diff --git a/deployments/base/DecentHatsCreationModule.json b/deployments/base/DecentHatsCreationModule.json index 1932727..e0eb319 100644 --- a/deployments/base/DecentHatsCreationModule.json +++ b/deployments/base/DecentHatsCreationModule.json @@ -1,5 +1,5 @@ { - "address": "0x5843E6fa58163453A0A753a831E3BbdB2da06259", + "address": "0xD3Ec453029d9FCdc33d36640aFf250F4ac609B11", "abi": [ { "inputs": [], @@ -222,28 +222,28 @@ "type": "function" } ], - "transactionHash": "0x08c1e4b365e4a754ed0cee88c09dd6d86e81d2f3254becfa3cf6404a30fdb381", + "transactionHash": "0x0a374ee4a2aa63733ab8045d1b6b37229aaac3ce6909c2ea0e23346bbd7a93a1", "receipt": { "to": null, "from": "0xb5Ca125166C1987A35EDD550E16846Fa1e1D9bB3", - "contractAddress": "0x5843E6fa58163453A0A753a831E3BbdB2da06259", - "transactionIndex": 100, - "gasUsed": "1751463", + "contractAddress": "0xD3Ec453029d9FCdc33d36640aFf250F4ac609B11", + "transactionIndex": 82, + "gasUsed": "1887591", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xc9cd3f6abe6d9cc71e9be39a4707529eb4d43e88b48d51ba192d8d6c30484707", - "transactionHash": "0x08c1e4b365e4a754ed0cee88c09dd6d86e81d2f3254becfa3cf6404a30fdb381", + "blockHash": "0xa6623703dc71c1df2b659a475cbf5469123a961722f958e8d4ad37451dc62b0a", + "transactionHash": "0x0a374ee4a2aa63733ab8045d1b6b37229aaac3ce6909c2ea0e23346bbd7a93a1", "logs": [], - "blockNumber": 22022651, - "cumulativeGasUsed": "18102156", + "blockNumber": 22747340, + "cumulativeGasUsed": "14504546", "status": 1, "byzantium": true }, "args": [], - "numDeployments": 1, - "solcInputHash": "e3ec7808efccf5e6b24e16a29ead3983", - "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"SALT\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"contract IHats\",\"name\":\"hatsProtocol\",\"type\":\"address\"},{\"internalType\":\"contract IERC6551Registry\",\"name\":\"erc6551Registry\",\"type\":\"address\"},{\"internalType\":\"contract IHatsModuleFactory\",\"name\":\"hatsModuleFactory\",\"type\":\"address\"},{\"internalType\":\"contract ModuleProxyFactory\",\"name\":\"moduleProxyFactory\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"keyValuePairs\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"decentAutonomousAdminImplementation\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"hatsAccountImplementation\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"hatsElectionsEligibilityImplementation\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"string\",\"name\":\"details\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"imageURI\",\"type\":\"string\"}],\"internalType\":\"struct DecentHatsCreationModule.TopHatParams\",\"name\":\"topHat\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"string\",\"name\":\"details\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"imageURI\",\"type\":\"string\"},{\"internalType\":\"bool\",\"name\":\"isMutable\",\"type\":\"bool\"}],\"internalType\":\"struct DecentHatsCreationModule.AdminHatParams\",\"name\":\"adminHat\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"wearer\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"details\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"imageURI\",\"type\":\"string\"},{\"components\":[{\"internalType\":\"contract ISablierV2LockupLinear\",\"name\":\"sablier\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint40\",\"name\":\"start\",\"type\":\"uint40\"},{\"internalType\":\"uint40\",\"name\":\"cliff\",\"type\":\"uint40\"},{\"internalType\":\"uint40\",\"name\":\"end\",\"type\":\"uint40\"}],\"internalType\":\"struct LockupLinear.Timestamps\",\"name\":\"timestamps\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"UD60x18\",\"name\":\"fee\",\"type\":\"uint256\"}],\"internalType\":\"struct Broker\",\"name\":\"broker\",\"type\":\"tuple\"},{\"internalType\":\"uint128\",\"name\":\"totalAmount\",\"type\":\"uint128\"},{\"internalType\":\"bool\",\"name\":\"cancelable\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"transferable\",\"type\":\"bool\"}],\"internalType\":\"struct DecentHatsModuleUtils.SablierStreamParams[]\",\"name\":\"sablierStreamsParams\",\"type\":\"tuple[]\"},{\"internalType\":\"uint128\",\"name\":\"termEndDateTs\",\"type\":\"uint128\"},{\"internalType\":\"uint32\",\"name\":\"maxSupply\",\"type\":\"uint32\"},{\"internalType\":\"bool\",\"name\":\"isMutable\",\"type\":\"bool\"}],\"internalType\":\"struct DecentHatsModuleUtils.HatParams[]\",\"name\":\"hats\",\"type\":\"tuple[]\"}],\"internalType\":\"struct DecentHatsCreationModule.CreateTreeParams\",\"name\":\"treeParams\",\"type\":\"tuple\"}],\"name\":\"createAndDeclareTree\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"createAndDeclareTree((address,address,address,address,address,address,address,address,(string,string),(string,string,bool),(address,string,string,(address,address,address,(uint40,uint40,uint40),(address,uint256),uint128,bool,bool)[],uint128,uint32,bool)[]))\":{\"details\":\"For each hat that is included, if the hat is: - termed, its stream funds on are targeted directly at the nominated wearer. The wearer should directly call `withdraw-` on the Sablier contract. - untermed, its stream funds are targeted at the hat's smart account. In order to withdraw funds from the stream, the hat's smart account must be the one call to `withdraw-` on the Sablier contract, setting the recipient arg to its wearer.In order for a Safe to seamlessly create roles even if it has never previously created a role and thus has no hat tree, we defer the creation of the hat tree and its setup to this contract. This way, in a single tx block, the resulting topHatId of the newly created hat can be used to create an admin hat and any other hats needed. We also make use of `KeyValuePairs` to associate the topHatId with the Safe.\",\"params\":{\"treeParams\":\"The parameters for creating the Hat Tree with Roles\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"createAndDeclareTree((address,address,address,address,address,address,address,address,(string,string),(string,string,bool),(address,string,string,(address,address,address,(uint40,uint40,uint40),(address,uint256),uint128,bool,bool)[],uint128,uint32,bool)[]))\":{\"notice\":\"For a safe without any roles previously created on it, this function should be called. It sets up the top hat and admin hat, as well as any other hats and their streams that are provided, then transfers the top hat to the calling safe.This contract should be enabled a module on the Safe for which the role(s) are to be created, and disabled after.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/modules/DecentHatsCreationModule.sol\":\"DecentHatsCreationModule\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\npragma solidity >=0.7.0 <0.9.0;\\n\\n/// @title Enum - Collection of enums\\n/// @author Richard Meissner - \\ncontract Enum {\\n enum Operation {Call, DelegateCall}\\n}\\n\",\"keccak256\":\"0x473e45b1a5cc47be494b0e123c9127f0c11c1e0992a321ae5a644c0bfdb2c14f\",\"license\":\"LGPL-3.0-only\"},\"@gnosis.pm/zodiac/contracts/factory/ModuleProxyFactory.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\npragma solidity >=0.8.0;\\n\\ncontract ModuleProxyFactory {\\n event ModuleProxyCreation(\\n address indexed proxy,\\n address indexed masterCopy\\n );\\n\\n /// `target` can not be zero.\\n error ZeroAddress(address target);\\n\\n /// `address_` is already taken.\\n error TakenAddress(address address_);\\n\\n /// @notice Initialization failed.\\n error FailedInitialization();\\n\\n function createProxy(address target, bytes32 salt)\\n internal\\n returns (address result)\\n {\\n if (address(target) == address(0)) revert ZeroAddress(target);\\n bytes memory deployment = abi.encodePacked(\\n hex\\\"602d8060093d393df3363d3d373d3d3d363d73\\\",\\n target,\\n hex\\\"5af43d82803e903d91602b57fd5bf3\\\"\\n );\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n result := create2(0, add(deployment, 0x20), mload(deployment), salt)\\n }\\n if (result == address(0)) revert TakenAddress(result);\\n }\\n\\n function deployModule(\\n address masterCopy,\\n bytes memory initializer,\\n uint256 saltNonce\\n ) public returns (address proxy) {\\n proxy = createProxy(\\n masterCopy,\\n keccak256(abi.encodePacked(keccak256(initializer), saltNonce))\\n );\\n (bool success, ) = proxy.call(initializer);\\n if (!success) revert FailedInitialization();\\n\\n emit ModuleProxyCreation(proxy, masterCopy);\\n }\\n}\\n\",\"keccak256\":\"0x70f6f1d88cf3382748e58f85ba87279f5bb8761863c293dd8c197a71ff558761\",\"license\":\"LGPL-3.0-only\"},\"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\n\\n/// @title Zodiac Avatar - A contract that manages modules that can execute transactions via this contract.\\npragma solidity >=0.7.0 <0.9.0;\\n\\nimport \\\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\\\";\\n\\ninterface IAvatar {\\n event EnabledModule(address module);\\n event DisabledModule(address module);\\n event ExecutionFromModuleSuccess(address indexed module);\\n event ExecutionFromModuleFailure(address indexed module);\\n\\n /// @dev Enables a module on the avatar.\\n /// @notice Can only be called by the avatar.\\n /// @notice Modules should be stored as a linked list.\\n /// @notice Must emit EnabledModule(address module) if successful.\\n /// @param module Module to be enabled.\\n function enableModule(address module) external;\\n\\n /// @dev Disables a module on the avatar.\\n /// @notice Can only be called by the avatar.\\n /// @notice Must emit DisabledModule(address module) if successful.\\n /// @param prevModule Address that pointed to the module to be removed in the linked list\\n /// @param module Module to be removed.\\n function disableModule(address prevModule, address module) external;\\n\\n /// @dev Allows a Module to execute a transaction.\\n /// @notice Can only be called by an enabled module.\\n /// @notice Must emit ExecutionFromModuleSuccess(address module) if successful.\\n /// @notice Must emit ExecutionFromModuleFailure(address module) if unsuccessful.\\n /// @param to Destination address of module transaction.\\n /// @param value Ether value of module transaction.\\n /// @param data Data payload of module transaction.\\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\\n function execTransactionFromModule(\\n address to,\\n uint256 value,\\n bytes memory data,\\n Enum.Operation operation\\n ) external returns (bool success);\\n\\n /// @dev Allows a Module to execute a transaction and return data\\n /// @notice Can only be called by an enabled module.\\n /// @notice Must emit ExecutionFromModuleSuccess(address module) if successful.\\n /// @notice Must emit ExecutionFromModuleFailure(address module) if unsuccessful.\\n /// @param to Destination address of module transaction.\\n /// @param value Ether value of module transaction.\\n /// @param data Data payload of module transaction.\\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\\n function execTransactionFromModuleReturnData(\\n address to,\\n uint256 value,\\n bytes memory data,\\n Enum.Operation operation\\n ) external returns (bool success, bytes memory returnData);\\n\\n /// @dev Returns if an module is enabled\\n /// @return True if the module is enabled\\n function isModuleEnabled(address module) external view returns (bool);\\n\\n /// @dev Returns array of modules.\\n /// @param start Start of the page.\\n /// @param pageSize Maximum number of modules that should be returned.\\n /// @return array Array of modules.\\n /// @return next Start of the next page.\\n function getModulesPaginated(address start, uint256 pageSize)\\n external\\n view\\n returns (address[] memory array, address next);\\n}\\n\",\"keccak256\":\"0xcd5508ffe596eef8fbccfd5fc4f10a34397773547ce64e212d48b5212865ec1f\",\"license\":\"LGPL-3.0-only\"},\"@openzeppelin/contracts/interfaces/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/introspection/IERC165.sol\\\";\\n\",\"keccak256\":\"0xd04b0f06e0666f29cf7cccc82894de541e19bb30a765b107b1e40bb7fe5f7d7a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev 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 amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `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 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes calldata data\\n ) external;\\n\\n /**\\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 {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the caller.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool _approved) external;\\n\\n /**\\n * @dev Returns 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\",\"keccak256\":\"0xed6a749c5373af398105ce6ee3ac4763aa450ea7285d268c85d9eeca809cdb1f\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../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\",\"keccak256\":\"0x75b829ff2f26c14355d1cba20e16fe7b29ca58eb5fef665ede48bc0f9c6c74b9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _HEX_SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\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 // Inspired by OraclizeAPI's implementation - MIT licence\\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\\n\\n if (value == 0) {\\n return \\\"0\\\";\\n }\\n uint256 temp = value;\\n uint256 digits;\\n while (temp != 0) {\\n digits++;\\n temp /= 10;\\n }\\n bytes memory buffer = new bytes(digits);\\n while (value != 0) {\\n digits -= 1;\\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\\n value /= 10;\\n }\\n return string(buffer);\\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 if (value == 0) {\\n return \\\"0x00\\\";\\n }\\n uint256 temp = value;\\n uint256 length = 0;\\n while (temp != 0) {\\n length++;\\n temp >>= 8;\\n }\\n return toHexString(value, length);\\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 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_SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\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 representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n}\\n\",\"keccak256\":\"0xaf159a8b1923ad2a26d516089bceca9bdeaeacd04be50983ea00ba63070f08a3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"@prb/math/src/Common.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\n// Common.sol\\n//\\n// Common mathematical functions used in both SD59x18 and UD60x18. Note that these global functions do not\\n// always operate with SD59x18 and UD60x18 numbers.\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CUSTOM ERRORS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @notice Thrown when the resultant value in {mulDiv} overflows uint256.\\nerror PRBMath_MulDiv_Overflow(uint256 x, uint256 y, uint256 denominator);\\n\\n/// @notice Thrown when the resultant value in {mulDiv18} overflows uint256.\\nerror PRBMath_MulDiv18_Overflow(uint256 x, uint256 y);\\n\\n/// @notice Thrown when one of the inputs passed to {mulDivSigned} is `type(int256).min`.\\nerror PRBMath_MulDivSigned_InputTooSmall();\\n\\n/// @notice Thrown when the resultant value in {mulDivSigned} overflows int256.\\nerror PRBMath_MulDivSigned_Overflow(int256 x, int256 y);\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CONSTANTS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @dev The maximum value a uint128 number can have.\\nuint128 constant MAX_UINT128 = type(uint128).max;\\n\\n/// @dev The maximum value a uint40 number can have.\\nuint40 constant MAX_UINT40 = type(uint40).max;\\n\\n/// @dev The unit number, which the decimal precision of the fixed-point types.\\nuint256 constant UNIT = 1e18;\\n\\n/// @dev The unit number inverted mod 2^256.\\nuint256 constant UNIT_INVERSE = 78156646155174841979727994598816262306175212592076161876661_508869554232690281;\\n\\n/// @dev The the largest power of two that divides the decimal value of `UNIT`. The logarithm of this value is the least significant\\n/// bit in the binary representation of `UNIT`.\\nuint256 constant UNIT_LPOTD = 262144;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @notice Calculates the binary exponent of x using the binary fraction method.\\n/// @dev Has to use 192.64-bit fixed-point numbers. See https://ethereum.stackexchange.com/a/96594/24693.\\n/// @param x The exponent as an unsigned 192.64-bit fixed-point number.\\n/// @return result The result as an unsigned 60.18-decimal fixed-point number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp2(uint256 x) pure returns (uint256 result) {\\n unchecked {\\n // Start from 0.5 in the 192.64-bit fixed-point format.\\n result = 0x800000000000000000000000000000000000000000000000;\\n\\n // The following logic multiplies the result by $\\\\sqrt{2^{-i}}$ when the bit at position i is 1. Key points:\\n //\\n // 1. Intermediate results will not overflow, as the starting point is 2^191 and all magic factors are under 2^65.\\n // 2. The rationale for organizing the if statements into groups of 8 is gas savings. If the result of performing\\n // a bitwise AND operation between x and any value in the array [0x80; 0x40; 0x20; 0x10; 0x08; 0x04; 0x02; 0x01] is 1,\\n // we know that `x & 0xFF` is also 1.\\n if (x & 0xFF00000000000000 > 0) {\\n if (x & 0x8000000000000000 > 0) {\\n result = (result * 0x16A09E667F3BCC909) >> 64;\\n }\\n if (x & 0x4000000000000000 > 0) {\\n result = (result * 0x1306FE0A31B7152DF) >> 64;\\n }\\n if (x & 0x2000000000000000 > 0) {\\n result = (result * 0x1172B83C7D517ADCE) >> 64;\\n }\\n if (x & 0x1000000000000000 > 0) {\\n result = (result * 0x10B5586CF9890F62A) >> 64;\\n }\\n if (x & 0x800000000000000 > 0) {\\n result = (result * 0x1059B0D31585743AE) >> 64;\\n }\\n if (x & 0x400000000000000 > 0) {\\n result = (result * 0x102C9A3E778060EE7) >> 64;\\n }\\n if (x & 0x200000000000000 > 0) {\\n result = (result * 0x10163DA9FB33356D8) >> 64;\\n }\\n if (x & 0x100000000000000 > 0) {\\n result = (result * 0x100B1AFA5ABCBED61) >> 64;\\n }\\n }\\n\\n if (x & 0xFF000000000000 > 0) {\\n if (x & 0x80000000000000 > 0) {\\n result = (result * 0x10058C86DA1C09EA2) >> 64;\\n }\\n if (x & 0x40000000000000 > 0) {\\n result = (result * 0x1002C605E2E8CEC50) >> 64;\\n }\\n if (x & 0x20000000000000 > 0) {\\n result = (result * 0x100162F3904051FA1) >> 64;\\n }\\n if (x & 0x10000000000000 > 0) {\\n result = (result * 0x1000B175EFFDC76BA) >> 64;\\n }\\n if (x & 0x8000000000000 > 0) {\\n result = (result * 0x100058BA01FB9F96D) >> 64;\\n }\\n if (x & 0x4000000000000 > 0) {\\n result = (result * 0x10002C5CC37DA9492) >> 64;\\n }\\n if (x & 0x2000000000000 > 0) {\\n result = (result * 0x1000162E525EE0547) >> 64;\\n }\\n if (x & 0x1000000000000 > 0) {\\n result = (result * 0x10000B17255775C04) >> 64;\\n }\\n }\\n\\n if (x & 0xFF0000000000 > 0) {\\n if (x & 0x800000000000 > 0) {\\n result = (result * 0x1000058B91B5BC9AE) >> 64;\\n }\\n if (x & 0x400000000000 > 0) {\\n result = (result * 0x100002C5C89D5EC6D) >> 64;\\n }\\n if (x & 0x200000000000 > 0) {\\n result = (result * 0x10000162E43F4F831) >> 64;\\n }\\n if (x & 0x100000000000 > 0) {\\n result = (result * 0x100000B1721BCFC9A) >> 64;\\n }\\n if (x & 0x80000000000 > 0) {\\n result = (result * 0x10000058B90CF1E6E) >> 64;\\n }\\n if (x & 0x40000000000 > 0) {\\n result = (result * 0x1000002C5C863B73F) >> 64;\\n }\\n if (x & 0x20000000000 > 0) {\\n result = (result * 0x100000162E430E5A2) >> 64;\\n }\\n if (x & 0x10000000000 > 0) {\\n result = (result * 0x1000000B172183551) >> 64;\\n }\\n }\\n\\n if (x & 0xFF00000000 > 0) {\\n if (x & 0x8000000000 > 0) {\\n result = (result * 0x100000058B90C0B49) >> 64;\\n }\\n if (x & 0x4000000000 > 0) {\\n result = (result * 0x10000002C5C8601CC) >> 64;\\n }\\n if (x & 0x2000000000 > 0) {\\n result = (result * 0x1000000162E42FFF0) >> 64;\\n }\\n if (x & 0x1000000000 > 0) {\\n result = (result * 0x10000000B17217FBB) >> 64;\\n }\\n if (x & 0x800000000 > 0) {\\n result = (result * 0x1000000058B90BFCE) >> 64;\\n }\\n if (x & 0x400000000 > 0) {\\n result = (result * 0x100000002C5C85FE3) >> 64;\\n }\\n if (x & 0x200000000 > 0) {\\n result = (result * 0x10000000162E42FF1) >> 64;\\n }\\n if (x & 0x100000000 > 0) {\\n result = (result * 0x100000000B17217F8) >> 64;\\n }\\n }\\n\\n if (x & 0xFF000000 > 0) {\\n if (x & 0x80000000 > 0) {\\n result = (result * 0x10000000058B90BFC) >> 64;\\n }\\n if (x & 0x40000000 > 0) {\\n result = (result * 0x1000000002C5C85FE) >> 64;\\n }\\n if (x & 0x20000000 > 0) {\\n result = (result * 0x100000000162E42FF) >> 64;\\n }\\n if (x & 0x10000000 > 0) {\\n result = (result * 0x1000000000B17217F) >> 64;\\n }\\n if (x & 0x8000000 > 0) {\\n result = (result * 0x100000000058B90C0) >> 64;\\n }\\n if (x & 0x4000000 > 0) {\\n result = (result * 0x10000000002C5C860) >> 64;\\n }\\n if (x & 0x2000000 > 0) {\\n result = (result * 0x1000000000162E430) >> 64;\\n }\\n if (x & 0x1000000 > 0) {\\n result = (result * 0x10000000000B17218) >> 64;\\n }\\n }\\n\\n if (x & 0xFF0000 > 0) {\\n if (x & 0x800000 > 0) {\\n result = (result * 0x1000000000058B90C) >> 64;\\n }\\n if (x & 0x400000 > 0) {\\n result = (result * 0x100000000002C5C86) >> 64;\\n }\\n if (x & 0x200000 > 0) {\\n result = (result * 0x10000000000162E43) >> 64;\\n }\\n if (x & 0x100000 > 0) {\\n result = (result * 0x100000000000B1721) >> 64;\\n }\\n if (x & 0x80000 > 0) {\\n result = (result * 0x10000000000058B91) >> 64;\\n }\\n if (x & 0x40000 > 0) {\\n result = (result * 0x1000000000002C5C8) >> 64;\\n }\\n if (x & 0x20000 > 0) {\\n result = (result * 0x100000000000162E4) >> 64;\\n }\\n if (x & 0x10000 > 0) {\\n result = (result * 0x1000000000000B172) >> 64;\\n }\\n }\\n\\n if (x & 0xFF00 > 0) {\\n if (x & 0x8000 > 0) {\\n result = (result * 0x100000000000058B9) >> 64;\\n }\\n if (x & 0x4000 > 0) {\\n result = (result * 0x10000000000002C5D) >> 64;\\n }\\n if (x & 0x2000 > 0) {\\n result = (result * 0x1000000000000162E) >> 64;\\n }\\n if (x & 0x1000 > 0) {\\n result = (result * 0x10000000000000B17) >> 64;\\n }\\n if (x & 0x800 > 0) {\\n result = (result * 0x1000000000000058C) >> 64;\\n }\\n if (x & 0x400 > 0) {\\n result = (result * 0x100000000000002C6) >> 64;\\n }\\n if (x & 0x200 > 0) {\\n result = (result * 0x10000000000000163) >> 64;\\n }\\n if (x & 0x100 > 0) {\\n result = (result * 0x100000000000000B1) >> 64;\\n }\\n }\\n\\n if (x & 0xFF > 0) {\\n if (x & 0x80 > 0) {\\n result = (result * 0x10000000000000059) >> 64;\\n }\\n if (x & 0x40 > 0) {\\n result = (result * 0x1000000000000002C) >> 64;\\n }\\n if (x & 0x20 > 0) {\\n result = (result * 0x10000000000000016) >> 64;\\n }\\n if (x & 0x10 > 0) {\\n result = (result * 0x1000000000000000B) >> 64;\\n }\\n if (x & 0x8 > 0) {\\n result = (result * 0x10000000000000006) >> 64;\\n }\\n if (x & 0x4 > 0) {\\n result = (result * 0x10000000000000003) >> 64;\\n }\\n if (x & 0x2 > 0) {\\n result = (result * 0x10000000000000001) >> 64;\\n }\\n if (x & 0x1 > 0) {\\n result = (result * 0x10000000000000001) >> 64;\\n }\\n }\\n\\n // In the code snippet below, two operations are executed simultaneously:\\n //\\n // 1. The result is multiplied by $(2^n + 1)$, where $2^n$ represents the integer part, and the additional 1\\n // accounts for the initial guess of 0.5. This is achieved by subtracting from 191 instead of 192.\\n // 2. The result is then converted to an unsigned 60.18-decimal fixed-point format.\\n //\\n // The underlying logic is based on the relationship $2^{191-ip} = 2^{ip} / 2^{191}$, where $ip$ denotes the,\\n // integer part, $2^n$.\\n result *= UNIT;\\n result >>= (191 - (x >> 64));\\n }\\n}\\n\\n/// @notice Finds the zero-based index of the first 1 in the binary representation of x.\\n///\\n/// @dev See the note on \\\"msb\\\" in this Wikipedia article: https://en.wikipedia.org/wiki/Find_first_set\\n///\\n/// Each step in this implementation is equivalent to this high-level code:\\n///\\n/// ```solidity\\n/// if (x >= 2 ** 128) {\\n/// x >>= 128;\\n/// result += 128;\\n/// }\\n/// ```\\n///\\n/// Where 128 is replaced with each respective power of two factor. See the full high-level implementation here:\\n/// https://gist.github.com/PaulRBerg/f932f8693f2733e30c4d479e8e980948\\n///\\n/// The Yul instructions used below are:\\n///\\n/// - \\\"gt\\\" is \\\"greater than\\\"\\n/// - \\\"or\\\" is the OR bitwise operator\\n/// - \\\"shl\\\" is \\\"shift left\\\"\\n/// - \\\"shr\\\" is \\\"shift right\\\"\\n///\\n/// @param x The uint256 number for which to find the index of the most significant bit.\\n/// @return result The index of the most significant bit as a uint256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction msb(uint256 x) pure returns (uint256 result) {\\n // 2^128\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(7, gt(x, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^64\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(6, gt(x, 0xFFFFFFFFFFFFFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^32\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(5, gt(x, 0xFFFFFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^16\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(4, gt(x, 0xFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^8\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(3, gt(x, 0xFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^4\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(2, gt(x, 0xF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^2\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(1, gt(x, 0x3))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^1\\n // No need to shift x any more.\\n assembly (\\\"memory-safe\\\") {\\n let factor := gt(x, 0x1)\\n result := or(result, factor)\\n }\\n}\\n\\n/// @notice Calculates x*y\\u00f7denominator with 512-bit precision.\\n///\\n/// @dev Credits to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv.\\n///\\n/// Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - The denominator must not be zero.\\n/// - The result must fit in uint256.\\n///\\n/// @param x The multiplicand as a uint256.\\n/// @param y The multiplier as a uint256.\\n/// @param denominator The divisor as a uint256.\\n/// @return result The result as a uint256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mulDiv(uint256 x, uint256 y, uint256 denominator) pure returns (uint256 result) {\\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; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly (\\\"memory-safe\\\") {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\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 unchecked {\\n return prod0 / denominator;\\n }\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n if (prod1 >= denominator) {\\n revert PRBMath_MulDiv_Overflow(x, y, denominator);\\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 (\\\"memory-safe\\\") {\\n // Compute remainder using the mulmod Yul instruction.\\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 unchecked {\\n // Calculate the largest power of two divisor of the denominator using the unary operator ~. This operation cannot overflow\\n // because the denominator cannot be zero at this point in the function execution. The result is always >= 1.\\n // For more detail, see https://cs.stackexchange.com/q/138556/92363.\\n uint256 lpotdod = denominator & (~denominator + 1);\\n uint256 flippedLpotdod;\\n\\n assembly (\\\"memory-safe\\\") {\\n // Factor powers of two out of denominator.\\n denominator := div(denominator, lpotdod)\\n\\n // Divide [prod1 prod0] by lpotdod.\\n prod0 := div(prod0, lpotdod)\\n\\n // Get the flipped value `2^256 / lpotdod`. If the `lpotdod` is zero, the flipped value is one.\\n // `sub(0, lpotdod)` produces the two's complement version of `lpotdod`, which is equivalent to flipping all the bits.\\n // However, `div` interprets this value as an unsigned value: https://ethereum.stackexchange.com/q/147168/24693\\n flippedLpotdod := add(div(sub(0, lpotdod), lpotdod), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * flippedLpotdod;\\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 works\\n // 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 }\\n}\\n\\n/// @notice Calculates x*y\\u00f71e18 with 512-bit precision.\\n///\\n/// @dev A variant of {mulDiv} with constant folding, i.e. in which the denominator is hard coded to 1e18.\\n///\\n/// Notes:\\n/// - The body is purposely left uncommented; to understand how this works, see the documentation in {mulDiv}.\\n/// - The result is rounded toward zero.\\n/// - We take as an axiom that the result cannot be `MAX_UINT256` when x and y solve the following system of equations:\\n///\\n/// $$\\n/// \\\\begin{cases}\\n/// x * y = MAX\\\\_UINT256 * UNIT \\\\\\\\\\n/// (x * y) \\\\% UNIT \\\\geq \\\\frac{UNIT}{2}\\n/// \\\\end{cases}\\n/// $$\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {mulDiv}.\\n/// - The result must fit in uint256.\\n///\\n/// @param x The multiplicand as an unsigned 60.18-decimal fixed-point number.\\n/// @param y The multiplier as an unsigned 60.18-decimal fixed-point number.\\n/// @return result The result as an unsigned 60.18-decimal fixed-point number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mulDiv18(uint256 x, uint256 y) pure returns (uint256 result) {\\n uint256 prod0;\\n uint256 prod1;\\n assembly (\\\"memory-safe\\\") {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n if (prod1 == 0) {\\n unchecked {\\n return prod0 / UNIT;\\n }\\n }\\n\\n if (prod1 >= UNIT) {\\n revert PRBMath_MulDiv18_Overflow(x, y);\\n }\\n\\n uint256 remainder;\\n assembly (\\\"memory-safe\\\") {\\n remainder := mulmod(x, y, UNIT)\\n result :=\\n mul(\\n or(\\n div(sub(prod0, remainder), UNIT_LPOTD),\\n mul(sub(prod1, gt(remainder, prod0)), add(div(sub(0, UNIT_LPOTD), UNIT_LPOTD), 1))\\n ),\\n UNIT_INVERSE\\n )\\n }\\n}\\n\\n/// @notice Calculates x*y\\u00f7denominator with 512-bit precision.\\n///\\n/// @dev This is an extension of {mulDiv} for signed numbers, which works by computing the signs and the absolute values separately.\\n///\\n/// Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {mulDiv}.\\n/// - None of the inputs can be `type(int256).min`.\\n/// - The result must fit in int256.\\n///\\n/// @param x The multiplicand as an int256.\\n/// @param y The multiplier as an int256.\\n/// @param denominator The divisor as an int256.\\n/// @return result The result as an int256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mulDivSigned(int256 x, int256 y, int256 denominator) pure returns (int256 result) {\\n if (x == type(int256).min || y == type(int256).min || denominator == type(int256).min) {\\n revert PRBMath_MulDivSigned_InputTooSmall();\\n }\\n\\n // Get hold of the absolute values of x, y and the denominator.\\n uint256 xAbs;\\n uint256 yAbs;\\n uint256 dAbs;\\n unchecked {\\n xAbs = x < 0 ? uint256(-x) : uint256(x);\\n yAbs = y < 0 ? uint256(-y) : uint256(y);\\n dAbs = denominator < 0 ? uint256(-denominator) : uint256(denominator);\\n }\\n\\n // Compute the absolute value of x*y\\u00f7denominator. The result must fit in int256.\\n uint256 resultAbs = mulDiv(xAbs, yAbs, dAbs);\\n if (resultAbs > uint256(type(int256).max)) {\\n revert PRBMath_MulDivSigned_Overflow(x, y);\\n }\\n\\n // Get the signs of x, y and the denominator.\\n uint256 sx;\\n uint256 sy;\\n uint256 sd;\\n assembly (\\\"memory-safe\\\") {\\n // \\\"sgt\\\" is the \\\"signed greater than\\\" assembly instruction and \\\"sub(0,1)\\\" is -1 in two's complement.\\n sx := sgt(x, sub(0, 1))\\n sy := sgt(y, sub(0, 1))\\n sd := sgt(denominator, sub(0, 1))\\n }\\n\\n // XOR over sx, sy and sd. What this does is to check whether there are 1 or 3 negative signs in the inputs.\\n // If there are, the result should be negative. Otherwise, it should be positive.\\n unchecked {\\n result = sx ^ sy ^ sd == 0 ? -int256(resultAbs) : int256(resultAbs);\\n }\\n}\\n\\n/// @notice Calculates the square root of x using the Babylonian method.\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\\n///\\n/// Notes:\\n/// - If x is not a perfect square, the result is rounded down.\\n/// - Credits to OpenZeppelin for the explanations in comments below.\\n///\\n/// @param x The uint256 number for which to calculate the square root.\\n/// @return result The result as a uint256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction sqrt(uint256 x) pure returns (uint256 result) {\\n if (x == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we calculate the biggest power of 2 which is smaller than the square root of x.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of x is a power of 2 such that we have:\\n //\\n // $$\\n // msb(x) <= x <= 2*msb(x)$\\n // $$\\n //\\n // We write $msb(x)$ as $2^k$, and we get:\\n //\\n // $$\\n // k = log_2(x)\\n // $$\\n //\\n // Thus, we can write the initial inequality as:\\n //\\n // $$\\n // 2^{log_2(x)} <= x <= 2*2^{log_2(x)+1} \\\\\\\\\\n // sqrt(2^k) <= sqrt(x) < sqrt(2^{k+1}) \\\\\\\\\\n // 2^{k/2} <= sqrt(x) < 2^{(k+1)/2} <= 2^{(k/2)+1}\\n // $$\\n //\\n // Consequently, $2^{log_2(x) /2} is a good first approximation of sqrt(x) with at least one correct bit.\\n uint256 xAux = uint256(x);\\n result = 1;\\n if (xAux >= 2 ** 128) {\\n xAux >>= 128;\\n result <<= 64;\\n }\\n if (xAux >= 2 ** 64) {\\n xAux >>= 64;\\n result <<= 32;\\n }\\n if (xAux >= 2 ** 32) {\\n xAux >>= 32;\\n result <<= 16;\\n }\\n if (xAux >= 2 ** 16) {\\n xAux >>= 16;\\n result <<= 8;\\n }\\n if (xAux >= 2 ** 8) {\\n xAux >>= 8;\\n result <<= 4;\\n }\\n if (xAux >= 2 ** 4) {\\n xAux >>= 4;\\n result <<= 2;\\n }\\n if (xAux >= 2 ** 2) {\\n result <<= 1;\\n }\\n\\n // At this point, `result` is an estimation with at least one bit of precision. We know the true value has at\\n // most 128 bits, since it is the square root of a uint256. Newton's method converges quadratically (precision\\n // doubles at every iteration). We thus need at most 7 iteration to turn our partial result with one bit of\\n // precision into the expected uint128 result.\\n unchecked {\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n\\n // If x is not a perfect square, round the result toward zero.\\n uint256 roundedResult = x / result;\\n if (result >= roundedResult) {\\n result = roundedResult;\\n }\\n }\\n}\\n\",\"keccak256\":\"0xaa374e2c26cc93e8c22a6953804ee05f811597ef5fa82f76824378b22944778b\",\"license\":\"MIT\"},\"@prb/math/src/UD2x18.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\n/*\\n\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2550\\u2550\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2554\\u2588\\u2588\\u2588\\u2588\\u2554\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551 \\u255a\\u2550\\u255d \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\n\\n\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2550\\u2550\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d \\u255a\\u2588\\u2588\\u2588\\u2554\\u255d \\u255a\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u255d\\n\\n*/\\n\\nimport \\\"./ud2x18/Casting.sol\\\";\\nimport \\\"./ud2x18/Constants.sol\\\";\\nimport \\\"./ud2x18/Errors.sol\\\";\\nimport \\\"./ud2x18/ValueType.sol\\\";\\n\",\"keccak256\":\"0xfb624e24cd8bb790fa08e7827819de85504a86e20e961fa4ad126c65b6d90641\",\"license\":\"MIT\"},\"@prb/math/src/UD60x18.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\n/*\\n\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2550\\u2550\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2554\\u2588\\u2588\\u2588\\u2588\\u2554\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551 \\u255a\\u2550\\u255d \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\n\\n\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2550\\u2588\\u2588\\u2588\\u2588\\u2557\\u255a\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2588\\u2588\\u2551 \\u255a\\u2588\\u2588\\u2588\\u2554\\u255d \\u255a\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2554\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2554\\u255d \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u255d\\n\\n*/\\n\\nimport \\\"./ud60x18/Casting.sol\\\";\\nimport \\\"./ud60x18/Constants.sol\\\";\\nimport \\\"./ud60x18/Conversions.sol\\\";\\nimport \\\"./ud60x18/Errors.sol\\\";\\nimport \\\"./ud60x18/Helpers.sol\\\";\\nimport \\\"./ud60x18/Math.sol\\\";\\nimport \\\"./ud60x18/ValueType.sol\\\";\\n\",\"keccak256\":\"0xb98c6f74275914d279e8af6c502c2b1f50d5f6e1ed418d3b0153f5a193206c48\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as CastingErrors;\\nimport { SD59x18 } from \\\"../sd59x18/ValueType.sol\\\";\\nimport { UD2x18 } from \\\"../ud2x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"../ud60x18/ValueType.sol\\\";\\nimport { SD1x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts an SD1x18 number into SD59x18.\\n/// @dev There is no overflow check because the domain of SD1x18 is a subset of SD59x18.\\nfunction intoSD59x18(SD1x18 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(int256(SD1x18.unwrap(x)));\\n}\\n\\n/// @notice Casts an SD1x18 number into UD2x18.\\n/// - x must be positive.\\nfunction intoUD2x18(SD1x18 x) pure returns (UD2x18 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUD2x18_Underflow(x);\\n }\\n result = UD2x18.wrap(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into UD60x18.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUD60x18(SD1x18 x) pure returns (UD60x18 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUD60x18_Underflow(x);\\n }\\n result = UD60x18.wrap(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into uint256.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUint256(SD1x18 x) pure returns (uint256 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint256_Underflow(x);\\n }\\n result = uint256(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into uint128.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUint128(SD1x18 x) pure returns (uint128 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint128_Underflow(x);\\n }\\n result = uint128(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(SD1x18 x) pure returns (uint40 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint40_Underflow(x);\\n }\\n if (xInt > int64(uint64(Common.MAX_UINT40))) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint40_Overflow(x);\\n }\\n result = uint40(uint64(xInt));\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction sd1x18(int64 x) pure returns (SD1x18 result) {\\n result = SD1x18.wrap(x);\\n}\\n\\n/// @notice Unwraps an SD1x18 number into int64.\\nfunction unwrap(SD1x18 x) pure returns (int64 result) {\\n result = SD1x18.unwrap(x);\\n}\\n\\n/// @notice Wraps an int64 number into SD1x18.\\nfunction wrap(int64 x) pure returns (SD1x18 result) {\\n result = SD1x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x9e49e2b37c1bb845861740805edaaef3fe951a7b96eef16ce84fbf76e8278670\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD1x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @dev Euler's number as an SD1x18 number.\\nSD1x18 constant E = SD1x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum value an SD1x18 number can have.\\nint64 constant uMAX_SD1x18 = 9_223372036854775807;\\nSD1x18 constant MAX_SD1x18 = SD1x18.wrap(uMAX_SD1x18);\\n\\n/// @dev The maximum value an SD1x18 number can have.\\nint64 constant uMIN_SD1x18 = -9_223372036854775808;\\nSD1x18 constant MIN_SD1x18 = SD1x18.wrap(uMIN_SD1x18);\\n\\n/// @dev PI as an SD1x18 number.\\nSD1x18 constant PI = SD1x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of SD1x18.\\nSD1x18 constant UNIT = SD1x18.wrap(1e18);\\nint64 constant uUNIT = 1e18;\\n\",\"keccak256\":\"0x6496165b80552785a4b65a239b96e2a5fedf62fe54f002eeed72d75e566d7585\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD1x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in UD2x18.\\nerror PRBMath_SD1x18_ToUD2x18_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in UD60x18.\\nerror PRBMath_SD1x18_ToUD60x18_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint128.\\nerror PRBMath_SD1x18_ToUint128_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint256.\\nerror PRBMath_SD1x18_ToUint256_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint40.\\nerror PRBMath_SD1x18_ToUint40_Overflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint40.\\nerror PRBMath_SD1x18_ToUint40_Underflow(SD1x18 x);\\n\",\"keccak256\":\"0x836cb42ba619ca369fd4765bc47fefc3c3621369c5861882af14660aca5057ee\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\n\\n/// @notice The signed 1.18-decimal fixed-point number representation, which can have up to 1 digit and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\\n/// type int64. This is useful when end users want to use int64 to save gas, e.g. with tight variable packing in contract\\n/// storage.\\ntype SD1x18 is int64;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoSD59x18,\\n Casting.intoUD2x18,\\n Casting.intoUD60x18,\\n Casting.intoUint256,\\n Casting.intoUint128,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for SD1x18 global;\\n\",\"keccak256\":\"0x2f86f1aa9fca42f40808b51a879b406ac51817647bdb9642f8a79dd8fdb754a7\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Errors.sol\\\" as CastingErrors;\\nimport { MAX_UINT128, MAX_UINT40 } from \\\"../Common.sol\\\";\\nimport { uMAX_SD1x18, uMIN_SD1x18 } from \\\"../sd1x18/Constants.sol\\\";\\nimport { SD1x18 } from \\\"../sd1x18/ValueType.sol\\\";\\nimport { uMAX_UD2x18 } from \\\"../ud2x18/Constants.sol\\\";\\nimport { UD2x18 } from \\\"../ud2x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"../ud60x18/ValueType.sol\\\";\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts an SD59x18 number into int256.\\n/// @dev This is basically a functional alias for {unwrap}.\\nfunction intoInt256(SD59x18 x) pure returns (int256 result) {\\n result = SD59x18.unwrap(x);\\n}\\n\\n/// @notice Casts an SD59x18 number into SD1x18.\\n/// @dev Requirements:\\n/// - x must be greater than or equal to `uMIN_SD1x18`.\\n/// - x must be less than or equal to `uMAX_SD1x18`.\\nfunction intoSD1x18(SD59x18 x) pure returns (SD1x18 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < uMIN_SD1x18) {\\n revert CastingErrors.PRBMath_SD59x18_IntoSD1x18_Underflow(x);\\n }\\n if (xInt > uMAX_SD1x18) {\\n revert CastingErrors.PRBMath_SD59x18_IntoSD1x18_Overflow(x);\\n }\\n result = SD1x18.wrap(int64(xInt));\\n}\\n\\n/// @notice Casts an SD59x18 number into UD2x18.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `uMAX_UD2x18`.\\nfunction intoUD2x18(SD59x18 x) pure returns (UD2x18 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUD2x18_Underflow(x);\\n }\\n if (xInt > int256(uint256(uMAX_UD2x18))) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUD2x18_Overflow(x);\\n }\\n result = UD2x18.wrap(uint64(uint256(xInt)));\\n}\\n\\n/// @notice Casts an SD59x18 number into UD60x18.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUD60x18(SD59x18 x) pure returns (UD60x18 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUD60x18_Underflow(x);\\n }\\n result = UD60x18.wrap(uint256(xInt));\\n}\\n\\n/// @notice Casts an SD59x18 number into uint256.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUint256(SD59x18 x) pure returns (uint256 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint256_Underflow(x);\\n }\\n result = uint256(xInt);\\n}\\n\\n/// @notice Casts an SD59x18 number into uint128.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `uMAX_UINT128`.\\nfunction intoUint128(SD59x18 x) pure returns (uint128 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint128_Underflow(x);\\n }\\n if (xInt > int256(uint256(MAX_UINT128))) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint128_Overflow(x);\\n }\\n result = uint128(uint256(xInt));\\n}\\n\\n/// @notice Casts an SD59x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(SD59x18 x) pure returns (uint40 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint40_Underflow(x);\\n }\\n if (xInt > int256(uint256(MAX_UINT40))) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint40_Overflow(x);\\n }\\n result = uint40(uint256(xInt));\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction sd(int256 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(x);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction sd59x18(int256 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(x);\\n}\\n\\n/// @notice Unwraps an SD59x18 number into int256.\\nfunction unwrap(SD59x18 x) pure returns (int256 result) {\\n result = SD59x18.unwrap(x);\\n}\\n\\n/// @notice Wraps an int256 number into SD59x18.\\nfunction wrap(int256 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x3b21b60ec2998c3ae32f647412da51d3683b3f183a807198cc8d157499484f99\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n// NOTICE: the \\\"u\\\" prefix stands for \\\"unwrapped\\\".\\n\\n/// @dev Euler's number as an SD59x18 number.\\nSD59x18 constant E = SD59x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum input permitted in {exp}.\\nint256 constant uEXP_MAX_INPUT = 133_084258667509499440;\\nSD59x18 constant EXP_MAX_INPUT = SD59x18.wrap(uEXP_MAX_INPUT);\\n\\n/// @dev Any value less than this returns 0 in {exp}.\\nint256 constant uEXP_MIN_THRESHOLD = -41_446531673892822322;\\nSD59x18 constant EXP_MIN_THRESHOLD = SD59x18.wrap(uEXP_MIN_THRESHOLD);\\n\\n/// @dev The maximum input permitted in {exp2}.\\nint256 constant uEXP2_MAX_INPUT = 192e18 - 1;\\nSD59x18 constant EXP2_MAX_INPUT = SD59x18.wrap(uEXP2_MAX_INPUT);\\n\\n/// @dev Any value less than this returns 0 in {exp2}.\\nint256 constant uEXP2_MIN_THRESHOLD = -59_794705707972522261;\\nSD59x18 constant EXP2_MIN_THRESHOLD = SD59x18.wrap(uEXP2_MIN_THRESHOLD);\\n\\n/// @dev Half the UNIT number.\\nint256 constant uHALF_UNIT = 0.5e18;\\nSD59x18 constant HALF_UNIT = SD59x18.wrap(uHALF_UNIT);\\n\\n/// @dev $log_2(10)$ as an SD59x18 number.\\nint256 constant uLOG2_10 = 3_321928094887362347;\\nSD59x18 constant LOG2_10 = SD59x18.wrap(uLOG2_10);\\n\\n/// @dev $log_2(e)$ as an SD59x18 number.\\nint256 constant uLOG2_E = 1_442695040888963407;\\nSD59x18 constant LOG2_E = SD59x18.wrap(uLOG2_E);\\n\\n/// @dev The maximum value an SD59x18 number can have.\\nint256 constant uMAX_SD59x18 = 57896044618658097711785492504343953926634992332820282019728_792003956564819967;\\nSD59x18 constant MAX_SD59x18 = SD59x18.wrap(uMAX_SD59x18);\\n\\n/// @dev The maximum whole value an SD59x18 number can have.\\nint256 constant uMAX_WHOLE_SD59x18 = 57896044618658097711785492504343953926634992332820282019728_000000000000000000;\\nSD59x18 constant MAX_WHOLE_SD59x18 = SD59x18.wrap(uMAX_WHOLE_SD59x18);\\n\\n/// @dev The minimum value an SD59x18 number can have.\\nint256 constant uMIN_SD59x18 = -57896044618658097711785492504343953926634992332820282019728_792003956564819968;\\nSD59x18 constant MIN_SD59x18 = SD59x18.wrap(uMIN_SD59x18);\\n\\n/// @dev The minimum whole value an SD59x18 number can have.\\nint256 constant uMIN_WHOLE_SD59x18 = -57896044618658097711785492504343953926634992332820282019728_000000000000000000;\\nSD59x18 constant MIN_WHOLE_SD59x18 = SD59x18.wrap(uMIN_WHOLE_SD59x18);\\n\\n/// @dev PI as an SD59x18 number.\\nSD59x18 constant PI = SD59x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of SD59x18.\\nint256 constant uUNIT = 1e18;\\nSD59x18 constant UNIT = SD59x18.wrap(1e18);\\n\\n/// @dev The unit number squared.\\nint256 constant uUNIT_SQUARED = 1e36;\\nSD59x18 constant UNIT_SQUARED = SD59x18.wrap(uUNIT_SQUARED);\\n\\n/// @dev Zero as an SD59x18 number.\\nSD59x18 constant ZERO = SD59x18.wrap(0);\\n\",\"keccak256\":\"0x9bcb8dd6b3e886d140ad1c32747a4f6d29a492529ceb835be878ae837aa6cc3a\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when taking the absolute value of `MIN_SD59x18`.\\nerror PRBMath_SD59x18_Abs_MinSD59x18();\\n\\n/// @notice Thrown when ceiling a number overflows SD59x18.\\nerror PRBMath_SD59x18_Ceil_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when converting a basic integer to the fixed-point format overflows SD59x18.\\nerror PRBMath_SD59x18_Convert_Overflow(int256 x);\\n\\n/// @notice Thrown when converting a basic integer to the fixed-point format underflows SD59x18.\\nerror PRBMath_SD59x18_Convert_Underflow(int256 x);\\n\\n/// @notice Thrown when dividing two numbers and one of them is `MIN_SD59x18`.\\nerror PRBMath_SD59x18_Div_InputTooSmall();\\n\\n/// @notice Thrown when dividing two numbers and one of the intermediary unsigned results overflows SD59x18.\\nerror PRBMath_SD59x18_Div_Overflow(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when taking the natural exponent of a base greater than 133_084258667509499441.\\nerror PRBMath_SD59x18_Exp_InputTooBig(SD59x18 x);\\n\\n/// @notice Thrown when taking the binary exponent of a base greater than 192e18.\\nerror PRBMath_SD59x18_Exp2_InputTooBig(SD59x18 x);\\n\\n/// @notice Thrown when flooring a number underflows SD59x18.\\nerror PRBMath_SD59x18_Floor_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when taking the geometric mean of two numbers and their product is negative.\\nerror PRBMath_SD59x18_Gm_NegativeProduct(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when taking the geometric mean of two numbers and multiplying them overflows SD59x18.\\nerror PRBMath_SD59x18_Gm_Overflow(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\\nerror PRBMath_SD59x18_IntoSD1x18_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\\nerror PRBMath_SD59x18_IntoSD1x18_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\\nerror PRBMath_SD59x18_IntoUD2x18_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\\nerror PRBMath_SD59x18_IntoUD2x18_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD60x18.\\nerror PRBMath_SD59x18_IntoUD60x18_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\\nerror PRBMath_SD59x18_IntoUint128_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\\nerror PRBMath_SD59x18_IntoUint128_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint256.\\nerror PRBMath_SD59x18_IntoUint256_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\\nerror PRBMath_SD59x18_IntoUint40_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\\nerror PRBMath_SD59x18_IntoUint40_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when taking the logarithm of a number less than or equal to zero.\\nerror PRBMath_SD59x18_Log_InputTooSmall(SD59x18 x);\\n\\n/// @notice Thrown when multiplying two numbers and one of the inputs is `MIN_SD59x18`.\\nerror PRBMath_SD59x18_Mul_InputTooSmall();\\n\\n/// @notice Thrown when multiplying two numbers and the intermediary absolute result overflows SD59x18.\\nerror PRBMath_SD59x18_Mul_Overflow(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when raising a number to a power and the intermediary absolute result overflows SD59x18.\\nerror PRBMath_SD59x18_Powu_Overflow(SD59x18 x, uint256 y);\\n\\n/// @notice Thrown when taking the square root of a negative number.\\nerror PRBMath_SD59x18_Sqrt_NegativeInput(SD59x18 x);\\n\\n/// @notice Thrown when the calculating the square root overflows SD59x18.\\nerror PRBMath_SD59x18_Sqrt_Overflow(SD59x18 x);\\n\",\"keccak256\":\"0xa6d00fe5efa215ac0df25c896e3da99a12fb61e799644b2ec32da947313d3db4\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Helpers.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { wrap } from \\\"./Casting.sol\\\";\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Implements the checked addition operation (+) in the SD59x18 type.\\nfunction add(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n return wrap(x.unwrap() + y.unwrap());\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the SD59x18 type.\\nfunction and(SD59x18 x, int256 bits) pure returns (SD59x18 result) {\\n return wrap(x.unwrap() & bits);\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the SD59x18 type.\\nfunction and2(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n return wrap(x.unwrap() & y.unwrap());\\n}\\n\\n/// @notice Implements the equal (=) operation in the SD59x18 type.\\nfunction eq(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() == y.unwrap();\\n}\\n\\n/// @notice Implements the greater than operation (>) in the SD59x18 type.\\nfunction gt(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() > y.unwrap();\\n}\\n\\n/// @notice Implements the greater than or equal to operation (>=) in the SD59x18 type.\\nfunction gte(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() >= y.unwrap();\\n}\\n\\n/// @notice Implements a zero comparison check function in the SD59x18 type.\\nfunction isZero(SD59x18 x) pure returns (bool result) {\\n result = x.unwrap() == 0;\\n}\\n\\n/// @notice Implements the left shift operation (<<) in the SD59x18 type.\\nfunction lshift(SD59x18 x, uint256 bits) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() << bits);\\n}\\n\\n/// @notice Implements the lower than operation (<) in the SD59x18 type.\\nfunction lt(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() < y.unwrap();\\n}\\n\\n/// @notice Implements the lower than or equal to operation (<=) in the SD59x18 type.\\nfunction lte(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() <= y.unwrap();\\n}\\n\\n/// @notice Implements the unchecked modulo operation (%) in the SD59x18 type.\\nfunction mod(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() % y.unwrap());\\n}\\n\\n/// @notice Implements the not equal operation (!=) in the SD59x18 type.\\nfunction neq(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() != y.unwrap();\\n}\\n\\n/// @notice Implements the NOT (~) bitwise operation in the SD59x18 type.\\nfunction not(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(~x.unwrap());\\n}\\n\\n/// @notice Implements the OR (|) bitwise operation in the SD59x18 type.\\nfunction or(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() | y.unwrap());\\n}\\n\\n/// @notice Implements the right shift operation (>>) in the SD59x18 type.\\nfunction rshift(SD59x18 x, uint256 bits) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() >> bits);\\n}\\n\\n/// @notice Implements the checked subtraction operation (-) in the SD59x18 type.\\nfunction sub(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() - y.unwrap());\\n}\\n\\n/// @notice Implements the checked unary minus operation (-) in the SD59x18 type.\\nfunction unary(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(-x.unwrap());\\n}\\n\\n/// @notice Implements the unchecked addition operation (+) in the SD59x18 type.\\nfunction uncheckedAdd(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() + y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the unchecked subtraction operation (-) in the SD59x18 type.\\nfunction uncheckedSub(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() - y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the unchecked unary minus operation (-) in the SD59x18 type.\\nfunction uncheckedUnary(SD59x18 x) pure returns (SD59x18 result) {\\n unchecked {\\n result = wrap(-x.unwrap());\\n }\\n}\\n\\n/// @notice Implements the XOR (^) bitwise operation in the SD59x18 type.\\nfunction xor(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() ^ y.unwrap());\\n}\\n\",\"keccak256\":\"0x208570f1657cf730cb6c3d81aa14030e0d45cf906cdedea5059369d7df4bb716\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as Errors;\\nimport {\\n uEXP_MAX_INPUT,\\n uEXP2_MAX_INPUT,\\n uEXP_MIN_THRESHOLD,\\n uEXP2_MIN_THRESHOLD,\\n uHALF_UNIT,\\n uLOG2_10,\\n uLOG2_E,\\n uMAX_SD59x18,\\n uMAX_WHOLE_SD59x18,\\n uMIN_SD59x18,\\n uMIN_WHOLE_SD59x18,\\n UNIT,\\n uUNIT,\\n uUNIT_SQUARED,\\n ZERO\\n} from \\\"./Constants.sol\\\";\\nimport { wrap } from \\\"./Helpers.sol\\\";\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Calculates the absolute value of x.\\n///\\n/// @dev Requirements:\\n/// - x must be greater than `MIN_SD59x18`.\\n///\\n/// @param x The SD59x18 number for which to calculate the absolute value.\\n/// @param result The absolute value of x as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction abs(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt == uMIN_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Abs_MinSD59x18();\\n }\\n result = xInt < 0 ? wrap(-xInt) : x;\\n}\\n\\n/// @notice Calculates the arithmetic average of x and y.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// @param x The first operand as an SD59x18 number.\\n/// @param y The second operand as an SD59x18 number.\\n/// @return result The arithmetic average as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction avg(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n\\n unchecked {\\n // This operation is equivalent to `x / 2 + y / 2`, and it can never overflow.\\n int256 sum = (xInt >> 1) + (yInt >> 1);\\n\\n if (sum < 0) {\\n // If at least one of x and y is odd, add 1 to the result, because shifting negative numbers to the right\\n // rounds toward negative infinity. The right part is equivalent to `sum + (x % 2 == 1 || y % 2 == 1)`.\\n assembly (\\\"memory-safe\\\") {\\n result := add(sum, and(or(xInt, yInt), 1))\\n }\\n } else {\\n // Add 1 if both x and y are odd to account for the double 0.5 remainder truncated after shifting.\\n result = wrap(sum + (xInt & yInt & 1));\\n }\\n }\\n}\\n\\n/// @notice Yields the smallest whole number greater than or equal to x.\\n///\\n/// @dev Optimized for fractional value inputs, because every whole value has (1e18 - 1) fractional counterparts.\\n/// See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n///\\n/// Requirements:\\n/// - x must be less than or equal to `MAX_WHOLE_SD59x18`.\\n///\\n/// @param x The SD59x18 number to ceil.\\n/// @param result The smallest whole number greater than or equal to x, as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ceil(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt > uMAX_WHOLE_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Ceil_Overflow(x);\\n }\\n\\n int256 remainder = xInt % uUNIT;\\n if (remainder == 0) {\\n result = x;\\n } else {\\n unchecked {\\n // Solidity uses C fmod style, which returns a modulus with the same sign as x.\\n int256 resultInt = xInt - remainder;\\n if (xInt > 0) {\\n resultInt += uUNIT;\\n }\\n result = wrap(resultInt);\\n }\\n }\\n}\\n\\n/// @notice Divides two SD59x18 numbers, returning a new SD59x18 number.\\n///\\n/// @dev This is an extension of {Common.mulDiv} for signed numbers, which works by computing the signs and the absolute\\n/// values separately.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv}.\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv}.\\n/// - None of the inputs can be `MIN_SD59x18`.\\n/// - The denominator must not be zero.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The numerator as an SD59x18 number.\\n/// @param y The denominator as an SD59x18 number.\\n/// @param result The quotient as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction div(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n if (xInt == uMIN_SD59x18 || yInt == uMIN_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Div_InputTooSmall();\\n }\\n\\n // Get hold of the absolute values of x and y.\\n uint256 xAbs;\\n uint256 yAbs;\\n unchecked {\\n xAbs = xInt < 0 ? uint256(-xInt) : uint256(xInt);\\n yAbs = yInt < 0 ? uint256(-yInt) : uint256(yInt);\\n }\\n\\n // Compute the absolute value (x*UNIT\\u00f7y). The resulting value must fit in SD59x18.\\n uint256 resultAbs = Common.mulDiv(xAbs, uint256(uUNIT), yAbs);\\n if (resultAbs > uint256(uMAX_SD59x18)) {\\n revert Errors.PRBMath_SD59x18_Div_Overflow(x, y);\\n }\\n\\n // Check if x and y have the same sign using two's complement representation. The left-most bit represents the sign (1 for\\n // negative, 0 for positive or zero).\\n bool sameSign = (xInt ^ yInt) > -1;\\n\\n // If the inputs have the same sign, the result should be positive. Otherwise, it should be negative.\\n unchecked {\\n result = wrap(sameSign ? int256(resultAbs) : -int256(resultAbs));\\n }\\n}\\n\\n/// @notice Calculates the natural exponent of x using the following formula:\\n///\\n/// $$\\n/// e^x = 2^{x * log_2{e}}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {exp2}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {exp2}.\\n/// - x must be less than 133_084258667509499441.\\n///\\n/// @param x The exponent as an SD59x18 number.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n\\n // Any input less than the threshold returns zero.\\n // This check also prevents an overflow for very small numbers.\\n if (xInt < uEXP_MIN_THRESHOLD) {\\n return ZERO;\\n }\\n\\n // This check prevents values greater than 192e18 from being passed to {exp2}.\\n if (xInt > uEXP_MAX_INPUT) {\\n revert Errors.PRBMath_SD59x18_Exp_InputTooBig(x);\\n }\\n\\n unchecked {\\n // Inline the fixed-point multiplication to save gas.\\n int256 doubleUnitProduct = xInt * uLOG2_E;\\n result = exp2(wrap(doubleUnitProduct / uUNIT));\\n }\\n}\\n\\n/// @notice Calculates the binary exponent of x using the binary fraction method using the following formula:\\n///\\n/// $$\\n/// 2^{-x} = \\\\frac{1}{2^x}\\n/// $$\\n///\\n/// @dev See https://ethereum.stackexchange.com/q/79903/24693.\\n///\\n/// Notes:\\n/// - If x is less than -59_794705707972522261, the result is zero.\\n///\\n/// Requirements:\\n/// - x must be less than 192e18.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The exponent as an SD59x18 number.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp2(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < 0) {\\n // The inverse of any number less than the threshold is truncated to zero.\\n if (xInt < uEXP2_MIN_THRESHOLD) {\\n return ZERO;\\n }\\n\\n unchecked {\\n // Inline the fixed-point inversion to save gas.\\n result = wrap(uUNIT_SQUARED / exp2(wrap(-xInt)).unwrap());\\n }\\n } else {\\n // Numbers greater than or equal to 192e18 don't fit in the 192.64-bit format.\\n if (xInt > uEXP2_MAX_INPUT) {\\n revert Errors.PRBMath_SD59x18_Exp2_InputTooBig(x);\\n }\\n\\n unchecked {\\n // Convert x to the 192.64-bit fixed-point format.\\n uint256 x_192x64 = uint256((xInt << 64) / uUNIT);\\n\\n // It is safe to cast the result to int256 due to the checks above.\\n result = wrap(int256(Common.exp2(x_192x64)));\\n }\\n }\\n}\\n\\n/// @notice Yields the greatest whole number less than or equal to x.\\n///\\n/// @dev Optimized for fractional value inputs, because for every whole value there are (1e18 - 1) fractional\\n/// counterparts. See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n///\\n/// Requirements:\\n/// - x must be greater than or equal to `MIN_WHOLE_SD59x18`.\\n///\\n/// @param x The SD59x18 number to floor.\\n/// @param result The greatest whole number less than or equal to x, as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction floor(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < uMIN_WHOLE_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Floor_Underflow(x);\\n }\\n\\n int256 remainder = xInt % uUNIT;\\n if (remainder == 0) {\\n result = x;\\n } else {\\n unchecked {\\n // Solidity uses C fmod style, which returns a modulus with the same sign as x.\\n int256 resultInt = xInt - remainder;\\n if (xInt < 0) {\\n resultInt -= uUNIT;\\n }\\n result = wrap(resultInt);\\n }\\n }\\n}\\n\\n/// @notice Yields the excess beyond the floor of x for positive numbers and the part of the number to the right.\\n/// of the radix point for negative numbers.\\n/// @dev Based on the odd function definition. https://en.wikipedia.org/wiki/Fractional_part\\n/// @param x The SD59x18 number to get the fractional part of.\\n/// @param result The fractional part of x as an SD59x18 number.\\nfunction frac(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() % uUNIT);\\n}\\n\\n/// @notice Calculates the geometric mean of x and y, i.e. $\\\\sqrt{x * y}$.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x * y must fit in SD59x18.\\n/// - x * y must not be negative, since complex numbers are not supported.\\n///\\n/// @param x The first operand as an SD59x18 number.\\n/// @param y The second operand as an SD59x18 number.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction gm(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n if (xInt == 0 || yInt == 0) {\\n return ZERO;\\n }\\n\\n unchecked {\\n // Equivalent to `xy / x != y`. Checking for overflow this way is faster than letting Solidity do it.\\n int256 xyInt = xInt * yInt;\\n if (xyInt / xInt != yInt) {\\n revert Errors.PRBMath_SD59x18_Gm_Overflow(x, y);\\n }\\n\\n // The product must not be negative, since complex numbers are not supported.\\n if (xyInt < 0) {\\n revert Errors.PRBMath_SD59x18_Gm_NegativeProduct(x, y);\\n }\\n\\n // We don't need to multiply the result by `UNIT` here because the x*y product picked up a factor of `UNIT`\\n // during multiplication. See the comments in {Common.sqrt}.\\n uint256 resultUint = Common.sqrt(uint256(xyInt));\\n result = wrap(int256(resultUint));\\n }\\n}\\n\\n/// @notice Calculates the inverse of x.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x must not be zero.\\n///\\n/// @param x The SD59x18 number for which to calculate the inverse.\\n/// @return result The inverse as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction inv(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(uUNIT_SQUARED / x.unwrap());\\n}\\n\\n/// @notice Calculates the natural logarithm of x using the following formula:\\n///\\n/// $$\\n/// ln{x} = log_2{x} / log_2{e}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n/// - The precision isn't sufficiently fine-grained to return exactly `UNIT` when the input is `E`.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The SD59x18 number for which to calculate the natural logarithm.\\n/// @return result The natural logarithm as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ln(SD59x18 x) pure returns (SD59x18 result) {\\n // Inline the fixed-point multiplication to save gas. This is overflow-safe because the maximum value that\\n // {log2} can return is ~195_205294292027477728.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_E);\\n}\\n\\n/// @notice Calculates the common logarithm of x using the following formula:\\n///\\n/// $$\\n/// log_{10}{x} = log_2{x} / log_2{10}\\n/// $$\\n///\\n/// However, if x is an exact power of ten, a hard coded value is returned.\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The SD59x18 number for which to calculate the common logarithm.\\n/// @return result The common logarithm as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log10(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < 0) {\\n revert Errors.PRBMath_SD59x18_Log_InputTooSmall(x);\\n }\\n\\n // Note that the `mul` in this block is the standard multiplication operation, not {SD59x18.mul}.\\n // prettier-ignore\\n assembly (\\\"memory-safe\\\") {\\n switch x\\n case 1 { result := mul(uUNIT, sub(0, 18)) }\\n case 10 { result := mul(uUNIT, sub(1, 18)) }\\n case 100 { result := mul(uUNIT, sub(2, 18)) }\\n case 1000 { result := mul(uUNIT, sub(3, 18)) }\\n case 10000 { result := mul(uUNIT, sub(4, 18)) }\\n case 100000 { result := mul(uUNIT, sub(5, 18)) }\\n case 1000000 { result := mul(uUNIT, sub(6, 18)) }\\n case 10000000 { result := mul(uUNIT, sub(7, 18)) }\\n case 100000000 { result := mul(uUNIT, sub(8, 18)) }\\n case 1000000000 { result := mul(uUNIT, sub(9, 18)) }\\n case 10000000000 { result := mul(uUNIT, sub(10, 18)) }\\n case 100000000000 { result := mul(uUNIT, sub(11, 18)) }\\n case 1000000000000 { result := mul(uUNIT, sub(12, 18)) }\\n case 10000000000000 { result := mul(uUNIT, sub(13, 18)) }\\n case 100000000000000 { result := mul(uUNIT, sub(14, 18)) }\\n case 1000000000000000 { result := mul(uUNIT, sub(15, 18)) }\\n case 10000000000000000 { result := mul(uUNIT, sub(16, 18)) }\\n case 100000000000000000 { result := mul(uUNIT, sub(17, 18)) }\\n case 1000000000000000000 { result := 0 }\\n case 10000000000000000000 { result := uUNIT }\\n case 100000000000000000000 { result := mul(uUNIT, 2) }\\n case 1000000000000000000000 { result := mul(uUNIT, 3) }\\n case 10000000000000000000000 { result := mul(uUNIT, 4) }\\n case 100000000000000000000000 { result := mul(uUNIT, 5) }\\n case 1000000000000000000000000 { result := mul(uUNIT, 6) }\\n case 10000000000000000000000000 { result := mul(uUNIT, 7) }\\n case 100000000000000000000000000 { result := mul(uUNIT, 8) }\\n case 1000000000000000000000000000 { result := mul(uUNIT, 9) }\\n case 10000000000000000000000000000 { result := mul(uUNIT, 10) }\\n case 100000000000000000000000000000 { result := mul(uUNIT, 11) }\\n case 1000000000000000000000000000000 { result := mul(uUNIT, 12) }\\n case 10000000000000000000000000000000 { result := mul(uUNIT, 13) }\\n case 100000000000000000000000000000000 { result := mul(uUNIT, 14) }\\n case 1000000000000000000000000000000000 { result := mul(uUNIT, 15) }\\n case 10000000000000000000000000000000000 { result := mul(uUNIT, 16) }\\n case 100000000000000000000000000000000000 { result := mul(uUNIT, 17) }\\n case 1000000000000000000000000000000000000 { result := mul(uUNIT, 18) }\\n case 10000000000000000000000000000000000000 { result := mul(uUNIT, 19) }\\n case 100000000000000000000000000000000000000 { result := mul(uUNIT, 20) }\\n case 1000000000000000000000000000000000000000 { result := mul(uUNIT, 21) }\\n case 10000000000000000000000000000000000000000 { result := mul(uUNIT, 22) }\\n case 100000000000000000000000000000000000000000 { result := mul(uUNIT, 23) }\\n case 1000000000000000000000000000000000000000000 { result := mul(uUNIT, 24) }\\n case 10000000000000000000000000000000000000000000 { result := mul(uUNIT, 25) }\\n case 100000000000000000000000000000000000000000000 { result := mul(uUNIT, 26) }\\n case 1000000000000000000000000000000000000000000000 { result := mul(uUNIT, 27) }\\n case 10000000000000000000000000000000000000000000000 { result := mul(uUNIT, 28) }\\n case 100000000000000000000000000000000000000000000000 { result := mul(uUNIT, 29) }\\n case 1000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 30) }\\n case 10000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 31) }\\n case 100000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 32) }\\n case 1000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 33) }\\n case 10000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 34) }\\n case 100000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 35) }\\n case 1000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 36) }\\n case 10000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 37) }\\n case 100000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 38) }\\n case 1000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 39) }\\n case 10000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 40) }\\n case 100000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 41) }\\n case 1000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 42) }\\n case 10000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 43) }\\n case 100000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 44) }\\n case 1000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 45) }\\n case 10000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 46) }\\n case 100000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 47) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 48) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 49) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 50) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 51) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 52) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 53) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 54) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 55) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 56) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 57) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 58) }\\n default { result := uMAX_SD59x18 }\\n }\\n\\n if (result.unwrap() == uMAX_SD59x18) {\\n unchecked {\\n // Inline the fixed-point division to save gas.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_10);\\n }\\n }\\n}\\n\\n/// @notice Calculates the binary logarithm of x using the iterative approximation algorithm:\\n///\\n/// $$\\n/// log_2{x} = n + log_2{y}, \\\\text{ where } y = x*2^{-n}, \\\\ y \\\\in [1, 2)\\n/// $$\\n///\\n/// For $0 \\\\leq x \\\\lt 1$, the input is inverted:\\n///\\n/// $$\\n/// log_2{x} = -log_2{\\\\frac{1}{x}}\\n/// $$\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Binary_logarithm#Iterative_approximation.\\n///\\n/// Notes:\\n/// - Due to the lossy precision of the iterative approximation, the results are not perfectly accurate to the last decimal.\\n///\\n/// Requirements:\\n/// - x must be greater than zero.\\n///\\n/// @param x The SD59x18 number for which to calculate the binary logarithm.\\n/// @return result The binary logarithm as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log2(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt <= 0) {\\n revert Errors.PRBMath_SD59x18_Log_InputTooSmall(x);\\n }\\n\\n unchecked {\\n int256 sign;\\n if (xInt >= uUNIT) {\\n sign = 1;\\n } else {\\n sign = -1;\\n // Inline the fixed-point inversion to save gas.\\n xInt = uUNIT_SQUARED / xInt;\\n }\\n\\n // Calculate the integer part of the logarithm.\\n uint256 n = Common.msb(uint256(xInt / uUNIT));\\n\\n // This is the integer part of the logarithm as an SD59x18 number. The operation can't overflow\\n // because n is at most 255, `UNIT` is 1e18, and the sign is either 1 or -1.\\n int256 resultInt = int256(n) * uUNIT;\\n\\n // Calculate $y = x * 2^{-n}$.\\n int256 y = xInt >> n;\\n\\n // If y is the unit number, the fractional part is zero.\\n if (y == uUNIT) {\\n return wrap(resultInt * sign);\\n }\\n\\n // Calculate the fractional part via the iterative approximation.\\n // The `delta >>= 1` part is equivalent to `delta /= 2`, but shifting bits is more gas efficient.\\n int256 DOUBLE_UNIT = 2e18;\\n for (int256 delta = uHALF_UNIT; delta > 0; delta >>= 1) {\\n y = (y * y) / uUNIT;\\n\\n // Is y^2 >= 2e18 and so in the range [2e18, 4e18)?\\n if (y >= DOUBLE_UNIT) {\\n // Add the 2^{-m} factor to the logarithm.\\n resultInt = resultInt + delta;\\n\\n // Halve y, which corresponds to z/2 in the Wikipedia article.\\n y >>= 1;\\n }\\n }\\n resultInt *= sign;\\n result = wrap(resultInt);\\n }\\n}\\n\\n/// @notice Multiplies two SD59x18 numbers together, returning a new SD59x18 number.\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {Common.mulDiv18}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv18}.\\n/// - None of the inputs can be `MIN_SD59x18`.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The multiplicand as an SD59x18 number.\\n/// @param y The multiplier as an SD59x18 number.\\n/// @return result The product as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mul(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n if (xInt == uMIN_SD59x18 || yInt == uMIN_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Mul_InputTooSmall();\\n }\\n\\n // Get hold of the absolute values of x and y.\\n uint256 xAbs;\\n uint256 yAbs;\\n unchecked {\\n xAbs = xInt < 0 ? uint256(-xInt) : uint256(xInt);\\n yAbs = yInt < 0 ? uint256(-yInt) : uint256(yInt);\\n }\\n\\n // Compute the absolute value (x*y\\u00f7UNIT). The resulting value must fit in SD59x18.\\n uint256 resultAbs = Common.mulDiv18(xAbs, yAbs);\\n if (resultAbs > uint256(uMAX_SD59x18)) {\\n revert Errors.PRBMath_SD59x18_Mul_Overflow(x, y);\\n }\\n\\n // Check if x and y have the same sign using two's complement representation. The left-most bit represents the sign (1 for\\n // negative, 0 for positive or zero).\\n bool sameSign = (xInt ^ yInt) > -1;\\n\\n // If the inputs have the same sign, the result should be positive. Otherwise, it should be negative.\\n unchecked {\\n result = wrap(sameSign ? int256(resultAbs) : -int256(resultAbs));\\n }\\n}\\n\\n/// @notice Raises x to the power of y using the following formula:\\n///\\n/// $$\\n/// x^y = 2^{log_2{x} * y}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {exp2}, {log2}, and {mul}.\\n/// - Returns `UNIT` for 0^0.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {exp2}, {log2}, and {mul}.\\n///\\n/// @param x The base as an SD59x18 number.\\n/// @param y Exponent to raise x to, as an SD59x18 number\\n/// @return result x raised to power y, as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction pow(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n\\n // If both x and y are zero, the result is `UNIT`. If just x is zero, the result is always zero.\\n if (xInt == 0) {\\n return yInt == 0 ? UNIT : ZERO;\\n }\\n // If x is `UNIT`, the result is always `UNIT`.\\n else if (xInt == uUNIT) {\\n return UNIT;\\n }\\n\\n // If y is zero, the result is always `UNIT`.\\n if (yInt == 0) {\\n return UNIT;\\n }\\n // If y is `UNIT`, the result is always x.\\n else if (yInt == uUNIT) {\\n return x;\\n }\\n\\n // Calculate the result using the formula.\\n result = exp2(mul(log2(x), y));\\n}\\n\\n/// @notice Raises x (an SD59x18 number) to the power y (an unsigned basic integer) using the well-known\\n/// algorithm \\\"exponentiation by squaring\\\".\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Exponentiation_by_squaring.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv18}.\\n/// - Returns `UNIT` for 0^0.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {abs} and {Common.mulDiv18}.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The base as an SD59x18 number.\\n/// @param y The exponent as a uint256.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction powu(SD59x18 x, uint256 y) pure returns (SD59x18 result) {\\n uint256 xAbs = uint256(abs(x).unwrap());\\n\\n // Calculate the first iteration of the loop in advance.\\n uint256 resultAbs = y & 1 > 0 ? xAbs : uint256(uUNIT);\\n\\n // Equivalent to `for(y /= 2; y > 0; y /= 2)`.\\n uint256 yAux = y;\\n for (yAux >>= 1; yAux > 0; yAux >>= 1) {\\n xAbs = Common.mulDiv18(xAbs, xAbs);\\n\\n // Equivalent to `y % 2 == 1`.\\n if (yAux & 1 > 0) {\\n resultAbs = Common.mulDiv18(resultAbs, xAbs);\\n }\\n }\\n\\n // The result must fit in SD59x18.\\n if (resultAbs > uint256(uMAX_SD59x18)) {\\n revert Errors.PRBMath_SD59x18_Powu_Overflow(x, y);\\n }\\n\\n unchecked {\\n // Is the base negative and the exponent odd? If yes, the result should be negative.\\n int256 resultInt = int256(resultAbs);\\n bool isNegative = x.unwrap() < 0 && y & 1 == 1;\\n if (isNegative) {\\n resultInt = -resultInt;\\n }\\n result = wrap(resultInt);\\n }\\n}\\n\\n/// @notice Calculates the square root of x using the Babylonian method.\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\\n///\\n/// Notes:\\n/// - Only the positive root is returned.\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x cannot be negative, since complex numbers are not supported.\\n/// - x must be less than `MAX_SD59x18 / UNIT`.\\n///\\n/// @param x The SD59x18 number for which to calculate the square root.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction sqrt(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < 0) {\\n revert Errors.PRBMath_SD59x18_Sqrt_NegativeInput(x);\\n }\\n if (xInt > uMAX_SD59x18 / uUNIT) {\\n revert Errors.PRBMath_SD59x18_Sqrt_Overflow(x);\\n }\\n\\n unchecked {\\n // Multiply x by `UNIT` to account for the factor of `UNIT` picked up when multiplying two SD59x18 numbers.\\n // In this case, the two numbers are both the square root.\\n uint256 resultUint = Common.sqrt(uint256(xInt * uUNIT));\\n result = wrap(int256(resultUint));\\n }\\n}\\n\",\"keccak256\":\"0xa074831139fc89ca0e5a36086b30eb50896bb6770cd5823461b1f2769017d2f0\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\nimport \\\"./Helpers.sol\\\" as Helpers;\\nimport \\\"./Math.sol\\\" as Math;\\n\\n/// @notice The signed 59.18-decimal fixed-point number representation, which can have up to 59 digits and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\\n/// type int256.\\ntype SD59x18 is int256;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoInt256,\\n Casting.intoSD1x18,\\n Casting.intoUD2x18,\\n Casting.intoUD60x18,\\n Casting.intoUint256,\\n Casting.intoUint128,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for SD59x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n MATHEMATICAL FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Math.abs,\\n Math.avg,\\n Math.ceil,\\n Math.div,\\n Math.exp,\\n Math.exp2,\\n Math.floor,\\n Math.frac,\\n Math.gm,\\n Math.inv,\\n Math.log10,\\n Math.log2,\\n Math.ln,\\n Math.mul,\\n Math.pow,\\n Math.powu,\\n Math.sqrt\\n} for SD59x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n HELPER FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Helpers.add,\\n Helpers.and,\\n Helpers.eq,\\n Helpers.gt,\\n Helpers.gte,\\n Helpers.isZero,\\n Helpers.lshift,\\n Helpers.lt,\\n Helpers.lte,\\n Helpers.mod,\\n Helpers.neq,\\n Helpers.not,\\n Helpers.or,\\n Helpers.rshift,\\n Helpers.sub,\\n Helpers.uncheckedAdd,\\n Helpers.uncheckedSub,\\n Helpers.uncheckedUnary,\\n Helpers.xor\\n} for SD59x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n OPERATORS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes it possible to use these operators on the SD59x18 type.\\nusing {\\n Helpers.add as +,\\n Helpers.and2 as &,\\n Math.div as /,\\n Helpers.eq as ==,\\n Helpers.gt as >,\\n Helpers.gte as >=,\\n Helpers.lt as <,\\n Helpers.lte as <=,\\n Helpers.mod as %,\\n Math.mul as *,\\n Helpers.neq as !=,\\n Helpers.not as ~,\\n Helpers.or as |,\\n Helpers.sub as -,\\n Helpers.unary as -,\\n Helpers.xor as ^\\n} for SD59x18 global;\\n\",\"keccak256\":\"0xe03112d145dcd5863aff24e5f381debaae29d446acd5666f3d640e3d9af738d7\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as Errors;\\nimport { uMAX_SD1x18 } from \\\"../sd1x18/Constants.sol\\\";\\nimport { SD1x18 } from \\\"../sd1x18/ValueType.sol\\\";\\nimport { SD59x18 } from \\\"../sd59x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"../ud60x18/ValueType.sol\\\";\\nimport { UD2x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts a UD2x18 number into SD1x18.\\n/// - x must be less than or equal to `uMAX_SD1x18`.\\nfunction intoSD1x18(UD2x18 x) pure returns (SD1x18 result) {\\n uint64 xUint = UD2x18.unwrap(x);\\n if (xUint > uint64(uMAX_SD1x18)) {\\n revert Errors.PRBMath_UD2x18_IntoSD1x18_Overflow(x);\\n }\\n result = SD1x18.wrap(int64(xUint));\\n}\\n\\n/// @notice Casts a UD2x18 number into SD59x18.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of SD59x18.\\nfunction intoSD59x18(UD2x18 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(int256(uint256(UD2x18.unwrap(x))));\\n}\\n\\n/// @notice Casts a UD2x18 number into UD60x18.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of UD60x18.\\nfunction intoUD60x18(UD2x18 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(UD2x18.unwrap(x));\\n}\\n\\n/// @notice Casts a UD2x18 number into uint128.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of uint128.\\nfunction intoUint128(UD2x18 x) pure returns (uint128 result) {\\n result = uint128(UD2x18.unwrap(x));\\n}\\n\\n/// @notice Casts a UD2x18 number into uint256.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of uint256.\\nfunction intoUint256(UD2x18 x) pure returns (uint256 result) {\\n result = uint256(UD2x18.unwrap(x));\\n}\\n\\n/// @notice Casts a UD2x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(UD2x18 x) pure returns (uint40 result) {\\n uint64 xUint = UD2x18.unwrap(x);\\n if (xUint > uint64(Common.MAX_UINT40)) {\\n revert Errors.PRBMath_UD2x18_IntoUint40_Overflow(x);\\n }\\n result = uint40(xUint);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction ud2x18(uint64 x) pure returns (UD2x18 result) {\\n result = UD2x18.wrap(x);\\n}\\n\\n/// @notice Unwrap a UD2x18 number into uint64.\\nfunction unwrap(UD2x18 x) pure returns (uint64 result) {\\n result = UD2x18.unwrap(x);\\n}\\n\\n/// @notice Wraps a uint64 number into UD2x18.\\nfunction wrap(uint64 x) pure returns (UD2x18 result) {\\n result = UD2x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x9b1a35d432ef951a415fae8098b3c609a99b630a3d5464b3c8e1efa8893eea07\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD2x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @dev Euler's number as a UD2x18 number.\\nUD2x18 constant E = UD2x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum value a UD2x18 number can have.\\nuint64 constant uMAX_UD2x18 = 18_446744073709551615;\\nUD2x18 constant MAX_UD2x18 = UD2x18.wrap(uMAX_UD2x18);\\n\\n/// @dev PI as a UD2x18 number.\\nUD2x18 constant PI = UD2x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of UD2x18.\\nUD2x18 constant UNIT = UD2x18.wrap(1e18);\\nuint64 constant uUNIT = 1e18;\\n\",\"keccak256\":\"0x29b0e050c865899e1fb9022b460a7829cdee248c44c4299f068ba80695eec3fc\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD2x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when trying to cast a UD2x18 number that doesn't fit in SD1x18.\\nerror PRBMath_UD2x18_IntoSD1x18_Overflow(UD2x18 x);\\n\\n/// @notice Thrown when trying to cast a UD2x18 number that doesn't fit in uint40.\\nerror PRBMath_UD2x18_IntoUint40_Overflow(UD2x18 x);\\n\",\"keccak256\":\"0xdf1e22f0b4c8032bcc8b7f63fe3984e1387f3dc7b2e9ab381822249f75376d33\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\n\\n/// @notice The unsigned 2.18-decimal fixed-point number representation, which can have up to 2 digits and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\\n/// type uint64. This is useful when end users want to use uint64 to save gas, e.g. with tight variable packing in contract\\n/// storage.\\ntype UD2x18 is uint64;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoSD1x18,\\n Casting.intoSD59x18,\\n Casting.intoUD60x18,\\n Casting.intoUint256,\\n Casting.intoUint128,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for UD2x18 global;\\n\",\"keccak256\":\"0x2802edc9869db116a0b5c490cc5f8554742f747183fa30ac5e9c80bb967e61a1\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Errors.sol\\\" as CastingErrors;\\nimport { MAX_UINT128, MAX_UINT40 } from \\\"../Common.sol\\\";\\nimport { uMAX_SD1x18 } from \\\"../sd1x18/Constants.sol\\\";\\nimport { SD1x18 } from \\\"../sd1x18/ValueType.sol\\\";\\nimport { uMAX_SD59x18 } from \\\"../sd59x18/Constants.sol\\\";\\nimport { SD59x18 } from \\\"../sd59x18/ValueType.sol\\\";\\nimport { uMAX_UD2x18 } from \\\"../ud2x18/Constants.sol\\\";\\nimport { UD2x18 } from \\\"../ud2x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts a UD60x18 number into SD1x18.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `uMAX_SD1x18`.\\nfunction intoSD1x18(UD60x18 x) pure returns (SD1x18 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > uint256(int256(uMAX_SD1x18))) {\\n revert CastingErrors.PRBMath_UD60x18_IntoSD1x18_Overflow(x);\\n }\\n result = SD1x18.wrap(int64(uint64(xUint)));\\n}\\n\\n/// @notice Casts a UD60x18 number into UD2x18.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `uMAX_UD2x18`.\\nfunction intoUD2x18(UD60x18 x) pure returns (UD2x18 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > uMAX_UD2x18) {\\n revert CastingErrors.PRBMath_UD60x18_IntoUD2x18_Overflow(x);\\n }\\n result = UD2x18.wrap(uint64(xUint));\\n}\\n\\n/// @notice Casts a UD60x18 number into SD59x18.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `uMAX_SD59x18`.\\nfunction intoSD59x18(UD60x18 x) pure returns (SD59x18 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > uint256(uMAX_SD59x18)) {\\n revert CastingErrors.PRBMath_UD60x18_IntoSD59x18_Overflow(x);\\n }\\n result = SD59x18.wrap(int256(xUint));\\n}\\n\\n/// @notice Casts a UD60x18 number into uint128.\\n/// @dev This is basically an alias for {unwrap}.\\nfunction intoUint256(UD60x18 x) pure returns (uint256 result) {\\n result = UD60x18.unwrap(x);\\n}\\n\\n/// @notice Casts a UD60x18 number into uint128.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UINT128`.\\nfunction intoUint128(UD60x18 x) pure returns (uint128 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > MAX_UINT128) {\\n revert CastingErrors.PRBMath_UD60x18_IntoUint128_Overflow(x);\\n }\\n result = uint128(xUint);\\n}\\n\\n/// @notice Casts a UD60x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(UD60x18 x) pure returns (uint40 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > MAX_UINT40) {\\n revert CastingErrors.PRBMath_UD60x18_IntoUint40_Overflow(x);\\n }\\n result = uint40(xUint);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction ud(uint256 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(x);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction ud60x18(uint256 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(x);\\n}\\n\\n/// @notice Unwraps a UD60x18 number into uint256.\\nfunction unwrap(UD60x18 x) pure returns (uint256 result) {\\n result = UD60x18.unwrap(x);\\n}\\n\\n/// @notice Wraps a uint256 number into the UD60x18 value type.\\nfunction wrap(uint256 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x5bb532da36921cbdac64d1f16de5d366ef1f664502e3b7c07d0ad06917551f85\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n// NOTICE: the \\\"u\\\" prefix stands for \\\"unwrapped\\\".\\n\\n/// @dev Euler's number as a UD60x18 number.\\nUD60x18 constant E = UD60x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum input permitted in {exp}.\\nuint256 constant uEXP_MAX_INPUT = 133_084258667509499440;\\nUD60x18 constant EXP_MAX_INPUT = UD60x18.wrap(uEXP_MAX_INPUT);\\n\\n/// @dev The maximum input permitted in {exp2}.\\nuint256 constant uEXP2_MAX_INPUT = 192e18 - 1;\\nUD60x18 constant EXP2_MAX_INPUT = UD60x18.wrap(uEXP2_MAX_INPUT);\\n\\n/// @dev Half the UNIT number.\\nuint256 constant uHALF_UNIT = 0.5e18;\\nUD60x18 constant HALF_UNIT = UD60x18.wrap(uHALF_UNIT);\\n\\n/// @dev $log_2(10)$ as a UD60x18 number.\\nuint256 constant uLOG2_10 = 3_321928094887362347;\\nUD60x18 constant LOG2_10 = UD60x18.wrap(uLOG2_10);\\n\\n/// @dev $log_2(e)$ as a UD60x18 number.\\nuint256 constant uLOG2_E = 1_442695040888963407;\\nUD60x18 constant LOG2_E = UD60x18.wrap(uLOG2_E);\\n\\n/// @dev The maximum value a UD60x18 number can have.\\nuint256 constant uMAX_UD60x18 = 115792089237316195423570985008687907853269984665640564039457_584007913129639935;\\nUD60x18 constant MAX_UD60x18 = UD60x18.wrap(uMAX_UD60x18);\\n\\n/// @dev The maximum whole value a UD60x18 number can have.\\nuint256 constant uMAX_WHOLE_UD60x18 = 115792089237316195423570985008687907853269984665640564039457_000000000000000000;\\nUD60x18 constant MAX_WHOLE_UD60x18 = UD60x18.wrap(uMAX_WHOLE_UD60x18);\\n\\n/// @dev PI as a UD60x18 number.\\nUD60x18 constant PI = UD60x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of UD60x18.\\nuint256 constant uUNIT = 1e18;\\nUD60x18 constant UNIT = UD60x18.wrap(uUNIT);\\n\\n/// @dev The unit number squared.\\nuint256 constant uUNIT_SQUARED = 1e36;\\nUD60x18 constant UNIT_SQUARED = UD60x18.wrap(uUNIT_SQUARED);\\n\\n/// @dev Zero as a UD60x18 number.\\nUD60x18 constant ZERO = UD60x18.wrap(0);\\n\",\"keccak256\":\"0x2b80d26153d3fdcfb3a9ca772d9309d31ed1275f5b8b54c3ffb54d3652b37d90\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Conversions.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { uMAX_UD60x18, uUNIT } from \\\"./Constants.sol\\\";\\nimport { PRBMath_UD60x18_Convert_Overflow } from \\\"./Errors.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Converts a UD60x18 number to a simple integer by dividing it by `UNIT`.\\n/// @dev The result is rounded toward zero.\\n/// @param x The UD60x18 number to convert.\\n/// @return result The same number in basic integer form.\\nfunction convert(UD60x18 x) pure returns (uint256 result) {\\n result = UD60x18.unwrap(x) / uUNIT;\\n}\\n\\n/// @notice Converts a simple integer to UD60x18 by multiplying it by `UNIT`.\\n///\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UD60x18 / UNIT`.\\n///\\n/// @param x The basic integer to convert.\\n/// @param result The same number converted to UD60x18.\\nfunction convert(uint256 x) pure returns (UD60x18 result) {\\n if (x > uMAX_UD60x18 / uUNIT) {\\n revert PRBMath_UD60x18_Convert_Overflow(x);\\n }\\n unchecked {\\n result = UD60x18.wrap(x * uUNIT);\\n }\\n}\\n\",\"keccak256\":\"0xaf7fc2523413822de3b66ba339fe2884fb3b8c6f6cf38ec90a2c3e3aae71df6b\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when ceiling a number overflows UD60x18.\\nerror PRBMath_UD60x18_Ceil_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when converting a basic integer to the fixed-point format overflows UD60x18.\\nerror PRBMath_UD60x18_Convert_Overflow(uint256 x);\\n\\n/// @notice Thrown when taking the natural exponent of a base greater than 133_084258667509499441.\\nerror PRBMath_UD60x18_Exp_InputTooBig(UD60x18 x);\\n\\n/// @notice Thrown when taking the binary exponent of a base greater than 192e18.\\nerror PRBMath_UD60x18_Exp2_InputTooBig(UD60x18 x);\\n\\n/// @notice Thrown when taking the geometric mean of two numbers and multiplying them overflows UD60x18.\\nerror PRBMath_UD60x18_Gm_Overflow(UD60x18 x, UD60x18 y);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\\nerror PRBMath_UD60x18_IntoSD1x18_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD59x18.\\nerror PRBMath_UD60x18_IntoSD59x18_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\\nerror PRBMath_UD60x18_IntoUD2x18_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\\nerror PRBMath_UD60x18_IntoUint128_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\\nerror PRBMath_UD60x18_IntoUint40_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when taking the logarithm of a number less than 1.\\nerror PRBMath_UD60x18_Log_InputTooSmall(UD60x18 x);\\n\\n/// @notice Thrown when calculating the square root overflows UD60x18.\\nerror PRBMath_UD60x18_Sqrt_Overflow(UD60x18 x);\\n\",\"keccak256\":\"0xa8c60d4066248df22c49c882873efbc017344107edabc48c52209abbc39cb1e3\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Helpers.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { wrap } from \\\"./Casting.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Implements the checked addition operation (+) in the UD60x18 type.\\nfunction add(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() + y.unwrap());\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the UD60x18 type.\\nfunction and(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() & bits);\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the UD60x18 type.\\nfunction and2(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() & y.unwrap());\\n}\\n\\n/// @notice Implements the equal operation (==) in the UD60x18 type.\\nfunction eq(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() == y.unwrap();\\n}\\n\\n/// @notice Implements the greater than operation (>) in the UD60x18 type.\\nfunction gt(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() > y.unwrap();\\n}\\n\\n/// @notice Implements the greater than or equal to operation (>=) in the UD60x18 type.\\nfunction gte(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() >= y.unwrap();\\n}\\n\\n/// @notice Implements a zero comparison check function in the UD60x18 type.\\nfunction isZero(UD60x18 x) pure returns (bool result) {\\n // This wouldn't work if x could be negative.\\n result = x.unwrap() == 0;\\n}\\n\\n/// @notice Implements the left shift operation (<<) in the UD60x18 type.\\nfunction lshift(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() << bits);\\n}\\n\\n/// @notice Implements the lower than operation (<) in the UD60x18 type.\\nfunction lt(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() < y.unwrap();\\n}\\n\\n/// @notice Implements the lower than or equal to operation (<=) in the UD60x18 type.\\nfunction lte(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() <= y.unwrap();\\n}\\n\\n/// @notice Implements the checked modulo operation (%) in the UD60x18 type.\\nfunction mod(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() % y.unwrap());\\n}\\n\\n/// @notice Implements the not equal operation (!=) in the UD60x18 type.\\nfunction neq(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() != y.unwrap();\\n}\\n\\n/// @notice Implements the NOT (~) bitwise operation in the UD60x18 type.\\nfunction not(UD60x18 x) pure returns (UD60x18 result) {\\n result = wrap(~x.unwrap());\\n}\\n\\n/// @notice Implements the OR (|) bitwise operation in the UD60x18 type.\\nfunction or(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() | y.unwrap());\\n}\\n\\n/// @notice Implements the right shift operation (>>) in the UD60x18 type.\\nfunction rshift(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() >> bits);\\n}\\n\\n/// @notice Implements the checked subtraction operation (-) in the UD60x18 type.\\nfunction sub(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() - y.unwrap());\\n}\\n\\n/// @notice Implements the unchecked addition operation (+) in the UD60x18 type.\\nfunction uncheckedAdd(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() + y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the unchecked subtraction operation (-) in the UD60x18 type.\\nfunction uncheckedSub(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() - y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the XOR (^) bitwise operation in the UD60x18 type.\\nfunction xor(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() ^ y.unwrap());\\n}\\n\",\"keccak256\":\"0xf5faff881391d2c060029499a666cc5f0bea90a213150bb476fae8f02a5df268\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as Errors;\\nimport { wrap } from \\\"./Casting.sol\\\";\\nimport {\\n uEXP_MAX_INPUT,\\n uEXP2_MAX_INPUT,\\n uHALF_UNIT,\\n uLOG2_10,\\n uLOG2_E,\\n uMAX_UD60x18,\\n uMAX_WHOLE_UD60x18,\\n UNIT,\\n uUNIT,\\n uUNIT_SQUARED,\\n ZERO\\n} from \\\"./Constants.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n MATHEMATICAL FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @notice Calculates the arithmetic average of x and y using the following formula:\\n///\\n/// $$\\n/// avg(x, y) = (x & y) + ((xUint ^ yUint) / 2)\\n/// $$\\n///\\n/// In English, this is what this formula does:\\n///\\n/// 1. AND x and y.\\n/// 2. Calculate half of XOR x and y.\\n/// 3. Add the two results together.\\n///\\n/// This technique is known as SWAR, which stands for \\\"SIMD within a register\\\". You can read more about it here:\\n/// https://devblogs.microsoft.com/oldnewthing/20220207-00/?p=106223\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// @param x The first operand as a UD60x18 number.\\n/// @param y The second operand as a UD60x18 number.\\n/// @return result The arithmetic average as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction avg(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n uint256 yUint = y.unwrap();\\n unchecked {\\n result = wrap((xUint & yUint) + ((xUint ^ yUint) >> 1));\\n }\\n}\\n\\n/// @notice Yields the smallest whole number greater than or equal to x.\\n///\\n/// @dev This is optimized for fractional value inputs, because for every whole value there are (1e18 - 1) fractional\\n/// counterparts. See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n///\\n/// Requirements:\\n/// - x must be less than or equal to `MAX_WHOLE_UD60x18`.\\n///\\n/// @param x The UD60x18 number to ceil.\\n/// @param result The smallest whole number greater than or equal to x, as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ceil(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n if (xUint > uMAX_WHOLE_UD60x18) {\\n revert Errors.PRBMath_UD60x18_Ceil_Overflow(x);\\n }\\n\\n assembly (\\\"memory-safe\\\") {\\n // Equivalent to `x % UNIT`.\\n let remainder := mod(x, uUNIT)\\n\\n // Equivalent to `UNIT - remainder`.\\n let delta := sub(uUNIT, remainder)\\n\\n // Equivalent to `x + remainder > 0 ? delta : 0`.\\n result := add(x, mul(delta, gt(remainder, 0)))\\n }\\n}\\n\\n/// @notice Divides two UD60x18 numbers, returning a new UD60x18 number.\\n///\\n/// @dev Uses {Common.mulDiv} to enable overflow-safe multiplication and division.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv}.\\n///\\n/// @param x The numerator as a UD60x18 number.\\n/// @param y The denominator as a UD60x18 number.\\n/// @param result The quotient as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction div(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(Common.mulDiv(x.unwrap(), uUNIT, y.unwrap()));\\n}\\n\\n/// @notice Calculates the natural exponent of x using the following formula:\\n///\\n/// $$\\n/// e^x = 2^{x * log_2{e}}\\n/// $$\\n///\\n/// @dev Requirements:\\n/// - x must be less than 133_084258667509499441.\\n///\\n/// @param x The exponent as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n // This check prevents values greater than 192e18 from being passed to {exp2}.\\n if (xUint > uEXP_MAX_INPUT) {\\n revert Errors.PRBMath_UD60x18_Exp_InputTooBig(x);\\n }\\n\\n unchecked {\\n // Inline the fixed-point multiplication to save gas.\\n uint256 doubleUnitProduct = xUint * uLOG2_E;\\n result = exp2(wrap(doubleUnitProduct / uUNIT));\\n }\\n}\\n\\n/// @notice Calculates the binary exponent of x using the binary fraction method.\\n///\\n/// @dev See https://ethereum.stackexchange.com/q/79903/24693\\n///\\n/// Requirements:\\n/// - x must be less than 192e18.\\n/// - The result must fit in UD60x18.\\n///\\n/// @param x The exponent as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp2(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n // Numbers greater than or equal to 192e18 don't fit in the 192.64-bit format.\\n if (xUint > uEXP2_MAX_INPUT) {\\n revert Errors.PRBMath_UD60x18_Exp2_InputTooBig(x);\\n }\\n\\n // Convert x to the 192.64-bit fixed-point format.\\n uint256 x_192x64 = (xUint << 64) / uUNIT;\\n\\n // Pass x to the {Common.exp2} function, which uses the 192.64-bit fixed-point number representation.\\n result = wrap(Common.exp2(x_192x64));\\n}\\n\\n/// @notice Yields the greatest whole number less than or equal to x.\\n/// @dev Optimized for fractional value inputs, because every whole value has (1e18 - 1) fractional counterparts.\\n/// See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n/// @param x The UD60x18 number to floor.\\n/// @param result The greatest whole number less than or equal to x, as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction floor(UD60x18 x) pure returns (UD60x18 result) {\\n assembly (\\\"memory-safe\\\") {\\n // Equivalent to `x % UNIT`.\\n let remainder := mod(x, uUNIT)\\n\\n // Equivalent to `x - remainder > 0 ? remainder : 0)`.\\n result := sub(x, mul(remainder, gt(remainder, 0)))\\n }\\n}\\n\\n/// @notice Yields the excess beyond the floor of x using the odd function definition.\\n/// @dev See https://en.wikipedia.org/wiki/Fractional_part.\\n/// @param x The UD60x18 number to get the fractional part of.\\n/// @param result The fractional part of x as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction frac(UD60x18 x) pure returns (UD60x18 result) {\\n assembly (\\\"memory-safe\\\") {\\n result := mod(x, uUNIT)\\n }\\n}\\n\\n/// @notice Calculates the geometric mean of x and y, i.e. $\\\\sqrt{x * y}$, rounding down.\\n///\\n/// @dev Requirements:\\n/// - x * y must fit in UD60x18.\\n///\\n/// @param x The first operand as a UD60x18 number.\\n/// @param y The second operand as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction gm(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n uint256 yUint = y.unwrap();\\n if (xUint == 0 || yUint == 0) {\\n return ZERO;\\n }\\n\\n unchecked {\\n // Checking for overflow this way is faster than letting Solidity do it.\\n uint256 xyUint = xUint * yUint;\\n if (xyUint / xUint != yUint) {\\n revert Errors.PRBMath_UD60x18_Gm_Overflow(x, y);\\n }\\n\\n // We don't need to multiply the result by `UNIT` here because the x*y product picked up a factor of `UNIT`\\n // during multiplication. See the comments in {Common.sqrt}.\\n result = wrap(Common.sqrt(xyUint));\\n }\\n}\\n\\n/// @notice Calculates the inverse of x.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x must not be zero.\\n///\\n/// @param x The UD60x18 number for which to calculate the inverse.\\n/// @return result The inverse as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction inv(UD60x18 x) pure returns (UD60x18 result) {\\n unchecked {\\n result = wrap(uUNIT_SQUARED / x.unwrap());\\n }\\n}\\n\\n/// @notice Calculates the natural logarithm of x using the following formula:\\n///\\n/// $$\\n/// ln{x} = log_2{x} / log_2{e}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n/// - The precision isn't sufficiently fine-grained to return exactly `UNIT` when the input is `E`.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The UD60x18 number for which to calculate the natural logarithm.\\n/// @return result The natural logarithm as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ln(UD60x18 x) pure returns (UD60x18 result) {\\n unchecked {\\n // Inline the fixed-point multiplication to save gas. This is overflow-safe because the maximum value that\\n // {log2} can return is ~196_205294292027477728.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_E);\\n }\\n}\\n\\n/// @notice Calculates the common logarithm of x using the following formula:\\n///\\n/// $$\\n/// log_{10}{x} = log_2{x} / log_2{10}\\n/// $$\\n///\\n/// However, if x is an exact power of ten, a hard coded value is returned.\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The UD60x18 number for which to calculate the common logarithm.\\n/// @return result The common logarithm as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log10(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n if (xUint < uUNIT) {\\n revert Errors.PRBMath_UD60x18_Log_InputTooSmall(x);\\n }\\n\\n // Note that the `mul` in this assembly block is the standard multiplication operation, not {UD60x18.mul}.\\n // prettier-ignore\\n assembly (\\\"memory-safe\\\") {\\n switch x\\n case 1 { result := mul(uUNIT, sub(0, 18)) }\\n case 10 { result := mul(uUNIT, sub(1, 18)) }\\n case 100 { result := mul(uUNIT, sub(2, 18)) }\\n case 1000 { result := mul(uUNIT, sub(3, 18)) }\\n case 10000 { result := mul(uUNIT, sub(4, 18)) }\\n case 100000 { result := mul(uUNIT, sub(5, 18)) }\\n case 1000000 { result := mul(uUNIT, sub(6, 18)) }\\n case 10000000 { result := mul(uUNIT, sub(7, 18)) }\\n case 100000000 { result := mul(uUNIT, sub(8, 18)) }\\n case 1000000000 { result := mul(uUNIT, sub(9, 18)) }\\n case 10000000000 { result := mul(uUNIT, sub(10, 18)) }\\n case 100000000000 { result := mul(uUNIT, sub(11, 18)) }\\n case 1000000000000 { result := mul(uUNIT, sub(12, 18)) }\\n case 10000000000000 { result := mul(uUNIT, sub(13, 18)) }\\n case 100000000000000 { result := mul(uUNIT, sub(14, 18)) }\\n case 1000000000000000 { result := mul(uUNIT, sub(15, 18)) }\\n case 10000000000000000 { result := mul(uUNIT, sub(16, 18)) }\\n case 100000000000000000 { result := mul(uUNIT, sub(17, 18)) }\\n case 1000000000000000000 { result := 0 }\\n case 10000000000000000000 { result := uUNIT }\\n case 100000000000000000000 { result := mul(uUNIT, 2) }\\n case 1000000000000000000000 { result := mul(uUNIT, 3) }\\n case 10000000000000000000000 { result := mul(uUNIT, 4) }\\n case 100000000000000000000000 { result := mul(uUNIT, 5) }\\n case 1000000000000000000000000 { result := mul(uUNIT, 6) }\\n case 10000000000000000000000000 { result := mul(uUNIT, 7) }\\n case 100000000000000000000000000 { result := mul(uUNIT, 8) }\\n case 1000000000000000000000000000 { result := mul(uUNIT, 9) }\\n case 10000000000000000000000000000 { result := mul(uUNIT, 10) }\\n case 100000000000000000000000000000 { result := mul(uUNIT, 11) }\\n case 1000000000000000000000000000000 { result := mul(uUNIT, 12) }\\n case 10000000000000000000000000000000 { result := mul(uUNIT, 13) }\\n case 100000000000000000000000000000000 { result := mul(uUNIT, 14) }\\n case 1000000000000000000000000000000000 { result := mul(uUNIT, 15) }\\n case 10000000000000000000000000000000000 { result := mul(uUNIT, 16) }\\n case 100000000000000000000000000000000000 { result := mul(uUNIT, 17) }\\n case 1000000000000000000000000000000000000 { result := mul(uUNIT, 18) }\\n case 10000000000000000000000000000000000000 { result := mul(uUNIT, 19) }\\n case 100000000000000000000000000000000000000 { result := mul(uUNIT, 20) }\\n case 1000000000000000000000000000000000000000 { result := mul(uUNIT, 21) }\\n case 10000000000000000000000000000000000000000 { result := mul(uUNIT, 22) }\\n case 100000000000000000000000000000000000000000 { result := mul(uUNIT, 23) }\\n case 1000000000000000000000000000000000000000000 { result := mul(uUNIT, 24) }\\n case 10000000000000000000000000000000000000000000 { result := mul(uUNIT, 25) }\\n case 100000000000000000000000000000000000000000000 { result := mul(uUNIT, 26) }\\n case 1000000000000000000000000000000000000000000000 { result := mul(uUNIT, 27) }\\n case 10000000000000000000000000000000000000000000000 { result := mul(uUNIT, 28) }\\n case 100000000000000000000000000000000000000000000000 { result := mul(uUNIT, 29) }\\n case 1000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 30) }\\n case 10000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 31) }\\n case 100000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 32) }\\n case 1000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 33) }\\n case 10000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 34) }\\n case 100000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 35) }\\n case 1000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 36) }\\n case 10000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 37) }\\n case 100000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 38) }\\n case 1000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 39) }\\n case 10000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 40) }\\n case 100000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 41) }\\n case 1000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 42) }\\n case 10000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 43) }\\n case 100000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 44) }\\n case 1000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 45) }\\n case 10000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 46) }\\n case 100000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 47) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 48) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 49) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 50) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 51) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 52) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 53) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 54) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 55) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 56) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 57) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 58) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 59) }\\n default { result := uMAX_UD60x18 }\\n }\\n\\n if (result.unwrap() == uMAX_UD60x18) {\\n unchecked {\\n // Inline the fixed-point division to save gas.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_10);\\n }\\n }\\n}\\n\\n/// @notice Calculates the binary logarithm of x using the iterative approximation algorithm:\\n///\\n/// $$\\n/// log_2{x} = n + log_2{y}, \\\\text{ where } y = x*2^{-n}, \\\\ y \\\\in [1, 2)\\n/// $$\\n///\\n/// For $0 \\\\leq x \\\\lt 1$, the input is inverted:\\n///\\n/// $$\\n/// log_2{x} = -log_2{\\\\frac{1}{x}}\\n/// $$\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Binary_logarithm#Iterative_approximation\\n///\\n/// Notes:\\n/// - Due to the lossy precision of the iterative approximation, the results are not perfectly accurate to the last decimal.\\n///\\n/// Requirements:\\n/// - x must be greater than zero.\\n///\\n/// @param x The UD60x18 number for which to calculate the binary logarithm.\\n/// @return result The binary logarithm as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log2(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n if (xUint < uUNIT) {\\n revert Errors.PRBMath_UD60x18_Log_InputTooSmall(x);\\n }\\n\\n unchecked {\\n // Calculate the integer part of the logarithm.\\n uint256 n = Common.msb(xUint / uUNIT);\\n\\n // This is the integer part of the logarithm as a UD60x18 number. The operation can't overflow because n\\n // n is at most 255 and UNIT is 1e18.\\n uint256 resultUint = n * uUNIT;\\n\\n // Calculate $y = x * 2^{-n}$.\\n uint256 y = xUint >> n;\\n\\n // If y is the unit number, the fractional part is zero.\\n if (y == uUNIT) {\\n return wrap(resultUint);\\n }\\n\\n // Calculate the fractional part via the iterative approximation.\\n // The `delta >>= 1` part is equivalent to `delta /= 2`, but shifting bits is more gas efficient.\\n uint256 DOUBLE_UNIT = 2e18;\\n for (uint256 delta = uHALF_UNIT; delta > 0; delta >>= 1) {\\n y = (y * y) / uUNIT;\\n\\n // Is y^2 >= 2e18 and so in the range [2e18, 4e18)?\\n if (y >= DOUBLE_UNIT) {\\n // Add the 2^{-m} factor to the logarithm.\\n resultUint += delta;\\n\\n // Halve y, which corresponds to z/2 in the Wikipedia article.\\n y >>= 1;\\n }\\n }\\n result = wrap(resultUint);\\n }\\n}\\n\\n/// @notice Multiplies two UD60x18 numbers together, returning a new UD60x18 number.\\n///\\n/// @dev Uses {Common.mulDiv} to enable overflow-safe multiplication and division.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv}.\\n///\\n/// @dev See the documentation in {Common.mulDiv18}.\\n/// @param x The multiplicand as a UD60x18 number.\\n/// @param y The multiplier as a UD60x18 number.\\n/// @return result The product as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mul(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(Common.mulDiv18(x.unwrap(), y.unwrap()));\\n}\\n\\n/// @notice Raises x to the power of y.\\n///\\n/// For $1 \\\\leq x \\\\leq \\\\infty$, the following standard formula is used:\\n///\\n/// $$\\n/// x^y = 2^{log_2{x} * y}\\n/// $$\\n///\\n/// For $0 \\\\leq x \\\\lt 1$, since the unsigned {log2} is undefined, an equivalent formula is used:\\n///\\n/// $$\\n/// i = \\\\frac{1}{x}\\n/// w = 2^{log_2{i} * y}\\n/// x^y = \\\\frac{1}{w}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2} and {mul}.\\n/// - Returns `UNIT` for 0^0.\\n/// - It may not perform well with very small values of x. Consider using SD59x18 as an alternative.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {exp2}, {log2}, and {mul}.\\n///\\n/// @param x The base as a UD60x18 number.\\n/// @param y The exponent as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction pow(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n uint256 yUint = y.unwrap();\\n\\n // If both x and y are zero, the result is `UNIT`. If just x is zero, the result is always zero.\\n if (xUint == 0) {\\n return yUint == 0 ? UNIT : ZERO;\\n }\\n // If x is `UNIT`, the result is always `UNIT`.\\n else if (xUint == uUNIT) {\\n return UNIT;\\n }\\n\\n // If y is zero, the result is always `UNIT`.\\n if (yUint == 0) {\\n return UNIT;\\n }\\n // If y is `UNIT`, the result is always x.\\n else if (yUint == uUNIT) {\\n return x;\\n }\\n\\n // If x is greater than `UNIT`, use the standard formula.\\n if (xUint > uUNIT) {\\n result = exp2(mul(log2(x), y));\\n }\\n // Conversely, if x is less than `UNIT`, use the equivalent formula.\\n else {\\n UD60x18 i = wrap(uUNIT_SQUARED / xUint);\\n UD60x18 w = exp2(mul(log2(i), y));\\n result = wrap(uUNIT_SQUARED / w.unwrap());\\n }\\n}\\n\\n/// @notice Raises x (a UD60x18 number) to the power y (an unsigned basic integer) using the well-known\\n/// algorithm \\\"exponentiation by squaring\\\".\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Exponentiation_by_squaring.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv18}.\\n/// - Returns `UNIT` for 0^0.\\n///\\n/// Requirements:\\n/// - The result must fit in UD60x18.\\n///\\n/// @param x The base as a UD60x18 number.\\n/// @param y The exponent as a uint256.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction powu(UD60x18 x, uint256 y) pure returns (UD60x18 result) {\\n // Calculate the first iteration of the loop in advance.\\n uint256 xUint = x.unwrap();\\n uint256 resultUint = y & 1 > 0 ? xUint : uUNIT;\\n\\n // Equivalent to `for(y /= 2; y > 0; y /= 2)`.\\n for (y >>= 1; y > 0; y >>= 1) {\\n xUint = Common.mulDiv18(xUint, xUint);\\n\\n // Equivalent to `y % 2 == 1`.\\n if (y & 1 > 0) {\\n resultUint = Common.mulDiv18(resultUint, xUint);\\n }\\n }\\n result = wrap(resultUint);\\n}\\n\\n/// @notice Calculates the square root of x using the Babylonian method.\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\\n///\\n/// Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x must be less than `MAX_UD60x18 / UNIT`.\\n///\\n/// @param x The UD60x18 number for which to calculate the square root.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction sqrt(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n unchecked {\\n if (xUint > uMAX_UD60x18 / uUNIT) {\\n revert Errors.PRBMath_UD60x18_Sqrt_Overflow(x);\\n }\\n // Multiply x by `UNIT` to account for the factor of `UNIT` picked up when multiplying two UD60x18 numbers.\\n // In this case, the two numbers are both the square root.\\n result = wrap(Common.sqrt(xUint * uUNIT));\\n }\\n}\\n\",\"keccak256\":\"0x462144667aac3f96d5f8dba7aa68fe4c5a3f61e1d7bbbc81bee21168817f9c09\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\nimport \\\"./Helpers.sol\\\" as Helpers;\\nimport \\\"./Math.sol\\\" as Math;\\n\\n/// @notice The unsigned 60.18-decimal fixed-point number representation, which can have up to 60 digits and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the Solidity type uint256.\\n/// @dev The value type is defined here so it can be imported in all other files.\\ntype UD60x18 is uint256;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoSD1x18,\\n Casting.intoUD2x18,\\n Casting.intoSD59x18,\\n Casting.intoUint128,\\n Casting.intoUint256,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for UD60x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n MATHEMATICAL FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes the functions in this library callable on the UD60x18 type.\\nusing {\\n Math.avg,\\n Math.ceil,\\n Math.div,\\n Math.exp,\\n Math.exp2,\\n Math.floor,\\n Math.frac,\\n Math.gm,\\n Math.inv,\\n Math.ln,\\n Math.log10,\\n Math.log2,\\n Math.mul,\\n Math.pow,\\n Math.powu,\\n Math.sqrt\\n} for UD60x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n HELPER FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes the functions in this library callable on the UD60x18 type.\\nusing {\\n Helpers.add,\\n Helpers.and,\\n Helpers.eq,\\n Helpers.gt,\\n Helpers.gte,\\n Helpers.isZero,\\n Helpers.lshift,\\n Helpers.lt,\\n Helpers.lte,\\n Helpers.mod,\\n Helpers.neq,\\n Helpers.not,\\n Helpers.or,\\n Helpers.rshift,\\n Helpers.sub,\\n Helpers.uncheckedAdd,\\n Helpers.uncheckedSub,\\n Helpers.xor\\n} for UD60x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n OPERATORS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes it possible to use these operators on the UD60x18 type.\\nusing {\\n Helpers.add as +,\\n Helpers.and2 as &,\\n Math.div as /,\\n Helpers.eq as ==,\\n Helpers.gt as >,\\n Helpers.gte as >=,\\n Helpers.lt as <,\\n Helpers.lte as <=,\\n Helpers.or as |,\\n Helpers.mod as %,\\n Math.mul as *,\\n Helpers.neq as !=,\\n Helpers.not as ~,\\n Helpers.sub as -,\\n Helpers.xor as ^\\n} for UD60x18 global;\\n\",\"keccak256\":\"0xdd873b5124180d9b71498b3a7fe93b1c08c368bec741f7d5f8e17f78a0b70f31\",\"license\":\"MIT\"},\"contracts/interfaces/IERC6551Registry.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\ninterface IERC6551Registry {\\n /**\\n * @dev Creates a token bound account for a non-fungible token.\\n *\\n * If account has already been created, returns the account address without calling create2.\\n *\\n * Emits ERC6551AccountCreated event.\\n *\\n * @return account The address of the token bound account\\n */\\n function createAccount(\\n address implementation,\\n bytes32 salt,\\n uint256 chainId,\\n address tokenContract,\\n uint256 tokenId\\n ) external returns (address account);\\n}\\n\",\"keccak256\":\"0x64c52de8a8e68398e61dd8b42dda8e9af8cf6abf93bb85629c322440991ea568\",\"license\":\"MIT\"},\"contracts/interfaces/hats/HatsErrors.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface HatsErrors {\\n /// @notice Emitted when `user` is attempting to perform an action on `hatId` but is not wearing one of `hatId`'s admin hats\\n /// @dev Can be equivalent to `NotHatWearer(buildHatId(hatId))`, such as when emitted by `approveLinkTopHatToTree` or `relinkTopHatToTree`\\n error NotAdmin(address user, uint256 hatId);\\n\\n /// @notice Emitted when attempting to perform an action as or for an account that is not a wearer of a given hat\\n error NotHatWearer();\\n\\n /// @notice Emitted when attempting to perform an action that requires being either an admin or wearer of a given hat\\n error NotAdminOrWearer();\\n\\n /// @notice Emitted when attempting to mint `hatId` but `hatId`'s maxSupply has been reached\\n error AllHatsWorn(uint256 hatId);\\n\\n /// @notice Emitted when attempting to create a hat with a level 14 hat as its admin\\n error MaxLevelsReached();\\n\\n /// @notice Emitted when an attempted hat id has empty intermediate level(s)\\n error InvalidHatId();\\n\\n /// @notice Emitted when attempting to mint `hatId` to a `wearer` who is already wearing the hat\\n error AlreadyWearingHat(address wearer, uint256 hatId);\\n\\n /// @notice Emitted when attempting to mint a non-existant hat\\n error HatDoesNotExist(uint256 hatId);\\n\\n /// @notice Emmitted when attempting to mint or transfer a hat that is not active\\n error HatNotActive();\\n\\n /// @notice Emitted when attempting to mint or transfer a hat to an ineligible wearer\\n error NotEligible();\\n\\n /// @notice Emitted when attempting to check or set a hat's status from an account that is not that hat's toggle module\\n error NotHatsToggle();\\n\\n /// @notice Emitted when attempting to check or set a hat wearer's status from an account that is not that hat's eligibility module\\n error NotHatsEligibility();\\n\\n /// @notice Emitted when array arguments to a batch function have mismatching lengths\\n error BatchArrayLengthMismatch();\\n\\n /// @notice Emitted when attempting to mutate or transfer an immutable hat\\n error Immutable();\\n\\n /// @notice Emitted when attempting to change a hat's maxSupply to a value lower than its current supply\\n error NewMaxSupplyTooLow();\\n\\n /// @notice Emitted when attempting to link a tophat to a new admin for which the tophat serves as an admin\\n error CircularLinkage();\\n\\n /// @notice Emitted when attempting to link or relink a tophat to a separate tree\\n error CrossTreeLinkage();\\n\\n /// @notice Emitted when attempting to link a tophat without a request\\n error LinkageNotRequested();\\n\\n /// @notice Emitted when attempting to unlink a tophat that does not have a wearer\\n /// @dev This ensures that unlinking never results in a bricked tophat\\n error InvalidUnlink();\\n\\n /// @notice Emmited when attempting to change a hat's eligibility or toggle module to the zero address\\n error ZeroAddress();\\n\\n /// @notice Emmitted when attempting to change a hat's details or imageURI to a string with over 7000 bytes (~characters)\\n /// @dev This protects against a DOS attack where an admin iteratively extend's a hat's details or imageURI\\n /// to be so long that reading it exceeds the block gas limit, breaking `uri()` and `viewHat()`\\n error StringTooLong();\\n}\\n\",\"keccak256\":\"0x81b0056b7bed86eabc07c0e4a9655c586ddb8e6c128320593669b76efd5a08de\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/HatsEvents.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface HatsEvents {\\n /// @notice Emitted when a new hat is created\\n /// @param id The id for the new hat\\n /// @param details A description of the Hat\\n /// @param maxSupply The total instances of the Hat that can be worn at once\\n /// @param eligibility The address that can report on the Hat wearer's status\\n /// @param toggle The address that can deactivate the Hat\\n /// @param mutable_ Whether the hat's properties are changeable after creation\\n /// @param imageURI The image uri for this hat and the fallback for its\\n event HatCreated(\\n uint256 id,\\n string details,\\n uint32 maxSupply,\\n address eligibility,\\n address toggle,\\n bool mutable_,\\n string imageURI\\n );\\n\\n /// @notice Emitted when a hat wearer's standing is updated\\n /// @dev Eligibility is excluded since the source of truth for eligibility is the eligibility module and may change without a transaction\\n /// @param hatId The id of the wearer's hat\\n /// @param wearer The wearer's address\\n /// @param wearerStanding Whether the wearer is in good standing for the hat\\n event WearerStandingChanged(\\n uint256 hatId,\\n address wearer,\\n bool wearerStanding\\n );\\n\\n /// @notice Emitted when a hat's status is updated\\n /// @param hatId The id of the hat\\n /// @param newStatus Whether the hat is active\\n event HatStatusChanged(uint256 hatId, bool newStatus);\\n\\n /// @notice Emitted when a hat's details are updated\\n /// @param hatId The id of the hat\\n /// @param newDetails The updated details\\n event HatDetailsChanged(uint256 hatId, string newDetails);\\n\\n /// @notice Emitted when a hat's eligibility module is updated\\n /// @param hatId The id of the hat\\n /// @param newEligibility The updated eligibiliy module\\n event HatEligibilityChanged(uint256 hatId, address newEligibility);\\n\\n /// @notice Emitted when a hat's toggle module is updated\\n /// @param hatId The id of the hat\\n /// @param newToggle The updated toggle module\\n event HatToggleChanged(uint256 hatId, address newToggle);\\n\\n /// @notice Emitted when a hat's mutability is updated\\n /// @param hatId The id of the hat\\n event HatMutabilityChanged(uint256 hatId);\\n\\n /// @notice Emitted when a hat's maximum supply is updated\\n /// @param hatId The id of the hat\\n /// @param newMaxSupply The updated max supply\\n event HatMaxSupplyChanged(uint256 hatId, uint32 newMaxSupply);\\n\\n /// @notice Emitted when a hat's image URI is updated\\n /// @param hatId The id of the hat\\n /// @param newImageURI The updated image URI\\n event HatImageURIChanged(uint256 hatId, string newImageURI);\\n\\n /// @notice Emitted when a tophat linkage is requested by its admin\\n /// @param domain The domain of the tree tophat to link\\n /// @param newAdmin The tophat's would-be admin in the parent tree\\n event TopHatLinkRequested(uint32 domain, uint256 newAdmin);\\n\\n /// @notice Emitted when a tophat is linked to a another tree\\n /// @param domain The domain of the newly-linked tophat\\n /// @param newAdmin The tophat's new admin in the parent tree\\n event TopHatLinked(uint32 domain, uint256 newAdmin);\\n}\\n\",\"keccak256\":\"0x53413397d15e1636c3cd7bd667656b79bc2886785403b824bcd4ed122667f2c6\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/IHats.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\nimport \\\"./IHatsIdUtilities.sol\\\";\\nimport \\\"./HatsErrors.sol\\\";\\nimport \\\"./HatsEvents.sol\\\";\\n\\ninterface IHats is IHatsIdUtilities, HatsErrors, HatsEvents {\\n function mintTopHat(\\n address _target,\\n string memory _details,\\n string memory _imageURI\\n ) external returns (uint256 topHatId);\\n\\n function createHat(\\n uint256 _admin,\\n string calldata _details,\\n uint32 _maxSupply,\\n address _eligibility,\\n address _toggle,\\n bool _mutable,\\n string calldata _imageURI\\n ) external returns (uint256 newHatId);\\n\\n function batchCreateHats(\\n uint256[] calldata _admins,\\n string[] calldata _details,\\n uint32[] calldata _maxSupplies,\\n address[] memory _eligibilityModules,\\n address[] memory _toggleModules,\\n bool[] calldata _mutables,\\n string[] calldata _imageURIs\\n ) external returns (bool success);\\n\\n function getNextId(uint256 _admin) external view returns (uint256 nextId);\\n\\n function mintHat(\\n uint256 _hatId,\\n address _wearer\\n ) external returns (bool success);\\n\\n function batchMintHats(\\n uint256[] calldata _hatIds,\\n address[] calldata _wearers\\n ) external returns (bool success);\\n\\n function setHatStatus(\\n uint256 _hatId,\\n bool _newStatus\\n ) external returns (bool toggled);\\n\\n function checkHatStatus(uint256 _hatId) external returns (bool toggled);\\n\\n function setHatWearerStatus(\\n uint256 _hatId,\\n address _wearer,\\n bool _eligible,\\n bool _standing\\n ) external returns (bool updated);\\n\\n function checkHatWearerStatus(\\n uint256 _hatId,\\n address _wearer\\n ) external returns (bool updated);\\n\\n function renounceHat(uint256 _hatId) external;\\n\\n function transferHat(uint256 _hatId, address _from, address _to) external;\\n\\n /*//////////////////////////////////////////////////////////////\\n HATS ADMIN FUNCTIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n function makeHatImmutable(uint256 _hatId) external;\\n\\n function changeHatDetails(\\n uint256 _hatId,\\n string memory _newDetails\\n ) external;\\n\\n function changeHatEligibility(\\n uint256 _hatId,\\n address _newEligibility\\n ) external;\\n\\n function changeHatToggle(uint256 _hatId, address _newToggle) external;\\n\\n function changeHatImageURI(\\n uint256 _hatId,\\n string memory _newImageURI\\n ) external;\\n\\n function changeHatMaxSupply(uint256 _hatId, uint32 _newMaxSupply) external;\\n\\n function requestLinkTopHatToTree(\\n uint32 _topHatId,\\n uint256 _newAdminHat\\n ) external;\\n\\n function approveLinkTopHatToTree(\\n uint32 _topHatId,\\n uint256 _newAdminHat,\\n address _eligibility,\\n address _toggle,\\n string calldata _details,\\n string calldata _imageURI\\n ) external;\\n\\n function unlinkTopHatFromTree(uint32 _topHatId, address _wearer) external;\\n\\n function relinkTopHatWithinTree(\\n uint32 _topHatDomain,\\n uint256 _newAdminHat,\\n address _eligibility,\\n address _toggle,\\n string calldata _details,\\n string calldata _imageURI\\n ) external;\\n\\n /*//////////////////////////////////////////////////////////////\\n VIEW FUNCTIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n function viewHat(\\n uint256 _hatId\\n )\\n external\\n view\\n returns (\\n string memory details,\\n uint32 maxSupply,\\n uint32 supply,\\n address eligibility,\\n address toggle,\\n string memory imageURI,\\n uint16 lastHatId,\\n bool mutable_,\\n bool active\\n );\\n\\n function isWearerOfHat(\\n address _user,\\n uint256 _hatId\\n ) external view returns (bool isWearer);\\n\\n function isAdminOfHat(\\n address _user,\\n uint256 _hatId\\n ) external view returns (bool isAdmin);\\n\\n function isInGoodStanding(\\n address _wearer,\\n uint256 _hatId\\n ) external view returns (bool standing);\\n\\n function isEligible(\\n address _wearer,\\n uint256 _hatId\\n ) external view returns (bool eligible);\\n\\n function getHatEligibilityModule(\\n uint256 _hatId\\n ) external view returns (address eligibility);\\n\\n function getHatToggleModule(\\n uint256 _hatId\\n ) external view returns (address toggle);\\n\\n function getHatMaxSupply(\\n uint256 _hatId\\n ) external view returns (uint32 maxSupply);\\n\\n function hatSupply(uint256 _hatId) external view returns (uint32 supply);\\n\\n function getImageURIForHat(\\n uint256 _hatId\\n ) external view returns (string memory _uri);\\n\\n function balanceOf(\\n address wearer,\\n uint256 hatId\\n ) external view returns (uint256 balance);\\n\\n function balanceOfBatch(\\n address[] calldata _wearers,\\n uint256[] calldata _hatIds\\n ) external view returns (uint256[] memory);\\n\\n function uri(uint256 id) external view returns (string memory _uri);\\n}\\n\",\"keccak256\":\"0x2867004bddc5148fa1937f25c0403e5d9977583aaf50fdbdb74bd463f64f21c8\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/IHatsIdUtilities.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface IHatsIdUtilities {\\n function buildHatId(\\n uint256 _admin,\\n uint16 _newHat\\n ) external pure returns (uint256 id);\\n\\n function getHatLevel(uint256 _hatId) external view returns (uint32 level);\\n\\n function getLocalHatLevel(\\n uint256 _hatId\\n ) external pure returns (uint32 level);\\n\\n function isTopHat(uint256 _hatId) external view returns (bool _topHat);\\n\\n function isLocalTopHat(\\n uint256 _hatId\\n ) external pure returns (bool _localTopHat);\\n\\n function isValidHatId(\\n uint256 _hatId\\n ) external view returns (bool validHatId);\\n\\n function getAdminAtLevel(\\n uint256 _hatId,\\n uint32 _level\\n ) external view returns (uint256 admin);\\n\\n function getAdminAtLocalLevel(\\n uint256 _hatId,\\n uint32 _level\\n ) external pure returns (uint256 admin);\\n\\n function getTopHatDomain(\\n uint256 _hatId\\n ) external view returns (uint32 domain);\\n\\n function getTippyTopHatDomain(\\n uint32 _topHatDomain\\n ) external view returns (uint32 domain);\\n\\n function noCircularLinkage(\\n uint32 _topHatDomain,\\n uint256 _linkedAdmin\\n ) external view returns (bool notCircular);\\n\\n function sameTippyTopHatDomain(\\n uint32 _topHatDomain,\\n uint256 _newAdminHat\\n ) external view returns (bool sameDomain);\\n}\\n\",\"keccak256\":\"0x007fcc07b20bf84bacad1f9a2ddf4e30e1a8be961e144b7bef8e98a51781aee9\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/IHatsModuleFactory.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.19;\\n\\ninterface IHatsModuleFactory {\\n error HatsModuleFactory_ModuleAlreadyDeployed(\\n address implementation,\\n uint256 hatId,\\n bytes otherImmutableArgs,\\n uint256 saltNonce\\n );\\n\\n error BatchArrayLengthMismatch();\\n\\n event HatsModuleFactory_ModuleDeployed(\\n address implementation,\\n address instance,\\n uint256 hatId,\\n bytes otherImmutableArgs,\\n bytes initData,\\n uint256 saltNonce\\n );\\n\\n function HATS() external view returns (address);\\n\\n function version() external view returns (string memory);\\n\\n function createHatsModule(\\n address _implementation,\\n uint256 _hatId,\\n bytes calldata _otherImmutableArgs,\\n bytes calldata _initData,\\n uint256 _saltNonce\\n ) external returns (address _instance);\\n\\n function batchCreateHatsModule(\\n address[] calldata _implementations,\\n uint256[] calldata _hatIds,\\n bytes[] calldata _otherImmutableArgsArray,\\n bytes[] calldata _initDataArray,\\n uint256[] calldata _saltNonces\\n ) external returns (bool success);\\n\\n function getHatsModuleAddress(\\n address _implementation,\\n uint256 _hatId,\\n bytes calldata _otherImmutableArgs,\\n uint256 _saltNonce\\n ) external view returns (address);\\n\\n function deployed(\\n address _implementation,\\n uint256 _hatId,\\n bytes calldata _otherImmutableArgs,\\n uint256 _saltNonce\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x861faf40785cedb829243116d492653414a367853408a5c27d201522f6c3bfdd\",\"license\":\"MIT\"},\"contracts/interfaces/hats/modules/IHatsElectionsEligibility.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.13;\\n\\ninterface IHatsElectionsEligibility {\\n event ElectionOpened(uint128 nextTermEnd);\\n event ElectionCompleted(uint128 termEnd, address[] winners);\\n event NewTermStarted(uint128 termEnd);\\n event Recalled(uint128 termEnd, address[] accounts);\\n\\n /// @notice Returns the first second after the current term ends.\\n /// @dev Also serves as the id for the current term.\\n function currentTermEnd() external view returns (uint128);\\n\\n /// @notice Returns the first second after the next term ends.\\n /// @dev Also serves as the id for the next term.\\n function nextTermEnd() external view returns (uint128);\\n\\n /// @notice Returns the election status (open or closed) for a given term end.\\n /// @param termEnd The term end timestamp to query.\\n function electionStatus(\\n uint128 termEnd\\n ) external view returns (bool isElectionOpen);\\n\\n /// @notice Returns whether a candidate was elected in a given term.\\n /// @param termEnd The term end timestamp to query.\\n /// @param candidate The address of the candidate.\\n function electionResults(\\n uint128 termEnd,\\n address candidate\\n ) external view returns (bool elected);\\n\\n /// @notice Returns the BALLOT_BOX_HAT constant.\\n function BALLOT_BOX_HAT() external pure returns (uint256);\\n\\n /// @notice Returns the ADMIN_HAT constant.\\n function ADMIN_HAT() external pure returns (uint256);\\n\\n /**\\n * @notice Submit the results of an election for a specified term.\\n * @dev Only callable by the wearer(s) of the BALLOT_BOX_HAT.\\n * @param _termEnd The id of the term for which the election results are being submitted.\\n * @param _winners The addresses of the winners of the election.\\n */\\n function elect(uint128 _termEnd, address[] calldata _winners) external;\\n\\n /**\\n * @notice Submit the results of a recall election for a specified term.\\n * @dev Only callable by the wearer(s) of the BALLOT_BOX_HAT.\\n * @param _termEnd The id of the term for which the recall results are being submitted.\\n * @param _recallees The addresses to be recalled.\\n */\\n function recall(uint128 _termEnd, address[] calldata _recallees) external;\\n\\n /**\\n * @notice Set the next term and open the election for it.\\n * @dev Only callable by the wearer(s) of the ADMIN_HAT.\\n * @param _newTermEnd The id of the term that will be opened.\\n */\\n function setNextTerm(uint128 _newTermEnd) external;\\n\\n /**\\n * @notice Start the next term, updating the current term.\\n * @dev Can be called by anyone, but will revert if conditions are not met.\\n */\\n function startNextTerm() external;\\n\\n /**\\n * @notice Determine the eligibility and standing of a wearer for a hat.\\n * @param _wearer The address of the hat wearer.\\n * @param _hatId The ID of the hat.\\n * @return eligible True if the wearer is eligible for the hat.\\n * @return standing True if the wearer is in good standing.\\n */\\n function getWearerStatus(\\n address _wearer,\\n uint256 _hatId\\n ) external view returns (bool eligible, bool standing);\\n}\\n\",\"keccak256\":\"0x74dfc5d538d866ddb8ee2ca1b569abf62e02d848c59f308adf6075ecff175c7d\",\"license\":\"MIT\"},\"contracts/interfaces/sablier/IAdminable.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\n/// @title IAdminable\\n/// @notice Contract module that provides a basic access control mechanism, with an admin that can be\\n/// granted exclusive access to specific functions. The inheriting contract must set the initial admin\\n/// in the constructor.\\ninterface IAdminable {\\n /*//////////////////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Emitted when the admin is transferred.\\n /// @param oldAdmin The address of the old admin.\\n /// @param newAdmin The address of the new admin.\\n event TransferAdmin(address indexed oldAdmin, address indexed newAdmin);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice The address of the admin account or contract.\\n function admin() external view returns (address);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n NON-CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Transfers the contract admin to a new address.\\n ///\\n /// @dev Notes:\\n /// - Does not revert if the admin is the same.\\n /// - This function can potentially leave the contract without an admin, thereby removing any\\n /// functionality that is only available to the admin.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the contract admin.\\n ///\\n /// @param newAdmin The address of the new admin.\\n function transferAdmin(address newAdmin) external;\\n}\\n\",\"keccak256\":\"0xa279c49e51228b571329164e36250e82b2c1378e8b549194ab7dd90fca9c3b2b\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/IERC4096.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 \\\"@openzeppelin/contracts/interfaces/IERC165.sol\\\";\\nimport {IERC721} from \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\n\\n/// @title ERC-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\",\"keccak256\":\"0xa34b9c52cbe36be860244f52256f1b05badf0cb797d208664b87337610d0e82d\",\"license\":\"MIT\"},\"contracts/interfaces/sablier/ISablierV2Lockup.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC4906} from \\\"./IERC4096.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IERC721Metadata} from \\\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\\\";\\nimport {UD60x18} from \\\"@prb/math/src/UD60x18.sol\\\";\\n\\nimport {Lockup} from \\\"./types/DataTypes.sol\\\";\\nimport {IAdminable} from \\\"./IAdminable.sol\\\";\\nimport {ISablierV2NFTDescriptor} from \\\"./ISablierV2NFTDescriptor.sol\\\";\\n\\n/// @title ISablierV2Lockup\\n/// @notice Common logic between all Sablier V2 Lockup contracts.\\ninterface ISablierV2Lockup is\\n IAdminable, // 0 inherited components\\n IERC4906, // 2 inherited components\\n IERC721Metadata // 2 inherited components\\n{\\n /*//////////////////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Emitted when the admin allows a new recipient contract to hook to Sablier.\\n /// @param admin The address of the current contract admin.\\n /// @param recipient The address of the recipient contract put on the allowlist.\\n event AllowToHook(address indexed admin, address recipient);\\n\\n /// @notice Emitted when a stream is canceled.\\n /// @param streamId The ID of the stream.\\n /// @param sender The address of the stream's sender.\\n /// @param recipient The address of the stream's recipient.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param senderAmount The amount of assets refunded to the stream's sender, denoted in units of the asset's\\n /// decimals.\\n /// @param recipientAmount The amount of assets left for the stream's recipient to withdraw, denoted in units of the\\n /// asset's decimals.\\n event CancelLockupStream(\\n uint256 streamId,\\n address indexed sender,\\n address indexed recipient,\\n IERC20 indexed asset,\\n uint128 senderAmount,\\n uint128 recipientAmount\\n );\\n\\n /// @notice Emitted when a sender gives up the right to cancel a stream.\\n /// @param streamId The ID of the stream.\\n event RenounceLockupStream(uint256 indexed streamId);\\n\\n /// @notice Emitted when the admin sets a new NFT descriptor contract.\\n /// @param admin The address of the current contract admin.\\n /// @param oldNFTDescriptor The address of the old NFT descriptor contract.\\n /// @param newNFTDescriptor The address of the new NFT descriptor contract.\\n event SetNFTDescriptor(\\n address indexed admin,\\n ISablierV2NFTDescriptor oldNFTDescriptor,\\n ISablierV2NFTDescriptor newNFTDescriptor\\n );\\n\\n /// @notice Emitted when assets are withdrawn from a stream.\\n /// @param streamId The ID of the stream.\\n /// @param to The address that has received the withdrawn assets.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param amount The amount of assets withdrawn, denoted in units of the asset's decimals.\\n event WithdrawFromLockupStream(\\n uint256 indexed streamId,\\n address indexed to,\\n IERC20 indexed asset,\\n uint128 amount\\n );\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Retrieves the address of the ERC-20 asset to be distributed.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getAsset(uint256 streamId) external view returns (IERC20 asset);\\n\\n /// @notice Retrieves the amount deposited in the stream, denoted in units of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getDepositedAmount(\\n uint256 streamId\\n ) external view returns (uint128 depositedAmount);\\n\\n /// @notice Retrieves the stream's end time, which is a Unix timestamp.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getEndTime(\\n uint256 streamId\\n ) external view returns (uint40 endTime);\\n\\n /// @notice Retrieves the stream's recipient.\\n /// @dev Reverts if the NFT has been burned.\\n /// @param streamId The stream ID for the query.\\n function getRecipient(\\n uint256 streamId\\n ) external view returns (address recipient);\\n\\n /// @notice Retrieves the amount refunded to the sender after a cancellation, denoted in units of the asset's\\n /// decimals. This amount is always zero unless the stream was canceled.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getRefundedAmount(\\n uint256 streamId\\n ) external view returns (uint128 refundedAmount);\\n\\n /// @notice Retrieves the stream's sender.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getSender(uint256 streamId) external view returns (address sender);\\n\\n /// @notice Retrieves the stream's start time, which is a Unix timestamp.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getStartTime(\\n uint256 streamId\\n ) external view returns (uint40 startTime);\\n\\n /// @notice Retrieves the amount withdrawn from the stream, denoted in units of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getWithdrawnAmount(\\n uint256 streamId\\n ) external view returns (uint128 withdrawnAmount);\\n\\n /// @notice Retrieves a flag indicating whether the provided address is a contract allowed to hook to Sablier\\n /// when a stream is canceled or when assets are withdrawn.\\n /// @dev See {ISablierLockupRecipient} for more information.\\n function isAllowedToHook(\\n address recipient\\n ) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream can be canceled. When the stream is cold, this\\n /// flag is always `false`.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isCancelable(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream is cold, i.e. settled, canceled, or depleted.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isCold(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream is depleted.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isDepleted(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream exists.\\n /// @dev Does not revert if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isStream(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream NFT can be transferred.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isTransferable(\\n uint256 streamId\\n ) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream is warm, i.e. either pending or streaming.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isWarm(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves the maximum broker fee that can be charged by the broker, denoted as a fixed-point\\n /// number where 1e18 is 100%.\\n /// @dev This value is hard coded as a constant.\\n function MAX_BROKER_FEE() external view returns (UD60x18);\\n\\n /// @notice Counter for stream IDs, used in the create functions.\\n function nextStreamId() external view returns (uint256);\\n\\n /// @notice Contract that generates the non-fungible token URI.\\n function nftDescriptor() external view returns (ISablierV2NFTDescriptor);\\n\\n /// @notice Calculates the amount that the sender would be refunded if the stream were canceled, denoted in units\\n /// of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function refundableAmountOf(\\n uint256 streamId\\n ) external view returns (uint128 refundableAmount);\\n\\n /// @notice Retrieves the stream's status.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function statusOf(\\n uint256 streamId\\n ) external view returns (Lockup.Status status);\\n\\n /// @notice Calculates the amount streamed to the recipient, denoted in units of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n ///\\n /// Notes:\\n /// - Upon cancellation of the stream, the amount streamed is calculated as the difference between the deposited\\n /// amount and the refunded amount. Ultimately, when the stream becomes depleted, the streamed amount is equivalent\\n /// to the total amount withdrawn.\\n ///\\n /// @param streamId The stream ID for the query.\\n function streamedAmountOf(\\n uint256 streamId\\n ) external view returns (uint128 streamedAmount);\\n\\n /// @notice Retrieves a flag indicating whether the stream was canceled.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function wasCanceled(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Calculates the amount that the recipient can withdraw from the stream, denoted in units of the asset's\\n /// decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function withdrawableAmountOf(\\n uint256 streamId\\n ) external view returns (uint128 withdrawableAmount);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n NON-CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Allows a recipient contract to hook to Sablier when a stream is canceled or when assets are withdrawn.\\n /// Useful for implementing contracts that hold streams on behalf of users, such as vaults or staking contracts.\\n ///\\n /// @dev Emits an {AllowToHook} event.\\n ///\\n /// Notes:\\n /// - Does not revert if the contract is already on the allowlist.\\n /// - This is an irreversible operation. The contract cannot be removed from the allowlist.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the contract admin.\\n /// - `recipient` must have a non-zero code size.\\n /// - `recipient` must implement {ISablierLockupRecipient}.\\n ///\\n /// @param recipient The address of the contract to allow for hooks.\\n function allowToHook(address recipient) external;\\n\\n /// @notice Burns the NFT associated with the stream.\\n ///\\n /// @dev Emits a {Transfer} event.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `streamId` must reference a depleted stream.\\n /// - The NFT must exist.\\n /// - `msg.sender` must be either the NFT owner or an approved third party.\\n ///\\n /// @param streamId The ID of the stream NFT to burn.\\n function burn(uint256 streamId) external;\\n\\n /// @notice Cancels the stream and refunds any remaining assets to the sender.\\n ///\\n /// @dev Emits a {Transfer}, {CancelLockupStream}, and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - If there any assets left for the recipient to withdraw, the stream is marked as canceled. Otherwise, the\\n /// stream is marked as depleted.\\n /// - This function attempts to invoke a hook on the recipient, if the resolved address is a contract.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - The stream must be warm and cancelable.\\n /// - `msg.sender` must be the stream's sender.\\n ///\\n /// @param streamId The ID of the stream to cancel.\\n function cancel(uint256 streamId) external;\\n\\n /// @notice Cancels multiple streams and refunds any remaining assets to the sender.\\n ///\\n /// @dev Emits multiple {Transfer}, {CancelLockupStream}, and {MetadataUpdate} events.\\n ///\\n /// Notes:\\n /// - Refer to the notes in {cancel}.\\n ///\\n /// Requirements:\\n /// - All requirements from {cancel} must be met for each stream.\\n ///\\n /// @param streamIds The IDs of the streams to cancel.\\n function cancelMultiple(uint256[] calldata streamIds) external;\\n\\n /// @notice Removes the right of the stream's sender to cancel the stream.\\n ///\\n /// @dev Emits a {RenounceLockupStream} and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - This is an irreversible operation.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `streamId` must reference a warm stream.\\n /// - `msg.sender` must be the stream's sender.\\n /// - The stream must be cancelable.\\n ///\\n /// @param streamId The ID of the stream to renounce.\\n function renounce(uint256 streamId) external;\\n\\n /// @notice Sets a new NFT descriptor contract, which produces the URI describing the Sablier stream NFTs.\\n ///\\n /// @dev Emits a {SetNFTDescriptor} and {BatchMetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - Does not revert if the NFT descriptor is the same.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the contract admin.\\n ///\\n /// @param newNFTDescriptor The address of the new NFT descriptor contract.\\n function setNFTDescriptor(\\n ISablierV2NFTDescriptor newNFTDescriptor\\n ) external;\\n\\n /// @notice Withdraws the provided amount of assets from the stream to the `to` address.\\n ///\\n /// @dev Emits a {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - This function attempts to call a hook on the recipient of the stream, unless `msg.sender` is the recipient.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `streamId` must not reference a null or depleted stream.\\n /// - `to` must not be the zero address.\\n /// - `amount` must be greater than zero and must not exceed the withdrawable amount.\\n /// - `to` must be the recipient if `msg.sender` is not the stream's recipient or an approved third party.\\n ///\\n /// @param streamId The ID of the stream to withdraw from.\\n /// @param to The address receiving the withdrawn assets.\\n /// @param amount The amount to withdraw, denoted in units of the asset's decimals.\\n function withdraw(uint256 streamId, address to, uint128 amount) external;\\n\\n /// @notice Withdraws the maximum withdrawable amount from the stream to the provided address `to`.\\n ///\\n /// @dev Emits a {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - Refer to the notes in {withdraw}.\\n ///\\n /// Requirements:\\n /// - Refer to the requirements in {withdraw}.\\n ///\\n /// @param streamId The ID of the stream to withdraw from.\\n /// @param to The address receiving the withdrawn assets.\\n /// @return withdrawnAmount The amount withdrawn, denoted in units of the asset's decimals.\\n function withdrawMax(\\n uint256 streamId,\\n address to\\n ) external returns (uint128 withdrawnAmount);\\n\\n /// @notice Withdraws the maximum withdrawable amount from the stream to the current recipient, and transfers the\\n /// NFT to `newRecipient`.\\n ///\\n /// @dev Emits a {WithdrawFromLockupStream} and a {Transfer} event.\\n ///\\n /// Notes:\\n /// - If the withdrawable amount is zero, the withdrawal is skipped.\\n /// - Refer to the notes in {withdraw}.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the stream's recipient.\\n /// - Refer to the requirements in {withdraw}.\\n /// - Refer to the requirements in {IERC721.transferFrom}.\\n ///\\n /// @param streamId The ID of the stream NFT to transfer.\\n /// @param newRecipient The address of the new owner of the stream NFT.\\n /// @return withdrawnAmount The amount withdrawn, denoted in units of the asset's decimals.\\n function withdrawMaxAndTransfer(\\n uint256 streamId,\\n address newRecipient\\n ) external returns (uint128 withdrawnAmount);\\n\\n /// @notice Withdraws assets from streams to the recipient of each stream.\\n ///\\n /// @dev Emits multiple {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} events.\\n ///\\n /// Notes:\\n /// - This function attempts to call a hook on the recipient of each stream, unless `msg.sender` is the recipient.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - There must be an equal number of `streamIds` and `amounts`.\\n /// - Each stream ID in the array must not reference a null or depleted stream.\\n /// - Each amount in the array must be greater than zero and must not exceed the withdrawable amount.\\n ///\\n /// @param streamIds The IDs of the streams to withdraw from.\\n /// @param amounts The amounts to withdraw, denoted in units of the asset's decimals.\\n function withdrawMultiple(\\n uint256[] calldata streamIds,\\n uint128[] calldata amounts\\n ) external;\\n}\\n\",\"keccak256\":\"0x3e5541c38a901637bd310965deb5bbde73ef07fe4ee3c752cbec330c6b9d62a3\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/ISablierV2LockupLinear.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\nimport {Lockup, LockupLinear} from \\\"./types/DataTypes.sol\\\";\\nimport {ISablierV2Lockup} from \\\"./ISablierV2Lockup.sol\\\";\\n\\n/// @title ISablierV2LockupLinear\\n/// @notice Creates and manages Lockup streams with a linear distribution function.\\ninterface ISablierV2LockupLinear is ISablierV2Lockup {\\n /*//////////////////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Emitted when a stream is created.\\n /// @param streamId The ID of the newly created stream.\\n /// @param funder The address which funded the stream.\\n /// @param sender The address distributing the assets, which will have the ability to cancel the stream.\\n /// @param recipient The address receiving the assets.\\n /// @param amounts Struct encapsulating (i) the deposit amount, and (ii) the broker fee amount, both denoted\\n /// in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Boolean indicating whether the stream will be cancelable or not.\\n /// @param transferable Boolean indicating whether the stream NFT is transferable or not.\\n /// @param timestamps Struct encapsulating (i) the stream's start time, (ii) cliff time, and (iii) end time, all as\\n /// Unix timestamps.\\n /// @param broker The address of the broker who has helped create the stream, e.g. a front-end website.\\n event CreateLockupLinearStream(\\n uint256 streamId,\\n address funder,\\n address indexed sender,\\n address indexed recipient,\\n Lockup.CreateAmounts amounts,\\n IERC20 indexed asset,\\n bool cancelable,\\n bool transferable,\\n LockupLinear.Timestamps timestamps,\\n address broker\\n );\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Retrieves the stream's cliff time, which is a Unix timestamp. A value of zero means there\\n /// is no cliff.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getCliffTime(\\n uint256 streamId\\n ) external view returns (uint40 cliffTime);\\n\\n /// @notice Retrieves the full stream details.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n /// @return stream See the documentation in {DataTypes}.\\n function getStream(\\n uint256 streamId\\n ) external view returns (LockupLinear.StreamLL memory stream);\\n\\n /// @notice Retrieves the stream's start, cliff and end timestamps.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n /// @return timestamps See the documentation in {DataTypes}.\\n function getTimestamps(\\n uint256 streamId\\n ) external view returns (LockupLinear.Timestamps memory timestamps);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n NON-CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Creates a stream by setting the start time to `block.timestamp`, and the end time to\\n /// the sum of `block.timestamp` and `params.durations.total`. The stream is funded by `msg.sender` and is wrapped\\n /// in an ERC-721 NFT.\\n ///\\n /// @dev Emits a {Transfer} and {CreateLockupLinearStream} event.\\n ///\\n /// Requirements:\\n /// - All requirements in {createWithTimestamps} must be met for the calculated parameters.\\n ///\\n /// @param params Struct encapsulating the function parameters, which are documented in {DataTypes}.\\n /// @return streamId The ID of the newly created stream.\\n function createWithDurations(\\n LockupLinear.CreateWithDurations calldata params\\n ) external returns (uint256 streamId);\\n\\n /// @notice Creates a stream with the provided start time and end time. The stream is funded by `msg.sender` and is\\n /// wrapped in an ERC-721 NFT.\\n ///\\n /// @dev Emits a {Transfer} and {CreateLockupLinearStream} event.\\n ///\\n /// Notes:\\n /// - A cliff time of zero means there is no cliff.\\n /// - As long as the times are ordered, it is not an error for the start or the cliff time to be in the past.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `params.totalAmount` must be greater than zero.\\n /// - If set, `params.broker.fee` must not be greater than `MAX_BROKER_FEE`.\\n /// - `params.timestamps.start` must be greater than zero and less than `params.timestamps.end`.\\n /// - If set, `params.timestamps.cliff` must be greater than `params.timestamps.start` and less than\\n /// `params.timestamps.end`.\\n /// - `params.timestamps.end` must be in the future.\\n /// - `params.recipient` must not be the zero address.\\n /// - `msg.sender` must have allowed this contract to spend at least `params.totalAmount` assets.\\n ///\\n /// @param params Struct encapsulating the function parameters, which are documented in {DataTypes}.\\n /// @return streamId The ID of the newly created stream.\\n function createWithTimestamps(\\n LockupLinear.CreateWithTimestamps calldata params\\n ) external returns (uint256 streamId);\\n}\\n\",\"keccak256\":\"0x064264723114b1f1cf3953fd79874dfcbb42cf313857aee6d5e6b09a23e0010b\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/ISablierV2NFTDescriptor.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC721Metadata} from \\\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\\\";\\n\\n/// @title ISablierV2NFTDescriptor\\n/// @notice This contract generates the URI describing the Sablier V2 stream NFTs.\\n/// @dev Inspired by Uniswap V3 Positions NFTs.\\ninterface ISablierV2NFTDescriptor {\\n /// @notice Produces the URI describing a particular stream NFT.\\n /// @dev This is a data URI with the JSON contents directly inlined.\\n /// @param sablier The address of the Sablier contract the stream was created in.\\n /// @param streamId The ID of the stream for which to produce a description.\\n /// @return uri The URI of the ERC721-compliant metadata.\\n function tokenURI(\\n IERC721Metadata sablier,\\n uint256 streamId\\n ) external view returns (string memory uri);\\n}\\n\",\"keccak256\":\"0x4ed430e553d14161e93efdaaacd1a502f49b38969c9d714b45d2e682a74fa0bc\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/types/DataTypes.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {UD2x18} from \\\"@prb/math/src/UD2x18.sol\\\";\\nimport {UD60x18} from \\\"@prb/math/src/UD60x18.sol\\\";\\n\\n// DataTypes.sol\\n//\\n// This file defines all structs used in V2 Core, most of which are organized under three namespaces:\\n//\\n// - Lockup\\n// - LockupDynamic\\n// - LockupLinear\\n// - LockupTranched\\n//\\n// You will notice that some structs contain \\\"slot\\\" annotations - they are used to indicate the\\n// storage layout of the struct. It is more gas efficient to group small data types together so\\n// that they fit in a single 32-byte slot.\\n\\n/// @notice Struct encapsulating the broker parameters passed to the create functions. Both can be set to zero.\\n/// @param account The address receiving the broker's fee.\\n/// @param fee The broker's percentage fee from the total amount, denoted as a fixed-point number where 1e18 is 100%.\\nstruct Broker {\\n address account;\\n UD60x18 fee;\\n}\\n\\n/// @notice Namespace for the structs used in both {SablierV2LockupLinear} and {SablierV2LockupDynamic}.\\nlibrary Lockup {\\n /// @notice Struct encapsulating the deposit, withdrawn, and refunded amounts, all denoted in units of the asset's\\n /// decimals.\\n /// @dev Because the deposited and the withdrawn amount are often read together, declaring them in the same slot\\n /// saves gas.\\n /// @param deposited The initial amount deposited in the stream, net of broker fee.\\n /// @param withdrawn The cumulative amount withdrawn from the stream.\\n /// @param refunded The amount refunded to the sender. Unless the stream was canceled, this is always zero.\\n struct Amounts {\\n // slot 0\\n uint128 deposited;\\n uint128 withdrawn;\\n // slot 1\\n uint128 refunded;\\n }\\n\\n /// @notice Struct encapsulating (i) the deposit amount and (ii) the broker fee amount, both denoted in units of the\\n /// asset's decimals.\\n /// @param deposit The amount to deposit in the stream.\\n /// @param brokerFee The broker fee amount.\\n struct CreateAmounts {\\n uint128 deposit;\\n uint128 brokerFee;\\n }\\n\\n /// @notice Enum representing the different statuses of a stream.\\n /// @custom:value0 PENDING Stream created but not started; assets are in a pending state.\\n /// @custom:value1 STREAMING Active stream where assets are currently being streamed.\\n /// @custom:value2 SETTLED All assets have been streamed; recipient is due to withdraw them.\\n /// @custom:value3 CANCELED Canceled stream; remaining assets await recipient's withdrawal.\\n /// @custom:value4 DEPLETED Depleted stream; all assets have been withdrawn and/or refunded.\\n enum Status {\\n PENDING,\\n STREAMING,\\n SETTLED,\\n CANCELED,\\n DEPLETED\\n }\\n\\n /// @notice A common data structure to be stored in all {SablierV2Lockup} models.\\n /// @dev The fields are arranged like this to save gas via tight variable packing.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream.\\n /// @param startTime The Unix timestamp indicating the stream's start.\\n /// @param endTime The Unix timestamp indicating the stream's end.\\n /// @param isCancelable Boolean indicating if the stream is cancelable.\\n /// @param wasCanceled Boolean indicating if the stream was canceled.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param isDepleted Boolean indicating if the stream is depleted.\\n /// @param isStream Boolean indicating if the struct entity exists.\\n /// @param isTransferable Boolean indicating if the stream NFT is transferable.\\n /// @param amounts Struct encapsulating the deposit, withdrawn, and refunded amounts, all denoted in units of the\\n /// asset's decimals.\\n struct Stream {\\n // slot 0\\n address sender;\\n uint40 startTime;\\n uint40 endTime;\\n bool isCancelable;\\n bool wasCanceled;\\n // slot 1\\n IERC20 asset;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n // slot 2 and 3\\n Lockup.Amounts amounts;\\n }\\n}\\n\\n/// @notice Namespace for the structs used in {SablierV2LockupDynamic}.\\nlibrary LockupDynamic {\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupDynamic.createWithDurations} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param segments Segments with durations used to compose the dynamic distribution function. Timestamps are\\n /// calculated by starting from `block.timestamp` and adding each duration to the previous timestamp.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithDurations {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n SegmentWithDuration[] segments;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupDynamic.createWithTimestamps} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param startTime The Unix timestamp indicating the stream's start.\\n /// @param segments Segments used to compose the dynamic distribution function.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithTimestamps {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n uint40 startTime;\\n Segment[] segments;\\n Broker broker;\\n }\\n\\n /// @notice Segment struct used in the Lockup Dynamic stream.\\n /// @param amount The amount of assets to be streamed in the segment, denoted in units of the asset's decimals.\\n /// @param exponent The exponent of the segment, denoted as a fixed-point number.\\n /// @param timestamp The Unix timestamp indicating the segment's end.\\n struct Segment {\\n // slot 0\\n uint128 amount;\\n UD2x18 exponent;\\n uint40 timestamp;\\n }\\n\\n /// @notice Segment struct used at runtime in {SablierV2LockupDynamic.createWithDurations}.\\n /// @param amount The amount of assets to be streamed in the segment, denoted in units of the asset's decimals.\\n /// @param exponent The exponent of the segment, denoted as a fixed-point number.\\n /// @param duration The time difference in seconds between the segment and the previous one.\\n struct SegmentWithDuration {\\n uint128 amount;\\n UD2x18 exponent;\\n uint40 duration;\\n }\\n\\n /// @notice Struct encapsulating the full details of a stream.\\n /// @dev Extends `Lockup.Stream` by including the recipient and the segments.\\n struct StreamLD {\\n address sender;\\n address recipient;\\n uint40 startTime;\\n uint40 endTime;\\n bool isCancelable;\\n bool wasCanceled;\\n IERC20 asset;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n Lockup.Amounts amounts;\\n Segment[] segments;\\n }\\n\\n /// @notice Struct encapsulating the LockupDynamic timestamps.\\n /// @param start The Unix timestamp indicating the stream's start.\\n /// @param end The Unix timestamp indicating the stream's end.\\n struct Timestamps {\\n uint40 start;\\n uint40 end;\\n }\\n}\\n\\n/// @notice Namespace for the structs used in {SablierV2LockupLinear}.\\nlibrary LockupLinear {\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupLinear.createWithDurations} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param durations Struct encapsulating (i) cliff period duration and (ii) total stream duration, both in seconds.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithDurations {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n Durations durations;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupLinear.createWithTimestamps} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param timestamps Struct encapsulating (i) the stream's start time, (ii) cliff time, and (iii) end time, all as\\n /// Unix timestamps.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithTimestamps {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n Timestamps timestamps;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the cliff duration and the total duration.\\n /// @param cliff The cliff duration in seconds.\\n /// @param total The total duration in seconds.\\n struct Durations {\\n uint40 cliff;\\n uint40 total;\\n }\\n\\n /// @notice Struct encapsulating the full details of a stream.\\n /// @dev Extends `Lockup.Stream` by including the recipient and the cliff time.\\n struct StreamLL {\\n address sender;\\n address recipient;\\n uint40 startTime;\\n bool isCancelable;\\n bool wasCanceled;\\n IERC20 asset;\\n uint40 endTime;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n Lockup.Amounts amounts;\\n uint40 cliffTime;\\n }\\n\\n /// @notice Struct encapsulating the LockupLinear timestamps.\\n /// @param start The Unix timestamp for the stream's start.\\n /// @param cliff The Unix timestamp for the cliff period's end. A value of zero means there is no cliff.\\n /// @param end The Unix timestamp for the stream's end.\\n struct Timestamps {\\n uint40 start;\\n uint40 cliff;\\n uint40 end;\\n }\\n}\\n\\n/// @notice Namespace for the structs used in {SablierV2LockupTranched}.\\nlibrary LockupTranched {\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupTranched.createWithDurations} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param tranches Tranches with durations used to compose the tranched distribution function. Timestamps are\\n /// calculated by starting from `block.timestamp` and adding each duration to the previous timestamp.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithDurations {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n TrancheWithDuration[] tranches;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupTranched.createWithTimestamps} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param startTime The Unix timestamp indicating the stream's start.\\n /// @param tranches Tranches used to compose the tranched distribution function.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithTimestamps {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n uint40 startTime;\\n Tranche[] tranches;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the full details of a stream.\\n /// @dev Extends `Lockup.Stream` by including the recipient and the tranches.\\n struct StreamLT {\\n address sender;\\n address recipient;\\n uint40 startTime;\\n uint40 endTime;\\n bool isCancelable;\\n bool wasCanceled;\\n IERC20 asset;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n Lockup.Amounts amounts;\\n Tranche[] tranches;\\n }\\n\\n /// @notice Struct encapsulating the LockupTranched timestamps.\\n /// @param start The Unix timestamp indicating the stream's start.\\n /// @param end The Unix timestamp indicating the stream's end.\\n struct Timestamps {\\n uint40 start;\\n uint40 end;\\n }\\n\\n /// @notice Tranche struct used in the Lockup Tranched stream.\\n /// @param amount The amount of assets to be unlocked in the tranche, denoted in units of the asset's decimals.\\n /// @param timestamp The Unix timestamp indicating the tranche's end.\\n struct Tranche {\\n // slot 0\\n uint128 amount;\\n uint40 timestamp;\\n }\\n\\n /// @notice Tranche struct used at runtime in {SablierV2LockupTranched.createWithDurations}.\\n /// @param amount The amount of assets to be unlocked in the tranche, denoted in units of the asset's decimals.\\n /// @param duration The time difference in seconds between the tranche and the previous one.\\n struct TrancheWithDuration {\\n uint128 amount;\\n uint40 duration;\\n }\\n}\\n\",\"keccak256\":\"0x727722c0ec71a76a947b935c9dfcac8fd846d6c3547dfbc8739c7109f3b95068\",\"license\":\"GPL-3.0-or-later\"},\"contracts/modules/DecentHatsCreationModule.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.28;\\n\\nimport {Enum} from \\\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\\\";\\nimport {IAvatar} from \\\"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol\\\";\\nimport {Strings} from \\\"@openzeppelin/contracts/utils/Strings.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IERC6551Registry} from \\\"../interfaces/IERC6551Registry.sol\\\";\\nimport {IHats} from \\\"../interfaces/hats/IHats.sol\\\";\\nimport {LockupLinear, Broker} from \\\"../interfaces/sablier/types/DataTypes.sol\\\";\\nimport {IHatsModuleFactory} from \\\"../interfaces/hats/IHatsModuleFactory.sol\\\";\\nimport {IHatsElectionsEligibility} from \\\"../interfaces/hats/modules/IHatsElectionsEligibility.sol\\\";\\nimport {ModuleProxyFactory} from \\\"@gnosis.pm/zodiac/contracts/factory/ModuleProxyFactory.sol\\\";\\nimport {ISablierV2LockupLinear} from \\\"../interfaces/sablier/ISablierV2LockupLinear.sol\\\";\\nimport {DecentHatsModuleUtils} from \\\"./DecentHatsModuleUtils.sol\\\";\\n\\ncontract DecentHatsCreationModule is DecentHatsModuleUtils {\\n struct TopHatParams {\\n string details;\\n string imageURI;\\n }\\n\\n struct AdminHatParams {\\n string details;\\n string imageURI;\\n bool isMutable;\\n }\\n\\n struct CreateTreeParams {\\n IHats hatsProtocol;\\n IERC6551Registry erc6551Registry;\\n IHatsModuleFactory hatsModuleFactory;\\n ModuleProxyFactory moduleProxyFactory;\\n address keyValuePairs;\\n address decentAutonomousAdminImplementation;\\n address hatsAccountImplementation;\\n address hatsElectionsEligibilityImplementation;\\n TopHatParams topHat;\\n AdminHatParams adminHat;\\n HatParams[] hats;\\n }\\n\\n /* /////////////////////////////////////////////////////////////////////////////\\n EXTERNAL FUNCTIONS\\n ///////////////////////////////////////////////////////////////////////////// */\\n /**\\n * @notice For a safe without any roles previously created on it, this function should be called. It sets up the\\n * top hat and admin hat, as well as any other hats and their streams that are provided, then transfers the top hat\\n * to the calling safe.\\n *\\n * @notice This contract should be enabled a module on the Safe for which the role(s) are to be created, and disabled after.\\n *\\n * @dev For each hat that is included, if the hat is:\\n * - termed, its stream funds on are targeted directly at the nominated wearer. The wearer should directly call `withdraw-`\\n * on the Sablier contract.\\n * - untermed, its stream funds are targeted at the hat's smart account. In order to withdraw funds from the stream, the\\n * hat's smart account must be the one call to `withdraw-` on the Sablier contract, setting the recipient arg to its wearer.\\n *\\n * @dev In order for a Safe to seamlessly create roles even if it has never previously created a role and thus has\\n * no hat tree, we defer the creation of the hat tree and its setup to this contract. This way, in a single tx block,\\n * the resulting topHatId of the newly created hat can be used to create an admin hat and any other hats needed.\\n * We also make use of `KeyValuePairs` to associate the topHatId with the Safe.\\n *\\n * @param treeParams The parameters for creating the Hat Tree with Roles\\n */\\n function createAndDeclareTree(\\n CreateTreeParams calldata treeParams\\n ) external {\\n // Create Top Hat\\n (uint256 topHatId, address topHatAccount) = _processTopHat(\\n treeParams.hatsProtocol,\\n treeParams.erc6551Registry,\\n treeParams.hatsAccountImplementation,\\n treeParams.keyValuePairs,\\n treeParams.topHat\\n );\\n\\n // Create Admin Hat\\n uint256 adminHatId = _processAdminHat(\\n treeParams.hatsProtocol,\\n treeParams.erc6551Registry,\\n treeParams.hatsAccountImplementation,\\n topHatId,\\n topHatAccount,\\n treeParams.moduleProxyFactory,\\n treeParams.decentAutonomousAdminImplementation,\\n treeParams.adminHat\\n );\\n\\n // Create Role Hats\\n _processRoleHats(\\n CreateRoleHatsParams({\\n hatsProtocol: treeParams.hatsProtocol,\\n erc6551Registry: treeParams.erc6551Registry,\\n hatsAccountImplementation: treeParams.hatsAccountImplementation,\\n topHatId: topHatId,\\n topHatAccount: topHatAccount,\\n hatsModuleFactory: treeParams.hatsModuleFactory,\\n hatsElectionsEligibilityImplementation: treeParams\\n .hatsElectionsEligibilityImplementation,\\n adminHatId: adminHatId,\\n hats: treeParams.hats\\n })\\n );\\n }\\n\\n /* /////////////////////////////////////////////////////////////////////////////\\n INTERNAL FUNCTIONS\\n ///////////////////////////////////////////////////////////////////////////// */\\n\\n function _processTopHat(\\n IHats hatsProtocol,\\n IERC6551Registry erc6551Registry,\\n address hatsAccountImplementation,\\n address keyValuePairs,\\n TopHatParams calldata topHat\\n ) internal returns (uint256 topHatId, address topHatAccount) {\\n // Call lastTopHatId() and properly decode the response\\n (bool success, bytes memory data) = address(hatsProtocol).call(\\n abi.encodeWithSignature(\\\"lastTopHatId()\\\")\\n );\\n require(success, \\\"Failed to get lastTopHatId\\\");\\n topHatId = (abi.decode(data, (uint256)) + 1) << 224;\\n\\n // Mint Top Hat to the Safe\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"mintTopHat(address,string,string)\\\",\\n msg.sender,\\n topHat.details,\\n topHat.imageURI\\n ),\\n Enum.Operation.Call\\n );\\n\\n // Create Top Hat's ERC6551 Account\\n topHatAccount = erc6551Registry.createAccount(\\n hatsAccountImplementation,\\n SALT,\\n block.chainid,\\n address(hatsProtocol),\\n topHatId\\n );\\n\\n // Declare Top Hat ID to Safe via KeyValuePairs\\n string[] memory keys = new string[](1);\\n string[] memory values = new string[](1);\\n keys[0] = \\\"topHatId\\\";\\n values[0] = Strings.toString(topHatId);\\n IAvatar(msg.sender).execTransactionFromModule(\\n keyValuePairs,\\n 0,\\n abi.encodeWithSignature(\\n \\\"updateValues(string[],string[])\\\",\\n keys,\\n values\\n ),\\n Enum.Operation.Call\\n );\\n }\\n\\n function _processAdminHat(\\n IHats hatsProtocol,\\n IERC6551Registry erc6551Registry,\\n address hatsAccountImplementation,\\n uint256 topHatId,\\n address topHatAccount,\\n ModuleProxyFactory moduleProxyFactory,\\n address decentAutonomousAdminImplementation,\\n AdminHatParams calldata adminHat\\n ) internal returns (uint256 adminHatId) {\\n // Create Admin Hat\\n adminHatId = hatsProtocol.getNextId(topHatId);\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"createHat(uint256,string,uint32,address,address,bool,string)\\\",\\n topHatId,\\n adminHat.details,\\n 1, // only one Admin Hat\\n topHatAccount,\\n topHatAccount,\\n adminHat.isMutable,\\n adminHat.imageURI\\n ),\\n Enum.Operation.Call\\n );\\n\\n // Create Admin Hat's ERC6551 Account\\n erc6551Registry.createAccount(\\n hatsAccountImplementation,\\n SALT,\\n block.chainid,\\n address(hatsProtocol),\\n adminHatId\\n );\\n\\n // Deploy Decent Autonomous Admin Module, which will wear the Admin Hat\\n address autonomousAdmin = moduleProxyFactory.deployModule(\\n decentAutonomousAdminImplementation,\\n abi.encodeWithSignature(\\\"setUp(bytes)\\\", bytes(\\\"\\\")),\\n uint256(\\n keccak256(\\n abi.encodePacked(\\n // for the salt, we'll concatenate our static salt\\n // with the Admin Hat ID\\n SALT,\\n adminHatId\\n )\\n )\\n )\\n );\\n\\n // Mint Hat to the Decent Autonomous Admin Module\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"mintHat(uint256,address)\\\",\\n adminHatId,\\n autonomousAdmin\\n ),\\n Enum.Operation.Call\\n );\\n }\\n}\\n\",\"keccak256\":\"0x0d952c31bdbe70343c618cdab6930200c3064eee26ccfb6913a94a2be635dd41\",\"license\":\"MIT\"},\"contracts/modules/DecentHatsModuleUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.28;\\n\\nimport {Enum} from \\\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\\\";\\nimport {IAvatar} from \\\"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IERC6551Registry} from \\\"../interfaces/IERC6551Registry.sol\\\";\\nimport {IHats} from \\\"../interfaces/hats/IHats.sol\\\";\\nimport {LockupLinear, Broker} from \\\"../interfaces/sablier/types/DataTypes.sol\\\";\\nimport {IHatsModuleFactory} from \\\"../interfaces/hats/IHatsModuleFactory.sol\\\";\\nimport {ISablierV2LockupLinear} from \\\"../interfaces/sablier/ISablierV2LockupLinear.sol\\\";\\n\\nabstract contract DecentHatsModuleUtils {\\n bytes32 public constant SALT =\\n 0x5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b5072;\\n\\n struct SablierStreamParams {\\n ISablierV2LockupLinear sablier;\\n address sender;\\n address asset;\\n LockupLinear.Timestamps timestamps;\\n Broker broker;\\n uint128 totalAmount;\\n bool cancelable;\\n bool transferable;\\n }\\n\\n struct HatParams {\\n address wearer;\\n string details;\\n string imageURI;\\n SablierStreamParams[] sablierStreamsParams;\\n uint128 termEndDateTs; // If 0, this is an untermed Hat\\n uint32 maxSupply;\\n bool isMutable;\\n }\\n\\n struct CreateRoleHatsParams {\\n IHats hatsProtocol;\\n IERC6551Registry erc6551Registry;\\n address hatsAccountImplementation;\\n uint256 topHatId;\\n address topHatAccount;\\n IHatsModuleFactory hatsModuleFactory;\\n address hatsElectionsEligibilityImplementation;\\n uint256 adminHatId;\\n HatParams[] hats;\\n }\\n\\n function _processRoleHats(\\n CreateRoleHatsParams memory roleHatsParams\\n ) internal {\\n for (uint256 i = 0; i < roleHatsParams.hats.length; ) {\\n HatParams memory hatParams = roleHatsParams.hats[i];\\n\\n // Create eligibility module if needed\\n address eligibilityAddress = _createEligibilityModule(\\n roleHatsParams.hatsProtocol,\\n roleHatsParams.hatsModuleFactory,\\n roleHatsParams.hatsElectionsEligibilityImplementation,\\n roleHatsParams.topHatId,\\n roleHatsParams.topHatAccount,\\n roleHatsParams.adminHatId,\\n hatParams.termEndDateTs\\n );\\n\\n // Create and Mint the Role Hat\\n uint256 hatId = _createAndMintHat(\\n roleHatsParams.hatsProtocol,\\n roleHatsParams.adminHatId,\\n hatParams,\\n eligibilityAddress,\\n roleHatsParams.topHatAccount\\n );\\n\\n // Get the stream recipient (based on termed or not)\\n address streamRecipient = _setupStreamRecipient(\\n roleHatsParams.erc6551Registry,\\n roleHatsParams.hatsAccountImplementation,\\n address(roleHatsParams.hatsProtocol),\\n hatParams.termEndDateTs,\\n hatParams.wearer,\\n hatId\\n );\\n\\n // Create streams\\n _processSablierStreams(\\n hatParams.sablierStreamsParams,\\n streamRecipient\\n );\\n\\n unchecked {\\n ++i;\\n }\\n }\\n }\\n\\n function _createEligibilityModule(\\n IHats hatsProtocol,\\n IHatsModuleFactory hatsModuleFactory,\\n address hatsElectionsEligibilityImplementation,\\n uint256 topHatId,\\n address topHatAccount,\\n uint256 adminHatId,\\n uint128 termEndDateTs\\n ) private returns (address) {\\n // If the Hat is termed, create the eligibility module\\n if (termEndDateTs != 0) {\\n return\\n hatsModuleFactory.createHatsModule(\\n hatsElectionsEligibilityImplementation,\\n hatsProtocol.getNextId(adminHatId),\\n abi.encode(topHatId, uint256(0)), // [BALLOT_BOX_ID, ADMIN_HAT_ID]\\n abi.encode(termEndDateTs),\\n uint256(SALT)\\n );\\n }\\n\\n // Otherwise, return the Top Hat account\\n return topHatAccount;\\n }\\n\\n function _createAndMintHat(\\n IHats hatsProtocol,\\n uint256 adminHatId,\\n HatParams memory hat,\\n address eligibilityAddress,\\n address topHatAccount\\n ) private returns (uint256) {\\n // Grab the next Hat ID (before creating it)\\n uint256 hatId = hatsProtocol.getNextId(adminHatId);\\n\\n // Create the new Hat\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"createHat(uint256,string,uint32,address,address,bool,string)\\\",\\n adminHatId,\\n hat.details,\\n hat.maxSupply,\\n eligibilityAddress,\\n topHatAccount,\\n hat.isMutable,\\n hat.imageURI\\n ),\\n Enum.Operation.Call\\n );\\n\\n // If the Hat is termed, nominate the wearer as the eligible member\\n if (hat.termEndDateTs != 0) {\\n address[] memory nominatedWearers = new address[](1);\\n nominatedWearers[0] = hat.wearer;\\n\\n IAvatar(msg.sender).execTransactionFromModule(\\n eligibilityAddress,\\n 0,\\n abi.encodeWithSignature(\\n \\\"elect(uint128,address[])\\\",\\n hat.termEndDateTs,\\n nominatedWearers\\n ),\\n Enum.Operation.Call\\n );\\n }\\n\\n // Mint the Hat\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"mintHat(uint256,address)\\\",\\n hatId,\\n hat.wearer\\n ),\\n Enum.Operation.Call\\n );\\n return hatId;\\n }\\n\\n // Exists to avoid stack too deep errors\\n function _setupStreamRecipient(\\n IERC6551Registry erc6551Registry,\\n address hatsAccountImplementation,\\n address hatsProtocol,\\n uint128 termEndDateTs,\\n address wearer,\\n uint256 hatId\\n ) private returns (address) {\\n // If the hat is termed, the wearer is the stream recipient\\n if (termEndDateTs != 0) {\\n return wearer;\\n }\\n\\n // Otherwise, the Hat's smart account is the stream recipient\\n return\\n erc6551Registry.createAccount(\\n hatsAccountImplementation,\\n SALT,\\n block.chainid,\\n hatsProtocol,\\n hatId\\n );\\n }\\n\\n function _processSablierStreams(\\n SablierStreamParams[] memory streamParams,\\n address streamRecipient\\n ) private {\\n for (uint256 i = 0; i < streamParams.length; ) {\\n SablierStreamParams memory sablierStreamParams = streamParams[i];\\n\\n // Approve tokens for Sablier\\n IAvatar(msg.sender).execTransactionFromModule(\\n sablierStreamParams.asset,\\n 0,\\n abi.encodeWithSignature(\\n \\\"approve(address,uint256)\\\",\\n sablierStreamParams.sablier,\\n sablierStreamParams.totalAmount\\n ),\\n Enum.Operation.Call\\n );\\n\\n // Proxy the Sablier call through IAvatar\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(sablierStreamParams.sablier),\\n 0,\\n abi.encodeWithSignature(\\n \\\"createWithTimestamps((address,address,uint128,address,bool,bool,(uint40,uint40,uint40),(address,uint256)))\\\",\\n LockupLinear.CreateWithTimestamps({\\n sender: sablierStreamParams.sender,\\n recipient: streamRecipient,\\n totalAmount: sablierStreamParams.totalAmount,\\n asset: IERC20(sablierStreamParams.asset),\\n cancelable: sablierStreamParams.cancelable,\\n transferable: sablierStreamParams.transferable,\\n timestamps: sablierStreamParams.timestamps,\\n broker: sablierStreamParams.broker\\n })\\n ),\\n Enum.Operation.Call\\n );\\n\\n unchecked {\\n ++i;\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x357c5264ecb63f8f15f67ffb7498c7fb55d9efe8d46358790933b4892bd38cde\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x6080604052348015600f57600080fd5b50611eb88061001f6000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c8063ba9a91a51461003b578063d58041b714610062575b600080fd5b610050600080516020611e6383398151915281565b60405190815260200160405180910390f35b6100756100703660046112ff565b610077565b005b6000806100cd61008a6020850185611359565b61009a6040860160208701611359565b6100aa60e0870160c08801611359565b6100ba60a0880160808901611359565b6100c8610100890189611386565b610227565b909250905060006101396100e46020860186611359565b6100f46040870160208801611359565b61010460e0880160c08901611359565b868661011660808b0160608c01611359565b61012660c08c0160a08d01611359565b6101346101208d018d6113a6565b610603565b604080516101208101909152909150610221908061015a6020880188611359565b6001600160a01b0316815260200186602001602081019061017b9190611359565b6001600160a01b0316815260200161019960e0880160c08901611359565b6001600160a01b03168152602001858152602001846001600160a01b031681526020018660400160208101906101cf9190611359565b6001600160a01b031681526020016101ee610100880160e08901611359565b6001600160a01b03168152602081018490526040016102116101408801886113bc565b61021a9161175d565b905261099f565b50505050565b60408051600481526024810182526020810180516001600160e01b0316633f0f816960e21b17905290516000918291829182916001600160a01b038b169161026e916118bf565b6000604051808303816000865af19150503d80600081146102ab576040519150601f19603f3d011682016040523d82523d6000602084013e6102b0565b606091505b5091509150816103065760405162461bcd60e51b815260206004820152601a60248201527f4661696c656420746f20676574206c617374546f704861744964000000000000604482015260640160405180910390fd5b60e08180602001905181019061031c91906118d1565b610327906001611900565b901b93503363468721a78a60008361033f8a80611919565b61034c60208d018d611919565b604051602401610360959493929190611988565b60408051601f198184030181529181526020820180516001600160e01b0316631a64dfad60e01b1790525160e085901b6001600160e01b03191681526103ae939291906000906004016119f8565b6020604051808303816000875af11580156103cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103f19190611a4e565b50604051638a54c52f60e01b81526001600160a01b03891690638a54c52f90610434908a90600080516020611e638339815191529046908f908b90600401611a6b565b6020604051808303816000875af1158015610453573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104779190611a9e565b60408051600180825281830190925291945060009190816020015b606081526020019060019003908161049257505060408051600180825281830190925291925060009190602082015b60608152602001906001900390816104c1579050509050604051806040016040528060088152602001671d1bdc12185d125960c21b8152508260008151811061050c5761050c611abb565b602002602001018190525061052086610a66565b8160008151811061053357610533611abb565b6020026020010181905250336001600160a01b031663468721a78960008585604051602401610563929190611b2d565b60408051601f198184030181529181526020820180516001600160e01b031663579374b960e11b1790525160e085901b6001600160e01b03191681526105b1939291906000906004016119f8565b6020604051808303816000875af11580156105d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105f49190611a4e565b50505050509550959350505050565b60405162460ea360e61b8152600481018690526000906001600160a01b038a1690631183a8c090602401602060405180830381865afa15801561064a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061066e91906118d1565b90503363468721a78a6000896106848780611919565b60018c8061069860608d0160408e01611b5b565b6106a560208e018e611919565b6040516024016106bd99989796959493929190611b78565b60408051601f198184030181529181526020820180516001600160e01b0316635829492f60e11b1790525160e085901b6001600160e01b031916815261070b939291906000906004016119f8565b6020604051808303816000875af115801561072a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061074e9190611a4e565b50604051638a54c52f60e01b81526001600160a01b03891690638a54c52f90610791908a90600080516020611e638339815191529046908f908890600401611a6b565b6020604051808303816000875af11580156107b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107d49190611a9e565b506000846001600160a01b031663f1ab873c85604051806020016040528060008152506040516024016108079190611bdd565b60408051601f19818403018152918152602080830180516001600160e01b031663a4f9edbf60e01b179052905161085991600080516020611e6383398151915291899101918252602082015260400190565b60408051601f198184030181529082905280516020909101206001600160e01b031960e086901b168252610891939291600401611bf0565b6020604051808303816000875af11580156108b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108d49190611a9e565b604051602481018490526001600160a01b0382166044820152909150339063468721a7908c9060009060640160408051601f198184030181529181526020820180516001600160e01b031663320fbbb760e11b1790525160e085901b6001600160e01b031916815261094e939291906000906004016119f8565b6020604051808303816000875af115801561096d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109919190611a4e565b505098975050505050505050565b60005b81610100015151811015610a6257600082610100015182815181106109c9576109c9611abb565b602002602001015190506000610a0084600001518560a001518660c00151876060015188608001518960e001518860800151610b6e565b90506000610a1d85600001518660e0015185858960800151610cd5565b90506000610a438660200151876040015188600001518760800151886000015187611007565b9050610a538460600151826110b1565b846001019450505050506109a2565b5050565b606081600003610a8d5750506040805180820190915260018152600360fc1b602082015290565b8160005b8115610ab75780610aa181611c24565b9150610ab09050600a83611c53565b9150610a91565b6000816001600160401b03811115610ad157610ad161140c565b6040519080825280601f01601f191660200182016040528015610afb576020820181803683370190505b5090505b8415610b6657610b10600183611c67565b9150610b1d600a86611c7a565b610b28906030611900565b60f81b818381518110610b3d57610b3d611abb565b60200101906001600160f81b031916908160001a905350610b5f600a86611c53565b9450610aff565b949350505050565b60006001600160801b03821615610cc757866001600160a01b0316632f7fb7b6878a6001600160a01b0316631183a8c0876040518263ffffffff1660e01b8152600401610bbd91815260200190565b602060405180830381865afa158015610bda573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bfe91906118d1565b886000604051602001610c1b929190918252602082015260400190565b60408051601f198184030181528282526001600160801b0389166020840152910160408051601f19818403018152908290526001600160e01b031960e087901b168252610c7d94939291600080516020611e6383398151915290600401611c8e565b6020604051808303816000875af1158015610c9c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cc09190611a9e565b9050610cca565b50825b979650505050505050565b60405162460ea360e61b81526004810185905260009081906001600160a01b03881690631183a8c090602401602060405180830381865afa158015610d1e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d4291906118d1565b9050336001600160a01b031663468721a78860008989602001518a60a001518a8a8d60c001518e60400151604051602401610d839796959493929190611cda565b60408051601f198184030181529181526020820180516001600160e01b0316635829492f60e11b1790525160e085901b6001600160e01b0319168152610dd1939291906000906004016119f8565b6020604051808303816000875af1158015610df0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e149190611a4e565b5060808501516001600160801b031615610f3f5760408051600180825281830190925260009160208083019080368337019050509050856000015181600081518110610e6257610e62611abb565b60200260200101906001600160a01b031690816001600160a01b031681525050336001600160a01b031663468721a7866000896080015185604051602401610eab929190611d3e565b60408051601f198184030181529181526020820180516001600160e01b0316634a231cef60e01b1790525160e085901b6001600160e01b0319168152610ef9939291906000906004016119f8565b6020604051808303816000875af1158015610f18573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f3c9190611a4e565b50505b8451604051602481018390526001600160a01b039091166044820152339063468721a790899060009060640160408051601f198184030181529181526020820180516001600160e01b031663320fbbb760e11b1790525160e085901b6001600160e01b0319168152610fb9939291906000906004016119f8565b6020604051808303816000875af1158015610fd8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ffc9190611a4e565b509695505050505050565b60006001600160801b0384161561101f5750816110a7565b604051638a54c52f60e01b81526001600160a01b03881690638a54c52f90611061908990600080516020611e638339815191529046908b908990600401611a6b565b6020604051808303816000875af1158015611080573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110a49190611a9e565b90505b9695505050505050565b60005b82518110156112fa5760008382815181106110d1576110d1611abb565b60200260200101519050336001600160a01b031663468721a78260400151600084600001518560a001516040516024016111299291906001600160a01b039290921682526001600160801b0316602082015260400190565b60408051601f198184030181529181526020820180516001600160e01b031663095ea7b360e01b1790525160e085901b6001600160e01b0319168152611177939291906000906004016119f8565b6020604051808303816000875af1158015611196573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111ba9190611a4e565b50336001600160a01b031663468721a78260000151600060405180610100016040528086602001516001600160a01b03168152602001886001600160a01b031681526020018660a001516001600160801b0316815260200186604001516001600160a01b031681526020018660c00151151581526020018660e001511515815260200186606001518152602001866080015181525060405160240161125f9190611d93565b60408051601f198184030181529181526020820180516001600160e01b03166353b1572760e01b1790525160e085901b6001600160e01b03191681526112ad939291906000906004016119f8565b6020604051808303816000875af11580156112cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112f09190611a4e565b50506001016110b4565b505050565b60006020828403121561131157600080fd5b81356001600160401b0381111561132757600080fd5b8201610160818503121561133a57600080fd5b9392505050565b6001600160a01b038116811461135657600080fd5b50565b60006020828403121561136b57600080fd5b813561133a81611341565b803561138181611341565b919050565b60008235603e1983360301811261139c57600080fd5b9190910192915050565b60008235605e1983360301811261139c57600080fd5b6000808335601e198436030181126113d357600080fd5b8301803591506001600160401b038211156113ed57600080fd5b6020019150600581901b360382131561140557600080fd5b9250929050565b634e487b7160e01b600052604160045260246000fd5b60405161010081016001600160401b03811182821017156114455761144561140c565b60405290565b60405160e081016001600160401b03811182821017156114455761144561140c565b604051601f8201601f191681016001600160401b03811182821017156114955761149561140c565b604052919050565b60006001600160401b038211156114b6576114b661140c565b5060051b60200190565b600082601f8301126114d157600080fd5b81356001600160401b038111156114ea576114ea61140c565b6114fd601f8201601f191660200161146d565b81815284602083860101111561151257600080fd5b816020850160208301376000918101602001919091529392505050565b803564ffffffffff8116811461138157600080fd5b60006060828403121561155657600080fd5b604051606081016001600160401b03811182821017156115785761157861140c565b6040529050806115878361152f565b81526115956020840161152f565b60208201526115a66040840161152f565b60408201525092915050565b6000604082840312156115c457600080fd5b604080519081016001600160401b03811182821017156115e6576115e661140c565b60405290508082356115f781611341565b8152602092830135920191909152919050565b80356001600160801b038116811461138157600080fd5b801515811461135657600080fd5b803561138181611621565b600082601f83011261164b57600080fd5b813561165e6116598261149d565b61146d565b808282526020820191506020610160840286010192508583111561168157600080fd5b602085015b8381101561173f57610160818803121561169f57600080fd5b6116a7611422565b6116b082611376565b81526116be60208301611376565b60208201526116cf60408301611376565b60408201526116e18860608401611544565b60608201526116f38860c084016115b2565b6080820152611705610100830161160a565b60a0820152611717610120830161162f565b60c0820152611729610140830161162f565b60e0820152835260209092019161016001611686565b5095945050505050565b803563ffffffff8116811461138157600080fd5b600061176b6116598461149d565b8381526020810190600585901b84013681111561178757600080fd5b845b818110156118905780356001600160401b038111156117a757600080fd5b860160e03682900312156117ba57600080fd5b6117c261144b565b6117cb82611376565b815260208201356001600160401b038111156117e657600080fd5b6117f2368285016114c0565b60208301525060408201356001600160401b0381111561181157600080fd5b61181d368285016114c0565b60408301525060608201356001600160401b0381111561183c57600080fd5b6118483682850161163a565b60608301525061185a6080830161160a565b608082015261186b60a08301611749565b60a082015261187c60c0830161162f565b60c082015285525060209384019301611789565b509095945050505050565b60005b838110156118b657818101518382015260200161189e565b50506000910152565b6000825161139c81846020870161189b565b6000602082840312156118e357600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b80820180821115611913576119136118ea565b92915050565b6000808335601e1984360301811261193057600080fd5b8301803591506001600160401b0382111561194a57600080fd5b60200191503681900382131561140557600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b03861681526060602082018190526000906119ad908301868861195f565b82810360408401526119c081858761195f565b98975050505050505050565b600081518084526119e481602086016020860161189b565b601f01601f19169290920160200192915050565b60018060a01b0385168152836020820152608060408201526000611a1f60808301856119cc565b905060028310611a3f57634e487b7160e01b600052602160045260246000fd5b82606083015295945050505050565b600060208284031215611a6057600080fd5b815161133a81611621565b6001600160a01b039586168152602081019490945260408401929092529092166060820152608081019190915260a00190565b600060208284031215611ab057600080fd5b815161133a81611341565b634e487b7160e01b600052603260045260246000fd5b600082825180855260208501945060208160051b8301016020850160005b83811015611b2157601f19858403018852611b0b8383516119cc565b6020988901989093509190910190600101611aef565b50909695505050505050565b604081526000611b406040830185611ad1565b8281036020840152611b528185611ad1565b95945050505050565b600060208284031215611b6d57600080fd5b813561133a81611621565b89815260e060208201526000611b9260e083018a8c61195f565b60ff891660408401526001600160a01b0388811660608501528716608084015285151560a084015282810360c0840152611bcd81858761195f565b9c9b505050505050505050505050565b60208152600061133a60208301846119cc565b6001600160a01b0384168152606060208201819052600090611c14908301856119cc565b9050826040830152949350505050565b600060018201611c3657611c366118ea565b5060010190565b634e487b7160e01b600052601260045260246000fd5b600082611c6257611c62611c3d565b500490565b81810381811115611913576119136118ea565b600082611c8957611c89611c3d565b500690565b60018060a01b038616815284602082015260a060408201526000611cb560a08301866119cc565b8281036060840152611cc781866119cc565b9150508260808301529695505050505050565b87815260e060208201526000611cf360e08301896119cc565b63ffffffff881660408401526001600160a01b0387811660608501528616608084015284151560a084015282810360c0840152611d3081856119cc565b9a9950505050505050505050565b6000604082016001600160801b03851683526040602084015280845180835260608501915060208601925060005b81811015611b215783516001600160a01b0316835260209384019390920191600101611d6c565b81516001600160a01b0390811682526020808401518216908301526040808401516001600160801b03169083015260608084015191821690830152610160820190506080830151611de8608084018215159052565b5060a0830151611dfc60a084018215159052565b5060c0830151611e3b60c084018264ffffffffff815116825264ffffffffff602082015116602083015264ffffffffff60408201511660408301525050565b5060e0929092015180516001600160a01b031661012083015260200151610140909101529056fe5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b5072a26469706673582212201f5f415bcb47b5bcc3f3fe15fa8e4612de722a3ea1aaa69d546320c040c561ba64736f6c634300081c0033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100365760003560e01c8063ba9a91a51461003b578063d58041b714610062575b600080fd5b610050600080516020611e6383398151915281565b60405190815260200160405180910390f35b6100756100703660046112ff565b610077565b005b6000806100cd61008a6020850185611359565b61009a6040860160208701611359565b6100aa60e0870160c08801611359565b6100ba60a0880160808901611359565b6100c8610100890189611386565b610227565b909250905060006101396100e46020860186611359565b6100f46040870160208801611359565b61010460e0880160c08901611359565b868661011660808b0160608c01611359565b61012660c08c0160a08d01611359565b6101346101208d018d6113a6565b610603565b604080516101208101909152909150610221908061015a6020880188611359565b6001600160a01b0316815260200186602001602081019061017b9190611359565b6001600160a01b0316815260200161019960e0880160c08901611359565b6001600160a01b03168152602001858152602001846001600160a01b031681526020018660400160208101906101cf9190611359565b6001600160a01b031681526020016101ee610100880160e08901611359565b6001600160a01b03168152602081018490526040016102116101408801886113bc565b61021a9161175d565b905261099f565b50505050565b60408051600481526024810182526020810180516001600160e01b0316633f0f816960e21b17905290516000918291829182916001600160a01b038b169161026e916118bf565b6000604051808303816000865af19150503d80600081146102ab576040519150601f19603f3d011682016040523d82523d6000602084013e6102b0565b606091505b5091509150816103065760405162461bcd60e51b815260206004820152601a60248201527f4661696c656420746f20676574206c617374546f704861744964000000000000604482015260640160405180910390fd5b60e08180602001905181019061031c91906118d1565b610327906001611900565b901b93503363468721a78a60008361033f8a80611919565b61034c60208d018d611919565b604051602401610360959493929190611988565b60408051601f198184030181529181526020820180516001600160e01b0316631a64dfad60e01b1790525160e085901b6001600160e01b03191681526103ae939291906000906004016119f8565b6020604051808303816000875af11580156103cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103f19190611a4e565b50604051638a54c52f60e01b81526001600160a01b03891690638a54c52f90610434908a90600080516020611e638339815191529046908f908b90600401611a6b565b6020604051808303816000875af1158015610453573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104779190611a9e565b60408051600180825281830190925291945060009190816020015b606081526020019060019003908161049257505060408051600180825281830190925291925060009190602082015b60608152602001906001900390816104c1579050509050604051806040016040528060088152602001671d1bdc12185d125960c21b8152508260008151811061050c5761050c611abb565b602002602001018190525061052086610a66565b8160008151811061053357610533611abb565b6020026020010181905250336001600160a01b031663468721a78960008585604051602401610563929190611b2d565b60408051601f198184030181529181526020820180516001600160e01b031663579374b960e11b1790525160e085901b6001600160e01b03191681526105b1939291906000906004016119f8565b6020604051808303816000875af11580156105d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105f49190611a4e565b50505050509550959350505050565b60405162460ea360e61b8152600481018690526000906001600160a01b038a1690631183a8c090602401602060405180830381865afa15801561064a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061066e91906118d1565b90503363468721a78a6000896106848780611919565b60018c8061069860608d0160408e01611b5b565b6106a560208e018e611919565b6040516024016106bd99989796959493929190611b78565b60408051601f198184030181529181526020820180516001600160e01b0316635829492f60e11b1790525160e085901b6001600160e01b031916815261070b939291906000906004016119f8565b6020604051808303816000875af115801561072a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061074e9190611a4e565b50604051638a54c52f60e01b81526001600160a01b03891690638a54c52f90610791908a90600080516020611e638339815191529046908f908890600401611a6b565b6020604051808303816000875af11580156107b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107d49190611a9e565b506000846001600160a01b031663f1ab873c85604051806020016040528060008152506040516024016108079190611bdd565b60408051601f19818403018152918152602080830180516001600160e01b031663a4f9edbf60e01b179052905161085991600080516020611e6383398151915291899101918252602082015260400190565b60408051601f198184030181529082905280516020909101206001600160e01b031960e086901b168252610891939291600401611bf0565b6020604051808303816000875af11580156108b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108d49190611a9e565b604051602481018490526001600160a01b0382166044820152909150339063468721a7908c9060009060640160408051601f198184030181529181526020820180516001600160e01b031663320fbbb760e11b1790525160e085901b6001600160e01b031916815261094e939291906000906004016119f8565b6020604051808303816000875af115801561096d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109919190611a4e565b505098975050505050505050565b60005b81610100015151811015610a6257600082610100015182815181106109c9576109c9611abb565b602002602001015190506000610a0084600001518560a001518660c00151876060015188608001518960e001518860800151610b6e565b90506000610a1d85600001518660e0015185858960800151610cd5565b90506000610a438660200151876040015188600001518760800151886000015187611007565b9050610a538460600151826110b1565b846001019450505050506109a2565b5050565b606081600003610a8d5750506040805180820190915260018152600360fc1b602082015290565b8160005b8115610ab75780610aa181611c24565b9150610ab09050600a83611c53565b9150610a91565b6000816001600160401b03811115610ad157610ad161140c565b6040519080825280601f01601f191660200182016040528015610afb576020820181803683370190505b5090505b8415610b6657610b10600183611c67565b9150610b1d600a86611c7a565b610b28906030611900565b60f81b818381518110610b3d57610b3d611abb565b60200101906001600160f81b031916908160001a905350610b5f600a86611c53565b9450610aff565b949350505050565b60006001600160801b03821615610cc757866001600160a01b0316632f7fb7b6878a6001600160a01b0316631183a8c0876040518263ffffffff1660e01b8152600401610bbd91815260200190565b602060405180830381865afa158015610bda573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bfe91906118d1565b886000604051602001610c1b929190918252602082015260400190565b60408051601f198184030181528282526001600160801b0389166020840152910160408051601f19818403018152908290526001600160e01b031960e087901b168252610c7d94939291600080516020611e6383398151915290600401611c8e565b6020604051808303816000875af1158015610c9c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cc09190611a9e565b9050610cca565b50825b979650505050505050565b60405162460ea360e61b81526004810185905260009081906001600160a01b03881690631183a8c090602401602060405180830381865afa158015610d1e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d4291906118d1565b9050336001600160a01b031663468721a78860008989602001518a60a001518a8a8d60c001518e60400151604051602401610d839796959493929190611cda565b60408051601f198184030181529181526020820180516001600160e01b0316635829492f60e11b1790525160e085901b6001600160e01b0319168152610dd1939291906000906004016119f8565b6020604051808303816000875af1158015610df0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e149190611a4e565b5060808501516001600160801b031615610f3f5760408051600180825281830190925260009160208083019080368337019050509050856000015181600081518110610e6257610e62611abb565b60200260200101906001600160a01b031690816001600160a01b031681525050336001600160a01b031663468721a7866000896080015185604051602401610eab929190611d3e565b60408051601f198184030181529181526020820180516001600160e01b0316634a231cef60e01b1790525160e085901b6001600160e01b0319168152610ef9939291906000906004016119f8565b6020604051808303816000875af1158015610f18573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f3c9190611a4e565b50505b8451604051602481018390526001600160a01b039091166044820152339063468721a790899060009060640160408051601f198184030181529181526020820180516001600160e01b031663320fbbb760e11b1790525160e085901b6001600160e01b0319168152610fb9939291906000906004016119f8565b6020604051808303816000875af1158015610fd8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ffc9190611a4e565b509695505050505050565b60006001600160801b0384161561101f5750816110a7565b604051638a54c52f60e01b81526001600160a01b03881690638a54c52f90611061908990600080516020611e638339815191529046908b908990600401611a6b565b6020604051808303816000875af1158015611080573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110a49190611a9e565b90505b9695505050505050565b60005b82518110156112fa5760008382815181106110d1576110d1611abb565b60200260200101519050336001600160a01b031663468721a78260400151600084600001518560a001516040516024016111299291906001600160a01b039290921682526001600160801b0316602082015260400190565b60408051601f198184030181529181526020820180516001600160e01b031663095ea7b360e01b1790525160e085901b6001600160e01b0319168152611177939291906000906004016119f8565b6020604051808303816000875af1158015611196573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111ba9190611a4e565b50336001600160a01b031663468721a78260000151600060405180610100016040528086602001516001600160a01b03168152602001886001600160a01b031681526020018660a001516001600160801b0316815260200186604001516001600160a01b031681526020018660c00151151581526020018660e001511515815260200186606001518152602001866080015181525060405160240161125f9190611d93565b60408051601f198184030181529181526020820180516001600160e01b03166353b1572760e01b1790525160e085901b6001600160e01b03191681526112ad939291906000906004016119f8565b6020604051808303816000875af11580156112cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112f09190611a4e565b50506001016110b4565b505050565b60006020828403121561131157600080fd5b81356001600160401b0381111561132757600080fd5b8201610160818503121561133a57600080fd5b9392505050565b6001600160a01b038116811461135657600080fd5b50565b60006020828403121561136b57600080fd5b813561133a81611341565b803561138181611341565b919050565b60008235603e1983360301811261139c57600080fd5b9190910192915050565b60008235605e1983360301811261139c57600080fd5b6000808335601e198436030181126113d357600080fd5b8301803591506001600160401b038211156113ed57600080fd5b6020019150600581901b360382131561140557600080fd5b9250929050565b634e487b7160e01b600052604160045260246000fd5b60405161010081016001600160401b03811182821017156114455761144561140c565b60405290565b60405160e081016001600160401b03811182821017156114455761144561140c565b604051601f8201601f191681016001600160401b03811182821017156114955761149561140c565b604052919050565b60006001600160401b038211156114b6576114b661140c565b5060051b60200190565b600082601f8301126114d157600080fd5b81356001600160401b038111156114ea576114ea61140c565b6114fd601f8201601f191660200161146d565b81815284602083860101111561151257600080fd5b816020850160208301376000918101602001919091529392505050565b803564ffffffffff8116811461138157600080fd5b60006060828403121561155657600080fd5b604051606081016001600160401b03811182821017156115785761157861140c565b6040529050806115878361152f565b81526115956020840161152f565b60208201526115a66040840161152f565b60408201525092915050565b6000604082840312156115c457600080fd5b604080519081016001600160401b03811182821017156115e6576115e661140c565b60405290508082356115f781611341565b8152602092830135920191909152919050565b80356001600160801b038116811461138157600080fd5b801515811461135657600080fd5b803561138181611621565b600082601f83011261164b57600080fd5b813561165e6116598261149d565b61146d565b808282526020820191506020610160840286010192508583111561168157600080fd5b602085015b8381101561173f57610160818803121561169f57600080fd5b6116a7611422565b6116b082611376565b81526116be60208301611376565b60208201526116cf60408301611376565b60408201526116e18860608401611544565b60608201526116f38860c084016115b2565b6080820152611705610100830161160a565b60a0820152611717610120830161162f565b60c0820152611729610140830161162f565b60e0820152835260209092019161016001611686565b5095945050505050565b803563ffffffff8116811461138157600080fd5b600061176b6116598461149d565b8381526020810190600585901b84013681111561178757600080fd5b845b818110156118905780356001600160401b038111156117a757600080fd5b860160e03682900312156117ba57600080fd5b6117c261144b565b6117cb82611376565b815260208201356001600160401b038111156117e657600080fd5b6117f2368285016114c0565b60208301525060408201356001600160401b0381111561181157600080fd5b61181d368285016114c0565b60408301525060608201356001600160401b0381111561183c57600080fd5b6118483682850161163a565b60608301525061185a6080830161160a565b608082015261186b60a08301611749565b60a082015261187c60c0830161162f565b60c082015285525060209384019301611789565b509095945050505050565b60005b838110156118b657818101518382015260200161189e565b50506000910152565b6000825161139c81846020870161189b565b6000602082840312156118e357600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b80820180821115611913576119136118ea565b92915050565b6000808335601e1984360301811261193057600080fd5b8301803591506001600160401b0382111561194a57600080fd5b60200191503681900382131561140557600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b03861681526060602082018190526000906119ad908301868861195f565b82810360408401526119c081858761195f565b98975050505050505050565b600081518084526119e481602086016020860161189b565b601f01601f19169290920160200192915050565b60018060a01b0385168152836020820152608060408201526000611a1f60808301856119cc565b905060028310611a3f57634e487b7160e01b600052602160045260246000fd5b82606083015295945050505050565b600060208284031215611a6057600080fd5b815161133a81611621565b6001600160a01b039586168152602081019490945260408401929092529092166060820152608081019190915260a00190565b600060208284031215611ab057600080fd5b815161133a81611341565b634e487b7160e01b600052603260045260246000fd5b600082825180855260208501945060208160051b8301016020850160005b83811015611b2157601f19858403018852611b0b8383516119cc565b6020988901989093509190910190600101611aef565b50909695505050505050565b604081526000611b406040830185611ad1565b8281036020840152611b528185611ad1565b95945050505050565b600060208284031215611b6d57600080fd5b813561133a81611621565b89815260e060208201526000611b9260e083018a8c61195f565b60ff891660408401526001600160a01b0388811660608501528716608084015285151560a084015282810360c0840152611bcd81858761195f565b9c9b505050505050505050505050565b60208152600061133a60208301846119cc565b6001600160a01b0384168152606060208201819052600090611c14908301856119cc565b9050826040830152949350505050565b600060018201611c3657611c366118ea565b5060010190565b634e487b7160e01b600052601260045260246000fd5b600082611c6257611c62611c3d565b500490565b81810381811115611913576119136118ea565b600082611c8957611c89611c3d565b500690565b60018060a01b038616815284602082015260a060408201526000611cb560a08301866119cc565b8281036060840152611cc781866119cc565b9150508260808301529695505050505050565b87815260e060208201526000611cf360e08301896119cc565b63ffffffff881660408401526001600160a01b0387811660608501528616608084015284151560a084015282810360c0840152611d3081856119cc565b9a9950505050505050505050565b6000604082016001600160801b03851683526040602084015280845180835260608501915060208601925060005b81811015611b215783516001600160a01b0316835260209384019390920191600101611d6c565b81516001600160a01b0390811682526020808401518216908301526040808401516001600160801b03169083015260608084015191821690830152610160820190506080830151611de8608084018215159052565b5060a0830151611dfc60a084018215159052565b5060c0830151611e3b60c084018264ffffffffff815116825264ffffffffff602082015116602083015264ffffffffff60408201511660408301525050565b5060e0929092015180516001600160a01b031661012083015260200151610140909101529056fe5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b5072a26469706673582212201f5f415bcb47b5bcc3f3fe15fa8e4612de722a3ea1aaa69d546320c040c561ba64736f6c634300081c0033", + "numDeployments": 2, + "solcInputHash": "f1fca9a70591742a2aedd10e2fd7e744", + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"SALT\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"contract IHats\",\"name\":\"hatsProtocol\",\"type\":\"address\"},{\"internalType\":\"contract IERC6551Registry\",\"name\":\"erc6551Registry\",\"type\":\"address\"},{\"internalType\":\"contract IHatsModuleFactory\",\"name\":\"hatsModuleFactory\",\"type\":\"address\"},{\"internalType\":\"contract ModuleProxyFactory\",\"name\":\"moduleProxyFactory\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"keyValuePairs\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"decentAutonomousAdminImplementation\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"hatsAccountImplementation\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"hatsElectionsEligibilityImplementation\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"string\",\"name\":\"details\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"imageURI\",\"type\":\"string\"}],\"internalType\":\"struct DecentHatsCreationModule.TopHatParams\",\"name\":\"topHat\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"string\",\"name\":\"details\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"imageURI\",\"type\":\"string\"},{\"internalType\":\"bool\",\"name\":\"isMutable\",\"type\":\"bool\"}],\"internalType\":\"struct DecentHatsCreationModule.AdminHatParams\",\"name\":\"adminHat\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"wearer\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"details\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"imageURI\",\"type\":\"string\"},{\"components\":[{\"internalType\":\"contract ISablierV2LockupLinear\",\"name\":\"sablier\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint40\",\"name\":\"start\",\"type\":\"uint40\"},{\"internalType\":\"uint40\",\"name\":\"cliff\",\"type\":\"uint40\"},{\"internalType\":\"uint40\",\"name\":\"end\",\"type\":\"uint40\"}],\"internalType\":\"struct LockupLinear.Timestamps\",\"name\":\"timestamps\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"UD60x18\",\"name\":\"fee\",\"type\":\"uint256\"}],\"internalType\":\"struct Broker\",\"name\":\"broker\",\"type\":\"tuple\"},{\"internalType\":\"uint128\",\"name\":\"totalAmount\",\"type\":\"uint128\"},{\"internalType\":\"bool\",\"name\":\"cancelable\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"transferable\",\"type\":\"bool\"}],\"internalType\":\"struct DecentHatsModuleUtils.SablierStreamParams[]\",\"name\":\"sablierStreamsParams\",\"type\":\"tuple[]\"},{\"internalType\":\"uint128\",\"name\":\"termEndDateTs\",\"type\":\"uint128\"},{\"internalType\":\"uint32\",\"name\":\"maxSupply\",\"type\":\"uint32\"},{\"internalType\":\"bool\",\"name\":\"isMutable\",\"type\":\"bool\"}],\"internalType\":\"struct DecentHatsModuleUtils.HatParams[]\",\"name\":\"hats\",\"type\":\"tuple[]\"}],\"internalType\":\"struct DecentHatsCreationModule.CreateTreeParams\",\"name\":\"treeParams\",\"type\":\"tuple\"}],\"name\":\"createAndDeclareTree\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"createAndDeclareTree((address,address,address,address,address,address,address,address,(string,string),(string,string,bool),(address,string,string,(address,address,address,(uint40,uint40,uint40),(address,uint256),uint128,bool,bool)[],uint128,uint32,bool)[]))\":{\"details\":\"For each hat that is included, if the hat is: - termed, its stream funds on are targeted directly at the nominated wearer. The wearer should directly call `withdraw-` on the Sablier contract. - untermed, its stream funds are targeted at the hat's smart account. In order to withdraw funds from the stream, the hat's smart account must be the one call to `withdraw-` on the Sablier contract, setting the recipient arg to its wearer.In order for a Safe to seamlessly create roles even if it has never previously created a role and thus has no hat tree, we defer the creation of the hat tree and its setup to this contract. This way, in a single tx block, the resulting topHatId of the newly created hat can be used to create an admin hat and any other hats needed. We also make use of `KeyValuePairs` to associate the topHatId with the Safe.\",\"params\":{\"treeParams\":\"The parameters for creating the Hat Tree with Roles\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"createAndDeclareTree((address,address,address,address,address,address,address,address,(string,string),(string,string,bool),(address,string,string,(address,address,address,(uint40,uint40,uint40),(address,uint256),uint128,bool,bool)[],uint128,uint32,bool)[]))\":{\"notice\":\"For a safe without any roles previously created on it, this function should be called. It sets up the top hat and admin hat, as well as any other hats and their streams that are provided, then transfers the top hat to the calling safe.This contract should be enabled a module on the Safe for which the role(s) are to be created, and disabled after.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/modules/DecentHatsCreationModule.sol\":\"DecentHatsCreationModule\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\npragma solidity >=0.7.0 <0.9.0;\\n\\n/// @title Enum - Collection of enums\\n/// @author Richard Meissner - \\ncontract Enum {\\n enum Operation {Call, DelegateCall}\\n}\\n\",\"keccak256\":\"0x473e45b1a5cc47be494b0e123c9127f0c11c1e0992a321ae5a644c0bfdb2c14f\",\"license\":\"LGPL-3.0-only\"},\"@gnosis.pm/zodiac/contracts/factory/ModuleProxyFactory.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\npragma solidity >=0.8.0;\\n\\ncontract ModuleProxyFactory {\\n event ModuleProxyCreation(\\n address indexed proxy,\\n address indexed masterCopy\\n );\\n\\n /// `target` can not be zero.\\n error ZeroAddress(address target);\\n\\n /// `address_` is already taken.\\n error TakenAddress(address address_);\\n\\n /// @notice Initialization failed.\\n error FailedInitialization();\\n\\n function createProxy(address target, bytes32 salt)\\n internal\\n returns (address result)\\n {\\n if (address(target) == address(0)) revert ZeroAddress(target);\\n bytes memory deployment = abi.encodePacked(\\n hex\\\"602d8060093d393df3363d3d373d3d3d363d73\\\",\\n target,\\n hex\\\"5af43d82803e903d91602b57fd5bf3\\\"\\n );\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n result := create2(0, add(deployment, 0x20), mload(deployment), salt)\\n }\\n if (result == address(0)) revert TakenAddress(result);\\n }\\n\\n function deployModule(\\n address masterCopy,\\n bytes memory initializer,\\n uint256 saltNonce\\n ) public returns (address proxy) {\\n proxy = createProxy(\\n masterCopy,\\n keccak256(abi.encodePacked(keccak256(initializer), saltNonce))\\n );\\n (bool success, ) = proxy.call(initializer);\\n if (!success) revert FailedInitialization();\\n\\n emit ModuleProxyCreation(proxy, masterCopy);\\n }\\n}\\n\",\"keccak256\":\"0x70f6f1d88cf3382748e58f85ba87279f5bb8761863c293dd8c197a71ff558761\",\"license\":\"LGPL-3.0-only\"},\"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\n\\n/// @title Zodiac Avatar - A contract that manages modules that can execute transactions via this contract.\\npragma solidity >=0.7.0 <0.9.0;\\n\\nimport \\\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\\\";\\n\\ninterface IAvatar {\\n event EnabledModule(address module);\\n event DisabledModule(address module);\\n event ExecutionFromModuleSuccess(address indexed module);\\n event ExecutionFromModuleFailure(address indexed module);\\n\\n /// @dev Enables a module on the avatar.\\n /// @notice Can only be called by the avatar.\\n /// @notice Modules should be stored as a linked list.\\n /// @notice Must emit EnabledModule(address module) if successful.\\n /// @param module Module to be enabled.\\n function enableModule(address module) external;\\n\\n /// @dev Disables a module on the avatar.\\n /// @notice Can only be called by the avatar.\\n /// @notice Must emit DisabledModule(address module) if successful.\\n /// @param prevModule Address that pointed to the module to be removed in the linked list\\n /// @param module Module to be removed.\\n function disableModule(address prevModule, address module) external;\\n\\n /// @dev Allows a Module to execute a transaction.\\n /// @notice Can only be called by an enabled module.\\n /// @notice Must emit ExecutionFromModuleSuccess(address module) if successful.\\n /// @notice Must emit ExecutionFromModuleFailure(address module) if unsuccessful.\\n /// @param to Destination address of module transaction.\\n /// @param value Ether value of module transaction.\\n /// @param data Data payload of module transaction.\\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\\n function execTransactionFromModule(\\n address to,\\n uint256 value,\\n bytes memory data,\\n Enum.Operation operation\\n ) external returns (bool success);\\n\\n /// @dev Allows a Module to execute a transaction and return data\\n /// @notice Can only be called by an enabled module.\\n /// @notice Must emit ExecutionFromModuleSuccess(address module) if successful.\\n /// @notice Must emit ExecutionFromModuleFailure(address module) if unsuccessful.\\n /// @param to Destination address of module transaction.\\n /// @param value Ether value of module transaction.\\n /// @param data Data payload of module transaction.\\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\\n function execTransactionFromModuleReturnData(\\n address to,\\n uint256 value,\\n bytes memory data,\\n Enum.Operation operation\\n ) external returns (bool success, bytes memory returnData);\\n\\n /// @dev Returns if an module is enabled\\n /// @return True if the module is enabled\\n function isModuleEnabled(address module) external view returns (bool);\\n\\n /// @dev Returns array of modules.\\n /// @param start Start of the page.\\n /// @param pageSize Maximum number of modules that should be returned.\\n /// @return array Array of modules.\\n /// @return next Start of the next page.\\n function getModulesPaginated(address start, uint256 pageSize)\\n external\\n view\\n returns (address[] memory array, address next);\\n}\\n\",\"keccak256\":\"0xcd5508ffe596eef8fbccfd5fc4f10a34397773547ce64e212d48b5212865ec1f\",\"license\":\"LGPL-3.0-only\"},\"@openzeppelin/contracts/interfaces/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/introspection/IERC165.sol\\\";\\n\",\"keccak256\":\"0xd04b0f06e0666f29cf7cccc82894de541e19bb30a765b107b1e40bb7fe5f7d7a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev 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 amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `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 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes calldata data\\n ) external;\\n\\n /**\\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 {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the caller.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool _approved) external;\\n\\n /**\\n * @dev Returns 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\",\"keccak256\":\"0xed6a749c5373af398105ce6ee3ac4763aa450ea7285d268c85d9eeca809cdb1f\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../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\",\"keccak256\":\"0x75b829ff2f26c14355d1cba20e16fe7b29ca58eb5fef665ede48bc0f9c6c74b9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _HEX_SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\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 // Inspired by OraclizeAPI's implementation - MIT licence\\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\\n\\n if (value == 0) {\\n return \\\"0\\\";\\n }\\n uint256 temp = value;\\n uint256 digits;\\n while (temp != 0) {\\n digits++;\\n temp /= 10;\\n }\\n bytes memory buffer = new bytes(digits);\\n while (value != 0) {\\n digits -= 1;\\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\\n value /= 10;\\n }\\n return string(buffer);\\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 if (value == 0) {\\n return \\\"0x00\\\";\\n }\\n uint256 temp = value;\\n uint256 length = 0;\\n while (temp != 0) {\\n length++;\\n temp >>= 8;\\n }\\n return toHexString(value, length);\\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 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_SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\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 representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n}\\n\",\"keccak256\":\"0xaf159a8b1923ad2a26d516089bceca9bdeaeacd04be50983ea00ba63070f08a3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"@prb/math/src/Common.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\n// Common.sol\\n//\\n// Common mathematical functions used in both SD59x18 and UD60x18. Note that these global functions do not\\n// always operate with SD59x18 and UD60x18 numbers.\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CUSTOM ERRORS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @notice Thrown when the resultant value in {mulDiv} overflows uint256.\\nerror PRBMath_MulDiv_Overflow(uint256 x, uint256 y, uint256 denominator);\\n\\n/// @notice Thrown when the resultant value in {mulDiv18} overflows uint256.\\nerror PRBMath_MulDiv18_Overflow(uint256 x, uint256 y);\\n\\n/// @notice Thrown when one of the inputs passed to {mulDivSigned} is `type(int256).min`.\\nerror PRBMath_MulDivSigned_InputTooSmall();\\n\\n/// @notice Thrown when the resultant value in {mulDivSigned} overflows int256.\\nerror PRBMath_MulDivSigned_Overflow(int256 x, int256 y);\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CONSTANTS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @dev The maximum value a uint128 number can have.\\nuint128 constant MAX_UINT128 = type(uint128).max;\\n\\n/// @dev The maximum value a uint40 number can have.\\nuint40 constant MAX_UINT40 = type(uint40).max;\\n\\n/// @dev The unit number, which the decimal precision of the fixed-point types.\\nuint256 constant UNIT = 1e18;\\n\\n/// @dev The unit number inverted mod 2^256.\\nuint256 constant UNIT_INVERSE = 78156646155174841979727994598816262306175212592076161876661_508869554232690281;\\n\\n/// @dev The the largest power of two that divides the decimal value of `UNIT`. The logarithm of this value is the least significant\\n/// bit in the binary representation of `UNIT`.\\nuint256 constant UNIT_LPOTD = 262144;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @notice Calculates the binary exponent of x using the binary fraction method.\\n/// @dev Has to use 192.64-bit fixed-point numbers. See https://ethereum.stackexchange.com/a/96594/24693.\\n/// @param x The exponent as an unsigned 192.64-bit fixed-point number.\\n/// @return result The result as an unsigned 60.18-decimal fixed-point number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp2(uint256 x) pure returns (uint256 result) {\\n unchecked {\\n // Start from 0.5 in the 192.64-bit fixed-point format.\\n result = 0x800000000000000000000000000000000000000000000000;\\n\\n // The following logic multiplies the result by $\\\\sqrt{2^{-i}}$ when the bit at position i is 1. Key points:\\n //\\n // 1. Intermediate results will not overflow, as the starting point is 2^191 and all magic factors are under 2^65.\\n // 2. The rationale for organizing the if statements into groups of 8 is gas savings. If the result of performing\\n // a bitwise AND operation between x and any value in the array [0x80; 0x40; 0x20; 0x10; 0x08; 0x04; 0x02; 0x01] is 1,\\n // we know that `x & 0xFF` is also 1.\\n if (x & 0xFF00000000000000 > 0) {\\n if (x & 0x8000000000000000 > 0) {\\n result = (result * 0x16A09E667F3BCC909) >> 64;\\n }\\n if (x & 0x4000000000000000 > 0) {\\n result = (result * 0x1306FE0A31B7152DF) >> 64;\\n }\\n if (x & 0x2000000000000000 > 0) {\\n result = (result * 0x1172B83C7D517ADCE) >> 64;\\n }\\n if (x & 0x1000000000000000 > 0) {\\n result = (result * 0x10B5586CF9890F62A) >> 64;\\n }\\n if (x & 0x800000000000000 > 0) {\\n result = (result * 0x1059B0D31585743AE) >> 64;\\n }\\n if (x & 0x400000000000000 > 0) {\\n result = (result * 0x102C9A3E778060EE7) >> 64;\\n }\\n if (x & 0x200000000000000 > 0) {\\n result = (result * 0x10163DA9FB33356D8) >> 64;\\n }\\n if (x & 0x100000000000000 > 0) {\\n result = (result * 0x100B1AFA5ABCBED61) >> 64;\\n }\\n }\\n\\n if (x & 0xFF000000000000 > 0) {\\n if (x & 0x80000000000000 > 0) {\\n result = (result * 0x10058C86DA1C09EA2) >> 64;\\n }\\n if (x & 0x40000000000000 > 0) {\\n result = (result * 0x1002C605E2E8CEC50) >> 64;\\n }\\n if (x & 0x20000000000000 > 0) {\\n result = (result * 0x100162F3904051FA1) >> 64;\\n }\\n if (x & 0x10000000000000 > 0) {\\n result = (result * 0x1000B175EFFDC76BA) >> 64;\\n }\\n if (x & 0x8000000000000 > 0) {\\n result = (result * 0x100058BA01FB9F96D) >> 64;\\n }\\n if (x & 0x4000000000000 > 0) {\\n result = (result * 0x10002C5CC37DA9492) >> 64;\\n }\\n if (x & 0x2000000000000 > 0) {\\n result = (result * 0x1000162E525EE0547) >> 64;\\n }\\n if (x & 0x1000000000000 > 0) {\\n result = (result * 0x10000B17255775C04) >> 64;\\n }\\n }\\n\\n if (x & 0xFF0000000000 > 0) {\\n if (x & 0x800000000000 > 0) {\\n result = (result * 0x1000058B91B5BC9AE) >> 64;\\n }\\n if (x & 0x400000000000 > 0) {\\n result = (result * 0x100002C5C89D5EC6D) >> 64;\\n }\\n if (x & 0x200000000000 > 0) {\\n result = (result * 0x10000162E43F4F831) >> 64;\\n }\\n if (x & 0x100000000000 > 0) {\\n result = (result * 0x100000B1721BCFC9A) >> 64;\\n }\\n if (x & 0x80000000000 > 0) {\\n result = (result * 0x10000058B90CF1E6E) >> 64;\\n }\\n if (x & 0x40000000000 > 0) {\\n result = (result * 0x1000002C5C863B73F) >> 64;\\n }\\n if (x & 0x20000000000 > 0) {\\n result = (result * 0x100000162E430E5A2) >> 64;\\n }\\n if (x & 0x10000000000 > 0) {\\n result = (result * 0x1000000B172183551) >> 64;\\n }\\n }\\n\\n if (x & 0xFF00000000 > 0) {\\n if (x & 0x8000000000 > 0) {\\n result = (result * 0x100000058B90C0B49) >> 64;\\n }\\n if (x & 0x4000000000 > 0) {\\n result = (result * 0x10000002C5C8601CC) >> 64;\\n }\\n if (x & 0x2000000000 > 0) {\\n result = (result * 0x1000000162E42FFF0) >> 64;\\n }\\n if (x & 0x1000000000 > 0) {\\n result = (result * 0x10000000B17217FBB) >> 64;\\n }\\n if (x & 0x800000000 > 0) {\\n result = (result * 0x1000000058B90BFCE) >> 64;\\n }\\n if (x & 0x400000000 > 0) {\\n result = (result * 0x100000002C5C85FE3) >> 64;\\n }\\n if (x & 0x200000000 > 0) {\\n result = (result * 0x10000000162E42FF1) >> 64;\\n }\\n if (x & 0x100000000 > 0) {\\n result = (result * 0x100000000B17217F8) >> 64;\\n }\\n }\\n\\n if (x & 0xFF000000 > 0) {\\n if (x & 0x80000000 > 0) {\\n result = (result * 0x10000000058B90BFC) >> 64;\\n }\\n if (x & 0x40000000 > 0) {\\n result = (result * 0x1000000002C5C85FE) >> 64;\\n }\\n if (x & 0x20000000 > 0) {\\n result = (result * 0x100000000162E42FF) >> 64;\\n }\\n if (x & 0x10000000 > 0) {\\n result = (result * 0x1000000000B17217F) >> 64;\\n }\\n if (x & 0x8000000 > 0) {\\n result = (result * 0x100000000058B90C0) >> 64;\\n }\\n if (x & 0x4000000 > 0) {\\n result = (result * 0x10000000002C5C860) >> 64;\\n }\\n if (x & 0x2000000 > 0) {\\n result = (result * 0x1000000000162E430) >> 64;\\n }\\n if (x & 0x1000000 > 0) {\\n result = (result * 0x10000000000B17218) >> 64;\\n }\\n }\\n\\n if (x & 0xFF0000 > 0) {\\n if (x & 0x800000 > 0) {\\n result = (result * 0x1000000000058B90C) >> 64;\\n }\\n if (x & 0x400000 > 0) {\\n result = (result * 0x100000000002C5C86) >> 64;\\n }\\n if (x & 0x200000 > 0) {\\n result = (result * 0x10000000000162E43) >> 64;\\n }\\n if (x & 0x100000 > 0) {\\n result = (result * 0x100000000000B1721) >> 64;\\n }\\n if (x & 0x80000 > 0) {\\n result = (result * 0x10000000000058B91) >> 64;\\n }\\n if (x & 0x40000 > 0) {\\n result = (result * 0x1000000000002C5C8) >> 64;\\n }\\n if (x & 0x20000 > 0) {\\n result = (result * 0x100000000000162E4) >> 64;\\n }\\n if (x & 0x10000 > 0) {\\n result = (result * 0x1000000000000B172) >> 64;\\n }\\n }\\n\\n if (x & 0xFF00 > 0) {\\n if (x & 0x8000 > 0) {\\n result = (result * 0x100000000000058B9) >> 64;\\n }\\n if (x & 0x4000 > 0) {\\n result = (result * 0x10000000000002C5D) >> 64;\\n }\\n if (x & 0x2000 > 0) {\\n result = (result * 0x1000000000000162E) >> 64;\\n }\\n if (x & 0x1000 > 0) {\\n result = (result * 0x10000000000000B17) >> 64;\\n }\\n if (x & 0x800 > 0) {\\n result = (result * 0x1000000000000058C) >> 64;\\n }\\n if (x & 0x400 > 0) {\\n result = (result * 0x100000000000002C6) >> 64;\\n }\\n if (x & 0x200 > 0) {\\n result = (result * 0x10000000000000163) >> 64;\\n }\\n if (x & 0x100 > 0) {\\n result = (result * 0x100000000000000B1) >> 64;\\n }\\n }\\n\\n if (x & 0xFF > 0) {\\n if (x & 0x80 > 0) {\\n result = (result * 0x10000000000000059) >> 64;\\n }\\n if (x & 0x40 > 0) {\\n result = (result * 0x1000000000000002C) >> 64;\\n }\\n if (x & 0x20 > 0) {\\n result = (result * 0x10000000000000016) >> 64;\\n }\\n if (x & 0x10 > 0) {\\n result = (result * 0x1000000000000000B) >> 64;\\n }\\n if (x & 0x8 > 0) {\\n result = (result * 0x10000000000000006) >> 64;\\n }\\n if (x & 0x4 > 0) {\\n result = (result * 0x10000000000000003) >> 64;\\n }\\n if (x & 0x2 > 0) {\\n result = (result * 0x10000000000000001) >> 64;\\n }\\n if (x & 0x1 > 0) {\\n result = (result * 0x10000000000000001) >> 64;\\n }\\n }\\n\\n // In the code snippet below, two operations are executed simultaneously:\\n //\\n // 1. The result is multiplied by $(2^n + 1)$, where $2^n$ represents the integer part, and the additional 1\\n // accounts for the initial guess of 0.5. This is achieved by subtracting from 191 instead of 192.\\n // 2. The result is then converted to an unsigned 60.18-decimal fixed-point format.\\n //\\n // The underlying logic is based on the relationship $2^{191-ip} = 2^{ip} / 2^{191}$, where $ip$ denotes the,\\n // integer part, $2^n$.\\n result *= UNIT;\\n result >>= (191 - (x >> 64));\\n }\\n}\\n\\n/// @notice Finds the zero-based index of the first 1 in the binary representation of x.\\n///\\n/// @dev See the note on \\\"msb\\\" in this Wikipedia article: https://en.wikipedia.org/wiki/Find_first_set\\n///\\n/// Each step in this implementation is equivalent to this high-level code:\\n///\\n/// ```solidity\\n/// if (x >= 2 ** 128) {\\n/// x >>= 128;\\n/// result += 128;\\n/// }\\n/// ```\\n///\\n/// Where 128 is replaced with each respective power of two factor. See the full high-level implementation here:\\n/// https://gist.github.com/PaulRBerg/f932f8693f2733e30c4d479e8e980948\\n///\\n/// The Yul instructions used below are:\\n///\\n/// - \\\"gt\\\" is \\\"greater than\\\"\\n/// - \\\"or\\\" is the OR bitwise operator\\n/// - \\\"shl\\\" is \\\"shift left\\\"\\n/// - \\\"shr\\\" is \\\"shift right\\\"\\n///\\n/// @param x The uint256 number for which to find the index of the most significant bit.\\n/// @return result The index of the most significant bit as a uint256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction msb(uint256 x) pure returns (uint256 result) {\\n // 2^128\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(7, gt(x, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^64\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(6, gt(x, 0xFFFFFFFFFFFFFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^32\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(5, gt(x, 0xFFFFFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^16\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(4, gt(x, 0xFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^8\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(3, gt(x, 0xFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^4\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(2, gt(x, 0xF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^2\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(1, gt(x, 0x3))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^1\\n // No need to shift x any more.\\n assembly (\\\"memory-safe\\\") {\\n let factor := gt(x, 0x1)\\n result := or(result, factor)\\n }\\n}\\n\\n/// @notice Calculates x*y\\u00f7denominator with 512-bit precision.\\n///\\n/// @dev Credits to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv.\\n///\\n/// Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - The denominator must not be zero.\\n/// - The result must fit in uint256.\\n///\\n/// @param x The multiplicand as a uint256.\\n/// @param y The multiplier as a uint256.\\n/// @param denominator The divisor as a uint256.\\n/// @return result The result as a uint256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mulDiv(uint256 x, uint256 y, uint256 denominator) pure returns (uint256 result) {\\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; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly (\\\"memory-safe\\\") {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\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 unchecked {\\n return prod0 / denominator;\\n }\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n if (prod1 >= denominator) {\\n revert PRBMath_MulDiv_Overflow(x, y, denominator);\\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 (\\\"memory-safe\\\") {\\n // Compute remainder using the mulmod Yul instruction.\\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 unchecked {\\n // Calculate the largest power of two divisor of the denominator using the unary operator ~. This operation cannot overflow\\n // because the denominator cannot be zero at this point in the function execution. The result is always >= 1.\\n // For more detail, see https://cs.stackexchange.com/q/138556/92363.\\n uint256 lpotdod = denominator & (~denominator + 1);\\n uint256 flippedLpotdod;\\n\\n assembly (\\\"memory-safe\\\") {\\n // Factor powers of two out of denominator.\\n denominator := div(denominator, lpotdod)\\n\\n // Divide [prod1 prod0] by lpotdod.\\n prod0 := div(prod0, lpotdod)\\n\\n // Get the flipped value `2^256 / lpotdod`. If the `lpotdod` is zero, the flipped value is one.\\n // `sub(0, lpotdod)` produces the two's complement version of `lpotdod`, which is equivalent to flipping all the bits.\\n // However, `div` interprets this value as an unsigned value: https://ethereum.stackexchange.com/q/147168/24693\\n flippedLpotdod := add(div(sub(0, lpotdod), lpotdod), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * flippedLpotdod;\\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 works\\n // 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 }\\n}\\n\\n/// @notice Calculates x*y\\u00f71e18 with 512-bit precision.\\n///\\n/// @dev A variant of {mulDiv} with constant folding, i.e. in which the denominator is hard coded to 1e18.\\n///\\n/// Notes:\\n/// - The body is purposely left uncommented; to understand how this works, see the documentation in {mulDiv}.\\n/// - The result is rounded toward zero.\\n/// - We take as an axiom that the result cannot be `MAX_UINT256` when x and y solve the following system of equations:\\n///\\n/// $$\\n/// \\\\begin{cases}\\n/// x * y = MAX\\\\_UINT256 * UNIT \\\\\\\\\\n/// (x * y) \\\\% UNIT \\\\geq \\\\frac{UNIT}{2}\\n/// \\\\end{cases}\\n/// $$\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {mulDiv}.\\n/// - The result must fit in uint256.\\n///\\n/// @param x The multiplicand as an unsigned 60.18-decimal fixed-point number.\\n/// @param y The multiplier as an unsigned 60.18-decimal fixed-point number.\\n/// @return result The result as an unsigned 60.18-decimal fixed-point number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mulDiv18(uint256 x, uint256 y) pure returns (uint256 result) {\\n uint256 prod0;\\n uint256 prod1;\\n assembly (\\\"memory-safe\\\") {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n if (prod1 == 0) {\\n unchecked {\\n return prod0 / UNIT;\\n }\\n }\\n\\n if (prod1 >= UNIT) {\\n revert PRBMath_MulDiv18_Overflow(x, y);\\n }\\n\\n uint256 remainder;\\n assembly (\\\"memory-safe\\\") {\\n remainder := mulmod(x, y, UNIT)\\n result :=\\n mul(\\n or(\\n div(sub(prod0, remainder), UNIT_LPOTD),\\n mul(sub(prod1, gt(remainder, prod0)), add(div(sub(0, UNIT_LPOTD), UNIT_LPOTD), 1))\\n ),\\n UNIT_INVERSE\\n )\\n }\\n}\\n\\n/// @notice Calculates x*y\\u00f7denominator with 512-bit precision.\\n///\\n/// @dev This is an extension of {mulDiv} for signed numbers, which works by computing the signs and the absolute values separately.\\n///\\n/// Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {mulDiv}.\\n/// - None of the inputs can be `type(int256).min`.\\n/// - The result must fit in int256.\\n///\\n/// @param x The multiplicand as an int256.\\n/// @param y The multiplier as an int256.\\n/// @param denominator The divisor as an int256.\\n/// @return result The result as an int256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mulDivSigned(int256 x, int256 y, int256 denominator) pure returns (int256 result) {\\n if (x == type(int256).min || y == type(int256).min || denominator == type(int256).min) {\\n revert PRBMath_MulDivSigned_InputTooSmall();\\n }\\n\\n // Get hold of the absolute values of x, y and the denominator.\\n uint256 xAbs;\\n uint256 yAbs;\\n uint256 dAbs;\\n unchecked {\\n xAbs = x < 0 ? uint256(-x) : uint256(x);\\n yAbs = y < 0 ? uint256(-y) : uint256(y);\\n dAbs = denominator < 0 ? uint256(-denominator) : uint256(denominator);\\n }\\n\\n // Compute the absolute value of x*y\\u00f7denominator. The result must fit in int256.\\n uint256 resultAbs = mulDiv(xAbs, yAbs, dAbs);\\n if (resultAbs > uint256(type(int256).max)) {\\n revert PRBMath_MulDivSigned_Overflow(x, y);\\n }\\n\\n // Get the signs of x, y and the denominator.\\n uint256 sx;\\n uint256 sy;\\n uint256 sd;\\n assembly (\\\"memory-safe\\\") {\\n // \\\"sgt\\\" is the \\\"signed greater than\\\" assembly instruction and \\\"sub(0,1)\\\" is -1 in two's complement.\\n sx := sgt(x, sub(0, 1))\\n sy := sgt(y, sub(0, 1))\\n sd := sgt(denominator, sub(0, 1))\\n }\\n\\n // XOR over sx, sy and sd. What this does is to check whether there are 1 or 3 negative signs in the inputs.\\n // If there are, the result should be negative. Otherwise, it should be positive.\\n unchecked {\\n result = sx ^ sy ^ sd == 0 ? -int256(resultAbs) : int256(resultAbs);\\n }\\n}\\n\\n/// @notice Calculates the square root of x using the Babylonian method.\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\\n///\\n/// Notes:\\n/// - If x is not a perfect square, the result is rounded down.\\n/// - Credits to OpenZeppelin for the explanations in comments below.\\n///\\n/// @param x The uint256 number for which to calculate the square root.\\n/// @return result The result as a uint256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction sqrt(uint256 x) pure returns (uint256 result) {\\n if (x == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we calculate the biggest power of 2 which is smaller than the square root of x.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of x is a power of 2 such that we have:\\n //\\n // $$\\n // msb(x) <= x <= 2*msb(x)$\\n // $$\\n //\\n // We write $msb(x)$ as $2^k$, and we get:\\n //\\n // $$\\n // k = log_2(x)\\n // $$\\n //\\n // Thus, we can write the initial inequality as:\\n //\\n // $$\\n // 2^{log_2(x)} <= x <= 2*2^{log_2(x)+1} \\\\\\\\\\n // sqrt(2^k) <= sqrt(x) < sqrt(2^{k+1}) \\\\\\\\\\n // 2^{k/2} <= sqrt(x) < 2^{(k+1)/2} <= 2^{(k/2)+1}\\n // $$\\n //\\n // Consequently, $2^{log_2(x) /2} is a good first approximation of sqrt(x) with at least one correct bit.\\n uint256 xAux = uint256(x);\\n result = 1;\\n if (xAux >= 2 ** 128) {\\n xAux >>= 128;\\n result <<= 64;\\n }\\n if (xAux >= 2 ** 64) {\\n xAux >>= 64;\\n result <<= 32;\\n }\\n if (xAux >= 2 ** 32) {\\n xAux >>= 32;\\n result <<= 16;\\n }\\n if (xAux >= 2 ** 16) {\\n xAux >>= 16;\\n result <<= 8;\\n }\\n if (xAux >= 2 ** 8) {\\n xAux >>= 8;\\n result <<= 4;\\n }\\n if (xAux >= 2 ** 4) {\\n xAux >>= 4;\\n result <<= 2;\\n }\\n if (xAux >= 2 ** 2) {\\n result <<= 1;\\n }\\n\\n // At this point, `result` is an estimation with at least one bit of precision. We know the true value has at\\n // most 128 bits, since it is the square root of a uint256. Newton's method converges quadratically (precision\\n // doubles at every iteration). We thus need at most 7 iteration to turn our partial result with one bit of\\n // precision into the expected uint128 result.\\n unchecked {\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n\\n // If x is not a perfect square, round the result toward zero.\\n uint256 roundedResult = x / result;\\n if (result >= roundedResult) {\\n result = roundedResult;\\n }\\n }\\n}\\n\",\"keccak256\":\"0xaa374e2c26cc93e8c22a6953804ee05f811597ef5fa82f76824378b22944778b\",\"license\":\"MIT\"},\"@prb/math/src/UD2x18.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\n/*\\n\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2550\\u2550\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2554\\u2588\\u2588\\u2588\\u2588\\u2554\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551 \\u255a\\u2550\\u255d \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\n\\n\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2550\\u2550\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d \\u255a\\u2588\\u2588\\u2588\\u2554\\u255d \\u255a\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u255d\\n\\n*/\\n\\nimport \\\"./ud2x18/Casting.sol\\\";\\nimport \\\"./ud2x18/Constants.sol\\\";\\nimport \\\"./ud2x18/Errors.sol\\\";\\nimport \\\"./ud2x18/ValueType.sol\\\";\\n\",\"keccak256\":\"0xfb624e24cd8bb790fa08e7827819de85504a86e20e961fa4ad126c65b6d90641\",\"license\":\"MIT\"},\"@prb/math/src/UD60x18.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\n/*\\n\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2550\\u2550\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2554\\u2588\\u2588\\u2588\\u2588\\u2554\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551 \\u255a\\u2550\\u255d \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\n\\n\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2550\\u2588\\u2588\\u2588\\u2588\\u2557\\u255a\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2588\\u2588\\u2551 \\u255a\\u2588\\u2588\\u2588\\u2554\\u255d \\u255a\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2554\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2554\\u255d \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u255d\\n\\n*/\\n\\nimport \\\"./ud60x18/Casting.sol\\\";\\nimport \\\"./ud60x18/Constants.sol\\\";\\nimport \\\"./ud60x18/Conversions.sol\\\";\\nimport \\\"./ud60x18/Errors.sol\\\";\\nimport \\\"./ud60x18/Helpers.sol\\\";\\nimport \\\"./ud60x18/Math.sol\\\";\\nimport \\\"./ud60x18/ValueType.sol\\\";\\n\",\"keccak256\":\"0xb98c6f74275914d279e8af6c502c2b1f50d5f6e1ed418d3b0153f5a193206c48\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as CastingErrors;\\nimport { SD59x18 } from \\\"../sd59x18/ValueType.sol\\\";\\nimport { UD2x18 } from \\\"../ud2x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"../ud60x18/ValueType.sol\\\";\\nimport { SD1x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts an SD1x18 number into SD59x18.\\n/// @dev There is no overflow check because the domain of SD1x18 is a subset of SD59x18.\\nfunction intoSD59x18(SD1x18 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(int256(SD1x18.unwrap(x)));\\n}\\n\\n/// @notice Casts an SD1x18 number into UD2x18.\\n/// - x must be positive.\\nfunction intoUD2x18(SD1x18 x) pure returns (UD2x18 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUD2x18_Underflow(x);\\n }\\n result = UD2x18.wrap(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into UD60x18.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUD60x18(SD1x18 x) pure returns (UD60x18 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUD60x18_Underflow(x);\\n }\\n result = UD60x18.wrap(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into uint256.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUint256(SD1x18 x) pure returns (uint256 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint256_Underflow(x);\\n }\\n result = uint256(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into uint128.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUint128(SD1x18 x) pure returns (uint128 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint128_Underflow(x);\\n }\\n result = uint128(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(SD1x18 x) pure returns (uint40 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint40_Underflow(x);\\n }\\n if (xInt > int64(uint64(Common.MAX_UINT40))) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint40_Overflow(x);\\n }\\n result = uint40(uint64(xInt));\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction sd1x18(int64 x) pure returns (SD1x18 result) {\\n result = SD1x18.wrap(x);\\n}\\n\\n/// @notice Unwraps an SD1x18 number into int64.\\nfunction unwrap(SD1x18 x) pure returns (int64 result) {\\n result = SD1x18.unwrap(x);\\n}\\n\\n/// @notice Wraps an int64 number into SD1x18.\\nfunction wrap(int64 x) pure returns (SD1x18 result) {\\n result = SD1x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x9e49e2b37c1bb845861740805edaaef3fe951a7b96eef16ce84fbf76e8278670\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD1x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @dev Euler's number as an SD1x18 number.\\nSD1x18 constant E = SD1x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum value an SD1x18 number can have.\\nint64 constant uMAX_SD1x18 = 9_223372036854775807;\\nSD1x18 constant MAX_SD1x18 = SD1x18.wrap(uMAX_SD1x18);\\n\\n/// @dev The maximum value an SD1x18 number can have.\\nint64 constant uMIN_SD1x18 = -9_223372036854775808;\\nSD1x18 constant MIN_SD1x18 = SD1x18.wrap(uMIN_SD1x18);\\n\\n/// @dev PI as an SD1x18 number.\\nSD1x18 constant PI = SD1x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of SD1x18.\\nSD1x18 constant UNIT = SD1x18.wrap(1e18);\\nint64 constant uUNIT = 1e18;\\n\",\"keccak256\":\"0x6496165b80552785a4b65a239b96e2a5fedf62fe54f002eeed72d75e566d7585\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD1x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in UD2x18.\\nerror PRBMath_SD1x18_ToUD2x18_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in UD60x18.\\nerror PRBMath_SD1x18_ToUD60x18_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint128.\\nerror PRBMath_SD1x18_ToUint128_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint256.\\nerror PRBMath_SD1x18_ToUint256_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint40.\\nerror PRBMath_SD1x18_ToUint40_Overflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint40.\\nerror PRBMath_SD1x18_ToUint40_Underflow(SD1x18 x);\\n\",\"keccak256\":\"0x836cb42ba619ca369fd4765bc47fefc3c3621369c5861882af14660aca5057ee\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\n\\n/// @notice The signed 1.18-decimal fixed-point number representation, which can have up to 1 digit and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\\n/// type int64. This is useful when end users want to use int64 to save gas, e.g. with tight variable packing in contract\\n/// storage.\\ntype SD1x18 is int64;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoSD59x18,\\n Casting.intoUD2x18,\\n Casting.intoUD60x18,\\n Casting.intoUint256,\\n Casting.intoUint128,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for SD1x18 global;\\n\",\"keccak256\":\"0x2f86f1aa9fca42f40808b51a879b406ac51817647bdb9642f8a79dd8fdb754a7\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Errors.sol\\\" as CastingErrors;\\nimport { MAX_UINT128, MAX_UINT40 } from \\\"../Common.sol\\\";\\nimport { uMAX_SD1x18, uMIN_SD1x18 } from \\\"../sd1x18/Constants.sol\\\";\\nimport { SD1x18 } from \\\"../sd1x18/ValueType.sol\\\";\\nimport { uMAX_UD2x18 } from \\\"../ud2x18/Constants.sol\\\";\\nimport { UD2x18 } from \\\"../ud2x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"../ud60x18/ValueType.sol\\\";\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts an SD59x18 number into int256.\\n/// @dev This is basically a functional alias for {unwrap}.\\nfunction intoInt256(SD59x18 x) pure returns (int256 result) {\\n result = SD59x18.unwrap(x);\\n}\\n\\n/// @notice Casts an SD59x18 number into SD1x18.\\n/// @dev Requirements:\\n/// - x must be greater than or equal to `uMIN_SD1x18`.\\n/// - x must be less than or equal to `uMAX_SD1x18`.\\nfunction intoSD1x18(SD59x18 x) pure returns (SD1x18 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < uMIN_SD1x18) {\\n revert CastingErrors.PRBMath_SD59x18_IntoSD1x18_Underflow(x);\\n }\\n if (xInt > uMAX_SD1x18) {\\n revert CastingErrors.PRBMath_SD59x18_IntoSD1x18_Overflow(x);\\n }\\n result = SD1x18.wrap(int64(xInt));\\n}\\n\\n/// @notice Casts an SD59x18 number into UD2x18.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `uMAX_UD2x18`.\\nfunction intoUD2x18(SD59x18 x) pure returns (UD2x18 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUD2x18_Underflow(x);\\n }\\n if (xInt > int256(uint256(uMAX_UD2x18))) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUD2x18_Overflow(x);\\n }\\n result = UD2x18.wrap(uint64(uint256(xInt)));\\n}\\n\\n/// @notice Casts an SD59x18 number into UD60x18.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUD60x18(SD59x18 x) pure returns (UD60x18 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUD60x18_Underflow(x);\\n }\\n result = UD60x18.wrap(uint256(xInt));\\n}\\n\\n/// @notice Casts an SD59x18 number into uint256.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUint256(SD59x18 x) pure returns (uint256 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint256_Underflow(x);\\n }\\n result = uint256(xInt);\\n}\\n\\n/// @notice Casts an SD59x18 number into uint128.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `uMAX_UINT128`.\\nfunction intoUint128(SD59x18 x) pure returns (uint128 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint128_Underflow(x);\\n }\\n if (xInt > int256(uint256(MAX_UINT128))) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint128_Overflow(x);\\n }\\n result = uint128(uint256(xInt));\\n}\\n\\n/// @notice Casts an SD59x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(SD59x18 x) pure returns (uint40 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint40_Underflow(x);\\n }\\n if (xInt > int256(uint256(MAX_UINT40))) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint40_Overflow(x);\\n }\\n result = uint40(uint256(xInt));\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction sd(int256 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(x);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction sd59x18(int256 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(x);\\n}\\n\\n/// @notice Unwraps an SD59x18 number into int256.\\nfunction unwrap(SD59x18 x) pure returns (int256 result) {\\n result = SD59x18.unwrap(x);\\n}\\n\\n/// @notice Wraps an int256 number into SD59x18.\\nfunction wrap(int256 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x3b21b60ec2998c3ae32f647412da51d3683b3f183a807198cc8d157499484f99\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n// NOTICE: the \\\"u\\\" prefix stands for \\\"unwrapped\\\".\\n\\n/// @dev Euler's number as an SD59x18 number.\\nSD59x18 constant E = SD59x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum input permitted in {exp}.\\nint256 constant uEXP_MAX_INPUT = 133_084258667509499440;\\nSD59x18 constant EXP_MAX_INPUT = SD59x18.wrap(uEXP_MAX_INPUT);\\n\\n/// @dev Any value less than this returns 0 in {exp}.\\nint256 constant uEXP_MIN_THRESHOLD = -41_446531673892822322;\\nSD59x18 constant EXP_MIN_THRESHOLD = SD59x18.wrap(uEXP_MIN_THRESHOLD);\\n\\n/// @dev The maximum input permitted in {exp2}.\\nint256 constant uEXP2_MAX_INPUT = 192e18 - 1;\\nSD59x18 constant EXP2_MAX_INPUT = SD59x18.wrap(uEXP2_MAX_INPUT);\\n\\n/// @dev Any value less than this returns 0 in {exp2}.\\nint256 constant uEXP2_MIN_THRESHOLD = -59_794705707972522261;\\nSD59x18 constant EXP2_MIN_THRESHOLD = SD59x18.wrap(uEXP2_MIN_THRESHOLD);\\n\\n/// @dev Half the UNIT number.\\nint256 constant uHALF_UNIT = 0.5e18;\\nSD59x18 constant HALF_UNIT = SD59x18.wrap(uHALF_UNIT);\\n\\n/// @dev $log_2(10)$ as an SD59x18 number.\\nint256 constant uLOG2_10 = 3_321928094887362347;\\nSD59x18 constant LOG2_10 = SD59x18.wrap(uLOG2_10);\\n\\n/// @dev $log_2(e)$ as an SD59x18 number.\\nint256 constant uLOG2_E = 1_442695040888963407;\\nSD59x18 constant LOG2_E = SD59x18.wrap(uLOG2_E);\\n\\n/// @dev The maximum value an SD59x18 number can have.\\nint256 constant uMAX_SD59x18 = 57896044618658097711785492504343953926634992332820282019728_792003956564819967;\\nSD59x18 constant MAX_SD59x18 = SD59x18.wrap(uMAX_SD59x18);\\n\\n/// @dev The maximum whole value an SD59x18 number can have.\\nint256 constant uMAX_WHOLE_SD59x18 = 57896044618658097711785492504343953926634992332820282019728_000000000000000000;\\nSD59x18 constant MAX_WHOLE_SD59x18 = SD59x18.wrap(uMAX_WHOLE_SD59x18);\\n\\n/// @dev The minimum value an SD59x18 number can have.\\nint256 constant uMIN_SD59x18 = -57896044618658097711785492504343953926634992332820282019728_792003956564819968;\\nSD59x18 constant MIN_SD59x18 = SD59x18.wrap(uMIN_SD59x18);\\n\\n/// @dev The minimum whole value an SD59x18 number can have.\\nint256 constant uMIN_WHOLE_SD59x18 = -57896044618658097711785492504343953926634992332820282019728_000000000000000000;\\nSD59x18 constant MIN_WHOLE_SD59x18 = SD59x18.wrap(uMIN_WHOLE_SD59x18);\\n\\n/// @dev PI as an SD59x18 number.\\nSD59x18 constant PI = SD59x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of SD59x18.\\nint256 constant uUNIT = 1e18;\\nSD59x18 constant UNIT = SD59x18.wrap(1e18);\\n\\n/// @dev The unit number squared.\\nint256 constant uUNIT_SQUARED = 1e36;\\nSD59x18 constant UNIT_SQUARED = SD59x18.wrap(uUNIT_SQUARED);\\n\\n/// @dev Zero as an SD59x18 number.\\nSD59x18 constant ZERO = SD59x18.wrap(0);\\n\",\"keccak256\":\"0x9bcb8dd6b3e886d140ad1c32747a4f6d29a492529ceb835be878ae837aa6cc3a\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when taking the absolute value of `MIN_SD59x18`.\\nerror PRBMath_SD59x18_Abs_MinSD59x18();\\n\\n/// @notice Thrown when ceiling a number overflows SD59x18.\\nerror PRBMath_SD59x18_Ceil_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when converting a basic integer to the fixed-point format overflows SD59x18.\\nerror PRBMath_SD59x18_Convert_Overflow(int256 x);\\n\\n/// @notice Thrown when converting a basic integer to the fixed-point format underflows SD59x18.\\nerror PRBMath_SD59x18_Convert_Underflow(int256 x);\\n\\n/// @notice Thrown when dividing two numbers and one of them is `MIN_SD59x18`.\\nerror PRBMath_SD59x18_Div_InputTooSmall();\\n\\n/// @notice Thrown when dividing two numbers and one of the intermediary unsigned results overflows SD59x18.\\nerror PRBMath_SD59x18_Div_Overflow(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when taking the natural exponent of a base greater than 133_084258667509499441.\\nerror PRBMath_SD59x18_Exp_InputTooBig(SD59x18 x);\\n\\n/// @notice Thrown when taking the binary exponent of a base greater than 192e18.\\nerror PRBMath_SD59x18_Exp2_InputTooBig(SD59x18 x);\\n\\n/// @notice Thrown when flooring a number underflows SD59x18.\\nerror PRBMath_SD59x18_Floor_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when taking the geometric mean of two numbers and their product is negative.\\nerror PRBMath_SD59x18_Gm_NegativeProduct(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when taking the geometric mean of two numbers and multiplying them overflows SD59x18.\\nerror PRBMath_SD59x18_Gm_Overflow(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\\nerror PRBMath_SD59x18_IntoSD1x18_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\\nerror PRBMath_SD59x18_IntoSD1x18_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\\nerror PRBMath_SD59x18_IntoUD2x18_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\\nerror PRBMath_SD59x18_IntoUD2x18_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD60x18.\\nerror PRBMath_SD59x18_IntoUD60x18_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\\nerror PRBMath_SD59x18_IntoUint128_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\\nerror PRBMath_SD59x18_IntoUint128_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint256.\\nerror PRBMath_SD59x18_IntoUint256_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\\nerror PRBMath_SD59x18_IntoUint40_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\\nerror PRBMath_SD59x18_IntoUint40_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when taking the logarithm of a number less than or equal to zero.\\nerror PRBMath_SD59x18_Log_InputTooSmall(SD59x18 x);\\n\\n/// @notice Thrown when multiplying two numbers and one of the inputs is `MIN_SD59x18`.\\nerror PRBMath_SD59x18_Mul_InputTooSmall();\\n\\n/// @notice Thrown when multiplying two numbers and the intermediary absolute result overflows SD59x18.\\nerror PRBMath_SD59x18_Mul_Overflow(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when raising a number to a power and the intermediary absolute result overflows SD59x18.\\nerror PRBMath_SD59x18_Powu_Overflow(SD59x18 x, uint256 y);\\n\\n/// @notice Thrown when taking the square root of a negative number.\\nerror PRBMath_SD59x18_Sqrt_NegativeInput(SD59x18 x);\\n\\n/// @notice Thrown when the calculating the square root overflows SD59x18.\\nerror PRBMath_SD59x18_Sqrt_Overflow(SD59x18 x);\\n\",\"keccak256\":\"0xa6d00fe5efa215ac0df25c896e3da99a12fb61e799644b2ec32da947313d3db4\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Helpers.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { wrap } from \\\"./Casting.sol\\\";\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Implements the checked addition operation (+) in the SD59x18 type.\\nfunction add(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n return wrap(x.unwrap() + y.unwrap());\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the SD59x18 type.\\nfunction and(SD59x18 x, int256 bits) pure returns (SD59x18 result) {\\n return wrap(x.unwrap() & bits);\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the SD59x18 type.\\nfunction and2(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n return wrap(x.unwrap() & y.unwrap());\\n}\\n\\n/// @notice Implements the equal (=) operation in the SD59x18 type.\\nfunction eq(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() == y.unwrap();\\n}\\n\\n/// @notice Implements the greater than operation (>) in the SD59x18 type.\\nfunction gt(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() > y.unwrap();\\n}\\n\\n/// @notice Implements the greater than or equal to operation (>=) in the SD59x18 type.\\nfunction gte(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() >= y.unwrap();\\n}\\n\\n/// @notice Implements a zero comparison check function in the SD59x18 type.\\nfunction isZero(SD59x18 x) pure returns (bool result) {\\n result = x.unwrap() == 0;\\n}\\n\\n/// @notice Implements the left shift operation (<<) in the SD59x18 type.\\nfunction lshift(SD59x18 x, uint256 bits) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() << bits);\\n}\\n\\n/// @notice Implements the lower than operation (<) in the SD59x18 type.\\nfunction lt(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() < y.unwrap();\\n}\\n\\n/// @notice Implements the lower than or equal to operation (<=) in the SD59x18 type.\\nfunction lte(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() <= y.unwrap();\\n}\\n\\n/// @notice Implements the unchecked modulo operation (%) in the SD59x18 type.\\nfunction mod(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() % y.unwrap());\\n}\\n\\n/// @notice Implements the not equal operation (!=) in the SD59x18 type.\\nfunction neq(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() != y.unwrap();\\n}\\n\\n/// @notice Implements the NOT (~) bitwise operation in the SD59x18 type.\\nfunction not(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(~x.unwrap());\\n}\\n\\n/// @notice Implements the OR (|) bitwise operation in the SD59x18 type.\\nfunction or(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() | y.unwrap());\\n}\\n\\n/// @notice Implements the right shift operation (>>) in the SD59x18 type.\\nfunction rshift(SD59x18 x, uint256 bits) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() >> bits);\\n}\\n\\n/// @notice Implements the checked subtraction operation (-) in the SD59x18 type.\\nfunction sub(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() - y.unwrap());\\n}\\n\\n/// @notice Implements the checked unary minus operation (-) in the SD59x18 type.\\nfunction unary(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(-x.unwrap());\\n}\\n\\n/// @notice Implements the unchecked addition operation (+) in the SD59x18 type.\\nfunction uncheckedAdd(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() + y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the unchecked subtraction operation (-) in the SD59x18 type.\\nfunction uncheckedSub(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() - y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the unchecked unary minus operation (-) in the SD59x18 type.\\nfunction uncheckedUnary(SD59x18 x) pure returns (SD59x18 result) {\\n unchecked {\\n result = wrap(-x.unwrap());\\n }\\n}\\n\\n/// @notice Implements the XOR (^) bitwise operation in the SD59x18 type.\\nfunction xor(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() ^ y.unwrap());\\n}\\n\",\"keccak256\":\"0x208570f1657cf730cb6c3d81aa14030e0d45cf906cdedea5059369d7df4bb716\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as Errors;\\nimport {\\n uEXP_MAX_INPUT,\\n uEXP2_MAX_INPUT,\\n uEXP_MIN_THRESHOLD,\\n uEXP2_MIN_THRESHOLD,\\n uHALF_UNIT,\\n uLOG2_10,\\n uLOG2_E,\\n uMAX_SD59x18,\\n uMAX_WHOLE_SD59x18,\\n uMIN_SD59x18,\\n uMIN_WHOLE_SD59x18,\\n UNIT,\\n uUNIT,\\n uUNIT_SQUARED,\\n ZERO\\n} from \\\"./Constants.sol\\\";\\nimport { wrap } from \\\"./Helpers.sol\\\";\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Calculates the absolute value of x.\\n///\\n/// @dev Requirements:\\n/// - x must be greater than `MIN_SD59x18`.\\n///\\n/// @param x The SD59x18 number for which to calculate the absolute value.\\n/// @param result The absolute value of x as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction abs(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt == uMIN_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Abs_MinSD59x18();\\n }\\n result = xInt < 0 ? wrap(-xInt) : x;\\n}\\n\\n/// @notice Calculates the arithmetic average of x and y.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// @param x The first operand as an SD59x18 number.\\n/// @param y The second operand as an SD59x18 number.\\n/// @return result The arithmetic average as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction avg(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n\\n unchecked {\\n // This operation is equivalent to `x / 2 + y / 2`, and it can never overflow.\\n int256 sum = (xInt >> 1) + (yInt >> 1);\\n\\n if (sum < 0) {\\n // If at least one of x and y is odd, add 1 to the result, because shifting negative numbers to the right\\n // rounds toward negative infinity. The right part is equivalent to `sum + (x % 2 == 1 || y % 2 == 1)`.\\n assembly (\\\"memory-safe\\\") {\\n result := add(sum, and(or(xInt, yInt), 1))\\n }\\n } else {\\n // Add 1 if both x and y are odd to account for the double 0.5 remainder truncated after shifting.\\n result = wrap(sum + (xInt & yInt & 1));\\n }\\n }\\n}\\n\\n/// @notice Yields the smallest whole number greater than or equal to x.\\n///\\n/// @dev Optimized for fractional value inputs, because every whole value has (1e18 - 1) fractional counterparts.\\n/// See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n///\\n/// Requirements:\\n/// - x must be less than or equal to `MAX_WHOLE_SD59x18`.\\n///\\n/// @param x The SD59x18 number to ceil.\\n/// @param result The smallest whole number greater than or equal to x, as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ceil(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt > uMAX_WHOLE_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Ceil_Overflow(x);\\n }\\n\\n int256 remainder = xInt % uUNIT;\\n if (remainder == 0) {\\n result = x;\\n } else {\\n unchecked {\\n // Solidity uses C fmod style, which returns a modulus with the same sign as x.\\n int256 resultInt = xInt - remainder;\\n if (xInt > 0) {\\n resultInt += uUNIT;\\n }\\n result = wrap(resultInt);\\n }\\n }\\n}\\n\\n/// @notice Divides two SD59x18 numbers, returning a new SD59x18 number.\\n///\\n/// @dev This is an extension of {Common.mulDiv} for signed numbers, which works by computing the signs and the absolute\\n/// values separately.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv}.\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv}.\\n/// - None of the inputs can be `MIN_SD59x18`.\\n/// - The denominator must not be zero.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The numerator as an SD59x18 number.\\n/// @param y The denominator as an SD59x18 number.\\n/// @param result The quotient as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction div(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n if (xInt == uMIN_SD59x18 || yInt == uMIN_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Div_InputTooSmall();\\n }\\n\\n // Get hold of the absolute values of x and y.\\n uint256 xAbs;\\n uint256 yAbs;\\n unchecked {\\n xAbs = xInt < 0 ? uint256(-xInt) : uint256(xInt);\\n yAbs = yInt < 0 ? uint256(-yInt) : uint256(yInt);\\n }\\n\\n // Compute the absolute value (x*UNIT\\u00f7y). The resulting value must fit in SD59x18.\\n uint256 resultAbs = Common.mulDiv(xAbs, uint256(uUNIT), yAbs);\\n if (resultAbs > uint256(uMAX_SD59x18)) {\\n revert Errors.PRBMath_SD59x18_Div_Overflow(x, y);\\n }\\n\\n // Check if x and y have the same sign using two's complement representation. The left-most bit represents the sign (1 for\\n // negative, 0 for positive or zero).\\n bool sameSign = (xInt ^ yInt) > -1;\\n\\n // If the inputs have the same sign, the result should be positive. Otherwise, it should be negative.\\n unchecked {\\n result = wrap(sameSign ? int256(resultAbs) : -int256(resultAbs));\\n }\\n}\\n\\n/// @notice Calculates the natural exponent of x using the following formula:\\n///\\n/// $$\\n/// e^x = 2^{x * log_2{e}}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {exp2}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {exp2}.\\n/// - x must be less than 133_084258667509499441.\\n///\\n/// @param x The exponent as an SD59x18 number.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n\\n // Any input less than the threshold returns zero.\\n // This check also prevents an overflow for very small numbers.\\n if (xInt < uEXP_MIN_THRESHOLD) {\\n return ZERO;\\n }\\n\\n // This check prevents values greater than 192e18 from being passed to {exp2}.\\n if (xInt > uEXP_MAX_INPUT) {\\n revert Errors.PRBMath_SD59x18_Exp_InputTooBig(x);\\n }\\n\\n unchecked {\\n // Inline the fixed-point multiplication to save gas.\\n int256 doubleUnitProduct = xInt * uLOG2_E;\\n result = exp2(wrap(doubleUnitProduct / uUNIT));\\n }\\n}\\n\\n/// @notice Calculates the binary exponent of x using the binary fraction method using the following formula:\\n///\\n/// $$\\n/// 2^{-x} = \\\\frac{1}{2^x}\\n/// $$\\n///\\n/// @dev See https://ethereum.stackexchange.com/q/79903/24693.\\n///\\n/// Notes:\\n/// - If x is less than -59_794705707972522261, the result is zero.\\n///\\n/// Requirements:\\n/// - x must be less than 192e18.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The exponent as an SD59x18 number.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp2(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < 0) {\\n // The inverse of any number less than the threshold is truncated to zero.\\n if (xInt < uEXP2_MIN_THRESHOLD) {\\n return ZERO;\\n }\\n\\n unchecked {\\n // Inline the fixed-point inversion to save gas.\\n result = wrap(uUNIT_SQUARED / exp2(wrap(-xInt)).unwrap());\\n }\\n } else {\\n // Numbers greater than or equal to 192e18 don't fit in the 192.64-bit format.\\n if (xInt > uEXP2_MAX_INPUT) {\\n revert Errors.PRBMath_SD59x18_Exp2_InputTooBig(x);\\n }\\n\\n unchecked {\\n // Convert x to the 192.64-bit fixed-point format.\\n uint256 x_192x64 = uint256((xInt << 64) / uUNIT);\\n\\n // It is safe to cast the result to int256 due to the checks above.\\n result = wrap(int256(Common.exp2(x_192x64)));\\n }\\n }\\n}\\n\\n/// @notice Yields the greatest whole number less than or equal to x.\\n///\\n/// @dev Optimized for fractional value inputs, because for every whole value there are (1e18 - 1) fractional\\n/// counterparts. See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n///\\n/// Requirements:\\n/// - x must be greater than or equal to `MIN_WHOLE_SD59x18`.\\n///\\n/// @param x The SD59x18 number to floor.\\n/// @param result The greatest whole number less than or equal to x, as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction floor(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < uMIN_WHOLE_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Floor_Underflow(x);\\n }\\n\\n int256 remainder = xInt % uUNIT;\\n if (remainder == 0) {\\n result = x;\\n } else {\\n unchecked {\\n // Solidity uses C fmod style, which returns a modulus with the same sign as x.\\n int256 resultInt = xInt - remainder;\\n if (xInt < 0) {\\n resultInt -= uUNIT;\\n }\\n result = wrap(resultInt);\\n }\\n }\\n}\\n\\n/// @notice Yields the excess beyond the floor of x for positive numbers and the part of the number to the right.\\n/// of the radix point for negative numbers.\\n/// @dev Based on the odd function definition. https://en.wikipedia.org/wiki/Fractional_part\\n/// @param x The SD59x18 number to get the fractional part of.\\n/// @param result The fractional part of x as an SD59x18 number.\\nfunction frac(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() % uUNIT);\\n}\\n\\n/// @notice Calculates the geometric mean of x and y, i.e. $\\\\sqrt{x * y}$.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x * y must fit in SD59x18.\\n/// - x * y must not be negative, since complex numbers are not supported.\\n///\\n/// @param x The first operand as an SD59x18 number.\\n/// @param y The second operand as an SD59x18 number.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction gm(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n if (xInt == 0 || yInt == 0) {\\n return ZERO;\\n }\\n\\n unchecked {\\n // Equivalent to `xy / x != y`. Checking for overflow this way is faster than letting Solidity do it.\\n int256 xyInt = xInt * yInt;\\n if (xyInt / xInt != yInt) {\\n revert Errors.PRBMath_SD59x18_Gm_Overflow(x, y);\\n }\\n\\n // The product must not be negative, since complex numbers are not supported.\\n if (xyInt < 0) {\\n revert Errors.PRBMath_SD59x18_Gm_NegativeProduct(x, y);\\n }\\n\\n // We don't need to multiply the result by `UNIT` here because the x*y product picked up a factor of `UNIT`\\n // during multiplication. See the comments in {Common.sqrt}.\\n uint256 resultUint = Common.sqrt(uint256(xyInt));\\n result = wrap(int256(resultUint));\\n }\\n}\\n\\n/// @notice Calculates the inverse of x.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x must not be zero.\\n///\\n/// @param x The SD59x18 number for which to calculate the inverse.\\n/// @return result The inverse as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction inv(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(uUNIT_SQUARED / x.unwrap());\\n}\\n\\n/// @notice Calculates the natural logarithm of x using the following formula:\\n///\\n/// $$\\n/// ln{x} = log_2{x} / log_2{e}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n/// - The precision isn't sufficiently fine-grained to return exactly `UNIT` when the input is `E`.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The SD59x18 number for which to calculate the natural logarithm.\\n/// @return result The natural logarithm as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ln(SD59x18 x) pure returns (SD59x18 result) {\\n // Inline the fixed-point multiplication to save gas. This is overflow-safe because the maximum value that\\n // {log2} can return is ~195_205294292027477728.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_E);\\n}\\n\\n/// @notice Calculates the common logarithm of x using the following formula:\\n///\\n/// $$\\n/// log_{10}{x} = log_2{x} / log_2{10}\\n/// $$\\n///\\n/// However, if x is an exact power of ten, a hard coded value is returned.\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The SD59x18 number for which to calculate the common logarithm.\\n/// @return result The common logarithm as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log10(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < 0) {\\n revert Errors.PRBMath_SD59x18_Log_InputTooSmall(x);\\n }\\n\\n // Note that the `mul` in this block is the standard multiplication operation, not {SD59x18.mul}.\\n // prettier-ignore\\n assembly (\\\"memory-safe\\\") {\\n switch x\\n case 1 { result := mul(uUNIT, sub(0, 18)) }\\n case 10 { result := mul(uUNIT, sub(1, 18)) }\\n case 100 { result := mul(uUNIT, sub(2, 18)) }\\n case 1000 { result := mul(uUNIT, sub(3, 18)) }\\n case 10000 { result := mul(uUNIT, sub(4, 18)) }\\n case 100000 { result := mul(uUNIT, sub(5, 18)) }\\n case 1000000 { result := mul(uUNIT, sub(6, 18)) }\\n case 10000000 { result := mul(uUNIT, sub(7, 18)) }\\n case 100000000 { result := mul(uUNIT, sub(8, 18)) }\\n case 1000000000 { result := mul(uUNIT, sub(9, 18)) }\\n case 10000000000 { result := mul(uUNIT, sub(10, 18)) }\\n case 100000000000 { result := mul(uUNIT, sub(11, 18)) }\\n case 1000000000000 { result := mul(uUNIT, sub(12, 18)) }\\n case 10000000000000 { result := mul(uUNIT, sub(13, 18)) }\\n case 100000000000000 { result := mul(uUNIT, sub(14, 18)) }\\n case 1000000000000000 { result := mul(uUNIT, sub(15, 18)) }\\n case 10000000000000000 { result := mul(uUNIT, sub(16, 18)) }\\n case 100000000000000000 { result := mul(uUNIT, sub(17, 18)) }\\n case 1000000000000000000 { result := 0 }\\n case 10000000000000000000 { result := uUNIT }\\n case 100000000000000000000 { result := mul(uUNIT, 2) }\\n case 1000000000000000000000 { result := mul(uUNIT, 3) }\\n case 10000000000000000000000 { result := mul(uUNIT, 4) }\\n case 100000000000000000000000 { result := mul(uUNIT, 5) }\\n case 1000000000000000000000000 { result := mul(uUNIT, 6) }\\n case 10000000000000000000000000 { result := mul(uUNIT, 7) }\\n case 100000000000000000000000000 { result := mul(uUNIT, 8) }\\n case 1000000000000000000000000000 { result := mul(uUNIT, 9) }\\n case 10000000000000000000000000000 { result := mul(uUNIT, 10) }\\n case 100000000000000000000000000000 { result := mul(uUNIT, 11) }\\n case 1000000000000000000000000000000 { result := mul(uUNIT, 12) }\\n case 10000000000000000000000000000000 { result := mul(uUNIT, 13) }\\n case 100000000000000000000000000000000 { result := mul(uUNIT, 14) }\\n case 1000000000000000000000000000000000 { result := mul(uUNIT, 15) }\\n case 10000000000000000000000000000000000 { result := mul(uUNIT, 16) }\\n case 100000000000000000000000000000000000 { result := mul(uUNIT, 17) }\\n case 1000000000000000000000000000000000000 { result := mul(uUNIT, 18) }\\n case 10000000000000000000000000000000000000 { result := mul(uUNIT, 19) }\\n case 100000000000000000000000000000000000000 { result := mul(uUNIT, 20) }\\n case 1000000000000000000000000000000000000000 { result := mul(uUNIT, 21) }\\n case 10000000000000000000000000000000000000000 { result := mul(uUNIT, 22) }\\n case 100000000000000000000000000000000000000000 { result := mul(uUNIT, 23) }\\n case 1000000000000000000000000000000000000000000 { result := mul(uUNIT, 24) }\\n case 10000000000000000000000000000000000000000000 { result := mul(uUNIT, 25) }\\n case 100000000000000000000000000000000000000000000 { result := mul(uUNIT, 26) }\\n case 1000000000000000000000000000000000000000000000 { result := mul(uUNIT, 27) }\\n case 10000000000000000000000000000000000000000000000 { result := mul(uUNIT, 28) }\\n case 100000000000000000000000000000000000000000000000 { result := mul(uUNIT, 29) }\\n case 1000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 30) }\\n case 10000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 31) }\\n case 100000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 32) }\\n case 1000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 33) }\\n case 10000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 34) }\\n case 100000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 35) }\\n case 1000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 36) }\\n case 10000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 37) }\\n case 100000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 38) }\\n case 1000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 39) }\\n case 10000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 40) }\\n case 100000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 41) }\\n case 1000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 42) }\\n case 10000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 43) }\\n case 100000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 44) }\\n case 1000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 45) }\\n case 10000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 46) }\\n case 100000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 47) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 48) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 49) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 50) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 51) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 52) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 53) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 54) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 55) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 56) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 57) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 58) }\\n default { result := uMAX_SD59x18 }\\n }\\n\\n if (result.unwrap() == uMAX_SD59x18) {\\n unchecked {\\n // Inline the fixed-point division to save gas.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_10);\\n }\\n }\\n}\\n\\n/// @notice Calculates the binary logarithm of x using the iterative approximation algorithm:\\n///\\n/// $$\\n/// log_2{x} = n + log_2{y}, \\\\text{ where } y = x*2^{-n}, \\\\ y \\\\in [1, 2)\\n/// $$\\n///\\n/// For $0 \\\\leq x \\\\lt 1$, the input is inverted:\\n///\\n/// $$\\n/// log_2{x} = -log_2{\\\\frac{1}{x}}\\n/// $$\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Binary_logarithm#Iterative_approximation.\\n///\\n/// Notes:\\n/// - Due to the lossy precision of the iterative approximation, the results are not perfectly accurate to the last decimal.\\n///\\n/// Requirements:\\n/// - x must be greater than zero.\\n///\\n/// @param x The SD59x18 number for which to calculate the binary logarithm.\\n/// @return result The binary logarithm as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log2(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt <= 0) {\\n revert Errors.PRBMath_SD59x18_Log_InputTooSmall(x);\\n }\\n\\n unchecked {\\n int256 sign;\\n if (xInt >= uUNIT) {\\n sign = 1;\\n } else {\\n sign = -1;\\n // Inline the fixed-point inversion to save gas.\\n xInt = uUNIT_SQUARED / xInt;\\n }\\n\\n // Calculate the integer part of the logarithm.\\n uint256 n = Common.msb(uint256(xInt / uUNIT));\\n\\n // This is the integer part of the logarithm as an SD59x18 number. The operation can't overflow\\n // because n is at most 255, `UNIT` is 1e18, and the sign is either 1 or -1.\\n int256 resultInt = int256(n) * uUNIT;\\n\\n // Calculate $y = x * 2^{-n}$.\\n int256 y = xInt >> n;\\n\\n // If y is the unit number, the fractional part is zero.\\n if (y == uUNIT) {\\n return wrap(resultInt * sign);\\n }\\n\\n // Calculate the fractional part via the iterative approximation.\\n // The `delta >>= 1` part is equivalent to `delta /= 2`, but shifting bits is more gas efficient.\\n int256 DOUBLE_UNIT = 2e18;\\n for (int256 delta = uHALF_UNIT; delta > 0; delta >>= 1) {\\n y = (y * y) / uUNIT;\\n\\n // Is y^2 >= 2e18 and so in the range [2e18, 4e18)?\\n if (y >= DOUBLE_UNIT) {\\n // Add the 2^{-m} factor to the logarithm.\\n resultInt = resultInt + delta;\\n\\n // Halve y, which corresponds to z/2 in the Wikipedia article.\\n y >>= 1;\\n }\\n }\\n resultInt *= sign;\\n result = wrap(resultInt);\\n }\\n}\\n\\n/// @notice Multiplies two SD59x18 numbers together, returning a new SD59x18 number.\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {Common.mulDiv18}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv18}.\\n/// - None of the inputs can be `MIN_SD59x18`.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The multiplicand as an SD59x18 number.\\n/// @param y The multiplier as an SD59x18 number.\\n/// @return result The product as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mul(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n if (xInt == uMIN_SD59x18 || yInt == uMIN_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Mul_InputTooSmall();\\n }\\n\\n // Get hold of the absolute values of x and y.\\n uint256 xAbs;\\n uint256 yAbs;\\n unchecked {\\n xAbs = xInt < 0 ? uint256(-xInt) : uint256(xInt);\\n yAbs = yInt < 0 ? uint256(-yInt) : uint256(yInt);\\n }\\n\\n // Compute the absolute value (x*y\\u00f7UNIT). The resulting value must fit in SD59x18.\\n uint256 resultAbs = Common.mulDiv18(xAbs, yAbs);\\n if (resultAbs > uint256(uMAX_SD59x18)) {\\n revert Errors.PRBMath_SD59x18_Mul_Overflow(x, y);\\n }\\n\\n // Check if x and y have the same sign using two's complement representation. The left-most bit represents the sign (1 for\\n // negative, 0 for positive or zero).\\n bool sameSign = (xInt ^ yInt) > -1;\\n\\n // If the inputs have the same sign, the result should be positive. Otherwise, it should be negative.\\n unchecked {\\n result = wrap(sameSign ? int256(resultAbs) : -int256(resultAbs));\\n }\\n}\\n\\n/// @notice Raises x to the power of y using the following formula:\\n///\\n/// $$\\n/// x^y = 2^{log_2{x} * y}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {exp2}, {log2}, and {mul}.\\n/// - Returns `UNIT` for 0^0.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {exp2}, {log2}, and {mul}.\\n///\\n/// @param x The base as an SD59x18 number.\\n/// @param y Exponent to raise x to, as an SD59x18 number\\n/// @return result x raised to power y, as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction pow(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n\\n // If both x and y are zero, the result is `UNIT`. If just x is zero, the result is always zero.\\n if (xInt == 0) {\\n return yInt == 0 ? UNIT : ZERO;\\n }\\n // If x is `UNIT`, the result is always `UNIT`.\\n else if (xInt == uUNIT) {\\n return UNIT;\\n }\\n\\n // If y is zero, the result is always `UNIT`.\\n if (yInt == 0) {\\n return UNIT;\\n }\\n // If y is `UNIT`, the result is always x.\\n else if (yInt == uUNIT) {\\n return x;\\n }\\n\\n // Calculate the result using the formula.\\n result = exp2(mul(log2(x), y));\\n}\\n\\n/// @notice Raises x (an SD59x18 number) to the power y (an unsigned basic integer) using the well-known\\n/// algorithm \\\"exponentiation by squaring\\\".\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Exponentiation_by_squaring.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv18}.\\n/// - Returns `UNIT` for 0^0.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {abs} and {Common.mulDiv18}.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The base as an SD59x18 number.\\n/// @param y The exponent as a uint256.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction powu(SD59x18 x, uint256 y) pure returns (SD59x18 result) {\\n uint256 xAbs = uint256(abs(x).unwrap());\\n\\n // Calculate the first iteration of the loop in advance.\\n uint256 resultAbs = y & 1 > 0 ? xAbs : uint256(uUNIT);\\n\\n // Equivalent to `for(y /= 2; y > 0; y /= 2)`.\\n uint256 yAux = y;\\n for (yAux >>= 1; yAux > 0; yAux >>= 1) {\\n xAbs = Common.mulDiv18(xAbs, xAbs);\\n\\n // Equivalent to `y % 2 == 1`.\\n if (yAux & 1 > 0) {\\n resultAbs = Common.mulDiv18(resultAbs, xAbs);\\n }\\n }\\n\\n // The result must fit in SD59x18.\\n if (resultAbs > uint256(uMAX_SD59x18)) {\\n revert Errors.PRBMath_SD59x18_Powu_Overflow(x, y);\\n }\\n\\n unchecked {\\n // Is the base negative and the exponent odd? If yes, the result should be negative.\\n int256 resultInt = int256(resultAbs);\\n bool isNegative = x.unwrap() < 0 && y & 1 == 1;\\n if (isNegative) {\\n resultInt = -resultInt;\\n }\\n result = wrap(resultInt);\\n }\\n}\\n\\n/// @notice Calculates the square root of x using the Babylonian method.\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\\n///\\n/// Notes:\\n/// - Only the positive root is returned.\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x cannot be negative, since complex numbers are not supported.\\n/// - x must be less than `MAX_SD59x18 / UNIT`.\\n///\\n/// @param x The SD59x18 number for which to calculate the square root.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction sqrt(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < 0) {\\n revert Errors.PRBMath_SD59x18_Sqrt_NegativeInput(x);\\n }\\n if (xInt > uMAX_SD59x18 / uUNIT) {\\n revert Errors.PRBMath_SD59x18_Sqrt_Overflow(x);\\n }\\n\\n unchecked {\\n // Multiply x by `UNIT` to account for the factor of `UNIT` picked up when multiplying two SD59x18 numbers.\\n // In this case, the two numbers are both the square root.\\n uint256 resultUint = Common.sqrt(uint256(xInt * uUNIT));\\n result = wrap(int256(resultUint));\\n }\\n}\\n\",\"keccak256\":\"0xa074831139fc89ca0e5a36086b30eb50896bb6770cd5823461b1f2769017d2f0\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\nimport \\\"./Helpers.sol\\\" as Helpers;\\nimport \\\"./Math.sol\\\" as Math;\\n\\n/// @notice The signed 59.18-decimal fixed-point number representation, which can have up to 59 digits and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\\n/// type int256.\\ntype SD59x18 is int256;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoInt256,\\n Casting.intoSD1x18,\\n Casting.intoUD2x18,\\n Casting.intoUD60x18,\\n Casting.intoUint256,\\n Casting.intoUint128,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for SD59x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n MATHEMATICAL FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Math.abs,\\n Math.avg,\\n Math.ceil,\\n Math.div,\\n Math.exp,\\n Math.exp2,\\n Math.floor,\\n Math.frac,\\n Math.gm,\\n Math.inv,\\n Math.log10,\\n Math.log2,\\n Math.ln,\\n Math.mul,\\n Math.pow,\\n Math.powu,\\n Math.sqrt\\n} for SD59x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n HELPER FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Helpers.add,\\n Helpers.and,\\n Helpers.eq,\\n Helpers.gt,\\n Helpers.gte,\\n Helpers.isZero,\\n Helpers.lshift,\\n Helpers.lt,\\n Helpers.lte,\\n Helpers.mod,\\n Helpers.neq,\\n Helpers.not,\\n Helpers.or,\\n Helpers.rshift,\\n Helpers.sub,\\n Helpers.uncheckedAdd,\\n Helpers.uncheckedSub,\\n Helpers.uncheckedUnary,\\n Helpers.xor\\n} for SD59x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n OPERATORS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes it possible to use these operators on the SD59x18 type.\\nusing {\\n Helpers.add as +,\\n Helpers.and2 as &,\\n Math.div as /,\\n Helpers.eq as ==,\\n Helpers.gt as >,\\n Helpers.gte as >=,\\n Helpers.lt as <,\\n Helpers.lte as <=,\\n Helpers.mod as %,\\n Math.mul as *,\\n Helpers.neq as !=,\\n Helpers.not as ~,\\n Helpers.or as |,\\n Helpers.sub as -,\\n Helpers.unary as -,\\n Helpers.xor as ^\\n} for SD59x18 global;\\n\",\"keccak256\":\"0xe03112d145dcd5863aff24e5f381debaae29d446acd5666f3d640e3d9af738d7\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as Errors;\\nimport { uMAX_SD1x18 } from \\\"../sd1x18/Constants.sol\\\";\\nimport { SD1x18 } from \\\"../sd1x18/ValueType.sol\\\";\\nimport { SD59x18 } from \\\"../sd59x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"../ud60x18/ValueType.sol\\\";\\nimport { UD2x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts a UD2x18 number into SD1x18.\\n/// - x must be less than or equal to `uMAX_SD1x18`.\\nfunction intoSD1x18(UD2x18 x) pure returns (SD1x18 result) {\\n uint64 xUint = UD2x18.unwrap(x);\\n if (xUint > uint64(uMAX_SD1x18)) {\\n revert Errors.PRBMath_UD2x18_IntoSD1x18_Overflow(x);\\n }\\n result = SD1x18.wrap(int64(xUint));\\n}\\n\\n/// @notice Casts a UD2x18 number into SD59x18.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of SD59x18.\\nfunction intoSD59x18(UD2x18 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(int256(uint256(UD2x18.unwrap(x))));\\n}\\n\\n/// @notice Casts a UD2x18 number into UD60x18.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of UD60x18.\\nfunction intoUD60x18(UD2x18 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(UD2x18.unwrap(x));\\n}\\n\\n/// @notice Casts a UD2x18 number into uint128.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of uint128.\\nfunction intoUint128(UD2x18 x) pure returns (uint128 result) {\\n result = uint128(UD2x18.unwrap(x));\\n}\\n\\n/// @notice Casts a UD2x18 number into uint256.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of uint256.\\nfunction intoUint256(UD2x18 x) pure returns (uint256 result) {\\n result = uint256(UD2x18.unwrap(x));\\n}\\n\\n/// @notice Casts a UD2x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(UD2x18 x) pure returns (uint40 result) {\\n uint64 xUint = UD2x18.unwrap(x);\\n if (xUint > uint64(Common.MAX_UINT40)) {\\n revert Errors.PRBMath_UD2x18_IntoUint40_Overflow(x);\\n }\\n result = uint40(xUint);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction ud2x18(uint64 x) pure returns (UD2x18 result) {\\n result = UD2x18.wrap(x);\\n}\\n\\n/// @notice Unwrap a UD2x18 number into uint64.\\nfunction unwrap(UD2x18 x) pure returns (uint64 result) {\\n result = UD2x18.unwrap(x);\\n}\\n\\n/// @notice Wraps a uint64 number into UD2x18.\\nfunction wrap(uint64 x) pure returns (UD2x18 result) {\\n result = UD2x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x9b1a35d432ef951a415fae8098b3c609a99b630a3d5464b3c8e1efa8893eea07\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD2x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @dev Euler's number as a UD2x18 number.\\nUD2x18 constant E = UD2x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum value a UD2x18 number can have.\\nuint64 constant uMAX_UD2x18 = 18_446744073709551615;\\nUD2x18 constant MAX_UD2x18 = UD2x18.wrap(uMAX_UD2x18);\\n\\n/// @dev PI as a UD2x18 number.\\nUD2x18 constant PI = UD2x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of UD2x18.\\nUD2x18 constant UNIT = UD2x18.wrap(1e18);\\nuint64 constant uUNIT = 1e18;\\n\",\"keccak256\":\"0x29b0e050c865899e1fb9022b460a7829cdee248c44c4299f068ba80695eec3fc\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD2x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when trying to cast a UD2x18 number that doesn't fit in SD1x18.\\nerror PRBMath_UD2x18_IntoSD1x18_Overflow(UD2x18 x);\\n\\n/// @notice Thrown when trying to cast a UD2x18 number that doesn't fit in uint40.\\nerror PRBMath_UD2x18_IntoUint40_Overflow(UD2x18 x);\\n\",\"keccak256\":\"0xdf1e22f0b4c8032bcc8b7f63fe3984e1387f3dc7b2e9ab381822249f75376d33\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\n\\n/// @notice The unsigned 2.18-decimal fixed-point number representation, which can have up to 2 digits and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\\n/// type uint64. This is useful when end users want to use uint64 to save gas, e.g. with tight variable packing in contract\\n/// storage.\\ntype UD2x18 is uint64;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoSD1x18,\\n Casting.intoSD59x18,\\n Casting.intoUD60x18,\\n Casting.intoUint256,\\n Casting.intoUint128,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for UD2x18 global;\\n\",\"keccak256\":\"0x2802edc9869db116a0b5c490cc5f8554742f747183fa30ac5e9c80bb967e61a1\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Errors.sol\\\" as CastingErrors;\\nimport { MAX_UINT128, MAX_UINT40 } from \\\"../Common.sol\\\";\\nimport { uMAX_SD1x18 } from \\\"../sd1x18/Constants.sol\\\";\\nimport { SD1x18 } from \\\"../sd1x18/ValueType.sol\\\";\\nimport { uMAX_SD59x18 } from \\\"../sd59x18/Constants.sol\\\";\\nimport { SD59x18 } from \\\"../sd59x18/ValueType.sol\\\";\\nimport { uMAX_UD2x18 } from \\\"../ud2x18/Constants.sol\\\";\\nimport { UD2x18 } from \\\"../ud2x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts a UD60x18 number into SD1x18.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `uMAX_SD1x18`.\\nfunction intoSD1x18(UD60x18 x) pure returns (SD1x18 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > uint256(int256(uMAX_SD1x18))) {\\n revert CastingErrors.PRBMath_UD60x18_IntoSD1x18_Overflow(x);\\n }\\n result = SD1x18.wrap(int64(uint64(xUint)));\\n}\\n\\n/// @notice Casts a UD60x18 number into UD2x18.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `uMAX_UD2x18`.\\nfunction intoUD2x18(UD60x18 x) pure returns (UD2x18 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > uMAX_UD2x18) {\\n revert CastingErrors.PRBMath_UD60x18_IntoUD2x18_Overflow(x);\\n }\\n result = UD2x18.wrap(uint64(xUint));\\n}\\n\\n/// @notice Casts a UD60x18 number into SD59x18.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `uMAX_SD59x18`.\\nfunction intoSD59x18(UD60x18 x) pure returns (SD59x18 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > uint256(uMAX_SD59x18)) {\\n revert CastingErrors.PRBMath_UD60x18_IntoSD59x18_Overflow(x);\\n }\\n result = SD59x18.wrap(int256(xUint));\\n}\\n\\n/// @notice Casts a UD60x18 number into uint128.\\n/// @dev This is basically an alias for {unwrap}.\\nfunction intoUint256(UD60x18 x) pure returns (uint256 result) {\\n result = UD60x18.unwrap(x);\\n}\\n\\n/// @notice Casts a UD60x18 number into uint128.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UINT128`.\\nfunction intoUint128(UD60x18 x) pure returns (uint128 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > MAX_UINT128) {\\n revert CastingErrors.PRBMath_UD60x18_IntoUint128_Overflow(x);\\n }\\n result = uint128(xUint);\\n}\\n\\n/// @notice Casts a UD60x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(UD60x18 x) pure returns (uint40 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > MAX_UINT40) {\\n revert CastingErrors.PRBMath_UD60x18_IntoUint40_Overflow(x);\\n }\\n result = uint40(xUint);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction ud(uint256 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(x);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction ud60x18(uint256 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(x);\\n}\\n\\n/// @notice Unwraps a UD60x18 number into uint256.\\nfunction unwrap(UD60x18 x) pure returns (uint256 result) {\\n result = UD60x18.unwrap(x);\\n}\\n\\n/// @notice Wraps a uint256 number into the UD60x18 value type.\\nfunction wrap(uint256 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x5bb532da36921cbdac64d1f16de5d366ef1f664502e3b7c07d0ad06917551f85\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n// NOTICE: the \\\"u\\\" prefix stands for \\\"unwrapped\\\".\\n\\n/// @dev Euler's number as a UD60x18 number.\\nUD60x18 constant E = UD60x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum input permitted in {exp}.\\nuint256 constant uEXP_MAX_INPUT = 133_084258667509499440;\\nUD60x18 constant EXP_MAX_INPUT = UD60x18.wrap(uEXP_MAX_INPUT);\\n\\n/// @dev The maximum input permitted in {exp2}.\\nuint256 constant uEXP2_MAX_INPUT = 192e18 - 1;\\nUD60x18 constant EXP2_MAX_INPUT = UD60x18.wrap(uEXP2_MAX_INPUT);\\n\\n/// @dev Half the UNIT number.\\nuint256 constant uHALF_UNIT = 0.5e18;\\nUD60x18 constant HALF_UNIT = UD60x18.wrap(uHALF_UNIT);\\n\\n/// @dev $log_2(10)$ as a UD60x18 number.\\nuint256 constant uLOG2_10 = 3_321928094887362347;\\nUD60x18 constant LOG2_10 = UD60x18.wrap(uLOG2_10);\\n\\n/// @dev $log_2(e)$ as a UD60x18 number.\\nuint256 constant uLOG2_E = 1_442695040888963407;\\nUD60x18 constant LOG2_E = UD60x18.wrap(uLOG2_E);\\n\\n/// @dev The maximum value a UD60x18 number can have.\\nuint256 constant uMAX_UD60x18 = 115792089237316195423570985008687907853269984665640564039457_584007913129639935;\\nUD60x18 constant MAX_UD60x18 = UD60x18.wrap(uMAX_UD60x18);\\n\\n/// @dev The maximum whole value a UD60x18 number can have.\\nuint256 constant uMAX_WHOLE_UD60x18 = 115792089237316195423570985008687907853269984665640564039457_000000000000000000;\\nUD60x18 constant MAX_WHOLE_UD60x18 = UD60x18.wrap(uMAX_WHOLE_UD60x18);\\n\\n/// @dev PI as a UD60x18 number.\\nUD60x18 constant PI = UD60x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of UD60x18.\\nuint256 constant uUNIT = 1e18;\\nUD60x18 constant UNIT = UD60x18.wrap(uUNIT);\\n\\n/// @dev The unit number squared.\\nuint256 constant uUNIT_SQUARED = 1e36;\\nUD60x18 constant UNIT_SQUARED = UD60x18.wrap(uUNIT_SQUARED);\\n\\n/// @dev Zero as a UD60x18 number.\\nUD60x18 constant ZERO = UD60x18.wrap(0);\\n\",\"keccak256\":\"0x2b80d26153d3fdcfb3a9ca772d9309d31ed1275f5b8b54c3ffb54d3652b37d90\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Conversions.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { uMAX_UD60x18, uUNIT } from \\\"./Constants.sol\\\";\\nimport { PRBMath_UD60x18_Convert_Overflow } from \\\"./Errors.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Converts a UD60x18 number to a simple integer by dividing it by `UNIT`.\\n/// @dev The result is rounded toward zero.\\n/// @param x The UD60x18 number to convert.\\n/// @return result The same number in basic integer form.\\nfunction convert(UD60x18 x) pure returns (uint256 result) {\\n result = UD60x18.unwrap(x) / uUNIT;\\n}\\n\\n/// @notice Converts a simple integer to UD60x18 by multiplying it by `UNIT`.\\n///\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UD60x18 / UNIT`.\\n///\\n/// @param x The basic integer to convert.\\n/// @param result The same number converted to UD60x18.\\nfunction convert(uint256 x) pure returns (UD60x18 result) {\\n if (x > uMAX_UD60x18 / uUNIT) {\\n revert PRBMath_UD60x18_Convert_Overflow(x);\\n }\\n unchecked {\\n result = UD60x18.wrap(x * uUNIT);\\n }\\n}\\n\",\"keccak256\":\"0xaf7fc2523413822de3b66ba339fe2884fb3b8c6f6cf38ec90a2c3e3aae71df6b\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when ceiling a number overflows UD60x18.\\nerror PRBMath_UD60x18_Ceil_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when converting a basic integer to the fixed-point format overflows UD60x18.\\nerror PRBMath_UD60x18_Convert_Overflow(uint256 x);\\n\\n/// @notice Thrown when taking the natural exponent of a base greater than 133_084258667509499441.\\nerror PRBMath_UD60x18_Exp_InputTooBig(UD60x18 x);\\n\\n/// @notice Thrown when taking the binary exponent of a base greater than 192e18.\\nerror PRBMath_UD60x18_Exp2_InputTooBig(UD60x18 x);\\n\\n/// @notice Thrown when taking the geometric mean of two numbers and multiplying them overflows UD60x18.\\nerror PRBMath_UD60x18_Gm_Overflow(UD60x18 x, UD60x18 y);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\\nerror PRBMath_UD60x18_IntoSD1x18_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD59x18.\\nerror PRBMath_UD60x18_IntoSD59x18_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\\nerror PRBMath_UD60x18_IntoUD2x18_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\\nerror PRBMath_UD60x18_IntoUint128_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\\nerror PRBMath_UD60x18_IntoUint40_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when taking the logarithm of a number less than 1.\\nerror PRBMath_UD60x18_Log_InputTooSmall(UD60x18 x);\\n\\n/// @notice Thrown when calculating the square root overflows UD60x18.\\nerror PRBMath_UD60x18_Sqrt_Overflow(UD60x18 x);\\n\",\"keccak256\":\"0xa8c60d4066248df22c49c882873efbc017344107edabc48c52209abbc39cb1e3\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Helpers.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { wrap } from \\\"./Casting.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Implements the checked addition operation (+) in the UD60x18 type.\\nfunction add(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() + y.unwrap());\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the UD60x18 type.\\nfunction and(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() & bits);\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the UD60x18 type.\\nfunction and2(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() & y.unwrap());\\n}\\n\\n/// @notice Implements the equal operation (==) in the UD60x18 type.\\nfunction eq(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() == y.unwrap();\\n}\\n\\n/// @notice Implements the greater than operation (>) in the UD60x18 type.\\nfunction gt(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() > y.unwrap();\\n}\\n\\n/// @notice Implements the greater than or equal to operation (>=) in the UD60x18 type.\\nfunction gte(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() >= y.unwrap();\\n}\\n\\n/// @notice Implements a zero comparison check function in the UD60x18 type.\\nfunction isZero(UD60x18 x) pure returns (bool result) {\\n // This wouldn't work if x could be negative.\\n result = x.unwrap() == 0;\\n}\\n\\n/// @notice Implements the left shift operation (<<) in the UD60x18 type.\\nfunction lshift(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() << bits);\\n}\\n\\n/// @notice Implements the lower than operation (<) in the UD60x18 type.\\nfunction lt(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() < y.unwrap();\\n}\\n\\n/// @notice Implements the lower than or equal to operation (<=) in the UD60x18 type.\\nfunction lte(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() <= y.unwrap();\\n}\\n\\n/// @notice Implements the checked modulo operation (%) in the UD60x18 type.\\nfunction mod(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() % y.unwrap());\\n}\\n\\n/// @notice Implements the not equal operation (!=) in the UD60x18 type.\\nfunction neq(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() != y.unwrap();\\n}\\n\\n/// @notice Implements the NOT (~) bitwise operation in the UD60x18 type.\\nfunction not(UD60x18 x) pure returns (UD60x18 result) {\\n result = wrap(~x.unwrap());\\n}\\n\\n/// @notice Implements the OR (|) bitwise operation in the UD60x18 type.\\nfunction or(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() | y.unwrap());\\n}\\n\\n/// @notice Implements the right shift operation (>>) in the UD60x18 type.\\nfunction rshift(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() >> bits);\\n}\\n\\n/// @notice Implements the checked subtraction operation (-) in the UD60x18 type.\\nfunction sub(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() - y.unwrap());\\n}\\n\\n/// @notice Implements the unchecked addition operation (+) in the UD60x18 type.\\nfunction uncheckedAdd(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() + y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the unchecked subtraction operation (-) in the UD60x18 type.\\nfunction uncheckedSub(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() - y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the XOR (^) bitwise operation in the UD60x18 type.\\nfunction xor(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() ^ y.unwrap());\\n}\\n\",\"keccak256\":\"0xf5faff881391d2c060029499a666cc5f0bea90a213150bb476fae8f02a5df268\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as Errors;\\nimport { wrap } from \\\"./Casting.sol\\\";\\nimport {\\n uEXP_MAX_INPUT,\\n uEXP2_MAX_INPUT,\\n uHALF_UNIT,\\n uLOG2_10,\\n uLOG2_E,\\n uMAX_UD60x18,\\n uMAX_WHOLE_UD60x18,\\n UNIT,\\n uUNIT,\\n uUNIT_SQUARED,\\n ZERO\\n} from \\\"./Constants.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n MATHEMATICAL FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @notice Calculates the arithmetic average of x and y using the following formula:\\n///\\n/// $$\\n/// avg(x, y) = (x & y) + ((xUint ^ yUint) / 2)\\n/// $$\\n///\\n/// In English, this is what this formula does:\\n///\\n/// 1. AND x and y.\\n/// 2. Calculate half of XOR x and y.\\n/// 3. Add the two results together.\\n///\\n/// This technique is known as SWAR, which stands for \\\"SIMD within a register\\\". You can read more about it here:\\n/// https://devblogs.microsoft.com/oldnewthing/20220207-00/?p=106223\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// @param x The first operand as a UD60x18 number.\\n/// @param y The second operand as a UD60x18 number.\\n/// @return result The arithmetic average as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction avg(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n uint256 yUint = y.unwrap();\\n unchecked {\\n result = wrap((xUint & yUint) + ((xUint ^ yUint) >> 1));\\n }\\n}\\n\\n/// @notice Yields the smallest whole number greater than or equal to x.\\n///\\n/// @dev This is optimized for fractional value inputs, because for every whole value there are (1e18 - 1) fractional\\n/// counterparts. See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n///\\n/// Requirements:\\n/// - x must be less than or equal to `MAX_WHOLE_UD60x18`.\\n///\\n/// @param x The UD60x18 number to ceil.\\n/// @param result The smallest whole number greater than or equal to x, as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ceil(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n if (xUint > uMAX_WHOLE_UD60x18) {\\n revert Errors.PRBMath_UD60x18_Ceil_Overflow(x);\\n }\\n\\n assembly (\\\"memory-safe\\\") {\\n // Equivalent to `x % UNIT`.\\n let remainder := mod(x, uUNIT)\\n\\n // Equivalent to `UNIT - remainder`.\\n let delta := sub(uUNIT, remainder)\\n\\n // Equivalent to `x + remainder > 0 ? delta : 0`.\\n result := add(x, mul(delta, gt(remainder, 0)))\\n }\\n}\\n\\n/// @notice Divides two UD60x18 numbers, returning a new UD60x18 number.\\n///\\n/// @dev Uses {Common.mulDiv} to enable overflow-safe multiplication and division.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv}.\\n///\\n/// @param x The numerator as a UD60x18 number.\\n/// @param y The denominator as a UD60x18 number.\\n/// @param result The quotient as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction div(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(Common.mulDiv(x.unwrap(), uUNIT, y.unwrap()));\\n}\\n\\n/// @notice Calculates the natural exponent of x using the following formula:\\n///\\n/// $$\\n/// e^x = 2^{x * log_2{e}}\\n/// $$\\n///\\n/// @dev Requirements:\\n/// - x must be less than 133_084258667509499441.\\n///\\n/// @param x The exponent as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n // This check prevents values greater than 192e18 from being passed to {exp2}.\\n if (xUint > uEXP_MAX_INPUT) {\\n revert Errors.PRBMath_UD60x18_Exp_InputTooBig(x);\\n }\\n\\n unchecked {\\n // Inline the fixed-point multiplication to save gas.\\n uint256 doubleUnitProduct = xUint * uLOG2_E;\\n result = exp2(wrap(doubleUnitProduct / uUNIT));\\n }\\n}\\n\\n/// @notice Calculates the binary exponent of x using the binary fraction method.\\n///\\n/// @dev See https://ethereum.stackexchange.com/q/79903/24693\\n///\\n/// Requirements:\\n/// - x must be less than 192e18.\\n/// - The result must fit in UD60x18.\\n///\\n/// @param x The exponent as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp2(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n // Numbers greater than or equal to 192e18 don't fit in the 192.64-bit format.\\n if (xUint > uEXP2_MAX_INPUT) {\\n revert Errors.PRBMath_UD60x18_Exp2_InputTooBig(x);\\n }\\n\\n // Convert x to the 192.64-bit fixed-point format.\\n uint256 x_192x64 = (xUint << 64) / uUNIT;\\n\\n // Pass x to the {Common.exp2} function, which uses the 192.64-bit fixed-point number representation.\\n result = wrap(Common.exp2(x_192x64));\\n}\\n\\n/// @notice Yields the greatest whole number less than or equal to x.\\n/// @dev Optimized for fractional value inputs, because every whole value has (1e18 - 1) fractional counterparts.\\n/// See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n/// @param x The UD60x18 number to floor.\\n/// @param result The greatest whole number less than or equal to x, as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction floor(UD60x18 x) pure returns (UD60x18 result) {\\n assembly (\\\"memory-safe\\\") {\\n // Equivalent to `x % UNIT`.\\n let remainder := mod(x, uUNIT)\\n\\n // Equivalent to `x - remainder > 0 ? remainder : 0)`.\\n result := sub(x, mul(remainder, gt(remainder, 0)))\\n }\\n}\\n\\n/// @notice Yields the excess beyond the floor of x using the odd function definition.\\n/// @dev See https://en.wikipedia.org/wiki/Fractional_part.\\n/// @param x The UD60x18 number to get the fractional part of.\\n/// @param result The fractional part of x as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction frac(UD60x18 x) pure returns (UD60x18 result) {\\n assembly (\\\"memory-safe\\\") {\\n result := mod(x, uUNIT)\\n }\\n}\\n\\n/// @notice Calculates the geometric mean of x and y, i.e. $\\\\sqrt{x * y}$, rounding down.\\n///\\n/// @dev Requirements:\\n/// - x * y must fit in UD60x18.\\n///\\n/// @param x The first operand as a UD60x18 number.\\n/// @param y The second operand as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction gm(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n uint256 yUint = y.unwrap();\\n if (xUint == 0 || yUint == 0) {\\n return ZERO;\\n }\\n\\n unchecked {\\n // Checking for overflow this way is faster than letting Solidity do it.\\n uint256 xyUint = xUint * yUint;\\n if (xyUint / xUint != yUint) {\\n revert Errors.PRBMath_UD60x18_Gm_Overflow(x, y);\\n }\\n\\n // We don't need to multiply the result by `UNIT` here because the x*y product picked up a factor of `UNIT`\\n // during multiplication. See the comments in {Common.sqrt}.\\n result = wrap(Common.sqrt(xyUint));\\n }\\n}\\n\\n/// @notice Calculates the inverse of x.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x must not be zero.\\n///\\n/// @param x The UD60x18 number for which to calculate the inverse.\\n/// @return result The inverse as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction inv(UD60x18 x) pure returns (UD60x18 result) {\\n unchecked {\\n result = wrap(uUNIT_SQUARED / x.unwrap());\\n }\\n}\\n\\n/// @notice Calculates the natural logarithm of x using the following formula:\\n///\\n/// $$\\n/// ln{x} = log_2{x} / log_2{e}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n/// - The precision isn't sufficiently fine-grained to return exactly `UNIT` when the input is `E`.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The UD60x18 number for which to calculate the natural logarithm.\\n/// @return result The natural logarithm as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ln(UD60x18 x) pure returns (UD60x18 result) {\\n unchecked {\\n // Inline the fixed-point multiplication to save gas. This is overflow-safe because the maximum value that\\n // {log2} can return is ~196_205294292027477728.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_E);\\n }\\n}\\n\\n/// @notice Calculates the common logarithm of x using the following formula:\\n///\\n/// $$\\n/// log_{10}{x} = log_2{x} / log_2{10}\\n/// $$\\n///\\n/// However, if x is an exact power of ten, a hard coded value is returned.\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The UD60x18 number for which to calculate the common logarithm.\\n/// @return result The common logarithm as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log10(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n if (xUint < uUNIT) {\\n revert Errors.PRBMath_UD60x18_Log_InputTooSmall(x);\\n }\\n\\n // Note that the `mul` in this assembly block is the standard multiplication operation, not {UD60x18.mul}.\\n // prettier-ignore\\n assembly (\\\"memory-safe\\\") {\\n switch x\\n case 1 { result := mul(uUNIT, sub(0, 18)) }\\n case 10 { result := mul(uUNIT, sub(1, 18)) }\\n case 100 { result := mul(uUNIT, sub(2, 18)) }\\n case 1000 { result := mul(uUNIT, sub(3, 18)) }\\n case 10000 { result := mul(uUNIT, sub(4, 18)) }\\n case 100000 { result := mul(uUNIT, sub(5, 18)) }\\n case 1000000 { result := mul(uUNIT, sub(6, 18)) }\\n case 10000000 { result := mul(uUNIT, sub(7, 18)) }\\n case 100000000 { result := mul(uUNIT, sub(8, 18)) }\\n case 1000000000 { result := mul(uUNIT, sub(9, 18)) }\\n case 10000000000 { result := mul(uUNIT, sub(10, 18)) }\\n case 100000000000 { result := mul(uUNIT, sub(11, 18)) }\\n case 1000000000000 { result := mul(uUNIT, sub(12, 18)) }\\n case 10000000000000 { result := mul(uUNIT, sub(13, 18)) }\\n case 100000000000000 { result := mul(uUNIT, sub(14, 18)) }\\n case 1000000000000000 { result := mul(uUNIT, sub(15, 18)) }\\n case 10000000000000000 { result := mul(uUNIT, sub(16, 18)) }\\n case 100000000000000000 { result := mul(uUNIT, sub(17, 18)) }\\n case 1000000000000000000 { result := 0 }\\n case 10000000000000000000 { result := uUNIT }\\n case 100000000000000000000 { result := mul(uUNIT, 2) }\\n case 1000000000000000000000 { result := mul(uUNIT, 3) }\\n case 10000000000000000000000 { result := mul(uUNIT, 4) }\\n case 100000000000000000000000 { result := mul(uUNIT, 5) }\\n case 1000000000000000000000000 { result := mul(uUNIT, 6) }\\n case 10000000000000000000000000 { result := mul(uUNIT, 7) }\\n case 100000000000000000000000000 { result := mul(uUNIT, 8) }\\n case 1000000000000000000000000000 { result := mul(uUNIT, 9) }\\n case 10000000000000000000000000000 { result := mul(uUNIT, 10) }\\n case 100000000000000000000000000000 { result := mul(uUNIT, 11) }\\n case 1000000000000000000000000000000 { result := mul(uUNIT, 12) }\\n case 10000000000000000000000000000000 { result := mul(uUNIT, 13) }\\n case 100000000000000000000000000000000 { result := mul(uUNIT, 14) }\\n case 1000000000000000000000000000000000 { result := mul(uUNIT, 15) }\\n case 10000000000000000000000000000000000 { result := mul(uUNIT, 16) }\\n case 100000000000000000000000000000000000 { result := mul(uUNIT, 17) }\\n case 1000000000000000000000000000000000000 { result := mul(uUNIT, 18) }\\n case 10000000000000000000000000000000000000 { result := mul(uUNIT, 19) }\\n case 100000000000000000000000000000000000000 { result := mul(uUNIT, 20) }\\n case 1000000000000000000000000000000000000000 { result := mul(uUNIT, 21) }\\n case 10000000000000000000000000000000000000000 { result := mul(uUNIT, 22) }\\n case 100000000000000000000000000000000000000000 { result := mul(uUNIT, 23) }\\n case 1000000000000000000000000000000000000000000 { result := mul(uUNIT, 24) }\\n case 10000000000000000000000000000000000000000000 { result := mul(uUNIT, 25) }\\n case 100000000000000000000000000000000000000000000 { result := mul(uUNIT, 26) }\\n case 1000000000000000000000000000000000000000000000 { result := mul(uUNIT, 27) }\\n case 10000000000000000000000000000000000000000000000 { result := mul(uUNIT, 28) }\\n case 100000000000000000000000000000000000000000000000 { result := mul(uUNIT, 29) }\\n case 1000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 30) }\\n case 10000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 31) }\\n case 100000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 32) }\\n case 1000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 33) }\\n case 10000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 34) }\\n case 100000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 35) }\\n case 1000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 36) }\\n case 10000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 37) }\\n case 100000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 38) }\\n case 1000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 39) }\\n case 10000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 40) }\\n case 100000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 41) }\\n case 1000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 42) }\\n case 10000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 43) }\\n case 100000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 44) }\\n case 1000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 45) }\\n case 10000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 46) }\\n case 100000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 47) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 48) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 49) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 50) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 51) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 52) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 53) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 54) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 55) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 56) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 57) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 58) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 59) }\\n default { result := uMAX_UD60x18 }\\n }\\n\\n if (result.unwrap() == uMAX_UD60x18) {\\n unchecked {\\n // Inline the fixed-point division to save gas.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_10);\\n }\\n }\\n}\\n\\n/// @notice Calculates the binary logarithm of x using the iterative approximation algorithm:\\n///\\n/// $$\\n/// log_2{x} = n + log_2{y}, \\\\text{ where } y = x*2^{-n}, \\\\ y \\\\in [1, 2)\\n/// $$\\n///\\n/// For $0 \\\\leq x \\\\lt 1$, the input is inverted:\\n///\\n/// $$\\n/// log_2{x} = -log_2{\\\\frac{1}{x}}\\n/// $$\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Binary_logarithm#Iterative_approximation\\n///\\n/// Notes:\\n/// - Due to the lossy precision of the iterative approximation, the results are not perfectly accurate to the last decimal.\\n///\\n/// Requirements:\\n/// - x must be greater than zero.\\n///\\n/// @param x The UD60x18 number for which to calculate the binary logarithm.\\n/// @return result The binary logarithm as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log2(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n if (xUint < uUNIT) {\\n revert Errors.PRBMath_UD60x18_Log_InputTooSmall(x);\\n }\\n\\n unchecked {\\n // Calculate the integer part of the logarithm.\\n uint256 n = Common.msb(xUint / uUNIT);\\n\\n // This is the integer part of the logarithm as a UD60x18 number. The operation can't overflow because n\\n // n is at most 255 and UNIT is 1e18.\\n uint256 resultUint = n * uUNIT;\\n\\n // Calculate $y = x * 2^{-n}$.\\n uint256 y = xUint >> n;\\n\\n // If y is the unit number, the fractional part is zero.\\n if (y == uUNIT) {\\n return wrap(resultUint);\\n }\\n\\n // Calculate the fractional part via the iterative approximation.\\n // The `delta >>= 1` part is equivalent to `delta /= 2`, but shifting bits is more gas efficient.\\n uint256 DOUBLE_UNIT = 2e18;\\n for (uint256 delta = uHALF_UNIT; delta > 0; delta >>= 1) {\\n y = (y * y) / uUNIT;\\n\\n // Is y^2 >= 2e18 and so in the range [2e18, 4e18)?\\n if (y >= DOUBLE_UNIT) {\\n // Add the 2^{-m} factor to the logarithm.\\n resultUint += delta;\\n\\n // Halve y, which corresponds to z/2 in the Wikipedia article.\\n y >>= 1;\\n }\\n }\\n result = wrap(resultUint);\\n }\\n}\\n\\n/// @notice Multiplies two UD60x18 numbers together, returning a new UD60x18 number.\\n///\\n/// @dev Uses {Common.mulDiv} to enable overflow-safe multiplication and division.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv}.\\n///\\n/// @dev See the documentation in {Common.mulDiv18}.\\n/// @param x The multiplicand as a UD60x18 number.\\n/// @param y The multiplier as a UD60x18 number.\\n/// @return result The product as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mul(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(Common.mulDiv18(x.unwrap(), y.unwrap()));\\n}\\n\\n/// @notice Raises x to the power of y.\\n///\\n/// For $1 \\\\leq x \\\\leq \\\\infty$, the following standard formula is used:\\n///\\n/// $$\\n/// x^y = 2^{log_2{x} * y}\\n/// $$\\n///\\n/// For $0 \\\\leq x \\\\lt 1$, since the unsigned {log2} is undefined, an equivalent formula is used:\\n///\\n/// $$\\n/// i = \\\\frac{1}{x}\\n/// w = 2^{log_2{i} * y}\\n/// x^y = \\\\frac{1}{w}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2} and {mul}.\\n/// - Returns `UNIT` for 0^0.\\n/// - It may not perform well with very small values of x. Consider using SD59x18 as an alternative.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {exp2}, {log2}, and {mul}.\\n///\\n/// @param x The base as a UD60x18 number.\\n/// @param y The exponent as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction pow(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n uint256 yUint = y.unwrap();\\n\\n // If both x and y are zero, the result is `UNIT`. If just x is zero, the result is always zero.\\n if (xUint == 0) {\\n return yUint == 0 ? UNIT : ZERO;\\n }\\n // If x is `UNIT`, the result is always `UNIT`.\\n else if (xUint == uUNIT) {\\n return UNIT;\\n }\\n\\n // If y is zero, the result is always `UNIT`.\\n if (yUint == 0) {\\n return UNIT;\\n }\\n // If y is `UNIT`, the result is always x.\\n else if (yUint == uUNIT) {\\n return x;\\n }\\n\\n // If x is greater than `UNIT`, use the standard formula.\\n if (xUint > uUNIT) {\\n result = exp2(mul(log2(x), y));\\n }\\n // Conversely, if x is less than `UNIT`, use the equivalent formula.\\n else {\\n UD60x18 i = wrap(uUNIT_SQUARED / xUint);\\n UD60x18 w = exp2(mul(log2(i), y));\\n result = wrap(uUNIT_SQUARED / w.unwrap());\\n }\\n}\\n\\n/// @notice Raises x (a UD60x18 number) to the power y (an unsigned basic integer) using the well-known\\n/// algorithm \\\"exponentiation by squaring\\\".\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Exponentiation_by_squaring.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv18}.\\n/// - Returns `UNIT` for 0^0.\\n///\\n/// Requirements:\\n/// - The result must fit in UD60x18.\\n///\\n/// @param x The base as a UD60x18 number.\\n/// @param y The exponent as a uint256.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction powu(UD60x18 x, uint256 y) pure returns (UD60x18 result) {\\n // Calculate the first iteration of the loop in advance.\\n uint256 xUint = x.unwrap();\\n uint256 resultUint = y & 1 > 0 ? xUint : uUNIT;\\n\\n // Equivalent to `for(y /= 2; y > 0; y /= 2)`.\\n for (y >>= 1; y > 0; y >>= 1) {\\n xUint = Common.mulDiv18(xUint, xUint);\\n\\n // Equivalent to `y % 2 == 1`.\\n if (y & 1 > 0) {\\n resultUint = Common.mulDiv18(resultUint, xUint);\\n }\\n }\\n result = wrap(resultUint);\\n}\\n\\n/// @notice Calculates the square root of x using the Babylonian method.\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\\n///\\n/// Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x must be less than `MAX_UD60x18 / UNIT`.\\n///\\n/// @param x The UD60x18 number for which to calculate the square root.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction sqrt(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n unchecked {\\n if (xUint > uMAX_UD60x18 / uUNIT) {\\n revert Errors.PRBMath_UD60x18_Sqrt_Overflow(x);\\n }\\n // Multiply x by `UNIT` to account for the factor of `UNIT` picked up when multiplying two UD60x18 numbers.\\n // In this case, the two numbers are both the square root.\\n result = wrap(Common.sqrt(xUint * uUNIT));\\n }\\n}\\n\",\"keccak256\":\"0x462144667aac3f96d5f8dba7aa68fe4c5a3f61e1d7bbbc81bee21168817f9c09\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\nimport \\\"./Helpers.sol\\\" as Helpers;\\nimport \\\"./Math.sol\\\" as Math;\\n\\n/// @notice The unsigned 60.18-decimal fixed-point number representation, which can have up to 60 digits and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the Solidity type uint256.\\n/// @dev The value type is defined here so it can be imported in all other files.\\ntype UD60x18 is uint256;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoSD1x18,\\n Casting.intoUD2x18,\\n Casting.intoSD59x18,\\n Casting.intoUint128,\\n Casting.intoUint256,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for UD60x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n MATHEMATICAL FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes the functions in this library callable on the UD60x18 type.\\nusing {\\n Math.avg,\\n Math.ceil,\\n Math.div,\\n Math.exp,\\n Math.exp2,\\n Math.floor,\\n Math.frac,\\n Math.gm,\\n Math.inv,\\n Math.ln,\\n Math.log10,\\n Math.log2,\\n Math.mul,\\n Math.pow,\\n Math.powu,\\n Math.sqrt\\n} for UD60x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n HELPER FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes the functions in this library callable on the UD60x18 type.\\nusing {\\n Helpers.add,\\n Helpers.and,\\n Helpers.eq,\\n Helpers.gt,\\n Helpers.gte,\\n Helpers.isZero,\\n Helpers.lshift,\\n Helpers.lt,\\n Helpers.lte,\\n Helpers.mod,\\n Helpers.neq,\\n Helpers.not,\\n Helpers.or,\\n Helpers.rshift,\\n Helpers.sub,\\n Helpers.uncheckedAdd,\\n Helpers.uncheckedSub,\\n Helpers.xor\\n} for UD60x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n OPERATORS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes it possible to use these operators on the UD60x18 type.\\nusing {\\n Helpers.add as +,\\n Helpers.and2 as &,\\n Math.div as /,\\n Helpers.eq as ==,\\n Helpers.gt as >,\\n Helpers.gte as >=,\\n Helpers.lt as <,\\n Helpers.lte as <=,\\n Helpers.or as |,\\n Helpers.mod as %,\\n Math.mul as *,\\n Helpers.neq as !=,\\n Helpers.not as ~,\\n Helpers.sub as -,\\n Helpers.xor as ^\\n} for UD60x18 global;\\n\",\"keccak256\":\"0xdd873b5124180d9b71498b3a7fe93b1c08c368bec741f7d5f8e17f78a0b70f31\",\"license\":\"MIT\"},\"contracts/interfaces/IERC6551Registry.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\ninterface IERC6551Registry {\\n /**\\n * @dev Creates a token bound account for a non-fungible token.\\n *\\n * If account has already been created, returns the account address without calling create2.\\n *\\n * Emits ERC6551AccountCreated event.\\n *\\n * @return account The address of the token bound account\\n */\\n function createAccount(\\n address implementation,\\n bytes32 salt,\\n uint256 chainId,\\n address tokenContract,\\n uint256 tokenId\\n ) external returns (address account);\\n}\\n\",\"keccak256\":\"0x64c52de8a8e68398e61dd8b42dda8e9af8cf6abf93bb85629c322440991ea568\",\"license\":\"MIT\"},\"contracts/interfaces/hats/HatsErrors.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface HatsErrors {\\n /// @notice Emitted when `user` is attempting to perform an action on `hatId` but is not wearing one of `hatId`'s admin hats\\n /// @dev Can be equivalent to `NotHatWearer(buildHatId(hatId))`, such as when emitted by `approveLinkTopHatToTree` or `relinkTopHatToTree`\\n error NotAdmin(address user, uint256 hatId);\\n\\n /// @notice Emitted when attempting to perform an action as or for an account that is not a wearer of a given hat\\n error NotHatWearer();\\n\\n /// @notice Emitted when attempting to perform an action that requires being either an admin or wearer of a given hat\\n error NotAdminOrWearer();\\n\\n /// @notice Emitted when attempting to mint `hatId` but `hatId`'s maxSupply has been reached\\n error AllHatsWorn(uint256 hatId);\\n\\n /// @notice Emitted when attempting to create a hat with a level 14 hat as its admin\\n error MaxLevelsReached();\\n\\n /// @notice Emitted when an attempted hat id has empty intermediate level(s)\\n error InvalidHatId();\\n\\n /// @notice Emitted when attempting to mint `hatId` to a `wearer` who is already wearing the hat\\n error AlreadyWearingHat(address wearer, uint256 hatId);\\n\\n /// @notice Emitted when attempting to mint a non-existant hat\\n error HatDoesNotExist(uint256 hatId);\\n\\n /// @notice Emmitted when attempting to mint or transfer a hat that is not active\\n error HatNotActive();\\n\\n /// @notice Emitted when attempting to mint or transfer a hat to an ineligible wearer\\n error NotEligible();\\n\\n /// @notice Emitted when attempting to check or set a hat's status from an account that is not that hat's toggle module\\n error NotHatsToggle();\\n\\n /// @notice Emitted when attempting to check or set a hat wearer's status from an account that is not that hat's eligibility module\\n error NotHatsEligibility();\\n\\n /// @notice Emitted when array arguments to a batch function have mismatching lengths\\n error BatchArrayLengthMismatch();\\n\\n /// @notice Emitted when attempting to mutate or transfer an immutable hat\\n error Immutable();\\n\\n /// @notice Emitted when attempting to change a hat's maxSupply to a value lower than its current supply\\n error NewMaxSupplyTooLow();\\n\\n /// @notice Emitted when attempting to link a tophat to a new admin for which the tophat serves as an admin\\n error CircularLinkage();\\n\\n /// @notice Emitted when attempting to link or relink a tophat to a separate tree\\n error CrossTreeLinkage();\\n\\n /// @notice Emitted when attempting to link a tophat without a request\\n error LinkageNotRequested();\\n\\n /// @notice Emitted when attempting to unlink a tophat that does not have a wearer\\n /// @dev This ensures that unlinking never results in a bricked tophat\\n error InvalidUnlink();\\n\\n /// @notice Emmited when attempting to change a hat's eligibility or toggle module to the zero address\\n error ZeroAddress();\\n\\n /// @notice Emmitted when attempting to change a hat's details or imageURI to a string with over 7000 bytes (~characters)\\n /// @dev This protects against a DOS attack where an admin iteratively extend's a hat's details or imageURI\\n /// to be so long that reading it exceeds the block gas limit, breaking `uri()` and `viewHat()`\\n error StringTooLong();\\n}\\n\",\"keccak256\":\"0x81b0056b7bed86eabc07c0e4a9655c586ddb8e6c128320593669b76efd5a08de\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/HatsEvents.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface HatsEvents {\\n /// @notice Emitted when a new hat is created\\n /// @param id The id for the new hat\\n /// @param details A description of the Hat\\n /// @param maxSupply The total instances of the Hat that can be worn at once\\n /// @param eligibility The address that can report on the Hat wearer's status\\n /// @param toggle The address that can deactivate the Hat\\n /// @param mutable_ Whether the hat's properties are changeable after creation\\n /// @param imageURI The image uri for this hat and the fallback for its\\n event HatCreated(\\n uint256 id,\\n string details,\\n uint32 maxSupply,\\n address eligibility,\\n address toggle,\\n bool mutable_,\\n string imageURI\\n );\\n\\n /// @notice Emitted when a hat wearer's standing is updated\\n /// @dev Eligibility is excluded since the source of truth for eligibility is the eligibility module and may change without a transaction\\n /// @param hatId The id of the wearer's hat\\n /// @param wearer The wearer's address\\n /// @param wearerStanding Whether the wearer is in good standing for the hat\\n event WearerStandingChanged(\\n uint256 hatId,\\n address wearer,\\n bool wearerStanding\\n );\\n\\n /// @notice Emitted when a hat's status is updated\\n /// @param hatId The id of the hat\\n /// @param newStatus Whether the hat is active\\n event HatStatusChanged(uint256 hatId, bool newStatus);\\n\\n /// @notice Emitted when a hat's details are updated\\n /// @param hatId The id of the hat\\n /// @param newDetails The updated details\\n event HatDetailsChanged(uint256 hatId, string newDetails);\\n\\n /// @notice Emitted when a hat's eligibility module is updated\\n /// @param hatId The id of the hat\\n /// @param newEligibility The updated eligibiliy module\\n event HatEligibilityChanged(uint256 hatId, address newEligibility);\\n\\n /// @notice Emitted when a hat's toggle module is updated\\n /// @param hatId The id of the hat\\n /// @param newToggle The updated toggle module\\n event HatToggleChanged(uint256 hatId, address newToggle);\\n\\n /// @notice Emitted when a hat's mutability is updated\\n /// @param hatId The id of the hat\\n event HatMutabilityChanged(uint256 hatId);\\n\\n /// @notice Emitted when a hat's maximum supply is updated\\n /// @param hatId The id of the hat\\n /// @param newMaxSupply The updated max supply\\n event HatMaxSupplyChanged(uint256 hatId, uint32 newMaxSupply);\\n\\n /// @notice Emitted when a hat's image URI is updated\\n /// @param hatId The id of the hat\\n /// @param newImageURI The updated image URI\\n event HatImageURIChanged(uint256 hatId, string newImageURI);\\n\\n /// @notice Emitted when a tophat linkage is requested by its admin\\n /// @param domain The domain of the tree tophat to link\\n /// @param newAdmin The tophat's would-be admin in the parent tree\\n event TopHatLinkRequested(uint32 domain, uint256 newAdmin);\\n\\n /// @notice Emitted when a tophat is linked to a another tree\\n /// @param domain The domain of the newly-linked tophat\\n /// @param newAdmin The tophat's new admin in the parent tree\\n event TopHatLinked(uint32 domain, uint256 newAdmin);\\n}\\n\",\"keccak256\":\"0x53413397d15e1636c3cd7bd667656b79bc2886785403b824bcd4ed122667f2c6\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/IHats.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\nimport \\\"./IHatsIdUtilities.sol\\\";\\nimport \\\"./HatsErrors.sol\\\";\\nimport \\\"./HatsEvents.sol\\\";\\n\\ninterface IHats is IHatsIdUtilities, HatsErrors, HatsEvents {\\n function mintTopHat(\\n address _target,\\n string memory _details,\\n string memory _imageURI\\n ) external returns (uint256 topHatId);\\n\\n function createHat(\\n uint256 _admin,\\n string calldata _details,\\n uint32 _maxSupply,\\n address _eligibility,\\n address _toggle,\\n bool _mutable,\\n string calldata _imageURI\\n ) external returns (uint256 newHatId);\\n\\n function batchCreateHats(\\n uint256[] calldata _admins,\\n string[] calldata _details,\\n uint32[] calldata _maxSupplies,\\n address[] memory _eligibilityModules,\\n address[] memory _toggleModules,\\n bool[] calldata _mutables,\\n string[] calldata _imageURIs\\n ) external returns (bool success);\\n\\n function getNextId(uint256 _admin) external view returns (uint256 nextId);\\n\\n function mintHat(\\n uint256 _hatId,\\n address _wearer\\n ) external returns (bool success);\\n\\n function batchMintHats(\\n uint256[] calldata _hatIds,\\n address[] calldata _wearers\\n ) external returns (bool success);\\n\\n function setHatStatus(\\n uint256 _hatId,\\n bool _newStatus\\n ) external returns (bool toggled);\\n\\n function checkHatStatus(uint256 _hatId) external returns (bool toggled);\\n\\n function setHatWearerStatus(\\n uint256 _hatId,\\n address _wearer,\\n bool _eligible,\\n bool _standing\\n ) external returns (bool updated);\\n\\n function checkHatWearerStatus(\\n uint256 _hatId,\\n address _wearer\\n ) external returns (bool updated);\\n\\n function renounceHat(uint256 _hatId) external;\\n\\n function transferHat(uint256 _hatId, address _from, address _to) external;\\n\\n /*//////////////////////////////////////////////////////////////\\n HATS ADMIN FUNCTIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n function makeHatImmutable(uint256 _hatId) external;\\n\\n function changeHatDetails(\\n uint256 _hatId,\\n string memory _newDetails\\n ) external;\\n\\n function changeHatEligibility(\\n uint256 _hatId,\\n address _newEligibility\\n ) external;\\n\\n function changeHatToggle(uint256 _hatId, address _newToggle) external;\\n\\n function changeHatImageURI(\\n uint256 _hatId,\\n string memory _newImageURI\\n ) external;\\n\\n function changeHatMaxSupply(uint256 _hatId, uint32 _newMaxSupply) external;\\n\\n function requestLinkTopHatToTree(\\n uint32 _topHatId,\\n uint256 _newAdminHat\\n ) external;\\n\\n function approveLinkTopHatToTree(\\n uint32 _topHatId,\\n uint256 _newAdminHat,\\n address _eligibility,\\n address _toggle,\\n string calldata _details,\\n string calldata _imageURI\\n ) external;\\n\\n function unlinkTopHatFromTree(uint32 _topHatId, address _wearer) external;\\n\\n function relinkTopHatWithinTree(\\n uint32 _topHatDomain,\\n uint256 _newAdminHat,\\n address _eligibility,\\n address _toggle,\\n string calldata _details,\\n string calldata _imageURI\\n ) external;\\n\\n /*//////////////////////////////////////////////////////////////\\n VIEW FUNCTIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n function viewHat(\\n uint256 _hatId\\n )\\n external\\n view\\n returns (\\n string memory details,\\n uint32 maxSupply,\\n uint32 supply,\\n address eligibility,\\n address toggle,\\n string memory imageURI,\\n uint16 lastHatId,\\n bool mutable_,\\n bool active\\n );\\n\\n function isWearerOfHat(\\n address _user,\\n uint256 _hatId\\n ) external view returns (bool isWearer);\\n\\n function isAdminOfHat(\\n address _user,\\n uint256 _hatId\\n ) external view returns (bool isAdmin);\\n\\n function isInGoodStanding(\\n address _wearer,\\n uint256 _hatId\\n ) external view returns (bool standing);\\n\\n function isEligible(\\n address _wearer,\\n uint256 _hatId\\n ) external view returns (bool eligible);\\n\\n function getHatEligibilityModule(\\n uint256 _hatId\\n ) external view returns (address eligibility);\\n\\n function getHatToggleModule(\\n uint256 _hatId\\n ) external view returns (address toggle);\\n\\n function getHatMaxSupply(\\n uint256 _hatId\\n ) external view returns (uint32 maxSupply);\\n\\n function hatSupply(uint256 _hatId) external view returns (uint32 supply);\\n\\n function getImageURIForHat(\\n uint256 _hatId\\n ) external view returns (string memory _uri);\\n\\n function balanceOf(\\n address wearer,\\n uint256 hatId\\n ) external view returns (uint256 balance);\\n\\n function balanceOfBatch(\\n address[] calldata _wearers,\\n uint256[] calldata _hatIds\\n ) external view returns (uint256[] memory);\\n\\n function uri(uint256 id) external view returns (string memory _uri);\\n}\\n\",\"keccak256\":\"0x2867004bddc5148fa1937f25c0403e5d9977583aaf50fdbdb74bd463f64f21c8\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/IHatsIdUtilities.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface IHatsIdUtilities {\\n function buildHatId(\\n uint256 _admin,\\n uint16 _newHat\\n ) external pure returns (uint256 id);\\n\\n function getHatLevel(uint256 _hatId) external view returns (uint32 level);\\n\\n function getLocalHatLevel(\\n uint256 _hatId\\n ) external pure returns (uint32 level);\\n\\n function isTopHat(uint256 _hatId) external view returns (bool _topHat);\\n\\n function isLocalTopHat(\\n uint256 _hatId\\n ) external pure returns (bool _localTopHat);\\n\\n function isValidHatId(\\n uint256 _hatId\\n ) external view returns (bool validHatId);\\n\\n function getAdminAtLevel(\\n uint256 _hatId,\\n uint32 _level\\n ) external view returns (uint256 admin);\\n\\n function getAdminAtLocalLevel(\\n uint256 _hatId,\\n uint32 _level\\n ) external pure returns (uint256 admin);\\n\\n function getTopHatDomain(\\n uint256 _hatId\\n ) external view returns (uint32 domain);\\n\\n function getTippyTopHatDomain(\\n uint32 _topHatDomain\\n ) external view returns (uint32 domain);\\n\\n function noCircularLinkage(\\n uint32 _topHatDomain,\\n uint256 _linkedAdmin\\n ) external view returns (bool notCircular);\\n\\n function sameTippyTopHatDomain(\\n uint32 _topHatDomain,\\n uint256 _newAdminHat\\n ) external view returns (bool sameDomain);\\n}\\n\",\"keccak256\":\"0x007fcc07b20bf84bacad1f9a2ddf4e30e1a8be961e144b7bef8e98a51781aee9\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/IHatsModuleFactory.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.19;\\n\\ninterface IHatsModuleFactory {\\n error HatsModuleFactory_ModuleAlreadyDeployed(\\n address implementation,\\n uint256 hatId,\\n bytes otherImmutableArgs,\\n uint256 saltNonce\\n );\\n\\n error BatchArrayLengthMismatch();\\n\\n event HatsModuleFactory_ModuleDeployed(\\n address implementation,\\n address instance,\\n uint256 hatId,\\n bytes otherImmutableArgs,\\n bytes initData,\\n uint256 saltNonce\\n );\\n\\n function HATS() external view returns (address);\\n\\n function version() external view returns (string memory);\\n\\n function createHatsModule(\\n address _implementation,\\n uint256 _hatId,\\n bytes calldata _otherImmutableArgs,\\n bytes calldata _initData,\\n uint256 _saltNonce\\n ) external returns (address _instance);\\n\\n function batchCreateHatsModule(\\n address[] calldata _implementations,\\n uint256[] calldata _hatIds,\\n bytes[] calldata _otherImmutableArgsArray,\\n bytes[] calldata _initDataArray,\\n uint256[] calldata _saltNonces\\n ) external returns (bool success);\\n\\n function getHatsModuleAddress(\\n address _implementation,\\n uint256 _hatId,\\n bytes calldata _otherImmutableArgs,\\n uint256 _saltNonce\\n ) external view returns (address);\\n\\n function deployed(\\n address _implementation,\\n uint256 _hatId,\\n bytes calldata _otherImmutableArgs,\\n uint256 _saltNonce\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x861faf40785cedb829243116d492653414a367853408a5c27d201522f6c3bfdd\",\"license\":\"MIT\"},\"contracts/interfaces/hats/modules/IHatsElectionsEligibility.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.13;\\n\\ninterface IHatsElectionsEligibility {\\n event ElectionOpened(uint128 nextTermEnd);\\n event ElectionCompleted(uint128 termEnd, address[] winners);\\n event NewTermStarted(uint128 termEnd);\\n event Recalled(uint128 termEnd, address[] accounts);\\n\\n /// @notice Returns the first second after the current term ends.\\n /// @dev Also serves as the id for the current term.\\n function currentTermEnd() external view returns (uint128);\\n\\n /// @notice Returns the first second after the next term ends.\\n /// @dev Also serves as the id for the next term.\\n function nextTermEnd() external view returns (uint128);\\n\\n /// @notice Returns the election status (open or closed) for a given term end.\\n /// @param termEnd The term end timestamp to query.\\n function electionStatus(\\n uint128 termEnd\\n ) external view returns (bool isElectionOpen);\\n\\n /// @notice Returns whether a candidate was elected in a given term.\\n /// @param termEnd The term end timestamp to query.\\n /// @param candidate The address of the candidate.\\n function electionResults(\\n uint128 termEnd,\\n address candidate\\n ) external view returns (bool elected);\\n\\n /// @notice Returns the BALLOT_BOX_HAT constant.\\n function BALLOT_BOX_HAT() external pure returns (uint256);\\n\\n /// @notice Returns the ADMIN_HAT constant.\\n function ADMIN_HAT() external pure returns (uint256);\\n\\n /**\\n * @notice Submit the results of an election for a specified term.\\n * @dev Only callable by the wearer(s) of the BALLOT_BOX_HAT.\\n * @param _termEnd The id of the term for which the election results are being submitted.\\n * @param _winners The addresses of the winners of the election.\\n */\\n function elect(uint128 _termEnd, address[] calldata _winners) external;\\n\\n /**\\n * @notice Submit the results of a recall election for a specified term.\\n * @dev Only callable by the wearer(s) of the BALLOT_BOX_HAT.\\n * @param _termEnd The id of the term for which the recall results are being submitted.\\n * @param _recallees The addresses to be recalled.\\n */\\n function recall(uint128 _termEnd, address[] calldata _recallees) external;\\n\\n /**\\n * @notice Set the next term and open the election for it.\\n * @dev Only callable by the wearer(s) of the ADMIN_HAT.\\n * @param _newTermEnd The id of the term that will be opened.\\n */\\n function setNextTerm(uint128 _newTermEnd) external;\\n\\n /**\\n * @notice Start the next term, updating the current term.\\n * @dev Can be called by anyone, but will revert if conditions are not met.\\n */\\n function startNextTerm() external;\\n\\n /**\\n * @notice Determine the eligibility and standing of a wearer for a hat.\\n * @param _wearer The address of the hat wearer.\\n * @param _hatId The ID of the hat.\\n * @return eligible True if the wearer is eligible for the hat.\\n * @return standing True if the wearer is in good standing.\\n */\\n function getWearerStatus(\\n address _wearer,\\n uint256 _hatId\\n ) external view returns (bool eligible, bool standing);\\n}\\n\",\"keccak256\":\"0x74dfc5d538d866ddb8ee2ca1b569abf62e02d848c59f308adf6075ecff175c7d\",\"license\":\"MIT\"},\"contracts/interfaces/sablier/IAdminable.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\n/// @title IAdminable\\n/// @notice Contract module that provides a basic access control mechanism, with an admin that can be\\n/// granted exclusive access to specific functions. The inheriting contract must set the initial admin\\n/// in the constructor.\\ninterface IAdminable {\\n /*//////////////////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Emitted when the admin is transferred.\\n /// @param oldAdmin The address of the old admin.\\n /// @param newAdmin The address of the new admin.\\n event TransferAdmin(address indexed oldAdmin, address indexed newAdmin);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice The address of the admin account or contract.\\n function admin() external view returns (address);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n NON-CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Transfers the contract admin to a new address.\\n ///\\n /// @dev Notes:\\n /// - Does not revert if the admin is the same.\\n /// - This function can potentially leave the contract without an admin, thereby removing any\\n /// functionality that is only available to the admin.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the contract admin.\\n ///\\n /// @param newAdmin The address of the new admin.\\n function transferAdmin(address newAdmin) external;\\n}\\n\",\"keccak256\":\"0xa279c49e51228b571329164e36250e82b2c1378e8b549194ab7dd90fca9c3b2b\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/IERC4096.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 \\\"@openzeppelin/contracts/interfaces/IERC165.sol\\\";\\nimport {IERC721} from \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\n\\n/// @title ERC-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\",\"keccak256\":\"0xa34b9c52cbe36be860244f52256f1b05badf0cb797d208664b87337610d0e82d\",\"license\":\"MIT\"},\"contracts/interfaces/sablier/ISablierV2Lockup.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC4906} from \\\"./IERC4096.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IERC721Metadata} from \\\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\\\";\\nimport {UD60x18} from \\\"@prb/math/src/UD60x18.sol\\\";\\n\\nimport {Lockup} from \\\"./types/DataTypes.sol\\\";\\nimport {IAdminable} from \\\"./IAdminable.sol\\\";\\nimport {ISablierV2NFTDescriptor} from \\\"./ISablierV2NFTDescriptor.sol\\\";\\n\\n/// @title ISablierV2Lockup\\n/// @notice Common logic between all Sablier V2 Lockup contracts.\\ninterface ISablierV2Lockup is\\n IAdminable, // 0 inherited components\\n IERC4906, // 2 inherited components\\n IERC721Metadata // 2 inherited components\\n{\\n /*//////////////////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Emitted when the admin allows a new recipient contract to hook to Sablier.\\n /// @param admin The address of the current contract admin.\\n /// @param recipient The address of the recipient contract put on the allowlist.\\n event AllowToHook(address indexed admin, address recipient);\\n\\n /// @notice Emitted when a stream is canceled.\\n /// @param streamId The ID of the stream.\\n /// @param sender The address of the stream's sender.\\n /// @param recipient The address of the stream's recipient.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param senderAmount The amount of assets refunded to the stream's sender, denoted in units of the asset's\\n /// decimals.\\n /// @param recipientAmount The amount of assets left for the stream's recipient to withdraw, denoted in units of the\\n /// asset's decimals.\\n event CancelLockupStream(\\n uint256 streamId,\\n address indexed sender,\\n address indexed recipient,\\n IERC20 indexed asset,\\n uint128 senderAmount,\\n uint128 recipientAmount\\n );\\n\\n /// @notice Emitted when a sender gives up the right to cancel a stream.\\n /// @param streamId The ID of the stream.\\n event RenounceLockupStream(uint256 indexed streamId);\\n\\n /// @notice Emitted when the admin sets a new NFT descriptor contract.\\n /// @param admin The address of the current contract admin.\\n /// @param oldNFTDescriptor The address of the old NFT descriptor contract.\\n /// @param newNFTDescriptor The address of the new NFT descriptor contract.\\n event SetNFTDescriptor(\\n address indexed admin,\\n ISablierV2NFTDescriptor oldNFTDescriptor,\\n ISablierV2NFTDescriptor newNFTDescriptor\\n );\\n\\n /// @notice Emitted when assets are withdrawn from a stream.\\n /// @param streamId The ID of the stream.\\n /// @param to The address that has received the withdrawn assets.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param amount The amount of assets withdrawn, denoted in units of the asset's decimals.\\n event WithdrawFromLockupStream(\\n uint256 indexed streamId,\\n address indexed to,\\n IERC20 indexed asset,\\n uint128 amount\\n );\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Retrieves the address of the ERC-20 asset to be distributed.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getAsset(uint256 streamId) external view returns (IERC20 asset);\\n\\n /// @notice Retrieves the amount deposited in the stream, denoted in units of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getDepositedAmount(\\n uint256 streamId\\n ) external view returns (uint128 depositedAmount);\\n\\n /// @notice Retrieves the stream's end time, which is a Unix timestamp.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getEndTime(\\n uint256 streamId\\n ) external view returns (uint40 endTime);\\n\\n /// @notice Retrieves the stream's recipient.\\n /// @dev Reverts if the NFT has been burned.\\n /// @param streamId The stream ID for the query.\\n function getRecipient(\\n uint256 streamId\\n ) external view returns (address recipient);\\n\\n /// @notice Retrieves the amount refunded to the sender after a cancellation, denoted in units of the asset's\\n /// decimals. This amount is always zero unless the stream was canceled.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getRefundedAmount(\\n uint256 streamId\\n ) external view returns (uint128 refundedAmount);\\n\\n /// @notice Retrieves the stream's sender.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getSender(uint256 streamId) external view returns (address sender);\\n\\n /// @notice Retrieves the stream's start time, which is a Unix timestamp.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getStartTime(\\n uint256 streamId\\n ) external view returns (uint40 startTime);\\n\\n /// @notice Retrieves the amount withdrawn from the stream, denoted in units of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getWithdrawnAmount(\\n uint256 streamId\\n ) external view returns (uint128 withdrawnAmount);\\n\\n /// @notice Retrieves a flag indicating whether the provided address is a contract allowed to hook to Sablier\\n /// when a stream is canceled or when assets are withdrawn.\\n /// @dev See {ISablierLockupRecipient} for more information.\\n function isAllowedToHook(\\n address recipient\\n ) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream can be canceled. When the stream is cold, this\\n /// flag is always `false`.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isCancelable(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream is cold, i.e. settled, canceled, or depleted.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isCold(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream is depleted.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isDepleted(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream exists.\\n /// @dev Does not revert if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isStream(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream NFT can be transferred.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isTransferable(\\n uint256 streamId\\n ) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream is warm, i.e. either pending or streaming.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isWarm(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves the maximum broker fee that can be charged by the broker, denoted as a fixed-point\\n /// number where 1e18 is 100%.\\n /// @dev This value is hard coded as a constant.\\n function MAX_BROKER_FEE() external view returns (UD60x18);\\n\\n /// @notice Counter for stream IDs, used in the create functions.\\n function nextStreamId() external view returns (uint256);\\n\\n /// @notice Contract that generates the non-fungible token URI.\\n function nftDescriptor() external view returns (ISablierV2NFTDescriptor);\\n\\n /// @notice Calculates the amount that the sender would be refunded if the stream were canceled, denoted in units\\n /// of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function refundableAmountOf(\\n uint256 streamId\\n ) external view returns (uint128 refundableAmount);\\n\\n /// @notice Retrieves the stream's status.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function statusOf(\\n uint256 streamId\\n ) external view returns (Lockup.Status status);\\n\\n /// @notice Calculates the amount streamed to the recipient, denoted in units of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n ///\\n /// Notes:\\n /// - Upon cancellation of the stream, the amount streamed is calculated as the difference between the deposited\\n /// amount and the refunded amount. Ultimately, when the stream becomes depleted, the streamed amount is equivalent\\n /// to the total amount withdrawn.\\n ///\\n /// @param streamId The stream ID for the query.\\n function streamedAmountOf(\\n uint256 streamId\\n ) external view returns (uint128 streamedAmount);\\n\\n /// @notice Retrieves a flag indicating whether the stream was canceled.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function wasCanceled(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Calculates the amount that the recipient can withdraw from the stream, denoted in units of the asset's\\n /// decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function withdrawableAmountOf(\\n uint256 streamId\\n ) external view returns (uint128 withdrawableAmount);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n NON-CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Allows a recipient contract to hook to Sablier when a stream is canceled or when assets are withdrawn.\\n /// Useful for implementing contracts that hold streams on behalf of users, such as vaults or staking contracts.\\n ///\\n /// @dev Emits an {AllowToHook} event.\\n ///\\n /// Notes:\\n /// - Does not revert if the contract is already on the allowlist.\\n /// - This is an irreversible operation. The contract cannot be removed from the allowlist.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the contract admin.\\n /// - `recipient` must have a non-zero code size.\\n /// - `recipient` must implement {ISablierLockupRecipient}.\\n ///\\n /// @param recipient The address of the contract to allow for hooks.\\n function allowToHook(address recipient) external;\\n\\n /// @notice Burns the NFT associated with the stream.\\n ///\\n /// @dev Emits a {Transfer} event.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `streamId` must reference a depleted stream.\\n /// - The NFT must exist.\\n /// - `msg.sender` must be either the NFT owner or an approved third party.\\n ///\\n /// @param streamId The ID of the stream NFT to burn.\\n function burn(uint256 streamId) external;\\n\\n /// @notice Cancels the stream and refunds any remaining assets to the sender.\\n ///\\n /// @dev Emits a {Transfer}, {CancelLockupStream}, and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - If there any assets left for the recipient to withdraw, the stream is marked as canceled. Otherwise, the\\n /// stream is marked as depleted.\\n /// - This function attempts to invoke a hook on the recipient, if the resolved address is a contract.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - The stream must be warm and cancelable.\\n /// - `msg.sender` must be the stream's sender.\\n ///\\n /// @param streamId The ID of the stream to cancel.\\n function cancel(uint256 streamId) external;\\n\\n /// @notice Cancels multiple streams and refunds any remaining assets to the sender.\\n ///\\n /// @dev Emits multiple {Transfer}, {CancelLockupStream}, and {MetadataUpdate} events.\\n ///\\n /// Notes:\\n /// - Refer to the notes in {cancel}.\\n ///\\n /// Requirements:\\n /// - All requirements from {cancel} must be met for each stream.\\n ///\\n /// @param streamIds The IDs of the streams to cancel.\\n function cancelMultiple(uint256[] calldata streamIds) external;\\n\\n /// @notice Removes the right of the stream's sender to cancel the stream.\\n ///\\n /// @dev Emits a {RenounceLockupStream} and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - This is an irreversible operation.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `streamId` must reference a warm stream.\\n /// - `msg.sender` must be the stream's sender.\\n /// - The stream must be cancelable.\\n ///\\n /// @param streamId The ID of the stream to renounce.\\n function renounce(uint256 streamId) external;\\n\\n /// @notice Sets a new NFT descriptor contract, which produces the URI describing the Sablier stream NFTs.\\n ///\\n /// @dev Emits a {SetNFTDescriptor} and {BatchMetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - Does not revert if the NFT descriptor is the same.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the contract admin.\\n ///\\n /// @param newNFTDescriptor The address of the new NFT descriptor contract.\\n function setNFTDescriptor(\\n ISablierV2NFTDescriptor newNFTDescriptor\\n ) external;\\n\\n /// @notice Withdraws the provided amount of assets from the stream to the `to` address.\\n ///\\n /// @dev Emits a {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - This function attempts to call a hook on the recipient of the stream, unless `msg.sender` is the recipient.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `streamId` must not reference a null or depleted stream.\\n /// - `to` must not be the zero address.\\n /// - `amount` must be greater than zero and must not exceed the withdrawable amount.\\n /// - `to` must be the recipient if `msg.sender` is not the stream's recipient or an approved third party.\\n ///\\n /// @param streamId The ID of the stream to withdraw from.\\n /// @param to The address receiving the withdrawn assets.\\n /// @param amount The amount to withdraw, denoted in units of the asset's decimals.\\n function withdraw(uint256 streamId, address to, uint128 amount) external;\\n\\n /// @notice Withdraws the maximum withdrawable amount from the stream to the provided address `to`.\\n ///\\n /// @dev Emits a {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - Refer to the notes in {withdraw}.\\n ///\\n /// Requirements:\\n /// - Refer to the requirements in {withdraw}.\\n ///\\n /// @param streamId The ID of the stream to withdraw from.\\n /// @param to The address receiving the withdrawn assets.\\n /// @return withdrawnAmount The amount withdrawn, denoted in units of the asset's decimals.\\n function withdrawMax(\\n uint256 streamId,\\n address to\\n ) external returns (uint128 withdrawnAmount);\\n\\n /// @notice Withdraws the maximum withdrawable amount from the stream to the current recipient, and transfers the\\n /// NFT to `newRecipient`.\\n ///\\n /// @dev Emits a {WithdrawFromLockupStream} and a {Transfer} event.\\n ///\\n /// Notes:\\n /// - If the withdrawable amount is zero, the withdrawal is skipped.\\n /// - Refer to the notes in {withdraw}.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the stream's recipient.\\n /// - Refer to the requirements in {withdraw}.\\n /// - Refer to the requirements in {IERC721.transferFrom}.\\n ///\\n /// @param streamId The ID of the stream NFT to transfer.\\n /// @param newRecipient The address of the new owner of the stream NFT.\\n /// @return withdrawnAmount The amount withdrawn, denoted in units of the asset's decimals.\\n function withdrawMaxAndTransfer(\\n uint256 streamId,\\n address newRecipient\\n ) external returns (uint128 withdrawnAmount);\\n\\n /// @notice Withdraws assets from streams to the recipient of each stream.\\n ///\\n /// @dev Emits multiple {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} events.\\n ///\\n /// Notes:\\n /// - This function attempts to call a hook on the recipient of each stream, unless `msg.sender` is the recipient.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - There must be an equal number of `streamIds` and `amounts`.\\n /// - Each stream ID in the array must not reference a null or depleted stream.\\n /// - Each amount in the array must be greater than zero and must not exceed the withdrawable amount.\\n ///\\n /// @param streamIds The IDs of the streams to withdraw from.\\n /// @param amounts The amounts to withdraw, denoted in units of the asset's decimals.\\n function withdrawMultiple(\\n uint256[] calldata streamIds,\\n uint128[] calldata amounts\\n ) external;\\n}\\n\",\"keccak256\":\"0x3e5541c38a901637bd310965deb5bbde73ef07fe4ee3c752cbec330c6b9d62a3\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/ISablierV2LockupLinear.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\nimport {Lockup, LockupLinear} from \\\"./types/DataTypes.sol\\\";\\nimport {ISablierV2Lockup} from \\\"./ISablierV2Lockup.sol\\\";\\n\\n/// @title ISablierV2LockupLinear\\n/// @notice Creates and manages Lockup streams with a linear distribution function.\\ninterface ISablierV2LockupLinear is ISablierV2Lockup {\\n /*//////////////////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Emitted when a stream is created.\\n /// @param streamId The ID of the newly created stream.\\n /// @param funder The address which funded the stream.\\n /// @param sender The address distributing the assets, which will have the ability to cancel the stream.\\n /// @param recipient The address receiving the assets.\\n /// @param amounts Struct encapsulating (i) the deposit amount, and (ii) the broker fee amount, both denoted\\n /// in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Boolean indicating whether the stream will be cancelable or not.\\n /// @param transferable Boolean indicating whether the stream NFT is transferable or not.\\n /// @param timestamps Struct encapsulating (i) the stream's start time, (ii) cliff time, and (iii) end time, all as\\n /// Unix timestamps.\\n /// @param broker The address of the broker who has helped create the stream, e.g. a front-end website.\\n event CreateLockupLinearStream(\\n uint256 streamId,\\n address funder,\\n address indexed sender,\\n address indexed recipient,\\n Lockup.CreateAmounts amounts,\\n IERC20 indexed asset,\\n bool cancelable,\\n bool transferable,\\n LockupLinear.Timestamps timestamps,\\n address broker\\n );\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Retrieves the stream's cliff time, which is a Unix timestamp. A value of zero means there\\n /// is no cliff.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getCliffTime(\\n uint256 streamId\\n ) external view returns (uint40 cliffTime);\\n\\n /// @notice Retrieves the full stream details.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n /// @return stream See the documentation in {DataTypes}.\\n function getStream(\\n uint256 streamId\\n ) external view returns (LockupLinear.StreamLL memory stream);\\n\\n /// @notice Retrieves the stream's start, cliff and end timestamps.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n /// @return timestamps See the documentation in {DataTypes}.\\n function getTimestamps(\\n uint256 streamId\\n ) external view returns (LockupLinear.Timestamps memory timestamps);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n NON-CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Creates a stream by setting the start time to `block.timestamp`, and the end time to\\n /// the sum of `block.timestamp` and `params.durations.total`. The stream is funded by `msg.sender` and is wrapped\\n /// in an ERC-721 NFT.\\n ///\\n /// @dev Emits a {Transfer} and {CreateLockupLinearStream} event.\\n ///\\n /// Requirements:\\n /// - All requirements in {createWithTimestamps} must be met for the calculated parameters.\\n ///\\n /// @param params Struct encapsulating the function parameters, which are documented in {DataTypes}.\\n /// @return streamId The ID of the newly created stream.\\n function createWithDurations(\\n LockupLinear.CreateWithDurations calldata params\\n ) external returns (uint256 streamId);\\n\\n /// @notice Creates a stream with the provided start time and end time. The stream is funded by `msg.sender` and is\\n /// wrapped in an ERC-721 NFT.\\n ///\\n /// @dev Emits a {Transfer} and {CreateLockupLinearStream} event.\\n ///\\n /// Notes:\\n /// - A cliff time of zero means there is no cliff.\\n /// - As long as the times are ordered, it is not an error for the start or the cliff time to be in the past.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `params.totalAmount` must be greater than zero.\\n /// - If set, `params.broker.fee` must not be greater than `MAX_BROKER_FEE`.\\n /// - `params.timestamps.start` must be greater than zero and less than `params.timestamps.end`.\\n /// - If set, `params.timestamps.cliff` must be greater than `params.timestamps.start` and less than\\n /// `params.timestamps.end`.\\n /// - `params.timestamps.end` must be in the future.\\n /// - `params.recipient` must not be the zero address.\\n /// - `msg.sender` must have allowed this contract to spend at least `params.totalAmount` assets.\\n ///\\n /// @param params Struct encapsulating the function parameters, which are documented in {DataTypes}.\\n /// @return streamId The ID of the newly created stream.\\n function createWithTimestamps(\\n LockupLinear.CreateWithTimestamps calldata params\\n ) external returns (uint256 streamId);\\n}\\n\",\"keccak256\":\"0x064264723114b1f1cf3953fd79874dfcbb42cf313857aee6d5e6b09a23e0010b\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/ISablierV2NFTDescriptor.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC721Metadata} from \\\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\\\";\\n\\n/// @title ISablierV2NFTDescriptor\\n/// @notice This contract generates the URI describing the Sablier V2 stream NFTs.\\n/// @dev Inspired by Uniswap V3 Positions NFTs.\\ninterface ISablierV2NFTDescriptor {\\n /// @notice Produces the URI describing a particular stream NFT.\\n /// @dev This is a data URI with the JSON contents directly inlined.\\n /// @param sablier The address of the Sablier contract the stream was created in.\\n /// @param streamId The ID of the stream for which to produce a description.\\n /// @return uri The URI of the ERC721-compliant metadata.\\n function tokenURI(\\n IERC721Metadata sablier,\\n uint256 streamId\\n ) external view returns (string memory uri);\\n}\\n\",\"keccak256\":\"0x4ed430e553d14161e93efdaaacd1a502f49b38969c9d714b45d2e682a74fa0bc\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/types/DataTypes.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {UD2x18} from \\\"@prb/math/src/UD2x18.sol\\\";\\nimport {UD60x18} from \\\"@prb/math/src/UD60x18.sol\\\";\\n\\n// DataTypes.sol\\n//\\n// This file defines all structs used in V2 Core, most of which are organized under three namespaces:\\n//\\n// - Lockup\\n// - LockupDynamic\\n// - LockupLinear\\n// - LockupTranched\\n//\\n// You will notice that some structs contain \\\"slot\\\" annotations - they are used to indicate the\\n// storage layout of the struct. It is more gas efficient to group small data types together so\\n// that they fit in a single 32-byte slot.\\n\\n/// @notice Struct encapsulating the broker parameters passed to the create functions. Both can be set to zero.\\n/// @param account The address receiving the broker's fee.\\n/// @param fee The broker's percentage fee from the total amount, denoted as a fixed-point number where 1e18 is 100%.\\nstruct Broker {\\n address account;\\n UD60x18 fee;\\n}\\n\\n/// @notice Namespace for the structs used in both {SablierV2LockupLinear} and {SablierV2LockupDynamic}.\\nlibrary Lockup {\\n /// @notice Struct encapsulating the deposit, withdrawn, and refunded amounts, all denoted in units of the asset's\\n /// decimals.\\n /// @dev Because the deposited and the withdrawn amount are often read together, declaring them in the same slot\\n /// saves gas.\\n /// @param deposited The initial amount deposited in the stream, net of broker fee.\\n /// @param withdrawn The cumulative amount withdrawn from the stream.\\n /// @param refunded The amount refunded to the sender. Unless the stream was canceled, this is always zero.\\n struct Amounts {\\n // slot 0\\n uint128 deposited;\\n uint128 withdrawn;\\n // slot 1\\n uint128 refunded;\\n }\\n\\n /// @notice Struct encapsulating (i) the deposit amount and (ii) the broker fee amount, both denoted in units of the\\n /// asset's decimals.\\n /// @param deposit The amount to deposit in the stream.\\n /// @param brokerFee The broker fee amount.\\n struct CreateAmounts {\\n uint128 deposit;\\n uint128 brokerFee;\\n }\\n\\n /// @notice Enum representing the different statuses of a stream.\\n /// @custom:value0 PENDING Stream created but not started; assets are in a pending state.\\n /// @custom:value1 STREAMING Active stream where assets are currently being streamed.\\n /// @custom:value2 SETTLED All assets have been streamed; recipient is due to withdraw them.\\n /// @custom:value3 CANCELED Canceled stream; remaining assets await recipient's withdrawal.\\n /// @custom:value4 DEPLETED Depleted stream; all assets have been withdrawn and/or refunded.\\n enum Status {\\n PENDING,\\n STREAMING,\\n SETTLED,\\n CANCELED,\\n DEPLETED\\n }\\n\\n /// @notice A common data structure to be stored in all {SablierV2Lockup} models.\\n /// @dev The fields are arranged like this to save gas via tight variable packing.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream.\\n /// @param startTime The Unix timestamp indicating the stream's start.\\n /// @param endTime The Unix timestamp indicating the stream's end.\\n /// @param isCancelable Boolean indicating if the stream is cancelable.\\n /// @param wasCanceled Boolean indicating if the stream was canceled.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param isDepleted Boolean indicating if the stream is depleted.\\n /// @param isStream Boolean indicating if the struct entity exists.\\n /// @param isTransferable Boolean indicating if the stream NFT is transferable.\\n /// @param amounts Struct encapsulating the deposit, withdrawn, and refunded amounts, all denoted in units of the\\n /// asset's decimals.\\n struct Stream {\\n // slot 0\\n address sender;\\n uint40 startTime;\\n uint40 endTime;\\n bool isCancelable;\\n bool wasCanceled;\\n // slot 1\\n IERC20 asset;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n // slot 2 and 3\\n Lockup.Amounts amounts;\\n }\\n}\\n\\n/// @notice Namespace for the structs used in {SablierV2LockupDynamic}.\\nlibrary LockupDynamic {\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupDynamic.createWithDurations} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param segments Segments with durations used to compose the dynamic distribution function. Timestamps are\\n /// calculated by starting from `block.timestamp` and adding each duration to the previous timestamp.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithDurations {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n SegmentWithDuration[] segments;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupDynamic.createWithTimestamps} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param startTime The Unix timestamp indicating the stream's start.\\n /// @param segments Segments used to compose the dynamic distribution function.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithTimestamps {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n uint40 startTime;\\n Segment[] segments;\\n Broker broker;\\n }\\n\\n /// @notice Segment struct used in the Lockup Dynamic stream.\\n /// @param amount The amount of assets to be streamed in the segment, denoted in units of the asset's decimals.\\n /// @param exponent The exponent of the segment, denoted as a fixed-point number.\\n /// @param timestamp The Unix timestamp indicating the segment's end.\\n struct Segment {\\n // slot 0\\n uint128 amount;\\n UD2x18 exponent;\\n uint40 timestamp;\\n }\\n\\n /// @notice Segment struct used at runtime in {SablierV2LockupDynamic.createWithDurations}.\\n /// @param amount The amount of assets to be streamed in the segment, denoted in units of the asset's decimals.\\n /// @param exponent The exponent of the segment, denoted as a fixed-point number.\\n /// @param duration The time difference in seconds between the segment and the previous one.\\n struct SegmentWithDuration {\\n uint128 amount;\\n UD2x18 exponent;\\n uint40 duration;\\n }\\n\\n /// @notice Struct encapsulating the full details of a stream.\\n /// @dev Extends `Lockup.Stream` by including the recipient and the segments.\\n struct StreamLD {\\n address sender;\\n address recipient;\\n uint40 startTime;\\n uint40 endTime;\\n bool isCancelable;\\n bool wasCanceled;\\n IERC20 asset;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n Lockup.Amounts amounts;\\n Segment[] segments;\\n }\\n\\n /// @notice Struct encapsulating the LockupDynamic timestamps.\\n /// @param start The Unix timestamp indicating the stream's start.\\n /// @param end The Unix timestamp indicating the stream's end.\\n struct Timestamps {\\n uint40 start;\\n uint40 end;\\n }\\n}\\n\\n/// @notice Namespace for the structs used in {SablierV2LockupLinear}.\\nlibrary LockupLinear {\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupLinear.createWithDurations} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param durations Struct encapsulating (i) cliff period duration and (ii) total stream duration, both in seconds.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithDurations {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n Durations durations;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupLinear.createWithTimestamps} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param timestamps Struct encapsulating (i) the stream's start time, (ii) cliff time, and (iii) end time, all as\\n /// Unix timestamps.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithTimestamps {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n Timestamps timestamps;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the cliff duration and the total duration.\\n /// @param cliff The cliff duration in seconds.\\n /// @param total The total duration in seconds.\\n struct Durations {\\n uint40 cliff;\\n uint40 total;\\n }\\n\\n /// @notice Struct encapsulating the full details of a stream.\\n /// @dev Extends `Lockup.Stream` by including the recipient and the cliff time.\\n struct StreamLL {\\n address sender;\\n address recipient;\\n uint40 startTime;\\n bool isCancelable;\\n bool wasCanceled;\\n IERC20 asset;\\n uint40 endTime;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n Lockup.Amounts amounts;\\n uint40 cliffTime;\\n }\\n\\n /// @notice Struct encapsulating the LockupLinear timestamps.\\n /// @param start The Unix timestamp for the stream's start.\\n /// @param cliff The Unix timestamp for the cliff period's end. A value of zero means there is no cliff.\\n /// @param end The Unix timestamp for the stream's end.\\n struct Timestamps {\\n uint40 start;\\n uint40 cliff;\\n uint40 end;\\n }\\n}\\n\\n/// @notice Namespace for the structs used in {SablierV2LockupTranched}.\\nlibrary LockupTranched {\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupTranched.createWithDurations} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param tranches Tranches with durations used to compose the tranched distribution function. Timestamps are\\n /// calculated by starting from `block.timestamp` and adding each duration to the previous timestamp.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithDurations {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n TrancheWithDuration[] tranches;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupTranched.createWithTimestamps} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param startTime The Unix timestamp indicating the stream's start.\\n /// @param tranches Tranches used to compose the tranched distribution function.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithTimestamps {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n uint40 startTime;\\n Tranche[] tranches;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the full details of a stream.\\n /// @dev Extends `Lockup.Stream` by including the recipient and the tranches.\\n struct StreamLT {\\n address sender;\\n address recipient;\\n uint40 startTime;\\n uint40 endTime;\\n bool isCancelable;\\n bool wasCanceled;\\n IERC20 asset;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n Lockup.Amounts amounts;\\n Tranche[] tranches;\\n }\\n\\n /// @notice Struct encapsulating the LockupTranched timestamps.\\n /// @param start The Unix timestamp indicating the stream's start.\\n /// @param end The Unix timestamp indicating the stream's end.\\n struct Timestamps {\\n uint40 start;\\n uint40 end;\\n }\\n\\n /// @notice Tranche struct used in the Lockup Tranched stream.\\n /// @param amount The amount of assets to be unlocked in the tranche, denoted in units of the asset's decimals.\\n /// @param timestamp The Unix timestamp indicating the tranche's end.\\n struct Tranche {\\n // slot 0\\n uint128 amount;\\n uint40 timestamp;\\n }\\n\\n /// @notice Tranche struct used at runtime in {SablierV2LockupTranched.createWithDurations}.\\n /// @param amount The amount of assets to be unlocked in the tranche, denoted in units of the asset's decimals.\\n /// @param duration The time difference in seconds between the tranche and the previous one.\\n struct TrancheWithDuration {\\n uint128 amount;\\n uint40 duration;\\n }\\n}\\n\",\"keccak256\":\"0x727722c0ec71a76a947b935c9dfcac8fd846d6c3547dfbc8739c7109f3b95068\",\"license\":\"GPL-3.0-or-later\"},\"contracts/modules/DecentHatsCreationModule.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.28;\\n\\nimport {Enum} from \\\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\\\";\\nimport {IAvatar} from \\\"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol\\\";\\nimport {Strings} from \\\"@openzeppelin/contracts/utils/Strings.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IERC6551Registry} from \\\"../interfaces/IERC6551Registry.sol\\\";\\nimport {IHats} from \\\"../interfaces/hats/IHats.sol\\\";\\nimport {LockupLinear, Broker} from \\\"../interfaces/sablier/types/DataTypes.sol\\\";\\nimport {IHatsModuleFactory} from \\\"../interfaces/hats/IHatsModuleFactory.sol\\\";\\nimport {IHatsElectionsEligibility} from \\\"../interfaces/hats/modules/IHatsElectionsEligibility.sol\\\";\\nimport {ModuleProxyFactory} from \\\"@gnosis.pm/zodiac/contracts/factory/ModuleProxyFactory.sol\\\";\\nimport {ISablierV2LockupLinear} from \\\"../interfaces/sablier/ISablierV2LockupLinear.sol\\\";\\nimport {DecentHatsModuleUtils} from \\\"./DecentHatsModuleUtils.sol\\\";\\n\\ncontract DecentHatsCreationModule is DecentHatsModuleUtils {\\n struct TopHatParams {\\n string details;\\n string imageURI;\\n }\\n\\n struct AdminHatParams {\\n string details;\\n string imageURI;\\n bool isMutable;\\n }\\n\\n struct CreateTreeParams {\\n IHats hatsProtocol;\\n IERC6551Registry erc6551Registry;\\n IHatsModuleFactory hatsModuleFactory;\\n ModuleProxyFactory moduleProxyFactory;\\n address keyValuePairs;\\n address decentAutonomousAdminImplementation;\\n address hatsAccountImplementation;\\n address hatsElectionsEligibilityImplementation;\\n TopHatParams topHat;\\n AdminHatParams adminHat;\\n HatParams[] hats;\\n }\\n\\n /* /////////////////////////////////////////////////////////////////////////////\\n EXTERNAL FUNCTIONS\\n ///////////////////////////////////////////////////////////////////////////// */\\n /**\\n * @notice For a safe without any roles previously created on it, this function should be called. It sets up the\\n * top hat and admin hat, as well as any other hats and their streams that are provided, then transfers the top hat\\n * to the calling safe.\\n *\\n * @notice This contract should be enabled a module on the Safe for which the role(s) are to be created, and disabled after.\\n *\\n * @dev For each hat that is included, if the hat is:\\n * - termed, its stream funds on are targeted directly at the nominated wearer. The wearer should directly call `withdraw-`\\n * on the Sablier contract.\\n * - untermed, its stream funds are targeted at the hat's smart account. In order to withdraw funds from the stream, the\\n * hat's smart account must be the one call to `withdraw-` on the Sablier contract, setting the recipient arg to its wearer.\\n *\\n * @dev In order for a Safe to seamlessly create roles even if it has never previously created a role and thus has\\n * no hat tree, we defer the creation of the hat tree and its setup to this contract. This way, in a single tx block,\\n * the resulting topHatId of the newly created hat can be used to create an admin hat and any other hats needed.\\n * We also make use of `KeyValuePairs` to associate the topHatId with the Safe.\\n *\\n * @param treeParams The parameters for creating the Hat Tree with Roles\\n */\\n function createAndDeclareTree(\\n CreateTreeParams calldata treeParams\\n ) external {\\n // Create Top Hat\\n (uint256 topHatId, address topHatAccount) = _processTopHat(\\n treeParams.hatsProtocol,\\n treeParams.erc6551Registry,\\n treeParams.hatsAccountImplementation,\\n treeParams.keyValuePairs,\\n treeParams.topHat\\n );\\n\\n // Create Admin Hat\\n uint256 adminHatId = _processAdminHat(\\n treeParams.hatsProtocol,\\n treeParams.erc6551Registry,\\n treeParams.hatsAccountImplementation,\\n topHatId,\\n topHatAccount,\\n treeParams.moduleProxyFactory,\\n treeParams.decentAutonomousAdminImplementation,\\n treeParams.adminHat\\n );\\n\\n // Create Role Hats\\n _processRoleHats(\\n CreateRoleHatsParams({\\n hatsProtocol: treeParams.hatsProtocol,\\n erc6551Registry: treeParams.erc6551Registry,\\n hatsAccountImplementation: treeParams.hatsAccountImplementation,\\n topHatId: topHatId,\\n topHatAccount: topHatAccount,\\n hatsModuleFactory: treeParams.hatsModuleFactory,\\n hatsElectionsEligibilityImplementation: treeParams\\n .hatsElectionsEligibilityImplementation,\\n adminHatId: adminHatId,\\n hats: treeParams.hats,\\n keyValuePairs: treeParams.keyValuePairs\\n })\\n );\\n }\\n\\n /* /////////////////////////////////////////////////////////////////////////////\\n INTERNAL FUNCTIONS\\n ///////////////////////////////////////////////////////////////////////////// */\\n\\n function _processTopHat(\\n IHats hatsProtocol,\\n IERC6551Registry erc6551Registry,\\n address hatsAccountImplementation,\\n address keyValuePairs,\\n TopHatParams calldata topHat\\n ) internal returns (uint256 topHatId, address topHatAccount) {\\n // Call lastTopHatId() and properly decode the response\\n (bool success, bytes memory data) = address(hatsProtocol).call(\\n abi.encodeWithSignature(\\\"lastTopHatId()\\\")\\n );\\n require(success, \\\"Failed to get lastTopHatId\\\");\\n topHatId = (abi.decode(data, (uint256)) + 1) << 224;\\n\\n // Mint Top Hat to the Safe\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"mintTopHat(address,string,string)\\\",\\n msg.sender,\\n topHat.details,\\n topHat.imageURI\\n ),\\n Enum.Operation.Call\\n );\\n\\n // Create Top Hat's ERC6551 Account\\n topHatAccount = erc6551Registry.createAccount(\\n hatsAccountImplementation,\\n SALT,\\n block.chainid,\\n address(hatsProtocol),\\n topHatId\\n );\\n\\n // Declare Top Hat ID to Safe via KeyValuePairs\\n string[] memory keys = new string[](1);\\n string[] memory values = new string[](1);\\n keys[0] = \\\"topHatId\\\";\\n values[0] = Strings.toString(topHatId);\\n IAvatar(msg.sender).execTransactionFromModule(\\n keyValuePairs,\\n 0,\\n abi.encodeWithSignature(\\n \\\"updateValues(string[],string[])\\\",\\n keys,\\n values\\n ),\\n Enum.Operation.Call\\n );\\n }\\n\\n function _processAdminHat(\\n IHats hatsProtocol,\\n IERC6551Registry erc6551Registry,\\n address hatsAccountImplementation,\\n uint256 topHatId,\\n address topHatAccount,\\n ModuleProxyFactory moduleProxyFactory,\\n address decentAutonomousAdminImplementation,\\n AdminHatParams calldata adminHat\\n ) internal returns (uint256 adminHatId) {\\n // Create Admin Hat\\n adminHatId = hatsProtocol.getNextId(topHatId);\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"createHat(uint256,string,uint32,address,address,bool,string)\\\",\\n topHatId,\\n adminHat.details,\\n 1, // only one Admin Hat\\n topHatAccount,\\n topHatAccount,\\n adminHat.isMutable,\\n adminHat.imageURI\\n ),\\n Enum.Operation.Call\\n );\\n\\n // Create Admin Hat's ERC6551 Account\\n erc6551Registry.createAccount(\\n hatsAccountImplementation,\\n SALT,\\n block.chainid,\\n address(hatsProtocol),\\n adminHatId\\n );\\n\\n // Deploy Decent Autonomous Admin Module, which will wear the Admin Hat\\n address autonomousAdmin = moduleProxyFactory.deployModule(\\n decentAutonomousAdminImplementation,\\n abi.encodeWithSignature(\\\"setUp(bytes)\\\", bytes(\\\"\\\")),\\n uint256(\\n keccak256(\\n abi.encodePacked(\\n // for the salt, we'll concatenate our static salt\\n // with the Admin Hat ID\\n SALT,\\n adminHatId\\n )\\n )\\n )\\n );\\n\\n // Mint Hat to the Decent Autonomous Admin Module\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"mintHat(uint256,address)\\\",\\n adminHatId,\\n autonomousAdmin\\n ),\\n Enum.Operation.Call\\n );\\n }\\n}\\n\",\"keccak256\":\"0x5c95f7e83ded3c184dddd6b769791c92a68794eeb49deaccec4422497935c7c2\",\"license\":\"MIT\"},\"contracts/modules/DecentHatsModuleUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.28;\\n\\nimport {Enum} from \\\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\\\";\\nimport {IAvatar} from \\\"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IERC6551Registry} from \\\"../interfaces/IERC6551Registry.sol\\\";\\nimport {IHats} from \\\"../interfaces/hats/IHats.sol\\\";\\nimport {LockupLinear, Broker} from \\\"../interfaces/sablier/types/DataTypes.sol\\\";\\nimport {IHatsModuleFactory} from \\\"../interfaces/hats/IHatsModuleFactory.sol\\\";\\nimport {ISablierV2LockupLinear} from \\\"../interfaces/sablier/ISablierV2LockupLinear.sol\\\";\\nimport {Strings} from \\\"@openzeppelin/contracts/utils/Strings.sol\\\";\\n\\nabstract contract DecentHatsModuleUtils {\\n bytes32 public constant SALT =\\n 0x5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b5072;\\n\\n struct SablierStreamParams {\\n ISablierV2LockupLinear sablier;\\n address sender;\\n address asset;\\n LockupLinear.Timestamps timestamps;\\n Broker broker;\\n uint128 totalAmount;\\n bool cancelable;\\n bool transferable;\\n }\\n\\n struct HatParams {\\n address wearer;\\n string details;\\n string imageURI;\\n SablierStreamParams[] sablierStreamsParams;\\n uint128 termEndDateTs; // If 0, this is an untermed Hat\\n uint32 maxSupply;\\n bool isMutable;\\n }\\n\\n struct CreateRoleHatsParams {\\n IHats hatsProtocol;\\n IERC6551Registry erc6551Registry;\\n address hatsAccountImplementation;\\n uint256 topHatId;\\n address topHatAccount;\\n address keyValuePairs;\\n IHatsModuleFactory hatsModuleFactory;\\n address hatsElectionsEligibilityImplementation;\\n uint256 adminHatId;\\n HatParams[] hats;\\n }\\n\\n function _processRoleHats(\\n CreateRoleHatsParams memory roleHatsParams\\n ) internal {\\n for (uint256 i = 0; i < roleHatsParams.hats.length; ) {\\n HatParams memory hatParams = roleHatsParams.hats[i];\\n\\n // Create eligibility module if needed\\n address eligibilityAddress = _createEligibilityModule(\\n roleHatsParams.hatsProtocol,\\n roleHatsParams.hatsModuleFactory,\\n roleHatsParams.hatsElectionsEligibilityImplementation,\\n roleHatsParams.topHatId,\\n roleHatsParams.topHatAccount,\\n roleHatsParams.adminHatId,\\n hatParams.termEndDateTs\\n );\\n\\n // Create and Mint the Role Hat\\n uint256 hatId = _createAndMintHat(\\n roleHatsParams.hatsProtocol,\\n roleHatsParams.adminHatId,\\n hatParams,\\n eligibilityAddress,\\n roleHatsParams.topHatAccount\\n );\\n\\n // Get the stream recipient (based on termed or not)\\n address streamRecipient = _setupStreamRecipient(\\n roleHatsParams.erc6551Registry,\\n roleHatsParams.hatsAccountImplementation,\\n address(roleHatsParams.hatsProtocol),\\n hatParams.termEndDateTs,\\n hatParams.wearer,\\n hatId\\n );\\n\\n // Create streams\\n _processSablierStreams(\\n hatParams.sablierStreamsParams,\\n streamRecipient,\\n roleHatsParams.keyValuePairs,\\n hatId\\n );\\n\\n unchecked {\\n ++i;\\n }\\n }\\n }\\n\\n function _createEligibilityModule(\\n IHats hatsProtocol,\\n IHatsModuleFactory hatsModuleFactory,\\n address hatsElectionsEligibilityImplementation,\\n uint256 topHatId,\\n address topHatAccount,\\n uint256 adminHatId,\\n uint128 termEndDateTs\\n ) private returns (address) {\\n // If the Hat is termed, create the eligibility module\\n if (termEndDateTs != 0) {\\n return\\n hatsModuleFactory.createHatsModule(\\n hatsElectionsEligibilityImplementation,\\n hatsProtocol.getNextId(adminHatId),\\n abi.encode(topHatId, uint256(0)), // [BALLOT_BOX_ID, ADMIN_HAT_ID]\\n abi.encode(termEndDateTs),\\n uint256(SALT)\\n );\\n }\\n\\n // Otherwise, return the Top Hat account\\n return topHatAccount;\\n }\\n\\n function _createAndMintHat(\\n IHats hatsProtocol,\\n uint256 adminHatId,\\n HatParams memory hat,\\n address eligibilityAddress,\\n address topHatAccount\\n ) private returns (uint256) {\\n // Grab the next Hat ID (before creating it)\\n uint256 hatId = hatsProtocol.getNextId(adminHatId);\\n\\n // Create the new Hat\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"createHat(uint256,string,uint32,address,address,bool,string)\\\",\\n adminHatId,\\n hat.details,\\n hat.maxSupply,\\n eligibilityAddress,\\n topHatAccount,\\n hat.isMutable,\\n hat.imageURI\\n ),\\n Enum.Operation.Call\\n );\\n\\n // If the Hat is termed, nominate the wearer as the eligible member\\n if (hat.termEndDateTs != 0) {\\n address[] memory nominatedWearers = new address[](1);\\n nominatedWearers[0] = hat.wearer;\\n\\n IAvatar(msg.sender).execTransactionFromModule(\\n eligibilityAddress,\\n 0,\\n abi.encodeWithSignature(\\n \\\"elect(uint128,address[])\\\",\\n hat.termEndDateTs,\\n nominatedWearers\\n ),\\n Enum.Operation.Call\\n );\\n }\\n\\n // Mint the Hat\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"mintHat(uint256,address)\\\",\\n hatId,\\n hat.wearer\\n ),\\n Enum.Operation.Call\\n );\\n return hatId;\\n }\\n\\n // Exists to avoid stack too deep errors\\n function _setupStreamRecipient(\\n IERC6551Registry erc6551Registry,\\n address hatsAccountImplementation,\\n address hatsProtocol,\\n uint128 termEndDateTs,\\n address wearer,\\n uint256 hatId\\n ) private returns (address) {\\n // If the hat is termed, the wearer is the stream recipient\\n if (termEndDateTs != 0) {\\n return wearer;\\n }\\n\\n // Otherwise, the Hat's smart account is the stream recipient\\n return\\n erc6551Registry.createAccount(\\n hatsAccountImplementation,\\n SALT,\\n block.chainid,\\n hatsProtocol,\\n hatId\\n );\\n }\\n\\n function _processSablierStreams(\\n SablierStreamParams[] memory streamParams,\\n address streamRecipient,\\n address keyValuePairs,\\n uint256 hatId\\n ) private {\\n for (uint256 i = 0; i < streamParams.length; ) {\\n SablierStreamParams memory sablierStreamParams = streamParams[i];\\n\\n // Approve tokens for Sablier\\n IAvatar(msg.sender).execTransactionFromModule(\\n sablierStreamParams.asset,\\n 0,\\n abi.encodeWithSignature(\\n \\\"approve(address,uint256)\\\",\\n sablierStreamParams.sablier,\\n sablierStreamParams.totalAmount\\n ),\\n Enum.Operation.Call\\n );\\n uint256 streamId = ISablierV2LockupLinear(\\n sablierStreamParams.sablier\\n ).nextStreamId();\\n\\n // Proxy the Sablier call through IAvatar\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(sablierStreamParams.sablier),\\n 0,\\n abi.encodeWithSignature(\\n \\\"createWithTimestamps((address,address,uint128,address,bool,bool,(uint40,uint40,uint40),(address,uint256)))\\\",\\n LockupLinear.CreateWithTimestamps({\\n sender: sablierStreamParams.sender,\\n recipient: streamRecipient,\\n totalAmount: sablierStreamParams.totalAmount,\\n asset: IERC20(sablierStreamParams.asset),\\n cancelable: sablierStreamParams.cancelable,\\n transferable: sablierStreamParams.transferable,\\n timestamps: sablierStreamParams.timestamps,\\n broker: sablierStreamParams.broker\\n })\\n ),\\n Enum.Operation.Call\\n );\\n\\n // Update KeyValuePairs with the stream ID and Hat ID\\n string[] memory keys = new string[](1);\\n string[] memory values = new string[](1);\\n keys[0] = \\\"hatIdToStreamId\\\";\\n values[0] = string(\\n abi.encodePacked(\\n Strings.toString(hatId),\\n \\\":\\\",\\n Strings.toString(streamId)\\n )\\n );\\n\\n IAvatar(msg.sender).execTransactionFromModule(\\n keyValuePairs,\\n 0,\\n abi.encodeWithSignature(\\n \\\"updateValues(string[],string[])\\\",\\n keys,\\n values\\n ),\\n Enum.Operation.Call\\n );\\n\\n unchecked {\\n ++i;\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xcf91d6de2291dd71d2491292ee2d1120c444b8f4f11b8c31429ed4c630013e69\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052348015600f57600080fd5b5061212e8061001f6000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c8063ba9a91a51461003b578063d58041b714610062575b600080fd5b6100506000805160206120d983398151915281565b60405190815260200160405180910390f35b610075610070366004611539565b610077565b005b6000806100cd61008a6020850185611593565b61009a6040860160208701611593565b6100aa60e0870160c08801611593565b6100ba60a0880160808901611593565b6100c86101008901896115c0565b61023d565b909250905060006101396100e46020860186611593565b6100f46040870160208801611593565b61010460e0880160c08901611593565b868661011660808b0160608c01611593565b61012660c08c0160a08d01611593565b6101346101208d018d6115e0565b610619565b604080516101408101909152909150610237908061015a6020880188611593565b6001600160a01b0316815260200186602001602081019061017b9190611593565b6001600160a01b0316815260200161019960e0880160c08901611593565b6001600160a01b03908116825260208201879052851660408201526060016101c760a0880160808901611593565b6001600160a01b031681526020016101e56060880160408901611593565b6001600160a01b03168152602001610204610100880160e08901611593565b6001600160a01b03168152602081018490526040016102276101408801886115f6565b61023091611997565b90526109b5565b50505050565b60408051600481526024810182526020810180516001600160e01b0316633f0f816960e21b17905290516000918291829182916001600160a01b038b169161028491611af9565b6000604051808303816000865af19150503d80600081146102c1576040519150601f19603f3d011682016040523d82523d6000602084013e6102c6565b606091505b50915091508161031c5760405162461bcd60e51b815260206004820152601a60248201527f4661696c656420746f20676574206c617374546f704861744964000000000000604482015260640160405180910390fd5b60e0818060200190518101906103329190611b0b565b61033d906001611b3a565b901b93503363468721a78a6000836103558a80611b53565b61036260208d018d611b53565b604051602401610376959493929190611bc2565b60408051601f198184030181529181526020820180516001600160e01b0316631a64dfad60e01b1790525160e085901b6001600160e01b03191681526103c493929190600090600401611c32565b6020604051808303816000875af11580156103e3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104079190611c88565b50604051638a54c52f60e01b81526001600160a01b03891690638a54c52f9061044a908a906000805160206120d98339815191529046908f908b90600401611ca5565b6020604051808303816000875af1158015610469573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061048d9190611cd8565b60408051600180825281830190925291945060009190816020015b60608152602001906001900390816104a857505060408051600180825281830190925291925060009190602082015b60608152602001906001900390816104d7579050509050604051806040016040528060088152602001671d1bdc12185d125960c21b8152508260008151811061052257610522611cf5565b602002602001018190525061053686610a84565b8160008151811061054957610549611cf5565b6020026020010181905250336001600160a01b031663468721a78960008585604051602401610579929190611d67565b60408051601f198184030181529181526020820180516001600160e01b031663579374b960e11b1790525160e085901b6001600160e01b03191681526105c793929190600090600401611c32565b6020604051808303816000875af11580156105e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061060a9190611c88565b50505050509550959350505050565b60405162460ea360e61b8152600481018690526000906001600160a01b038a1690631183a8c090602401602060405180830381865afa158015610660573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106849190611b0b565b90503363468721a78a60008961069a8780611b53565b60018c806106ae60608d0160408e01611d95565b6106bb60208e018e611b53565b6040516024016106d399989796959493929190611db2565b60408051601f198184030181529181526020820180516001600160e01b0316635829492f60e11b1790525160e085901b6001600160e01b031916815261072193929190600090600401611c32565b6020604051808303816000875af1158015610740573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107649190611c88565b50604051638a54c52f60e01b81526001600160a01b03891690638a54c52f906107a7908a906000805160206120d98339815191529046908f908890600401611ca5565b6020604051808303816000875af11580156107c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ea9190611cd8565b506000846001600160a01b031663f1ab873c856040518060200160405280600081525060405160240161081d9190611e17565b60408051601f19818403018152918152602080830180516001600160e01b031663a4f9edbf60e01b179052905161086f916000805160206120d983398151915291899101918252602082015260400190565b60408051601f198184030181529082905280516020909101206001600160e01b031960e086901b1682526108a7939291600401611e2a565b6020604051808303816000875af11580156108c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108ea9190611cd8565b604051602481018490526001600160a01b0382166044820152909150339063468721a7908c9060009060640160408051601f198184030181529181526020820180516001600160e01b031663320fbbb760e11b1790525160e085901b6001600160e01b031916815261096493929190600090600401611c32565b6020604051808303816000875af1158015610983573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109a79190611c88565b505098975050505050505050565b60005b81610120015151811015610a8057600082610120015182815181106109df576109df611cf5565b602002602001015190506000610a1784600001518560c001518660e00151876060015188608001518961010001518860800151610b8c565b90506000610a35856000015186610100015185858960800151610cf3565b90506000610a5b8660200151876040015188600001518760800151886000015187611025565b9050610a718460600151828860a00151856110cf565b846001019450505050506109b8565b5050565b606081600003610aab5750506040805180820190915260018152600360fc1b602082015290565b8160005b8115610ad55780610abf81611e5e565b9150610ace9050600a83611e8d565b9150610aaf565b6000816001600160401b03811115610aef57610aef611646565b6040519080825280601f01601f191660200182016040528015610b19576020820181803683370190505b5090505b8415610b8457610b2e600183611ea1565b9150610b3b600a86611eb4565b610b46906030611b3a565b60f81b818381518110610b5b57610b5b611cf5565b60200101906001600160f81b031916908160001a905350610b7d600a86611e8d565b9450610b1d565b949350505050565b60006001600160801b03821615610ce557866001600160a01b0316632f7fb7b6878a6001600160a01b0316631183a8c0876040518263ffffffff1660e01b8152600401610bdb91815260200190565b602060405180830381865afa158015610bf8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c1c9190611b0b565b886000604051602001610c39929190918252602082015260400190565b60408051601f198184030181528282526001600160801b0389166020840152910160408051601f19818403018152908290526001600160e01b031960e087901b168252610c9b949392916000805160206120d983398151915290600401611ec8565b6020604051808303816000875af1158015610cba573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cde9190611cd8565b9050610ce8565b50825b979650505050505050565b60405162460ea360e61b81526004810185905260009081906001600160a01b03881690631183a8c090602401602060405180830381865afa158015610d3c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d609190611b0b565b9050336001600160a01b031663468721a78860008989602001518a60a001518a8a8d60c001518e60400151604051602401610da19796959493929190611f14565b60408051601f198184030181529181526020820180516001600160e01b0316635829492f60e11b1790525160e085901b6001600160e01b0319168152610def93929190600090600401611c32565b6020604051808303816000875af1158015610e0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e329190611c88565b5060808501516001600160801b031615610f5d5760408051600180825281830190925260009160208083019080368337019050509050856000015181600081518110610e8057610e80611cf5565b60200260200101906001600160a01b031690816001600160a01b031681525050336001600160a01b031663468721a7866000896080015185604051602401610ec9929190611f78565b60408051601f198184030181529181526020820180516001600160e01b0316634a231cef60e01b1790525160e085901b6001600160e01b0319168152610f1793929190600090600401611c32565b6020604051808303816000875af1158015610f36573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f5a9190611c88565b50505b8451604051602481018390526001600160a01b039091166044820152339063468721a790899060009060640160408051601f198184030181529181526020820180516001600160e01b031663320fbbb760e11b1790525160e085901b6001600160e01b0319168152610fd793929190600090600401611c32565b6020604051808303816000875af1158015610ff6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061101a9190611c88565b509695505050505050565b60006001600160801b0384161561103d5750816110c5565b604051638a54c52f60e01b81526001600160a01b03881690638a54c52f9061107f9089906000805160206120d98339815191529046908b908990600401611ca5565b6020604051808303816000875af115801561109e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110c29190611cd8565b90505b9695505050505050565b60005b84518110156115325760008582815181106110ef576110ef611cf5565b60200260200101519050336001600160a01b031663468721a78260400151600084600001518560a001516040516024016111479291906001600160a01b039290921682526001600160801b0316602082015260400190565b60408051601f198184030181529181526020820180516001600160e01b031663095ea7b360e01b1790525160e085901b6001600160e01b031916815261119593929190600090600401611c32565b6020604051808303816000875af11580156111b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111d89190611c88565b50600081600001516001600160a01b0316631e99d5696040518163ffffffff1660e01b8152600401602060405180830381865afa15801561121d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112419190611b0b565b9050336001600160a01b031663468721a78360000151600060405180610100016040528087602001516001600160a01b031681526020018b6001600160a01b031681526020018760a001516001600160801b0316815260200187604001516001600160a01b031681526020018760c00151151581526020018760e00151151581526020018760600151815260200187608001518152506040516024016112e79190611fcd565b60408051601f198184030181529181526020820180516001600160e01b03166353b1572760e01b1790525160e085901b6001600160e01b031916815261133593929190600090600401611c32565b6020604051808303816000875af1158015611354573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113789190611c88565b50604080516001808252818301909252600091816020015b606081526020019060019003908161139057505060408051600180825281830190925291925060009190602082015b60608152602001906001900390816113bf5790505090506040518060400160405280600f81526020016e1a185d1259151bd4dd1c99585b5259608a1b8152508260008151811061141157611411611cf5565b602002602001018190525061142586610a84565b61142e84610a84565b60405160200161143f92919061209c565b6040516020818303038152906040528160008151811061146157611461611cf5565b6020026020010181905250336001600160a01b031663468721a78860008585604051602401611491929190611d67565b60408051601f198184030181529181526020820180516001600160e01b031663579374b960e11b1790525160e085901b6001600160e01b03191681526114df93929190600090600401611c32565b6020604051808303816000875af11580156114fe573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115229190611c88565b50846001019450505050506110d2565b5050505050565b60006020828403121561154b57600080fd5b81356001600160401b0381111561156157600080fd5b8201610160818503121561157457600080fd5b9392505050565b6001600160a01b038116811461159057600080fd5b50565b6000602082840312156115a557600080fd5b81356115748161157b565b80356115bb8161157b565b919050565b60008235603e198336030181126115d657600080fd5b9190910192915050565b60008235605e198336030181126115d657600080fd5b6000808335601e1984360301811261160d57600080fd5b8301803591506001600160401b0382111561162757600080fd5b6020019150600581901b360382131561163f57600080fd5b9250929050565b634e487b7160e01b600052604160045260246000fd5b60405161010081016001600160401b038111828210171561167f5761167f611646565b60405290565b60405160e081016001600160401b038111828210171561167f5761167f611646565b604051601f8201601f191681016001600160401b03811182821017156116cf576116cf611646565b604052919050565b60006001600160401b038211156116f0576116f0611646565b5060051b60200190565b600082601f83011261170b57600080fd5b81356001600160401b0381111561172457611724611646565b611737601f8201601f19166020016116a7565b81815284602083860101111561174c57600080fd5b816020850160208301376000918101602001919091529392505050565b803564ffffffffff811681146115bb57600080fd5b60006060828403121561179057600080fd5b604051606081016001600160401b03811182821017156117b2576117b2611646565b6040529050806117c183611769565b81526117cf60208401611769565b60208201526117e060408401611769565b60408201525092915050565b6000604082840312156117fe57600080fd5b604080519081016001600160401b038111828210171561182057611820611646565b60405290508082356118318161157b565b8152602092830135920191909152919050565b80356001600160801b03811681146115bb57600080fd5b801515811461159057600080fd5b80356115bb8161185b565b600082601f83011261188557600080fd5b8135611898611893826116d7565b6116a7565b80828252602082019150602061016084028601019250858311156118bb57600080fd5b602085015b838110156119795761016081880312156118d957600080fd5b6118e161165c565b6118ea826115b0565b81526118f8602083016115b0565b6020820152611909604083016115b0565b604082015261191b886060840161177e565b606082015261192d8860c084016117ec565b608082015261193f6101008301611844565b60a08201526119516101208301611869565b60c08201526119636101408301611869565b60e08201528352602090920191610160016118c0565b5095945050505050565b803563ffffffff811681146115bb57600080fd5b60006119a5611893846116d7565b8381526020810190600585901b8401368111156119c157600080fd5b845b81811015611aca5780356001600160401b038111156119e157600080fd5b860160e03682900312156119f457600080fd5b6119fc611685565b611a05826115b0565b815260208201356001600160401b03811115611a2057600080fd5b611a2c368285016116fa565b60208301525060408201356001600160401b03811115611a4b57600080fd5b611a57368285016116fa565b60408301525060608201356001600160401b03811115611a7657600080fd5b611a8236828501611874565b606083015250611a9460808301611844565b6080820152611aa560a08301611983565b60a0820152611ab660c08301611869565b60c0820152855250602093840193016119c3565b509095945050505050565b60005b83811015611af0578181015183820152602001611ad8565b50506000910152565b600082516115d6818460208701611ad5565b600060208284031215611b1d57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b80820180821115611b4d57611b4d611b24565b92915050565b6000808335601e19843603018112611b6a57600080fd5b8301803591506001600160401b03821115611b8457600080fd5b60200191503681900382131561163f57600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b0386168152606060208201819052600090611be79083018688611b99565b8281036040840152611bfa818587611b99565b98975050505050505050565b60008151808452611c1e816020860160208601611ad5565b601f01601f19169290920160200192915050565b60018060a01b0385168152836020820152608060408201526000611c596080830185611c06565b905060028310611c7957634e487b7160e01b600052602160045260246000fd5b82606083015295945050505050565b600060208284031215611c9a57600080fd5b81516115748161185b565b6001600160a01b039586168152602081019490945260408401929092529092166060820152608081019190915260a00190565b600060208284031215611cea57600080fd5b81516115748161157b565b634e487b7160e01b600052603260045260246000fd5b600082825180855260208501945060208160051b8301016020850160005b83811015611d5b57601f19858403018852611d45838351611c06565b6020988901989093509190910190600101611d29565b50909695505050505050565b604081526000611d7a6040830185611d0b565b8281036020840152611d8c8185611d0b565b95945050505050565b600060208284031215611da757600080fd5b81356115748161185b565b89815260e060208201526000611dcc60e083018a8c611b99565b60ff891660408401526001600160a01b0388811660608501528716608084015285151560a084015282810360c0840152611e07818587611b99565b9c9b505050505050505050505050565b6020815260006115746020830184611c06565b6001600160a01b0384168152606060208201819052600090611e4e90830185611c06565b9050826040830152949350505050565b600060018201611e7057611e70611b24565b5060010190565b634e487b7160e01b600052601260045260246000fd5b600082611e9c57611e9c611e77565b500490565b81810381811115611b4d57611b4d611b24565b600082611ec357611ec3611e77565b500690565b60018060a01b038616815284602082015260a060408201526000611eef60a0830186611c06565b8281036060840152611f018186611c06565b9150508260808301529695505050505050565b87815260e060208201526000611f2d60e0830189611c06565b63ffffffff881660408401526001600160a01b0387811660608501528616608084015284151560a084015282810360c0840152611f6a8185611c06565b9a9950505050505050505050565b6000604082016001600160801b03851683526040602084015280845180835260608501915060208601925060005b81811015611d5b5783516001600160a01b0316835260209384019390920191600101611fa6565b81516001600160a01b0390811682526020808401518216908301526040808401516001600160801b03169083015260608084015191821690830152610160820190506080830151612022608084018215159052565b5060a083015161203660a084018215159052565b5060c083015161207560c084018264ffffffffff815116825264ffffffffff602082015116602083015264ffffffffff60408201511660408301525050565b5060e0929092015180516001600160a01b0316610120830152602001516101409091015290565b600083516120ae818460208801611ad5565b601d60f91b90830190815283516120cc816001840160208801611ad5565b0160010194935050505056fe5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b5072a26469706673582212200934c93692d281e9d89ed2e17022e289297dd78e723d3ba32c6645f05d3b8df864736f6c634300081c0033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100365760003560e01c8063ba9a91a51461003b578063d58041b714610062575b600080fd5b6100506000805160206120d983398151915281565b60405190815260200160405180910390f35b610075610070366004611539565b610077565b005b6000806100cd61008a6020850185611593565b61009a6040860160208701611593565b6100aa60e0870160c08801611593565b6100ba60a0880160808901611593565b6100c86101008901896115c0565b61023d565b909250905060006101396100e46020860186611593565b6100f46040870160208801611593565b61010460e0880160c08901611593565b868661011660808b0160608c01611593565b61012660c08c0160a08d01611593565b6101346101208d018d6115e0565b610619565b604080516101408101909152909150610237908061015a6020880188611593565b6001600160a01b0316815260200186602001602081019061017b9190611593565b6001600160a01b0316815260200161019960e0880160c08901611593565b6001600160a01b03908116825260208201879052851660408201526060016101c760a0880160808901611593565b6001600160a01b031681526020016101e56060880160408901611593565b6001600160a01b03168152602001610204610100880160e08901611593565b6001600160a01b03168152602081018490526040016102276101408801886115f6565b61023091611997565b90526109b5565b50505050565b60408051600481526024810182526020810180516001600160e01b0316633f0f816960e21b17905290516000918291829182916001600160a01b038b169161028491611af9565b6000604051808303816000865af19150503d80600081146102c1576040519150601f19603f3d011682016040523d82523d6000602084013e6102c6565b606091505b50915091508161031c5760405162461bcd60e51b815260206004820152601a60248201527f4661696c656420746f20676574206c617374546f704861744964000000000000604482015260640160405180910390fd5b60e0818060200190518101906103329190611b0b565b61033d906001611b3a565b901b93503363468721a78a6000836103558a80611b53565b61036260208d018d611b53565b604051602401610376959493929190611bc2565b60408051601f198184030181529181526020820180516001600160e01b0316631a64dfad60e01b1790525160e085901b6001600160e01b03191681526103c493929190600090600401611c32565b6020604051808303816000875af11580156103e3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104079190611c88565b50604051638a54c52f60e01b81526001600160a01b03891690638a54c52f9061044a908a906000805160206120d98339815191529046908f908b90600401611ca5565b6020604051808303816000875af1158015610469573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061048d9190611cd8565b60408051600180825281830190925291945060009190816020015b60608152602001906001900390816104a857505060408051600180825281830190925291925060009190602082015b60608152602001906001900390816104d7579050509050604051806040016040528060088152602001671d1bdc12185d125960c21b8152508260008151811061052257610522611cf5565b602002602001018190525061053686610a84565b8160008151811061054957610549611cf5565b6020026020010181905250336001600160a01b031663468721a78960008585604051602401610579929190611d67565b60408051601f198184030181529181526020820180516001600160e01b031663579374b960e11b1790525160e085901b6001600160e01b03191681526105c793929190600090600401611c32565b6020604051808303816000875af11580156105e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061060a9190611c88565b50505050509550959350505050565b60405162460ea360e61b8152600481018690526000906001600160a01b038a1690631183a8c090602401602060405180830381865afa158015610660573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106849190611b0b565b90503363468721a78a60008961069a8780611b53565b60018c806106ae60608d0160408e01611d95565b6106bb60208e018e611b53565b6040516024016106d399989796959493929190611db2565b60408051601f198184030181529181526020820180516001600160e01b0316635829492f60e11b1790525160e085901b6001600160e01b031916815261072193929190600090600401611c32565b6020604051808303816000875af1158015610740573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107649190611c88565b50604051638a54c52f60e01b81526001600160a01b03891690638a54c52f906107a7908a906000805160206120d98339815191529046908f908890600401611ca5565b6020604051808303816000875af11580156107c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ea9190611cd8565b506000846001600160a01b031663f1ab873c856040518060200160405280600081525060405160240161081d9190611e17565b60408051601f19818403018152918152602080830180516001600160e01b031663a4f9edbf60e01b179052905161086f916000805160206120d983398151915291899101918252602082015260400190565b60408051601f198184030181529082905280516020909101206001600160e01b031960e086901b1682526108a7939291600401611e2a565b6020604051808303816000875af11580156108c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108ea9190611cd8565b604051602481018490526001600160a01b0382166044820152909150339063468721a7908c9060009060640160408051601f198184030181529181526020820180516001600160e01b031663320fbbb760e11b1790525160e085901b6001600160e01b031916815261096493929190600090600401611c32565b6020604051808303816000875af1158015610983573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109a79190611c88565b505098975050505050505050565b60005b81610120015151811015610a8057600082610120015182815181106109df576109df611cf5565b602002602001015190506000610a1784600001518560c001518660e00151876060015188608001518961010001518860800151610b8c565b90506000610a35856000015186610100015185858960800151610cf3565b90506000610a5b8660200151876040015188600001518760800151886000015187611025565b9050610a718460600151828860a00151856110cf565b846001019450505050506109b8565b5050565b606081600003610aab5750506040805180820190915260018152600360fc1b602082015290565b8160005b8115610ad55780610abf81611e5e565b9150610ace9050600a83611e8d565b9150610aaf565b6000816001600160401b03811115610aef57610aef611646565b6040519080825280601f01601f191660200182016040528015610b19576020820181803683370190505b5090505b8415610b8457610b2e600183611ea1565b9150610b3b600a86611eb4565b610b46906030611b3a565b60f81b818381518110610b5b57610b5b611cf5565b60200101906001600160f81b031916908160001a905350610b7d600a86611e8d565b9450610b1d565b949350505050565b60006001600160801b03821615610ce557866001600160a01b0316632f7fb7b6878a6001600160a01b0316631183a8c0876040518263ffffffff1660e01b8152600401610bdb91815260200190565b602060405180830381865afa158015610bf8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c1c9190611b0b565b886000604051602001610c39929190918252602082015260400190565b60408051601f198184030181528282526001600160801b0389166020840152910160408051601f19818403018152908290526001600160e01b031960e087901b168252610c9b949392916000805160206120d983398151915290600401611ec8565b6020604051808303816000875af1158015610cba573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cde9190611cd8565b9050610ce8565b50825b979650505050505050565b60405162460ea360e61b81526004810185905260009081906001600160a01b03881690631183a8c090602401602060405180830381865afa158015610d3c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d609190611b0b565b9050336001600160a01b031663468721a78860008989602001518a60a001518a8a8d60c001518e60400151604051602401610da19796959493929190611f14565b60408051601f198184030181529181526020820180516001600160e01b0316635829492f60e11b1790525160e085901b6001600160e01b0319168152610def93929190600090600401611c32565b6020604051808303816000875af1158015610e0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e329190611c88565b5060808501516001600160801b031615610f5d5760408051600180825281830190925260009160208083019080368337019050509050856000015181600081518110610e8057610e80611cf5565b60200260200101906001600160a01b031690816001600160a01b031681525050336001600160a01b031663468721a7866000896080015185604051602401610ec9929190611f78565b60408051601f198184030181529181526020820180516001600160e01b0316634a231cef60e01b1790525160e085901b6001600160e01b0319168152610f1793929190600090600401611c32565b6020604051808303816000875af1158015610f36573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f5a9190611c88565b50505b8451604051602481018390526001600160a01b039091166044820152339063468721a790899060009060640160408051601f198184030181529181526020820180516001600160e01b031663320fbbb760e11b1790525160e085901b6001600160e01b0319168152610fd793929190600090600401611c32565b6020604051808303816000875af1158015610ff6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061101a9190611c88565b509695505050505050565b60006001600160801b0384161561103d5750816110c5565b604051638a54c52f60e01b81526001600160a01b03881690638a54c52f9061107f9089906000805160206120d98339815191529046908b908990600401611ca5565b6020604051808303816000875af115801561109e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110c29190611cd8565b90505b9695505050505050565b60005b84518110156115325760008582815181106110ef576110ef611cf5565b60200260200101519050336001600160a01b031663468721a78260400151600084600001518560a001516040516024016111479291906001600160a01b039290921682526001600160801b0316602082015260400190565b60408051601f198184030181529181526020820180516001600160e01b031663095ea7b360e01b1790525160e085901b6001600160e01b031916815261119593929190600090600401611c32565b6020604051808303816000875af11580156111b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111d89190611c88565b50600081600001516001600160a01b0316631e99d5696040518163ffffffff1660e01b8152600401602060405180830381865afa15801561121d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112419190611b0b565b9050336001600160a01b031663468721a78360000151600060405180610100016040528087602001516001600160a01b031681526020018b6001600160a01b031681526020018760a001516001600160801b0316815260200187604001516001600160a01b031681526020018760c00151151581526020018760e00151151581526020018760600151815260200187608001518152506040516024016112e79190611fcd565b60408051601f198184030181529181526020820180516001600160e01b03166353b1572760e01b1790525160e085901b6001600160e01b031916815261133593929190600090600401611c32565b6020604051808303816000875af1158015611354573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113789190611c88565b50604080516001808252818301909252600091816020015b606081526020019060019003908161139057505060408051600180825281830190925291925060009190602082015b60608152602001906001900390816113bf5790505090506040518060400160405280600f81526020016e1a185d1259151bd4dd1c99585b5259608a1b8152508260008151811061141157611411611cf5565b602002602001018190525061142586610a84565b61142e84610a84565b60405160200161143f92919061209c565b6040516020818303038152906040528160008151811061146157611461611cf5565b6020026020010181905250336001600160a01b031663468721a78860008585604051602401611491929190611d67565b60408051601f198184030181529181526020820180516001600160e01b031663579374b960e11b1790525160e085901b6001600160e01b03191681526114df93929190600090600401611c32565b6020604051808303816000875af11580156114fe573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115229190611c88565b50846001019450505050506110d2565b5050505050565b60006020828403121561154b57600080fd5b81356001600160401b0381111561156157600080fd5b8201610160818503121561157457600080fd5b9392505050565b6001600160a01b038116811461159057600080fd5b50565b6000602082840312156115a557600080fd5b81356115748161157b565b80356115bb8161157b565b919050565b60008235603e198336030181126115d657600080fd5b9190910192915050565b60008235605e198336030181126115d657600080fd5b6000808335601e1984360301811261160d57600080fd5b8301803591506001600160401b0382111561162757600080fd5b6020019150600581901b360382131561163f57600080fd5b9250929050565b634e487b7160e01b600052604160045260246000fd5b60405161010081016001600160401b038111828210171561167f5761167f611646565b60405290565b60405160e081016001600160401b038111828210171561167f5761167f611646565b604051601f8201601f191681016001600160401b03811182821017156116cf576116cf611646565b604052919050565b60006001600160401b038211156116f0576116f0611646565b5060051b60200190565b600082601f83011261170b57600080fd5b81356001600160401b0381111561172457611724611646565b611737601f8201601f19166020016116a7565b81815284602083860101111561174c57600080fd5b816020850160208301376000918101602001919091529392505050565b803564ffffffffff811681146115bb57600080fd5b60006060828403121561179057600080fd5b604051606081016001600160401b03811182821017156117b2576117b2611646565b6040529050806117c183611769565b81526117cf60208401611769565b60208201526117e060408401611769565b60408201525092915050565b6000604082840312156117fe57600080fd5b604080519081016001600160401b038111828210171561182057611820611646565b60405290508082356118318161157b565b8152602092830135920191909152919050565b80356001600160801b03811681146115bb57600080fd5b801515811461159057600080fd5b80356115bb8161185b565b600082601f83011261188557600080fd5b8135611898611893826116d7565b6116a7565b80828252602082019150602061016084028601019250858311156118bb57600080fd5b602085015b838110156119795761016081880312156118d957600080fd5b6118e161165c565b6118ea826115b0565b81526118f8602083016115b0565b6020820152611909604083016115b0565b604082015261191b886060840161177e565b606082015261192d8860c084016117ec565b608082015261193f6101008301611844565b60a08201526119516101208301611869565b60c08201526119636101408301611869565b60e08201528352602090920191610160016118c0565b5095945050505050565b803563ffffffff811681146115bb57600080fd5b60006119a5611893846116d7565b8381526020810190600585901b8401368111156119c157600080fd5b845b81811015611aca5780356001600160401b038111156119e157600080fd5b860160e03682900312156119f457600080fd5b6119fc611685565b611a05826115b0565b815260208201356001600160401b03811115611a2057600080fd5b611a2c368285016116fa565b60208301525060408201356001600160401b03811115611a4b57600080fd5b611a57368285016116fa565b60408301525060608201356001600160401b03811115611a7657600080fd5b611a8236828501611874565b606083015250611a9460808301611844565b6080820152611aa560a08301611983565b60a0820152611ab660c08301611869565b60c0820152855250602093840193016119c3565b509095945050505050565b60005b83811015611af0578181015183820152602001611ad8565b50506000910152565b600082516115d6818460208701611ad5565b600060208284031215611b1d57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b80820180821115611b4d57611b4d611b24565b92915050565b6000808335601e19843603018112611b6a57600080fd5b8301803591506001600160401b03821115611b8457600080fd5b60200191503681900382131561163f57600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b0386168152606060208201819052600090611be79083018688611b99565b8281036040840152611bfa818587611b99565b98975050505050505050565b60008151808452611c1e816020860160208601611ad5565b601f01601f19169290920160200192915050565b60018060a01b0385168152836020820152608060408201526000611c596080830185611c06565b905060028310611c7957634e487b7160e01b600052602160045260246000fd5b82606083015295945050505050565b600060208284031215611c9a57600080fd5b81516115748161185b565b6001600160a01b039586168152602081019490945260408401929092529092166060820152608081019190915260a00190565b600060208284031215611cea57600080fd5b81516115748161157b565b634e487b7160e01b600052603260045260246000fd5b600082825180855260208501945060208160051b8301016020850160005b83811015611d5b57601f19858403018852611d45838351611c06565b6020988901989093509190910190600101611d29565b50909695505050505050565b604081526000611d7a6040830185611d0b565b8281036020840152611d8c8185611d0b565b95945050505050565b600060208284031215611da757600080fd5b81356115748161185b565b89815260e060208201526000611dcc60e083018a8c611b99565b60ff891660408401526001600160a01b0388811660608501528716608084015285151560a084015282810360c0840152611e07818587611b99565b9c9b505050505050505050505050565b6020815260006115746020830184611c06565b6001600160a01b0384168152606060208201819052600090611e4e90830185611c06565b9050826040830152949350505050565b600060018201611e7057611e70611b24565b5060010190565b634e487b7160e01b600052601260045260246000fd5b600082611e9c57611e9c611e77565b500490565b81810381811115611b4d57611b4d611b24565b600082611ec357611ec3611e77565b500690565b60018060a01b038616815284602082015260a060408201526000611eef60a0830186611c06565b8281036060840152611f018186611c06565b9150508260808301529695505050505050565b87815260e060208201526000611f2d60e0830189611c06565b63ffffffff881660408401526001600160a01b0387811660608501528616608084015284151560a084015282810360c0840152611f6a8185611c06565b9a9950505050505050505050565b6000604082016001600160801b03851683526040602084015280845180835260608501915060208601925060005b81811015611d5b5783516001600160a01b0316835260209384019390920191600101611fa6565b81516001600160a01b0390811682526020808401518216908301526040808401516001600160801b03169083015260608084015191821690830152610160820190506080830151612022608084018215159052565b5060a083015161203660a084018215159052565b5060c083015161207560c084018264ffffffffff815116825264ffffffffff602082015116602083015264ffffffffff60408201511660408301525050565b5060e0929092015180516001600160a01b0316610120830152602001516101409091015290565b600083516120ae818460208801611ad5565b601d60f91b90830190815283516120cc816001840160208801611ad5565b0160010194935050505056fe5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b5072a26469706673582212200934c93692d281e9d89ed2e17022e289297dd78e723d3ba32c6645f05d3b8df864736f6c634300081c0033", "devdoc": { "kind": "dev", "methods": { diff --git a/deployments/base/DecentHatsModificationModule.json b/deployments/base/DecentHatsModificationModule.json index 5b808f3..0dc4e8c 100644 --- a/deployments/base/DecentHatsModificationModule.json +++ b/deployments/base/DecentHatsModificationModule.json @@ -1,5 +1,5 @@ { - "address": "0x3F852ac21185E62F322F8d0Ca680b06c077280D5", + "address": "0x3D3E9F0d3576a520b12A54e6e79BA2314Fe9ce71", "abi": [ { "inputs": [], @@ -43,6 +43,11 @@ "name": "topHatAccount", "type": "address" }, + { + "internalType": "address", + "name": "keyValuePairs", + "type": "address" + }, { "internalType": "contract IHatsModuleFactory", "name": "hatsModuleFactory", @@ -183,32 +188,32 @@ "type": "function" } ], - "transactionHash": "0x369d72a844e310e7095a4a59fbc00e376b99487cff2f6dd5cac9983c0e7be274", + "transactionHash": "0x6411cdf1db7e67eb4fcd87ddccb81ab67e55717752d4185db7cb77b3b4667c62", "receipt": { "to": null, "from": "0xb5Ca125166C1987A35EDD550E16846Fa1e1D9bB3", - "contractAddress": "0x3F852ac21185E62F322F8d0Ca680b06c077280D5", - "transactionIndex": 129, - "gasUsed": "1061522", + "contractAddress": "0x3D3E9F0d3576a520b12A54e6e79BA2314Fe9ce71", + "transactionIndex": 92, + "gasUsed": "1316194", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x53eabf84590d566b2f1f1706b513e536db86a938e7037bc7e7eb79bc0163b21c", - "transactionHash": "0x369d72a844e310e7095a4a59fbc00e376b99487cff2f6dd5cac9983c0e7be274", + "blockHash": "0x8bf5bebd91611d3abd9f3ddd93f429173d13dc65c47ce49278d13c52986f720a", + "transactionHash": "0x6411cdf1db7e67eb4fcd87ddccb81ab67e55717752d4185db7cb77b3b4667c62", "logs": [], - "blockNumber": 22022654, - "cumulativeGasUsed": "21754563", + "blockNumber": 22747343, + "cumulativeGasUsed": "14895601", "status": 1, "byzantium": true }, "args": [], - "numDeployments": 1, - "solcInputHash": "e3ec7808efccf5e6b24e16a29ead3983", - "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"SALT\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"contract IHats\",\"name\":\"hatsProtocol\",\"type\":\"address\"},{\"internalType\":\"contract IERC6551Registry\",\"name\":\"erc6551Registry\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"hatsAccountImplementation\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"topHatId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"topHatAccount\",\"type\":\"address\"},{\"internalType\":\"contract IHatsModuleFactory\",\"name\":\"hatsModuleFactory\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"hatsElectionsEligibilityImplementation\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"adminHatId\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"wearer\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"details\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"imageURI\",\"type\":\"string\"},{\"components\":[{\"internalType\":\"contract ISablierV2LockupLinear\",\"name\":\"sablier\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint40\",\"name\":\"start\",\"type\":\"uint40\"},{\"internalType\":\"uint40\",\"name\":\"cliff\",\"type\":\"uint40\"},{\"internalType\":\"uint40\",\"name\":\"end\",\"type\":\"uint40\"}],\"internalType\":\"struct LockupLinear.Timestamps\",\"name\":\"timestamps\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"UD60x18\",\"name\":\"fee\",\"type\":\"uint256\"}],\"internalType\":\"struct Broker\",\"name\":\"broker\",\"type\":\"tuple\"},{\"internalType\":\"uint128\",\"name\":\"totalAmount\",\"type\":\"uint128\"},{\"internalType\":\"bool\",\"name\":\"cancelable\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"transferable\",\"type\":\"bool\"}],\"internalType\":\"struct DecentHatsModuleUtils.SablierStreamParams[]\",\"name\":\"sablierStreamsParams\",\"type\":\"tuple[]\"},{\"internalType\":\"uint128\",\"name\":\"termEndDateTs\",\"type\":\"uint128\"},{\"internalType\":\"uint32\",\"name\":\"maxSupply\",\"type\":\"uint32\"},{\"internalType\":\"bool\",\"name\":\"isMutable\",\"type\":\"bool\"}],\"internalType\":\"struct DecentHatsModuleUtils.HatParams[]\",\"name\":\"hats\",\"type\":\"tuple[]\"}],\"internalType\":\"struct DecentHatsModuleUtils.CreateRoleHatsParams\",\"name\":\"roleHatsParams\",\"type\":\"tuple\"}],\"name\":\"createRoleHats\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"createRoleHats((address,address,address,uint256,address,address,address,uint256,(address,string,string,(address,address,address,(uint40,uint40,uint40),(address,uint256),uint128,bool,bool)[],uint128,uint32,bool)[]))\":{\"details\":\"Stream funds on untermed Roles are targeted at the hat's smart account. In order to withdraw funds from the stream, the hat's smart account must be the one call to `withdraw-` on the Sablier contract, setting the recipient arg to its wearer.Stream funds on termed Roles are targeted directly at the nominated wearer. The wearer should directly call `withdraw-` on the Sablier contract.Role hat creation, minting, smart account creation and stream creation are handled here in order to avoid a race condition where not more than one active proposal to create a new role can exist at a time. See: https://github.com/decentdao/decent-interface/issues/2402\",\"params\":{\"roleHatsParams\":\"An array of params for each role hat to be created.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"createRoleHats((address,address,address,uint256,address,address,address,uint256,(address,string,string,(address,address,address,(uint40,uint40,uint40),(address,uint256),uint128,bool,bool)[],uint128,uint32,bool)[]))\":{\"notice\":\"Creates a new termed or untermed role hat and any streams on it.This contract should be enabled a module on the Safe for which the role is to be created, and disabled after.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/modules/DecentHatsModificationModule.sol\":\"DecentHatsModificationModule\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\npragma solidity >=0.7.0 <0.9.0;\\n\\n/// @title Enum - Collection of enums\\n/// @author Richard Meissner - \\ncontract Enum {\\n enum Operation {Call, DelegateCall}\\n}\\n\",\"keccak256\":\"0x473e45b1a5cc47be494b0e123c9127f0c11c1e0992a321ae5a644c0bfdb2c14f\",\"license\":\"LGPL-3.0-only\"},\"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\n\\n/// @title Zodiac Avatar - A contract that manages modules that can execute transactions via this contract.\\npragma solidity >=0.7.0 <0.9.0;\\n\\nimport \\\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\\\";\\n\\ninterface IAvatar {\\n event EnabledModule(address module);\\n event DisabledModule(address module);\\n event ExecutionFromModuleSuccess(address indexed module);\\n event ExecutionFromModuleFailure(address indexed module);\\n\\n /// @dev Enables a module on the avatar.\\n /// @notice Can only be called by the avatar.\\n /// @notice Modules should be stored as a linked list.\\n /// @notice Must emit EnabledModule(address module) if successful.\\n /// @param module Module to be enabled.\\n function enableModule(address module) external;\\n\\n /// @dev Disables a module on the avatar.\\n /// @notice Can only be called by the avatar.\\n /// @notice Must emit DisabledModule(address module) if successful.\\n /// @param prevModule Address that pointed to the module to be removed in the linked list\\n /// @param module Module to be removed.\\n function disableModule(address prevModule, address module) external;\\n\\n /// @dev Allows a Module to execute a transaction.\\n /// @notice Can only be called by an enabled module.\\n /// @notice Must emit ExecutionFromModuleSuccess(address module) if successful.\\n /// @notice Must emit ExecutionFromModuleFailure(address module) if unsuccessful.\\n /// @param to Destination address of module transaction.\\n /// @param value Ether value of module transaction.\\n /// @param data Data payload of module transaction.\\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\\n function execTransactionFromModule(\\n address to,\\n uint256 value,\\n bytes memory data,\\n Enum.Operation operation\\n ) external returns (bool success);\\n\\n /// @dev Allows a Module to execute a transaction and return data\\n /// @notice Can only be called by an enabled module.\\n /// @notice Must emit ExecutionFromModuleSuccess(address module) if successful.\\n /// @notice Must emit ExecutionFromModuleFailure(address module) if unsuccessful.\\n /// @param to Destination address of module transaction.\\n /// @param value Ether value of module transaction.\\n /// @param data Data payload of module transaction.\\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\\n function execTransactionFromModuleReturnData(\\n address to,\\n uint256 value,\\n bytes memory data,\\n Enum.Operation operation\\n ) external returns (bool success, bytes memory returnData);\\n\\n /// @dev Returns if an module is enabled\\n /// @return True if the module is enabled\\n function isModuleEnabled(address module) external view returns (bool);\\n\\n /// @dev Returns array of modules.\\n /// @param start Start of the page.\\n /// @param pageSize Maximum number of modules that should be returned.\\n /// @return array Array of modules.\\n /// @return next Start of the next page.\\n function getModulesPaginated(address start, uint256 pageSize)\\n external\\n view\\n returns (address[] memory array, address next);\\n}\\n\",\"keccak256\":\"0xcd5508ffe596eef8fbccfd5fc4f10a34397773547ce64e212d48b5212865ec1f\",\"license\":\"LGPL-3.0-only\"},\"@openzeppelin/contracts/interfaces/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/introspection/IERC165.sol\\\";\\n\",\"keccak256\":\"0xd04b0f06e0666f29cf7cccc82894de541e19bb30a765b107b1e40bb7fe5f7d7a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev 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 amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `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 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes calldata data\\n ) external;\\n\\n /**\\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 {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the caller.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool _approved) external;\\n\\n /**\\n * @dev Returns 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\",\"keccak256\":\"0xed6a749c5373af398105ce6ee3ac4763aa450ea7285d268c85d9eeca809cdb1f\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../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\",\"keccak256\":\"0x75b829ff2f26c14355d1cba20e16fe7b29ca58eb5fef665ede48bc0f9c6c74b9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"@prb/math/src/Common.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\n// Common.sol\\n//\\n// Common mathematical functions used in both SD59x18 and UD60x18. Note that these global functions do not\\n// always operate with SD59x18 and UD60x18 numbers.\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CUSTOM ERRORS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @notice Thrown when the resultant value in {mulDiv} overflows uint256.\\nerror PRBMath_MulDiv_Overflow(uint256 x, uint256 y, uint256 denominator);\\n\\n/// @notice Thrown when the resultant value in {mulDiv18} overflows uint256.\\nerror PRBMath_MulDiv18_Overflow(uint256 x, uint256 y);\\n\\n/// @notice Thrown when one of the inputs passed to {mulDivSigned} is `type(int256).min`.\\nerror PRBMath_MulDivSigned_InputTooSmall();\\n\\n/// @notice Thrown when the resultant value in {mulDivSigned} overflows int256.\\nerror PRBMath_MulDivSigned_Overflow(int256 x, int256 y);\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CONSTANTS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @dev The maximum value a uint128 number can have.\\nuint128 constant MAX_UINT128 = type(uint128).max;\\n\\n/// @dev The maximum value a uint40 number can have.\\nuint40 constant MAX_UINT40 = type(uint40).max;\\n\\n/// @dev The unit number, which the decimal precision of the fixed-point types.\\nuint256 constant UNIT = 1e18;\\n\\n/// @dev The unit number inverted mod 2^256.\\nuint256 constant UNIT_INVERSE = 78156646155174841979727994598816262306175212592076161876661_508869554232690281;\\n\\n/// @dev The the largest power of two that divides the decimal value of `UNIT`. The logarithm of this value is the least significant\\n/// bit in the binary representation of `UNIT`.\\nuint256 constant UNIT_LPOTD = 262144;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @notice Calculates the binary exponent of x using the binary fraction method.\\n/// @dev Has to use 192.64-bit fixed-point numbers. See https://ethereum.stackexchange.com/a/96594/24693.\\n/// @param x The exponent as an unsigned 192.64-bit fixed-point number.\\n/// @return result The result as an unsigned 60.18-decimal fixed-point number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp2(uint256 x) pure returns (uint256 result) {\\n unchecked {\\n // Start from 0.5 in the 192.64-bit fixed-point format.\\n result = 0x800000000000000000000000000000000000000000000000;\\n\\n // The following logic multiplies the result by $\\\\sqrt{2^{-i}}$ when the bit at position i is 1. Key points:\\n //\\n // 1. Intermediate results will not overflow, as the starting point is 2^191 and all magic factors are under 2^65.\\n // 2. The rationale for organizing the if statements into groups of 8 is gas savings. If the result of performing\\n // a bitwise AND operation between x and any value in the array [0x80; 0x40; 0x20; 0x10; 0x08; 0x04; 0x02; 0x01] is 1,\\n // we know that `x & 0xFF` is also 1.\\n if (x & 0xFF00000000000000 > 0) {\\n if (x & 0x8000000000000000 > 0) {\\n result = (result * 0x16A09E667F3BCC909) >> 64;\\n }\\n if (x & 0x4000000000000000 > 0) {\\n result = (result * 0x1306FE0A31B7152DF) >> 64;\\n }\\n if (x & 0x2000000000000000 > 0) {\\n result = (result * 0x1172B83C7D517ADCE) >> 64;\\n }\\n if (x & 0x1000000000000000 > 0) {\\n result = (result * 0x10B5586CF9890F62A) >> 64;\\n }\\n if (x & 0x800000000000000 > 0) {\\n result = (result * 0x1059B0D31585743AE) >> 64;\\n }\\n if (x & 0x400000000000000 > 0) {\\n result = (result * 0x102C9A3E778060EE7) >> 64;\\n }\\n if (x & 0x200000000000000 > 0) {\\n result = (result * 0x10163DA9FB33356D8) >> 64;\\n }\\n if (x & 0x100000000000000 > 0) {\\n result = (result * 0x100B1AFA5ABCBED61) >> 64;\\n }\\n }\\n\\n if (x & 0xFF000000000000 > 0) {\\n if (x & 0x80000000000000 > 0) {\\n result = (result * 0x10058C86DA1C09EA2) >> 64;\\n }\\n if (x & 0x40000000000000 > 0) {\\n result = (result * 0x1002C605E2E8CEC50) >> 64;\\n }\\n if (x & 0x20000000000000 > 0) {\\n result = (result * 0x100162F3904051FA1) >> 64;\\n }\\n if (x & 0x10000000000000 > 0) {\\n result = (result * 0x1000B175EFFDC76BA) >> 64;\\n }\\n if (x & 0x8000000000000 > 0) {\\n result = (result * 0x100058BA01FB9F96D) >> 64;\\n }\\n if (x & 0x4000000000000 > 0) {\\n result = (result * 0x10002C5CC37DA9492) >> 64;\\n }\\n if (x & 0x2000000000000 > 0) {\\n result = (result * 0x1000162E525EE0547) >> 64;\\n }\\n if (x & 0x1000000000000 > 0) {\\n result = (result * 0x10000B17255775C04) >> 64;\\n }\\n }\\n\\n if (x & 0xFF0000000000 > 0) {\\n if (x & 0x800000000000 > 0) {\\n result = (result * 0x1000058B91B5BC9AE) >> 64;\\n }\\n if (x & 0x400000000000 > 0) {\\n result = (result * 0x100002C5C89D5EC6D) >> 64;\\n }\\n if (x & 0x200000000000 > 0) {\\n result = (result * 0x10000162E43F4F831) >> 64;\\n }\\n if (x & 0x100000000000 > 0) {\\n result = (result * 0x100000B1721BCFC9A) >> 64;\\n }\\n if (x & 0x80000000000 > 0) {\\n result = (result * 0x10000058B90CF1E6E) >> 64;\\n }\\n if (x & 0x40000000000 > 0) {\\n result = (result * 0x1000002C5C863B73F) >> 64;\\n }\\n if (x & 0x20000000000 > 0) {\\n result = (result * 0x100000162E430E5A2) >> 64;\\n }\\n if (x & 0x10000000000 > 0) {\\n result = (result * 0x1000000B172183551) >> 64;\\n }\\n }\\n\\n if (x & 0xFF00000000 > 0) {\\n if (x & 0x8000000000 > 0) {\\n result = (result * 0x100000058B90C0B49) >> 64;\\n }\\n if (x & 0x4000000000 > 0) {\\n result = (result * 0x10000002C5C8601CC) >> 64;\\n }\\n if (x & 0x2000000000 > 0) {\\n result = (result * 0x1000000162E42FFF0) >> 64;\\n }\\n if (x & 0x1000000000 > 0) {\\n result = (result * 0x10000000B17217FBB) >> 64;\\n }\\n if (x & 0x800000000 > 0) {\\n result = (result * 0x1000000058B90BFCE) >> 64;\\n }\\n if (x & 0x400000000 > 0) {\\n result = (result * 0x100000002C5C85FE3) >> 64;\\n }\\n if (x & 0x200000000 > 0) {\\n result = (result * 0x10000000162E42FF1) >> 64;\\n }\\n if (x & 0x100000000 > 0) {\\n result = (result * 0x100000000B17217F8) >> 64;\\n }\\n }\\n\\n if (x & 0xFF000000 > 0) {\\n if (x & 0x80000000 > 0) {\\n result = (result * 0x10000000058B90BFC) >> 64;\\n }\\n if (x & 0x40000000 > 0) {\\n result = (result * 0x1000000002C5C85FE) >> 64;\\n }\\n if (x & 0x20000000 > 0) {\\n result = (result * 0x100000000162E42FF) >> 64;\\n }\\n if (x & 0x10000000 > 0) {\\n result = (result * 0x1000000000B17217F) >> 64;\\n }\\n if (x & 0x8000000 > 0) {\\n result = (result * 0x100000000058B90C0) >> 64;\\n }\\n if (x & 0x4000000 > 0) {\\n result = (result * 0x10000000002C5C860) >> 64;\\n }\\n if (x & 0x2000000 > 0) {\\n result = (result * 0x1000000000162E430) >> 64;\\n }\\n if (x & 0x1000000 > 0) {\\n result = (result * 0x10000000000B17218) >> 64;\\n }\\n }\\n\\n if (x & 0xFF0000 > 0) {\\n if (x & 0x800000 > 0) {\\n result = (result * 0x1000000000058B90C) >> 64;\\n }\\n if (x & 0x400000 > 0) {\\n result = (result * 0x100000000002C5C86) >> 64;\\n }\\n if (x & 0x200000 > 0) {\\n result = (result * 0x10000000000162E43) >> 64;\\n }\\n if (x & 0x100000 > 0) {\\n result = (result * 0x100000000000B1721) >> 64;\\n }\\n if (x & 0x80000 > 0) {\\n result = (result * 0x10000000000058B91) >> 64;\\n }\\n if (x & 0x40000 > 0) {\\n result = (result * 0x1000000000002C5C8) >> 64;\\n }\\n if (x & 0x20000 > 0) {\\n result = (result * 0x100000000000162E4) >> 64;\\n }\\n if (x & 0x10000 > 0) {\\n result = (result * 0x1000000000000B172) >> 64;\\n }\\n }\\n\\n if (x & 0xFF00 > 0) {\\n if (x & 0x8000 > 0) {\\n result = (result * 0x100000000000058B9) >> 64;\\n }\\n if (x & 0x4000 > 0) {\\n result = (result * 0x10000000000002C5D) >> 64;\\n }\\n if (x & 0x2000 > 0) {\\n result = (result * 0x1000000000000162E) >> 64;\\n }\\n if (x & 0x1000 > 0) {\\n result = (result * 0x10000000000000B17) >> 64;\\n }\\n if (x & 0x800 > 0) {\\n result = (result * 0x1000000000000058C) >> 64;\\n }\\n if (x & 0x400 > 0) {\\n result = (result * 0x100000000000002C6) >> 64;\\n }\\n if (x & 0x200 > 0) {\\n result = (result * 0x10000000000000163) >> 64;\\n }\\n if (x & 0x100 > 0) {\\n result = (result * 0x100000000000000B1) >> 64;\\n }\\n }\\n\\n if (x & 0xFF > 0) {\\n if (x & 0x80 > 0) {\\n result = (result * 0x10000000000000059) >> 64;\\n }\\n if (x & 0x40 > 0) {\\n result = (result * 0x1000000000000002C) >> 64;\\n }\\n if (x & 0x20 > 0) {\\n result = (result * 0x10000000000000016) >> 64;\\n }\\n if (x & 0x10 > 0) {\\n result = (result * 0x1000000000000000B) >> 64;\\n }\\n if (x & 0x8 > 0) {\\n result = (result * 0x10000000000000006) >> 64;\\n }\\n if (x & 0x4 > 0) {\\n result = (result * 0x10000000000000003) >> 64;\\n }\\n if (x & 0x2 > 0) {\\n result = (result * 0x10000000000000001) >> 64;\\n }\\n if (x & 0x1 > 0) {\\n result = (result * 0x10000000000000001) >> 64;\\n }\\n }\\n\\n // In the code snippet below, two operations are executed simultaneously:\\n //\\n // 1. The result is multiplied by $(2^n + 1)$, where $2^n$ represents the integer part, and the additional 1\\n // accounts for the initial guess of 0.5. This is achieved by subtracting from 191 instead of 192.\\n // 2. The result is then converted to an unsigned 60.18-decimal fixed-point format.\\n //\\n // The underlying logic is based on the relationship $2^{191-ip} = 2^{ip} / 2^{191}$, where $ip$ denotes the,\\n // integer part, $2^n$.\\n result *= UNIT;\\n result >>= (191 - (x >> 64));\\n }\\n}\\n\\n/// @notice Finds the zero-based index of the first 1 in the binary representation of x.\\n///\\n/// @dev See the note on \\\"msb\\\" in this Wikipedia article: https://en.wikipedia.org/wiki/Find_first_set\\n///\\n/// Each step in this implementation is equivalent to this high-level code:\\n///\\n/// ```solidity\\n/// if (x >= 2 ** 128) {\\n/// x >>= 128;\\n/// result += 128;\\n/// }\\n/// ```\\n///\\n/// Where 128 is replaced with each respective power of two factor. See the full high-level implementation here:\\n/// https://gist.github.com/PaulRBerg/f932f8693f2733e30c4d479e8e980948\\n///\\n/// The Yul instructions used below are:\\n///\\n/// - \\\"gt\\\" is \\\"greater than\\\"\\n/// - \\\"or\\\" is the OR bitwise operator\\n/// - \\\"shl\\\" is \\\"shift left\\\"\\n/// - \\\"shr\\\" is \\\"shift right\\\"\\n///\\n/// @param x The uint256 number for which to find the index of the most significant bit.\\n/// @return result The index of the most significant bit as a uint256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction msb(uint256 x) pure returns (uint256 result) {\\n // 2^128\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(7, gt(x, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^64\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(6, gt(x, 0xFFFFFFFFFFFFFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^32\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(5, gt(x, 0xFFFFFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^16\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(4, gt(x, 0xFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^8\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(3, gt(x, 0xFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^4\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(2, gt(x, 0xF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^2\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(1, gt(x, 0x3))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^1\\n // No need to shift x any more.\\n assembly (\\\"memory-safe\\\") {\\n let factor := gt(x, 0x1)\\n result := or(result, factor)\\n }\\n}\\n\\n/// @notice Calculates x*y\\u00f7denominator with 512-bit precision.\\n///\\n/// @dev Credits to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv.\\n///\\n/// Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - The denominator must not be zero.\\n/// - The result must fit in uint256.\\n///\\n/// @param x The multiplicand as a uint256.\\n/// @param y The multiplier as a uint256.\\n/// @param denominator The divisor as a uint256.\\n/// @return result The result as a uint256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mulDiv(uint256 x, uint256 y, uint256 denominator) pure returns (uint256 result) {\\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; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly (\\\"memory-safe\\\") {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\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 unchecked {\\n return prod0 / denominator;\\n }\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n if (prod1 >= denominator) {\\n revert PRBMath_MulDiv_Overflow(x, y, denominator);\\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 (\\\"memory-safe\\\") {\\n // Compute remainder using the mulmod Yul instruction.\\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 unchecked {\\n // Calculate the largest power of two divisor of the denominator using the unary operator ~. This operation cannot overflow\\n // because the denominator cannot be zero at this point in the function execution. The result is always >= 1.\\n // For more detail, see https://cs.stackexchange.com/q/138556/92363.\\n uint256 lpotdod = denominator & (~denominator + 1);\\n uint256 flippedLpotdod;\\n\\n assembly (\\\"memory-safe\\\") {\\n // Factor powers of two out of denominator.\\n denominator := div(denominator, lpotdod)\\n\\n // Divide [prod1 prod0] by lpotdod.\\n prod0 := div(prod0, lpotdod)\\n\\n // Get the flipped value `2^256 / lpotdod`. If the `lpotdod` is zero, the flipped value is one.\\n // `sub(0, lpotdod)` produces the two's complement version of `lpotdod`, which is equivalent to flipping all the bits.\\n // However, `div` interprets this value as an unsigned value: https://ethereum.stackexchange.com/q/147168/24693\\n flippedLpotdod := add(div(sub(0, lpotdod), lpotdod), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * flippedLpotdod;\\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 works\\n // 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 }\\n}\\n\\n/// @notice Calculates x*y\\u00f71e18 with 512-bit precision.\\n///\\n/// @dev A variant of {mulDiv} with constant folding, i.e. in which the denominator is hard coded to 1e18.\\n///\\n/// Notes:\\n/// - The body is purposely left uncommented; to understand how this works, see the documentation in {mulDiv}.\\n/// - The result is rounded toward zero.\\n/// - We take as an axiom that the result cannot be `MAX_UINT256` when x and y solve the following system of equations:\\n///\\n/// $$\\n/// \\\\begin{cases}\\n/// x * y = MAX\\\\_UINT256 * UNIT \\\\\\\\\\n/// (x * y) \\\\% UNIT \\\\geq \\\\frac{UNIT}{2}\\n/// \\\\end{cases}\\n/// $$\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {mulDiv}.\\n/// - The result must fit in uint256.\\n///\\n/// @param x The multiplicand as an unsigned 60.18-decimal fixed-point number.\\n/// @param y The multiplier as an unsigned 60.18-decimal fixed-point number.\\n/// @return result The result as an unsigned 60.18-decimal fixed-point number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mulDiv18(uint256 x, uint256 y) pure returns (uint256 result) {\\n uint256 prod0;\\n uint256 prod1;\\n assembly (\\\"memory-safe\\\") {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n if (prod1 == 0) {\\n unchecked {\\n return prod0 / UNIT;\\n }\\n }\\n\\n if (prod1 >= UNIT) {\\n revert PRBMath_MulDiv18_Overflow(x, y);\\n }\\n\\n uint256 remainder;\\n assembly (\\\"memory-safe\\\") {\\n remainder := mulmod(x, y, UNIT)\\n result :=\\n mul(\\n or(\\n div(sub(prod0, remainder), UNIT_LPOTD),\\n mul(sub(prod1, gt(remainder, prod0)), add(div(sub(0, UNIT_LPOTD), UNIT_LPOTD), 1))\\n ),\\n UNIT_INVERSE\\n )\\n }\\n}\\n\\n/// @notice Calculates x*y\\u00f7denominator with 512-bit precision.\\n///\\n/// @dev This is an extension of {mulDiv} for signed numbers, which works by computing the signs and the absolute values separately.\\n///\\n/// Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {mulDiv}.\\n/// - None of the inputs can be `type(int256).min`.\\n/// - The result must fit in int256.\\n///\\n/// @param x The multiplicand as an int256.\\n/// @param y The multiplier as an int256.\\n/// @param denominator The divisor as an int256.\\n/// @return result The result as an int256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mulDivSigned(int256 x, int256 y, int256 denominator) pure returns (int256 result) {\\n if (x == type(int256).min || y == type(int256).min || denominator == type(int256).min) {\\n revert PRBMath_MulDivSigned_InputTooSmall();\\n }\\n\\n // Get hold of the absolute values of x, y and the denominator.\\n uint256 xAbs;\\n uint256 yAbs;\\n uint256 dAbs;\\n unchecked {\\n xAbs = x < 0 ? uint256(-x) : uint256(x);\\n yAbs = y < 0 ? uint256(-y) : uint256(y);\\n dAbs = denominator < 0 ? uint256(-denominator) : uint256(denominator);\\n }\\n\\n // Compute the absolute value of x*y\\u00f7denominator. The result must fit in int256.\\n uint256 resultAbs = mulDiv(xAbs, yAbs, dAbs);\\n if (resultAbs > uint256(type(int256).max)) {\\n revert PRBMath_MulDivSigned_Overflow(x, y);\\n }\\n\\n // Get the signs of x, y and the denominator.\\n uint256 sx;\\n uint256 sy;\\n uint256 sd;\\n assembly (\\\"memory-safe\\\") {\\n // \\\"sgt\\\" is the \\\"signed greater than\\\" assembly instruction and \\\"sub(0,1)\\\" is -1 in two's complement.\\n sx := sgt(x, sub(0, 1))\\n sy := sgt(y, sub(0, 1))\\n sd := sgt(denominator, sub(0, 1))\\n }\\n\\n // XOR over sx, sy and sd. What this does is to check whether there are 1 or 3 negative signs in the inputs.\\n // If there are, the result should be negative. Otherwise, it should be positive.\\n unchecked {\\n result = sx ^ sy ^ sd == 0 ? -int256(resultAbs) : int256(resultAbs);\\n }\\n}\\n\\n/// @notice Calculates the square root of x using the Babylonian method.\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\\n///\\n/// Notes:\\n/// - If x is not a perfect square, the result is rounded down.\\n/// - Credits to OpenZeppelin for the explanations in comments below.\\n///\\n/// @param x The uint256 number for which to calculate the square root.\\n/// @return result The result as a uint256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction sqrt(uint256 x) pure returns (uint256 result) {\\n if (x == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we calculate the biggest power of 2 which is smaller than the square root of x.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of x is a power of 2 such that we have:\\n //\\n // $$\\n // msb(x) <= x <= 2*msb(x)$\\n // $$\\n //\\n // We write $msb(x)$ as $2^k$, and we get:\\n //\\n // $$\\n // k = log_2(x)\\n // $$\\n //\\n // Thus, we can write the initial inequality as:\\n //\\n // $$\\n // 2^{log_2(x)} <= x <= 2*2^{log_2(x)+1} \\\\\\\\\\n // sqrt(2^k) <= sqrt(x) < sqrt(2^{k+1}) \\\\\\\\\\n // 2^{k/2} <= sqrt(x) < 2^{(k+1)/2} <= 2^{(k/2)+1}\\n // $$\\n //\\n // Consequently, $2^{log_2(x) /2} is a good first approximation of sqrt(x) with at least one correct bit.\\n uint256 xAux = uint256(x);\\n result = 1;\\n if (xAux >= 2 ** 128) {\\n xAux >>= 128;\\n result <<= 64;\\n }\\n if (xAux >= 2 ** 64) {\\n xAux >>= 64;\\n result <<= 32;\\n }\\n if (xAux >= 2 ** 32) {\\n xAux >>= 32;\\n result <<= 16;\\n }\\n if (xAux >= 2 ** 16) {\\n xAux >>= 16;\\n result <<= 8;\\n }\\n if (xAux >= 2 ** 8) {\\n xAux >>= 8;\\n result <<= 4;\\n }\\n if (xAux >= 2 ** 4) {\\n xAux >>= 4;\\n result <<= 2;\\n }\\n if (xAux >= 2 ** 2) {\\n result <<= 1;\\n }\\n\\n // At this point, `result` is an estimation with at least one bit of precision. We know the true value has at\\n // most 128 bits, since it is the square root of a uint256. Newton's method converges quadratically (precision\\n // doubles at every iteration). We thus need at most 7 iteration to turn our partial result with one bit of\\n // precision into the expected uint128 result.\\n unchecked {\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n\\n // If x is not a perfect square, round the result toward zero.\\n uint256 roundedResult = x / result;\\n if (result >= roundedResult) {\\n result = roundedResult;\\n }\\n }\\n}\\n\",\"keccak256\":\"0xaa374e2c26cc93e8c22a6953804ee05f811597ef5fa82f76824378b22944778b\",\"license\":\"MIT\"},\"@prb/math/src/UD2x18.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\n/*\\n\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2550\\u2550\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2554\\u2588\\u2588\\u2588\\u2588\\u2554\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551 \\u255a\\u2550\\u255d \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\n\\n\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2550\\u2550\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d \\u255a\\u2588\\u2588\\u2588\\u2554\\u255d \\u255a\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u255d\\n\\n*/\\n\\nimport \\\"./ud2x18/Casting.sol\\\";\\nimport \\\"./ud2x18/Constants.sol\\\";\\nimport \\\"./ud2x18/Errors.sol\\\";\\nimport \\\"./ud2x18/ValueType.sol\\\";\\n\",\"keccak256\":\"0xfb624e24cd8bb790fa08e7827819de85504a86e20e961fa4ad126c65b6d90641\",\"license\":\"MIT\"},\"@prb/math/src/UD60x18.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\n/*\\n\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2550\\u2550\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2554\\u2588\\u2588\\u2588\\u2588\\u2554\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551 \\u255a\\u2550\\u255d \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\n\\n\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2550\\u2588\\u2588\\u2588\\u2588\\u2557\\u255a\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2588\\u2588\\u2551 \\u255a\\u2588\\u2588\\u2588\\u2554\\u255d \\u255a\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2554\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2554\\u255d \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u255d\\n\\n*/\\n\\nimport \\\"./ud60x18/Casting.sol\\\";\\nimport \\\"./ud60x18/Constants.sol\\\";\\nimport \\\"./ud60x18/Conversions.sol\\\";\\nimport \\\"./ud60x18/Errors.sol\\\";\\nimport \\\"./ud60x18/Helpers.sol\\\";\\nimport \\\"./ud60x18/Math.sol\\\";\\nimport \\\"./ud60x18/ValueType.sol\\\";\\n\",\"keccak256\":\"0xb98c6f74275914d279e8af6c502c2b1f50d5f6e1ed418d3b0153f5a193206c48\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as CastingErrors;\\nimport { SD59x18 } from \\\"../sd59x18/ValueType.sol\\\";\\nimport { UD2x18 } from \\\"../ud2x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"../ud60x18/ValueType.sol\\\";\\nimport { SD1x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts an SD1x18 number into SD59x18.\\n/// @dev There is no overflow check because the domain of SD1x18 is a subset of SD59x18.\\nfunction intoSD59x18(SD1x18 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(int256(SD1x18.unwrap(x)));\\n}\\n\\n/// @notice Casts an SD1x18 number into UD2x18.\\n/// - x must be positive.\\nfunction intoUD2x18(SD1x18 x) pure returns (UD2x18 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUD2x18_Underflow(x);\\n }\\n result = UD2x18.wrap(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into UD60x18.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUD60x18(SD1x18 x) pure returns (UD60x18 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUD60x18_Underflow(x);\\n }\\n result = UD60x18.wrap(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into uint256.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUint256(SD1x18 x) pure returns (uint256 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint256_Underflow(x);\\n }\\n result = uint256(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into uint128.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUint128(SD1x18 x) pure returns (uint128 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint128_Underflow(x);\\n }\\n result = uint128(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(SD1x18 x) pure returns (uint40 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint40_Underflow(x);\\n }\\n if (xInt > int64(uint64(Common.MAX_UINT40))) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint40_Overflow(x);\\n }\\n result = uint40(uint64(xInt));\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction sd1x18(int64 x) pure returns (SD1x18 result) {\\n result = SD1x18.wrap(x);\\n}\\n\\n/// @notice Unwraps an SD1x18 number into int64.\\nfunction unwrap(SD1x18 x) pure returns (int64 result) {\\n result = SD1x18.unwrap(x);\\n}\\n\\n/// @notice Wraps an int64 number into SD1x18.\\nfunction wrap(int64 x) pure returns (SD1x18 result) {\\n result = SD1x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x9e49e2b37c1bb845861740805edaaef3fe951a7b96eef16ce84fbf76e8278670\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD1x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @dev Euler's number as an SD1x18 number.\\nSD1x18 constant E = SD1x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum value an SD1x18 number can have.\\nint64 constant uMAX_SD1x18 = 9_223372036854775807;\\nSD1x18 constant MAX_SD1x18 = SD1x18.wrap(uMAX_SD1x18);\\n\\n/// @dev The maximum value an SD1x18 number can have.\\nint64 constant uMIN_SD1x18 = -9_223372036854775808;\\nSD1x18 constant MIN_SD1x18 = SD1x18.wrap(uMIN_SD1x18);\\n\\n/// @dev PI as an SD1x18 number.\\nSD1x18 constant PI = SD1x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of SD1x18.\\nSD1x18 constant UNIT = SD1x18.wrap(1e18);\\nint64 constant uUNIT = 1e18;\\n\",\"keccak256\":\"0x6496165b80552785a4b65a239b96e2a5fedf62fe54f002eeed72d75e566d7585\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD1x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in UD2x18.\\nerror PRBMath_SD1x18_ToUD2x18_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in UD60x18.\\nerror PRBMath_SD1x18_ToUD60x18_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint128.\\nerror PRBMath_SD1x18_ToUint128_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint256.\\nerror PRBMath_SD1x18_ToUint256_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint40.\\nerror PRBMath_SD1x18_ToUint40_Overflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint40.\\nerror PRBMath_SD1x18_ToUint40_Underflow(SD1x18 x);\\n\",\"keccak256\":\"0x836cb42ba619ca369fd4765bc47fefc3c3621369c5861882af14660aca5057ee\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\n\\n/// @notice The signed 1.18-decimal fixed-point number representation, which can have up to 1 digit and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\\n/// type int64. This is useful when end users want to use int64 to save gas, e.g. with tight variable packing in contract\\n/// storage.\\ntype SD1x18 is int64;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoSD59x18,\\n Casting.intoUD2x18,\\n Casting.intoUD60x18,\\n Casting.intoUint256,\\n Casting.intoUint128,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for SD1x18 global;\\n\",\"keccak256\":\"0x2f86f1aa9fca42f40808b51a879b406ac51817647bdb9642f8a79dd8fdb754a7\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Errors.sol\\\" as CastingErrors;\\nimport { MAX_UINT128, MAX_UINT40 } from \\\"../Common.sol\\\";\\nimport { uMAX_SD1x18, uMIN_SD1x18 } from \\\"../sd1x18/Constants.sol\\\";\\nimport { SD1x18 } from \\\"../sd1x18/ValueType.sol\\\";\\nimport { uMAX_UD2x18 } from \\\"../ud2x18/Constants.sol\\\";\\nimport { UD2x18 } from \\\"../ud2x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"../ud60x18/ValueType.sol\\\";\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts an SD59x18 number into int256.\\n/// @dev This is basically a functional alias for {unwrap}.\\nfunction intoInt256(SD59x18 x) pure returns (int256 result) {\\n result = SD59x18.unwrap(x);\\n}\\n\\n/// @notice Casts an SD59x18 number into SD1x18.\\n/// @dev Requirements:\\n/// - x must be greater than or equal to `uMIN_SD1x18`.\\n/// - x must be less than or equal to `uMAX_SD1x18`.\\nfunction intoSD1x18(SD59x18 x) pure returns (SD1x18 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < uMIN_SD1x18) {\\n revert CastingErrors.PRBMath_SD59x18_IntoSD1x18_Underflow(x);\\n }\\n if (xInt > uMAX_SD1x18) {\\n revert CastingErrors.PRBMath_SD59x18_IntoSD1x18_Overflow(x);\\n }\\n result = SD1x18.wrap(int64(xInt));\\n}\\n\\n/// @notice Casts an SD59x18 number into UD2x18.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `uMAX_UD2x18`.\\nfunction intoUD2x18(SD59x18 x) pure returns (UD2x18 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUD2x18_Underflow(x);\\n }\\n if (xInt > int256(uint256(uMAX_UD2x18))) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUD2x18_Overflow(x);\\n }\\n result = UD2x18.wrap(uint64(uint256(xInt)));\\n}\\n\\n/// @notice Casts an SD59x18 number into UD60x18.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUD60x18(SD59x18 x) pure returns (UD60x18 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUD60x18_Underflow(x);\\n }\\n result = UD60x18.wrap(uint256(xInt));\\n}\\n\\n/// @notice Casts an SD59x18 number into uint256.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUint256(SD59x18 x) pure returns (uint256 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint256_Underflow(x);\\n }\\n result = uint256(xInt);\\n}\\n\\n/// @notice Casts an SD59x18 number into uint128.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `uMAX_UINT128`.\\nfunction intoUint128(SD59x18 x) pure returns (uint128 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint128_Underflow(x);\\n }\\n if (xInt > int256(uint256(MAX_UINT128))) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint128_Overflow(x);\\n }\\n result = uint128(uint256(xInt));\\n}\\n\\n/// @notice Casts an SD59x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(SD59x18 x) pure returns (uint40 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint40_Underflow(x);\\n }\\n if (xInt > int256(uint256(MAX_UINT40))) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint40_Overflow(x);\\n }\\n result = uint40(uint256(xInt));\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction sd(int256 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(x);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction sd59x18(int256 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(x);\\n}\\n\\n/// @notice Unwraps an SD59x18 number into int256.\\nfunction unwrap(SD59x18 x) pure returns (int256 result) {\\n result = SD59x18.unwrap(x);\\n}\\n\\n/// @notice Wraps an int256 number into SD59x18.\\nfunction wrap(int256 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x3b21b60ec2998c3ae32f647412da51d3683b3f183a807198cc8d157499484f99\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n// NOTICE: the \\\"u\\\" prefix stands for \\\"unwrapped\\\".\\n\\n/// @dev Euler's number as an SD59x18 number.\\nSD59x18 constant E = SD59x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum input permitted in {exp}.\\nint256 constant uEXP_MAX_INPUT = 133_084258667509499440;\\nSD59x18 constant EXP_MAX_INPUT = SD59x18.wrap(uEXP_MAX_INPUT);\\n\\n/// @dev Any value less than this returns 0 in {exp}.\\nint256 constant uEXP_MIN_THRESHOLD = -41_446531673892822322;\\nSD59x18 constant EXP_MIN_THRESHOLD = SD59x18.wrap(uEXP_MIN_THRESHOLD);\\n\\n/// @dev The maximum input permitted in {exp2}.\\nint256 constant uEXP2_MAX_INPUT = 192e18 - 1;\\nSD59x18 constant EXP2_MAX_INPUT = SD59x18.wrap(uEXP2_MAX_INPUT);\\n\\n/// @dev Any value less than this returns 0 in {exp2}.\\nint256 constant uEXP2_MIN_THRESHOLD = -59_794705707972522261;\\nSD59x18 constant EXP2_MIN_THRESHOLD = SD59x18.wrap(uEXP2_MIN_THRESHOLD);\\n\\n/// @dev Half the UNIT number.\\nint256 constant uHALF_UNIT = 0.5e18;\\nSD59x18 constant HALF_UNIT = SD59x18.wrap(uHALF_UNIT);\\n\\n/// @dev $log_2(10)$ as an SD59x18 number.\\nint256 constant uLOG2_10 = 3_321928094887362347;\\nSD59x18 constant LOG2_10 = SD59x18.wrap(uLOG2_10);\\n\\n/// @dev $log_2(e)$ as an SD59x18 number.\\nint256 constant uLOG2_E = 1_442695040888963407;\\nSD59x18 constant LOG2_E = SD59x18.wrap(uLOG2_E);\\n\\n/// @dev The maximum value an SD59x18 number can have.\\nint256 constant uMAX_SD59x18 = 57896044618658097711785492504343953926634992332820282019728_792003956564819967;\\nSD59x18 constant MAX_SD59x18 = SD59x18.wrap(uMAX_SD59x18);\\n\\n/// @dev The maximum whole value an SD59x18 number can have.\\nint256 constant uMAX_WHOLE_SD59x18 = 57896044618658097711785492504343953926634992332820282019728_000000000000000000;\\nSD59x18 constant MAX_WHOLE_SD59x18 = SD59x18.wrap(uMAX_WHOLE_SD59x18);\\n\\n/// @dev The minimum value an SD59x18 number can have.\\nint256 constant uMIN_SD59x18 = -57896044618658097711785492504343953926634992332820282019728_792003956564819968;\\nSD59x18 constant MIN_SD59x18 = SD59x18.wrap(uMIN_SD59x18);\\n\\n/// @dev The minimum whole value an SD59x18 number can have.\\nint256 constant uMIN_WHOLE_SD59x18 = -57896044618658097711785492504343953926634992332820282019728_000000000000000000;\\nSD59x18 constant MIN_WHOLE_SD59x18 = SD59x18.wrap(uMIN_WHOLE_SD59x18);\\n\\n/// @dev PI as an SD59x18 number.\\nSD59x18 constant PI = SD59x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of SD59x18.\\nint256 constant uUNIT = 1e18;\\nSD59x18 constant UNIT = SD59x18.wrap(1e18);\\n\\n/// @dev The unit number squared.\\nint256 constant uUNIT_SQUARED = 1e36;\\nSD59x18 constant UNIT_SQUARED = SD59x18.wrap(uUNIT_SQUARED);\\n\\n/// @dev Zero as an SD59x18 number.\\nSD59x18 constant ZERO = SD59x18.wrap(0);\\n\",\"keccak256\":\"0x9bcb8dd6b3e886d140ad1c32747a4f6d29a492529ceb835be878ae837aa6cc3a\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when taking the absolute value of `MIN_SD59x18`.\\nerror PRBMath_SD59x18_Abs_MinSD59x18();\\n\\n/// @notice Thrown when ceiling a number overflows SD59x18.\\nerror PRBMath_SD59x18_Ceil_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when converting a basic integer to the fixed-point format overflows SD59x18.\\nerror PRBMath_SD59x18_Convert_Overflow(int256 x);\\n\\n/// @notice Thrown when converting a basic integer to the fixed-point format underflows SD59x18.\\nerror PRBMath_SD59x18_Convert_Underflow(int256 x);\\n\\n/// @notice Thrown when dividing two numbers and one of them is `MIN_SD59x18`.\\nerror PRBMath_SD59x18_Div_InputTooSmall();\\n\\n/// @notice Thrown when dividing two numbers and one of the intermediary unsigned results overflows SD59x18.\\nerror PRBMath_SD59x18_Div_Overflow(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when taking the natural exponent of a base greater than 133_084258667509499441.\\nerror PRBMath_SD59x18_Exp_InputTooBig(SD59x18 x);\\n\\n/// @notice Thrown when taking the binary exponent of a base greater than 192e18.\\nerror PRBMath_SD59x18_Exp2_InputTooBig(SD59x18 x);\\n\\n/// @notice Thrown when flooring a number underflows SD59x18.\\nerror PRBMath_SD59x18_Floor_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when taking the geometric mean of two numbers and their product is negative.\\nerror PRBMath_SD59x18_Gm_NegativeProduct(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when taking the geometric mean of two numbers and multiplying them overflows SD59x18.\\nerror PRBMath_SD59x18_Gm_Overflow(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\\nerror PRBMath_SD59x18_IntoSD1x18_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\\nerror PRBMath_SD59x18_IntoSD1x18_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\\nerror PRBMath_SD59x18_IntoUD2x18_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\\nerror PRBMath_SD59x18_IntoUD2x18_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD60x18.\\nerror PRBMath_SD59x18_IntoUD60x18_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\\nerror PRBMath_SD59x18_IntoUint128_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\\nerror PRBMath_SD59x18_IntoUint128_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint256.\\nerror PRBMath_SD59x18_IntoUint256_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\\nerror PRBMath_SD59x18_IntoUint40_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\\nerror PRBMath_SD59x18_IntoUint40_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when taking the logarithm of a number less than or equal to zero.\\nerror PRBMath_SD59x18_Log_InputTooSmall(SD59x18 x);\\n\\n/// @notice Thrown when multiplying two numbers and one of the inputs is `MIN_SD59x18`.\\nerror PRBMath_SD59x18_Mul_InputTooSmall();\\n\\n/// @notice Thrown when multiplying two numbers and the intermediary absolute result overflows SD59x18.\\nerror PRBMath_SD59x18_Mul_Overflow(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when raising a number to a power and the intermediary absolute result overflows SD59x18.\\nerror PRBMath_SD59x18_Powu_Overflow(SD59x18 x, uint256 y);\\n\\n/// @notice Thrown when taking the square root of a negative number.\\nerror PRBMath_SD59x18_Sqrt_NegativeInput(SD59x18 x);\\n\\n/// @notice Thrown when the calculating the square root overflows SD59x18.\\nerror PRBMath_SD59x18_Sqrt_Overflow(SD59x18 x);\\n\",\"keccak256\":\"0xa6d00fe5efa215ac0df25c896e3da99a12fb61e799644b2ec32da947313d3db4\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Helpers.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { wrap } from \\\"./Casting.sol\\\";\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Implements the checked addition operation (+) in the SD59x18 type.\\nfunction add(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n return wrap(x.unwrap() + y.unwrap());\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the SD59x18 type.\\nfunction and(SD59x18 x, int256 bits) pure returns (SD59x18 result) {\\n return wrap(x.unwrap() & bits);\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the SD59x18 type.\\nfunction and2(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n return wrap(x.unwrap() & y.unwrap());\\n}\\n\\n/// @notice Implements the equal (=) operation in the SD59x18 type.\\nfunction eq(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() == y.unwrap();\\n}\\n\\n/// @notice Implements the greater than operation (>) in the SD59x18 type.\\nfunction gt(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() > y.unwrap();\\n}\\n\\n/// @notice Implements the greater than or equal to operation (>=) in the SD59x18 type.\\nfunction gte(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() >= y.unwrap();\\n}\\n\\n/// @notice Implements a zero comparison check function in the SD59x18 type.\\nfunction isZero(SD59x18 x) pure returns (bool result) {\\n result = x.unwrap() == 0;\\n}\\n\\n/// @notice Implements the left shift operation (<<) in the SD59x18 type.\\nfunction lshift(SD59x18 x, uint256 bits) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() << bits);\\n}\\n\\n/// @notice Implements the lower than operation (<) in the SD59x18 type.\\nfunction lt(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() < y.unwrap();\\n}\\n\\n/// @notice Implements the lower than or equal to operation (<=) in the SD59x18 type.\\nfunction lte(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() <= y.unwrap();\\n}\\n\\n/// @notice Implements the unchecked modulo operation (%) in the SD59x18 type.\\nfunction mod(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() % y.unwrap());\\n}\\n\\n/// @notice Implements the not equal operation (!=) in the SD59x18 type.\\nfunction neq(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() != y.unwrap();\\n}\\n\\n/// @notice Implements the NOT (~) bitwise operation in the SD59x18 type.\\nfunction not(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(~x.unwrap());\\n}\\n\\n/// @notice Implements the OR (|) bitwise operation in the SD59x18 type.\\nfunction or(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() | y.unwrap());\\n}\\n\\n/// @notice Implements the right shift operation (>>) in the SD59x18 type.\\nfunction rshift(SD59x18 x, uint256 bits) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() >> bits);\\n}\\n\\n/// @notice Implements the checked subtraction operation (-) in the SD59x18 type.\\nfunction sub(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() - y.unwrap());\\n}\\n\\n/// @notice Implements the checked unary minus operation (-) in the SD59x18 type.\\nfunction unary(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(-x.unwrap());\\n}\\n\\n/// @notice Implements the unchecked addition operation (+) in the SD59x18 type.\\nfunction uncheckedAdd(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() + y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the unchecked subtraction operation (-) in the SD59x18 type.\\nfunction uncheckedSub(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() - y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the unchecked unary minus operation (-) in the SD59x18 type.\\nfunction uncheckedUnary(SD59x18 x) pure returns (SD59x18 result) {\\n unchecked {\\n result = wrap(-x.unwrap());\\n }\\n}\\n\\n/// @notice Implements the XOR (^) bitwise operation in the SD59x18 type.\\nfunction xor(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() ^ y.unwrap());\\n}\\n\",\"keccak256\":\"0x208570f1657cf730cb6c3d81aa14030e0d45cf906cdedea5059369d7df4bb716\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as Errors;\\nimport {\\n uEXP_MAX_INPUT,\\n uEXP2_MAX_INPUT,\\n uEXP_MIN_THRESHOLD,\\n uEXP2_MIN_THRESHOLD,\\n uHALF_UNIT,\\n uLOG2_10,\\n uLOG2_E,\\n uMAX_SD59x18,\\n uMAX_WHOLE_SD59x18,\\n uMIN_SD59x18,\\n uMIN_WHOLE_SD59x18,\\n UNIT,\\n uUNIT,\\n uUNIT_SQUARED,\\n ZERO\\n} from \\\"./Constants.sol\\\";\\nimport { wrap } from \\\"./Helpers.sol\\\";\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Calculates the absolute value of x.\\n///\\n/// @dev Requirements:\\n/// - x must be greater than `MIN_SD59x18`.\\n///\\n/// @param x The SD59x18 number for which to calculate the absolute value.\\n/// @param result The absolute value of x as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction abs(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt == uMIN_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Abs_MinSD59x18();\\n }\\n result = xInt < 0 ? wrap(-xInt) : x;\\n}\\n\\n/// @notice Calculates the arithmetic average of x and y.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// @param x The first operand as an SD59x18 number.\\n/// @param y The second operand as an SD59x18 number.\\n/// @return result The arithmetic average as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction avg(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n\\n unchecked {\\n // This operation is equivalent to `x / 2 + y / 2`, and it can never overflow.\\n int256 sum = (xInt >> 1) + (yInt >> 1);\\n\\n if (sum < 0) {\\n // If at least one of x and y is odd, add 1 to the result, because shifting negative numbers to the right\\n // rounds toward negative infinity. The right part is equivalent to `sum + (x % 2 == 1 || y % 2 == 1)`.\\n assembly (\\\"memory-safe\\\") {\\n result := add(sum, and(or(xInt, yInt), 1))\\n }\\n } else {\\n // Add 1 if both x and y are odd to account for the double 0.5 remainder truncated after shifting.\\n result = wrap(sum + (xInt & yInt & 1));\\n }\\n }\\n}\\n\\n/// @notice Yields the smallest whole number greater than or equal to x.\\n///\\n/// @dev Optimized for fractional value inputs, because every whole value has (1e18 - 1) fractional counterparts.\\n/// See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n///\\n/// Requirements:\\n/// - x must be less than or equal to `MAX_WHOLE_SD59x18`.\\n///\\n/// @param x The SD59x18 number to ceil.\\n/// @param result The smallest whole number greater than or equal to x, as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ceil(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt > uMAX_WHOLE_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Ceil_Overflow(x);\\n }\\n\\n int256 remainder = xInt % uUNIT;\\n if (remainder == 0) {\\n result = x;\\n } else {\\n unchecked {\\n // Solidity uses C fmod style, which returns a modulus with the same sign as x.\\n int256 resultInt = xInt - remainder;\\n if (xInt > 0) {\\n resultInt += uUNIT;\\n }\\n result = wrap(resultInt);\\n }\\n }\\n}\\n\\n/// @notice Divides two SD59x18 numbers, returning a new SD59x18 number.\\n///\\n/// @dev This is an extension of {Common.mulDiv} for signed numbers, which works by computing the signs and the absolute\\n/// values separately.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv}.\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv}.\\n/// - None of the inputs can be `MIN_SD59x18`.\\n/// - The denominator must not be zero.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The numerator as an SD59x18 number.\\n/// @param y The denominator as an SD59x18 number.\\n/// @param result The quotient as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction div(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n if (xInt == uMIN_SD59x18 || yInt == uMIN_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Div_InputTooSmall();\\n }\\n\\n // Get hold of the absolute values of x and y.\\n uint256 xAbs;\\n uint256 yAbs;\\n unchecked {\\n xAbs = xInt < 0 ? uint256(-xInt) : uint256(xInt);\\n yAbs = yInt < 0 ? uint256(-yInt) : uint256(yInt);\\n }\\n\\n // Compute the absolute value (x*UNIT\\u00f7y). The resulting value must fit in SD59x18.\\n uint256 resultAbs = Common.mulDiv(xAbs, uint256(uUNIT), yAbs);\\n if (resultAbs > uint256(uMAX_SD59x18)) {\\n revert Errors.PRBMath_SD59x18_Div_Overflow(x, y);\\n }\\n\\n // Check if x and y have the same sign using two's complement representation. The left-most bit represents the sign (1 for\\n // negative, 0 for positive or zero).\\n bool sameSign = (xInt ^ yInt) > -1;\\n\\n // If the inputs have the same sign, the result should be positive. Otherwise, it should be negative.\\n unchecked {\\n result = wrap(sameSign ? int256(resultAbs) : -int256(resultAbs));\\n }\\n}\\n\\n/// @notice Calculates the natural exponent of x using the following formula:\\n///\\n/// $$\\n/// e^x = 2^{x * log_2{e}}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {exp2}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {exp2}.\\n/// - x must be less than 133_084258667509499441.\\n///\\n/// @param x The exponent as an SD59x18 number.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n\\n // Any input less than the threshold returns zero.\\n // This check also prevents an overflow for very small numbers.\\n if (xInt < uEXP_MIN_THRESHOLD) {\\n return ZERO;\\n }\\n\\n // This check prevents values greater than 192e18 from being passed to {exp2}.\\n if (xInt > uEXP_MAX_INPUT) {\\n revert Errors.PRBMath_SD59x18_Exp_InputTooBig(x);\\n }\\n\\n unchecked {\\n // Inline the fixed-point multiplication to save gas.\\n int256 doubleUnitProduct = xInt * uLOG2_E;\\n result = exp2(wrap(doubleUnitProduct / uUNIT));\\n }\\n}\\n\\n/// @notice Calculates the binary exponent of x using the binary fraction method using the following formula:\\n///\\n/// $$\\n/// 2^{-x} = \\\\frac{1}{2^x}\\n/// $$\\n///\\n/// @dev See https://ethereum.stackexchange.com/q/79903/24693.\\n///\\n/// Notes:\\n/// - If x is less than -59_794705707972522261, the result is zero.\\n///\\n/// Requirements:\\n/// - x must be less than 192e18.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The exponent as an SD59x18 number.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp2(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < 0) {\\n // The inverse of any number less than the threshold is truncated to zero.\\n if (xInt < uEXP2_MIN_THRESHOLD) {\\n return ZERO;\\n }\\n\\n unchecked {\\n // Inline the fixed-point inversion to save gas.\\n result = wrap(uUNIT_SQUARED / exp2(wrap(-xInt)).unwrap());\\n }\\n } else {\\n // Numbers greater than or equal to 192e18 don't fit in the 192.64-bit format.\\n if (xInt > uEXP2_MAX_INPUT) {\\n revert Errors.PRBMath_SD59x18_Exp2_InputTooBig(x);\\n }\\n\\n unchecked {\\n // Convert x to the 192.64-bit fixed-point format.\\n uint256 x_192x64 = uint256((xInt << 64) / uUNIT);\\n\\n // It is safe to cast the result to int256 due to the checks above.\\n result = wrap(int256(Common.exp2(x_192x64)));\\n }\\n }\\n}\\n\\n/// @notice Yields the greatest whole number less than or equal to x.\\n///\\n/// @dev Optimized for fractional value inputs, because for every whole value there are (1e18 - 1) fractional\\n/// counterparts. See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n///\\n/// Requirements:\\n/// - x must be greater than or equal to `MIN_WHOLE_SD59x18`.\\n///\\n/// @param x The SD59x18 number to floor.\\n/// @param result The greatest whole number less than or equal to x, as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction floor(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < uMIN_WHOLE_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Floor_Underflow(x);\\n }\\n\\n int256 remainder = xInt % uUNIT;\\n if (remainder == 0) {\\n result = x;\\n } else {\\n unchecked {\\n // Solidity uses C fmod style, which returns a modulus with the same sign as x.\\n int256 resultInt = xInt - remainder;\\n if (xInt < 0) {\\n resultInt -= uUNIT;\\n }\\n result = wrap(resultInt);\\n }\\n }\\n}\\n\\n/// @notice Yields the excess beyond the floor of x for positive numbers and the part of the number to the right.\\n/// of the radix point for negative numbers.\\n/// @dev Based on the odd function definition. https://en.wikipedia.org/wiki/Fractional_part\\n/// @param x The SD59x18 number to get the fractional part of.\\n/// @param result The fractional part of x as an SD59x18 number.\\nfunction frac(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() % uUNIT);\\n}\\n\\n/// @notice Calculates the geometric mean of x and y, i.e. $\\\\sqrt{x * y}$.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x * y must fit in SD59x18.\\n/// - x * y must not be negative, since complex numbers are not supported.\\n///\\n/// @param x The first operand as an SD59x18 number.\\n/// @param y The second operand as an SD59x18 number.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction gm(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n if (xInt == 0 || yInt == 0) {\\n return ZERO;\\n }\\n\\n unchecked {\\n // Equivalent to `xy / x != y`. Checking for overflow this way is faster than letting Solidity do it.\\n int256 xyInt = xInt * yInt;\\n if (xyInt / xInt != yInt) {\\n revert Errors.PRBMath_SD59x18_Gm_Overflow(x, y);\\n }\\n\\n // The product must not be negative, since complex numbers are not supported.\\n if (xyInt < 0) {\\n revert Errors.PRBMath_SD59x18_Gm_NegativeProduct(x, y);\\n }\\n\\n // We don't need to multiply the result by `UNIT` here because the x*y product picked up a factor of `UNIT`\\n // during multiplication. See the comments in {Common.sqrt}.\\n uint256 resultUint = Common.sqrt(uint256(xyInt));\\n result = wrap(int256(resultUint));\\n }\\n}\\n\\n/// @notice Calculates the inverse of x.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x must not be zero.\\n///\\n/// @param x The SD59x18 number for which to calculate the inverse.\\n/// @return result The inverse as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction inv(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(uUNIT_SQUARED / x.unwrap());\\n}\\n\\n/// @notice Calculates the natural logarithm of x using the following formula:\\n///\\n/// $$\\n/// ln{x} = log_2{x} / log_2{e}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n/// - The precision isn't sufficiently fine-grained to return exactly `UNIT` when the input is `E`.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The SD59x18 number for which to calculate the natural logarithm.\\n/// @return result The natural logarithm as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ln(SD59x18 x) pure returns (SD59x18 result) {\\n // Inline the fixed-point multiplication to save gas. This is overflow-safe because the maximum value that\\n // {log2} can return is ~195_205294292027477728.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_E);\\n}\\n\\n/// @notice Calculates the common logarithm of x using the following formula:\\n///\\n/// $$\\n/// log_{10}{x} = log_2{x} / log_2{10}\\n/// $$\\n///\\n/// However, if x is an exact power of ten, a hard coded value is returned.\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The SD59x18 number for which to calculate the common logarithm.\\n/// @return result The common logarithm as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log10(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < 0) {\\n revert Errors.PRBMath_SD59x18_Log_InputTooSmall(x);\\n }\\n\\n // Note that the `mul` in this block is the standard multiplication operation, not {SD59x18.mul}.\\n // prettier-ignore\\n assembly (\\\"memory-safe\\\") {\\n switch x\\n case 1 { result := mul(uUNIT, sub(0, 18)) }\\n case 10 { result := mul(uUNIT, sub(1, 18)) }\\n case 100 { result := mul(uUNIT, sub(2, 18)) }\\n case 1000 { result := mul(uUNIT, sub(3, 18)) }\\n case 10000 { result := mul(uUNIT, sub(4, 18)) }\\n case 100000 { result := mul(uUNIT, sub(5, 18)) }\\n case 1000000 { result := mul(uUNIT, sub(6, 18)) }\\n case 10000000 { result := mul(uUNIT, sub(7, 18)) }\\n case 100000000 { result := mul(uUNIT, sub(8, 18)) }\\n case 1000000000 { result := mul(uUNIT, sub(9, 18)) }\\n case 10000000000 { result := mul(uUNIT, sub(10, 18)) }\\n case 100000000000 { result := mul(uUNIT, sub(11, 18)) }\\n case 1000000000000 { result := mul(uUNIT, sub(12, 18)) }\\n case 10000000000000 { result := mul(uUNIT, sub(13, 18)) }\\n case 100000000000000 { result := mul(uUNIT, sub(14, 18)) }\\n case 1000000000000000 { result := mul(uUNIT, sub(15, 18)) }\\n case 10000000000000000 { result := mul(uUNIT, sub(16, 18)) }\\n case 100000000000000000 { result := mul(uUNIT, sub(17, 18)) }\\n case 1000000000000000000 { result := 0 }\\n case 10000000000000000000 { result := uUNIT }\\n case 100000000000000000000 { result := mul(uUNIT, 2) }\\n case 1000000000000000000000 { result := mul(uUNIT, 3) }\\n case 10000000000000000000000 { result := mul(uUNIT, 4) }\\n case 100000000000000000000000 { result := mul(uUNIT, 5) }\\n case 1000000000000000000000000 { result := mul(uUNIT, 6) }\\n case 10000000000000000000000000 { result := mul(uUNIT, 7) }\\n case 100000000000000000000000000 { result := mul(uUNIT, 8) }\\n case 1000000000000000000000000000 { result := mul(uUNIT, 9) }\\n case 10000000000000000000000000000 { result := mul(uUNIT, 10) }\\n case 100000000000000000000000000000 { result := mul(uUNIT, 11) }\\n case 1000000000000000000000000000000 { result := mul(uUNIT, 12) }\\n case 10000000000000000000000000000000 { result := mul(uUNIT, 13) }\\n case 100000000000000000000000000000000 { result := mul(uUNIT, 14) }\\n case 1000000000000000000000000000000000 { result := mul(uUNIT, 15) }\\n case 10000000000000000000000000000000000 { result := mul(uUNIT, 16) }\\n case 100000000000000000000000000000000000 { result := mul(uUNIT, 17) }\\n case 1000000000000000000000000000000000000 { result := mul(uUNIT, 18) }\\n case 10000000000000000000000000000000000000 { result := mul(uUNIT, 19) }\\n case 100000000000000000000000000000000000000 { result := mul(uUNIT, 20) }\\n case 1000000000000000000000000000000000000000 { result := mul(uUNIT, 21) }\\n case 10000000000000000000000000000000000000000 { result := mul(uUNIT, 22) }\\n case 100000000000000000000000000000000000000000 { result := mul(uUNIT, 23) }\\n case 1000000000000000000000000000000000000000000 { result := mul(uUNIT, 24) }\\n case 10000000000000000000000000000000000000000000 { result := mul(uUNIT, 25) }\\n case 100000000000000000000000000000000000000000000 { result := mul(uUNIT, 26) }\\n case 1000000000000000000000000000000000000000000000 { result := mul(uUNIT, 27) }\\n case 10000000000000000000000000000000000000000000000 { result := mul(uUNIT, 28) }\\n case 100000000000000000000000000000000000000000000000 { result := mul(uUNIT, 29) }\\n case 1000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 30) }\\n case 10000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 31) }\\n case 100000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 32) }\\n case 1000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 33) }\\n case 10000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 34) }\\n case 100000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 35) }\\n case 1000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 36) }\\n case 10000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 37) }\\n case 100000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 38) }\\n case 1000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 39) }\\n case 10000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 40) }\\n case 100000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 41) }\\n case 1000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 42) }\\n case 10000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 43) }\\n case 100000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 44) }\\n case 1000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 45) }\\n case 10000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 46) }\\n case 100000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 47) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 48) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 49) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 50) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 51) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 52) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 53) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 54) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 55) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 56) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 57) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 58) }\\n default { result := uMAX_SD59x18 }\\n }\\n\\n if (result.unwrap() == uMAX_SD59x18) {\\n unchecked {\\n // Inline the fixed-point division to save gas.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_10);\\n }\\n }\\n}\\n\\n/// @notice Calculates the binary logarithm of x using the iterative approximation algorithm:\\n///\\n/// $$\\n/// log_2{x} = n + log_2{y}, \\\\text{ where } y = x*2^{-n}, \\\\ y \\\\in [1, 2)\\n/// $$\\n///\\n/// For $0 \\\\leq x \\\\lt 1$, the input is inverted:\\n///\\n/// $$\\n/// log_2{x} = -log_2{\\\\frac{1}{x}}\\n/// $$\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Binary_logarithm#Iterative_approximation.\\n///\\n/// Notes:\\n/// - Due to the lossy precision of the iterative approximation, the results are not perfectly accurate to the last decimal.\\n///\\n/// Requirements:\\n/// - x must be greater than zero.\\n///\\n/// @param x The SD59x18 number for which to calculate the binary logarithm.\\n/// @return result The binary logarithm as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log2(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt <= 0) {\\n revert Errors.PRBMath_SD59x18_Log_InputTooSmall(x);\\n }\\n\\n unchecked {\\n int256 sign;\\n if (xInt >= uUNIT) {\\n sign = 1;\\n } else {\\n sign = -1;\\n // Inline the fixed-point inversion to save gas.\\n xInt = uUNIT_SQUARED / xInt;\\n }\\n\\n // Calculate the integer part of the logarithm.\\n uint256 n = Common.msb(uint256(xInt / uUNIT));\\n\\n // This is the integer part of the logarithm as an SD59x18 number. The operation can't overflow\\n // because n is at most 255, `UNIT` is 1e18, and the sign is either 1 or -1.\\n int256 resultInt = int256(n) * uUNIT;\\n\\n // Calculate $y = x * 2^{-n}$.\\n int256 y = xInt >> n;\\n\\n // If y is the unit number, the fractional part is zero.\\n if (y == uUNIT) {\\n return wrap(resultInt * sign);\\n }\\n\\n // Calculate the fractional part via the iterative approximation.\\n // The `delta >>= 1` part is equivalent to `delta /= 2`, but shifting bits is more gas efficient.\\n int256 DOUBLE_UNIT = 2e18;\\n for (int256 delta = uHALF_UNIT; delta > 0; delta >>= 1) {\\n y = (y * y) / uUNIT;\\n\\n // Is y^2 >= 2e18 and so in the range [2e18, 4e18)?\\n if (y >= DOUBLE_UNIT) {\\n // Add the 2^{-m} factor to the logarithm.\\n resultInt = resultInt + delta;\\n\\n // Halve y, which corresponds to z/2 in the Wikipedia article.\\n y >>= 1;\\n }\\n }\\n resultInt *= sign;\\n result = wrap(resultInt);\\n }\\n}\\n\\n/// @notice Multiplies two SD59x18 numbers together, returning a new SD59x18 number.\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {Common.mulDiv18}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv18}.\\n/// - None of the inputs can be `MIN_SD59x18`.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The multiplicand as an SD59x18 number.\\n/// @param y The multiplier as an SD59x18 number.\\n/// @return result The product as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mul(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n if (xInt == uMIN_SD59x18 || yInt == uMIN_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Mul_InputTooSmall();\\n }\\n\\n // Get hold of the absolute values of x and y.\\n uint256 xAbs;\\n uint256 yAbs;\\n unchecked {\\n xAbs = xInt < 0 ? uint256(-xInt) : uint256(xInt);\\n yAbs = yInt < 0 ? uint256(-yInt) : uint256(yInt);\\n }\\n\\n // Compute the absolute value (x*y\\u00f7UNIT). The resulting value must fit in SD59x18.\\n uint256 resultAbs = Common.mulDiv18(xAbs, yAbs);\\n if (resultAbs > uint256(uMAX_SD59x18)) {\\n revert Errors.PRBMath_SD59x18_Mul_Overflow(x, y);\\n }\\n\\n // Check if x and y have the same sign using two's complement representation. The left-most bit represents the sign (1 for\\n // negative, 0 for positive or zero).\\n bool sameSign = (xInt ^ yInt) > -1;\\n\\n // If the inputs have the same sign, the result should be positive. Otherwise, it should be negative.\\n unchecked {\\n result = wrap(sameSign ? int256(resultAbs) : -int256(resultAbs));\\n }\\n}\\n\\n/// @notice Raises x to the power of y using the following formula:\\n///\\n/// $$\\n/// x^y = 2^{log_2{x} * y}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {exp2}, {log2}, and {mul}.\\n/// - Returns `UNIT` for 0^0.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {exp2}, {log2}, and {mul}.\\n///\\n/// @param x The base as an SD59x18 number.\\n/// @param y Exponent to raise x to, as an SD59x18 number\\n/// @return result x raised to power y, as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction pow(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n\\n // If both x and y are zero, the result is `UNIT`. If just x is zero, the result is always zero.\\n if (xInt == 0) {\\n return yInt == 0 ? UNIT : ZERO;\\n }\\n // If x is `UNIT`, the result is always `UNIT`.\\n else if (xInt == uUNIT) {\\n return UNIT;\\n }\\n\\n // If y is zero, the result is always `UNIT`.\\n if (yInt == 0) {\\n return UNIT;\\n }\\n // If y is `UNIT`, the result is always x.\\n else if (yInt == uUNIT) {\\n return x;\\n }\\n\\n // Calculate the result using the formula.\\n result = exp2(mul(log2(x), y));\\n}\\n\\n/// @notice Raises x (an SD59x18 number) to the power y (an unsigned basic integer) using the well-known\\n/// algorithm \\\"exponentiation by squaring\\\".\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Exponentiation_by_squaring.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv18}.\\n/// - Returns `UNIT` for 0^0.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {abs} and {Common.mulDiv18}.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The base as an SD59x18 number.\\n/// @param y The exponent as a uint256.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction powu(SD59x18 x, uint256 y) pure returns (SD59x18 result) {\\n uint256 xAbs = uint256(abs(x).unwrap());\\n\\n // Calculate the first iteration of the loop in advance.\\n uint256 resultAbs = y & 1 > 0 ? xAbs : uint256(uUNIT);\\n\\n // Equivalent to `for(y /= 2; y > 0; y /= 2)`.\\n uint256 yAux = y;\\n for (yAux >>= 1; yAux > 0; yAux >>= 1) {\\n xAbs = Common.mulDiv18(xAbs, xAbs);\\n\\n // Equivalent to `y % 2 == 1`.\\n if (yAux & 1 > 0) {\\n resultAbs = Common.mulDiv18(resultAbs, xAbs);\\n }\\n }\\n\\n // The result must fit in SD59x18.\\n if (resultAbs > uint256(uMAX_SD59x18)) {\\n revert Errors.PRBMath_SD59x18_Powu_Overflow(x, y);\\n }\\n\\n unchecked {\\n // Is the base negative and the exponent odd? If yes, the result should be negative.\\n int256 resultInt = int256(resultAbs);\\n bool isNegative = x.unwrap() < 0 && y & 1 == 1;\\n if (isNegative) {\\n resultInt = -resultInt;\\n }\\n result = wrap(resultInt);\\n }\\n}\\n\\n/// @notice Calculates the square root of x using the Babylonian method.\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\\n///\\n/// Notes:\\n/// - Only the positive root is returned.\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x cannot be negative, since complex numbers are not supported.\\n/// - x must be less than `MAX_SD59x18 / UNIT`.\\n///\\n/// @param x The SD59x18 number for which to calculate the square root.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction sqrt(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < 0) {\\n revert Errors.PRBMath_SD59x18_Sqrt_NegativeInput(x);\\n }\\n if (xInt > uMAX_SD59x18 / uUNIT) {\\n revert Errors.PRBMath_SD59x18_Sqrt_Overflow(x);\\n }\\n\\n unchecked {\\n // Multiply x by `UNIT` to account for the factor of `UNIT` picked up when multiplying two SD59x18 numbers.\\n // In this case, the two numbers are both the square root.\\n uint256 resultUint = Common.sqrt(uint256(xInt * uUNIT));\\n result = wrap(int256(resultUint));\\n }\\n}\\n\",\"keccak256\":\"0xa074831139fc89ca0e5a36086b30eb50896bb6770cd5823461b1f2769017d2f0\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\nimport \\\"./Helpers.sol\\\" as Helpers;\\nimport \\\"./Math.sol\\\" as Math;\\n\\n/// @notice The signed 59.18-decimal fixed-point number representation, which can have up to 59 digits and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\\n/// type int256.\\ntype SD59x18 is int256;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoInt256,\\n Casting.intoSD1x18,\\n Casting.intoUD2x18,\\n Casting.intoUD60x18,\\n Casting.intoUint256,\\n Casting.intoUint128,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for SD59x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n MATHEMATICAL FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Math.abs,\\n Math.avg,\\n Math.ceil,\\n Math.div,\\n Math.exp,\\n Math.exp2,\\n Math.floor,\\n Math.frac,\\n Math.gm,\\n Math.inv,\\n Math.log10,\\n Math.log2,\\n Math.ln,\\n Math.mul,\\n Math.pow,\\n Math.powu,\\n Math.sqrt\\n} for SD59x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n HELPER FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Helpers.add,\\n Helpers.and,\\n Helpers.eq,\\n Helpers.gt,\\n Helpers.gte,\\n Helpers.isZero,\\n Helpers.lshift,\\n Helpers.lt,\\n Helpers.lte,\\n Helpers.mod,\\n Helpers.neq,\\n Helpers.not,\\n Helpers.or,\\n Helpers.rshift,\\n Helpers.sub,\\n Helpers.uncheckedAdd,\\n Helpers.uncheckedSub,\\n Helpers.uncheckedUnary,\\n Helpers.xor\\n} for SD59x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n OPERATORS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes it possible to use these operators on the SD59x18 type.\\nusing {\\n Helpers.add as +,\\n Helpers.and2 as &,\\n Math.div as /,\\n Helpers.eq as ==,\\n Helpers.gt as >,\\n Helpers.gte as >=,\\n Helpers.lt as <,\\n Helpers.lte as <=,\\n Helpers.mod as %,\\n Math.mul as *,\\n Helpers.neq as !=,\\n Helpers.not as ~,\\n Helpers.or as |,\\n Helpers.sub as -,\\n Helpers.unary as -,\\n Helpers.xor as ^\\n} for SD59x18 global;\\n\",\"keccak256\":\"0xe03112d145dcd5863aff24e5f381debaae29d446acd5666f3d640e3d9af738d7\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as Errors;\\nimport { uMAX_SD1x18 } from \\\"../sd1x18/Constants.sol\\\";\\nimport { SD1x18 } from \\\"../sd1x18/ValueType.sol\\\";\\nimport { SD59x18 } from \\\"../sd59x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"../ud60x18/ValueType.sol\\\";\\nimport { UD2x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts a UD2x18 number into SD1x18.\\n/// - x must be less than or equal to `uMAX_SD1x18`.\\nfunction intoSD1x18(UD2x18 x) pure returns (SD1x18 result) {\\n uint64 xUint = UD2x18.unwrap(x);\\n if (xUint > uint64(uMAX_SD1x18)) {\\n revert Errors.PRBMath_UD2x18_IntoSD1x18_Overflow(x);\\n }\\n result = SD1x18.wrap(int64(xUint));\\n}\\n\\n/// @notice Casts a UD2x18 number into SD59x18.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of SD59x18.\\nfunction intoSD59x18(UD2x18 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(int256(uint256(UD2x18.unwrap(x))));\\n}\\n\\n/// @notice Casts a UD2x18 number into UD60x18.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of UD60x18.\\nfunction intoUD60x18(UD2x18 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(UD2x18.unwrap(x));\\n}\\n\\n/// @notice Casts a UD2x18 number into uint128.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of uint128.\\nfunction intoUint128(UD2x18 x) pure returns (uint128 result) {\\n result = uint128(UD2x18.unwrap(x));\\n}\\n\\n/// @notice Casts a UD2x18 number into uint256.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of uint256.\\nfunction intoUint256(UD2x18 x) pure returns (uint256 result) {\\n result = uint256(UD2x18.unwrap(x));\\n}\\n\\n/// @notice Casts a UD2x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(UD2x18 x) pure returns (uint40 result) {\\n uint64 xUint = UD2x18.unwrap(x);\\n if (xUint > uint64(Common.MAX_UINT40)) {\\n revert Errors.PRBMath_UD2x18_IntoUint40_Overflow(x);\\n }\\n result = uint40(xUint);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction ud2x18(uint64 x) pure returns (UD2x18 result) {\\n result = UD2x18.wrap(x);\\n}\\n\\n/// @notice Unwrap a UD2x18 number into uint64.\\nfunction unwrap(UD2x18 x) pure returns (uint64 result) {\\n result = UD2x18.unwrap(x);\\n}\\n\\n/// @notice Wraps a uint64 number into UD2x18.\\nfunction wrap(uint64 x) pure returns (UD2x18 result) {\\n result = UD2x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x9b1a35d432ef951a415fae8098b3c609a99b630a3d5464b3c8e1efa8893eea07\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD2x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @dev Euler's number as a UD2x18 number.\\nUD2x18 constant E = UD2x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum value a UD2x18 number can have.\\nuint64 constant uMAX_UD2x18 = 18_446744073709551615;\\nUD2x18 constant MAX_UD2x18 = UD2x18.wrap(uMAX_UD2x18);\\n\\n/// @dev PI as a UD2x18 number.\\nUD2x18 constant PI = UD2x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of UD2x18.\\nUD2x18 constant UNIT = UD2x18.wrap(1e18);\\nuint64 constant uUNIT = 1e18;\\n\",\"keccak256\":\"0x29b0e050c865899e1fb9022b460a7829cdee248c44c4299f068ba80695eec3fc\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD2x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when trying to cast a UD2x18 number that doesn't fit in SD1x18.\\nerror PRBMath_UD2x18_IntoSD1x18_Overflow(UD2x18 x);\\n\\n/// @notice Thrown when trying to cast a UD2x18 number that doesn't fit in uint40.\\nerror PRBMath_UD2x18_IntoUint40_Overflow(UD2x18 x);\\n\",\"keccak256\":\"0xdf1e22f0b4c8032bcc8b7f63fe3984e1387f3dc7b2e9ab381822249f75376d33\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\n\\n/// @notice The unsigned 2.18-decimal fixed-point number representation, which can have up to 2 digits and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\\n/// type uint64. This is useful when end users want to use uint64 to save gas, e.g. with tight variable packing in contract\\n/// storage.\\ntype UD2x18 is uint64;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoSD1x18,\\n Casting.intoSD59x18,\\n Casting.intoUD60x18,\\n Casting.intoUint256,\\n Casting.intoUint128,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for UD2x18 global;\\n\",\"keccak256\":\"0x2802edc9869db116a0b5c490cc5f8554742f747183fa30ac5e9c80bb967e61a1\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Errors.sol\\\" as CastingErrors;\\nimport { MAX_UINT128, MAX_UINT40 } from \\\"../Common.sol\\\";\\nimport { uMAX_SD1x18 } from \\\"../sd1x18/Constants.sol\\\";\\nimport { SD1x18 } from \\\"../sd1x18/ValueType.sol\\\";\\nimport { uMAX_SD59x18 } from \\\"../sd59x18/Constants.sol\\\";\\nimport { SD59x18 } from \\\"../sd59x18/ValueType.sol\\\";\\nimport { uMAX_UD2x18 } from \\\"../ud2x18/Constants.sol\\\";\\nimport { UD2x18 } from \\\"../ud2x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts a UD60x18 number into SD1x18.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `uMAX_SD1x18`.\\nfunction intoSD1x18(UD60x18 x) pure returns (SD1x18 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > uint256(int256(uMAX_SD1x18))) {\\n revert CastingErrors.PRBMath_UD60x18_IntoSD1x18_Overflow(x);\\n }\\n result = SD1x18.wrap(int64(uint64(xUint)));\\n}\\n\\n/// @notice Casts a UD60x18 number into UD2x18.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `uMAX_UD2x18`.\\nfunction intoUD2x18(UD60x18 x) pure returns (UD2x18 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > uMAX_UD2x18) {\\n revert CastingErrors.PRBMath_UD60x18_IntoUD2x18_Overflow(x);\\n }\\n result = UD2x18.wrap(uint64(xUint));\\n}\\n\\n/// @notice Casts a UD60x18 number into SD59x18.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `uMAX_SD59x18`.\\nfunction intoSD59x18(UD60x18 x) pure returns (SD59x18 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > uint256(uMAX_SD59x18)) {\\n revert CastingErrors.PRBMath_UD60x18_IntoSD59x18_Overflow(x);\\n }\\n result = SD59x18.wrap(int256(xUint));\\n}\\n\\n/// @notice Casts a UD60x18 number into uint128.\\n/// @dev This is basically an alias for {unwrap}.\\nfunction intoUint256(UD60x18 x) pure returns (uint256 result) {\\n result = UD60x18.unwrap(x);\\n}\\n\\n/// @notice Casts a UD60x18 number into uint128.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UINT128`.\\nfunction intoUint128(UD60x18 x) pure returns (uint128 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > MAX_UINT128) {\\n revert CastingErrors.PRBMath_UD60x18_IntoUint128_Overflow(x);\\n }\\n result = uint128(xUint);\\n}\\n\\n/// @notice Casts a UD60x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(UD60x18 x) pure returns (uint40 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > MAX_UINT40) {\\n revert CastingErrors.PRBMath_UD60x18_IntoUint40_Overflow(x);\\n }\\n result = uint40(xUint);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction ud(uint256 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(x);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction ud60x18(uint256 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(x);\\n}\\n\\n/// @notice Unwraps a UD60x18 number into uint256.\\nfunction unwrap(UD60x18 x) pure returns (uint256 result) {\\n result = UD60x18.unwrap(x);\\n}\\n\\n/// @notice Wraps a uint256 number into the UD60x18 value type.\\nfunction wrap(uint256 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x5bb532da36921cbdac64d1f16de5d366ef1f664502e3b7c07d0ad06917551f85\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n// NOTICE: the \\\"u\\\" prefix stands for \\\"unwrapped\\\".\\n\\n/// @dev Euler's number as a UD60x18 number.\\nUD60x18 constant E = UD60x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum input permitted in {exp}.\\nuint256 constant uEXP_MAX_INPUT = 133_084258667509499440;\\nUD60x18 constant EXP_MAX_INPUT = UD60x18.wrap(uEXP_MAX_INPUT);\\n\\n/// @dev The maximum input permitted in {exp2}.\\nuint256 constant uEXP2_MAX_INPUT = 192e18 - 1;\\nUD60x18 constant EXP2_MAX_INPUT = UD60x18.wrap(uEXP2_MAX_INPUT);\\n\\n/// @dev Half the UNIT number.\\nuint256 constant uHALF_UNIT = 0.5e18;\\nUD60x18 constant HALF_UNIT = UD60x18.wrap(uHALF_UNIT);\\n\\n/// @dev $log_2(10)$ as a UD60x18 number.\\nuint256 constant uLOG2_10 = 3_321928094887362347;\\nUD60x18 constant LOG2_10 = UD60x18.wrap(uLOG2_10);\\n\\n/// @dev $log_2(e)$ as a UD60x18 number.\\nuint256 constant uLOG2_E = 1_442695040888963407;\\nUD60x18 constant LOG2_E = UD60x18.wrap(uLOG2_E);\\n\\n/// @dev The maximum value a UD60x18 number can have.\\nuint256 constant uMAX_UD60x18 = 115792089237316195423570985008687907853269984665640564039457_584007913129639935;\\nUD60x18 constant MAX_UD60x18 = UD60x18.wrap(uMAX_UD60x18);\\n\\n/// @dev The maximum whole value a UD60x18 number can have.\\nuint256 constant uMAX_WHOLE_UD60x18 = 115792089237316195423570985008687907853269984665640564039457_000000000000000000;\\nUD60x18 constant MAX_WHOLE_UD60x18 = UD60x18.wrap(uMAX_WHOLE_UD60x18);\\n\\n/// @dev PI as a UD60x18 number.\\nUD60x18 constant PI = UD60x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of UD60x18.\\nuint256 constant uUNIT = 1e18;\\nUD60x18 constant UNIT = UD60x18.wrap(uUNIT);\\n\\n/// @dev The unit number squared.\\nuint256 constant uUNIT_SQUARED = 1e36;\\nUD60x18 constant UNIT_SQUARED = UD60x18.wrap(uUNIT_SQUARED);\\n\\n/// @dev Zero as a UD60x18 number.\\nUD60x18 constant ZERO = UD60x18.wrap(0);\\n\",\"keccak256\":\"0x2b80d26153d3fdcfb3a9ca772d9309d31ed1275f5b8b54c3ffb54d3652b37d90\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Conversions.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { uMAX_UD60x18, uUNIT } from \\\"./Constants.sol\\\";\\nimport { PRBMath_UD60x18_Convert_Overflow } from \\\"./Errors.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Converts a UD60x18 number to a simple integer by dividing it by `UNIT`.\\n/// @dev The result is rounded toward zero.\\n/// @param x The UD60x18 number to convert.\\n/// @return result The same number in basic integer form.\\nfunction convert(UD60x18 x) pure returns (uint256 result) {\\n result = UD60x18.unwrap(x) / uUNIT;\\n}\\n\\n/// @notice Converts a simple integer to UD60x18 by multiplying it by `UNIT`.\\n///\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UD60x18 / UNIT`.\\n///\\n/// @param x The basic integer to convert.\\n/// @param result The same number converted to UD60x18.\\nfunction convert(uint256 x) pure returns (UD60x18 result) {\\n if (x > uMAX_UD60x18 / uUNIT) {\\n revert PRBMath_UD60x18_Convert_Overflow(x);\\n }\\n unchecked {\\n result = UD60x18.wrap(x * uUNIT);\\n }\\n}\\n\",\"keccak256\":\"0xaf7fc2523413822de3b66ba339fe2884fb3b8c6f6cf38ec90a2c3e3aae71df6b\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when ceiling a number overflows UD60x18.\\nerror PRBMath_UD60x18_Ceil_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when converting a basic integer to the fixed-point format overflows UD60x18.\\nerror PRBMath_UD60x18_Convert_Overflow(uint256 x);\\n\\n/// @notice Thrown when taking the natural exponent of a base greater than 133_084258667509499441.\\nerror PRBMath_UD60x18_Exp_InputTooBig(UD60x18 x);\\n\\n/// @notice Thrown when taking the binary exponent of a base greater than 192e18.\\nerror PRBMath_UD60x18_Exp2_InputTooBig(UD60x18 x);\\n\\n/// @notice Thrown when taking the geometric mean of two numbers and multiplying them overflows UD60x18.\\nerror PRBMath_UD60x18_Gm_Overflow(UD60x18 x, UD60x18 y);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\\nerror PRBMath_UD60x18_IntoSD1x18_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD59x18.\\nerror PRBMath_UD60x18_IntoSD59x18_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\\nerror PRBMath_UD60x18_IntoUD2x18_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\\nerror PRBMath_UD60x18_IntoUint128_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\\nerror PRBMath_UD60x18_IntoUint40_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when taking the logarithm of a number less than 1.\\nerror PRBMath_UD60x18_Log_InputTooSmall(UD60x18 x);\\n\\n/// @notice Thrown when calculating the square root overflows UD60x18.\\nerror PRBMath_UD60x18_Sqrt_Overflow(UD60x18 x);\\n\",\"keccak256\":\"0xa8c60d4066248df22c49c882873efbc017344107edabc48c52209abbc39cb1e3\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Helpers.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { wrap } from \\\"./Casting.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Implements the checked addition operation (+) in the UD60x18 type.\\nfunction add(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() + y.unwrap());\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the UD60x18 type.\\nfunction and(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() & bits);\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the UD60x18 type.\\nfunction and2(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() & y.unwrap());\\n}\\n\\n/// @notice Implements the equal operation (==) in the UD60x18 type.\\nfunction eq(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() == y.unwrap();\\n}\\n\\n/// @notice Implements the greater than operation (>) in the UD60x18 type.\\nfunction gt(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() > y.unwrap();\\n}\\n\\n/// @notice Implements the greater than or equal to operation (>=) in the UD60x18 type.\\nfunction gte(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() >= y.unwrap();\\n}\\n\\n/// @notice Implements a zero comparison check function in the UD60x18 type.\\nfunction isZero(UD60x18 x) pure returns (bool result) {\\n // This wouldn't work if x could be negative.\\n result = x.unwrap() == 0;\\n}\\n\\n/// @notice Implements the left shift operation (<<) in the UD60x18 type.\\nfunction lshift(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() << bits);\\n}\\n\\n/// @notice Implements the lower than operation (<) in the UD60x18 type.\\nfunction lt(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() < y.unwrap();\\n}\\n\\n/// @notice Implements the lower than or equal to operation (<=) in the UD60x18 type.\\nfunction lte(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() <= y.unwrap();\\n}\\n\\n/// @notice Implements the checked modulo operation (%) in the UD60x18 type.\\nfunction mod(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() % y.unwrap());\\n}\\n\\n/// @notice Implements the not equal operation (!=) in the UD60x18 type.\\nfunction neq(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() != y.unwrap();\\n}\\n\\n/// @notice Implements the NOT (~) bitwise operation in the UD60x18 type.\\nfunction not(UD60x18 x) pure returns (UD60x18 result) {\\n result = wrap(~x.unwrap());\\n}\\n\\n/// @notice Implements the OR (|) bitwise operation in the UD60x18 type.\\nfunction or(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() | y.unwrap());\\n}\\n\\n/// @notice Implements the right shift operation (>>) in the UD60x18 type.\\nfunction rshift(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() >> bits);\\n}\\n\\n/// @notice Implements the checked subtraction operation (-) in the UD60x18 type.\\nfunction sub(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() - y.unwrap());\\n}\\n\\n/// @notice Implements the unchecked addition operation (+) in the UD60x18 type.\\nfunction uncheckedAdd(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() + y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the unchecked subtraction operation (-) in the UD60x18 type.\\nfunction uncheckedSub(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() - y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the XOR (^) bitwise operation in the UD60x18 type.\\nfunction xor(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() ^ y.unwrap());\\n}\\n\",\"keccak256\":\"0xf5faff881391d2c060029499a666cc5f0bea90a213150bb476fae8f02a5df268\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as Errors;\\nimport { wrap } from \\\"./Casting.sol\\\";\\nimport {\\n uEXP_MAX_INPUT,\\n uEXP2_MAX_INPUT,\\n uHALF_UNIT,\\n uLOG2_10,\\n uLOG2_E,\\n uMAX_UD60x18,\\n uMAX_WHOLE_UD60x18,\\n UNIT,\\n uUNIT,\\n uUNIT_SQUARED,\\n ZERO\\n} from \\\"./Constants.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n MATHEMATICAL FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @notice Calculates the arithmetic average of x and y using the following formula:\\n///\\n/// $$\\n/// avg(x, y) = (x & y) + ((xUint ^ yUint) / 2)\\n/// $$\\n///\\n/// In English, this is what this formula does:\\n///\\n/// 1. AND x and y.\\n/// 2. Calculate half of XOR x and y.\\n/// 3. Add the two results together.\\n///\\n/// This technique is known as SWAR, which stands for \\\"SIMD within a register\\\". You can read more about it here:\\n/// https://devblogs.microsoft.com/oldnewthing/20220207-00/?p=106223\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// @param x The first operand as a UD60x18 number.\\n/// @param y The second operand as a UD60x18 number.\\n/// @return result The arithmetic average as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction avg(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n uint256 yUint = y.unwrap();\\n unchecked {\\n result = wrap((xUint & yUint) + ((xUint ^ yUint) >> 1));\\n }\\n}\\n\\n/// @notice Yields the smallest whole number greater than or equal to x.\\n///\\n/// @dev This is optimized for fractional value inputs, because for every whole value there are (1e18 - 1) fractional\\n/// counterparts. See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n///\\n/// Requirements:\\n/// - x must be less than or equal to `MAX_WHOLE_UD60x18`.\\n///\\n/// @param x The UD60x18 number to ceil.\\n/// @param result The smallest whole number greater than or equal to x, as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ceil(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n if (xUint > uMAX_WHOLE_UD60x18) {\\n revert Errors.PRBMath_UD60x18_Ceil_Overflow(x);\\n }\\n\\n assembly (\\\"memory-safe\\\") {\\n // Equivalent to `x % UNIT`.\\n let remainder := mod(x, uUNIT)\\n\\n // Equivalent to `UNIT - remainder`.\\n let delta := sub(uUNIT, remainder)\\n\\n // Equivalent to `x + remainder > 0 ? delta : 0`.\\n result := add(x, mul(delta, gt(remainder, 0)))\\n }\\n}\\n\\n/// @notice Divides two UD60x18 numbers, returning a new UD60x18 number.\\n///\\n/// @dev Uses {Common.mulDiv} to enable overflow-safe multiplication and division.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv}.\\n///\\n/// @param x The numerator as a UD60x18 number.\\n/// @param y The denominator as a UD60x18 number.\\n/// @param result The quotient as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction div(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(Common.mulDiv(x.unwrap(), uUNIT, y.unwrap()));\\n}\\n\\n/// @notice Calculates the natural exponent of x using the following formula:\\n///\\n/// $$\\n/// e^x = 2^{x * log_2{e}}\\n/// $$\\n///\\n/// @dev Requirements:\\n/// - x must be less than 133_084258667509499441.\\n///\\n/// @param x The exponent as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n // This check prevents values greater than 192e18 from being passed to {exp2}.\\n if (xUint > uEXP_MAX_INPUT) {\\n revert Errors.PRBMath_UD60x18_Exp_InputTooBig(x);\\n }\\n\\n unchecked {\\n // Inline the fixed-point multiplication to save gas.\\n uint256 doubleUnitProduct = xUint * uLOG2_E;\\n result = exp2(wrap(doubleUnitProduct / uUNIT));\\n }\\n}\\n\\n/// @notice Calculates the binary exponent of x using the binary fraction method.\\n///\\n/// @dev See https://ethereum.stackexchange.com/q/79903/24693\\n///\\n/// Requirements:\\n/// - x must be less than 192e18.\\n/// - The result must fit in UD60x18.\\n///\\n/// @param x The exponent as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp2(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n // Numbers greater than or equal to 192e18 don't fit in the 192.64-bit format.\\n if (xUint > uEXP2_MAX_INPUT) {\\n revert Errors.PRBMath_UD60x18_Exp2_InputTooBig(x);\\n }\\n\\n // Convert x to the 192.64-bit fixed-point format.\\n uint256 x_192x64 = (xUint << 64) / uUNIT;\\n\\n // Pass x to the {Common.exp2} function, which uses the 192.64-bit fixed-point number representation.\\n result = wrap(Common.exp2(x_192x64));\\n}\\n\\n/// @notice Yields the greatest whole number less than or equal to x.\\n/// @dev Optimized for fractional value inputs, because every whole value has (1e18 - 1) fractional counterparts.\\n/// See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n/// @param x The UD60x18 number to floor.\\n/// @param result The greatest whole number less than or equal to x, as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction floor(UD60x18 x) pure returns (UD60x18 result) {\\n assembly (\\\"memory-safe\\\") {\\n // Equivalent to `x % UNIT`.\\n let remainder := mod(x, uUNIT)\\n\\n // Equivalent to `x - remainder > 0 ? remainder : 0)`.\\n result := sub(x, mul(remainder, gt(remainder, 0)))\\n }\\n}\\n\\n/// @notice Yields the excess beyond the floor of x using the odd function definition.\\n/// @dev See https://en.wikipedia.org/wiki/Fractional_part.\\n/// @param x The UD60x18 number to get the fractional part of.\\n/// @param result The fractional part of x as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction frac(UD60x18 x) pure returns (UD60x18 result) {\\n assembly (\\\"memory-safe\\\") {\\n result := mod(x, uUNIT)\\n }\\n}\\n\\n/// @notice Calculates the geometric mean of x and y, i.e. $\\\\sqrt{x * y}$, rounding down.\\n///\\n/// @dev Requirements:\\n/// - x * y must fit in UD60x18.\\n///\\n/// @param x The first operand as a UD60x18 number.\\n/// @param y The second operand as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction gm(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n uint256 yUint = y.unwrap();\\n if (xUint == 0 || yUint == 0) {\\n return ZERO;\\n }\\n\\n unchecked {\\n // Checking for overflow this way is faster than letting Solidity do it.\\n uint256 xyUint = xUint * yUint;\\n if (xyUint / xUint != yUint) {\\n revert Errors.PRBMath_UD60x18_Gm_Overflow(x, y);\\n }\\n\\n // We don't need to multiply the result by `UNIT` here because the x*y product picked up a factor of `UNIT`\\n // during multiplication. See the comments in {Common.sqrt}.\\n result = wrap(Common.sqrt(xyUint));\\n }\\n}\\n\\n/// @notice Calculates the inverse of x.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x must not be zero.\\n///\\n/// @param x The UD60x18 number for which to calculate the inverse.\\n/// @return result The inverse as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction inv(UD60x18 x) pure returns (UD60x18 result) {\\n unchecked {\\n result = wrap(uUNIT_SQUARED / x.unwrap());\\n }\\n}\\n\\n/// @notice Calculates the natural logarithm of x using the following formula:\\n///\\n/// $$\\n/// ln{x} = log_2{x} / log_2{e}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n/// - The precision isn't sufficiently fine-grained to return exactly `UNIT` when the input is `E`.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The UD60x18 number for which to calculate the natural logarithm.\\n/// @return result The natural logarithm as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ln(UD60x18 x) pure returns (UD60x18 result) {\\n unchecked {\\n // Inline the fixed-point multiplication to save gas. This is overflow-safe because the maximum value that\\n // {log2} can return is ~196_205294292027477728.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_E);\\n }\\n}\\n\\n/// @notice Calculates the common logarithm of x using the following formula:\\n///\\n/// $$\\n/// log_{10}{x} = log_2{x} / log_2{10}\\n/// $$\\n///\\n/// However, if x is an exact power of ten, a hard coded value is returned.\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The UD60x18 number for which to calculate the common logarithm.\\n/// @return result The common logarithm as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log10(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n if (xUint < uUNIT) {\\n revert Errors.PRBMath_UD60x18_Log_InputTooSmall(x);\\n }\\n\\n // Note that the `mul` in this assembly block is the standard multiplication operation, not {UD60x18.mul}.\\n // prettier-ignore\\n assembly (\\\"memory-safe\\\") {\\n switch x\\n case 1 { result := mul(uUNIT, sub(0, 18)) }\\n case 10 { result := mul(uUNIT, sub(1, 18)) }\\n case 100 { result := mul(uUNIT, sub(2, 18)) }\\n case 1000 { result := mul(uUNIT, sub(3, 18)) }\\n case 10000 { result := mul(uUNIT, sub(4, 18)) }\\n case 100000 { result := mul(uUNIT, sub(5, 18)) }\\n case 1000000 { result := mul(uUNIT, sub(6, 18)) }\\n case 10000000 { result := mul(uUNIT, sub(7, 18)) }\\n case 100000000 { result := mul(uUNIT, sub(8, 18)) }\\n case 1000000000 { result := mul(uUNIT, sub(9, 18)) }\\n case 10000000000 { result := mul(uUNIT, sub(10, 18)) }\\n case 100000000000 { result := mul(uUNIT, sub(11, 18)) }\\n case 1000000000000 { result := mul(uUNIT, sub(12, 18)) }\\n case 10000000000000 { result := mul(uUNIT, sub(13, 18)) }\\n case 100000000000000 { result := mul(uUNIT, sub(14, 18)) }\\n case 1000000000000000 { result := mul(uUNIT, sub(15, 18)) }\\n case 10000000000000000 { result := mul(uUNIT, sub(16, 18)) }\\n case 100000000000000000 { result := mul(uUNIT, sub(17, 18)) }\\n case 1000000000000000000 { result := 0 }\\n case 10000000000000000000 { result := uUNIT }\\n case 100000000000000000000 { result := mul(uUNIT, 2) }\\n case 1000000000000000000000 { result := mul(uUNIT, 3) }\\n case 10000000000000000000000 { result := mul(uUNIT, 4) }\\n case 100000000000000000000000 { result := mul(uUNIT, 5) }\\n case 1000000000000000000000000 { result := mul(uUNIT, 6) }\\n case 10000000000000000000000000 { result := mul(uUNIT, 7) }\\n case 100000000000000000000000000 { result := mul(uUNIT, 8) }\\n case 1000000000000000000000000000 { result := mul(uUNIT, 9) }\\n case 10000000000000000000000000000 { result := mul(uUNIT, 10) }\\n case 100000000000000000000000000000 { result := mul(uUNIT, 11) }\\n case 1000000000000000000000000000000 { result := mul(uUNIT, 12) }\\n case 10000000000000000000000000000000 { result := mul(uUNIT, 13) }\\n case 100000000000000000000000000000000 { result := mul(uUNIT, 14) }\\n case 1000000000000000000000000000000000 { result := mul(uUNIT, 15) }\\n case 10000000000000000000000000000000000 { result := mul(uUNIT, 16) }\\n case 100000000000000000000000000000000000 { result := mul(uUNIT, 17) }\\n case 1000000000000000000000000000000000000 { result := mul(uUNIT, 18) }\\n case 10000000000000000000000000000000000000 { result := mul(uUNIT, 19) }\\n case 100000000000000000000000000000000000000 { result := mul(uUNIT, 20) }\\n case 1000000000000000000000000000000000000000 { result := mul(uUNIT, 21) }\\n case 10000000000000000000000000000000000000000 { result := mul(uUNIT, 22) }\\n case 100000000000000000000000000000000000000000 { result := mul(uUNIT, 23) }\\n case 1000000000000000000000000000000000000000000 { result := mul(uUNIT, 24) }\\n case 10000000000000000000000000000000000000000000 { result := mul(uUNIT, 25) }\\n case 100000000000000000000000000000000000000000000 { result := mul(uUNIT, 26) }\\n case 1000000000000000000000000000000000000000000000 { result := mul(uUNIT, 27) }\\n case 10000000000000000000000000000000000000000000000 { result := mul(uUNIT, 28) }\\n case 100000000000000000000000000000000000000000000000 { result := mul(uUNIT, 29) }\\n case 1000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 30) }\\n case 10000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 31) }\\n case 100000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 32) }\\n case 1000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 33) }\\n case 10000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 34) }\\n case 100000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 35) }\\n case 1000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 36) }\\n case 10000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 37) }\\n case 100000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 38) }\\n case 1000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 39) }\\n case 10000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 40) }\\n case 100000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 41) }\\n case 1000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 42) }\\n case 10000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 43) }\\n case 100000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 44) }\\n case 1000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 45) }\\n case 10000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 46) }\\n case 100000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 47) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 48) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 49) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 50) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 51) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 52) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 53) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 54) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 55) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 56) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 57) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 58) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 59) }\\n default { result := uMAX_UD60x18 }\\n }\\n\\n if (result.unwrap() == uMAX_UD60x18) {\\n unchecked {\\n // Inline the fixed-point division to save gas.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_10);\\n }\\n }\\n}\\n\\n/// @notice Calculates the binary logarithm of x using the iterative approximation algorithm:\\n///\\n/// $$\\n/// log_2{x} = n + log_2{y}, \\\\text{ where } y = x*2^{-n}, \\\\ y \\\\in [1, 2)\\n/// $$\\n///\\n/// For $0 \\\\leq x \\\\lt 1$, the input is inverted:\\n///\\n/// $$\\n/// log_2{x} = -log_2{\\\\frac{1}{x}}\\n/// $$\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Binary_logarithm#Iterative_approximation\\n///\\n/// Notes:\\n/// - Due to the lossy precision of the iterative approximation, the results are not perfectly accurate to the last decimal.\\n///\\n/// Requirements:\\n/// - x must be greater than zero.\\n///\\n/// @param x The UD60x18 number for which to calculate the binary logarithm.\\n/// @return result The binary logarithm as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log2(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n if (xUint < uUNIT) {\\n revert Errors.PRBMath_UD60x18_Log_InputTooSmall(x);\\n }\\n\\n unchecked {\\n // Calculate the integer part of the logarithm.\\n uint256 n = Common.msb(xUint / uUNIT);\\n\\n // This is the integer part of the logarithm as a UD60x18 number. The operation can't overflow because n\\n // n is at most 255 and UNIT is 1e18.\\n uint256 resultUint = n * uUNIT;\\n\\n // Calculate $y = x * 2^{-n}$.\\n uint256 y = xUint >> n;\\n\\n // If y is the unit number, the fractional part is zero.\\n if (y == uUNIT) {\\n return wrap(resultUint);\\n }\\n\\n // Calculate the fractional part via the iterative approximation.\\n // The `delta >>= 1` part is equivalent to `delta /= 2`, but shifting bits is more gas efficient.\\n uint256 DOUBLE_UNIT = 2e18;\\n for (uint256 delta = uHALF_UNIT; delta > 0; delta >>= 1) {\\n y = (y * y) / uUNIT;\\n\\n // Is y^2 >= 2e18 and so in the range [2e18, 4e18)?\\n if (y >= DOUBLE_UNIT) {\\n // Add the 2^{-m} factor to the logarithm.\\n resultUint += delta;\\n\\n // Halve y, which corresponds to z/2 in the Wikipedia article.\\n y >>= 1;\\n }\\n }\\n result = wrap(resultUint);\\n }\\n}\\n\\n/// @notice Multiplies two UD60x18 numbers together, returning a new UD60x18 number.\\n///\\n/// @dev Uses {Common.mulDiv} to enable overflow-safe multiplication and division.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv}.\\n///\\n/// @dev See the documentation in {Common.mulDiv18}.\\n/// @param x The multiplicand as a UD60x18 number.\\n/// @param y The multiplier as a UD60x18 number.\\n/// @return result The product as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mul(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(Common.mulDiv18(x.unwrap(), y.unwrap()));\\n}\\n\\n/// @notice Raises x to the power of y.\\n///\\n/// For $1 \\\\leq x \\\\leq \\\\infty$, the following standard formula is used:\\n///\\n/// $$\\n/// x^y = 2^{log_2{x} * y}\\n/// $$\\n///\\n/// For $0 \\\\leq x \\\\lt 1$, since the unsigned {log2} is undefined, an equivalent formula is used:\\n///\\n/// $$\\n/// i = \\\\frac{1}{x}\\n/// w = 2^{log_2{i} * y}\\n/// x^y = \\\\frac{1}{w}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2} and {mul}.\\n/// - Returns `UNIT` for 0^0.\\n/// - It may not perform well with very small values of x. Consider using SD59x18 as an alternative.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {exp2}, {log2}, and {mul}.\\n///\\n/// @param x The base as a UD60x18 number.\\n/// @param y The exponent as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction pow(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n uint256 yUint = y.unwrap();\\n\\n // If both x and y are zero, the result is `UNIT`. If just x is zero, the result is always zero.\\n if (xUint == 0) {\\n return yUint == 0 ? UNIT : ZERO;\\n }\\n // If x is `UNIT`, the result is always `UNIT`.\\n else if (xUint == uUNIT) {\\n return UNIT;\\n }\\n\\n // If y is zero, the result is always `UNIT`.\\n if (yUint == 0) {\\n return UNIT;\\n }\\n // If y is `UNIT`, the result is always x.\\n else if (yUint == uUNIT) {\\n return x;\\n }\\n\\n // If x is greater than `UNIT`, use the standard formula.\\n if (xUint > uUNIT) {\\n result = exp2(mul(log2(x), y));\\n }\\n // Conversely, if x is less than `UNIT`, use the equivalent formula.\\n else {\\n UD60x18 i = wrap(uUNIT_SQUARED / xUint);\\n UD60x18 w = exp2(mul(log2(i), y));\\n result = wrap(uUNIT_SQUARED / w.unwrap());\\n }\\n}\\n\\n/// @notice Raises x (a UD60x18 number) to the power y (an unsigned basic integer) using the well-known\\n/// algorithm \\\"exponentiation by squaring\\\".\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Exponentiation_by_squaring.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv18}.\\n/// - Returns `UNIT` for 0^0.\\n///\\n/// Requirements:\\n/// - The result must fit in UD60x18.\\n///\\n/// @param x The base as a UD60x18 number.\\n/// @param y The exponent as a uint256.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction powu(UD60x18 x, uint256 y) pure returns (UD60x18 result) {\\n // Calculate the first iteration of the loop in advance.\\n uint256 xUint = x.unwrap();\\n uint256 resultUint = y & 1 > 0 ? xUint : uUNIT;\\n\\n // Equivalent to `for(y /= 2; y > 0; y /= 2)`.\\n for (y >>= 1; y > 0; y >>= 1) {\\n xUint = Common.mulDiv18(xUint, xUint);\\n\\n // Equivalent to `y % 2 == 1`.\\n if (y & 1 > 0) {\\n resultUint = Common.mulDiv18(resultUint, xUint);\\n }\\n }\\n result = wrap(resultUint);\\n}\\n\\n/// @notice Calculates the square root of x using the Babylonian method.\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\\n///\\n/// Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x must be less than `MAX_UD60x18 / UNIT`.\\n///\\n/// @param x The UD60x18 number for which to calculate the square root.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction sqrt(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n unchecked {\\n if (xUint > uMAX_UD60x18 / uUNIT) {\\n revert Errors.PRBMath_UD60x18_Sqrt_Overflow(x);\\n }\\n // Multiply x by `UNIT` to account for the factor of `UNIT` picked up when multiplying two UD60x18 numbers.\\n // In this case, the two numbers are both the square root.\\n result = wrap(Common.sqrt(xUint * uUNIT));\\n }\\n}\\n\",\"keccak256\":\"0x462144667aac3f96d5f8dba7aa68fe4c5a3f61e1d7bbbc81bee21168817f9c09\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\nimport \\\"./Helpers.sol\\\" as Helpers;\\nimport \\\"./Math.sol\\\" as Math;\\n\\n/// @notice The unsigned 60.18-decimal fixed-point number representation, which can have up to 60 digits and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the Solidity type uint256.\\n/// @dev The value type is defined here so it can be imported in all other files.\\ntype UD60x18 is uint256;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoSD1x18,\\n Casting.intoUD2x18,\\n Casting.intoSD59x18,\\n Casting.intoUint128,\\n Casting.intoUint256,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for UD60x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n MATHEMATICAL FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes the functions in this library callable on the UD60x18 type.\\nusing {\\n Math.avg,\\n Math.ceil,\\n Math.div,\\n Math.exp,\\n Math.exp2,\\n Math.floor,\\n Math.frac,\\n Math.gm,\\n Math.inv,\\n Math.ln,\\n Math.log10,\\n Math.log2,\\n Math.mul,\\n Math.pow,\\n Math.powu,\\n Math.sqrt\\n} for UD60x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n HELPER FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes the functions in this library callable on the UD60x18 type.\\nusing {\\n Helpers.add,\\n Helpers.and,\\n Helpers.eq,\\n Helpers.gt,\\n Helpers.gte,\\n Helpers.isZero,\\n Helpers.lshift,\\n Helpers.lt,\\n Helpers.lte,\\n Helpers.mod,\\n Helpers.neq,\\n Helpers.not,\\n Helpers.or,\\n Helpers.rshift,\\n Helpers.sub,\\n Helpers.uncheckedAdd,\\n Helpers.uncheckedSub,\\n Helpers.xor\\n} for UD60x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n OPERATORS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes it possible to use these operators on the UD60x18 type.\\nusing {\\n Helpers.add as +,\\n Helpers.and2 as &,\\n Math.div as /,\\n Helpers.eq as ==,\\n Helpers.gt as >,\\n Helpers.gte as >=,\\n Helpers.lt as <,\\n Helpers.lte as <=,\\n Helpers.or as |,\\n Helpers.mod as %,\\n Math.mul as *,\\n Helpers.neq as !=,\\n Helpers.not as ~,\\n Helpers.sub as -,\\n Helpers.xor as ^\\n} for UD60x18 global;\\n\",\"keccak256\":\"0xdd873b5124180d9b71498b3a7fe93b1c08c368bec741f7d5f8e17f78a0b70f31\",\"license\":\"MIT\"},\"contracts/interfaces/IERC6551Registry.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\ninterface IERC6551Registry {\\n /**\\n * @dev Creates a token bound account for a non-fungible token.\\n *\\n * If account has already been created, returns the account address without calling create2.\\n *\\n * Emits ERC6551AccountCreated event.\\n *\\n * @return account The address of the token bound account\\n */\\n function createAccount(\\n address implementation,\\n bytes32 salt,\\n uint256 chainId,\\n address tokenContract,\\n uint256 tokenId\\n ) external returns (address account);\\n}\\n\",\"keccak256\":\"0x64c52de8a8e68398e61dd8b42dda8e9af8cf6abf93bb85629c322440991ea568\",\"license\":\"MIT\"},\"contracts/interfaces/hats/HatsErrors.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface HatsErrors {\\n /// @notice Emitted when `user` is attempting to perform an action on `hatId` but is not wearing one of `hatId`'s admin hats\\n /// @dev Can be equivalent to `NotHatWearer(buildHatId(hatId))`, such as when emitted by `approveLinkTopHatToTree` or `relinkTopHatToTree`\\n error NotAdmin(address user, uint256 hatId);\\n\\n /// @notice Emitted when attempting to perform an action as or for an account that is not a wearer of a given hat\\n error NotHatWearer();\\n\\n /// @notice Emitted when attempting to perform an action that requires being either an admin or wearer of a given hat\\n error NotAdminOrWearer();\\n\\n /// @notice Emitted when attempting to mint `hatId` but `hatId`'s maxSupply has been reached\\n error AllHatsWorn(uint256 hatId);\\n\\n /// @notice Emitted when attempting to create a hat with a level 14 hat as its admin\\n error MaxLevelsReached();\\n\\n /// @notice Emitted when an attempted hat id has empty intermediate level(s)\\n error InvalidHatId();\\n\\n /// @notice Emitted when attempting to mint `hatId` to a `wearer` who is already wearing the hat\\n error AlreadyWearingHat(address wearer, uint256 hatId);\\n\\n /// @notice Emitted when attempting to mint a non-existant hat\\n error HatDoesNotExist(uint256 hatId);\\n\\n /// @notice Emmitted when attempting to mint or transfer a hat that is not active\\n error HatNotActive();\\n\\n /// @notice Emitted when attempting to mint or transfer a hat to an ineligible wearer\\n error NotEligible();\\n\\n /// @notice Emitted when attempting to check or set a hat's status from an account that is not that hat's toggle module\\n error NotHatsToggle();\\n\\n /// @notice Emitted when attempting to check or set a hat wearer's status from an account that is not that hat's eligibility module\\n error NotHatsEligibility();\\n\\n /// @notice Emitted when array arguments to a batch function have mismatching lengths\\n error BatchArrayLengthMismatch();\\n\\n /// @notice Emitted when attempting to mutate or transfer an immutable hat\\n error Immutable();\\n\\n /// @notice Emitted when attempting to change a hat's maxSupply to a value lower than its current supply\\n error NewMaxSupplyTooLow();\\n\\n /// @notice Emitted when attempting to link a tophat to a new admin for which the tophat serves as an admin\\n error CircularLinkage();\\n\\n /// @notice Emitted when attempting to link or relink a tophat to a separate tree\\n error CrossTreeLinkage();\\n\\n /// @notice Emitted when attempting to link a tophat without a request\\n error LinkageNotRequested();\\n\\n /// @notice Emitted when attempting to unlink a tophat that does not have a wearer\\n /// @dev This ensures that unlinking never results in a bricked tophat\\n error InvalidUnlink();\\n\\n /// @notice Emmited when attempting to change a hat's eligibility or toggle module to the zero address\\n error ZeroAddress();\\n\\n /// @notice Emmitted when attempting to change a hat's details or imageURI to a string with over 7000 bytes (~characters)\\n /// @dev This protects against a DOS attack where an admin iteratively extend's a hat's details or imageURI\\n /// to be so long that reading it exceeds the block gas limit, breaking `uri()` and `viewHat()`\\n error StringTooLong();\\n}\\n\",\"keccak256\":\"0x81b0056b7bed86eabc07c0e4a9655c586ddb8e6c128320593669b76efd5a08de\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/HatsEvents.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface HatsEvents {\\n /// @notice Emitted when a new hat is created\\n /// @param id The id for the new hat\\n /// @param details A description of the Hat\\n /// @param maxSupply The total instances of the Hat that can be worn at once\\n /// @param eligibility The address that can report on the Hat wearer's status\\n /// @param toggle The address that can deactivate the Hat\\n /// @param mutable_ Whether the hat's properties are changeable after creation\\n /// @param imageURI The image uri for this hat and the fallback for its\\n event HatCreated(\\n uint256 id,\\n string details,\\n uint32 maxSupply,\\n address eligibility,\\n address toggle,\\n bool mutable_,\\n string imageURI\\n );\\n\\n /// @notice Emitted when a hat wearer's standing is updated\\n /// @dev Eligibility is excluded since the source of truth for eligibility is the eligibility module and may change without a transaction\\n /// @param hatId The id of the wearer's hat\\n /// @param wearer The wearer's address\\n /// @param wearerStanding Whether the wearer is in good standing for the hat\\n event WearerStandingChanged(\\n uint256 hatId,\\n address wearer,\\n bool wearerStanding\\n );\\n\\n /// @notice Emitted when a hat's status is updated\\n /// @param hatId The id of the hat\\n /// @param newStatus Whether the hat is active\\n event HatStatusChanged(uint256 hatId, bool newStatus);\\n\\n /// @notice Emitted when a hat's details are updated\\n /// @param hatId The id of the hat\\n /// @param newDetails The updated details\\n event HatDetailsChanged(uint256 hatId, string newDetails);\\n\\n /// @notice Emitted when a hat's eligibility module is updated\\n /// @param hatId The id of the hat\\n /// @param newEligibility The updated eligibiliy module\\n event HatEligibilityChanged(uint256 hatId, address newEligibility);\\n\\n /// @notice Emitted when a hat's toggle module is updated\\n /// @param hatId The id of the hat\\n /// @param newToggle The updated toggle module\\n event HatToggleChanged(uint256 hatId, address newToggle);\\n\\n /// @notice Emitted when a hat's mutability is updated\\n /// @param hatId The id of the hat\\n event HatMutabilityChanged(uint256 hatId);\\n\\n /// @notice Emitted when a hat's maximum supply is updated\\n /// @param hatId The id of the hat\\n /// @param newMaxSupply The updated max supply\\n event HatMaxSupplyChanged(uint256 hatId, uint32 newMaxSupply);\\n\\n /// @notice Emitted when a hat's image URI is updated\\n /// @param hatId The id of the hat\\n /// @param newImageURI The updated image URI\\n event HatImageURIChanged(uint256 hatId, string newImageURI);\\n\\n /// @notice Emitted when a tophat linkage is requested by its admin\\n /// @param domain The domain of the tree tophat to link\\n /// @param newAdmin The tophat's would-be admin in the parent tree\\n event TopHatLinkRequested(uint32 domain, uint256 newAdmin);\\n\\n /// @notice Emitted when a tophat is linked to a another tree\\n /// @param domain The domain of the newly-linked tophat\\n /// @param newAdmin The tophat's new admin in the parent tree\\n event TopHatLinked(uint32 domain, uint256 newAdmin);\\n}\\n\",\"keccak256\":\"0x53413397d15e1636c3cd7bd667656b79bc2886785403b824bcd4ed122667f2c6\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/IHats.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\nimport \\\"./IHatsIdUtilities.sol\\\";\\nimport \\\"./HatsErrors.sol\\\";\\nimport \\\"./HatsEvents.sol\\\";\\n\\ninterface IHats is IHatsIdUtilities, HatsErrors, HatsEvents {\\n function mintTopHat(\\n address _target,\\n string memory _details,\\n string memory _imageURI\\n ) external returns (uint256 topHatId);\\n\\n function createHat(\\n uint256 _admin,\\n string calldata _details,\\n uint32 _maxSupply,\\n address _eligibility,\\n address _toggle,\\n bool _mutable,\\n string calldata _imageURI\\n ) external returns (uint256 newHatId);\\n\\n function batchCreateHats(\\n uint256[] calldata _admins,\\n string[] calldata _details,\\n uint32[] calldata _maxSupplies,\\n address[] memory _eligibilityModules,\\n address[] memory _toggleModules,\\n bool[] calldata _mutables,\\n string[] calldata _imageURIs\\n ) external returns (bool success);\\n\\n function getNextId(uint256 _admin) external view returns (uint256 nextId);\\n\\n function mintHat(\\n uint256 _hatId,\\n address _wearer\\n ) external returns (bool success);\\n\\n function batchMintHats(\\n uint256[] calldata _hatIds,\\n address[] calldata _wearers\\n ) external returns (bool success);\\n\\n function setHatStatus(\\n uint256 _hatId,\\n bool _newStatus\\n ) external returns (bool toggled);\\n\\n function checkHatStatus(uint256 _hatId) external returns (bool toggled);\\n\\n function setHatWearerStatus(\\n uint256 _hatId,\\n address _wearer,\\n bool _eligible,\\n bool _standing\\n ) external returns (bool updated);\\n\\n function checkHatWearerStatus(\\n uint256 _hatId,\\n address _wearer\\n ) external returns (bool updated);\\n\\n function renounceHat(uint256 _hatId) external;\\n\\n function transferHat(uint256 _hatId, address _from, address _to) external;\\n\\n /*//////////////////////////////////////////////////////////////\\n HATS ADMIN FUNCTIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n function makeHatImmutable(uint256 _hatId) external;\\n\\n function changeHatDetails(\\n uint256 _hatId,\\n string memory _newDetails\\n ) external;\\n\\n function changeHatEligibility(\\n uint256 _hatId,\\n address _newEligibility\\n ) external;\\n\\n function changeHatToggle(uint256 _hatId, address _newToggle) external;\\n\\n function changeHatImageURI(\\n uint256 _hatId,\\n string memory _newImageURI\\n ) external;\\n\\n function changeHatMaxSupply(uint256 _hatId, uint32 _newMaxSupply) external;\\n\\n function requestLinkTopHatToTree(\\n uint32 _topHatId,\\n uint256 _newAdminHat\\n ) external;\\n\\n function approveLinkTopHatToTree(\\n uint32 _topHatId,\\n uint256 _newAdminHat,\\n address _eligibility,\\n address _toggle,\\n string calldata _details,\\n string calldata _imageURI\\n ) external;\\n\\n function unlinkTopHatFromTree(uint32 _topHatId, address _wearer) external;\\n\\n function relinkTopHatWithinTree(\\n uint32 _topHatDomain,\\n uint256 _newAdminHat,\\n address _eligibility,\\n address _toggle,\\n string calldata _details,\\n string calldata _imageURI\\n ) external;\\n\\n /*//////////////////////////////////////////////////////////////\\n VIEW FUNCTIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n function viewHat(\\n uint256 _hatId\\n )\\n external\\n view\\n returns (\\n string memory details,\\n uint32 maxSupply,\\n uint32 supply,\\n address eligibility,\\n address toggle,\\n string memory imageURI,\\n uint16 lastHatId,\\n bool mutable_,\\n bool active\\n );\\n\\n function isWearerOfHat(\\n address _user,\\n uint256 _hatId\\n ) external view returns (bool isWearer);\\n\\n function isAdminOfHat(\\n address _user,\\n uint256 _hatId\\n ) external view returns (bool isAdmin);\\n\\n function isInGoodStanding(\\n address _wearer,\\n uint256 _hatId\\n ) external view returns (bool standing);\\n\\n function isEligible(\\n address _wearer,\\n uint256 _hatId\\n ) external view returns (bool eligible);\\n\\n function getHatEligibilityModule(\\n uint256 _hatId\\n ) external view returns (address eligibility);\\n\\n function getHatToggleModule(\\n uint256 _hatId\\n ) external view returns (address toggle);\\n\\n function getHatMaxSupply(\\n uint256 _hatId\\n ) external view returns (uint32 maxSupply);\\n\\n function hatSupply(uint256 _hatId) external view returns (uint32 supply);\\n\\n function getImageURIForHat(\\n uint256 _hatId\\n ) external view returns (string memory _uri);\\n\\n function balanceOf(\\n address wearer,\\n uint256 hatId\\n ) external view returns (uint256 balance);\\n\\n function balanceOfBatch(\\n address[] calldata _wearers,\\n uint256[] calldata _hatIds\\n ) external view returns (uint256[] memory);\\n\\n function uri(uint256 id) external view returns (string memory _uri);\\n}\\n\",\"keccak256\":\"0x2867004bddc5148fa1937f25c0403e5d9977583aaf50fdbdb74bd463f64f21c8\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/IHatsIdUtilities.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface IHatsIdUtilities {\\n function buildHatId(\\n uint256 _admin,\\n uint16 _newHat\\n ) external pure returns (uint256 id);\\n\\n function getHatLevel(uint256 _hatId) external view returns (uint32 level);\\n\\n function getLocalHatLevel(\\n uint256 _hatId\\n ) external pure returns (uint32 level);\\n\\n function isTopHat(uint256 _hatId) external view returns (bool _topHat);\\n\\n function isLocalTopHat(\\n uint256 _hatId\\n ) external pure returns (bool _localTopHat);\\n\\n function isValidHatId(\\n uint256 _hatId\\n ) external view returns (bool validHatId);\\n\\n function getAdminAtLevel(\\n uint256 _hatId,\\n uint32 _level\\n ) external view returns (uint256 admin);\\n\\n function getAdminAtLocalLevel(\\n uint256 _hatId,\\n uint32 _level\\n ) external pure returns (uint256 admin);\\n\\n function getTopHatDomain(\\n uint256 _hatId\\n ) external view returns (uint32 domain);\\n\\n function getTippyTopHatDomain(\\n uint32 _topHatDomain\\n ) external view returns (uint32 domain);\\n\\n function noCircularLinkage(\\n uint32 _topHatDomain,\\n uint256 _linkedAdmin\\n ) external view returns (bool notCircular);\\n\\n function sameTippyTopHatDomain(\\n uint32 _topHatDomain,\\n uint256 _newAdminHat\\n ) external view returns (bool sameDomain);\\n}\\n\",\"keccak256\":\"0x007fcc07b20bf84bacad1f9a2ddf4e30e1a8be961e144b7bef8e98a51781aee9\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/IHatsModuleFactory.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.19;\\n\\ninterface IHatsModuleFactory {\\n error HatsModuleFactory_ModuleAlreadyDeployed(\\n address implementation,\\n uint256 hatId,\\n bytes otherImmutableArgs,\\n uint256 saltNonce\\n );\\n\\n error BatchArrayLengthMismatch();\\n\\n event HatsModuleFactory_ModuleDeployed(\\n address implementation,\\n address instance,\\n uint256 hatId,\\n bytes otherImmutableArgs,\\n bytes initData,\\n uint256 saltNonce\\n );\\n\\n function HATS() external view returns (address);\\n\\n function version() external view returns (string memory);\\n\\n function createHatsModule(\\n address _implementation,\\n uint256 _hatId,\\n bytes calldata _otherImmutableArgs,\\n bytes calldata _initData,\\n uint256 _saltNonce\\n ) external returns (address _instance);\\n\\n function batchCreateHatsModule(\\n address[] calldata _implementations,\\n uint256[] calldata _hatIds,\\n bytes[] calldata _otherImmutableArgsArray,\\n bytes[] calldata _initDataArray,\\n uint256[] calldata _saltNonces\\n ) external returns (bool success);\\n\\n function getHatsModuleAddress(\\n address _implementation,\\n uint256 _hatId,\\n bytes calldata _otherImmutableArgs,\\n uint256 _saltNonce\\n ) external view returns (address);\\n\\n function deployed(\\n address _implementation,\\n uint256 _hatId,\\n bytes calldata _otherImmutableArgs,\\n uint256 _saltNonce\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x861faf40785cedb829243116d492653414a367853408a5c27d201522f6c3bfdd\",\"license\":\"MIT\"},\"contracts/interfaces/sablier/IAdminable.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\n/// @title IAdminable\\n/// @notice Contract module that provides a basic access control mechanism, with an admin that can be\\n/// granted exclusive access to specific functions. The inheriting contract must set the initial admin\\n/// in the constructor.\\ninterface IAdminable {\\n /*//////////////////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Emitted when the admin is transferred.\\n /// @param oldAdmin The address of the old admin.\\n /// @param newAdmin The address of the new admin.\\n event TransferAdmin(address indexed oldAdmin, address indexed newAdmin);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice The address of the admin account or contract.\\n function admin() external view returns (address);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n NON-CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Transfers the contract admin to a new address.\\n ///\\n /// @dev Notes:\\n /// - Does not revert if the admin is the same.\\n /// - This function can potentially leave the contract without an admin, thereby removing any\\n /// functionality that is only available to the admin.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the contract admin.\\n ///\\n /// @param newAdmin The address of the new admin.\\n function transferAdmin(address newAdmin) external;\\n}\\n\",\"keccak256\":\"0xa279c49e51228b571329164e36250e82b2c1378e8b549194ab7dd90fca9c3b2b\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/IERC4096.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 \\\"@openzeppelin/contracts/interfaces/IERC165.sol\\\";\\nimport {IERC721} from \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\n\\n/// @title ERC-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\",\"keccak256\":\"0xa34b9c52cbe36be860244f52256f1b05badf0cb797d208664b87337610d0e82d\",\"license\":\"MIT\"},\"contracts/interfaces/sablier/ISablierV2Lockup.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC4906} from \\\"./IERC4096.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IERC721Metadata} from \\\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\\\";\\nimport {UD60x18} from \\\"@prb/math/src/UD60x18.sol\\\";\\n\\nimport {Lockup} from \\\"./types/DataTypes.sol\\\";\\nimport {IAdminable} from \\\"./IAdminable.sol\\\";\\nimport {ISablierV2NFTDescriptor} from \\\"./ISablierV2NFTDescriptor.sol\\\";\\n\\n/// @title ISablierV2Lockup\\n/// @notice Common logic between all Sablier V2 Lockup contracts.\\ninterface ISablierV2Lockup is\\n IAdminable, // 0 inherited components\\n IERC4906, // 2 inherited components\\n IERC721Metadata // 2 inherited components\\n{\\n /*//////////////////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Emitted when the admin allows a new recipient contract to hook to Sablier.\\n /// @param admin The address of the current contract admin.\\n /// @param recipient The address of the recipient contract put on the allowlist.\\n event AllowToHook(address indexed admin, address recipient);\\n\\n /// @notice Emitted when a stream is canceled.\\n /// @param streamId The ID of the stream.\\n /// @param sender The address of the stream's sender.\\n /// @param recipient The address of the stream's recipient.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param senderAmount The amount of assets refunded to the stream's sender, denoted in units of the asset's\\n /// decimals.\\n /// @param recipientAmount The amount of assets left for the stream's recipient to withdraw, denoted in units of the\\n /// asset's decimals.\\n event CancelLockupStream(\\n uint256 streamId,\\n address indexed sender,\\n address indexed recipient,\\n IERC20 indexed asset,\\n uint128 senderAmount,\\n uint128 recipientAmount\\n );\\n\\n /// @notice Emitted when a sender gives up the right to cancel a stream.\\n /// @param streamId The ID of the stream.\\n event RenounceLockupStream(uint256 indexed streamId);\\n\\n /// @notice Emitted when the admin sets a new NFT descriptor contract.\\n /// @param admin The address of the current contract admin.\\n /// @param oldNFTDescriptor The address of the old NFT descriptor contract.\\n /// @param newNFTDescriptor The address of the new NFT descriptor contract.\\n event SetNFTDescriptor(\\n address indexed admin,\\n ISablierV2NFTDescriptor oldNFTDescriptor,\\n ISablierV2NFTDescriptor newNFTDescriptor\\n );\\n\\n /// @notice Emitted when assets are withdrawn from a stream.\\n /// @param streamId The ID of the stream.\\n /// @param to The address that has received the withdrawn assets.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param amount The amount of assets withdrawn, denoted in units of the asset's decimals.\\n event WithdrawFromLockupStream(\\n uint256 indexed streamId,\\n address indexed to,\\n IERC20 indexed asset,\\n uint128 amount\\n );\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Retrieves the address of the ERC-20 asset to be distributed.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getAsset(uint256 streamId) external view returns (IERC20 asset);\\n\\n /// @notice Retrieves the amount deposited in the stream, denoted in units of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getDepositedAmount(\\n uint256 streamId\\n ) external view returns (uint128 depositedAmount);\\n\\n /// @notice Retrieves the stream's end time, which is a Unix timestamp.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getEndTime(\\n uint256 streamId\\n ) external view returns (uint40 endTime);\\n\\n /// @notice Retrieves the stream's recipient.\\n /// @dev Reverts if the NFT has been burned.\\n /// @param streamId The stream ID for the query.\\n function getRecipient(\\n uint256 streamId\\n ) external view returns (address recipient);\\n\\n /// @notice Retrieves the amount refunded to the sender after a cancellation, denoted in units of the asset's\\n /// decimals. This amount is always zero unless the stream was canceled.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getRefundedAmount(\\n uint256 streamId\\n ) external view returns (uint128 refundedAmount);\\n\\n /// @notice Retrieves the stream's sender.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getSender(uint256 streamId) external view returns (address sender);\\n\\n /// @notice Retrieves the stream's start time, which is a Unix timestamp.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getStartTime(\\n uint256 streamId\\n ) external view returns (uint40 startTime);\\n\\n /// @notice Retrieves the amount withdrawn from the stream, denoted in units of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getWithdrawnAmount(\\n uint256 streamId\\n ) external view returns (uint128 withdrawnAmount);\\n\\n /// @notice Retrieves a flag indicating whether the provided address is a contract allowed to hook to Sablier\\n /// when a stream is canceled or when assets are withdrawn.\\n /// @dev See {ISablierLockupRecipient} for more information.\\n function isAllowedToHook(\\n address recipient\\n ) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream can be canceled. When the stream is cold, this\\n /// flag is always `false`.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isCancelable(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream is cold, i.e. settled, canceled, or depleted.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isCold(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream is depleted.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isDepleted(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream exists.\\n /// @dev Does not revert if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isStream(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream NFT can be transferred.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isTransferable(\\n uint256 streamId\\n ) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream is warm, i.e. either pending or streaming.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isWarm(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves the maximum broker fee that can be charged by the broker, denoted as a fixed-point\\n /// number where 1e18 is 100%.\\n /// @dev This value is hard coded as a constant.\\n function MAX_BROKER_FEE() external view returns (UD60x18);\\n\\n /// @notice Counter for stream IDs, used in the create functions.\\n function nextStreamId() external view returns (uint256);\\n\\n /// @notice Contract that generates the non-fungible token URI.\\n function nftDescriptor() external view returns (ISablierV2NFTDescriptor);\\n\\n /// @notice Calculates the amount that the sender would be refunded if the stream were canceled, denoted in units\\n /// of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function refundableAmountOf(\\n uint256 streamId\\n ) external view returns (uint128 refundableAmount);\\n\\n /// @notice Retrieves the stream's status.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function statusOf(\\n uint256 streamId\\n ) external view returns (Lockup.Status status);\\n\\n /// @notice Calculates the amount streamed to the recipient, denoted in units of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n ///\\n /// Notes:\\n /// - Upon cancellation of the stream, the amount streamed is calculated as the difference between the deposited\\n /// amount and the refunded amount. Ultimately, when the stream becomes depleted, the streamed amount is equivalent\\n /// to the total amount withdrawn.\\n ///\\n /// @param streamId The stream ID for the query.\\n function streamedAmountOf(\\n uint256 streamId\\n ) external view returns (uint128 streamedAmount);\\n\\n /// @notice Retrieves a flag indicating whether the stream was canceled.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function wasCanceled(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Calculates the amount that the recipient can withdraw from the stream, denoted in units of the asset's\\n /// decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function withdrawableAmountOf(\\n uint256 streamId\\n ) external view returns (uint128 withdrawableAmount);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n NON-CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Allows a recipient contract to hook to Sablier when a stream is canceled or when assets are withdrawn.\\n /// Useful for implementing contracts that hold streams on behalf of users, such as vaults or staking contracts.\\n ///\\n /// @dev Emits an {AllowToHook} event.\\n ///\\n /// Notes:\\n /// - Does not revert if the contract is already on the allowlist.\\n /// - This is an irreversible operation. The contract cannot be removed from the allowlist.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the contract admin.\\n /// - `recipient` must have a non-zero code size.\\n /// - `recipient` must implement {ISablierLockupRecipient}.\\n ///\\n /// @param recipient The address of the contract to allow for hooks.\\n function allowToHook(address recipient) external;\\n\\n /// @notice Burns the NFT associated with the stream.\\n ///\\n /// @dev Emits a {Transfer} event.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `streamId` must reference a depleted stream.\\n /// - The NFT must exist.\\n /// - `msg.sender` must be either the NFT owner or an approved third party.\\n ///\\n /// @param streamId The ID of the stream NFT to burn.\\n function burn(uint256 streamId) external;\\n\\n /// @notice Cancels the stream and refunds any remaining assets to the sender.\\n ///\\n /// @dev Emits a {Transfer}, {CancelLockupStream}, and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - If there any assets left for the recipient to withdraw, the stream is marked as canceled. Otherwise, the\\n /// stream is marked as depleted.\\n /// - This function attempts to invoke a hook on the recipient, if the resolved address is a contract.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - The stream must be warm and cancelable.\\n /// - `msg.sender` must be the stream's sender.\\n ///\\n /// @param streamId The ID of the stream to cancel.\\n function cancel(uint256 streamId) external;\\n\\n /// @notice Cancels multiple streams and refunds any remaining assets to the sender.\\n ///\\n /// @dev Emits multiple {Transfer}, {CancelLockupStream}, and {MetadataUpdate} events.\\n ///\\n /// Notes:\\n /// - Refer to the notes in {cancel}.\\n ///\\n /// Requirements:\\n /// - All requirements from {cancel} must be met for each stream.\\n ///\\n /// @param streamIds The IDs of the streams to cancel.\\n function cancelMultiple(uint256[] calldata streamIds) external;\\n\\n /// @notice Removes the right of the stream's sender to cancel the stream.\\n ///\\n /// @dev Emits a {RenounceLockupStream} and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - This is an irreversible operation.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `streamId` must reference a warm stream.\\n /// - `msg.sender` must be the stream's sender.\\n /// - The stream must be cancelable.\\n ///\\n /// @param streamId The ID of the stream to renounce.\\n function renounce(uint256 streamId) external;\\n\\n /// @notice Sets a new NFT descriptor contract, which produces the URI describing the Sablier stream NFTs.\\n ///\\n /// @dev Emits a {SetNFTDescriptor} and {BatchMetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - Does not revert if the NFT descriptor is the same.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the contract admin.\\n ///\\n /// @param newNFTDescriptor The address of the new NFT descriptor contract.\\n function setNFTDescriptor(\\n ISablierV2NFTDescriptor newNFTDescriptor\\n ) external;\\n\\n /// @notice Withdraws the provided amount of assets from the stream to the `to` address.\\n ///\\n /// @dev Emits a {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - This function attempts to call a hook on the recipient of the stream, unless `msg.sender` is the recipient.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `streamId` must not reference a null or depleted stream.\\n /// - `to` must not be the zero address.\\n /// - `amount` must be greater than zero and must not exceed the withdrawable amount.\\n /// - `to` must be the recipient if `msg.sender` is not the stream's recipient or an approved third party.\\n ///\\n /// @param streamId The ID of the stream to withdraw from.\\n /// @param to The address receiving the withdrawn assets.\\n /// @param amount The amount to withdraw, denoted in units of the asset's decimals.\\n function withdraw(uint256 streamId, address to, uint128 amount) external;\\n\\n /// @notice Withdraws the maximum withdrawable amount from the stream to the provided address `to`.\\n ///\\n /// @dev Emits a {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - Refer to the notes in {withdraw}.\\n ///\\n /// Requirements:\\n /// - Refer to the requirements in {withdraw}.\\n ///\\n /// @param streamId The ID of the stream to withdraw from.\\n /// @param to The address receiving the withdrawn assets.\\n /// @return withdrawnAmount The amount withdrawn, denoted in units of the asset's decimals.\\n function withdrawMax(\\n uint256 streamId,\\n address to\\n ) external returns (uint128 withdrawnAmount);\\n\\n /// @notice Withdraws the maximum withdrawable amount from the stream to the current recipient, and transfers the\\n /// NFT to `newRecipient`.\\n ///\\n /// @dev Emits a {WithdrawFromLockupStream} and a {Transfer} event.\\n ///\\n /// Notes:\\n /// - If the withdrawable amount is zero, the withdrawal is skipped.\\n /// - Refer to the notes in {withdraw}.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the stream's recipient.\\n /// - Refer to the requirements in {withdraw}.\\n /// - Refer to the requirements in {IERC721.transferFrom}.\\n ///\\n /// @param streamId The ID of the stream NFT to transfer.\\n /// @param newRecipient The address of the new owner of the stream NFT.\\n /// @return withdrawnAmount The amount withdrawn, denoted in units of the asset's decimals.\\n function withdrawMaxAndTransfer(\\n uint256 streamId,\\n address newRecipient\\n ) external returns (uint128 withdrawnAmount);\\n\\n /// @notice Withdraws assets from streams to the recipient of each stream.\\n ///\\n /// @dev Emits multiple {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} events.\\n ///\\n /// Notes:\\n /// - This function attempts to call a hook on the recipient of each stream, unless `msg.sender` is the recipient.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - There must be an equal number of `streamIds` and `amounts`.\\n /// - Each stream ID in the array must not reference a null or depleted stream.\\n /// - Each amount in the array must be greater than zero and must not exceed the withdrawable amount.\\n ///\\n /// @param streamIds The IDs of the streams to withdraw from.\\n /// @param amounts The amounts to withdraw, denoted in units of the asset's decimals.\\n function withdrawMultiple(\\n uint256[] calldata streamIds,\\n uint128[] calldata amounts\\n ) external;\\n}\\n\",\"keccak256\":\"0x3e5541c38a901637bd310965deb5bbde73ef07fe4ee3c752cbec330c6b9d62a3\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/ISablierV2LockupLinear.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\nimport {Lockup, LockupLinear} from \\\"./types/DataTypes.sol\\\";\\nimport {ISablierV2Lockup} from \\\"./ISablierV2Lockup.sol\\\";\\n\\n/// @title ISablierV2LockupLinear\\n/// @notice Creates and manages Lockup streams with a linear distribution function.\\ninterface ISablierV2LockupLinear is ISablierV2Lockup {\\n /*//////////////////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Emitted when a stream is created.\\n /// @param streamId The ID of the newly created stream.\\n /// @param funder The address which funded the stream.\\n /// @param sender The address distributing the assets, which will have the ability to cancel the stream.\\n /// @param recipient The address receiving the assets.\\n /// @param amounts Struct encapsulating (i) the deposit amount, and (ii) the broker fee amount, both denoted\\n /// in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Boolean indicating whether the stream will be cancelable or not.\\n /// @param transferable Boolean indicating whether the stream NFT is transferable or not.\\n /// @param timestamps Struct encapsulating (i) the stream's start time, (ii) cliff time, and (iii) end time, all as\\n /// Unix timestamps.\\n /// @param broker The address of the broker who has helped create the stream, e.g. a front-end website.\\n event CreateLockupLinearStream(\\n uint256 streamId,\\n address funder,\\n address indexed sender,\\n address indexed recipient,\\n Lockup.CreateAmounts amounts,\\n IERC20 indexed asset,\\n bool cancelable,\\n bool transferable,\\n LockupLinear.Timestamps timestamps,\\n address broker\\n );\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Retrieves the stream's cliff time, which is a Unix timestamp. A value of zero means there\\n /// is no cliff.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getCliffTime(\\n uint256 streamId\\n ) external view returns (uint40 cliffTime);\\n\\n /// @notice Retrieves the full stream details.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n /// @return stream See the documentation in {DataTypes}.\\n function getStream(\\n uint256 streamId\\n ) external view returns (LockupLinear.StreamLL memory stream);\\n\\n /// @notice Retrieves the stream's start, cliff and end timestamps.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n /// @return timestamps See the documentation in {DataTypes}.\\n function getTimestamps(\\n uint256 streamId\\n ) external view returns (LockupLinear.Timestamps memory timestamps);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n NON-CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Creates a stream by setting the start time to `block.timestamp`, and the end time to\\n /// the sum of `block.timestamp` and `params.durations.total`. The stream is funded by `msg.sender` and is wrapped\\n /// in an ERC-721 NFT.\\n ///\\n /// @dev Emits a {Transfer} and {CreateLockupLinearStream} event.\\n ///\\n /// Requirements:\\n /// - All requirements in {createWithTimestamps} must be met for the calculated parameters.\\n ///\\n /// @param params Struct encapsulating the function parameters, which are documented in {DataTypes}.\\n /// @return streamId The ID of the newly created stream.\\n function createWithDurations(\\n LockupLinear.CreateWithDurations calldata params\\n ) external returns (uint256 streamId);\\n\\n /// @notice Creates a stream with the provided start time and end time. The stream is funded by `msg.sender` and is\\n /// wrapped in an ERC-721 NFT.\\n ///\\n /// @dev Emits a {Transfer} and {CreateLockupLinearStream} event.\\n ///\\n /// Notes:\\n /// - A cliff time of zero means there is no cliff.\\n /// - As long as the times are ordered, it is not an error for the start or the cliff time to be in the past.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `params.totalAmount` must be greater than zero.\\n /// - If set, `params.broker.fee` must not be greater than `MAX_BROKER_FEE`.\\n /// - `params.timestamps.start` must be greater than zero and less than `params.timestamps.end`.\\n /// - If set, `params.timestamps.cliff` must be greater than `params.timestamps.start` and less than\\n /// `params.timestamps.end`.\\n /// - `params.timestamps.end` must be in the future.\\n /// - `params.recipient` must not be the zero address.\\n /// - `msg.sender` must have allowed this contract to spend at least `params.totalAmount` assets.\\n ///\\n /// @param params Struct encapsulating the function parameters, which are documented in {DataTypes}.\\n /// @return streamId The ID of the newly created stream.\\n function createWithTimestamps(\\n LockupLinear.CreateWithTimestamps calldata params\\n ) external returns (uint256 streamId);\\n}\\n\",\"keccak256\":\"0x064264723114b1f1cf3953fd79874dfcbb42cf313857aee6d5e6b09a23e0010b\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/ISablierV2NFTDescriptor.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC721Metadata} from \\\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\\\";\\n\\n/// @title ISablierV2NFTDescriptor\\n/// @notice This contract generates the URI describing the Sablier V2 stream NFTs.\\n/// @dev Inspired by Uniswap V3 Positions NFTs.\\ninterface ISablierV2NFTDescriptor {\\n /// @notice Produces the URI describing a particular stream NFT.\\n /// @dev This is a data URI with the JSON contents directly inlined.\\n /// @param sablier The address of the Sablier contract the stream was created in.\\n /// @param streamId The ID of the stream for which to produce a description.\\n /// @return uri The URI of the ERC721-compliant metadata.\\n function tokenURI(\\n IERC721Metadata sablier,\\n uint256 streamId\\n ) external view returns (string memory uri);\\n}\\n\",\"keccak256\":\"0x4ed430e553d14161e93efdaaacd1a502f49b38969c9d714b45d2e682a74fa0bc\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/types/DataTypes.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {UD2x18} from \\\"@prb/math/src/UD2x18.sol\\\";\\nimport {UD60x18} from \\\"@prb/math/src/UD60x18.sol\\\";\\n\\n// DataTypes.sol\\n//\\n// This file defines all structs used in V2 Core, most of which are organized under three namespaces:\\n//\\n// - Lockup\\n// - LockupDynamic\\n// - LockupLinear\\n// - LockupTranched\\n//\\n// You will notice that some structs contain \\\"slot\\\" annotations - they are used to indicate the\\n// storage layout of the struct. It is more gas efficient to group small data types together so\\n// that they fit in a single 32-byte slot.\\n\\n/// @notice Struct encapsulating the broker parameters passed to the create functions. Both can be set to zero.\\n/// @param account The address receiving the broker's fee.\\n/// @param fee The broker's percentage fee from the total amount, denoted as a fixed-point number where 1e18 is 100%.\\nstruct Broker {\\n address account;\\n UD60x18 fee;\\n}\\n\\n/// @notice Namespace for the structs used in both {SablierV2LockupLinear} and {SablierV2LockupDynamic}.\\nlibrary Lockup {\\n /// @notice Struct encapsulating the deposit, withdrawn, and refunded amounts, all denoted in units of the asset's\\n /// decimals.\\n /// @dev Because the deposited and the withdrawn amount are often read together, declaring them in the same slot\\n /// saves gas.\\n /// @param deposited The initial amount deposited in the stream, net of broker fee.\\n /// @param withdrawn The cumulative amount withdrawn from the stream.\\n /// @param refunded The amount refunded to the sender. Unless the stream was canceled, this is always zero.\\n struct Amounts {\\n // slot 0\\n uint128 deposited;\\n uint128 withdrawn;\\n // slot 1\\n uint128 refunded;\\n }\\n\\n /// @notice Struct encapsulating (i) the deposit amount and (ii) the broker fee amount, both denoted in units of the\\n /// asset's decimals.\\n /// @param deposit The amount to deposit in the stream.\\n /// @param brokerFee The broker fee amount.\\n struct CreateAmounts {\\n uint128 deposit;\\n uint128 brokerFee;\\n }\\n\\n /// @notice Enum representing the different statuses of a stream.\\n /// @custom:value0 PENDING Stream created but not started; assets are in a pending state.\\n /// @custom:value1 STREAMING Active stream where assets are currently being streamed.\\n /// @custom:value2 SETTLED All assets have been streamed; recipient is due to withdraw them.\\n /// @custom:value3 CANCELED Canceled stream; remaining assets await recipient's withdrawal.\\n /// @custom:value4 DEPLETED Depleted stream; all assets have been withdrawn and/or refunded.\\n enum Status {\\n PENDING,\\n STREAMING,\\n SETTLED,\\n CANCELED,\\n DEPLETED\\n }\\n\\n /// @notice A common data structure to be stored in all {SablierV2Lockup} models.\\n /// @dev The fields are arranged like this to save gas via tight variable packing.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream.\\n /// @param startTime The Unix timestamp indicating the stream's start.\\n /// @param endTime The Unix timestamp indicating the stream's end.\\n /// @param isCancelable Boolean indicating if the stream is cancelable.\\n /// @param wasCanceled Boolean indicating if the stream was canceled.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param isDepleted Boolean indicating if the stream is depleted.\\n /// @param isStream Boolean indicating if the struct entity exists.\\n /// @param isTransferable Boolean indicating if the stream NFT is transferable.\\n /// @param amounts Struct encapsulating the deposit, withdrawn, and refunded amounts, all denoted in units of the\\n /// asset's decimals.\\n struct Stream {\\n // slot 0\\n address sender;\\n uint40 startTime;\\n uint40 endTime;\\n bool isCancelable;\\n bool wasCanceled;\\n // slot 1\\n IERC20 asset;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n // slot 2 and 3\\n Lockup.Amounts amounts;\\n }\\n}\\n\\n/// @notice Namespace for the structs used in {SablierV2LockupDynamic}.\\nlibrary LockupDynamic {\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupDynamic.createWithDurations} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param segments Segments with durations used to compose the dynamic distribution function. Timestamps are\\n /// calculated by starting from `block.timestamp` and adding each duration to the previous timestamp.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithDurations {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n SegmentWithDuration[] segments;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupDynamic.createWithTimestamps} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param startTime The Unix timestamp indicating the stream's start.\\n /// @param segments Segments used to compose the dynamic distribution function.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithTimestamps {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n uint40 startTime;\\n Segment[] segments;\\n Broker broker;\\n }\\n\\n /// @notice Segment struct used in the Lockup Dynamic stream.\\n /// @param amount The amount of assets to be streamed in the segment, denoted in units of the asset's decimals.\\n /// @param exponent The exponent of the segment, denoted as a fixed-point number.\\n /// @param timestamp The Unix timestamp indicating the segment's end.\\n struct Segment {\\n // slot 0\\n uint128 amount;\\n UD2x18 exponent;\\n uint40 timestamp;\\n }\\n\\n /// @notice Segment struct used at runtime in {SablierV2LockupDynamic.createWithDurations}.\\n /// @param amount The amount of assets to be streamed in the segment, denoted in units of the asset's decimals.\\n /// @param exponent The exponent of the segment, denoted as a fixed-point number.\\n /// @param duration The time difference in seconds between the segment and the previous one.\\n struct SegmentWithDuration {\\n uint128 amount;\\n UD2x18 exponent;\\n uint40 duration;\\n }\\n\\n /// @notice Struct encapsulating the full details of a stream.\\n /// @dev Extends `Lockup.Stream` by including the recipient and the segments.\\n struct StreamLD {\\n address sender;\\n address recipient;\\n uint40 startTime;\\n uint40 endTime;\\n bool isCancelable;\\n bool wasCanceled;\\n IERC20 asset;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n Lockup.Amounts amounts;\\n Segment[] segments;\\n }\\n\\n /// @notice Struct encapsulating the LockupDynamic timestamps.\\n /// @param start The Unix timestamp indicating the stream's start.\\n /// @param end The Unix timestamp indicating the stream's end.\\n struct Timestamps {\\n uint40 start;\\n uint40 end;\\n }\\n}\\n\\n/// @notice Namespace for the structs used in {SablierV2LockupLinear}.\\nlibrary LockupLinear {\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupLinear.createWithDurations} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param durations Struct encapsulating (i) cliff period duration and (ii) total stream duration, both in seconds.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithDurations {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n Durations durations;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupLinear.createWithTimestamps} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param timestamps Struct encapsulating (i) the stream's start time, (ii) cliff time, and (iii) end time, all as\\n /// Unix timestamps.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithTimestamps {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n Timestamps timestamps;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the cliff duration and the total duration.\\n /// @param cliff The cliff duration in seconds.\\n /// @param total The total duration in seconds.\\n struct Durations {\\n uint40 cliff;\\n uint40 total;\\n }\\n\\n /// @notice Struct encapsulating the full details of a stream.\\n /// @dev Extends `Lockup.Stream` by including the recipient and the cliff time.\\n struct StreamLL {\\n address sender;\\n address recipient;\\n uint40 startTime;\\n bool isCancelable;\\n bool wasCanceled;\\n IERC20 asset;\\n uint40 endTime;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n Lockup.Amounts amounts;\\n uint40 cliffTime;\\n }\\n\\n /// @notice Struct encapsulating the LockupLinear timestamps.\\n /// @param start The Unix timestamp for the stream's start.\\n /// @param cliff The Unix timestamp for the cliff period's end. A value of zero means there is no cliff.\\n /// @param end The Unix timestamp for the stream's end.\\n struct Timestamps {\\n uint40 start;\\n uint40 cliff;\\n uint40 end;\\n }\\n}\\n\\n/// @notice Namespace for the structs used in {SablierV2LockupTranched}.\\nlibrary LockupTranched {\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupTranched.createWithDurations} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param tranches Tranches with durations used to compose the tranched distribution function. Timestamps are\\n /// calculated by starting from `block.timestamp` and adding each duration to the previous timestamp.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithDurations {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n TrancheWithDuration[] tranches;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupTranched.createWithTimestamps} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param startTime The Unix timestamp indicating the stream's start.\\n /// @param tranches Tranches used to compose the tranched distribution function.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithTimestamps {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n uint40 startTime;\\n Tranche[] tranches;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the full details of a stream.\\n /// @dev Extends `Lockup.Stream` by including the recipient and the tranches.\\n struct StreamLT {\\n address sender;\\n address recipient;\\n uint40 startTime;\\n uint40 endTime;\\n bool isCancelable;\\n bool wasCanceled;\\n IERC20 asset;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n Lockup.Amounts amounts;\\n Tranche[] tranches;\\n }\\n\\n /// @notice Struct encapsulating the LockupTranched timestamps.\\n /// @param start The Unix timestamp indicating the stream's start.\\n /// @param end The Unix timestamp indicating the stream's end.\\n struct Timestamps {\\n uint40 start;\\n uint40 end;\\n }\\n\\n /// @notice Tranche struct used in the Lockup Tranched stream.\\n /// @param amount The amount of assets to be unlocked in the tranche, denoted in units of the asset's decimals.\\n /// @param timestamp The Unix timestamp indicating the tranche's end.\\n struct Tranche {\\n // slot 0\\n uint128 amount;\\n uint40 timestamp;\\n }\\n\\n /// @notice Tranche struct used at runtime in {SablierV2LockupTranched.createWithDurations}.\\n /// @param amount The amount of assets to be unlocked in the tranche, denoted in units of the asset's decimals.\\n /// @param duration The time difference in seconds between the tranche and the previous one.\\n struct TrancheWithDuration {\\n uint128 amount;\\n uint40 duration;\\n }\\n}\\n\",\"keccak256\":\"0x727722c0ec71a76a947b935c9dfcac8fd846d6c3547dfbc8739c7109f3b95068\",\"license\":\"GPL-3.0-or-later\"},\"contracts/modules/DecentHatsModificationModule.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.28;\\n\\nimport {DecentHatsModuleUtils} from \\\"./DecentHatsModuleUtils.sol\\\";\\n\\ncontract DecentHatsModificationModule is DecentHatsModuleUtils {\\n /**\\n * @notice Creates a new termed or untermed role hat and any streams on it.\\n *\\n * @notice This contract should be enabled a module on the Safe for which the role is to be created, and disabled after.\\n *\\n * @dev Stream funds on untermed Roles are targeted at the hat's smart account. In order to withdraw funds from the stream, the\\n * hat's smart account must be the one call to `withdraw-` on the Sablier contract, setting the recipient arg to its wearer.\\n *\\n * @dev Stream funds on termed Roles are targeted directly at the nominated wearer.\\n * The wearer should directly call `withdraw-` on the Sablier contract.\\n *\\n * @dev Role hat creation, minting, smart account creation and stream creation are handled here in order\\n * to avoid a race condition where not more than one active proposal to create a new role can exist at a time.\\n * See: https://github.com/decentdao/decent-interface/issues/2402\\n *\\n * @param roleHatsParams An array of params for each role hat to be created.\\n */\\n function createRoleHats(\\n CreateRoleHatsParams calldata roleHatsParams\\n ) external {\\n _processRoleHats(roleHatsParams);\\n }\\n}\\n\",\"keccak256\":\"0x45b9470e000a416382deebea44a8c8734a2d6b453e8c7fbba5ea9bc6fdd4917c\",\"license\":\"MIT\"},\"contracts/modules/DecentHatsModuleUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.28;\\n\\nimport {Enum} from \\\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\\\";\\nimport {IAvatar} from \\\"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IERC6551Registry} from \\\"../interfaces/IERC6551Registry.sol\\\";\\nimport {IHats} from \\\"../interfaces/hats/IHats.sol\\\";\\nimport {LockupLinear, Broker} from \\\"../interfaces/sablier/types/DataTypes.sol\\\";\\nimport {IHatsModuleFactory} from \\\"../interfaces/hats/IHatsModuleFactory.sol\\\";\\nimport {ISablierV2LockupLinear} from \\\"../interfaces/sablier/ISablierV2LockupLinear.sol\\\";\\n\\nabstract contract DecentHatsModuleUtils {\\n bytes32 public constant SALT =\\n 0x5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b5072;\\n\\n struct SablierStreamParams {\\n ISablierV2LockupLinear sablier;\\n address sender;\\n address asset;\\n LockupLinear.Timestamps timestamps;\\n Broker broker;\\n uint128 totalAmount;\\n bool cancelable;\\n bool transferable;\\n }\\n\\n struct HatParams {\\n address wearer;\\n string details;\\n string imageURI;\\n SablierStreamParams[] sablierStreamsParams;\\n uint128 termEndDateTs; // If 0, this is an untermed Hat\\n uint32 maxSupply;\\n bool isMutable;\\n }\\n\\n struct CreateRoleHatsParams {\\n IHats hatsProtocol;\\n IERC6551Registry erc6551Registry;\\n address hatsAccountImplementation;\\n uint256 topHatId;\\n address topHatAccount;\\n IHatsModuleFactory hatsModuleFactory;\\n address hatsElectionsEligibilityImplementation;\\n uint256 adminHatId;\\n HatParams[] hats;\\n }\\n\\n function _processRoleHats(\\n CreateRoleHatsParams memory roleHatsParams\\n ) internal {\\n for (uint256 i = 0; i < roleHatsParams.hats.length; ) {\\n HatParams memory hatParams = roleHatsParams.hats[i];\\n\\n // Create eligibility module if needed\\n address eligibilityAddress = _createEligibilityModule(\\n roleHatsParams.hatsProtocol,\\n roleHatsParams.hatsModuleFactory,\\n roleHatsParams.hatsElectionsEligibilityImplementation,\\n roleHatsParams.topHatId,\\n roleHatsParams.topHatAccount,\\n roleHatsParams.adminHatId,\\n hatParams.termEndDateTs\\n );\\n\\n // Create and Mint the Role Hat\\n uint256 hatId = _createAndMintHat(\\n roleHatsParams.hatsProtocol,\\n roleHatsParams.adminHatId,\\n hatParams,\\n eligibilityAddress,\\n roleHatsParams.topHatAccount\\n );\\n\\n // Get the stream recipient (based on termed or not)\\n address streamRecipient = _setupStreamRecipient(\\n roleHatsParams.erc6551Registry,\\n roleHatsParams.hatsAccountImplementation,\\n address(roleHatsParams.hatsProtocol),\\n hatParams.termEndDateTs,\\n hatParams.wearer,\\n hatId\\n );\\n\\n // Create streams\\n _processSablierStreams(\\n hatParams.sablierStreamsParams,\\n streamRecipient\\n );\\n\\n unchecked {\\n ++i;\\n }\\n }\\n }\\n\\n function _createEligibilityModule(\\n IHats hatsProtocol,\\n IHatsModuleFactory hatsModuleFactory,\\n address hatsElectionsEligibilityImplementation,\\n uint256 topHatId,\\n address topHatAccount,\\n uint256 adminHatId,\\n uint128 termEndDateTs\\n ) private returns (address) {\\n // If the Hat is termed, create the eligibility module\\n if (termEndDateTs != 0) {\\n return\\n hatsModuleFactory.createHatsModule(\\n hatsElectionsEligibilityImplementation,\\n hatsProtocol.getNextId(adminHatId),\\n abi.encode(topHatId, uint256(0)), // [BALLOT_BOX_ID, ADMIN_HAT_ID]\\n abi.encode(termEndDateTs),\\n uint256(SALT)\\n );\\n }\\n\\n // Otherwise, return the Top Hat account\\n return topHatAccount;\\n }\\n\\n function _createAndMintHat(\\n IHats hatsProtocol,\\n uint256 adminHatId,\\n HatParams memory hat,\\n address eligibilityAddress,\\n address topHatAccount\\n ) private returns (uint256) {\\n // Grab the next Hat ID (before creating it)\\n uint256 hatId = hatsProtocol.getNextId(adminHatId);\\n\\n // Create the new Hat\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"createHat(uint256,string,uint32,address,address,bool,string)\\\",\\n adminHatId,\\n hat.details,\\n hat.maxSupply,\\n eligibilityAddress,\\n topHatAccount,\\n hat.isMutable,\\n hat.imageURI\\n ),\\n Enum.Operation.Call\\n );\\n\\n // If the Hat is termed, nominate the wearer as the eligible member\\n if (hat.termEndDateTs != 0) {\\n address[] memory nominatedWearers = new address[](1);\\n nominatedWearers[0] = hat.wearer;\\n\\n IAvatar(msg.sender).execTransactionFromModule(\\n eligibilityAddress,\\n 0,\\n abi.encodeWithSignature(\\n \\\"elect(uint128,address[])\\\",\\n hat.termEndDateTs,\\n nominatedWearers\\n ),\\n Enum.Operation.Call\\n );\\n }\\n\\n // Mint the Hat\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"mintHat(uint256,address)\\\",\\n hatId,\\n hat.wearer\\n ),\\n Enum.Operation.Call\\n );\\n return hatId;\\n }\\n\\n // Exists to avoid stack too deep errors\\n function _setupStreamRecipient(\\n IERC6551Registry erc6551Registry,\\n address hatsAccountImplementation,\\n address hatsProtocol,\\n uint128 termEndDateTs,\\n address wearer,\\n uint256 hatId\\n ) private returns (address) {\\n // If the hat is termed, the wearer is the stream recipient\\n if (termEndDateTs != 0) {\\n return wearer;\\n }\\n\\n // Otherwise, the Hat's smart account is the stream recipient\\n return\\n erc6551Registry.createAccount(\\n hatsAccountImplementation,\\n SALT,\\n block.chainid,\\n hatsProtocol,\\n hatId\\n );\\n }\\n\\n function _processSablierStreams(\\n SablierStreamParams[] memory streamParams,\\n address streamRecipient\\n ) private {\\n for (uint256 i = 0; i < streamParams.length; ) {\\n SablierStreamParams memory sablierStreamParams = streamParams[i];\\n\\n // Approve tokens for Sablier\\n IAvatar(msg.sender).execTransactionFromModule(\\n sablierStreamParams.asset,\\n 0,\\n abi.encodeWithSignature(\\n \\\"approve(address,uint256)\\\",\\n sablierStreamParams.sablier,\\n sablierStreamParams.totalAmount\\n ),\\n Enum.Operation.Call\\n );\\n\\n // Proxy the Sablier call through IAvatar\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(sablierStreamParams.sablier),\\n 0,\\n abi.encodeWithSignature(\\n \\\"createWithTimestamps((address,address,uint128,address,bool,bool,(uint40,uint40,uint40),(address,uint256)))\\\",\\n LockupLinear.CreateWithTimestamps({\\n sender: sablierStreamParams.sender,\\n recipient: streamRecipient,\\n totalAmount: sablierStreamParams.totalAmount,\\n asset: IERC20(sablierStreamParams.asset),\\n cancelable: sablierStreamParams.cancelable,\\n transferable: sablierStreamParams.transferable,\\n timestamps: sablierStreamParams.timestamps,\\n broker: sablierStreamParams.broker\\n })\\n ),\\n Enum.Operation.Call\\n );\\n\\n unchecked {\\n ++i;\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x357c5264ecb63f8f15f67ffb7498c7fb55d9efe8d46358790933b4892bd38cde\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x6080604052348015600f57600080fd5b5061123d8061001f6000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80633dac44e81461003b578063ba9a91a514610050575b600080fd5b61004e610049366004610929565b610089565b005b6100777f5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b507281565b60405190815260200160405180910390f35b61009a61009582610e60565b61009d565b50565b60005b8161010001515181101561016057600082610100015182815181106100c7576100c7610f22565b6020026020010151905060006100fe84600001518560a001518660c00151876060015188608001518960e001518860800151610164565b9050600061011b85600001518660e00151858589608001516102dd565b90506000610141866020015187604001518860000151876080015188600001518761060f565b90506101518460600151826106db565b846001019450505050506100a0565b5050565b60006001600160801b038216156102cf57866001600160a01b0316632f7fb7b6878a6001600160a01b0316631183a8c0876040518263ffffffff1660e01b81526004016101b391815260200190565b602060405180830381865afa1580156101d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101f49190610f38565b886000604051602001610211929190918252602082015260400190565b60408051601f198184030181528282526001600160801b0389166020840152910160408051601f19818403018152908290526001600160e01b031960e087901b168252610285949392917f5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b507290600401610f97565b6020604051808303816000875af11580156102a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102c89190610fe3565b90506102d2565b50825b979650505050505050565b60405162460ea360e61b81526004810185905260009081906001600160a01b03881690631183a8c090602401602060405180830381865afa158015610326573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061034a9190610f38565b9050336001600160a01b031663468721a78860008989602001518a60a001518a8a8d60c001518e6040015160405160240161038b9796959493929190611000565b60408051601f198184030181529181526020820180516001600160e01b0316635829492f60e11b1790525160e085901b6001600160e01b03191681526103d993929190600090600401611064565b6020604051808303816000875af11580156103f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061041c91906110ba565b5060808501516001600160801b031615610547576040805160018082528183019092526000916020808301908036833701905050905085600001518160008151811061046a5761046a610f22565b60200260200101906001600160a01b031690816001600160a01b031681525050336001600160a01b031663468721a78660008960800151856040516024016104b39291906110d7565b60408051601f198184030181529181526020820180516001600160e01b0316634a231cef60e01b1790525160e085901b6001600160e01b031916815261050193929190600090600401611064565b6020604051808303816000875af1158015610520573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061054491906110ba565b50505b8451604051602481018390526001600160a01b039091166044820152339063468721a790899060009060640160408051601f198184030181529181526020820180516001600160e01b031663320fbbb760e11b1790525160e085901b6001600160e01b03191681526105c193929190600090600401611064565b6020604051808303816000875af11580156105e0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061060491906110ba565b509695505050505050565b60006001600160801b038416156106275750816106d1565b604051638a54c52f60e01b81526001600160a01b0387811660048301527f5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b50726024830152466044830152868116606483015260848201849052881690638a54c52f9060a4016020604051808303816000875af11580156106aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106ce9190610fe3565b90505b9695505050505050565b60005b82518110156109245760008382815181106106fb576106fb610f22565b60200260200101519050336001600160a01b031663468721a78260400151600084600001518560a001516040516024016107539291906001600160a01b039290921682526001600160801b0316602082015260400190565b60408051601f198184030181529181526020820180516001600160e01b031663095ea7b360e01b1790525160e085901b6001600160e01b03191681526107a193929190600090600401611064565b6020604051808303816000875af11580156107c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107e491906110ba565b50336001600160a01b031663468721a78260000151600060405180610100016040528086602001516001600160a01b03168152602001886001600160a01b031681526020018660a001516001600160801b0316815260200186604001516001600160a01b031681526020018660c00151151581526020018660e00151151581526020018660600151815260200186608001518152506040516024016108899190611138565b60408051601f198184030181529181526020820180516001600160e01b03166353b1572760e01b1790525160e085901b6001600160e01b03191681526108d793929190600090600401611064565b6020604051808303816000875af11580156108f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061091a91906110ba565b50506001016106de565b505050565b60006020828403121561093b57600080fd5b81356001600160401b0381111561095157600080fd5b8201610120818503121561096457600080fd5b9392505050565b634e487b7160e01b600052604160045260246000fd5b60405161010081016001600160401b03811182821017156109a4576109a461096b565b60405290565b60405160e081016001600160401b03811182821017156109a4576109a461096b565b60405161012081016001600160401b03811182821017156109a4576109a461096b565b604051601f8201601f191681016001600160401b0381118282101715610a1757610a1761096b565b604052919050565b6001600160a01b038116811461009a57600080fd5b8035610a3f81610a1f565b919050565b60006001600160401b03821115610a5d57610a5d61096b565b5060051b60200190565b600082601f830112610a7857600080fd5b81356001600160401b03811115610a9157610a9161096b565b610aa4601f8201601f19166020016109ef565b818152846020838601011115610ab957600080fd5b816020850160208301376000918101602001919091529392505050565b803564ffffffffff81168114610a3f57600080fd5b600060608284031215610afd57600080fd5b604051606081016001600160401b0381118282101715610b1f57610b1f61096b565b604052905080610b2e83610ad6565b8152610b3c60208401610ad6565b6020820152610b4d60408401610ad6565b60408201525092915050565b600060408284031215610b6b57600080fd5b604080519081016001600160401b0381118282101715610b8d57610b8d61096b565b6040529050808235610b9e81610a1f565b8152602092830135920191909152919050565b80356001600160801b0381168114610a3f57600080fd5b801515811461009a57600080fd5b8035610a3f81610bc8565b600082601f830112610bf257600080fd5b8135610c05610c0082610a44565b6109ef565b8082825260208201915060206101608402860101925085831115610c2857600080fd5b602085015b83811015610ce6576101608188031215610c4657600080fd5b610c4e610981565b610c5782610a34565b8152610c6560208301610a34565b6020820152610c7660408301610a34565b6040820152610c888860608401610aeb565b6060820152610c9a8860c08401610b59565b6080820152610cac6101008301610bb1565b60a0820152610cbe6101208301610bd6565b60c0820152610cd06101408301610bd6565b60e0820152835260209092019161016001610c2d565b5095945050505050565b803563ffffffff81168114610a3f57600080fd5b600082601f830112610d1557600080fd5b8135610d23610c0082610a44565b8082825260208201915060208360051b860101925085831115610d4557600080fd5b602085015b83811015610ce65780356001600160401b03811115610d6857600080fd5b860160e0818903601f19011215610d7e57600080fd5b610d866109aa565b610d9260208301610a34565b815260408201356001600160401b03811115610dad57600080fd5b610dbc8a602083860101610a67565b60208301525060608201356001600160401b03811115610ddb57600080fd5b610dea8a602083860101610a67565b60408301525060808201356001600160401b03811115610e0957600080fd5b610e188a602083860101610be1565b606083015250610e2a60a08301610bb1565b6080820152610e3b60c08301610cf0565b60a0820152610e4c60e08301610bd6565b60c082015284525060209283019201610d4a565b60006101208236031215610e7357600080fd5b610e7b6109cc565b610e8483610a34565b8152610e9260208401610a34565b6020820152610ea360408401610a34565b604082015260608381013590820152610ebe60808401610a34565b6080820152610ecf60a08401610a34565b60a0820152610ee060c08401610a34565b60c082015260e083810135908201526101008301356001600160401b03811115610f0957600080fd5b610f1536828601610d04565b6101008301525092915050565b634e487b7160e01b600052603260045260246000fd5b600060208284031215610f4a57600080fd5b5051919050565b6000815180845260005b81811015610f7757602081850181015186830182015201610f5b565b506000602082860101526020601f19601f83011685010191505092915050565b60018060a01b038616815284602082015260a060408201526000610fbe60a0830186610f51565b8281036060840152610fd08186610f51565b9150508260808301529695505050505050565b600060208284031215610ff557600080fd5b815161096481610a1f565b87815260e06020820152600061101960e0830189610f51565b63ffffffff881660408401526001600160a01b0387811660608501528616608084015284151560a084015282810360c08401526110568185610f51565b9a9950505050505050505050565b60018060a01b038516815283602082015260806040820152600061108b6080830185610f51565b9050600283106110ab57634e487b7160e01b600052602160045260246000fd5b82606083015295945050505050565b6000602082840312156110cc57600080fd5b815161096481610bc8565b6000604082016001600160801b03851683526040602084015280845180835260608501915060208601925060005b8181101561112c5783516001600160a01b0316835260209384019390920191600101611105565b50909695505050505050565b81516001600160a01b0390811682526020808401518216908301526040808401516001600160801b0316908301526060808401519182169083015261016082019050608083015161118d608084018215159052565b5060a08301516111a160a084018215159052565b5060c08301516111e060c084018264ffffffffff815116825264ffffffffff602082015116602083015264ffffffffff60408201511660408301525050565b5060e0929092015180516001600160a01b031661012083015260200151610140909101529056fea26469706673582212208ecde80de6a92bc6f34289d7626d01b9bebb41eb9991597e67fb6a0be17a938664736f6c634300081c0033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100365760003560e01c80633dac44e81461003b578063ba9a91a514610050575b600080fd5b61004e610049366004610929565b610089565b005b6100777f5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b507281565b60405190815260200160405180910390f35b61009a61009582610e60565b61009d565b50565b60005b8161010001515181101561016057600082610100015182815181106100c7576100c7610f22565b6020026020010151905060006100fe84600001518560a001518660c00151876060015188608001518960e001518860800151610164565b9050600061011b85600001518660e00151858589608001516102dd565b90506000610141866020015187604001518860000151876080015188600001518761060f565b90506101518460600151826106db565b846001019450505050506100a0565b5050565b60006001600160801b038216156102cf57866001600160a01b0316632f7fb7b6878a6001600160a01b0316631183a8c0876040518263ffffffff1660e01b81526004016101b391815260200190565b602060405180830381865afa1580156101d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101f49190610f38565b886000604051602001610211929190918252602082015260400190565b60408051601f198184030181528282526001600160801b0389166020840152910160408051601f19818403018152908290526001600160e01b031960e087901b168252610285949392917f5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b507290600401610f97565b6020604051808303816000875af11580156102a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102c89190610fe3565b90506102d2565b50825b979650505050505050565b60405162460ea360e61b81526004810185905260009081906001600160a01b03881690631183a8c090602401602060405180830381865afa158015610326573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061034a9190610f38565b9050336001600160a01b031663468721a78860008989602001518a60a001518a8a8d60c001518e6040015160405160240161038b9796959493929190611000565b60408051601f198184030181529181526020820180516001600160e01b0316635829492f60e11b1790525160e085901b6001600160e01b03191681526103d993929190600090600401611064565b6020604051808303816000875af11580156103f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061041c91906110ba565b5060808501516001600160801b031615610547576040805160018082528183019092526000916020808301908036833701905050905085600001518160008151811061046a5761046a610f22565b60200260200101906001600160a01b031690816001600160a01b031681525050336001600160a01b031663468721a78660008960800151856040516024016104b39291906110d7565b60408051601f198184030181529181526020820180516001600160e01b0316634a231cef60e01b1790525160e085901b6001600160e01b031916815261050193929190600090600401611064565b6020604051808303816000875af1158015610520573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061054491906110ba565b50505b8451604051602481018390526001600160a01b039091166044820152339063468721a790899060009060640160408051601f198184030181529181526020820180516001600160e01b031663320fbbb760e11b1790525160e085901b6001600160e01b03191681526105c193929190600090600401611064565b6020604051808303816000875af11580156105e0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061060491906110ba565b509695505050505050565b60006001600160801b038416156106275750816106d1565b604051638a54c52f60e01b81526001600160a01b0387811660048301527f5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b50726024830152466044830152868116606483015260848201849052881690638a54c52f9060a4016020604051808303816000875af11580156106aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106ce9190610fe3565b90505b9695505050505050565b60005b82518110156109245760008382815181106106fb576106fb610f22565b60200260200101519050336001600160a01b031663468721a78260400151600084600001518560a001516040516024016107539291906001600160a01b039290921682526001600160801b0316602082015260400190565b60408051601f198184030181529181526020820180516001600160e01b031663095ea7b360e01b1790525160e085901b6001600160e01b03191681526107a193929190600090600401611064565b6020604051808303816000875af11580156107c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107e491906110ba565b50336001600160a01b031663468721a78260000151600060405180610100016040528086602001516001600160a01b03168152602001886001600160a01b031681526020018660a001516001600160801b0316815260200186604001516001600160a01b031681526020018660c00151151581526020018660e00151151581526020018660600151815260200186608001518152506040516024016108899190611138565b60408051601f198184030181529181526020820180516001600160e01b03166353b1572760e01b1790525160e085901b6001600160e01b03191681526108d793929190600090600401611064565b6020604051808303816000875af11580156108f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061091a91906110ba565b50506001016106de565b505050565b60006020828403121561093b57600080fd5b81356001600160401b0381111561095157600080fd5b8201610120818503121561096457600080fd5b9392505050565b634e487b7160e01b600052604160045260246000fd5b60405161010081016001600160401b03811182821017156109a4576109a461096b565b60405290565b60405160e081016001600160401b03811182821017156109a4576109a461096b565b60405161012081016001600160401b03811182821017156109a4576109a461096b565b604051601f8201601f191681016001600160401b0381118282101715610a1757610a1761096b565b604052919050565b6001600160a01b038116811461009a57600080fd5b8035610a3f81610a1f565b919050565b60006001600160401b03821115610a5d57610a5d61096b565b5060051b60200190565b600082601f830112610a7857600080fd5b81356001600160401b03811115610a9157610a9161096b565b610aa4601f8201601f19166020016109ef565b818152846020838601011115610ab957600080fd5b816020850160208301376000918101602001919091529392505050565b803564ffffffffff81168114610a3f57600080fd5b600060608284031215610afd57600080fd5b604051606081016001600160401b0381118282101715610b1f57610b1f61096b565b604052905080610b2e83610ad6565b8152610b3c60208401610ad6565b6020820152610b4d60408401610ad6565b60408201525092915050565b600060408284031215610b6b57600080fd5b604080519081016001600160401b0381118282101715610b8d57610b8d61096b565b6040529050808235610b9e81610a1f565b8152602092830135920191909152919050565b80356001600160801b0381168114610a3f57600080fd5b801515811461009a57600080fd5b8035610a3f81610bc8565b600082601f830112610bf257600080fd5b8135610c05610c0082610a44565b6109ef565b8082825260208201915060206101608402860101925085831115610c2857600080fd5b602085015b83811015610ce6576101608188031215610c4657600080fd5b610c4e610981565b610c5782610a34565b8152610c6560208301610a34565b6020820152610c7660408301610a34565b6040820152610c888860608401610aeb565b6060820152610c9a8860c08401610b59565b6080820152610cac6101008301610bb1565b60a0820152610cbe6101208301610bd6565b60c0820152610cd06101408301610bd6565b60e0820152835260209092019161016001610c2d565b5095945050505050565b803563ffffffff81168114610a3f57600080fd5b600082601f830112610d1557600080fd5b8135610d23610c0082610a44565b8082825260208201915060208360051b860101925085831115610d4557600080fd5b602085015b83811015610ce65780356001600160401b03811115610d6857600080fd5b860160e0818903601f19011215610d7e57600080fd5b610d866109aa565b610d9260208301610a34565b815260408201356001600160401b03811115610dad57600080fd5b610dbc8a602083860101610a67565b60208301525060608201356001600160401b03811115610ddb57600080fd5b610dea8a602083860101610a67565b60408301525060808201356001600160401b03811115610e0957600080fd5b610e188a602083860101610be1565b606083015250610e2a60a08301610bb1565b6080820152610e3b60c08301610cf0565b60a0820152610e4c60e08301610bd6565b60c082015284525060209283019201610d4a565b60006101208236031215610e7357600080fd5b610e7b6109cc565b610e8483610a34565b8152610e9260208401610a34565b6020820152610ea360408401610a34565b604082015260608381013590820152610ebe60808401610a34565b6080820152610ecf60a08401610a34565b60a0820152610ee060c08401610a34565b60c082015260e083810135908201526101008301356001600160401b03811115610f0957600080fd5b610f1536828601610d04565b6101008301525092915050565b634e487b7160e01b600052603260045260246000fd5b600060208284031215610f4a57600080fd5b5051919050565b6000815180845260005b81811015610f7757602081850181015186830182015201610f5b565b506000602082860101526020601f19601f83011685010191505092915050565b60018060a01b038616815284602082015260a060408201526000610fbe60a0830186610f51565b8281036060840152610fd08186610f51565b9150508260808301529695505050505050565b600060208284031215610ff557600080fd5b815161096481610a1f565b87815260e06020820152600061101960e0830189610f51565b63ffffffff881660408401526001600160a01b0387811660608501528616608084015284151560a084015282810360c08401526110568185610f51565b9a9950505050505050505050565b60018060a01b038516815283602082015260806040820152600061108b6080830185610f51565b9050600283106110ab57634e487b7160e01b600052602160045260246000fd5b82606083015295945050505050565b6000602082840312156110cc57600080fd5b815161096481610bc8565b6000604082016001600160801b03851683526040602084015280845180835260608501915060208601925060005b8181101561112c5783516001600160a01b0316835260209384019390920191600101611105565b50909695505050505050565b81516001600160a01b0390811682526020808401518216908301526040808401516001600160801b0316908301526060808401519182169083015261016082019050608083015161118d608084018215159052565b5060a08301516111a160a084018215159052565b5060c08301516111e060c084018264ffffffffff815116825264ffffffffff602082015116602083015264ffffffffff60408201511660408301525050565b5060e0929092015180516001600160a01b031661012083015260200151610140909101529056fea26469706673582212208ecde80de6a92bc6f34289d7626d01b9bebb41eb9991597e67fb6a0be17a938664736f6c634300081c0033", + "numDeployments": 2, + "solcInputHash": "f1fca9a70591742a2aedd10e2fd7e744", + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"SALT\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"contract IHats\",\"name\":\"hatsProtocol\",\"type\":\"address\"},{\"internalType\":\"contract IERC6551Registry\",\"name\":\"erc6551Registry\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"hatsAccountImplementation\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"topHatId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"topHatAccount\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"keyValuePairs\",\"type\":\"address\"},{\"internalType\":\"contract IHatsModuleFactory\",\"name\":\"hatsModuleFactory\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"hatsElectionsEligibilityImplementation\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"adminHatId\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"wearer\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"details\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"imageURI\",\"type\":\"string\"},{\"components\":[{\"internalType\":\"contract ISablierV2LockupLinear\",\"name\":\"sablier\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint40\",\"name\":\"start\",\"type\":\"uint40\"},{\"internalType\":\"uint40\",\"name\":\"cliff\",\"type\":\"uint40\"},{\"internalType\":\"uint40\",\"name\":\"end\",\"type\":\"uint40\"}],\"internalType\":\"struct LockupLinear.Timestamps\",\"name\":\"timestamps\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"UD60x18\",\"name\":\"fee\",\"type\":\"uint256\"}],\"internalType\":\"struct Broker\",\"name\":\"broker\",\"type\":\"tuple\"},{\"internalType\":\"uint128\",\"name\":\"totalAmount\",\"type\":\"uint128\"},{\"internalType\":\"bool\",\"name\":\"cancelable\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"transferable\",\"type\":\"bool\"}],\"internalType\":\"struct DecentHatsModuleUtils.SablierStreamParams[]\",\"name\":\"sablierStreamsParams\",\"type\":\"tuple[]\"},{\"internalType\":\"uint128\",\"name\":\"termEndDateTs\",\"type\":\"uint128\"},{\"internalType\":\"uint32\",\"name\":\"maxSupply\",\"type\":\"uint32\"},{\"internalType\":\"bool\",\"name\":\"isMutable\",\"type\":\"bool\"}],\"internalType\":\"struct DecentHatsModuleUtils.HatParams[]\",\"name\":\"hats\",\"type\":\"tuple[]\"}],\"internalType\":\"struct DecentHatsModuleUtils.CreateRoleHatsParams\",\"name\":\"roleHatsParams\",\"type\":\"tuple\"}],\"name\":\"createRoleHats\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"createRoleHats((address,address,address,uint256,address,address,address,address,uint256,(address,string,string,(address,address,address,(uint40,uint40,uint40),(address,uint256),uint128,bool,bool)[],uint128,uint32,bool)[]))\":{\"details\":\"Stream funds on untermed Roles are targeted at the hat's smart account. In order to withdraw funds from the stream, the hat's smart account must be the one call to `withdraw-` on the Sablier contract, setting the recipient arg to its wearer.Stream funds on termed Roles are targeted directly at the nominated wearer. The wearer should directly call `withdraw-` on the Sablier contract.Role hat creation, minting, smart account creation and stream creation are handled here in order to avoid a race condition where not more than one active proposal to create a new role can exist at a time. See: https://github.com/decentdao/decent-interface/issues/2402\",\"params\":{\"roleHatsParams\":\"An array of params for each role hat to be created.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"createRoleHats((address,address,address,uint256,address,address,address,address,uint256,(address,string,string,(address,address,address,(uint40,uint40,uint40),(address,uint256),uint128,bool,bool)[],uint128,uint32,bool)[]))\":{\"notice\":\"Creates a new termed or untermed role hat and any streams on it.This contract should be enabled a module on the Safe for which the role is to be created, and disabled after.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/modules/DecentHatsModificationModule.sol\":\"DecentHatsModificationModule\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\npragma solidity >=0.7.0 <0.9.0;\\n\\n/// @title Enum - Collection of enums\\n/// @author Richard Meissner - \\ncontract Enum {\\n enum Operation {Call, DelegateCall}\\n}\\n\",\"keccak256\":\"0x473e45b1a5cc47be494b0e123c9127f0c11c1e0992a321ae5a644c0bfdb2c14f\",\"license\":\"LGPL-3.0-only\"},\"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\n\\n/// @title Zodiac Avatar - A contract that manages modules that can execute transactions via this contract.\\npragma solidity >=0.7.0 <0.9.0;\\n\\nimport \\\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\\\";\\n\\ninterface IAvatar {\\n event EnabledModule(address module);\\n event DisabledModule(address module);\\n event ExecutionFromModuleSuccess(address indexed module);\\n event ExecutionFromModuleFailure(address indexed module);\\n\\n /// @dev Enables a module on the avatar.\\n /// @notice Can only be called by the avatar.\\n /// @notice Modules should be stored as a linked list.\\n /// @notice Must emit EnabledModule(address module) if successful.\\n /// @param module Module to be enabled.\\n function enableModule(address module) external;\\n\\n /// @dev Disables a module on the avatar.\\n /// @notice Can only be called by the avatar.\\n /// @notice Must emit DisabledModule(address module) if successful.\\n /// @param prevModule Address that pointed to the module to be removed in the linked list\\n /// @param module Module to be removed.\\n function disableModule(address prevModule, address module) external;\\n\\n /// @dev Allows a Module to execute a transaction.\\n /// @notice Can only be called by an enabled module.\\n /// @notice Must emit ExecutionFromModuleSuccess(address module) if successful.\\n /// @notice Must emit ExecutionFromModuleFailure(address module) if unsuccessful.\\n /// @param to Destination address of module transaction.\\n /// @param value Ether value of module transaction.\\n /// @param data Data payload of module transaction.\\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\\n function execTransactionFromModule(\\n address to,\\n uint256 value,\\n bytes memory data,\\n Enum.Operation operation\\n ) external returns (bool success);\\n\\n /// @dev Allows a Module to execute a transaction and return data\\n /// @notice Can only be called by an enabled module.\\n /// @notice Must emit ExecutionFromModuleSuccess(address module) if successful.\\n /// @notice Must emit ExecutionFromModuleFailure(address module) if unsuccessful.\\n /// @param to Destination address of module transaction.\\n /// @param value Ether value of module transaction.\\n /// @param data Data payload of module transaction.\\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\\n function execTransactionFromModuleReturnData(\\n address to,\\n uint256 value,\\n bytes memory data,\\n Enum.Operation operation\\n ) external returns (bool success, bytes memory returnData);\\n\\n /// @dev Returns if an module is enabled\\n /// @return True if the module is enabled\\n function isModuleEnabled(address module) external view returns (bool);\\n\\n /// @dev Returns array of modules.\\n /// @param start Start of the page.\\n /// @param pageSize Maximum number of modules that should be returned.\\n /// @return array Array of modules.\\n /// @return next Start of the next page.\\n function getModulesPaginated(address start, uint256 pageSize)\\n external\\n view\\n returns (address[] memory array, address next);\\n}\\n\",\"keccak256\":\"0xcd5508ffe596eef8fbccfd5fc4f10a34397773547ce64e212d48b5212865ec1f\",\"license\":\"LGPL-3.0-only\"},\"@openzeppelin/contracts/interfaces/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/introspection/IERC165.sol\\\";\\n\",\"keccak256\":\"0xd04b0f06e0666f29cf7cccc82894de541e19bb30a765b107b1e40bb7fe5f7d7a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev 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 amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `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 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes calldata data\\n ) external;\\n\\n /**\\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 {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the caller.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool _approved) external;\\n\\n /**\\n * @dev Returns 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\",\"keccak256\":\"0xed6a749c5373af398105ce6ee3ac4763aa450ea7285d268c85d9eeca809cdb1f\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../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\",\"keccak256\":\"0x75b829ff2f26c14355d1cba20e16fe7b29ca58eb5fef665ede48bc0f9c6c74b9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _HEX_SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\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 // Inspired by OraclizeAPI's implementation - MIT licence\\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\\n\\n if (value == 0) {\\n return \\\"0\\\";\\n }\\n uint256 temp = value;\\n uint256 digits;\\n while (temp != 0) {\\n digits++;\\n temp /= 10;\\n }\\n bytes memory buffer = new bytes(digits);\\n while (value != 0) {\\n digits -= 1;\\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\\n value /= 10;\\n }\\n return string(buffer);\\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 if (value == 0) {\\n return \\\"0x00\\\";\\n }\\n uint256 temp = value;\\n uint256 length = 0;\\n while (temp != 0) {\\n length++;\\n temp >>= 8;\\n }\\n return toHexString(value, length);\\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 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_SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\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 representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n}\\n\",\"keccak256\":\"0xaf159a8b1923ad2a26d516089bceca9bdeaeacd04be50983ea00ba63070f08a3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"@prb/math/src/Common.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\n// Common.sol\\n//\\n// Common mathematical functions used in both SD59x18 and UD60x18. Note that these global functions do not\\n// always operate with SD59x18 and UD60x18 numbers.\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CUSTOM ERRORS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @notice Thrown when the resultant value in {mulDiv} overflows uint256.\\nerror PRBMath_MulDiv_Overflow(uint256 x, uint256 y, uint256 denominator);\\n\\n/// @notice Thrown when the resultant value in {mulDiv18} overflows uint256.\\nerror PRBMath_MulDiv18_Overflow(uint256 x, uint256 y);\\n\\n/// @notice Thrown when one of the inputs passed to {mulDivSigned} is `type(int256).min`.\\nerror PRBMath_MulDivSigned_InputTooSmall();\\n\\n/// @notice Thrown when the resultant value in {mulDivSigned} overflows int256.\\nerror PRBMath_MulDivSigned_Overflow(int256 x, int256 y);\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CONSTANTS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @dev The maximum value a uint128 number can have.\\nuint128 constant MAX_UINT128 = type(uint128).max;\\n\\n/// @dev The maximum value a uint40 number can have.\\nuint40 constant MAX_UINT40 = type(uint40).max;\\n\\n/// @dev The unit number, which the decimal precision of the fixed-point types.\\nuint256 constant UNIT = 1e18;\\n\\n/// @dev The unit number inverted mod 2^256.\\nuint256 constant UNIT_INVERSE = 78156646155174841979727994598816262306175212592076161876661_508869554232690281;\\n\\n/// @dev The the largest power of two that divides the decimal value of `UNIT`. The logarithm of this value is the least significant\\n/// bit in the binary representation of `UNIT`.\\nuint256 constant UNIT_LPOTD = 262144;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @notice Calculates the binary exponent of x using the binary fraction method.\\n/// @dev Has to use 192.64-bit fixed-point numbers. See https://ethereum.stackexchange.com/a/96594/24693.\\n/// @param x The exponent as an unsigned 192.64-bit fixed-point number.\\n/// @return result The result as an unsigned 60.18-decimal fixed-point number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp2(uint256 x) pure returns (uint256 result) {\\n unchecked {\\n // Start from 0.5 in the 192.64-bit fixed-point format.\\n result = 0x800000000000000000000000000000000000000000000000;\\n\\n // The following logic multiplies the result by $\\\\sqrt{2^{-i}}$ when the bit at position i is 1. Key points:\\n //\\n // 1. Intermediate results will not overflow, as the starting point is 2^191 and all magic factors are under 2^65.\\n // 2. The rationale for organizing the if statements into groups of 8 is gas savings. If the result of performing\\n // a bitwise AND operation between x and any value in the array [0x80; 0x40; 0x20; 0x10; 0x08; 0x04; 0x02; 0x01] is 1,\\n // we know that `x & 0xFF` is also 1.\\n if (x & 0xFF00000000000000 > 0) {\\n if (x & 0x8000000000000000 > 0) {\\n result = (result * 0x16A09E667F3BCC909) >> 64;\\n }\\n if (x & 0x4000000000000000 > 0) {\\n result = (result * 0x1306FE0A31B7152DF) >> 64;\\n }\\n if (x & 0x2000000000000000 > 0) {\\n result = (result * 0x1172B83C7D517ADCE) >> 64;\\n }\\n if (x & 0x1000000000000000 > 0) {\\n result = (result * 0x10B5586CF9890F62A) >> 64;\\n }\\n if (x & 0x800000000000000 > 0) {\\n result = (result * 0x1059B0D31585743AE) >> 64;\\n }\\n if (x & 0x400000000000000 > 0) {\\n result = (result * 0x102C9A3E778060EE7) >> 64;\\n }\\n if (x & 0x200000000000000 > 0) {\\n result = (result * 0x10163DA9FB33356D8) >> 64;\\n }\\n if (x & 0x100000000000000 > 0) {\\n result = (result * 0x100B1AFA5ABCBED61) >> 64;\\n }\\n }\\n\\n if (x & 0xFF000000000000 > 0) {\\n if (x & 0x80000000000000 > 0) {\\n result = (result * 0x10058C86DA1C09EA2) >> 64;\\n }\\n if (x & 0x40000000000000 > 0) {\\n result = (result * 0x1002C605E2E8CEC50) >> 64;\\n }\\n if (x & 0x20000000000000 > 0) {\\n result = (result * 0x100162F3904051FA1) >> 64;\\n }\\n if (x & 0x10000000000000 > 0) {\\n result = (result * 0x1000B175EFFDC76BA) >> 64;\\n }\\n if (x & 0x8000000000000 > 0) {\\n result = (result * 0x100058BA01FB9F96D) >> 64;\\n }\\n if (x & 0x4000000000000 > 0) {\\n result = (result * 0x10002C5CC37DA9492) >> 64;\\n }\\n if (x & 0x2000000000000 > 0) {\\n result = (result * 0x1000162E525EE0547) >> 64;\\n }\\n if (x & 0x1000000000000 > 0) {\\n result = (result * 0x10000B17255775C04) >> 64;\\n }\\n }\\n\\n if (x & 0xFF0000000000 > 0) {\\n if (x & 0x800000000000 > 0) {\\n result = (result * 0x1000058B91B5BC9AE) >> 64;\\n }\\n if (x & 0x400000000000 > 0) {\\n result = (result * 0x100002C5C89D5EC6D) >> 64;\\n }\\n if (x & 0x200000000000 > 0) {\\n result = (result * 0x10000162E43F4F831) >> 64;\\n }\\n if (x & 0x100000000000 > 0) {\\n result = (result * 0x100000B1721BCFC9A) >> 64;\\n }\\n if (x & 0x80000000000 > 0) {\\n result = (result * 0x10000058B90CF1E6E) >> 64;\\n }\\n if (x & 0x40000000000 > 0) {\\n result = (result * 0x1000002C5C863B73F) >> 64;\\n }\\n if (x & 0x20000000000 > 0) {\\n result = (result * 0x100000162E430E5A2) >> 64;\\n }\\n if (x & 0x10000000000 > 0) {\\n result = (result * 0x1000000B172183551) >> 64;\\n }\\n }\\n\\n if (x & 0xFF00000000 > 0) {\\n if (x & 0x8000000000 > 0) {\\n result = (result * 0x100000058B90C0B49) >> 64;\\n }\\n if (x & 0x4000000000 > 0) {\\n result = (result * 0x10000002C5C8601CC) >> 64;\\n }\\n if (x & 0x2000000000 > 0) {\\n result = (result * 0x1000000162E42FFF0) >> 64;\\n }\\n if (x & 0x1000000000 > 0) {\\n result = (result * 0x10000000B17217FBB) >> 64;\\n }\\n if (x & 0x800000000 > 0) {\\n result = (result * 0x1000000058B90BFCE) >> 64;\\n }\\n if (x & 0x400000000 > 0) {\\n result = (result * 0x100000002C5C85FE3) >> 64;\\n }\\n if (x & 0x200000000 > 0) {\\n result = (result * 0x10000000162E42FF1) >> 64;\\n }\\n if (x & 0x100000000 > 0) {\\n result = (result * 0x100000000B17217F8) >> 64;\\n }\\n }\\n\\n if (x & 0xFF000000 > 0) {\\n if (x & 0x80000000 > 0) {\\n result = (result * 0x10000000058B90BFC) >> 64;\\n }\\n if (x & 0x40000000 > 0) {\\n result = (result * 0x1000000002C5C85FE) >> 64;\\n }\\n if (x & 0x20000000 > 0) {\\n result = (result * 0x100000000162E42FF) >> 64;\\n }\\n if (x & 0x10000000 > 0) {\\n result = (result * 0x1000000000B17217F) >> 64;\\n }\\n if (x & 0x8000000 > 0) {\\n result = (result * 0x100000000058B90C0) >> 64;\\n }\\n if (x & 0x4000000 > 0) {\\n result = (result * 0x10000000002C5C860) >> 64;\\n }\\n if (x & 0x2000000 > 0) {\\n result = (result * 0x1000000000162E430) >> 64;\\n }\\n if (x & 0x1000000 > 0) {\\n result = (result * 0x10000000000B17218) >> 64;\\n }\\n }\\n\\n if (x & 0xFF0000 > 0) {\\n if (x & 0x800000 > 0) {\\n result = (result * 0x1000000000058B90C) >> 64;\\n }\\n if (x & 0x400000 > 0) {\\n result = (result * 0x100000000002C5C86) >> 64;\\n }\\n if (x & 0x200000 > 0) {\\n result = (result * 0x10000000000162E43) >> 64;\\n }\\n if (x & 0x100000 > 0) {\\n result = (result * 0x100000000000B1721) >> 64;\\n }\\n if (x & 0x80000 > 0) {\\n result = (result * 0x10000000000058B91) >> 64;\\n }\\n if (x & 0x40000 > 0) {\\n result = (result * 0x1000000000002C5C8) >> 64;\\n }\\n if (x & 0x20000 > 0) {\\n result = (result * 0x100000000000162E4) >> 64;\\n }\\n if (x & 0x10000 > 0) {\\n result = (result * 0x1000000000000B172) >> 64;\\n }\\n }\\n\\n if (x & 0xFF00 > 0) {\\n if (x & 0x8000 > 0) {\\n result = (result * 0x100000000000058B9) >> 64;\\n }\\n if (x & 0x4000 > 0) {\\n result = (result * 0x10000000000002C5D) >> 64;\\n }\\n if (x & 0x2000 > 0) {\\n result = (result * 0x1000000000000162E) >> 64;\\n }\\n if (x & 0x1000 > 0) {\\n result = (result * 0x10000000000000B17) >> 64;\\n }\\n if (x & 0x800 > 0) {\\n result = (result * 0x1000000000000058C) >> 64;\\n }\\n if (x & 0x400 > 0) {\\n result = (result * 0x100000000000002C6) >> 64;\\n }\\n if (x & 0x200 > 0) {\\n result = (result * 0x10000000000000163) >> 64;\\n }\\n if (x & 0x100 > 0) {\\n result = (result * 0x100000000000000B1) >> 64;\\n }\\n }\\n\\n if (x & 0xFF > 0) {\\n if (x & 0x80 > 0) {\\n result = (result * 0x10000000000000059) >> 64;\\n }\\n if (x & 0x40 > 0) {\\n result = (result * 0x1000000000000002C) >> 64;\\n }\\n if (x & 0x20 > 0) {\\n result = (result * 0x10000000000000016) >> 64;\\n }\\n if (x & 0x10 > 0) {\\n result = (result * 0x1000000000000000B) >> 64;\\n }\\n if (x & 0x8 > 0) {\\n result = (result * 0x10000000000000006) >> 64;\\n }\\n if (x & 0x4 > 0) {\\n result = (result * 0x10000000000000003) >> 64;\\n }\\n if (x & 0x2 > 0) {\\n result = (result * 0x10000000000000001) >> 64;\\n }\\n if (x & 0x1 > 0) {\\n result = (result * 0x10000000000000001) >> 64;\\n }\\n }\\n\\n // In the code snippet below, two operations are executed simultaneously:\\n //\\n // 1. The result is multiplied by $(2^n + 1)$, where $2^n$ represents the integer part, and the additional 1\\n // accounts for the initial guess of 0.5. This is achieved by subtracting from 191 instead of 192.\\n // 2. The result is then converted to an unsigned 60.18-decimal fixed-point format.\\n //\\n // The underlying logic is based on the relationship $2^{191-ip} = 2^{ip} / 2^{191}$, where $ip$ denotes the,\\n // integer part, $2^n$.\\n result *= UNIT;\\n result >>= (191 - (x >> 64));\\n }\\n}\\n\\n/// @notice Finds the zero-based index of the first 1 in the binary representation of x.\\n///\\n/// @dev See the note on \\\"msb\\\" in this Wikipedia article: https://en.wikipedia.org/wiki/Find_first_set\\n///\\n/// Each step in this implementation is equivalent to this high-level code:\\n///\\n/// ```solidity\\n/// if (x >= 2 ** 128) {\\n/// x >>= 128;\\n/// result += 128;\\n/// }\\n/// ```\\n///\\n/// Where 128 is replaced with each respective power of two factor. See the full high-level implementation here:\\n/// https://gist.github.com/PaulRBerg/f932f8693f2733e30c4d479e8e980948\\n///\\n/// The Yul instructions used below are:\\n///\\n/// - \\\"gt\\\" is \\\"greater than\\\"\\n/// - \\\"or\\\" is the OR bitwise operator\\n/// - \\\"shl\\\" is \\\"shift left\\\"\\n/// - \\\"shr\\\" is \\\"shift right\\\"\\n///\\n/// @param x The uint256 number for which to find the index of the most significant bit.\\n/// @return result The index of the most significant bit as a uint256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction msb(uint256 x) pure returns (uint256 result) {\\n // 2^128\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(7, gt(x, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^64\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(6, gt(x, 0xFFFFFFFFFFFFFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^32\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(5, gt(x, 0xFFFFFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^16\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(4, gt(x, 0xFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^8\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(3, gt(x, 0xFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^4\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(2, gt(x, 0xF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^2\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(1, gt(x, 0x3))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^1\\n // No need to shift x any more.\\n assembly (\\\"memory-safe\\\") {\\n let factor := gt(x, 0x1)\\n result := or(result, factor)\\n }\\n}\\n\\n/// @notice Calculates x*y\\u00f7denominator with 512-bit precision.\\n///\\n/// @dev Credits to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv.\\n///\\n/// Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - The denominator must not be zero.\\n/// - The result must fit in uint256.\\n///\\n/// @param x The multiplicand as a uint256.\\n/// @param y The multiplier as a uint256.\\n/// @param denominator The divisor as a uint256.\\n/// @return result The result as a uint256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mulDiv(uint256 x, uint256 y, uint256 denominator) pure returns (uint256 result) {\\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; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly (\\\"memory-safe\\\") {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\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 unchecked {\\n return prod0 / denominator;\\n }\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n if (prod1 >= denominator) {\\n revert PRBMath_MulDiv_Overflow(x, y, denominator);\\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 (\\\"memory-safe\\\") {\\n // Compute remainder using the mulmod Yul instruction.\\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 unchecked {\\n // Calculate the largest power of two divisor of the denominator using the unary operator ~. This operation cannot overflow\\n // because the denominator cannot be zero at this point in the function execution. The result is always >= 1.\\n // For more detail, see https://cs.stackexchange.com/q/138556/92363.\\n uint256 lpotdod = denominator & (~denominator + 1);\\n uint256 flippedLpotdod;\\n\\n assembly (\\\"memory-safe\\\") {\\n // Factor powers of two out of denominator.\\n denominator := div(denominator, lpotdod)\\n\\n // Divide [prod1 prod0] by lpotdod.\\n prod0 := div(prod0, lpotdod)\\n\\n // Get the flipped value `2^256 / lpotdod`. If the `lpotdod` is zero, the flipped value is one.\\n // `sub(0, lpotdod)` produces the two's complement version of `lpotdod`, which is equivalent to flipping all the bits.\\n // However, `div` interprets this value as an unsigned value: https://ethereum.stackexchange.com/q/147168/24693\\n flippedLpotdod := add(div(sub(0, lpotdod), lpotdod), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * flippedLpotdod;\\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 works\\n // 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 }\\n}\\n\\n/// @notice Calculates x*y\\u00f71e18 with 512-bit precision.\\n///\\n/// @dev A variant of {mulDiv} with constant folding, i.e. in which the denominator is hard coded to 1e18.\\n///\\n/// Notes:\\n/// - The body is purposely left uncommented; to understand how this works, see the documentation in {mulDiv}.\\n/// - The result is rounded toward zero.\\n/// - We take as an axiom that the result cannot be `MAX_UINT256` when x and y solve the following system of equations:\\n///\\n/// $$\\n/// \\\\begin{cases}\\n/// x * y = MAX\\\\_UINT256 * UNIT \\\\\\\\\\n/// (x * y) \\\\% UNIT \\\\geq \\\\frac{UNIT}{2}\\n/// \\\\end{cases}\\n/// $$\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {mulDiv}.\\n/// - The result must fit in uint256.\\n///\\n/// @param x The multiplicand as an unsigned 60.18-decimal fixed-point number.\\n/// @param y The multiplier as an unsigned 60.18-decimal fixed-point number.\\n/// @return result The result as an unsigned 60.18-decimal fixed-point number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mulDiv18(uint256 x, uint256 y) pure returns (uint256 result) {\\n uint256 prod0;\\n uint256 prod1;\\n assembly (\\\"memory-safe\\\") {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n if (prod1 == 0) {\\n unchecked {\\n return prod0 / UNIT;\\n }\\n }\\n\\n if (prod1 >= UNIT) {\\n revert PRBMath_MulDiv18_Overflow(x, y);\\n }\\n\\n uint256 remainder;\\n assembly (\\\"memory-safe\\\") {\\n remainder := mulmod(x, y, UNIT)\\n result :=\\n mul(\\n or(\\n div(sub(prod0, remainder), UNIT_LPOTD),\\n mul(sub(prod1, gt(remainder, prod0)), add(div(sub(0, UNIT_LPOTD), UNIT_LPOTD), 1))\\n ),\\n UNIT_INVERSE\\n )\\n }\\n}\\n\\n/// @notice Calculates x*y\\u00f7denominator with 512-bit precision.\\n///\\n/// @dev This is an extension of {mulDiv} for signed numbers, which works by computing the signs and the absolute values separately.\\n///\\n/// Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {mulDiv}.\\n/// - None of the inputs can be `type(int256).min`.\\n/// - The result must fit in int256.\\n///\\n/// @param x The multiplicand as an int256.\\n/// @param y The multiplier as an int256.\\n/// @param denominator The divisor as an int256.\\n/// @return result The result as an int256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mulDivSigned(int256 x, int256 y, int256 denominator) pure returns (int256 result) {\\n if (x == type(int256).min || y == type(int256).min || denominator == type(int256).min) {\\n revert PRBMath_MulDivSigned_InputTooSmall();\\n }\\n\\n // Get hold of the absolute values of x, y and the denominator.\\n uint256 xAbs;\\n uint256 yAbs;\\n uint256 dAbs;\\n unchecked {\\n xAbs = x < 0 ? uint256(-x) : uint256(x);\\n yAbs = y < 0 ? uint256(-y) : uint256(y);\\n dAbs = denominator < 0 ? uint256(-denominator) : uint256(denominator);\\n }\\n\\n // Compute the absolute value of x*y\\u00f7denominator. The result must fit in int256.\\n uint256 resultAbs = mulDiv(xAbs, yAbs, dAbs);\\n if (resultAbs > uint256(type(int256).max)) {\\n revert PRBMath_MulDivSigned_Overflow(x, y);\\n }\\n\\n // Get the signs of x, y and the denominator.\\n uint256 sx;\\n uint256 sy;\\n uint256 sd;\\n assembly (\\\"memory-safe\\\") {\\n // \\\"sgt\\\" is the \\\"signed greater than\\\" assembly instruction and \\\"sub(0,1)\\\" is -1 in two's complement.\\n sx := sgt(x, sub(0, 1))\\n sy := sgt(y, sub(0, 1))\\n sd := sgt(denominator, sub(0, 1))\\n }\\n\\n // XOR over sx, sy and sd. What this does is to check whether there are 1 or 3 negative signs in the inputs.\\n // If there are, the result should be negative. Otherwise, it should be positive.\\n unchecked {\\n result = sx ^ sy ^ sd == 0 ? -int256(resultAbs) : int256(resultAbs);\\n }\\n}\\n\\n/// @notice Calculates the square root of x using the Babylonian method.\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\\n///\\n/// Notes:\\n/// - If x is not a perfect square, the result is rounded down.\\n/// - Credits to OpenZeppelin for the explanations in comments below.\\n///\\n/// @param x The uint256 number for which to calculate the square root.\\n/// @return result The result as a uint256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction sqrt(uint256 x) pure returns (uint256 result) {\\n if (x == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we calculate the biggest power of 2 which is smaller than the square root of x.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of x is a power of 2 such that we have:\\n //\\n // $$\\n // msb(x) <= x <= 2*msb(x)$\\n // $$\\n //\\n // We write $msb(x)$ as $2^k$, and we get:\\n //\\n // $$\\n // k = log_2(x)\\n // $$\\n //\\n // Thus, we can write the initial inequality as:\\n //\\n // $$\\n // 2^{log_2(x)} <= x <= 2*2^{log_2(x)+1} \\\\\\\\\\n // sqrt(2^k) <= sqrt(x) < sqrt(2^{k+1}) \\\\\\\\\\n // 2^{k/2} <= sqrt(x) < 2^{(k+1)/2} <= 2^{(k/2)+1}\\n // $$\\n //\\n // Consequently, $2^{log_2(x) /2} is a good first approximation of sqrt(x) with at least one correct bit.\\n uint256 xAux = uint256(x);\\n result = 1;\\n if (xAux >= 2 ** 128) {\\n xAux >>= 128;\\n result <<= 64;\\n }\\n if (xAux >= 2 ** 64) {\\n xAux >>= 64;\\n result <<= 32;\\n }\\n if (xAux >= 2 ** 32) {\\n xAux >>= 32;\\n result <<= 16;\\n }\\n if (xAux >= 2 ** 16) {\\n xAux >>= 16;\\n result <<= 8;\\n }\\n if (xAux >= 2 ** 8) {\\n xAux >>= 8;\\n result <<= 4;\\n }\\n if (xAux >= 2 ** 4) {\\n xAux >>= 4;\\n result <<= 2;\\n }\\n if (xAux >= 2 ** 2) {\\n result <<= 1;\\n }\\n\\n // At this point, `result` is an estimation with at least one bit of precision. We know the true value has at\\n // most 128 bits, since it is the square root of a uint256. Newton's method converges quadratically (precision\\n // doubles at every iteration). We thus need at most 7 iteration to turn our partial result with one bit of\\n // precision into the expected uint128 result.\\n unchecked {\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n\\n // If x is not a perfect square, round the result toward zero.\\n uint256 roundedResult = x / result;\\n if (result >= roundedResult) {\\n result = roundedResult;\\n }\\n }\\n}\\n\",\"keccak256\":\"0xaa374e2c26cc93e8c22a6953804ee05f811597ef5fa82f76824378b22944778b\",\"license\":\"MIT\"},\"@prb/math/src/UD2x18.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\n/*\\n\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2550\\u2550\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2554\\u2588\\u2588\\u2588\\u2588\\u2554\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551 \\u255a\\u2550\\u255d \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\n\\n\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2550\\u2550\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d \\u255a\\u2588\\u2588\\u2588\\u2554\\u255d \\u255a\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u255d\\n\\n*/\\n\\nimport \\\"./ud2x18/Casting.sol\\\";\\nimport \\\"./ud2x18/Constants.sol\\\";\\nimport \\\"./ud2x18/Errors.sol\\\";\\nimport \\\"./ud2x18/ValueType.sol\\\";\\n\",\"keccak256\":\"0xfb624e24cd8bb790fa08e7827819de85504a86e20e961fa4ad126c65b6d90641\",\"license\":\"MIT\"},\"@prb/math/src/UD60x18.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\n/*\\n\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2550\\u2550\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2554\\u2588\\u2588\\u2588\\u2588\\u2554\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551 \\u255a\\u2550\\u255d \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\n\\n\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2550\\u2588\\u2588\\u2588\\u2588\\u2557\\u255a\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2588\\u2588\\u2551 \\u255a\\u2588\\u2588\\u2588\\u2554\\u255d \\u255a\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2554\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2554\\u255d \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u255d\\n\\n*/\\n\\nimport \\\"./ud60x18/Casting.sol\\\";\\nimport \\\"./ud60x18/Constants.sol\\\";\\nimport \\\"./ud60x18/Conversions.sol\\\";\\nimport \\\"./ud60x18/Errors.sol\\\";\\nimport \\\"./ud60x18/Helpers.sol\\\";\\nimport \\\"./ud60x18/Math.sol\\\";\\nimport \\\"./ud60x18/ValueType.sol\\\";\\n\",\"keccak256\":\"0xb98c6f74275914d279e8af6c502c2b1f50d5f6e1ed418d3b0153f5a193206c48\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as CastingErrors;\\nimport { SD59x18 } from \\\"../sd59x18/ValueType.sol\\\";\\nimport { UD2x18 } from \\\"../ud2x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"../ud60x18/ValueType.sol\\\";\\nimport { SD1x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts an SD1x18 number into SD59x18.\\n/// @dev There is no overflow check because the domain of SD1x18 is a subset of SD59x18.\\nfunction intoSD59x18(SD1x18 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(int256(SD1x18.unwrap(x)));\\n}\\n\\n/// @notice Casts an SD1x18 number into UD2x18.\\n/// - x must be positive.\\nfunction intoUD2x18(SD1x18 x) pure returns (UD2x18 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUD2x18_Underflow(x);\\n }\\n result = UD2x18.wrap(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into UD60x18.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUD60x18(SD1x18 x) pure returns (UD60x18 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUD60x18_Underflow(x);\\n }\\n result = UD60x18.wrap(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into uint256.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUint256(SD1x18 x) pure returns (uint256 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint256_Underflow(x);\\n }\\n result = uint256(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into uint128.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUint128(SD1x18 x) pure returns (uint128 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint128_Underflow(x);\\n }\\n result = uint128(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(SD1x18 x) pure returns (uint40 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint40_Underflow(x);\\n }\\n if (xInt > int64(uint64(Common.MAX_UINT40))) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint40_Overflow(x);\\n }\\n result = uint40(uint64(xInt));\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction sd1x18(int64 x) pure returns (SD1x18 result) {\\n result = SD1x18.wrap(x);\\n}\\n\\n/// @notice Unwraps an SD1x18 number into int64.\\nfunction unwrap(SD1x18 x) pure returns (int64 result) {\\n result = SD1x18.unwrap(x);\\n}\\n\\n/// @notice Wraps an int64 number into SD1x18.\\nfunction wrap(int64 x) pure returns (SD1x18 result) {\\n result = SD1x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x9e49e2b37c1bb845861740805edaaef3fe951a7b96eef16ce84fbf76e8278670\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD1x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @dev Euler's number as an SD1x18 number.\\nSD1x18 constant E = SD1x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum value an SD1x18 number can have.\\nint64 constant uMAX_SD1x18 = 9_223372036854775807;\\nSD1x18 constant MAX_SD1x18 = SD1x18.wrap(uMAX_SD1x18);\\n\\n/// @dev The maximum value an SD1x18 number can have.\\nint64 constant uMIN_SD1x18 = -9_223372036854775808;\\nSD1x18 constant MIN_SD1x18 = SD1x18.wrap(uMIN_SD1x18);\\n\\n/// @dev PI as an SD1x18 number.\\nSD1x18 constant PI = SD1x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of SD1x18.\\nSD1x18 constant UNIT = SD1x18.wrap(1e18);\\nint64 constant uUNIT = 1e18;\\n\",\"keccak256\":\"0x6496165b80552785a4b65a239b96e2a5fedf62fe54f002eeed72d75e566d7585\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD1x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in UD2x18.\\nerror PRBMath_SD1x18_ToUD2x18_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in UD60x18.\\nerror PRBMath_SD1x18_ToUD60x18_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint128.\\nerror PRBMath_SD1x18_ToUint128_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint256.\\nerror PRBMath_SD1x18_ToUint256_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint40.\\nerror PRBMath_SD1x18_ToUint40_Overflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint40.\\nerror PRBMath_SD1x18_ToUint40_Underflow(SD1x18 x);\\n\",\"keccak256\":\"0x836cb42ba619ca369fd4765bc47fefc3c3621369c5861882af14660aca5057ee\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\n\\n/// @notice The signed 1.18-decimal fixed-point number representation, which can have up to 1 digit and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\\n/// type int64. This is useful when end users want to use int64 to save gas, e.g. with tight variable packing in contract\\n/// storage.\\ntype SD1x18 is int64;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoSD59x18,\\n Casting.intoUD2x18,\\n Casting.intoUD60x18,\\n Casting.intoUint256,\\n Casting.intoUint128,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for SD1x18 global;\\n\",\"keccak256\":\"0x2f86f1aa9fca42f40808b51a879b406ac51817647bdb9642f8a79dd8fdb754a7\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Errors.sol\\\" as CastingErrors;\\nimport { MAX_UINT128, MAX_UINT40 } from \\\"../Common.sol\\\";\\nimport { uMAX_SD1x18, uMIN_SD1x18 } from \\\"../sd1x18/Constants.sol\\\";\\nimport { SD1x18 } from \\\"../sd1x18/ValueType.sol\\\";\\nimport { uMAX_UD2x18 } from \\\"../ud2x18/Constants.sol\\\";\\nimport { UD2x18 } from \\\"../ud2x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"../ud60x18/ValueType.sol\\\";\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts an SD59x18 number into int256.\\n/// @dev This is basically a functional alias for {unwrap}.\\nfunction intoInt256(SD59x18 x) pure returns (int256 result) {\\n result = SD59x18.unwrap(x);\\n}\\n\\n/// @notice Casts an SD59x18 number into SD1x18.\\n/// @dev Requirements:\\n/// - x must be greater than or equal to `uMIN_SD1x18`.\\n/// - x must be less than or equal to `uMAX_SD1x18`.\\nfunction intoSD1x18(SD59x18 x) pure returns (SD1x18 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < uMIN_SD1x18) {\\n revert CastingErrors.PRBMath_SD59x18_IntoSD1x18_Underflow(x);\\n }\\n if (xInt > uMAX_SD1x18) {\\n revert CastingErrors.PRBMath_SD59x18_IntoSD1x18_Overflow(x);\\n }\\n result = SD1x18.wrap(int64(xInt));\\n}\\n\\n/// @notice Casts an SD59x18 number into UD2x18.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `uMAX_UD2x18`.\\nfunction intoUD2x18(SD59x18 x) pure returns (UD2x18 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUD2x18_Underflow(x);\\n }\\n if (xInt > int256(uint256(uMAX_UD2x18))) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUD2x18_Overflow(x);\\n }\\n result = UD2x18.wrap(uint64(uint256(xInt)));\\n}\\n\\n/// @notice Casts an SD59x18 number into UD60x18.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUD60x18(SD59x18 x) pure returns (UD60x18 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUD60x18_Underflow(x);\\n }\\n result = UD60x18.wrap(uint256(xInt));\\n}\\n\\n/// @notice Casts an SD59x18 number into uint256.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUint256(SD59x18 x) pure returns (uint256 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint256_Underflow(x);\\n }\\n result = uint256(xInt);\\n}\\n\\n/// @notice Casts an SD59x18 number into uint128.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `uMAX_UINT128`.\\nfunction intoUint128(SD59x18 x) pure returns (uint128 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint128_Underflow(x);\\n }\\n if (xInt > int256(uint256(MAX_UINT128))) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint128_Overflow(x);\\n }\\n result = uint128(uint256(xInt));\\n}\\n\\n/// @notice Casts an SD59x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(SD59x18 x) pure returns (uint40 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint40_Underflow(x);\\n }\\n if (xInt > int256(uint256(MAX_UINT40))) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint40_Overflow(x);\\n }\\n result = uint40(uint256(xInt));\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction sd(int256 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(x);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction sd59x18(int256 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(x);\\n}\\n\\n/// @notice Unwraps an SD59x18 number into int256.\\nfunction unwrap(SD59x18 x) pure returns (int256 result) {\\n result = SD59x18.unwrap(x);\\n}\\n\\n/// @notice Wraps an int256 number into SD59x18.\\nfunction wrap(int256 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x3b21b60ec2998c3ae32f647412da51d3683b3f183a807198cc8d157499484f99\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n// NOTICE: the \\\"u\\\" prefix stands for \\\"unwrapped\\\".\\n\\n/// @dev Euler's number as an SD59x18 number.\\nSD59x18 constant E = SD59x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum input permitted in {exp}.\\nint256 constant uEXP_MAX_INPUT = 133_084258667509499440;\\nSD59x18 constant EXP_MAX_INPUT = SD59x18.wrap(uEXP_MAX_INPUT);\\n\\n/// @dev Any value less than this returns 0 in {exp}.\\nint256 constant uEXP_MIN_THRESHOLD = -41_446531673892822322;\\nSD59x18 constant EXP_MIN_THRESHOLD = SD59x18.wrap(uEXP_MIN_THRESHOLD);\\n\\n/// @dev The maximum input permitted in {exp2}.\\nint256 constant uEXP2_MAX_INPUT = 192e18 - 1;\\nSD59x18 constant EXP2_MAX_INPUT = SD59x18.wrap(uEXP2_MAX_INPUT);\\n\\n/// @dev Any value less than this returns 0 in {exp2}.\\nint256 constant uEXP2_MIN_THRESHOLD = -59_794705707972522261;\\nSD59x18 constant EXP2_MIN_THRESHOLD = SD59x18.wrap(uEXP2_MIN_THRESHOLD);\\n\\n/// @dev Half the UNIT number.\\nint256 constant uHALF_UNIT = 0.5e18;\\nSD59x18 constant HALF_UNIT = SD59x18.wrap(uHALF_UNIT);\\n\\n/// @dev $log_2(10)$ as an SD59x18 number.\\nint256 constant uLOG2_10 = 3_321928094887362347;\\nSD59x18 constant LOG2_10 = SD59x18.wrap(uLOG2_10);\\n\\n/// @dev $log_2(e)$ as an SD59x18 number.\\nint256 constant uLOG2_E = 1_442695040888963407;\\nSD59x18 constant LOG2_E = SD59x18.wrap(uLOG2_E);\\n\\n/// @dev The maximum value an SD59x18 number can have.\\nint256 constant uMAX_SD59x18 = 57896044618658097711785492504343953926634992332820282019728_792003956564819967;\\nSD59x18 constant MAX_SD59x18 = SD59x18.wrap(uMAX_SD59x18);\\n\\n/// @dev The maximum whole value an SD59x18 number can have.\\nint256 constant uMAX_WHOLE_SD59x18 = 57896044618658097711785492504343953926634992332820282019728_000000000000000000;\\nSD59x18 constant MAX_WHOLE_SD59x18 = SD59x18.wrap(uMAX_WHOLE_SD59x18);\\n\\n/// @dev The minimum value an SD59x18 number can have.\\nint256 constant uMIN_SD59x18 = -57896044618658097711785492504343953926634992332820282019728_792003956564819968;\\nSD59x18 constant MIN_SD59x18 = SD59x18.wrap(uMIN_SD59x18);\\n\\n/// @dev The minimum whole value an SD59x18 number can have.\\nint256 constant uMIN_WHOLE_SD59x18 = -57896044618658097711785492504343953926634992332820282019728_000000000000000000;\\nSD59x18 constant MIN_WHOLE_SD59x18 = SD59x18.wrap(uMIN_WHOLE_SD59x18);\\n\\n/// @dev PI as an SD59x18 number.\\nSD59x18 constant PI = SD59x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of SD59x18.\\nint256 constant uUNIT = 1e18;\\nSD59x18 constant UNIT = SD59x18.wrap(1e18);\\n\\n/// @dev The unit number squared.\\nint256 constant uUNIT_SQUARED = 1e36;\\nSD59x18 constant UNIT_SQUARED = SD59x18.wrap(uUNIT_SQUARED);\\n\\n/// @dev Zero as an SD59x18 number.\\nSD59x18 constant ZERO = SD59x18.wrap(0);\\n\",\"keccak256\":\"0x9bcb8dd6b3e886d140ad1c32747a4f6d29a492529ceb835be878ae837aa6cc3a\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when taking the absolute value of `MIN_SD59x18`.\\nerror PRBMath_SD59x18_Abs_MinSD59x18();\\n\\n/// @notice Thrown when ceiling a number overflows SD59x18.\\nerror PRBMath_SD59x18_Ceil_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when converting a basic integer to the fixed-point format overflows SD59x18.\\nerror PRBMath_SD59x18_Convert_Overflow(int256 x);\\n\\n/// @notice Thrown when converting a basic integer to the fixed-point format underflows SD59x18.\\nerror PRBMath_SD59x18_Convert_Underflow(int256 x);\\n\\n/// @notice Thrown when dividing two numbers and one of them is `MIN_SD59x18`.\\nerror PRBMath_SD59x18_Div_InputTooSmall();\\n\\n/// @notice Thrown when dividing two numbers and one of the intermediary unsigned results overflows SD59x18.\\nerror PRBMath_SD59x18_Div_Overflow(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when taking the natural exponent of a base greater than 133_084258667509499441.\\nerror PRBMath_SD59x18_Exp_InputTooBig(SD59x18 x);\\n\\n/// @notice Thrown when taking the binary exponent of a base greater than 192e18.\\nerror PRBMath_SD59x18_Exp2_InputTooBig(SD59x18 x);\\n\\n/// @notice Thrown when flooring a number underflows SD59x18.\\nerror PRBMath_SD59x18_Floor_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when taking the geometric mean of two numbers and their product is negative.\\nerror PRBMath_SD59x18_Gm_NegativeProduct(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when taking the geometric mean of two numbers and multiplying them overflows SD59x18.\\nerror PRBMath_SD59x18_Gm_Overflow(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\\nerror PRBMath_SD59x18_IntoSD1x18_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\\nerror PRBMath_SD59x18_IntoSD1x18_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\\nerror PRBMath_SD59x18_IntoUD2x18_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\\nerror PRBMath_SD59x18_IntoUD2x18_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD60x18.\\nerror PRBMath_SD59x18_IntoUD60x18_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\\nerror PRBMath_SD59x18_IntoUint128_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\\nerror PRBMath_SD59x18_IntoUint128_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint256.\\nerror PRBMath_SD59x18_IntoUint256_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\\nerror PRBMath_SD59x18_IntoUint40_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\\nerror PRBMath_SD59x18_IntoUint40_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when taking the logarithm of a number less than or equal to zero.\\nerror PRBMath_SD59x18_Log_InputTooSmall(SD59x18 x);\\n\\n/// @notice Thrown when multiplying two numbers and one of the inputs is `MIN_SD59x18`.\\nerror PRBMath_SD59x18_Mul_InputTooSmall();\\n\\n/// @notice Thrown when multiplying two numbers and the intermediary absolute result overflows SD59x18.\\nerror PRBMath_SD59x18_Mul_Overflow(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when raising a number to a power and the intermediary absolute result overflows SD59x18.\\nerror PRBMath_SD59x18_Powu_Overflow(SD59x18 x, uint256 y);\\n\\n/// @notice Thrown when taking the square root of a negative number.\\nerror PRBMath_SD59x18_Sqrt_NegativeInput(SD59x18 x);\\n\\n/// @notice Thrown when the calculating the square root overflows SD59x18.\\nerror PRBMath_SD59x18_Sqrt_Overflow(SD59x18 x);\\n\",\"keccak256\":\"0xa6d00fe5efa215ac0df25c896e3da99a12fb61e799644b2ec32da947313d3db4\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Helpers.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { wrap } from \\\"./Casting.sol\\\";\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Implements the checked addition operation (+) in the SD59x18 type.\\nfunction add(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n return wrap(x.unwrap() + y.unwrap());\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the SD59x18 type.\\nfunction and(SD59x18 x, int256 bits) pure returns (SD59x18 result) {\\n return wrap(x.unwrap() & bits);\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the SD59x18 type.\\nfunction and2(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n return wrap(x.unwrap() & y.unwrap());\\n}\\n\\n/// @notice Implements the equal (=) operation in the SD59x18 type.\\nfunction eq(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() == y.unwrap();\\n}\\n\\n/// @notice Implements the greater than operation (>) in the SD59x18 type.\\nfunction gt(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() > y.unwrap();\\n}\\n\\n/// @notice Implements the greater than or equal to operation (>=) in the SD59x18 type.\\nfunction gte(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() >= y.unwrap();\\n}\\n\\n/// @notice Implements a zero comparison check function in the SD59x18 type.\\nfunction isZero(SD59x18 x) pure returns (bool result) {\\n result = x.unwrap() == 0;\\n}\\n\\n/// @notice Implements the left shift operation (<<) in the SD59x18 type.\\nfunction lshift(SD59x18 x, uint256 bits) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() << bits);\\n}\\n\\n/// @notice Implements the lower than operation (<) in the SD59x18 type.\\nfunction lt(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() < y.unwrap();\\n}\\n\\n/// @notice Implements the lower than or equal to operation (<=) in the SD59x18 type.\\nfunction lte(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() <= y.unwrap();\\n}\\n\\n/// @notice Implements the unchecked modulo operation (%) in the SD59x18 type.\\nfunction mod(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() % y.unwrap());\\n}\\n\\n/// @notice Implements the not equal operation (!=) in the SD59x18 type.\\nfunction neq(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() != y.unwrap();\\n}\\n\\n/// @notice Implements the NOT (~) bitwise operation in the SD59x18 type.\\nfunction not(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(~x.unwrap());\\n}\\n\\n/// @notice Implements the OR (|) bitwise operation in the SD59x18 type.\\nfunction or(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() | y.unwrap());\\n}\\n\\n/// @notice Implements the right shift operation (>>) in the SD59x18 type.\\nfunction rshift(SD59x18 x, uint256 bits) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() >> bits);\\n}\\n\\n/// @notice Implements the checked subtraction operation (-) in the SD59x18 type.\\nfunction sub(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() - y.unwrap());\\n}\\n\\n/// @notice Implements the checked unary minus operation (-) in the SD59x18 type.\\nfunction unary(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(-x.unwrap());\\n}\\n\\n/// @notice Implements the unchecked addition operation (+) in the SD59x18 type.\\nfunction uncheckedAdd(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() + y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the unchecked subtraction operation (-) in the SD59x18 type.\\nfunction uncheckedSub(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() - y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the unchecked unary minus operation (-) in the SD59x18 type.\\nfunction uncheckedUnary(SD59x18 x) pure returns (SD59x18 result) {\\n unchecked {\\n result = wrap(-x.unwrap());\\n }\\n}\\n\\n/// @notice Implements the XOR (^) bitwise operation in the SD59x18 type.\\nfunction xor(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() ^ y.unwrap());\\n}\\n\",\"keccak256\":\"0x208570f1657cf730cb6c3d81aa14030e0d45cf906cdedea5059369d7df4bb716\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as Errors;\\nimport {\\n uEXP_MAX_INPUT,\\n uEXP2_MAX_INPUT,\\n uEXP_MIN_THRESHOLD,\\n uEXP2_MIN_THRESHOLD,\\n uHALF_UNIT,\\n uLOG2_10,\\n uLOG2_E,\\n uMAX_SD59x18,\\n uMAX_WHOLE_SD59x18,\\n uMIN_SD59x18,\\n uMIN_WHOLE_SD59x18,\\n UNIT,\\n uUNIT,\\n uUNIT_SQUARED,\\n ZERO\\n} from \\\"./Constants.sol\\\";\\nimport { wrap } from \\\"./Helpers.sol\\\";\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Calculates the absolute value of x.\\n///\\n/// @dev Requirements:\\n/// - x must be greater than `MIN_SD59x18`.\\n///\\n/// @param x The SD59x18 number for which to calculate the absolute value.\\n/// @param result The absolute value of x as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction abs(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt == uMIN_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Abs_MinSD59x18();\\n }\\n result = xInt < 0 ? wrap(-xInt) : x;\\n}\\n\\n/// @notice Calculates the arithmetic average of x and y.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// @param x The first operand as an SD59x18 number.\\n/// @param y The second operand as an SD59x18 number.\\n/// @return result The arithmetic average as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction avg(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n\\n unchecked {\\n // This operation is equivalent to `x / 2 + y / 2`, and it can never overflow.\\n int256 sum = (xInt >> 1) + (yInt >> 1);\\n\\n if (sum < 0) {\\n // If at least one of x and y is odd, add 1 to the result, because shifting negative numbers to the right\\n // rounds toward negative infinity. The right part is equivalent to `sum + (x % 2 == 1 || y % 2 == 1)`.\\n assembly (\\\"memory-safe\\\") {\\n result := add(sum, and(or(xInt, yInt), 1))\\n }\\n } else {\\n // Add 1 if both x and y are odd to account for the double 0.5 remainder truncated after shifting.\\n result = wrap(sum + (xInt & yInt & 1));\\n }\\n }\\n}\\n\\n/// @notice Yields the smallest whole number greater than or equal to x.\\n///\\n/// @dev Optimized for fractional value inputs, because every whole value has (1e18 - 1) fractional counterparts.\\n/// See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n///\\n/// Requirements:\\n/// - x must be less than or equal to `MAX_WHOLE_SD59x18`.\\n///\\n/// @param x The SD59x18 number to ceil.\\n/// @param result The smallest whole number greater than or equal to x, as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ceil(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt > uMAX_WHOLE_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Ceil_Overflow(x);\\n }\\n\\n int256 remainder = xInt % uUNIT;\\n if (remainder == 0) {\\n result = x;\\n } else {\\n unchecked {\\n // Solidity uses C fmod style, which returns a modulus with the same sign as x.\\n int256 resultInt = xInt - remainder;\\n if (xInt > 0) {\\n resultInt += uUNIT;\\n }\\n result = wrap(resultInt);\\n }\\n }\\n}\\n\\n/// @notice Divides two SD59x18 numbers, returning a new SD59x18 number.\\n///\\n/// @dev This is an extension of {Common.mulDiv} for signed numbers, which works by computing the signs and the absolute\\n/// values separately.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv}.\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv}.\\n/// - None of the inputs can be `MIN_SD59x18`.\\n/// - The denominator must not be zero.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The numerator as an SD59x18 number.\\n/// @param y The denominator as an SD59x18 number.\\n/// @param result The quotient as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction div(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n if (xInt == uMIN_SD59x18 || yInt == uMIN_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Div_InputTooSmall();\\n }\\n\\n // Get hold of the absolute values of x and y.\\n uint256 xAbs;\\n uint256 yAbs;\\n unchecked {\\n xAbs = xInt < 0 ? uint256(-xInt) : uint256(xInt);\\n yAbs = yInt < 0 ? uint256(-yInt) : uint256(yInt);\\n }\\n\\n // Compute the absolute value (x*UNIT\\u00f7y). The resulting value must fit in SD59x18.\\n uint256 resultAbs = Common.mulDiv(xAbs, uint256(uUNIT), yAbs);\\n if (resultAbs > uint256(uMAX_SD59x18)) {\\n revert Errors.PRBMath_SD59x18_Div_Overflow(x, y);\\n }\\n\\n // Check if x and y have the same sign using two's complement representation. The left-most bit represents the sign (1 for\\n // negative, 0 for positive or zero).\\n bool sameSign = (xInt ^ yInt) > -1;\\n\\n // If the inputs have the same sign, the result should be positive. Otherwise, it should be negative.\\n unchecked {\\n result = wrap(sameSign ? int256(resultAbs) : -int256(resultAbs));\\n }\\n}\\n\\n/// @notice Calculates the natural exponent of x using the following formula:\\n///\\n/// $$\\n/// e^x = 2^{x * log_2{e}}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {exp2}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {exp2}.\\n/// - x must be less than 133_084258667509499441.\\n///\\n/// @param x The exponent as an SD59x18 number.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n\\n // Any input less than the threshold returns zero.\\n // This check also prevents an overflow for very small numbers.\\n if (xInt < uEXP_MIN_THRESHOLD) {\\n return ZERO;\\n }\\n\\n // This check prevents values greater than 192e18 from being passed to {exp2}.\\n if (xInt > uEXP_MAX_INPUT) {\\n revert Errors.PRBMath_SD59x18_Exp_InputTooBig(x);\\n }\\n\\n unchecked {\\n // Inline the fixed-point multiplication to save gas.\\n int256 doubleUnitProduct = xInt * uLOG2_E;\\n result = exp2(wrap(doubleUnitProduct / uUNIT));\\n }\\n}\\n\\n/// @notice Calculates the binary exponent of x using the binary fraction method using the following formula:\\n///\\n/// $$\\n/// 2^{-x} = \\\\frac{1}{2^x}\\n/// $$\\n///\\n/// @dev See https://ethereum.stackexchange.com/q/79903/24693.\\n///\\n/// Notes:\\n/// - If x is less than -59_794705707972522261, the result is zero.\\n///\\n/// Requirements:\\n/// - x must be less than 192e18.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The exponent as an SD59x18 number.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp2(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < 0) {\\n // The inverse of any number less than the threshold is truncated to zero.\\n if (xInt < uEXP2_MIN_THRESHOLD) {\\n return ZERO;\\n }\\n\\n unchecked {\\n // Inline the fixed-point inversion to save gas.\\n result = wrap(uUNIT_SQUARED / exp2(wrap(-xInt)).unwrap());\\n }\\n } else {\\n // Numbers greater than or equal to 192e18 don't fit in the 192.64-bit format.\\n if (xInt > uEXP2_MAX_INPUT) {\\n revert Errors.PRBMath_SD59x18_Exp2_InputTooBig(x);\\n }\\n\\n unchecked {\\n // Convert x to the 192.64-bit fixed-point format.\\n uint256 x_192x64 = uint256((xInt << 64) / uUNIT);\\n\\n // It is safe to cast the result to int256 due to the checks above.\\n result = wrap(int256(Common.exp2(x_192x64)));\\n }\\n }\\n}\\n\\n/// @notice Yields the greatest whole number less than or equal to x.\\n///\\n/// @dev Optimized for fractional value inputs, because for every whole value there are (1e18 - 1) fractional\\n/// counterparts. See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n///\\n/// Requirements:\\n/// - x must be greater than or equal to `MIN_WHOLE_SD59x18`.\\n///\\n/// @param x The SD59x18 number to floor.\\n/// @param result The greatest whole number less than or equal to x, as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction floor(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < uMIN_WHOLE_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Floor_Underflow(x);\\n }\\n\\n int256 remainder = xInt % uUNIT;\\n if (remainder == 0) {\\n result = x;\\n } else {\\n unchecked {\\n // Solidity uses C fmod style, which returns a modulus with the same sign as x.\\n int256 resultInt = xInt - remainder;\\n if (xInt < 0) {\\n resultInt -= uUNIT;\\n }\\n result = wrap(resultInt);\\n }\\n }\\n}\\n\\n/// @notice Yields the excess beyond the floor of x for positive numbers and the part of the number to the right.\\n/// of the radix point for negative numbers.\\n/// @dev Based on the odd function definition. https://en.wikipedia.org/wiki/Fractional_part\\n/// @param x The SD59x18 number to get the fractional part of.\\n/// @param result The fractional part of x as an SD59x18 number.\\nfunction frac(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() % uUNIT);\\n}\\n\\n/// @notice Calculates the geometric mean of x and y, i.e. $\\\\sqrt{x * y}$.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x * y must fit in SD59x18.\\n/// - x * y must not be negative, since complex numbers are not supported.\\n///\\n/// @param x The first operand as an SD59x18 number.\\n/// @param y The second operand as an SD59x18 number.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction gm(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n if (xInt == 0 || yInt == 0) {\\n return ZERO;\\n }\\n\\n unchecked {\\n // Equivalent to `xy / x != y`. Checking for overflow this way is faster than letting Solidity do it.\\n int256 xyInt = xInt * yInt;\\n if (xyInt / xInt != yInt) {\\n revert Errors.PRBMath_SD59x18_Gm_Overflow(x, y);\\n }\\n\\n // The product must not be negative, since complex numbers are not supported.\\n if (xyInt < 0) {\\n revert Errors.PRBMath_SD59x18_Gm_NegativeProduct(x, y);\\n }\\n\\n // We don't need to multiply the result by `UNIT` here because the x*y product picked up a factor of `UNIT`\\n // during multiplication. See the comments in {Common.sqrt}.\\n uint256 resultUint = Common.sqrt(uint256(xyInt));\\n result = wrap(int256(resultUint));\\n }\\n}\\n\\n/// @notice Calculates the inverse of x.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x must not be zero.\\n///\\n/// @param x The SD59x18 number for which to calculate the inverse.\\n/// @return result The inverse as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction inv(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(uUNIT_SQUARED / x.unwrap());\\n}\\n\\n/// @notice Calculates the natural logarithm of x using the following formula:\\n///\\n/// $$\\n/// ln{x} = log_2{x} / log_2{e}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n/// - The precision isn't sufficiently fine-grained to return exactly `UNIT` when the input is `E`.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The SD59x18 number for which to calculate the natural logarithm.\\n/// @return result The natural logarithm as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ln(SD59x18 x) pure returns (SD59x18 result) {\\n // Inline the fixed-point multiplication to save gas. This is overflow-safe because the maximum value that\\n // {log2} can return is ~195_205294292027477728.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_E);\\n}\\n\\n/// @notice Calculates the common logarithm of x using the following formula:\\n///\\n/// $$\\n/// log_{10}{x} = log_2{x} / log_2{10}\\n/// $$\\n///\\n/// However, if x is an exact power of ten, a hard coded value is returned.\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The SD59x18 number for which to calculate the common logarithm.\\n/// @return result The common logarithm as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log10(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < 0) {\\n revert Errors.PRBMath_SD59x18_Log_InputTooSmall(x);\\n }\\n\\n // Note that the `mul` in this block is the standard multiplication operation, not {SD59x18.mul}.\\n // prettier-ignore\\n assembly (\\\"memory-safe\\\") {\\n switch x\\n case 1 { result := mul(uUNIT, sub(0, 18)) }\\n case 10 { result := mul(uUNIT, sub(1, 18)) }\\n case 100 { result := mul(uUNIT, sub(2, 18)) }\\n case 1000 { result := mul(uUNIT, sub(3, 18)) }\\n case 10000 { result := mul(uUNIT, sub(4, 18)) }\\n case 100000 { result := mul(uUNIT, sub(5, 18)) }\\n case 1000000 { result := mul(uUNIT, sub(6, 18)) }\\n case 10000000 { result := mul(uUNIT, sub(7, 18)) }\\n case 100000000 { result := mul(uUNIT, sub(8, 18)) }\\n case 1000000000 { result := mul(uUNIT, sub(9, 18)) }\\n case 10000000000 { result := mul(uUNIT, sub(10, 18)) }\\n case 100000000000 { result := mul(uUNIT, sub(11, 18)) }\\n case 1000000000000 { result := mul(uUNIT, sub(12, 18)) }\\n case 10000000000000 { result := mul(uUNIT, sub(13, 18)) }\\n case 100000000000000 { result := mul(uUNIT, sub(14, 18)) }\\n case 1000000000000000 { result := mul(uUNIT, sub(15, 18)) }\\n case 10000000000000000 { result := mul(uUNIT, sub(16, 18)) }\\n case 100000000000000000 { result := mul(uUNIT, sub(17, 18)) }\\n case 1000000000000000000 { result := 0 }\\n case 10000000000000000000 { result := uUNIT }\\n case 100000000000000000000 { result := mul(uUNIT, 2) }\\n case 1000000000000000000000 { result := mul(uUNIT, 3) }\\n case 10000000000000000000000 { result := mul(uUNIT, 4) }\\n case 100000000000000000000000 { result := mul(uUNIT, 5) }\\n case 1000000000000000000000000 { result := mul(uUNIT, 6) }\\n case 10000000000000000000000000 { result := mul(uUNIT, 7) }\\n case 100000000000000000000000000 { result := mul(uUNIT, 8) }\\n case 1000000000000000000000000000 { result := mul(uUNIT, 9) }\\n case 10000000000000000000000000000 { result := mul(uUNIT, 10) }\\n case 100000000000000000000000000000 { result := mul(uUNIT, 11) }\\n case 1000000000000000000000000000000 { result := mul(uUNIT, 12) }\\n case 10000000000000000000000000000000 { result := mul(uUNIT, 13) }\\n case 100000000000000000000000000000000 { result := mul(uUNIT, 14) }\\n case 1000000000000000000000000000000000 { result := mul(uUNIT, 15) }\\n case 10000000000000000000000000000000000 { result := mul(uUNIT, 16) }\\n case 100000000000000000000000000000000000 { result := mul(uUNIT, 17) }\\n case 1000000000000000000000000000000000000 { result := mul(uUNIT, 18) }\\n case 10000000000000000000000000000000000000 { result := mul(uUNIT, 19) }\\n case 100000000000000000000000000000000000000 { result := mul(uUNIT, 20) }\\n case 1000000000000000000000000000000000000000 { result := mul(uUNIT, 21) }\\n case 10000000000000000000000000000000000000000 { result := mul(uUNIT, 22) }\\n case 100000000000000000000000000000000000000000 { result := mul(uUNIT, 23) }\\n case 1000000000000000000000000000000000000000000 { result := mul(uUNIT, 24) }\\n case 10000000000000000000000000000000000000000000 { result := mul(uUNIT, 25) }\\n case 100000000000000000000000000000000000000000000 { result := mul(uUNIT, 26) }\\n case 1000000000000000000000000000000000000000000000 { result := mul(uUNIT, 27) }\\n case 10000000000000000000000000000000000000000000000 { result := mul(uUNIT, 28) }\\n case 100000000000000000000000000000000000000000000000 { result := mul(uUNIT, 29) }\\n case 1000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 30) }\\n case 10000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 31) }\\n case 100000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 32) }\\n case 1000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 33) }\\n case 10000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 34) }\\n case 100000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 35) }\\n case 1000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 36) }\\n case 10000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 37) }\\n case 100000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 38) }\\n case 1000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 39) }\\n case 10000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 40) }\\n case 100000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 41) }\\n case 1000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 42) }\\n case 10000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 43) }\\n case 100000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 44) }\\n case 1000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 45) }\\n case 10000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 46) }\\n case 100000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 47) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 48) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 49) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 50) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 51) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 52) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 53) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 54) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 55) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 56) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 57) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 58) }\\n default { result := uMAX_SD59x18 }\\n }\\n\\n if (result.unwrap() == uMAX_SD59x18) {\\n unchecked {\\n // Inline the fixed-point division to save gas.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_10);\\n }\\n }\\n}\\n\\n/// @notice Calculates the binary logarithm of x using the iterative approximation algorithm:\\n///\\n/// $$\\n/// log_2{x} = n + log_2{y}, \\\\text{ where } y = x*2^{-n}, \\\\ y \\\\in [1, 2)\\n/// $$\\n///\\n/// For $0 \\\\leq x \\\\lt 1$, the input is inverted:\\n///\\n/// $$\\n/// log_2{x} = -log_2{\\\\frac{1}{x}}\\n/// $$\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Binary_logarithm#Iterative_approximation.\\n///\\n/// Notes:\\n/// - Due to the lossy precision of the iterative approximation, the results are not perfectly accurate to the last decimal.\\n///\\n/// Requirements:\\n/// - x must be greater than zero.\\n///\\n/// @param x The SD59x18 number for which to calculate the binary logarithm.\\n/// @return result The binary logarithm as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log2(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt <= 0) {\\n revert Errors.PRBMath_SD59x18_Log_InputTooSmall(x);\\n }\\n\\n unchecked {\\n int256 sign;\\n if (xInt >= uUNIT) {\\n sign = 1;\\n } else {\\n sign = -1;\\n // Inline the fixed-point inversion to save gas.\\n xInt = uUNIT_SQUARED / xInt;\\n }\\n\\n // Calculate the integer part of the logarithm.\\n uint256 n = Common.msb(uint256(xInt / uUNIT));\\n\\n // This is the integer part of the logarithm as an SD59x18 number. The operation can't overflow\\n // because n is at most 255, `UNIT` is 1e18, and the sign is either 1 or -1.\\n int256 resultInt = int256(n) * uUNIT;\\n\\n // Calculate $y = x * 2^{-n}$.\\n int256 y = xInt >> n;\\n\\n // If y is the unit number, the fractional part is zero.\\n if (y == uUNIT) {\\n return wrap(resultInt * sign);\\n }\\n\\n // Calculate the fractional part via the iterative approximation.\\n // The `delta >>= 1` part is equivalent to `delta /= 2`, but shifting bits is more gas efficient.\\n int256 DOUBLE_UNIT = 2e18;\\n for (int256 delta = uHALF_UNIT; delta > 0; delta >>= 1) {\\n y = (y * y) / uUNIT;\\n\\n // Is y^2 >= 2e18 and so in the range [2e18, 4e18)?\\n if (y >= DOUBLE_UNIT) {\\n // Add the 2^{-m} factor to the logarithm.\\n resultInt = resultInt + delta;\\n\\n // Halve y, which corresponds to z/2 in the Wikipedia article.\\n y >>= 1;\\n }\\n }\\n resultInt *= sign;\\n result = wrap(resultInt);\\n }\\n}\\n\\n/// @notice Multiplies two SD59x18 numbers together, returning a new SD59x18 number.\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {Common.mulDiv18}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv18}.\\n/// - None of the inputs can be `MIN_SD59x18`.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The multiplicand as an SD59x18 number.\\n/// @param y The multiplier as an SD59x18 number.\\n/// @return result The product as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mul(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n if (xInt == uMIN_SD59x18 || yInt == uMIN_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Mul_InputTooSmall();\\n }\\n\\n // Get hold of the absolute values of x and y.\\n uint256 xAbs;\\n uint256 yAbs;\\n unchecked {\\n xAbs = xInt < 0 ? uint256(-xInt) : uint256(xInt);\\n yAbs = yInt < 0 ? uint256(-yInt) : uint256(yInt);\\n }\\n\\n // Compute the absolute value (x*y\\u00f7UNIT). The resulting value must fit in SD59x18.\\n uint256 resultAbs = Common.mulDiv18(xAbs, yAbs);\\n if (resultAbs > uint256(uMAX_SD59x18)) {\\n revert Errors.PRBMath_SD59x18_Mul_Overflow(x, y);\\n }\\n\\n // Check if x and y have the same sign using two's complement representation. The left-most bit represents the sign (1 for\\n // negative, 0 for positive or zero).\\n bool sameSign = (xInt ^ yInt) > -1;\\n\\n // If the inputs have the same sign, the result should be positive. Otherwise, it should be negative.\\n unchecked {\\n result = wrap(sameSign ? int256(resultAbs) : -int256(resultAbs));\\n }\\n}\\n\\n/// @notice Raises x to the power of y using the following formula:\\n///\\n/// $$\\n/// x^y = 2^{log_2{x} * y}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {exp2}, {log2}, and {mul}.\\n/// - Returns `UNIT` for 0^0.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {exp2}, {log2}, and {mul}.\\n///\\n/// @param x The base as an SD59x18 number.\\n/// @param y Exponent to raise x to, as an SD59x18 number\\n/// @return result x raised to power y, as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction pow(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n\\n // If both x and y are zero, the result is `UNIT`. If just x is zero, the result is always zero.\\n if (xInt == 0) {\\n return yInt == 0 ? UNIT : ZERO;\\n }\\n // If x is `UNIT`, the result is always `UNIT`.\\n else if (xInt == uUNIT) {\\n return UNIT;\\n }\\n\\n // If y is zero, the result is always `UNIT`.\\n if (yInt == 0) {\\n return UNIT;\\n }\\n // If y is `UNIT`, the result is always x.\\n else if (yInt == uUNIT) {\\n return x;\\n }\\n\\n // Calculate the result using the formula.\\n result = exp2(mul(log2(x), y));\\n}\\n\\n/// @notice Raises x (an SD59x18 number) to the power y (an unsigned basic integer) using the well-known\\n/// algorithm \\\"exponentiation by squaring\\\".\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Exponentiation_by_squaring.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv18}.\\n/// - Returns `UNIT` for 0^0.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {abs} and {Common.mulDiv18}.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The base as an SD59x18 number.\\n/// @param y The exponent as a uint256.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction powu(SD59x18 x, uint256 y) pure returns (SD59x18 result) {\\n uint256 xAbs = uint256(abs(x).unwrap());\\n\\n // Calculate the first iteration of the loop in advance.\\n uint256 resultAbs = y & 1 > 0 ? xAbs : uint256(uUNIT);\\n\\n // Equivalent to `for(y /= 2; y > 0; y /= 2)`.\\n uint256 yAux = y;\\n for (yAux >>= 1; yAux > 0; yAux >>= 1) {\\n xAbs = Common.mulDiv18(xAbs, xAbs);\\n\\n // Equivalent to `y % 2 == 1`.\\n if (yAux & 1 > 0) {\\n resultAbs = Common.mulDiv18(resultAbs, xAbs);\\n }\\n }\\n\\n // The result must fit in SD59x18.\\n if (resultAbs > uint256(uMAX_SD59x18)) {\\n revert Errors.PRBMath_SD59x18_Powu_Overflow(x, y);\\n }\\n\\n unchecked {\\n // Is the base negative and the exponent odd? If yes, the result should be negative.\\n int256 resultInt = int256(resultAbs);\\n bool isNegative = x.unwrap() < 0 && y & 1 == 1;\\n if (isNegative) {\\n resultInt = -resultInt;\\n }\\n result = wrap(resultInt);\\n }\\n}\\n\\n/// @notice Calculates the square root of x using the Babylonian method.\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\\n///\\n/// Notes:\\n/// - Only the positive root is returned.\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x cannot be negative, since complex numbers are not supported.\\n/// - x must be less than `MAX_SD59x18 / UNIT`.\\n///\\n/// @param x The SD59x18 number for which to calculate the square root.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction sqrt(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < 0) {\\n revert Errors.PRBMath_SD59x18_Sqrt_NegativeInput(x);\\n }\\n if (xInt > uMAX_SD59x18 / uUNIT) {\\n revert Errors.PRBMath_SD59x18_Sqrt_Overflow(x);\\n }\\n\\n unchecked {\\n // Multiply x by `UNIT` to account for the factor of `UNIT` picked up when multiplying two SD59x18 numbers.\\n // In this case, the two numbers are both the square root.\\n uint256 resultUint = Common.sqrt(uint256(xInt * uUNIT));\\n result = wrap(int256(resultUint));\\n }\\n}\\n\",\"keccak256\":\"0xa074831139fc89ca0e5a36086b30eb50896bb6770cd5823461b1f2769017d2f0\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\nimport \\\"./Helpers.sol\\\" as Helpers;\\nimport \\\"./Math.sol\\\" as Math;\\n\\n/// @notice The signed 59.18-decimal fixed-point number representation, which can have up to 59 digits and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\\n/// type int256.\\ntype SD59x18 is int256;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoInt256,\\n Casting.intoSD1x18,\\n Casting.intoUD2x18,\\n Casting.intoUD60x18,\\n Casting.intoUint256,\\n Casting.intoUint128,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for SD59x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n MATHEMATICAL FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Math.abs,\\n Math.avg,\\n Math.ceil,\\n Math.div,\\n Math.exp,\\n Math.exp2,\\n Math.floor,\\n Math.frac,\\n Math.gm,\\n Math.inv,\\n Math.log10,\\n Math.log2,\\n Math.ln,\\n Math.mul,\\n Math.pow,\\n Math.powu,\\n Math.sqrt\\n} for SD59x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n HELPER FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Helpers.add,\\n Helpers.and,\\n Helpers.eq,\\n Helpers.gt,\\n Helpers.gte,\\n Helpers.isZero,\\n Helpers.lshift,\\n Helpers.lt,\\n Helpers.lte,\\n Helpers.mod,\\n Helpers.neq,\\n Helpers.not,\\n Helpers.or,\\n Helpers.rshift,\\n Helpers.sub,\\n Helpers.uncheckedAdd,\\n Helpers.uncheckedSub,\\n Helpers.uncheckedUnary,\\n Helpers.xor\\n} for SD59x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n OPERATORS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes it possible to use these operators on the SD59x18 type.\\nusing {\\n Helpers.add as +,\\n Helpers.and2 as &,\\n Math.div as /,\\n Helpers.eq as ==,\\n Helpers.gt as >,\\n Helpers.gte as >=,\\n Helpers.lt as <,\\n Helpers.lte as <=,\\n Helpers.mod as %,\\n Math.mul as *,\\n Helpers.neq as !=,\\n Helpers.not as ~,\\n Helpers.or as |,\\n Helpers.sub as -,\\n Helpers.unary as -,\\n Helpers.xor as ^\\n} for SD59x18 global;\\n\",\"keccak256\":\"0xe03112d145dcd5863aff24e5f381debaae29d446acd5666f3d640e3d9af738d7\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as Errors;\\nimport { uMAX_SD1x18 } from \\\"../sd1x18/Constants.sol\\\";\\nimport { SD1x18 } from \\\"../sd1x18/ValueType.sol\\\";\\nimport { SD59x18 } from \\\"../sd59x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"../ud60x18/ValueType.sol\\\";\\nimport { UD2x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts a UD2x18 number into SD1x18.\\n/// - x must be less than or equal to `uMAX_SD1x18`.\\nfunction intoSD1x18(UD2x18 x) pure returns (SD1x18 result) {\\n uint64 xUint = UD2x18.unwrap(x);\\n if (xUint > uint64(uMAX_SD1x18)) {\\n revert Errors.PRBMath_UD2x18_IntoSD1x18_Overflow(x);\\n }\\n result = SD1x18.wrap(int64(xUint));\\n}\\n\\n/// @notice Casts a UD2x18 number into SD59x18.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of SD59x18.\\nfunction intoSD59x18(UD2x18 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(int256(uint256(UD2x18.unwrap(x))));\\n}\\n\\n/// @notice Casts a UD2x18 number into UD60x18.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of UD60x18.\\nfunction intoUD60x18(UD2x18 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(UD2x18.unwrap(x));\\n}\\n\\n/// @notice Casts a UD2x18 number into uint128.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of uint128.\\nfunction intoUint128(UD2x18 x) pure returns (uint128 result) {\\n result = uint128(UD2x18.unwrap(x));\\n}\\n\\n/// @notice Casts a UD2x18 number into uint256.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of uint256.\\nfunction intoUint256(UD2x18 x) pure returns (uint256 result) {\\n result = uint256(UD2x18.unwrap(x));\\n}\\n\\n/// @notice Casts a UD2x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(UD2x18 x) pure returns (uint40 result) {\\n uint64 xUint = UD2x18.unwrap(x);\\n if (xUint > uint64(Common.MAX_UINT40)) {\\n revert Errors.PRBMath_UD2x18_IntoUint40_Overflow(x);\\n }\\n result = uint40(xUint);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction ud2x18(uint64 x) pure returns (UD2x18 result) {\\n result = UD2x18.wrap(x);\\n}\\n\\n/// @notice Unwrap a UD2x18 number into uint64.\\nfunction unwrap(UD2x18 x) pure returns (uint64 result) {\\n result = UD2x18.unwrap(x);\\n}\\n\\n/// @notice Wraps a uint64 number into UD2x18.\\nfunction wrap(uint64 x) pure returns (UD2x18 result) {\\n result = UD2x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x9b1a35d432ef951a415fae8098b3c609a99b630a3d5464b3c8e1efa8893eea07\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD2x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @dev Euler's number as a UD2x18 number.\\nUD2x18 constant E = UD2x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum value a UD2x18 number can have.\\nuint64 constant uMAX_UD2x18 = 18_446744073709551615;\\nUD2x18 constant MAX_UD2x18 = UD2x18.wrap(uMAX_UD2x18);\\n\\n/// @dev PI as a UD2x18 number.\\nUD2x18 constant PI = UD2x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of UD2x18.\\nUD2x18 constant UNIT = UD2x18.wrap(1e18);\\nuint64 constant uUNIT = 1e18;\\n\",\"keccak256\":\"0x29b0e050c865899e1fb9022b460a7829cdee248c44c4299f068ba80695eec3fc\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD2x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when trying to cast a UD2x18 number that doesn't fit in SD1x18.\\nerror PRBMath_UD2x18_IntoSD1x18_Overflow(UD2x18 x);\\n\\n/// @notice Thrown when trying to cast a UD2x18 number that doesn't fit in uint40.\\nerror PRBMath_UD2x18_IntoUint40_Overflow(UD2x18 x);\\n\",\"keccak256\":\"0xdf1e22f0b4c8032bcc8b7f63fe3984e1387f3dc7b2e9ab381822249f75376d33\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\n\\n/// @notice The unsigned 2.18-decimal fixed-point number representation, which can have up to 2 digits and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\\n/// type uint64. This is useful when end users want to use uint64 to save gas, e.g. with tight variable packing in contract\\n/// storage.\\ntype UD2x18 is uint64;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoSD1x18,\\n Casting.intoSD59x18,\\n Casting.intoUD60x18,\\n Casting.intoUint256,\\n Casting.intoUint128,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for UD2x18 global;\\n\",\"keccak256\":\"0x2802edc9869db116a0b5c490cc5f8554742f747183fa30ac5e9c80bb967e61a1\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Errors.sol\\\" as CastingErrors;\\nimport { MAX_UINT128, MAX_UINT40 } from \\\"../Common.sol\\\";\\nimport { uMAX_SD1x18 } from \\\"../sd1x18/Constants.sol\\\";\\nimport { SD1x18 } from \\\"../sd1x18/ValueType.sol\\\";\\nimport { uMAX_SD59x18 } from \\\"../sd59x18/Constants.sol\\\";\\nimport { SD59x18 } from \\\"../sd59x18/ValueType.sol\\\";\\nimport { uMAX_UD2x18 } from \\\"../ud2x18/Constants.sol\\\";\\nimport { UD2x18 } from \\\"../ud2x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts a UD60x18 number into SD1x18.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `uMAX_SD1x18`.\\nfunction intoSD1x18(UD60x18 x) pure returns (SD1x18 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > uint256(int256(uMAX_SD1x18))) {\\n revert CastingErrors.PRBMath_UD60x18_IntoSD1x18_Overflow(x);\\n }\\n result = SD1x18.wrap(int64(uint64(xUint)));\\n}\\n\\n/// @notice Casts a UD60x18 number into UD2x18.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `uMAX_UD2x18`.\\nfunction intoUD2x18(UD60x18 x) pure returns (UD2x18 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > uMAX_UD2x18) {\\n revert CastingErrors.PRBMath_UD60x18_IntoUD2x18_Overflow(x);\\n }\\n result = UD2x18.wrap(uint64(xUint));\\n}\\n\\n/// @notice Casts a UD60x18 number into SD59x18.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `uMAX_SD59x18`.\\nfunction intoSD59x18(UD60x18 x) pure returns (SD59x18 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > uint256(uMAX_SD59x18)) {\\n revert CastingErrors.PRBMath_UD60x18_IntoSD59x18_Overflow(x);\\n }\\n result = SD59x18.wrap(int256(xUint));\\n}\\n\\n/// @notice Casts a UD60x18 number into uint128.\\n/// @dev This is basically an alias for {unwrap}.\\nfunction intoUint256(UD60x18 x) pure returns (uint256 result) {\\n result = UD60x18.unwrap(x);\\n}\\n\\n/// @notice Casts a UD60x18 number into uint128.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UINT128`.\\nfunction intoUint128(UD60x18 x) pure returns (uint128 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > MAX_UINT128) {\\n revert CastingErrors.PRBMath_UD60x18_IntoUint128_Overflow(x);\\n }\\n result = uint128(xUint);\\n}\\n\\n/// @notice Casts a UD60x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(UD60x18 x) pure returns (uint40 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > MAX_UINT40) {\\n revert CastingErrors.PRBMath_UD60x18_IntoUint40_Overflow(x);\\n }\\n result = uint40(xUint);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction ud(uint256 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(x);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction ud60x18(uint256 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(x);\\n}\\n\\n/// @notice Unwraps a UD60x18 number into uint256.\\nfunction unwrap(UD60x18 x) pure returns (uint256 result) {\\n result = UD60x18.unwrap(x);\\n}\\n\\n/// @notice Wraps a uint256 number into the UD60x18 value type.\\nfunction wrap(uint256 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x5bb532da36921cbdac64d1f16de5d366ef1f664502e3b7c07d0ad06917551f85\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n// NOTICE: the \\\"u\\\" prefix stands for \\\"unwrapped\\\".\\n\\n/// @dev Euler's number as a UD60x18 number.\\nUD60x18 constant E = UD60x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum input permitted in {exp}.\\nuint256 constant uEXP_MAX_INPUT = 133_084258667509499440;\\nUD60x18 constant EXP_MAX_INPUT = UD60x18.wrap(uEXP_MAX_INPUT);\\n\\n/// @dev The maximum input permitted in {exp2}.\\nuint256 constant uEXP2_MAX_INPUT = 192e18 - 1;\\nUD60x18 constant EXP2_MAX_INPUT = UD60x18.wrap(uEXP2_MAX_INPUT);\\n\\n/// @dev Half the UNIT number.\\nuint256 constant uHALF_UNIT = 0.5e18;\\nUD60x18 constant HALF_UNIT = UD60x18.wrap(uHALF_UNIT);\\n\\n/// @dev $log_2(10)$ as a UD60x18 number.\\nuint256 constant uLOG2_10 = 3_321928094887362347;\\nUD60x18 constant LOG2_10 = UD60x18.wrap(uLOG2_10);\\n\\n/// @dev $log_2(e)$ as a UD60x18 number.\\nuint256 constant uLOG2_E = 1_442695040888963407;\\nUD60x18 constant LOG2_E = UD60x18.wrap(uLOG2_E);\\n\\n/// @dev The maximum value a UD60x18 number can have.\\nuint256 constant uMAX_UD60x18 = 115792089237316195423570985008687907853269984665640564039457_584007913129639935;\\nUD60x18 constant MAX_UD60x18 = UD60x18.wrap(uMAX_UD60x18);\\n\\n/// @dev The maximum whole value a UD60x18 number can have.\\nuint256 constant uMAX_WHOLE_UD60x18 = 115792089237316195423570985008687907853269984665640564039457_000000000000000000;\\nUD60x18 constant MAX_WHOLE_UD60x18 = UD60x18.wrap(uMAX_WHOLE_UD60x18);\\n\\n/// @dev PI as a UD60x18 number.\\nUD60x18 constant PI = UD60x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of UD60x18.\\nuint256 constant uUNIT = 1e18;\\nUD60x18 constant UNIT = UD60x18.wrap(uUNIT);\\n\\n/// @dev The unit number squared.\\nuint256 constant uUNIT_SQUARED = 1e36;\\nUD60x18 constant UNIT_SQUARED = UD60x18.wrap(uUNIT_SQUARED);\\n\\n/// @dev Zero as a UD60x18 number.\\nUD60x18 constant ZERO = UD60x18.wrap(0);\\n\",\"keccak256\":\"0x2b80d26153d3fdcfb3a9ca772d9309d31ed1275f5b8b54c3ffb54d3652b37d90\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Conversions.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { uMAX_UD60x18, uUNIT } from \\\"./Constants.sol\\\";\\nimport { PRBMath_UD60x18_Convert_Overflow } from \\\"./Errors.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Converts a UD60x18 number to a simple integer by dividing it by `UNIT`.\\n/// @dev The result is rounded toward zero.\\n/// @param x The UD60x18 number to convert.\\n/// @return result The same number in basic integer form.\\nfunction convert(UD60x18 x) pure returns (uint256 result) {\\n result = UD60x18.unwrap(x) / uUNIT;\\n}\\n\\n/// @notice Converts a simple integer to UD60x18 by multiplying it by `UNIT`.\\n///\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UD60x18 / UNIT`.\\n///\\n/// @param x The basic integer to convert.\\n/// @param result The same number converted to UD60x18.\\nfunction convert(uint256 x) pure returns (UD60x18 result) {\\n if (x > uMAX_UD60x18 / uUNIT) {\\n revert PRBMath_UD60x18_Convert_Overflow(x);\\n }\\n unchecked {\\n result = UD60x18.wrap(x * uUNIT);\\n }\\n}\\n\",\"keccak256\":\"0xaf7fc2523413822de3b66ba339fe2884fb3b8c6f6cf38ec90a2c3e3aae71df6b\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when ceiling a number overflows UD60x18.\\nerror PRBMath_UD60x18_Ceil_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when converting a basic integer to the fixed-point format overflows UD60x18.\\nerror PRBMath_UD60x18_Convert_Overflow(uint256 x);\\n\\n/// @notice Thrown when taking the natural exponent of a base greater than 133_084258667509499441.\\nerror PRBMath_UD60x18_Exp_InputTooBig(UD60x18 x);\\n\\n/// @notice Thrown when taking the binary exponent of a base greater than 192e18.\\nerror PRBMath_UD60x18_Exp2_InputTooBig(UD60x18 x);\\n\\n/// @notice Thrown when taking the geometric mean of two numbers and multiplying them overflows UD60x18.\\nerror PRBMath_UD60x18_Gm_Overflow(UD60x18 x, UD60x18 y);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\\nerror PRBMath_UD60x18_IntoSD1x18_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD59x18.\\nerror PRBMath_UD60x18_IntoSD59x18_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\\nerror PRBMath_UD60x18_IntoUD2x18_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\\nerror PRBMath_UD60x18_IntoUint128_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\\nerror PRBMath_UD60x18_IntoUint40_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when taking the logarithm of a number less than 1.\\nerror PRBMath_UD60x18_Log_InputTooSmall(UD60x18 x);\\n\\n/// @notice Thrown when calculating the square root overflows UD60x18.\\nerror PRBMath_UD60x18_Sqrt_Overflow(UD60x18 x);\\n\",\"keccak256\":\"0xa8c60d4066248df22c49c882873efbc017344107edabc48c52209abbc39cb1e3\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Helpers.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { wrap } from \\\"./Casting.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Implements the checked addition operation (+) in the UD60x18 type.\\nfunction add(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() + y.unwrap());\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the UD60x18 type.\\nfunction and(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() & bits);\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the UD60x18 type.\\nfunction and2(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() & y.unwrap());\\n}\\n\\n/// @notice Implements the equal operation (==) in the UD60x18 type.\\nfunction eq(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() == y.unwrap();\\n}\\n\\n/// @notice Implements the greater than operation (>) in the UD60x18 type.\\nfunction gt(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() > y.unwrap();\\n}\\n\\n/// @notice Implements the greater than or equal to operation (>=) in the UD60x18 type.\\nfunction gte(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() >= y.unwrap();\\n}\\n\\n/// @notice Implements a zero comparison check function in the UD60x18 type.\\nfunction isZero(UD60x18 x) pure returns (bool result) {\\n // This wouldn't work if x could be negative.\\n result = x.unwrap() == 0;\\n}\\n\\n/// @notice Implements the left shift operation (<<) in the UD60x18 type.\\nfunction lshift(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() << bits);\\n}\\n\\n/// @notice Implements the lower than operation (<) in the UD60x18 type.\\nfunction lt(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() < y.unwrap();\\n}\\n\\n/// @notice Implements the lower than or equal to operation (<=) in the UD60x18 type.\\nfunction lte(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() <= y.unwrap();\\n}\\n\\n/// @notice Implements the checked modulo operation (%) in the UD60x18 type.\\nfunction mod(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() % y.unwrap());\\n}\\n\\n/// @notice Implements the not equal operation (!=) in the UD60x18 type.\\nfunction neq(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() != y.unwrap();\\n}\\n\\n/// @notice Implements the NOT (~) bitwise operation in the UD60x18 type.\\nfunction not(UD60x18 x) pure returns (UD60x18 result) {\\n result = wrap(~x.unwrap());\\n}\\n\\n/// @notice Implements the OR (|) bitwise operation in the UD60x18 type.\\nfunction or(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() | y.unwrap());\\n}\\n\\n/// @notice Implements the right shift operation (>>) in the UD60x18 type.\\nfunction rshift(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() >> bits);\\n}\\n\\n/// @notice Implements the checked subtraction operation (-) in the UD60x18 type.\\nfunction sub(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() - y.unwrap());\\n}\\n\\n/// @notice Implements the unchecked addition operation (+) in the UD60x18 type.\\nfunction uncheckedAdd(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() + y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the unchecked subtraction operation (-) in the UD60x18 type.\\nfunction uncheckedSub(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() - y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the XOR (^) bitwise operation in the UD60x18 type.\\nfunction xor(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() ^ y.unwrap());\\n}\\n\",\"keccak256\":\"0xf5faff881391d2c060029499a666cc5f0bea90a213150bb476fae8f02a5df268\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as Errors;\\nimport { wrap } from \\\"./Casting.sol\\\";\\nimport {\\n uEXP_MAX_INPUT,\\n uEXP2_MAX_INPUT,\\n uHALF_UNIT,\\n uLOG2_10,\\n uLOG2_E,\\n uMAX_UD60x18,\\n uMAX_WHOLE_UD60x18,\\n UNIT,\\n uUNIT,\\n uUNIT_SQUARED,\\n ZERO\\n} from \\\"./Constants.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n MATHEMATICAL FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @notice Calculates the arithmetic average of x and y using the following formula:\\n///\\n/// $$\\n/// avg(x, y) = (x & y) + ((xUint ^ yUint) / 2)\\n/// $$\\n///\\n/// In English, this is what this formula does:\\n///\\n/// 1. AND x and y.\\n/// 2. Calculate half of XOR x and y.\\n/// 3. Add the two results together.\\n///\\n/// This technique is known as SWAR, which stands for \\\"SIMD within a register\\\". You can read more about it here:\\n/// https://devblogs.microsoft.com/oldnewthing/20220207-00/?p=106223\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// @param x The first operand as a UD60x18 number.\\n/// @param y The second operand as a UD60x18 number.\\n/// @return result The arithmetic average as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction avg(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n uint256 yUint = y.unwrap();\\n unchecked {\\n result = wrap((xUint & yUint) + ((xUint ^ yUint) >> 1));\\n }\\n}\\n\\n/// @notice Yields the smallest whole number greater than or equal to x.\\n///\\n/// @dev This is optimized for fractional value inputs, because for every whole value there are (1e18 - 1) fractional\\n/// counterparts. See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n///\\n/// Requirements:\\n/// - x must be less than or equal to `MAX_WHOLE_UD60x18`.\\n///\\n/// @param x The UD60x18 number to ceil.\\n/// @param result The smallest whole number greater than or equal to x, as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ceil(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n if (xUint > uMAX_WHOLE_UD60x18) {\\n revert Errors.PRBMath_UD60x18_Ceil_Overflow(x);\\n }\\n\\n assembly (\\\"memory-safe\\\") {\\n // Equivalent to `x % UNIT`.\\n let remainder := mod(x, uUNIT)\\n\\n // Equivalent to `UNIT - remainder`.\\n let delta := sub(uUNIT, remainder)\\n\\n // Equivalent to `x + remainder > 0 ? delta : 0`.\\n result := add(x, mul(delta, gt(remainder, 0)))\\n }\\n}\\n\\n/// @notice Divides two UD60x18 numbers, returning a new UD60x18 number.\\n///\\n/// @dev Uses {Common.mulDiv} to enable overflow-safe multiplication and division.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv}.\\n///\\n/// @param x The numerator as a UD60x18 number.\\n/// @param y The denominator as a UD60x18 number.\\n/// @param result The quotient as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction div(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(Common.mulDiv(x.unwrap(), uUNIT, y.unwrap()));\\n}\\n\\n/// @notice Calculates the natural exponent of x using the following formula:\\n///\\n/// $$\\n/// e^x = 2^{x * log_2{e}}\\n/// $$\\n///\\n/// @dev Requirements:\\n/// - x must be less than 133_084258667509499441.\\n///\\n/// @param x The exponent as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n // This check prevents values greater than 192e18 from being passed to {exp2}.\\n if (xUint > uEXP_MAX_INPUT) {\\n revert Errors.PRBMath_UD60x18_Exp_InputTooBig(x);\\n }\\n\\n unchecked {\\n // Inline the fixed-point multiplication to save gas.\\n uint256 doubleUnitProduct = xUint * uLOG2_E;\\n result = exp2(wrap(doubleUnitProduct / uUNIT));\\n }\\n}\\n\\n/// @notice Calculates the binary exponent of x using the binary fraction method.\\n///\\n/// @dev See https://ethereum.stackexchange.com/q/79903/24693\\n///\\n/// Requirements:\\n/// - x must be less than 192e18.\\n/// - The result must fit in UD60x18.\\n///\\n/// @param x The exponent as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp2(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n // Numbers greater than or equal to 192e18 don't fit in the 192.64-bit format.\\n if (xUint > uEXP2_MAX_INPUT) {\\n revert Errors.PRBMath_UD60x18_Exp2_InputTooBig(x);\\n }\\n\\n // Convert x to the 192.64-bit fixed-point format.\\n uint256 x_192x64 = (xUint << 64) / uUNIT;\\n\\n // Pass x to the {Common.exp2} function, which uses the 192.64-bit fixed-point number representation.\\n result = wrap(Common.exp2(x_192x64));\\n}\\n\\n/// @notice Yields the greatest whole number less than or equal to x.\\n/// @dev Optimized for fractional value inputs, because every whole value has (1e18 - 1) fractional counterparts.\\n/// See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n/// @param x The UD60x18 number to floor.\\n/// @param result The greatest whole number less than or equal to x, as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction floor(UD60x18 x) pure returns (UD60x18 result) {\\n assembly (\\\"memory-safe\\\") {\\n // Equivalent to `x % UNIT`.\\n let remainder := mod(x, uUNIT)\\n\\n // Equivalent to `x - remainder > 0 ? remainder : 0)`.\\n result := sub(x, mul(remainder, gt(remainder, 0)))\\n }\\n}\\n\\n/// @notice Yields the excess beyond the floor of x using the odd function definition.\\n/// @dev See https://en.wikipedia.org/wiki/Fractional_part.\\n/// @param x The UD60x18 number to get the fractional part of.\\n/// @param result The fractional part of x as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction frac(UD60x18 x) pure returns (UD60x18 result) {\\n assembly (\\\"memory-safe\\\") {\\n result := mod(x, uUNIT)\\n }\\n}\\n\\n/// @notice Calculates the geometric mean of x and y, i.e. $\\\\sqrt{x * y}$, rounding down.\\n///\\n/// @dev Requirements:\\n/// - x * y must fit in UD60x18.\\n///\\n/// @param x The first operand as a UD60x18 number.\\n/// @param y The second operand as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction gm(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n uint256 yUint = y.unwrap();\\n if (xUint == 0 || yUint == 0) {\\n return ZERO;\\n }\\n\\n unchecked {\\n // Checking for overflow this way is faster than letting Solidity do it.\\n uint256 xyUint = xUint * yUint;\\n if (xyUint / xUint != yUint) {\\n revert Errors.PRBMath_UD60x18_Gm_Overflow(x, y);\\n }\\n\\n // We don't need to multiply the result by `UNIT` here because the x*y product picked up a factor of `UNIT`\\n // during multiplication. See the comments in {Common.sqrt}.\\n result = wrap(Common.sqrt(xyUint));\\n }\\n}\\n\\n/// @notice Calculates the inverse of x.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x must not be zero.\\n///\\n/// @param x The UD60x18 number for which to calculate the inverse.\\n/// @return result The inverse as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction inv(UD60x18 x) pure returns (UD60x18 result) {\\n unchecked {\\n result = wrap(uUNIT_SQUARED / x.unwrap());\\n }\\n}\\n\\n/// @notice Calculates the natural logarithm of x using the following formula:\\n///\\n/// $$\\n/// ln{x} = log_2{x} / log_2{e}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n/// - The precision isn't sufficiently fine-grained to return exactly `UNIT` when the input is `E`.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The UD60x18 number for which to calculate the natural logarithm.\\n/// @return result The natural logarithm as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ln(UD60x18 x) pure returns (UD60x18 result) {\\n unchecked {\\n // Inline the fixed-point multiplication to save gas. This is overflow-safe because the maximum value that\\n // {log2} can return is ~196_205294292027477728.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_E);\\n }\\n}\\n\\n/// @notice Calculates the common logarithm of x using the following formula:\\n///\\n/// $$\\n/// log_{10}{x} = log_2{x} / log_2{10}\\n/// $$\\n///\\n/// However, if x is an exact power of ten, a hard coded value is returned.\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The UD60x18 number for which to calculate the common logarithm.\\n/// @return result The common logarithm as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log10(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n if (xUint < uUNIT) {\\n revert Errors.PRBMath_UD60x18_Log_InputTooSmall(x);\\n }\\n\\n // Note that the `mul` in this assembly block is the standard multiplication operation, not {UD60x18.mul}.\\n // prettier-ignore\\n assembly (\\\"memory-safe\\\") {\\n switch x\\n case 1 { result := mul(uUNIT, sub(0, 18)) }\\n case 10 { result := mul(uUNIT, sub(1, 18)) }\\n case 100 { result := mul(uUNIT, sub(2, 18)) }\\n case 1000 { result := mul(uUNIT, sub(3, 18)) }\\n case 10000 { result := mul(uUNIT, sub(4, 18)) }\\n case 100000 { result := mul(uUNIT, sub(5, 18)) }\\n case 1000000 { result := mul(uUNIT, sub(6, 18)) }\\n case 10000000 { result := mul(uUNIT, sub(7, 18)) }\\n case 100000000 { result := mul(uUNIT, sub(8, 18)) }\\n case 1000000000 { result := mul(uUNIT, sub(9, 18)) }\\n case 10000000000 { result := mul(uUNIT, sub(10, 18)) }\\n case 100000000000 { result := mul(uUNIT, sub(11, 18)) }\\n case 1000000000000 { result := mul(uUNIT, sub(12, 18)) }\\n case 10000000000000 { result := mul(uUNIT, sub(13, 18)) }\\n case 100000000000000 { result := mul(uUNIT, sub(14, 18)) }\\n case 1000000000000000 { result := mul(uUNIT, sub(15, 18)) }\\n case 10000000000000000 { result := mul(uUNIT, sub(16, 18)) }\\n case 100000000000000000 { result := mul(uUNIT, sub(17, 18)) }\\n case 1000000000000000000 { result := 0 }\\n case 10000000000000000000 { result := uUNIT }\\n case 100000000000000000000 { result := mul(uUNIT, 2) }\\n case 1000000000000000000000 { result := mul(uUNIT, 3) }\\n case 10000000000000000000000 { result := mul(uUNIT, 4) }\\n case 100000000000000000000000 { result := mul(uUNIT, 5) }\\n case 1000000000000000000000000 { result := mul(uUNIT, 6) }\\n case 10000000000000000000000000 { result := mul(uUNIT, 7) }\\n case 100000000000000000000000000 { result := mul(uUNIT, 8) }\\n case 1000000000000000000000000000 { result := mul(uUNIT, 9) }\\n case 10000000000000000000000000000 { result := mul(uUNIT, 10) }\\n case 100000000000000000000000000000 { result := mul(uUNIT, 11) }\\n case 1000000000000000000000000000000 { result := mul(uUNIT, 12) }\\n case 10000000000000000000000000000000 { result := mul(uUNIT, 13) }\\n case 100000000000000000000000000000000 { result := mul(uUNIT, 14) }\\n case 1000000000000000000000000000000000 { result := mul(uUNIT, 15) }\\n case 10000000000000000000000000000000000 { result := mul(uUNIT, 16) }\\n case 100000000000000000000000000000000000 { result := mul(uUNIT, 17) }\\n case 1000000000000000000000000000000000000 { result := mul(uUNIT, 18) }\\n case 10000000000000000000000000000000000000 { result := mul(uUNIT, 19) }\\n case 100000000000000000000000000000000000000 { result := mul(uUNIT, 20) }\\n case 1000000000000000000000000000000000000000 { result := mul(uUNIT, 21) }\\n case 10000000000000000000000000000000000000000 { result := mul(uUNIT, 22) }\\n case 100000000000000000000000000000000000000000 { result := mul(uUNIT, 23) }\\n case 1000000000000000000000000000000000000000000 { result := mul(uUNIT, 24) }\\n case 10000000000000000000000000000000000000000000 { result := mul(uUNIT, 25) }\\n case 100000000000000000000000000000000000000000000 { result := mul(uUNIT, 26) }\\n case 1000000000000000000000000000000000000000000000 { result := mul(uUNIT, 27) }\\n case 10000000000000000000000000000000000000000000000 { result := mul(uUNIT, 28) }\\n case 100000000000000000000000000000000000000000000000 { result := mul(uUNIT, 29) }\\n case 1000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 30) }\\n case 10000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 31) }\\n case 100000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 32) }\\n case 1000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 33) }\\n case 10000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 34) }\\n case 100000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 35) }\\n case 1000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 36) }\\n case 10000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 37) }\\n case 100000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 38) }\\n case 1000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 39) }\\n case 10000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 40) }\\n case 100000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 41) }\\n case 1000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 42) }\\n case 10000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 43) }\\n case 100000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 44) }\\n case 1000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 45) }\\n case 10000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 46) }\\n case 100000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 47) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 48) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 49) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 50) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 51) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 52) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 53) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 54) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 55) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 56) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 57) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 58) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 59) }\\n default { result := uMAX_UD60x18 }\\n }\\n\\n if (result.unwrap() == uMAX_UD60x18) {\\n unchecked {\\n // Inline the fixed-point division to save gas.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_10);\\n }\\n }\\n}\\n\\n/// @notice Calculates the binary logarithm of x using the iterative approximation algorithm:\\n///\\n/// $$\\n/// log_2{x} = n + log_2{y}, \\\\text{ where } y = x*2^{-n}, \\\\ y \\\\in [1, 2)\\n/// $$\\n///\\n/// For $0 \\\\leq x \\\\lt 1$, the input is inverted:\\n///\\n/// $$\\n/// log_2{x} = -log_2{\\\\frac{1}{x}}\\n/// $$\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Binary_logarithm#Iterative_approximation\\n///\\n/// Notes:\\n/// - Due to the lossy precision of the iterative approximation, the results are not perfectly accurate to the last decimal.\\n///\\n/// Requirements:\\n/// - x must be greater than zero.\\n///\\n/// @param x The UD60x18 number for which to calculate the binary logarithm.\\n/// @return result The binary logarithm as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log2(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n if (xUint < uUNIT) {\\n revert Errors.PRBMath_UD60x18_Log_InputTooSmall(x);\\n }\\n\\n unchecked {\\n // Calculate the integer part of the logarithm.\\n uint256 n = Common.msb(xUint / uUNIT);\\n\\n // This is the integer part of the logarithm as a UD60x18 number. The operation can't overflow because n\\n // n is at most 255 and UNIT is 1e18.\\n uint256 resultUint = n * uUNIT;\\n\\n // Calculate $y = x * 2^{-n}$.\\n uint256 y = xUint >> n;\\n\\n // If y is the unit number, the fractional part is zero.\\n if (y == uUNIT) {\\n return wrap(resultUint);\\n }\\n\\n // Calculate the fractional part via the iterative approximation.\\n // The `delta >>= 1` part is equivalent to `delta /= 2`, but shifting bits is more gas efficient.\\n uint256 DOUBLE_UNIT = 2e18;\\n for (uint256 delta = uHALF_UNIT; delta > 0; delta >>= 1) {\\n y = (y * y) / uUNIT;\\n\\n // Is y^2 >= 2e18 and so in the range [2e18, 4e18)?\\n if (y >= DOUBLE_UNIT) {\\n // Add the 2^{-m} factor to the logarithm.\\n resultUint += delta;\\n\\n // Halve y, which corresponds to z/2 in the Wikipedia article.\\n y >>= 1;\\n }\\n }\\n result = wrap(resultUint);\\n }\\n}\\n\\n/// @notice Multiplies two UD60x18 numbers together, returning a new UD60x18 number.\\n///\\n/// @dev Uses {Common.mulDiv} to enable overflow-safe multiplication and division.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv}.\\n///\\n/// @dev See the documentation in {Common.mulDiv18}.\\n/// @param x The multiplicand as a UD60x18 number.\\n/// @param y The multiplier as a UD60x18 number.\\n/// @return result The product as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mul(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(Common.mulDiv18(x.unwrap(), y.unwrap()));\\n}\\n\\n/// @notice Raises x to the power of y.\\n///\\n/// For $1 \\\\leq x \\\\leq \\\\infty$, the following standard formula is used:\\n///\\n/// $$\\n/// x^y = 2^{log_2{x} * y}\\n/// $$\\n///\\n/// For $0 \\\\leq x \\\\lt 1$, since the unsigned {log2} is undefined, an equivalent formula is used:\\n///\\n/// $$\\n/// i = \\\\frac{1}{x}\\n/// w = 2^{log_2{i} * y}\\n/// x^y = \\\\frac{1}{w}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2} and {mul}.\\n/// - Returns `UNIT` for 0^0.\\n/// - It may not perform well with very small values of x. Consider using SD59x18 as an alternative.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {exp2}, {log2}, and {mul}.\\n///\\n/// @param x The base as a UD60x18 number.\\n/// @param y The exponent as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction pow(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n uint256 yUint = y.unwrap();\\n\\n // If both x and y are zero, the result is `UNIT`. If just x is zero, the result is always zero.\\n if (xUint == 0) {\\n return yUint == 0 ? UNIT : ZERO;\\n }\\n // If x is `UNIT`, the result is always `UNIT`.\\n else if (xUint == uUNIT) {\\n return UNIT;\\n }\\n\\n // If y is zero, the result is always `UNIT`.\\n if (yUint == 0) {\\n return UNIT;\\n }\\n // If y is `UNIT`, the result is always x.\\n else if (yUint == uUNIT) {\\n return x;\\n }\\n\\n // If x is greater than `UNIT`, use the standard formula.\\n if (xUint > uUNIT) {\\n result = exp2(mul(log2(x), y));\\n }\\n // Conversely, if x is less than `UNIT`, use the equivalent formula.\\n else {\\n UD60x18 i = wrap(uUNIT_SQUARED / xUint);\\n UD60x18 w = exp2(mul(log2(i), y));\\n result = wrap(uUNIT_SQUARED / w.unwrap());\\n }\\n}\\n\\n/// @notice Raises x (a UD60x18 number) to the power y (an unsigned basic integer) using the well-known\\n/// algorithm \\\"exponentiation by squaring\\\".\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Exponentiation_by_squaring.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv18}.\\n/// - Returns `UNIT` for 0^0.\\n///\\n/// Requirements:\\n/// - The result must fit in UD60x18.\\n///\\n/// @param x The base as a UD60x18 number.\\n/// @param y The exponent as a uint256.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction powu(UD60x18 x, uint256 y) pure returns (UD60x18 result) {\\n // Calculate the first iteration of the loop in advance.\\n uint256 xUint = x.unwrap();\\n uint256 resultUint = y & 1 > 0 ? xUint : uUNIT;\\n\\n // Equivalent to `for(y /= 2; y > 0; y /= 2)`.\\n for (y >>= 1; y > 0; y >>= 1) {\\n xUint = Common.mulDiv18(xUint, xUint);\\n\\n // Equivalent to `y % 2 == 1`.\\n if (y & 1 > 0) {\\n resultUint = Common.mulDiv18(resultUint, xUint);\\n }\\n }\\n result = wrap(resultUint);\\n}\\n\\n/// @notice Calculates the square root of x using the Babylonian method.\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\\n///\\n/// Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x must be less than `MAX_UD60x18 / UNIT`.\\n///\\n/// @param x The UD60x18 number for which to calculate the square root.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction sqrt(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n unchecked {\\n if (xUint > uMAX_UD60x18 / uUNIT) {\\n revert Errors.PRBMath_UD60x18_Sqrt_Overflow(x);\\n }\\n // Multiply x by `UNIT` to account for the factor of `UNIT` picked up when multiplying two UD60x18 numbers.\\n // In this case, the two numbers are both the square root.\\n result = wrap(Common.sqrt(xUint * uUNIT));\\n }\\n}\\n\",\"keccak256\":\"0x462144667aac3f96d5f8dba7aa68fe4c5a3f61e1d7bbbc81bee21168817f9c09\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\nimport \\\"./Helpers.sol\\\" as Helpers;\\nimport \\\"./Math.sol\\\" as Math;\\n\\n/// @notice The unsigned 60.18-decimal fixed-point number representation, which can have up to 60 digits and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the Solidity type uint256.\\n/// @dev The value type is defined here so it can be imported in all other files.\\ntype UD60x18 is uint256;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoSD1x18,\\n Casting.intoUD2x18,\\n Casting.intoSD59x18,\\n Casting.intoUint128,\\n Casting.intoUint256,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for UD60x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n MATHEMATICAL FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes the functions in this library callable on the UD60x18 type.\\nusing {\\n Math.avg,\\n Math.ceil,\\n Math.div,\\n Math.exp,\\n Math.exp2,\\n Math.floor,\\n Math.frac,\\n Math.gm,\\n Math.inv,\\n Math.ln,\\n Math.log10,\\n Math.log2,\\n Math.mul,\\n Math.pow,\\n Math.powu,\\n Math.sqrt\\n} for UD60x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n HELPER FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes the functions in this library callable on the UD60x18 type.\\nusing {\\n Helpers.add,\\n Helpers.and,\\n Helpers.eq,\\n Helpers.gt,\\n Helpers.gte,\\n Helpers.isZero,\\n Helpers.lshift,\\n Helpers.lt,\\n Helpers.lte,\\n Helpers.mod,\\n Helpers.neq,\\n Helpers.not,\\n Helpers.or,\\n Helpers.rshift,\\n Helpers.sub,\\n Helpers.uncheckedAdd,\\n Helpers.uncheckedSub,\\n Helpers.xor\\n} for UD60x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n OPERATORS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes it possible to use these operators on the UD60x18 type.\\nusing {\\n Helpers.add as +,\\n Helpers.and2 as &,\\n Math.div as /,\\n Helpers.eq as ==,\\n Helpers.gt as >,\\n Helpers.gte as >=,\\n Helpers.lt as <,\\n Helpers.lte as <=,\\n Helpers.or as |,\\n Helpers.mod as %,\\n Math.mul as *,\\n Helpers.neq as !=,\\n Helpers.not as ~,\\n Helpers.sub as -,\\n Helpers.xor as ^\\n} for UD60x18 global;\\n\",\"keccak256\":\"0xdd873b5124180d9b71498b3a7fe93b1c08c368bec741f7d5f8e17f78a0b70f31\",\"license\":\"MIT\"},\"contracts/interfaces/IERC6551Registry.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\ninterface IERC6551Registry {\\n /**\\n * @dev Creates a token bound account for a non-fungible token.\\n *\\n * If account has already been created, returns the account address without calling create2.\\n *\\n * Emits ERC6551AccountCreated event.\\n *\\n * @return account The address of the token bound account\\n */\\n function createAccount(\\n address implementation,\\n bytes32 salt,\\n uint256 chainId,\\n address tokenContract,\\n uint256 tokenId\\n ) external returns (address account);\\n}\\n\",\"keccak256\":\"0x64c52de8a8e68398e61dd8b42dda8e9af8cf6abf93bb85629c322440991ea568\",\"license\":\"MIT\"},\"contracts/interfaces/hats/HatsErrors.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface HatsErrors {\\n /// @notice Emitted when `user` is attempting to perform an action on `hatId` but is not wearing one of `hatId`'s admin hats\\n /// @dev Can be equivalent to `NotHatWearer(buildHatId(hatId))`, such as when emitted by `approveLinkTopHatToTree` or `relinkTopHatToTree`\\n error NotAdmin(address user, uint256 hatId);\\n\\n /// @notice Emitted when attempting to perform an action as or for an account that is not a wearer of a given hat\\n error NotHatWearer();\\n\\n /// @notice Emitted when attempting to perform an action that requires being either an admin or wearer of a given hat\\n error NotAdminOrWearer();\\n\\n /// @notice Emitted when attempting to mint `hatId` but `hatId`'s maxSupply has been reached\\n error AllHatsWorn(uint256 hatId);\\n\\n /// @notice Emitted when attempting to create a hat with a level 14 hat as its admin\\n error MaxLevelsReached();\\n\\n /// @notice Emitted when an attempted hat id has empty intermediate level(s)\\n error InvalidHatId();\\n\\n /// @notice Emitted when attempting to mint `hatId` to a `wearer` who is already wearing the hat\\n error AlreadyWearingHat(address wearer, uint256 hatId);\\n\\n /// @notice Emitted when attempting to mint a non-existant hat\\n error HatDoesNotExist(uint256 hatId);\\n\\n /// @notice Emmitted when attempting to mint or transfer a hat that is not active\\n error HatNotActive();\\n\\n /// @notice Emitted when attempting to mint or transfer a hat to an ineligible wearer\\n error NotEligible();\\n\\n /// @notice Emitted when attempting to check or set a hat's status from an account that is not that hat's toggle module\\n error NotHatsToggle();\\n\\n /// @notice Emitted when attempting to check or set a hat wearer's status from an account that is not that hat's eligibility module\\n error NotHatsEligibility();\\n\\n /// @notice Emitted when array arguments to a batch function have mismatching lengths\\n error BatchArrayLengthMismatch();\\n\\n /// @notice Emitted when attempting to mutate or transfer an immutable hat\\n error Immutable();\\n\\n /// @notice Emitted when attempting to change a hat's maxSupply to a value lower than its current supply\\n error NewMaxSupplyTooLow();\\n\\n /// @notice Emitted when attempting to link a tophat to a new admin for which the tophat serves as an admin\\n error CircularLinkage();\\n\\n /// @notice Emitted when attempting to link or relink a tophat to a separate tree\\n error CrossTreeLinkage();\\n\\n /// @notice Emitted when attempting to link a tophat without a request\\n error LinkageNotRequested();\\n\\n /// @notice Emitted when attempting to unlink a tophat that does not have a wearer\\n /// @dev This ensures that unlinking never results in a bricked tophat\\n error InvalidUnlink();\\n\\n /// @notice Emmited when attempting to change a hat's eligibility or toggle module to the zero address\\n error ZeroAddress();\\n\\n /// @notice Emmitted when attempting to change a hat's details or imageURI to a string with over 7000 bytes (~characters)\\n /// @dev This protects against a DOS attack where an admin iteratively extend's a hat's details or imageURI\\n /// to be so long that reading it exceeds the block gas limit, breaking `uri()` and `viewHat()`\\n error StringTooLong();\\n}\\n\",\"keccak256\":\"0x81b0056b7bed86eabc07c0e4a9655c586ddb8e6c128320593669b76efd5a08de\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/HatsEvents.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface HatsEvents {\\n /// @notice Emitted when a new hat is created\\n /// @param id The id for the new hat\\n /// @param details A description of the Hat\\n /// @param maxSupply The total instances of the Hat that can be worn at once\\n /// @param eligibility The address that can report on the Hat wearer's status\\n /// @param toggle The address that can deactivate the Hat\\n /// @param mutable_ Whether the hat's properties are changeable after creation\\n /// @param imageURI The image uri for this hat and the fallback for its\\n event HatCreated(\\n uint256 id,\\n string details,\\n uint32 maxSupply,\\n address eligibility,\\n address toggle,\\n bool mutable_,\\n string imageURI\\n );\\n\\n /// @notice Emitted when a hat wearer's standing is updated\\n /// @dev Eligibility is excluded since the source of truth for eligibility is the eligibility module and may change without a transaction\\n /// @param hatId The id of the wearer's hat\\n /// @param wearer The wearer's address\\n /// @param wearerStanding Whether the wearer is in good standing for the hat\\n event WearerStandingChanged(\\n uint256 hatId,\\n address wearer,\\n bool wearerStanding\\n );\\n\\n /// @notice Emitted when a hat's status is updated\\n /// @param hatId The id of the hat\\n /// @param newStatus Whether the hat is active\\n event HatStatusChanged(uint256 hatId, bool newStatus);\\n\\n /// @notice Emitted when a hat's details are updated\\n /// @param hatId The id of the hat\\n /// @param newDetails The updated details\\n event HatDetailsChanged(uint256 hatId, string newDetails);\\n\\n /// @notice Emitted when a hat's eligibility module is updated\\n /// @param hatId The id of the hat\\n /// @param newEligibility The updated eligibiliy module\\n event HatEligibilityChanged(uint256 hatId, address newEligibility);\\n\\n /// @notice Emitted when a hat's toggle module is updated\\n /// @param hatId The id of the hat\\n /// @param newToggle The updated toggle module\\n event HatToggleChanged(uint256 hatId, address newToggle);\\n\\n /// @notice Emitted when a hat's mutability is updated\\n /// @param hatId The id of the hat\\n event HatMutabilityChanged(uint256 hatId);\\n\\n /// @notice Emitted when a hat's maximum supply is updated\\n /// @param hatId The id of the hat\\n /// @param newMaxSupply The updated max supply\\n event HatMaxSupplyChanged(uint256 hatId, uint32 newMaxSupply);\\n\\n /// @notice Emitted when a hat's image URI is updated\\n /// @param hatId The id of the hat\\n /// @param newImageURI The updated image URI\\n event HatImageURIChanged(uint256 hatId, string newImageURI);\\n\\n /// @notice Emitted when a tophat linkage is requested by its admin\\n /// @param domain The domain of the tree tophat to link\\n /// @param newAdmin The tophat's would-be admin in the parent tree\\n event TopHatLinkRequested(uint32 domain, uint256 newAdmin);\\n\\n /// @notice Emitted when a tophat is linked to a another tree\\n /// @param domain The domain of the newly-linked tophat\\n /// @param newAdmin The tophat's new admin in the parent tree\\n event TopHatLinked(uint32 domain, uint256 newAdmin);\\n}\\n\",\"keccak256\":\"0x53413397d15e1636c3cd7bd667656b79bc2886785403b824bcd4ed122667f2c6\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/IHats.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\nimport \\\"./IHatsIdUtilities.sol\\\";\\nimport \\\"./HatsErrors.sol\\\";\\nimport \\\"./HatsEvents.sol\\\";\\n\\ninterface IHats is IHatsIdUtilities, HatsErrors, HatsEvents {\\n function mintTopHat(\\n address _target,\\n string memory _details,\\n string memory _imageURI\\n ) external returns (uint256 topHatId);\\n\\n function createHat(\\n uint256 _admin,\\n string calldata _details,\\n uint32 _maxSupply,\\n address _eligibility,\\n address _toggle,\\n bool _mutable,\\n string calldata _imageURI\\n ) external returns (uint256 newHatId);\\n\\n function batchCreateHats(\\n uint256[] calldata _admins,\\n string[] calldata _details,\\n uint32[] calldata _maxSupplies,\\n address[] memory _eligibilityModules,\\n address[] memory _toggleModules,\\n bool[] calldata _mutables,\\n string[] calldata _imageURIs\\n ) external returns (bool success);\\n\\n function getNextId(uint256 _admin) external view returns (uint256 nextId);\\n\\n function mintHat(\\n uint256 _hatId,\\n address _wearer\\n ) external returns (bool success);\\n\\n function batchMintHats(\\n uint256[] calldata _hatIds,\\n address[] calldata _wearers\\n ) external returns (bool success);\\n\\n function setHatStatus(\\n uint256 _hatId,\\n bool _newStatus\\n ) external returns (bool toggled);\\n\\n function checkHatStatus(uint256 _hatId) external returns (bool toggled);\\n\\n function setHatWearerStatus(\\n uint256 _hatId,\\n address _wearer,\\n bool _eligible,\\n bool _standing\\n ) external returns (bool updated);\\n\\n function checkHatWearerStatus(\\n uint256 _hatId,\\n address _wearer\\n ) external returns (bool updated);\\n\\n function renounceHat(uint256 _hatId) external;\\n\\n function transferHat(uint256 _hatId, address _from, address _to) external;\\n\\n /*//////////////////////////////////////////////////////////////\\n HATS ADMIN FUNCTIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n function makeHatImmutable(uint256 _hatId) external;\\n\\n function changeHatDetails(\\n uint256 _hatId,\\n string memory _newDetails\\n ) external;\\n\\n function changeHatEligibility(\\n uint256 _hatId,\\n address _newEligibility\\n ) external;\\n\\n function changeHatToggle(uint256 _hatId, address _newToggle) external;\\n\\n function changeHatImageURI(\\n uint256 _hatId,\\n string memory _newImageURI\\n ) external;\\n\\n function changeHatMaxSupply(uint256 _hatId, uint32 _newMaxSupply) external;\\n\\n function requestLinkTopHatToTree(\\n uint32 _topHatId,\\n uint256 _newAdminHat\\n ) external;\\n\\n function approveLinkTopHatToTree(\\n uint32 _topHatId,\\n uint256 _newAdminHat,\\n address _eligibility,\\n address _toggle,\\n string calldata _details,\\n string calldata _imageURI\\n ) external;\\n\\n function unlinkTopHatFromTree(uint32 _topHatId, address _wearer) external;\\n\\n function relinkTopHatWithinTree(\\n uint32 _topHatDomain,\\n uint256 _newAdminHat,\\n address _eligibility,\\n address _toggle,\\n string calldata _details,\\n string calldata _imageURI\\n ) external;\\n\\n /*//////////////////////////////////////////////////////////////\\n VIEW FUNCTIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n function viewHat(\\n uint256 _hatId\\n )\\n external\\n view\\n returns (\\n string memory details,\\n uint32 maxSupply,\\n uint32 supply,\\n address eligibility,\\n address toggle,\\n string memory imageURI,\\n uint16 lastHatId,\\n bool mutable_,\\n bool active\\n );\\n\\n function isWearerOfHat(\\n address _user,\\n uint256 _hatId\\n ) external view returns (bool isWearer);\\n\\n function isAdminOfHat(\\n address _user,\\n uint256 _hatId\\n ) external view returns (bool isAdmin);\\n\\n function isInGoodStanding(\\n address _wearer,\\n uint256 _hatId\\n ) external view returns (bool standing);\\n\\n function isEligible(\\n address _wearer,\\n uint256 _hatId\\n ) external view returns (bool eligible);\\n\\n function getHatEligibilityModule(\\n uint256 _hatId\\n ) external view returns (address eligibility);\\n\\n function getHatToggleModule(\\n uint256 _hatId\\n ) external view returns (address toggle);\\n\\n function getHatMaxSupply(\\n uint256 _hatId\\n ) external view returns (uint32 maxSupply);\\n\\n function hatSupply(uint256 _hatId) external view returns (uint32 supply);\\n\\n function getImageURIForHat(\\n uint256 _hatId\\n ) external view returns (string memory _uri);\\n\\n function balanceOf(\\n address wearer,\\n uint256 hatId\\n ) external view returns (uint256 balance);\\n\\n function balanceOfBatch(\\n address[] calldata _wearers,\\n uint256[] calldata _hatIds\\n ) external view returns (uint256[] memory);\\n\\n function uri(uint256 id) external view returns (string memory _uri);\\n}\\n\",\"keccak256\":\"0x2867004bddc5148fa1937f25c0403e5d9977583aaf50fdbdb74bd463f64f21c8\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/IHatsIdUtilities.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface IHatsIdUtilities {\\n function buildHatId(\\n uint256 _admin,\\n uint16 _newHat\\n ) external pure returns (uint256 id);\\n\\n function getHatLevel(uint256 _hatId) external view returns (uint32 level);\\n\\n function getLocalHatLevel(\\n uint256 _hatId\\n ) external pure returns (uint32 level);\\n\\n function isTopHat(uint256 _hatId) external view returns (bool _topHat);\\n\\n function isLocalTopHat(\\n uint256 _hatId\\n ) external pure returns (bool _localTopHat);\\n\\n function isValidHatId(\\n uint256 _hatId\\n ) external view returns (bool validHatId);\\n\\n function getAdminAtLevel(\\n uint256 _hatId,\\n uint32 _level\\n ) external view returns (uint256 admin);\\n\\n function getAdminAtLocalLevel(\\n uint256 _hatId,\\n uint32 _level\\n ) external pure returns (uint256 admin);\\n\\n function getTopHatDomain(\\n uint256 _hatId\\n ) external view returns (uint32 domain);\\n\\n function getTippyTopHatDomain(\\n uint32 _topHatDomain\\n ) external view returns (uint32 domain);\\n\\n function noCircularLinkage(\\n uint32 _topHatDomain,\\n uint256 _linkedAdmin\\n ) external view returns (bool notCircular);\\n\\n function sameTippyTopHatDomain(\\n uint32 _topHatDomain,\\n uint256 _newAdminHat\\n ) external view returns (bool sameDomain);\\n}\\n\",\"keccak256\":\"0x007fcc07b20bf84bacad1f9a2ddf4e30e1a8be961e144b7bef8e98a51781aee9\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/IHatsModuleFactory.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.19;\\n\\ninterface IHatsModuleFactory {\\n error HatsModuleFactory_ModuleAlreadyDeployed(\\n address implementation,\\n uint256 hatId,\\n bytes otherImmutableArgs,\\n uint256 saltNonce\\n );\\n\\n error BatchArrayLengthMismatch();\\n\\n event HatsModuleFactory_ModuleDeployed(\\n address implementation,\\n address instance,\\n uint256 hatId,\\n bytes otherImmutableArgs,\\n bytes initData,\\n uint256 saltNonce\\n );\\n\\n function HATS() external view returns (address);\\n\\n function version() external view returns (string memory);\\n\\n function createHatsModule(\\n address _implementation,\\n uint256 _hatId,\\n bytes calldata _otherImmutableArgs,\\n bytes calldata _initData,\\n uint256 _saltNonce\\n ) external returns (address _instance);\\n\\n function batchCreateHatsModule(\\n address[] calldata _implementations,\\n uint256[] calldata _hatIds,\\n bytes[] calldata _otherImmutableArgsArray,\\n bytes[] calldata _initDataArray,\\n uint256[] calldata _saltNonces\\n ) external returns (bool success);\\n\\n function getHatsModuleAddress(\\n address _implementation,\\n uint256 _hatId,\\n bytes calldata _otherImmutableArgs,\\n uint256 _saltNonce\\n ) external view returns (address);\\n\\n function deployed(\\n address _implementation,\\n uint256 _hatId,\\n bytes calldata _otherImmutableArgs,\\n uint256 _saltNonce\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x861faf40785cedb829243116d492653414a367853408a5c27d201522f6c3bfdd\",\"license\":\"MIT\"},\"contracts/interfaces/sablier/IAdminable.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\n/// @title IAdminable\\n/// @notice Contract module that provides a basic access control mechanism, with an admin that can be\\n/// granted exclusive access to specific functions. The inheriting contract must set the initial admin\\n/// in the constructor.\\ninterface IAdminable {\\n /*//////////////////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Emitted when the admin is transferred.\\n /// @param oldAdmin The address of the old admin.\\n /// @param newAdmin The address of the new admin.\\n event TransferAdmin(address indexed oldAdmin, address indexed newAdmin);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice The address of the admin account or contract.\\n function admin() external view returns (address);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n NON-CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Transfers the contract admin to a new address.\\n ///\\n /// @dev Notes:\\n /// - Does not revert if the admin is the same.\\n /// - This function can potentially leave the contract without an admin, thereby removing any\\n /// functionality that is only available to the admin.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the contract admin.\\n ///\\n /// @param newAdmin The address of the new admin.\\n function transferAdmin(address newAdmin) external;\\n}\\n\",\"keccak256\":\"0xa279c49e51228b571329164e36250e82b2c1378e8b549194ab7dd90fca9c3b2b\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/IERC4096.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 \\\"@openzeppelin/contracts/interfaces/IERC165.sol\\\";\\nimport {IERC721} from \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\n\\n/// @title ERC-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\",\"keccak256\":\"0xa34b9c52cbe36be860244f52256f1b05badf0cb797d208664b87337610d0e82d\",\"license\":\"MIT\"},\"contracts/interfaces/sablier/ISablierV2Lockup.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC4906} from \\\"./IERC4096.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IERC721Metadata} from \\\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\\\";\\nimport {UD60x18} from \\\"@prb/math/src/UD60x18.sol\\\";\\n\\nimport {Lockup} from \\\"./types/DataTypes.sol\\\";\\nimport {IAdminable} from \\\"./IAdminable.sol\\\";\\nimport {ISablierV2NFTDescriptor} from \\\"./ISablierV2NFTDescriptor.sol\\\";\\n\\n/// @title ISablierV2Lockup\\n/// @notice Common logic between all Sablier V2 Lockup contracts.\\ninterface ISablierV2Lockup is\\n IAdminable, // 0 inherited components\\n IERC4906, // 2 inherited components\\n IERC721Metadata // 2 inherited components\\n{\\n /*//////////////////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Emitted when the admin allows a new recipient contract to hook to Sablier.\\n /// @param admin The address of the current contract admin.\\n /// @param recipient The address of the recipient contract put on the allowlist.\\n event AllowToHook(address indexed admin, address recipient);\\n\\n /// @notice Emitted when a stream is canceled.\\n /// @param streamId The ID of the stream.\\n /// @param sender The address of the stream's sender.\\n /// @param recipient The address of the stream's recipient.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param senderAmount The amount of assets refunded to the stream's sender, denoted in units of the asset's\\n /// decimals.\\n /// @param recipientAmount The amount of assets left for the stream's recipient to withdraw, denoted in units of the\\n /// asset's decimals.\\n event CancelLockupStream(\\n uint256 streamId,\\n address indexed sender,\\n address indexed recipient,\\n IERC20 indexed asset,\\n uint128 senderAmount,\\n uint128 recipientAmount\\n );\\n\\n /// @notice Emitted when a sender gives up the right to cancel a stream.\\n /// @param streamId The ID of the stream.\\n event RenounceLockupStream(uint256 indexed streamId);\\n\\n /// @notice Emitted when the admin sets a new NFT descriptor contract.\\n /// @param admin The address of the current contract admin.\\n /// @param oldNFTDescriptor The address of the old NFT descriptor contract.\\n /// @param newNFTDescriptor The address of the new NFT descriptor contract.\\n event SetNFTDescriptor(\\n address indexed admin,\\n ISablierV2NFTDescriptor oldNFTDescriptor,\\n ISablierV2NFTDescriptor newNFTDescriptor\\n );\\n\\n /// @notice Emitted when assets are withdrawn from a stream.\\n /// @param streamId The ID of the stream.\\n /// @param to The address that has received the withdrawn assets.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param amount The amount of assets withdrawn, denoted in units of the asset's decimals.\\n event WithdrawFromLockupStream(\\n uint256 indexed streamId,\\n address indexed to,\\n IERC20 indexed asset,\\n uint128 amount\\n );\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Retrieves the address of the ERC-20 asset to be distributed.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getAsset(uint256 streamId) external view returns (IERC20 asset);\\n\\n /// @notice Retrieves the amount deposited in the stream, denoted in units of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getDepositedAmount(\\n uint256 streamId\\n ) external view returns (uint128 depositedAmount);\\n\\n /// @notice Retrieves the stream's end time, which is a Unix timestamp.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getEndTime(\\n uint256 streamId\\n ) external view returns (uint40 endTime);\\n\\n /// @notice Retrieves the stream's recipient.\\n /// @dev Reverts if the NFT has been burned.\\n /// @param streamId The stream ID for the query.\\n function getRecipient(\\n uint256 streamId\\n ) external view returns (address recipient);\\n\\n /// @notice Retrieves the amount refunded to the sender after a cancellation, denoted in units of the asset's\\n /// decimals. This amount is always zero unless the stream was canceled.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getRefundedAmount(\\n uint256 streamId\\n ) external view returns (uint128 refundedAmount);\\n\\n /// @notice Retrieves the stream's sender.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getSender(uint256 streamId) external view returns (address sender);\\n\\n /// @notice Retrieves the stream's start time, which is a Unix timestamp.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getStartTime(\\n uint256 streamId\\n ) external view returns (uint40 startTime);\\n\\n /// @notice Retrieves the amount withdrawn from the stream, denoted in units of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getWithdrawnAmount(\\n uint256 streamId\\n ) external view returns (uint128 withdrawnAmount);\\n\\n /// @notice Retrieves a flag indicating whether the provided address is a contract allowed to hook to Sablier\\n /// when a stream is canceled or when assets are withdrawn.\\n /// @dev See {ISablierLockupRecipient} for more information.\\n function isAllowedToHook(\\n address recipient\\n ) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream can be canceled. When the stream is cold, this\\n /// flag is always `false`.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isCancelable(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream is cold, i.e. settled, canceled, or depleted.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isCold(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream is depleted.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isDepleted(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream exists.\\n /// @dev Does not revert if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isStream(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream NFT can be transferred.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isTransferable(\\n uint256 streamId\\n ) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream is warm, i.e. either pending or streaming.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isWarm(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves the maximum broker fee that can be charged by the broker, denoted as a fixed-point\\n /// number where 1e18 is 100%.\\n /// @dev This value is hard coded as a constant.\\n function MAX_BROKER_FEE() external view returns (UD60x18);\\n\\n /// @notice Counter for stream IDs, used in the create functions.\\n function nextStreamId() external view returns (uint256);\\n\\n /// @notice Contract that generates the non-fungible token URI.\\n function nftDescriptor() external view returns (ISablierV2NFTDescriptor);\\n\\n /// @notice Calculates the amount that the sender would be refunded if the stream were canceled, denoted in units\\n /// of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function refundableAmountOf(\\n uint256 streamId\\n ) external view returns (uint128 refundableAmount);\\n\\n /// @notice Retrieves the stream's status.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function statusOf(\\n uint256 streamId\\n ) external view returns (Lockup.Status status);\\n\\n /// @notice Calculates the amount streamed to the recipient, denoted in units of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n ///\\n /// Notes:\\n /// - Upon cancellation of the stream, the amount streamed is calculated as the difference between the deposited\\n /// amount and the refunded amount. Ultimately, when the stream becomes depleted, the streamed amount is equivalent\\n /// to the total amount withdrawn.\\n ///\\n /// @param streamId The stream ID for the query.\\n function streamedAmountOf(\\n uint256 streamId\\n ) external view returns (uint128 streamedAmount);\\n\\n /// @notice Retrieves a flag indicating whether the stream was canceled.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function wasCanceled(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Calculates the amount that the recipient can withdraw from the stream, denoted in units of the asset's\\n /// decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function withdrawableAmountOf(\\n uint256 streamId\\n ) external view returns (uint128 withdrawableAmount);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n NON-CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Allows a recipient contract to hook to Sablier when a stream is canceled or when assets are withdrawn.\\n /// Useful for implementing contracts that hold streams on behalf of users, such as vaults or staking contracts.\\n ///\\n /// @dev Emits an {AllowToHook} event.\\n ///\\n /// Notes:\\n /// - Does not revert if the contract is already on the allowlist.\\n /// - This is an irreversible operation. The contract cannot be removed from the allowlist.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the contract admin.\\n /// - `recipient` must have a non-zero code size.\\n /// - `recipient` must implement {ISablierLockupRecipient}.\\n ///\\n /// @param recipient The address of the contract to allow for hooks.\\n function allowToHook(address recipient) external;\\n\\n /// @notice Burns the NFT associated with the stream.\\n ///\\n /// @dev Emits a {Transfer} event.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `streamId` must reference a depleted stream.\\n /// - The NFT must exist.\\n /// - `msg.sender` must be either the NFT owner or an approved third party.\\n ///\\n /// @param streamId The ID of the stream NFT to burn.\\n function burn(uint256 streamId) external;\\n\\n /// @notice Cancels the stream and refunds any remaining assets to the sender.\\n ///\\n /// @dev Emits a {Transfer}, {CancelLockupStream}, and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - If there any assets left for the recipient to withdraw, the stream is marked as canceled. Otherwise, the\\n /// stream is marked as depleted.\\n /// - This function attempts to invoke a hook on the recipient, if the resolved address is a contract.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - The stream must be warm and cancelable.\\n /// - `msg.sender` must be the stream's sender.\\n ///\\n /// @param streamId The ID of the stream to cancel.\\n function cancel(uint256 streamId) external;\\n\\n /// @notice Cancels multiple streams and refunds any remaining assets to the sender.\\n ///\\n /// @dev Emits multiple {Transfer}, {CancelLockupStream}, and {MetadataUpdate} events.\\n ///\\n /// Notes:\\n /// - Refer to the notes in {cancel}.\\n ///\\n /// Requirements:\\n /// - All requirements from {cancel} must be met for each stream.\\n ///\\n /// @param streamIds The IDs of the streams to cancel.\\n function cancelMultiple(uint256[] calldata streamIds) external;\\n\\n /// @notice Removes the right of the stream's sender to cancel the stream.\\n ///\\n /// @dev Emits a {RenounceLockupStream} and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - This is an irreversible operation.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `streamId` must reference a warm stream.\\n /// - `msg.sender` must be the stream's sender.\\n /// - The stream must be cancelable.\\n ///\\n /// @param streamId The ID of the stream to renounce.\\n function renounce(uint256 streamId) external;\\n\\n /// @notice Sets a new NFT descriptor contract, which produces the URI describing the Sablier stream NFTs.\\n ///\\n /// @dev Emits a {SetNFTDescriptor} and {BatchMetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - Does not revert if the NFT descriptor is the same.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the contract admin.\\n ///\\n /// @param newNFTDescriptor The address of the new NFT descriptor contract.\\n function setNFTDescriptor(\\n ISablierV2NFTDescriptor newNFTDescriptor\\n ) external;\\n\\n /// @notice Withdraws the provided amount of assets from the stream to the `to` address.\\n ///\\n /// @dev Emits a {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - This function attempts to call a hook on the recipient of the stream, unless `msg.sender` is the recipient.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `streamId` must not reference a null or depleted stream.\\n /// - `to` must not be the zero address.\\n /// - `amount` must be greater than zero and must not exceed the withdrawable amount.\\n /// - `to` must be the recipient if `msg.sender` is not the stream's recipient or an approved third party.\\n ///\\n /// @param streamId The ID of the stream to withdraw from.\\n /// @param to The address receiving the withdrawn assets.\\n /// @param amount The amount to withdraw, denoted in units of the asset's decimals.\\n function withdraw(uint256 streamId, address to, uint128 amount) external;\\n\\n /// @notice Withdraws the maximum withdrawable amount from the stream to the provided address `to`.\\n ///\\n /// @dev Emits a {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - Refer to the notes in {withdraw}.\\n ///\\n /// Requirements:\\n /// - Refer to the requirements in {withdraw}.\\n ///\\n /// @param streamId The ID of the stream to withdraw from.\\n /// @param to The address receiving the withdrawn assets.\\n /// @return withdrawnAmount The amount withdrawn, denoted in units of the asset's decimals.\\n function withdrawMax(\\n uint256 streamId,\\n address to\\n ) external returns (uint128 withdrawnAmount);\\n\\n /// @notice Withdraws the maximum withdrawable amount from the stream to the current recipient, and transfers the\\n /// NFT to `newRecipient`.\\n ///\\n /// @dev Emits a {WithdrawFromLockupStream} and a {Transfer} event.\\n ///\\n /// Notes:\\n /// - If the withdrawable amount is zero, the withdrawal is skipped.\\n /// - Refer to the notes in {withdraw}.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the stream's recipient.\\n /// - Refer to the requirements in {withdraw}.\\n /// - Refer to the requirements in {IERC721.transferFrom}.\\n ///\\n /// @param streamId The ID of the stream NFT to transfer.\\n /// @param newRecipient The address of the new owner of the stream NFT.\\n /// @return withdrawnAmount The amount withdrawn, denoted in units of the asset's decimals.\\n function withdrawMaxAndTransfer(\\n uint256 streamId,\\n address newRecipient\\n ) external returns (uint128 withdrawnAmount);\\n\\n /// @notice Withdraws assets from streams to the recipient of each stream.\\n ///\\n /// @dev Emits multiple {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} events.\\n ///\\n /// Notes:\\n /// - This function attempts to call a hook on the recipient of each stream, unless `msg.sender` is the recipient.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - There must be an equal number of `streamIds` and `amounts`.\\n /// - Each stream ID in the array must not reference a null or depleted stream.\\n /// - Each amount in the array must be greater than zero and must not exceed the withdrawable amount.\\n ///\\n /// @param streamIds The IDs of the streams to withdraw from.\\n /// @param amounts The amounts to withdraw, denoted in units of the asset's decimals.\\n function withdrawMultiple(\\n uint256[] calldata streamIds,\\n uint128[] calldata amounts\\n ) external;\\n}\\n\",\"keccak256\":\"0x3e5541c38a901637bd310965deb5bbde73ef07fe4ee3c752cbec330c6b9d62a3\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/ISablierV2LockupLinear.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\nimport {Lockup, LockupLinear} from \\\"./types/DataTypes.sol\\\";\\nimport {ISablierV2Lockup} from \\\"./ISablierV2Lockup.sol\\\";\\n\\n/// @title ISablierV2LockupLinear\\n/// @notice Creates and manages Lockup streams with a linear distribution function.\\ninterface ISablierV2LockupLinear is ISablierV2Lockup {\\n /*//////////////////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Emitted when a stream is created.\\n /// @param streamId The ID of the newly created stream.\\n /// @param funder The address which funded the stream.\\n /// @param sender The address distributing the assets, which will have the ability to cancel the stream.\\n /// @param recipient The address receiving the assets.\\n /// @param amounts Struct encapsulating (i) the deposit amount, and (ii) the broker fee amount, both denoted\\n /// in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Boolean indicating whether the stream will be cancelable or not.\\n /// @param transferable Boolean indicating whether the stream NFT is transferable or not.\\n /// @param timestamps Struct encapsulating (i) the stream's start time, (ii) cliff time, and (iii) end time, all as\\n /// Unix timestamps.\\n /// @param broker The address of the broker who has helped create the stream, e.g. a front-end website.\\n event CreateLockupLinearStream(\\n uint256 streamId,\\n address funder,\\n address indexed sender,\\n address indexed recipient,\\n Lockup.CreateAmounts amounts,\\n IERC20 indexed asset,\\n bool cancelable,\\n bool transferable,\\n LockupLinear.Timestamps timestamps,\\n address broker\\n );\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Retrieves the stream's cliff time, which is a Unix timestamp. A value of zero means there\\n /// is no cliff.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getCliffTime(\\n uint256 streamId\\n ) external view returns (uint40 cliffTime);\\n\\n /// @notice Retrieves the full stream details.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n /// @return stream See the documentation in {DataTypes}.\\n function getStream(\\n uint256 streamId\\n ) external view returns (LockupLinear.StreamLL memory stream);\\n\\n /// @notice Retrieves the stream's start, cliff and end timestamps.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n /// @return timestamps See the documentation in {DataTypes}.\\n function getTimestamps(\\n uint256 streamId\\n ) external view returns (LockupLinear.Timestamps memory timestamps);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n NON-CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Creates a stream by setting the start time to `block.timestamp`, and the end time to\\n /// the sum of `block.timestamp` and `params.durations.total`. The stream is funded by `msg.sender` and is wrapped\\n /// in an ERC-721 NFT.\\n ///\\n /// @dev Emits a {Transfer} and {CreateLockupLinearStream} event.\\n ///\\n /// Requirements:\\n /// - All requirements in {createWithTimestamps} must be met for the calculated parameters.\\n ///\\n /// @param params Struct encapsulating the function parameters, which are documented in {DataTypes}.\\n /// @return streamId The ID of the newly created stream.\\n function createWithDurations(\\n LockupLinear.CreateWithDurations calldata params\\n ) external returns (uint256 streamId);\\n\\n /// @notice Creates a stream with the provided start time and end time. The stream is funded by `msg.sender` and is\\n /// wrapped in an ERC-721 NFT.\\n ///\\n /// @dev Emits a {Transfer} and {CreateLockupLinearStream} event.\\n ///\\n /// Notes:\\n /// - A cliff time of zero means there is no cliff.\\n /// - As long as the times are ordered, it is not an error for the start or the cliff time to be in the past.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `params.totalAmount` must be greater than zero.\\n /// - If set, `params.broker.fee` must not be greater than `MAX_BROKER_FEE`.\\n /// - `params.timestamps.start` must be greater than zero and less than `params.timestamps.end`.\\n /// - If set, `params.timestamps.cliff` must be greater than `params.timestamps.start` and less than\\n /// `params.timestamps.end`.\\n /// - `params.timestamps.end` must be in the future.\\n /// - `params.recipient` must not be the zero address.\\n /// - `msg.sender` must have allowed this contract to spend at least `params.totalAmount` assets.\\n ///\\n /// @param params Struct encapsulating the function parameters, which are documented in {DataTypes}.\\n /// @return streamId The ID of the newly created stream.\\n function createWithTimestamps(\\n LockupLinear.CreateWithTimestamps calldata params\\n ) external returns (uint256 streamId);\\n}\\n\",\"keccak256\":\"0x064264723114b1f1cf3953fd79874dfcbb42cf313857aee6d5e6b09a23e0010b\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/ISablierV2NFTDescriptor.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC721Metadata} from \\\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\\\";\\n\\n/// @title ISablierV2NFTDescriptor\\n/// @notice This contract generates the URI describing the Sablier V2 stream NFTs.\\n/// @dev Inspired by Uniswap V3 Positions NFTs.\\ninterface ISablierV2NFTDescriptor {\\n /// @notice Produces the URI describing a particular stream NFT.\\n /// @dev This is a data URI with the JSON contents directly inlined.\\n /// @param sablier The address of the Sablier contract the stream was created in.\\n /// @param streamId The ID of the stream for which to produce a description.\\n /// @return uri The URI of the ERC721-compliant metadata.\\n function tokenURI(\\n IERC721Metadata sablier,\\n uint256 streamId\\n ) external view returns (string memory uri);\\n}\\n\",\"keccak256\":\"0x4ed430e553d14161e93efdaaacd1a502f49b38969c9d714b45d2e682a74fa0bc\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/types/DataTypes.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {UD2x18} from \\\"@prb/math/src/UD2x18.sol\\\";\\nimport {UD60x18} from \\\"@prb/math/src/UD60x18.sol\\\";\\n\\n// DataTypes.sol\\n//\\n// This file defines all structs used in V2 Core, most of which are organized under three namespaces:\\n//\\n// - Lockup\\n// - LockupDynamic\\n// - LockupLinear\\n// - LockupTranched\\n//\\n// You will notice that some structs contain \\\"slot\\\" annotations - they are used to indicate the\\n// storage layout of the struct. It is more gas efficient to group small data types together so\\n// that they fit in a single 32-byte slot.\\n\\n/// @notice Struct encapsulating the broker parameters passed to the create functions. Both can be set to zero.\\n/// @param account The address receiving the broker's fee.\\n/// @param fee The broker's percentage fee from the total amount, denoted as a fixed-point number where 1e18 is 100%.\\nstruct Broker {\\n address account;\\n UD60x18 fee;\\n}\\n\\n/// @notice Namespace for the structs used in both {SablierV2LockupLinear} and {SablierV2LockupDynamic}.\\nlibrary Lockup {\\n /// @notice Struct encapsulating the deposit, withdrawn, and refunded amounts, all denoted in units of the asset's\\n /// decimals.\\n /// @dev Because the deposited and the withdrawn amount are often read together, declaring them in the same slot\\n /// saves gas.\\n /// @param deposited The initial amount deposited in the stream, net of broker fee.\\n /// @param withdrawn The cumulative amount withdrawn from the stream.\\n /// @param refunded The amount refunded to the sender. Unless the stream was canceled, this is always zero.\\n struct Amounts {\\n // slot 0\\n uint128 deposited;\\n uint128 withdrawn;\\n // slot 1\\n uint128 refunded;\\n }\\n\\n /// @notice Struct encapsulating (i) the deposit amount and (ii) the broker fee amount, both denoted in units of the\\n /// asset's decimals.\\n /// @param deposit The amount to deposit in the stream.\\n /// @param brokerFee The broker fee amount.\\n struct CreateAmounts {\\n uint128 deposit;\\n uint128 brokerFee;\\n }\\n\\n /// @notice Enum representing the different statuses of a stream.\\n /// @custom:value0 PENDING Stream created but not started; assets are in a pending state.\\n /// @custom:value1 STREAMING Active stream where assets are currently being streamed.\\n /// @custom:value2 SETTLED All assets have been streamed; recipient is due to withdraw them.\\n /// @custom:value3 CANCELED Canceled stream; remaining assets await recipient's withdrawal.\\n /// @custom:value4 DEPLETED Depleted stream; all assets have been withdrawn and/or refunded.\\n enum Status {\\n PENDING,\\n STREAMING,\\n SETTLED,\\n CANCELED,\\n DEPLETED\\n }\\n\\n /// @notice A common data structure to be stored in all {SablierV2Lockup} models.\\n /// @dev The fields are arranged like this to save gas via tight variable packing.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream.\\n /// @param startTime The Unix timestamp indicating the stream's start.\\n /// @param endTime The Unix timestamp indicating the stream's end.\\n /// @param isCancelable Boolean indicating if the stream is cancelable.\\n /// @param wasCanceled Boolean indicating if the stream was canceled.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param isDepleted Boolean indicating if the stream is depleted.\\n /// @param isStream Boolean indicating if the struct entity exists.\\n /// @param isTransferable Boolean indicating if the stream NFT is transferable.\\n /// @param amounts Struct encapsulating the deposit, withdrawn, and refunded amounts, all denoted in units of the\\n /// asset's decimals.\\n struct Stream {\\n // slot 0\\n address sender;\\n uint40 startTime;\\n uint40 endTime;\\n bool isCancelable;\\n bool wasCanceled;\\n // slot 1\\n IERC20 asset;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n // slot 2 and 3\\n Lockup.Amounts amounts;\\n }\\n}\\n\\n/// @notice Namespace for the structs used in {SablierV2LockupDynamic}.\\nlibrary LockupDynamic {\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupDynamic.createWithDurations} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param segments Segments with durations used to compose the dynamic distribution function. Timestamps are\\n /// calculated by starting from `block.timestamp` and adding each duration to the previous timestamp.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithDurations {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n SegmentWithDuration[] segments;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupDynamic.createWithTimestamps} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param startTime The Unix timestamp indicating the stream's start.\\n /// @param segments Segments used to compose the dynamic distribution function.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithTimestamps {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n uint40 startTime;\\n Segment[] segments;\\n Broker broker;\\n }\\n\\n /// @notice Segment struct used in the Lockup Dynamic stream.\\n /// @param amount The amount of assets to be streamed in the segment, denoted in units of the asset's decimals.\\n /// @param exponent The exponent of the segment, denoted as a fixed-point number.\\n /// @param timestamp The Unix timestamp indicating the segment's end.\\n struct Segment {\\n // slot 0\\n uint128 amount;\\n UD2x18 exponent;\\n uint40 timestamp;\\n }\\n\\n /// @notice Segment struct used at runtime in {SablierV2LockupDynamic.createWithDurations}.\\n /// @param amount The amount of assets to be streamed in the segment, denoted in units of the asset's decimals.\\n /// @param exponent The exponent of the segment, denoted as a fixed-point number.\\n /// @param duration The time difference in seconds between the segment and the previous one.\\n struct SegmentWithDuration {\\n uint128 amount;\\n UD2x18 exponent;\\n uint40 duration;\\n }\\n\\n /// @notice Struct encapsulating the full details of a stream.\\n /// @dev Extends `Lockup.Stream` by including the recipient and the segments.\\n struct StreamLD {\\n address sender;\\n address recipient;\\n uint40 startTime;\\n uint40 endTime;\\n bool isCancelable;\\n bool wasCanceled;\\n IERC20 asset;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n Lockup.Amounts amounts;\\n Segment[] segments;\\n }\\n\\n /// @notice Struct encapsulating the LockupDynamic timestamps.\\n /// @param start The Unix timestamp indicating the stream's start.\\n /// @param end The Unix timestamp indicating the stream's end.\\n struct Timestamps {\\n uint40 start;\\n uint40 end;\\n }\\n}\\n\\n/// @notice Namespace for the structs used in {SablierV2LockupLinear}.\\nlibrary LockupLinear {\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupLinear.createWithDurations} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param durations Struct encapsulating (i) cliff period duration and (ii) total stream duration, both in seconds.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithDurations {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n Durations durations;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupLinear.createWithTimestamps} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param timestamps Struct encapsulating (i) the stream's start time, (ii) cliff time, and (iii) end time, all as\\n /// Unix timestamps.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithTimestamps {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n Timestamps timestamps;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the cliff duration and the total duration.\\n /// @param cliff The cliff duration in seconds.\\n /// @param total The total duration in seconds.\\n struct Durations {\\n uint40 cliff;\\n uint40 total;\\n }\\n\\n /// @notice Struct encapsulating the full details of a stream.\\n /// @dev Extends `Lockup.Stream` by including the recipient and the cliff time.\\n struct StreamLL {\\n address sender;\\n address recipient;\\n uint40 startTime;\\n bool isCancelable;\\n bool wasCanceled;\\n IERC20 asset;\\n uint40 endTime;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n Lockup.Amounts amounts;\\n uint40 cliffTime;\\n }\\n\\n /// @notice Struct encapsulating the LockupLinear timestamps.\\n /// @param start The Unix timestamp for the stream's start.\\n /// @param cliff The Unix timestamp for the cliff period's end. A value of zero means there is no cliff.\\n /// @param end The Unix timestamp for the stream's end.\\n struct Timestamps {\\n uint40 start;\\n uint40 cliff;\\n uint40 end;\\n }\\n}\\n\\n/// @notice Namespace for the structs used in {SablierV2LockupTranched}.\\nlibrary LockupTranched {\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupTranched.createWithDurations} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param tranches Tranches with durations used to compose the tranched distribution function. Timestamps are\\n /// calculated by starting from `block.timestamp` and adding each duration to the previous timestamp.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithDurations {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n TrancheWithDuration[] tranches;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupTranched.createWithTimestamps} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param startTime The Unix timestamp indicating the stream's start.\\n /// @param tranches Tranches used to compose the tranched distribution function.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithTimestamps {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n uint40 startTime;\\n Tranche[] tranches;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the full details of a stream.\\n /// @dev Extends `Lockup.Stream` by including the recipient and the tranches.\\n struct StreamLT {\\n address sender;\\n address recipient;\\n uint40 startTime;\\n uint40 endTime;\\n bool isCancelable;\\n bool wasCanceled;\\n IERC20 asset;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n Lockup.Amounts amounts;\\n Tranche[] tranches;\\n }\\n\\n /// @notice Struct encapsulating the LockupTranched timestamps.\\n /// @param start The Unix timestamp indicating the stream's start.\\n /// @param end The Unix timestamp indicating the stream's end.\\n struct Timestamps {\\n uint40 start;\\n uint40 end;\\n }\\n\\n /// @notice Tranche struct used in the Lockup Tranched stream.\\n /// @param amount The amount of assets to be unlocked in the tranche, denoted in units of the asset's decimals.\\n /// @param timestamp The Unix timestamp indicating the tranche's end.\\n struct Tranche {\\n // slot 0\\n uint128 amount;\\n uint40 timestamp;\\n }\\n\\n /// @notice Tranche struct used at runtime in {SablierV2LockupTranched.createWithDurations}.\\n /// @param amount The amount of assets to be unlocked in the tranche, denoted in units of the asset's decimals.\\n /// @param duration The time difference in seconds between the tranche and the previous one.\\n struct TrancheWithDuration {\\n uint128 amount;\\n uint40 duration;\\n }\\n}\\n\",\"keccak256\":\"0x727722c0ec71a76a947b935c9dfcac8fd846d6c3547dfbc8739c7109f3b95068\",\"license\":\"GPL-3.0-or-later\"},\"contracts/modules/DecentHatsModificationModule.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.28;\\n\\nimport {DecentHatsModuleUtils} from \\\"./DecentHatsModuleUtils.sol\\\";\\n\\ncontract DecentHatsModificationModule is DecentHatsModuleUtils {\\n /**\\n * @notice Creates a new termed or untermed role hat and any streams on it.\\n *\\n * @notice This contract should be enabled a module on the Safe for which the role is to be created, and disabled after.\\n *\\n * @dev Stream funds on untermed Roles are targeted at the hat's smart account. In order to withdraw funds from the stream, the\\n * hat's smart account must be the one call to `withdraw-` on the Sablier contract, setting the recipient arg to its wearer.\\n *\\n * @dev Stream funds on termed Roles are targeted directly at the nominated wearer.\\n * The wearer should directly call `withdraw-` on the Sablier contract.\\n *\\n * @dev Role hat creation, minting, smart account creation and stream creation are handled here in order\\n * to avoid a race condition where not more than one active proposal to create a new role can exist at a time.\\n * See: https://github.com/decentdao/decent-interface/issues/2402\\n *\\n * @param roleHatsParams An array of params for each role hat to be created.\\n */\\n function createRoleHats(\\n CreateRoleHatsParams calldata roleHatsParams\\n ) external {\\n _processRoleHats(roleHatsParams);\\n }\\n}\\n\",\"keccak256\":\"0x45b9470e000a416382deebea44a8c8734a2d6b453e8c7fbba5ea9bc6fdd4917c\",\"license\":\"MIT\"},\"contracts/modules/DecentHatsModuleUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.28;\\n\\nimport {Enum} from \\\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\\\";\\nimport {IAvatar} from \\\"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IERC6551Registry} from \\\"../interfaces/IERC6551Registry.sol\\\";\\nimport {IHats} from \\\"../interfaces/hats/IHats.sol\\\";\\nimport {LockupLinear, Broker} from \\\"../interfaces/sablier/types/DataTypes.sol\\\";\\nimport {IHatsModuleFactory} from \\\"../interfaces/hats/IHatsModuleFactory.sol\\\";\\nimport {ISablierV2LockupLinear} from \\\"../interfaces/sablier/ISablierV2LockupLinear.sol\\\";\\nimport {Strings} from \\\"@openzeppelin/contracts/utils/Strings.sol\\\";\\n\\nabstract contract DecentHatsModuleUtils {\\n bytes32 public constant SALT =\\n 0x5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b5072;\\n\\n struct SablierStreamParams {\\n ISablierV2LockupLinear sablier;\\n address sender;\\n address asset;\\n LockupLinear.Timestamps timestamps;\\n Broker broker;\\n uint128 totalAmount;\\n bool cancelable;\\n bool transferable;\\n }\\n\\n struct HatParams {\\n address wearer;\\n string details;\\n string imageURI;\\n SablierStreamParams[] sablierStreamsParams;\\n uint128 termEndDateTs; // If 0, this is an untermed Hat\\n uint32 maxSupply;\\n bool isMutable;\\n }\\n\\n struct CreateRoleHatsParams {\\n IHats hatsProtocol;\\n IERC6551Registry erc6551Registry;\\n address hatsAccountImplementation;\\n uint256 topHatId;\\n address topHatAccount;\\n address keyValuePairs;\\n IHatsModuleFactory hatsModuleFactory;\\n address hatsElectionsEligibilityImplementation;\\n uint256 adminHatId;\\n HatParams[] hats;\\n }\\n\\n function _processRoleHats(\\n CreateRoleHatsParams memory roleHatsParams\\n ) internal {\\n for (uint256 i = 0; i < roleHatsParams.hats.length; ) {\\n HatParams memory hatParams = roleHatsParams.hats[i];\\n\\n // Create eligibility module if needed\\n address eligibilityAddress = _createEligibilityModule(\\n roleHatsParams.hatsProtocol,\\n roleHatsParams.hatsModuleFactory,\\n roleHatsParams.hatsElectionsEligibilityImplementation,\\n roleHatsParams.topHatId,\\n roleHatsParams.topHatAccount,\\n roleHatsParams.adminHatId,\\n hatParams.termEndDateTs\\n );\\n\\n // Create and Mint the Role Hat\\n uint256 hatId = _createAndMintHat(\\n roleHatsParams.hatsProtocol,\\n roleHatsParams.adminHatId,\\n hatParams,\\n eligibilityAddress,\\n roleHatsParams.topHatAccount\\n );\\n\\n // Get the stream recipient (based on termed or not)\\n address streamRecipient = _setupStreamRecipient(\\n roleHatsParams.erc6551Registry,\\n roleHatsParams.hatsAccountImplementation,\\n address(roleHatsParams.hatsProtocol),\\n hatParams.termEndDateTs,\\n hatParams.wearer,\\n hatId\\n );\\n\\n // Create streams\\n _processSablierStreams(\\n hatParams.sablierStreamsParams,\\n streamRecipient,\\n roleHatsParams.keyValuePairs,\\n hatId\\n );\\n\\n unchecked {\\n ++i;\\n }\\n }\\n }\\n\\n function _createEligibilityModule(\\n IHats hatsProtocol,\\n IHatsModuleFactory hatsModuleFactory,\\n address hatsElectionsEligibilityImplementation,\\n uint256 topHatId,\\n address topHatAccount,\\n uint256 adminHatId,\\n uint128 termEndDateTs\\n ) private returns (address) {\\n // If the Hat is termed, create the eligibility module\\n if (termEndDateTs != 0) {\\n return\\n hatsModuleFactory.createHatsModule(\\n hatsElectionsEligibilityImplementation,\\n hatsProtocol.getNextId(adminHatId),\\n abi.encode(topHatId, uint256(0)), // [BALLOT_BOX_ID, ADMIN_HAT_ID]\\n abi.encode(termEndDateTs),\\n uint256(SALT)\\n );\\n }\\n\\n // Otherwise, return the Top Hat account\\n return topHatAccount;\\n }\\n\\n function _createAndMintHat(\\n IHats hatsProtocol,\\n uint256 adminHatId,\\n HatParams memory hat,\\n address eligibilityAddress,\\n address topHatAccount\\n ) private returns (uint256) {\\n // Grab the next Hat ID (before creating it)\\n uint256 hatId = hatsProtocol.getNextId(adminHatId);\\n\\n // Create the new Hat\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"createHat(uint256,string,uint32,address,address,bool,string)\\\",\\n adminHatId,\\n hat.details,\\n hat.maxSupply,\\n eligibilityAddress,\\n topHatAccount,\\n hat.isMutable,\\n hat.imageURI\\n ),\\n Enum.Operation.Call\\n );\\n\\n // If the Hat is termed, nominate the wearer as the eligible member\\n if (hat.termEndDateTs != 0) {\\n address[] memory nominatedWearers = new address[](1);\\n nominatedWearers[0] = hat.wearer;\\n\\n IAvatar(msg.sender).execTransactionFromModule(\\n eligibilityAddress,\\n 0,\\n abi.encodeWithSignature(\\n \\\"elect(uint128,address[])\\\",\\n hat.termEndDateTs,\\n nominatedWearers\\n ),\\n Enum.Operation.Call\\n );\\n }\\n\\n // Mint the Hat\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"mintHat(uint256,address)\\\",\\n hatId,\\n hat.wearer\\n ),\\n Enum.Operation.Call\\n );\\n return hatId;\\n }\\n\\n // Exists to avoid stack too deep errors\\n function _setupStreamRecipient(\\n IERC6551Registry erc6551Registry,\\n address hatsAccountImplementation,\\n address hatsProtocol,\\n uint128 termEndDateTs,\\n address wearer,\\n uint256 hatId\\n ) private returns (address) {\\n // If the hat is termed, the wearer is the stream recipient\\n if (termEndDateTs != 0) {\\n return wearer;\\n }\\n\\n // Otherwise, the Hat's smart account is the stream recipient\\n return\\n erc6551Registry.createAccount(\\n hatsAccountImplementation,\\n SALT,\\n block.chainid,\\n hatsProtocol,\\n hatId\\n );\\n }\\n\\n function _processSablierStreams(\\n SablierStreamParams[] memory streamParams,\\n address streamRecipient,\\n address keyValuePairs,\\n uint256 hatId\\n ) private {\\n for (uint256 i = 0; i < streamParams.length; ) {\\n SablierStreamParams memory sablierStreamParams = streamParams[i];\\n\\n // Approve tokens for Sablier\\n IAvatar(msg.sender).execTransactionFromModule(\\n sablierStreamParams.asset,\\n 0,\\n abi.encodeWithSignature(\\n \\\"approve(address,uint256)\\\",\\n sablierStreamParams.sablier,\\n sablierStreamParams.totalAmount\\n ),\\n Enum.Operation.Call\\n );\\n uint256 streamId = ISablierV2LockupLinear(\\n sablierStreamParams.sablier\\n ).nextStreamId();\\n\\n // Proxy the Sablier call through IAvatar\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(sablierStreamParams.sablier),\\n 0,\\n abi.encodeWithSignature(\\n \\\"createWithTimestamps((address,address,uint128,address,bool,bool,(uint40,uint40,uint40),(address,uint256)))\\\",\\n LockupLinear.CreateWithTimestamps({\\n sender: sablierStreamParams.sender,\\n recipient: streamRecipient,\\n totalAmount: sablierStreamParams.totalAmount,\\n asset: IERC20(sablierStreamParams.asset),\\n cancelable: sablierStreamParams.cancelable,\\n transferable: sablierStreamParams.transferable,\\n timestamps: sablierStreamParams.timestamps,\\n broker: sablierStreamParams.broker\\n })\\n ),\\n Enum.Operation.Call\\n );\\n\\n // Update KeyValuePairs with the stream ID and Hat ID\\n string[] memory keys = new string[](1);\\n string[] memory values = new string[](1);\\n keys[0] = \\\"hatIdToStreamId\\\";\\n values[0] = string(\\n abi.encodePacked(\\n Strings.toString(hatId),\\n \\\":\\\",\\n Strings.toString(streamId)\\n )\\n );\\n\\n IAvatar(msg.sender).execTransactionFromModule(\\n keyValuePairs,\\n 0,\\n abi.encodeWithSignature(\\n \\\"updateValues(string[],string[])\\\",\\n keys,\\n values\\n ),\\n Enum.Operation.Call\\n );\\n\\n unchecked {\\n ++i;\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xcf91d6de2291dd71d2491292ee2d1120c444b8f4f11b8c31429ed4c630013e69\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052348015600f57600080fd5b506116d88061001f6000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80630ad5e4271461003b578063ba9a91a514610050575b600080fd5b61004e610049366004610c55565b610089565b005b6100777f5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b507281565b60405190815260200160405180910390f35b61009a6100958261118c565b61009d565b50565b60005b8161012001515181101561016857600082610120015182815181106100c7576100c7611260565b6020026020010151905060006100ff84600001518560c001518660e0015187606001518860800151896101000151886080015161016c565b9050600061011d8560000151866101000151858589608001516102e5565b905060006101438660200151876040015188600001518760800151886000015187610617565b90506101598460600151828860a00151856106e3565b846001019450505050506100a0565b5050565b60006001600160801b038216156102d757866001600160a01b0316632f7fb7b6878a6001600160a01b0316631183a8c0876040518263ffffffff1660e01b81526004016101bb91815260200190565b602060405180830381865afa1580156101d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101fc9190611276565b886000604051602001610219929190918252602082015260400190565b60408051601f198184030181528282526001600160801b0389166020840152910160408051601f19818403018152908290526001600160e01b031960e087901b16825261028d949392917f5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b5072906004016112df565b6020604051808303816000875af11580156102ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102d0919061132b565b90506102da565b50825b979650505050505050565b60405162460ea360e61b81526004810185905260009081906001600160a01b03881690631183a8c090602401602060405180830381865afa15801561032e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103529190611276565b9050336001600160a01b031663468721a78860008989602001518a60a001518a8a8d60c001518e604001516040516024016103939796959493929190611348565b60408051601f198184030181529181526020820180516001600160e01b0316635829492f60e11b1790525160e085901b6001600160e01b03191681526103e1939291906000906004016113ac565b6020604051808303816000875af1158015610400573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104249190611402565b5060808501516001600160801b03161561054f576040805160018082528183019092526000916020808301908036833701905050905085600001518160008151811061047257610472611260565b60200260200101906001600160a01b031690816001600160a01b031681525050336001600160a01b031663468721a78660008960800151856040516024016104bb92919061141f565b60408051601f198184030181529181526020820180516001600160e01b0316634a231cef60e01b1790525160e085901b6001600160e01b0319168152610509939291906000906004016113ac565b6020604051808303816000875af1158015610528573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061054c9190611402565b50505b8451604051602481018390526001600160a01b039091166044820152339063468721a790899060009060640160408051601f198184030181529181526020820180516001600160e01b031663320fbbb760e11b1790525160e085901b6001600160e01b03191681526105c9939291906000906004016113ac565b6020604051808303816000875af11580156105e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061060c9190611402565b509695505050505050565b60006001600160801b0384161561062f5750816106d9565b604051638a54c52f60e01b81526001600160a01b0387811660048301527f5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b50726024830152466044830152868116606483015260848201849052881690638a54c52f9060a4016020604051808303816000875af11580156106b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106d6919061132b565b90505b9695505050505050565b60005b8451811015610b4657600085828151811061070357610703611260565b60200260200101519050336001600160a01b031663468721a78260400151600084600001518560a0015160405160240161075b9291906001600160a01b039290921682526001600160801b0316602082015260400190565b60408051601f198184030181529181526020820180516001600160e01b031663095ea7b360e01b1790525160e085901b6001600160e01b03191681526107a9939291906000906004016113ac565b6020604051808303816000875af11580156107c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ec9190611402565b50600081600001516001600160a01b0316631e99d5696040518163ffffffff1660e01b8152600401602060405180830381865afa158015610831573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108559190611276565b9050336001600160a01b031663468721a78360000151600060405180610100016040528087602001516001600160a01b031681526020018b6001600160a01b031681526020018760a001516001600160801b0316815260200187604001516001600160a01b031681526020018760c00151151581526020018760e00151151581526020018760600151815260200187608001518152506040516024016108fb9190611480565b60408051601f198184030181529181526020820180516001600160e01b03166353b1572760e01b1790525160e085901b6001600160e01b0319168152610949939291906000906004016113ac565b6020604051808303816000875af1158015610968573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061098c9190611402565b50604080516001808252818301909252600091816020015b60608152602001906001900390816109a457505060408051600180825281830190925291925060009190602082015b60608152602001906001900390816109d35790505090506040518060400160405280600f81526020016e1a185d1259151bd4dd1c99585b5259608a1b81525082600081518110610a2557610a25611260565b6020026020010181905250610a3986610b4d565b610a4284610b4d565b604051602001610a5392919061154f565b60405160208183030381529060405281600081518110610a7557610a75611260565b6020026020010181905250336001600160a01b031663468721a78860008585604051602401610aa59291906115db565b60408051601f198184030181529181526020820180516001600160e01b031663579374b960e11b1790525160e085901b6001600160e01b0319168152610af3939291906000906004016113ac565b6020604051808303816000875af1158015610b12573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b369190611402565b50846001019450505050506106e6565b5050505050565b606081600003610b745750506040805180820190915260018152600360fc1b602082015290565b8160005b8115610b9e5780610b888161161f565b9150610b979050600a8361164e565b9150610b78565b6000816001600160401b03811115610bb857610bb8610c97565b6040519080825280601f01601f191660200182016040528015610be2576020820181803683370190505b5090505b8415610c4d57610bf7600183611662565b9150610c04600a8661167b565b610c0f90603061168f565b60f81b818381518110610c2457610c24611260565b60200101906001600160f81b031916908160001a905350610c46600a8661164e565b9450610be6565b949350505050565b600060208284031215610c6757600080fd5b81356001600160401b03811115610c7d57600080fd5b82016101408185031215610c9057600080fd5b9392505050565b634e487b7160e01b600052604160045260246000fd5b60405161010081016001600160401b0381118282101715610cd057610cd0610c97565b60405290565b60405160e081016001600160401b0381118282101715610cd057610cd0610c97565b60405161014081016001600160401b0381118282101715610cd057610cd0610c97565b604051601f8201601f191681016001600160401b0381118282101715610d4357610d43610c97565b604052919050565b6001600160a01b038116811461009a57600080fd5b8035610d6b81610d4b565b919050565b60006001600160401b03821115610d8957610d89610c97565b5060051b60200190565b600082601f830112610da457600080fd5b81356001600160401b03811115610dbd57610dbd610c97565b610dd0601f8201601f1916602001610d1b565b818152846020838601011115610de557600080fd5b816020850160208301376000918101602001919091529392505050565b803564ffffffffff81168114610d6b57600080fd5b600060608284031215610e2957600080fd5b604051606081016001600160401b0381118282101715610e4b57610e4b610c97565b604052905080610e5a83610e02565b8152610e6860208401610e02565b6020820152610e7960408401610e02565b60408201525092915050565b600060408284031215610e9757600080fd5b604080519081016001600160401b0381118282101715610eb957610eb9610c97565b6040529050808235610eca81610d4b565b8152602092830135920191909152919050565b80356001600160801b0381168114610d6b57600080fd5b801515811461009a57600080fd5b8035610d6b81610ef4565b600082601f830112610f1e57600080fd5b8135610f31610f2c82610d70565b610d1b565b8082825260208201915060206101608402860101925085831115610f5457600080fd5b602085015b83811015611012576101608188031215610f7257600080fd5b610f7a610cad565b610f8382610d60565b8152610f9160208301610d60565b6020820152610fa260408301610d60565b6040820152610fb48860608401610e17565b6060820152610fc68860c08401610e85565b6080820152610fd86101008301610edd565b60a0820152610fea6101208301610f02565b60c0820152610ffc6101408301610f02565b60e0820152835260209092019161016001610f59565b5095945050505050565b803563ffffffff81168114610d6b57600080fd5b600082601f83011261104157600080fd5b813561104f610f2c82610d70565b8082825260208201915060208360051b86010192508583111561107157600080fd5b602085015b838110156110125780356001600160401b0381111561109457600080fd5b860160e0818903601f190112156110aa57600080fd5b6110b2610cd6565b6110be60208301610d60565b815260408201356001600160401b038111156110d957600080fd5b6110e88a602083860101610d93565b60208301525060608201356001600160401b0381111561110757600080fd5b6111168a602083860101610d93565b60408301525060808201356001600160401b0381111561113557600080fd5b6111448a602083860101610f0d565b60608301525061115660a08301610edd565b608082015261116760c0830161101c565b60a082015261117860e08301610f02565b60c082015284525060209283019201611076565b6000610140823603121561119f57600080fd5b6111a7610cf8565b6111b083610d60565b81526111be60208401610d60565b60208201526111cf60408401610d60565b6040820152606083810135908201526111ea60808401610d60565b60808201526111fb60a08401610d60565b60a082015261120c60c08401610d60565b60c082015261121d60e08401610d60565b60e082015261010083810135908201526101208301356001600160401b0381111561124757600080fd5b61125336828601611030565b6101208301525092915050565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561128857600080fd5b5051919050565b60005b838110156112aa578181015183820152602001611292565b50506000910152565b600081518084526112cb81602086016020860161128f565b601f01601f19169290920160200192915050565b60018060a01b038616815284602082015260a06040820152600061130660a08301866112b3565b828103606084015261131881866112b3565b9150508260808301529695505050505050565b60006020828403121561133d57600080fd5b8151610c9081610d4b565b87815260e06020820152600061136160e08301896112b3565b63ffffffff881660408401526001600160a01b0387811660608501528616608084015284151560a084015282810360c084015261139e81856112b3565b9a9950505050505050505050565b60018060a01b03851681528360208201526080604082015260006113d360808301856112b3565b9050600283106113f357634e487b7160e01b600052602160045260246000fd5b82606083015295945050505050565b60006020828403121561141457600080fd5b8151610c9081610ef4565b6000604082016001600160801b03851683526040602084015280845180835260608501915060208601925060005b818110156114745783516001600160a01b031683526020938401939092019160010161144d565b50909695505050505050565b81516001600160a01b0390811682526020808401518216908301526040808401516001600160801b031690830152606080840151918216908301526101608201905060808301516114d5608084018215159052565b5060a08301516114e960a084018215159052565b5060c083015161152860c084018264ffffffffff815116825264ffffffffff602082015116602083015264ffffffffff60408201511660408301525050565b5060e0929092015180516001600160a01b0316610120830152602001516101409091015290565b6000835161156181846020880161128f565b601d60f91b908301908152835161157f81600184016020880161128f565b01600101949350505050565b600082825180855260208501945060208160051b8301016020850160005b8381101561147457601f198584030188526115c58383516112b3565b60209889019890935091909101906001016115a9565b6040815260006115ee604083018561158b565b8281036020840152611600818561158b565b95945050505050565b634e487b7160e01b600052601160045260246000fd5b60006001820161163157611631611609565b5060010190565b634e487b7160e01b600052601260045260246000fd5b60008261165d5761165d611638565b500490565b8181038181111561167557611675611609565b92915050565b60008261168a5761168a611638565b500690565b808201808211156116755761167561160956fea2646970667358221220cbb4b307eab1d5ffde2b7ecaf86a40052d6217b110fff2ecda840a0a4b601bdc64736f6c634300081c0033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100365760003560e01c80630ad5e4271461003b578063ba9a91a514610050575b600080fd5b61004e610049366004610c55565b610089565b005b6100777f5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b507281565b60405190815260200160405180910390f35b61009a6100958261118c565b61009d565b50565b60005b8161012001515181101561016857600082610120015182815181106100c7576100c7611260565b6020026020010151905060006100ff84600001518560c001518660e0015187606001518860800151896101000151886080015161016c565b9050600061011d8560000151866101000151858589608001516102e5565b905060006101438660200151876040015188600001518760800151886000015187610617565b90506101598460600151828860a00151856106e3565b846001019450505050506100a0565b5050565b60006001600160801b038216156102d757866001600160a01b0316632f7fb7b6878a6001600160a01b0316631183a8c0876040518263ffffffff1660e01b81526004016101bb91815260200190565b602060405180830381865afa1580156101d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101fc9190611276565b886000604051602001610219929190918252602082015260400190565b60408051601f198184030181528282526001600160801b0389166020840152910160408051601f19818403018152908290526001600160e01b031960e087901b16825261028d949392917f5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b5072906004016112df565b6020604051808303816000875af11580156102ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102d0919061132b565b90506102da565b50825b979650505050505050565b60405162460ea360e61b81526004810185905260009081906001600160a01b03881690631183a8c090602401602060405180830381865afa15801561032e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103529190611276565b9050336001600160a01b031663468721a78860008989602001518a60a001518a8a8d60c001518e604001516040516024016103939796959493929190611348565b60408051601f198184030181529181526020820180516001600160e01b0316635829492f60e11b1790525160e085901b6001600160e01b03191681526103e1939291906000906004016113ac565b6020604051808303816000875af1158015610400573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104249190611402565b5060808501516001600160801b03161561054f576040805160018082528183019092526000916020808301908036833701905050905085600001518160008151811061047257610472611260565b60200260200101906001600160a01b031690816001600160a01b031681525050336001600160a01b031663468721a78660008960800151856040516024016104bb92919061141f565b60408051601f198184030181529181526020820180516001600160e01b0316634a231cef60e01b1790525160e085901b6001600160e01b0319168152610509939291906000906004016113ac565b6020604051808303816000875af1158015610528573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061054c9190611402565b50505b8451604051602481018390526001600160a01b039091166044820152339063468721a790899060009060640160408051601f198184030181529181526020820180516001600160e01b031663320fbbb760e11b1790525160e085901b6001600160e01b03191681526105c9939291906000906004016113ac565b6020604051808303816000875af11580156105e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061060c9190611402565b509695505050505050565b60006001600160801b0384161561062f5750816106d9565b604051638a54c52f60e01b81526001600160a01b0387811660048301527f5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b50726024830152466044830152868116606483015260848201849052881690638a54c52f9060a4016020604051808303816000875af11580156106b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106d6919061132b565b90505b9695505050505050565b60005b8451811015610b4657600085828151811061070357610703611260565b60200260200101519050336001600160a01b031663468721a78260400151600084600001518560a0015160405160240161075b9291906001600160a01b039290921682526001600160801b0316602082015260400190565b60408051601f198184030181529181526020820180516001600160e01b031663095ea7b360e01b1790525160e085901b6001600160e01b03191681526107a9939291906000906004016113ac565b6020604051808303816000875af11580156107c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ec9190611402565b50600081600001516001600160a01b0316631e99d5696040518163ffffffff1660e01b8152600401602060405180830381865afa158015610831573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108559190611276565b9050336001600160a01b031663468721a78360000151600060405180610100016040528087602001516001600160a01b031681526020018b6001600160a01b031681526020018760a001516001600160801b0316815260200187604001516001600160a01b031681526020018760c00151151581526020018760e00151151581526020018760600151815260200187608001518152506040516024016108fb9190611480565b60408051601f198184030181529181526020820180516001600160e01b03166353b1572760e01b1790525160e085901b6001600160e01b0319168152610949939291906000906004016113ac565b6020604051808303816000875af1158015610968573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061098c9190611402565b50604080516001808252818301909252600091816020015b60608152602001906001900390816109a457505060408051600180825281830190925291925060009190602082015b60608152602001906001900390816109d35790505090506040518060400160405280600f81526020016e1a185d1259151bd4dd1c99585b5259608a1b81525082600081518110610a2557610a25611260565b6020026020010181905250610a3986610b4d565b610a4284610b4d565b604051602001610a5392919061154f565b60405160208183030381529060405281600081518110610a7557610a75611260565b6020026020010181905250336001600160a01b031663468721a78860008585604051602401610aa59291906115db565b60408051601f198184030181529181526020820180516001600160e01b031663579374b960e11b1790525160e085901b6001600160e01b0319168152610af3939291906000906004016113ac565b6020604051808303816000875af1158015610b12573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b369190611402565b50846001019450505050506106e6565b5050505050565b606081600003610b745750506040805180820190915260018152600360fc1b602082015290565b8160005b8115610b9e5780610b888161161f565b9150610b979050600a8361164e565b9150610b78565b6000816001600160401b03811115610bb857610bb8610c97565b6040519080825280601f01601f191660200182016040528015610be2576020820181803683370190505b5090505b8415610c4d57610bf7600183611662565b9150610c04600a8661167b565b610c0f90603061168f565b60f81b818381518110610c2457610c24611260565b60200101906001600160f81b031916908160001a905350610c46600a8661164e565b9450610be6565b949350505050565b600060208284031215610c6757600080fd5b81356001600160401b03811115610c7d57600080fd5b82016101408185031215610c9057600080fd5b9392505050565b634e487b7160e01b600052604160045260246000fd5b60405161010081016001600160401b0381118282101715610cd057610cd0610c97565b60405290565b60405160e081016001600160401b0381118282101715610cd057610cd0610c97565b60405161014081016001600160401b0381118282101715610cd057610cd0610c97565b604051601f8201601f191681016001600160401b0381118282101715610d4357610d43610c97565b604052919050565b6001600160a01b038116811461009a57600080fd5b8035610d6b81610d4b565b919050565b60006001600160401b03821115610d8957610d89610c97565b5060051b60200190565b600082601f830112610da457600080fd5b81356001600160401b03811115610dbd57610dbd610c97565b610dd0601f8201601f1916602001610d1b565b818152846020838601011115610de557600080fd5b816020850160208301376000918101602001919091529392505050565b803564ffffffffff81168114610d6b57600080fd5b600060608284031215610e2957600080fd5b604051606081016001600160401b0381118282101715610e4b57610e4b610c97565b604052905080610e5a83610e02565b8152610e6860208401610e02565b6020820152610e7960408401610e02565b60408201525092915050565b600060408284031215610e9757600080fd5b604080519081016001600160401b0381118282101715610eb957610eb9610c97565b6040529050808235610eca81610d4b565b8152602092830135920191909152919050565b80356001600160801b0381168114610d6b57600080fd5b801515811461009a57600080fd5b8035610d6b81610ef4565b600082601f830112610f1e57600080fd5b8135610f31610f2c82610d70565b610d1b565b8082825260208201915060206101608402860101925085831115610f5457600080fd5b602085015b83811015611012576101608188031215610f7257600080fd5b610f7a610cad565b610f8382610d60565b8152610f9160208301610d60565b6020820152610fa260408301610d60565b6040820152610fb48860608401610e17565b6060820152610fc68860c08401610e85565b6080820152610fd86101008301610edd565b60a0820152610fea6101208301610f02565b60c0820152610ffc6101408301610f02565b60e0820152835260209092019161016001610f59565b5095945050505050565b803563ffffffff81168114610d6b57600080fd5b600082601f83011261104157600080fd5b813561104f610f2c82610d70565b8082825260208201915060208360051b86010192508583111561107157600080fd5b602085015b838110156110125780356001600160401b0381111561109457600080fd5b860160e0818903601f190112156110aa57600080fd5b6110b2610cd6565b6110be60208301610d60565b815260408201356001600160401b038111156110d957600080fd5b6110e88a602083860101610d93565b60208301525060608201356001600160401b0381111561110757600080fd5b6111168a602083860101610d93565b60408301525060808201356001600160401b0381111561113557600080fd5b6111448a602083860101610f0d565b60608301525061115660a08301610edd565b608082015261116760c0830161101c565b60a082015261117860e08301610f02565b60c082015284525060209283019201611076565b6000610140823603121561119f57600080fd5b6111a7610cf8565b6111b083610d60565b81526111be60208401610d60565b60208201526111cf60408401610d60565b6040820152606083810135908201526111ea60808401610d60565b60808201526111fb60a08401610d60565b60a082015261120c60c08401610d60565b60c082015261121d60e08401610d60565b60e082015261010083810135908201526101208301356001600160401b0381111561124757600080fd5b61125336828601611030565b6101208301525092915050565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561128857600080fd5b5051919050565b60005b838110156112aa578181015183820152602001611292565b50506000910152565b600081518084526112cb81602086016020860161128f565b601f01601f19169290920160200192915050565b60018060a01b038616815284602082015260a06040820152600061130660a08301866112b3565b828103606084015261131881866112b3565b9150508260808301529695505050505050565b60006020828403121561133d57600080fd5b8151610c9081610d4b565b87815260e06020820152600061136160e08301896112b3565b63ffffffff881660408401526001600160a01b0387811660608501528616608084015284151560a084015282810360c084015261139e81856112b3565b9a9950505050505050505050565b60018060a01b03851681528360208201526080604082015260006113d360808301856112b3565b9050600283106113f357634e487b7160e01b600052602160045260246000fd5b82606083015295945050505050565b60006020828403121561141457600080fd5b8151610c9081610ef4565b6000604082016001600160801b03851683526040602084015280845180835260608501915060208601925060005b818110156114745783516001600160a01b031683526020938401939092019160010161144d565b50909695505050505050565b81516001600160a01b0390811682526020808401518216908301526040808401516001600160801b031690830152606080840151918216908301526101608201905060808301516114d5608084018215159052565b5060a08301516114e960a084018215159052565b5060c083015161152860c084018264ffffffffff815116825264ffffffffff602082015116602083015264ffffffffff60408201511660408301525050565b5060e0929092015180516001600160a01b0316610120830152602001516101409091015290565b6000835161156181846020880161128f565b601d60f91b908301908152835161157f81600184016020880161128f565b01600101949350505050565b600082825180855260208501945060208160051b8301016020850160005b8381101561147457601f198584030188526115c58383516112b3565b60209889019890935091909101906001016115a9565b6040815260006115ee604083018561158b565b8281036020840152611600818561158b565b95945050505050565b634e487b7160e01b600052601160045260246000fd5b60006001820161163157611631611609565b5060010190565b634e487b7160e01b600052601260045260246000fd5b60008261165d5761165d611638565b500490565b8181038181111561167557611675611609565b92915050565b60008261168a5761168a611638565b500690565b808201808211156116755761167561160956fea2646970667358221220cbb4b307eab1d5ffde2b7ecaf86a40052d6217b110fff2ecda840a0a4b601bdc64736f6c634300081c0033", "devdoc": { "kind": "dev", "methods": { - "createRoleHats((address,address,address,uint256,address,address,address,uint256,(address,string,string,(address,address,address,(uint40,uint40,uint40),(address,uint256),uint128,bool,bool)[],uint128,uint32,bool)[]))": { + "createRoleHats((address,address,address,uint256,address,address,address,address,uint256,(address,string,string,(address,address,address,(uint40,uint40,uint40),(address,uint256),uint128,bool,bool)[],uint128,uint32,bool)[]))": { "details": "Stream funds on untermed Roles are targeted at the hat's smart account. In order to withdraw funds from the stream, the hat's smart account must be the one call to `withdraw-` on the Sablier contract, setting the recipient arg to its wearer.Stream funds on termed Roles are targeted directly at the nominated wearer. The wearer should directly call `withdraw-` on the Sablier contract.Role hat creation, minting, smart account creation and stream creation are handled here in order to avoid a race condition where not more than one active proposal to create a new role can exist at a time. See: https://github.com/decentdao/decent-interface/issues/2402", "params": { "roleHatsParams": "An array of params for each role hat to be created." @@ -220,7 +225,7 @@ "userdoc": { "kind": "user", "methods": { - "createRoleHats((address,address,address,uint256,address,address,address,uint256,(address,string,string,(address,address,address,(uint40,uint40,uint40),(address,uint256),uint128,bool,bool)[],uint128,uint32,bool)[]))": { + "createRoleHats((address,address,address,uint256,address,address,address,address,uint256,(address,string,string,(address,address,address,(uint40,uint40,uint40),(address,uint256),uint128,bool,bool)[],uint128,uint32,bool)[]))": { "notice": "Creates a new termed or untermed role hat and any streams on it.This contract should be enabled a module on the Safe for which the role is to be created, and disabled after." } }, diff --git a/deployments/base/solcInputs/f1fca9a70591742a2aedd10e2fd7e744.json b/deployments/base/solcInputs/f1fca9a70591742a2aedd10e2fd7e744.json new file mode 100644 index 0000000..14e45d1 --- /dev/null +++ b/deployments/base/solcInputs/f1fca9a70591742a2aedd10e2fd7e744.json @@ -0,0 +1,387 @@ +{ + "language": "Solidity", + "sources": { + "@gnosis.pm/safe-contracts/contracts/base/Executor.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\nimport \"../common/Enum.sol\";\n\n/// @title Executor - A contract that can execute transactions\n/// @author Richard Meissner - \ncontract Executor {\n function execute(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation,\n uint256 txGas\n ) internal returns (bool success) {\n if (operation == Enum.Operation.DelegateCall) {\n // solhint-disable-next-line no-inline-assembly\n assembly {\n success := delegatecall(txGas, to, add(data, 0x20), mload(data), 0, 0)\n }\n } else {\n // solhint-disable-next-line no-inline-assembly\n assembly {\n success := call(txGas, to, value, add(data, 0x20), mload(data), 0, 0)\n }\n }\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/base/FallbackManager.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"../common/SelfAuthorized.sol\";\n\n/// @title Fallback Manager - A contract that manages fallback calls made to this contract\n/// @author Richard Meissner - \ncontract FallbackManager is SelfAuthorized {\n event ChangedFallbackHandler(address handler);\n\n // keccak256(\"fallback_manager.handler.address\")\n bytes32 internal constant FALLBACK_HANDLER_STORAGE_SLOT = 0x6c9a6c4a39284e37ed1cf53d337577d14212a4870fb976a4366c693b939918d5;\n\n function internalSetFallbackHandler(address handler) internal {\n bytes32 slot = FALLBACK_HANDLER_STORAGE_SLOT;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n sstore(slot, handler)\n }\n }\n\n /// @dev Allows to add a contract to handle fallback calls.\n /// Only fallback calls without value and with data will be forwarded.\n /// This can only be done via a Safe transaction.\n /// @param handler contract to handle fallbacks calls.\n function setFallbackHandler(address handler) public authorized {\n internalSetFallbackHandler(handler);\n emit ChangedFallbackHandler(handler);\n }\n\n // solhint-disable-next-line payable-fallback,no-complex-fallback\n fallback() external {\n bytes32 slot = FALLBACK_HANDLER_STORAGE_SLOT;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let handler := sload(slot)\n if iszero(handler) {\n return(0, 0)\n }\n calldatacopy(0, 0, calldatasize())\n // The msg.sender address is shifted to the left by 12 bytes to remove the padding\n // Then the address without padding is stored right after the calldata\n mstore(calldatasize(), shl(96, caller()))\n // Add 20 bytes for the address appended add the end\n let success := call(gas(), handler, 0, 0, add(calldatasize(), 20), 0, 0)\n returndatacopy(0, 0, returndatasize())\n if iszero(success) {\n revert(0, returndatasize())\n }\n return(0, returndatasize())\n }\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/base/GuardManager.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"../common/Enum.sol\";\nimport \"../common/SelfAuthorized.sol\";\n\ninterface Guard {\n function checkTransaction(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation,\n uint256 safeTxGas,\n uint256 baseGas,\n uint256 gasPrice,\n address gasToken,\n address payable refundReceiver,\n bytes memory signatures,\n address msgSender\n ) external;\n\n function checkAfterExecution(bytes32 txHash, bool success) external;\n}\n\n/// @title Fallback Manager - A contract that manages fallback calls made to this contract\n/// @author Richard Meissner - \ncontract GuardManager is SelfAuthorized {\n event ChangedGuard(address guard);\n // keccak256(\"guard_manager.guard.address\")\n bytes32 internal constant GUARD_STORAGE_SLOT = 0x4a204f620c8c5ccdca3fd54d003badd85ba500436a431f0cbda4f558c93c34c8;\n\n /// @dev Set a guard that checks transactions before execution\n /// @param guard The address of the guard to be used or the 0 address to disable the guard\n function setGuard(address guard) external authorized {\n bytes32 slot = GUARD_STORAGE_SLOT;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n sstore(slot, guard)\n }\n emit ChangedGuard(guard);\n }\n\n function getGuard() internal view returns (address guard) {\n bytes32 slot = GUARD_STORAGE_SLOT;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n guard := sload(slot)\n }\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/base/ModuleManager.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\nimport \"../common/Enum.sol\";\nimport \"../common/SelfAuthorized.sol\";\nimport \"./Executor.sol\";\n\n/// @title Module Manager - A contract that manages modules that can execute transactions via this contract\n/// @author Stefan George - \n/// @author Richard Meissner - \ncontract ModuleManager is SelfAuthorized, Executor {\n event EnabledModule(address module);\n event DisabledModule(address module);\n event ExecutionFromModuleSuccess(address indexed module);\n event ExecutionFromModuleFailure(address indexed module);\n\n address internal constant SENTINEL_MODULES = address(0x1);\n\n mapping(address => address) internal modules;\n\n function setupModules(address to, bytes memory data) internal {\n require(modules[SENTINEL_MODULES] == address(0), \"GS100\");\n modules[SENTINEL_MODULES] = SENTINEL_MODULES;\n if (to != address(0))\n // Setup has to complete successfully or transaction fails.\n require(execute(to, 0, data, Enum.Operation.DelegateCall, gasleft()), \"GS000\");\n }\n\n /// @dev Allows to add a module to the whitelist.\n /// This can only be done via a Safe transaction.\n /// @notice Enables the module `module` for the Safe.\n /// @param module Module to be whitelisted.\n function enableModule(address module) public authorized {\n // Module address cannot be null or sentinel.\n require(module != address(0) && module != SENTINEL_MODULES, \"GS101\");\n // Module cannot be added twice.\n require(modules[module] == address(0), \"GS102\");\n modules[module] = modules[SENTINEL_MODULES];\n modules[SENTINEL_MODULES] = module;\n emit EnabledModule(module);\n }\n\n /// @dev Allows to remove a module from the whitelist.\n /// This can only be done via a Safe transaction.\n /// @notice Disables the module `module` for the Safe.\n /// @param prevModule Module that pointed to the module to be removed in the linked list\n /// @param module Module to be removed.\n function disableModule(address prevModule, address module) public authorized {\n // Validate module address and check that it corresponds to module index.\n require(module != address(0) && module != SENTINEL_MODULES, \"GS101\");\n require(modules[prevModule] == module, \"GS103\");\n modules[prevModule] = modules[module];\n modules[module] = address(0);\n emit DisabledModule(module);\n }\n\n /// @dev Allows a Module to execute a Safe transaction without any further confirmations.\n /// @param to Destination address of module transaction.\n /// @param value Ether value of module transaction.\n /// @param data Data payload of module transaction.\n /// @param operation Operation type of module transaction.\n function execTransactionFromModule(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation\n ) public virtual returns (bool success) {\n // Only whitelisted modules are allowed.\n require(msg.sender != SENTINEL_MODULES && modules[msg.sender] != address(0), \"GS104\");\n // Execute transaction without further confirmations.\n success = execute(to, value, data, operation, gasleft());\n if (success) emit ExecutionFromModuleSuccess(msg.sender);\n else emit ExecutionFromModuleFailure(msg.sender);\n }\n\n /// @dev Allows a Module to execute a Safe transaction without any further confirmations and return data\n /// @param to Destination address of module transaction.\n /// @param value Ether value of module transaction.\n /// @param data Data payload of module transaction.\n /// @param operation Operation type of module transaction.\n function execTransactionFromModuleReturnData(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation\n ) public returns (bool success, bytes memory returnData) {\n success = execTransactionFromModule(to, value, data, operation);\n // solhint-disable-next-line no-inline-assembly\n assembly {\n // Load free memory location\n let ptr := mload(0x40)\n // We allocate memory for the return data by setting the free memory location to\n // current free memory location + data size + 32 bytes for data size value\n mstore(0x40, add(ptr, add(returndatasize(), 0x20)))\n // Store the size\n mstore(ptr, returndatasize())\n // Store the data\n returndatacopy(add(ptr, 0x20), 0, returndatasize())\n // Point the return data to the correct memory location\n returnData := ptr\n }\n }\n\n /// @dev Returns if an module is enabled\n /// @return True if the module is enabled\n function isModuleEnabled(address module) public view returns (bool) {\n return SENTINEL_MODULES != module && modules[module] != address(0);\n }\n\n /// @dev Returns array of modules.\n /// @param start Start of the page.\n /// @param pageSize Maximum number of modules that should be returned.\n /// @return array Array of modules.\n /// @return next Start of the next page.\n function getModulesPaginated(address start, uint256 pageSize) external view returns (address[] memory array, address next) {\n // Init array with max page size\n array = new address[](pageSize);\n\n // Populate return array\n uint256 moduleCount = 0;\n address currentModule = modules[start];\n while (currentModule != address(0x0) && currentModule != SENTINEL_MODULES && moduleCount < pageSize) {\n array[moduleCount] = currentModule;\n currentModule = modules[currentModule];\n moduleCount++;\n }\n next = currentModule;\n // Set correct size of returned array\n // solhint-disable-next-line no-inline-assembly\n assembly {\n mstore(array, moduleCount)\n }\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/base/OwnerManager.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\nimport \"../common/SelfAuthorized.sol\";\n\n/// @title OwnerManager - Manages a set of owners and a threshold to perform actions.\n/// @author Stefan George - \n/// @author Richard Meissner - \ncontract OwnerManager is SelfAuthorized {\n event AddedOwner(address owner);\n event RemovedOwner(address owner);\n event ChangedThreshold(uint256 threshold);\n\n address internal constant SENTINEL_OWNERS = address(0x1);\n\n mapping(address => address) internal owners;\n uint256 internal ownerCount;\n uint256 internal threshold;\n\n /// @dev Setup function sets initial storage of contract.\n /// @param _owners List of Safe owners.\n /// @param _threshold Number of required confirmations for a Safe transaction.\n function setupOwners(address[] memory _owners, uint256 _threshold) internal {\n // Threshold can only be 0 at initialization.\n // Check ensures that setup function can only be called once.\n require(threshold == 0, \"GS200\");\n // Validate that threshold is smaller than number of added owners.\n require(_threshold <= _owners.length, \"GS201\");\n // There has to be at least one Safe owner.\n require(_threshold >= 1, \"GS202\");\n // Initializing Safe owners.\n address currentOwner = SENTINEL_OWNERS;\n for (uint256 i = 0; i < _owners.length; i++) {\n // Owner address cannot be null.\n address owner = _owners[i];\n require(owner != address(0) && owner != SENTINEL_OWNERS && owner != address(this) && currentOwner != owner, \"GS203\");\n // No duplicate owners allowed.\n require(owners[owner] == address(0), \"GS204\");\n owners[currentOwner] = owner;\n currentOwner = owner;\n }\n owners[currentOwner] = SENTINEL_OWNERS;\n ownerCount = _owners.length;\n threshold = _threshold;\n }\n\n /// @dev Allows to add a new owner to the Safe and update the threshold at the same time.\n /// This can only be done via a Safe transaction.\n /// @notice Adds the owner `owner` to the Safe and updates the threshold to `_threshold`.\n /// @param owner New owner address.\n /// @param _threshold New threshold.\n function addOwnerWithThreshold(address owner, uint256 _threshold) public authorized {\n // Owner address cannot be null, the sentinel or the Safe itself.\n require(owner != address(0) && owner != SENTINEL_OWNERS && owner != address(this), \"GS203\");\n // No duplicate owners allowed.\n require(owners[owner] == address(0), \"GS204\");\n owners[owner] = owners[SENTINEL_OWNERS];\n owners[SENTINEL_OWNERS] = owner;\n ownerCount++;\n emit AddedOwner(owner);\n // Change threshold if threshold was changed.\n if (threshold != _threshold) changeThreshold(_threshold);\n }\n\n /// @dev Allows to remove an owner from the Safe and update the threshold at the same time.\n /// This can only be done via a Safe transaction.\n /// @notice Removes the owner `owner` from the Safe and updates the threshold to `_threshold`.\n /// @param prevOwner Owner that pointed to the owner to be removed in the linked list\n /// @param owner Owner address to be removed.\n /// @param _threshold New threshold.\n function removeOwner(\n address prevOwner,\n address owner,\n uint256 _threshold\n ) public authorized {\n // Only allow to remove an owner, if threshold can still be reached.\n require(ownerCount - 1 >= _threshold, \"GS201\");\n // Validate owner address and check that it corresponds to owner index.\n require(owner != address(0) && owner != SENTINEL_OWNERS, \"GS203\");\n require(owners[prevOwner] == owner, \"GS205\");\n owners[prevOwner] = owners[owner];\n owners[owner] = address(0);\n ownerCount--;\n emit RemovedOwner(owner);\n // Change threshold if threshold was changed.\n if (threshold != _threshold) changeThreshold(_threshold);\n }\n\n /// @dev Allows to swap/replace an owner from the Safe with another address.\n /// This can only be done via a Safe transaction.\n /// @notice Replaces the owner `oldOwner` in the Safe with `newOwner`.\n /// @param prevOwner Owner that pointed to the owner to be replaced in the linked list\n /// @param oldOwner Owner address to be replaced.\n /// @param newOwner New owner address.\n function swapOwner(\n address prevOwner,\n address oldOwner,\n address newOwner\n ) public authorized {\n // Owner address cannot be null, the sentinel or the Safe itself.\n require(newOwner != address(0) && newOwner != SENTINEL_OWNERS && newOwner != address(this), \"GS203\");\n // No duplicate owners allowed.\n require(owners[newOwner] == address(0), \"GS204\");\n // Validate oldOwner address and check that it corresponds to owner index.\n require(oldOwner != address(0) && oldOwner != SENTINEL_OWNERS, \"GS203\");\n require(owners[prevOwner] == oldOwner, \"GS205\");\n owners[newOwner] = owners[oldOwner];\n owners[prevOwner] = newOwner;\n owners[oldOwner] = address(0);\n emit RemovedOwner(oldOwner);\n emit AddedOwner(newOwner);\n }\n\n /// @dev Allows to update the number of required confirmations by Safe owners.\n /// This can only be done via a Safe transaction.\n /// @notice Changes the threshold of the Safe to `_threshold`.\n /// @param _threshold New threshold.\n function changeThreshold(uint256 _threshold) public authorized {\n // Validate that threshold is smaller than number of owners.\n require(_threshold <= ownerCount, \"GS201\");\n // There has to be at least one Safe owner.\n require(_threshold >= 1, \"GS202\");\n threshold = _threshold;\n emit ChangedThreshold(threshold);\n }\n\n function getThreshold() public view returns (uint256) {\n return threshold;\n }\n\n function isOwner(address owner) public view returns (bool) {\n return owner != SENTINEL_OWNERS && owners[owner] != address(0);\n }\n\n /// @dev Returns array of owners.\n /// @return Array of Safe owners.\n function getOwners() public view returns (address[] memory) {\n address[] memory array = new address[](ownerCount);\n\n // populate return array\n uint256 index = 0;\n address currentOwner = owners[SENTINEL_OWNERS];\n while (currentOwner != SENTINEL_OWNERS) {\n array[index] = currentOwner;\n currentOwner = owners[currentOwner];\n index++;\n }\n return array;\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/common/Enum.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\n/// @title Enum - Collection of enums\n/// @author Richard Meissner - \ncontract Enum {\n enum Operation {Call, DelegateCall}\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/common/EtherPaymentFallback.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\n/// @title EtherPaymentFallback - A contract that has a fallback to accept ether payments\n/// @author Richard Meissner - \ncontract EtherPaymentFallback {\n event SafeReceived(address indexed sender, uint256 value);\n\n /// @dev Fallback function accepts Ether transactions.\n receive() external payable {\n emit SafeReceived(msg.sender, msg.value);\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/common/SecuredTokenTransfer.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\n/// @title SecuredTokenTransfer - Secure token transfer\n/// @author Richard Meissner - \ncontract SecuredTokenTransfer {\n /// @dev Transfers a token and returns if it was a success\n /// @param token Token that should be transferred\n /// @param receiver Receiver to whom the token should be transferred\n /// @param amount The amount of tokens that should be transferred\n function transferToken(\n address token,\n address receiver,\n uint256 amount\n ) internal returns (bool transferred) {\n // 0xa9059cbb - keccack(\"transfer(address,uint256)\")\n bytes memory data = abi.encodeWithSelector(0xa9059cbb, receiver, amount);\n // solhint-disable-next-line no-inline-assembly\n assembly {\n // We write the return value to scratch space.\n // See https://docs.soliditylang.org/en/v0.7.6/internals/layout_in_memory.html#layout-in-memory\n let success := call(sub(gas(), 10000), token, 0, add(data, 0x20), mload(data), 0, 0x20)\n switch returndatasize()\n case 0 {\n transferred := success\n }\n case 0x20 {\n transferred := iszero(or(iszero(success), iszero(mload(0))))\n }\n default {\n transferred := 0\n }\n }\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/common/SelfAuthorized.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\n/// @title SelfAuthorized - authorizes current contract to perform actions\n/// @author Richard Meissner - \ncontract SelfAuthorized {\n function requireSelfCall() private view {\n require(msg.sender == address(this), \"GS031\");\n }\n\n modifier authorized() {\n // This is a function call as it minimized the bytecode size\n requireSelfCall();\n _;\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/common/SignatureDecoder.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\n/// @title SignatureDecoder - Decodes signatures that a encoded as bytes\n/// @author Richard Meissner - \ncontract SignatureDecoder {\n /// @dev divides bytes signature into `uint8 v, bytes32 r, bytes32 s`.\n /// @notice Make sure to peform a bounds check for @param pos, to avoid out of bounds access on @param signatures\n /// @param pos which signature to read. A prior bounds check of this parameter should be performed, to avoid out of bounds access\n /// @param signatures concatenated rsv signatures\n function signatureSplit(bytes memory signatures, uint256 pos)\n internal\n pure\n returns (\n uint8 v,\n bytes32 r,\n bytes32 s\n )\n {\n // The signature format is a compact form of:\n // {bytes32 r}{bytes32 s}{uint8 v}\n // Compact means, uint8 is not padded to 32 bytes.\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let signaturePos := mul(0x41, pos)\n r := mload(add(signatures, add(signaturePos, 0x20)))\n s := mload(add(signatures, add(signaturePos, 0x40)))\n // Here we are loading the last 32 bytes, including 31 bytes\n // of 's'. There is no 'mload8' to do this.\n //\n // 'byte' is not working due to the Solidity parser, so lets\n // use the second best option, 'and'\n v := and(mload(add(signatures, add(signaturePos, 0x41))), 0xff)\n }\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/common/Singleton.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\n/// @title Singleton - Base for singleton contracts (should always be first super contract)\n/// This contract is tightly coupled to our proxy contract (see `proxies/GnosisSafeProxy.sol`)\n/// @author Richard Meissner - \ncontract Singleton {\n // singleton always needs to be first declared variable, to ensure that it is at the same location as in the Proxy contract.\n // It should also always be ensured that the address is stored alone (uses a full word)\n address private singleton;\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/common/StorageAccessible.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\n/// @title StorageAccessible - generic base contract that allows callers to access all internal storage.\n/// @notice See https://github.com/gnosis/util-contracts/blob/bb5fe5fb5df6d8400998094fb1b32a178a47c3a1/contracts/StorageAccessible.sol\ncontract StorageAccessible {\n /**\n * @dev Reads `length` bytes of storage in the currents contract\n * @param offset - the offset in the current contract's storage in words to start reading from\n * @param length - the number of words (32 bytes) of data to read\n * @return the bytes that were read.\n */\n function getStorageAt(uint256 offset, uint256 length) public view returns (bytes memory) {\n bytes memory result = new bytes(length * 32);\n for (uint256 index = 0; index < length; index++) {\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let word := sload(add(offset, index))\n mstore(add(add(result, 0x20), mul(index, 0x20)), word)\n }\n }\n return result;\n }\n\n /**\n * @dev Performs a delegetecall on a targetContract in the context of self.\n * Internally reverts execution to avoid side effects (making it static).\n *\n * This method reverts with data equal to `abi.encode(bool(success), bytes(response))`.\n * Specifically, the `returndata` after a call to this method will be:\n * `success:bool || response.length:uint256 || response:bytes`.\n *\n * @param targetContract Address of the contract containing the code to execute.\n * @param calldataPayload Calldata that should be sent to the target contract (encoded method name and arguments).\n */\n function simulateAndRevert(address targetContract, bytes memory calldataPayload) external {\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let success := delegatecall(gas(), targetContract, add(calldataPayload, 0x20), mload(calldataPayload), 0, 0)\n\n mstore(0x00, success)\n mstore(0x20, returndatasize())\n returndatacopy(0x40, 0, returndatasize())\n revert(0, add(returndatasize(), 0x40))\n }\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/external/GnosisSafeMath.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\n/**\n * @title GnosisSafeMath\n * @dev Math operations with safety checks that revert on error\n * Renamed from SafeMath to GnosisSafeMath to avoid conflicts\n * TODO: remove once open zeppelin update to solc 0.5.0\n */\nlibrary GnosisSafeMath {\n /**\n * @dev Multiplies two numbers, reverts on overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\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-solidity/pull/522\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n require(c / a == b);\n\n return c;\n }\n\n /**\n * @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b <= a);\n uint256 c = a - b;\n\n return c;\n }\n\n /**\n * @dev Adds two numbers, reverts on overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a);\n\n return c;\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" + }, + "@gnosis.pm/safe-contracts/contracts/GnosisSafe.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"./base/ModuleManager.sol\";\nimport \"./base/OwnerManager.sol\";\nimport \"./base/FallbackManager.sol\";\nimport \"./base/GuardManager.sol\";\nimport \"./common/EtherPaymentFallback.sol\";\nimport \"./common/Singleton.sol\";\nimport \"./common/SignatureDecoder.sol\";\nimport \"./common/SecuredTokenTransfer.sol\";\nimport \"./common/StorageAccessible.sol\";\nimport \"./interfaces/ISignatureValidator.sol\";\nimport \"./external/GnosisSafeMath.sol\";\n\n/// @title Gnosis Safe - A multisignature wallet with support for confirmations using signed messages based on ERC191.\n/// @author Stefan George - \n/// @author Richard Meissner - \ncontract GnosisSafe is\n EtherPaymentFallback,\n Singleton,\n ModuleManager,\n OwnerManager,\n SignatureDecoder,\n SecuredTokenTransfer,\n ISignatureValidatorConstants,\n FallbackManager,\n StorageAccessible,\n GuardManager\n{\n using GnosisSafeMath for uint256;\n\n string public constant VERSION = \"1.3.0\";\n\n // keccak256(\n // \"EIP712Domain(uint256 chainId,address verifyingContract)\"\n // );\n bytes32 private constant DOMAIN_SEPARATOR_TYPEHASH = 0x47e79534a245952e8b16893a336b85a3d9ea9fa8c573f3d803afb92a79469218;\n\n // keccak256(\n // \"SafeTx(address to,uint256 value,bytes data,uint8 operation,uint256 safeTxGas,uint256 baseGas,uint256 gasPrice,address gasToken,address refundReceiver,uint256 nonce)\"\n // );\n bytes32 private constant SAFE_TX_TYPEHASH = 0xbb8310d486368db6bd6f849402fdd73ad53d316b5a4b2644ad6efe0f941286d8;\n\n event SafeSetup(address indexed initiator, address[] owners, uint256 threshold, address initializer, address fallbackHandler);\n event ApproveHash(bytes32 indexed approvedHash, address indexed owner);\n event SignMsg(bytes32 indexed msgHash);\n event ExecutionFailure(bytes32 txHash, uint256 payment);\n event ExecutionSuccess(bytes32 txHash, uint256 payment);\n\n uint256 public nonce;\n bytes32 private _deprecatedDomainSeparator;\n // Mapping to keep track of all message hashes that have been approve by ALL REQUIRED owners\n mapping(bytes32 => uint256) public signedMessages;\n // Mapping to keep track of all hashes (message or transaction) that have been approve by ANY owners\n mapping(address => mapping(bytes32 => uint256)) public approvedHashes;\n\n // This constructor ensures that this contract can only be used as a master copy for Proxy contracts\n constructor() {\n // By setting the threshold it is not possible to call setup anymore,\n // so we create a Safe with 0 owners and threshold 1.\n // This is an unusable Safe, perfect for the singleton\n threshold = 1;\n }\n\n /// @dev Setup function sets initial storage of contract.\n /// @param _owners List of Safe owners.\n /// @param _threshold Number of required confirmations for a Safe transaction.\n /// @param to Contract address for optional delegate call.\n /// @param data Data payload for optional delegate call.\n /// @param fallbackHandler Handler for fallback calls to this contract\n /// @param paymentToken Token that should be used for the payment (0 is ETH)\n /// @param payment Value that should be paid\n /// @param paymentReceiver Adddress that should receive the payment (or 0 if tx.origin)\n function setup(\n address[] calldata _owners,\n uint256 _threshold,\n address to,\n bytes calldata data,\n address fallbackHandler,\n address paymentToken,\n uint256 payment,\n address payable paymentReceiver\n ) external {\n // setupOwners checks if the Threshold is already set, therefore preventing that this method is called twice\n setupOwners(_owners, _threshold);\n if (fallbackHandler != address(0)) internalSetFallbackHandler(fallbackHandler);\n // As setupOwners can only be called if the contract has not been initialized we don't need a check for setupModules\n setupModules(to, data);\n\n if (payment > 0) {\n // To avoid running into issues with EIP-170 we reuse the handlePayment function (to avoid adjusting code of that has been verified we do not adjust the method itself)\n // baseGas = 0, gasPrice = 1 and gas = payment => amount = (payment + 0) * 1 = payment\n handlePayment(payment, 0, 1, paymentToken, paymentReceiver);\n }\n emit SafeSetup(msg.sender, _owners, _threshold, to, fallbackHandler);\n }\n\n /// @dev Allows to execute a Safe transaction confirmed by required number of owners and then pays the account that submitted the transaction.\n /// Note: The fees are always transferred, even if the user transaction fails.\n /// @param to Destination address of Safe transaction.\n /// @param value Ether value of Safe transaction.\n /// @param data Data payload of Safe transaction.\n /// @param operation Operation type of Safe transaction.\n /// @param safeTxGas Gas that should be used for the Safe transaction.\n /// @param baseGas Gas costs that are independent of the transaction execution(e.g. base transaction fee, signature check, payment of the refund)\n /// @param gasPrice Gas price that should be used for the payment calculation.\n /// @param gasToken Token address (or 0 if ETH) that is used for the payment.\n /// @param refundReceiver Address of receiver of gas payment (or 0 if tx.origin).\n /// @param signatures Packed signature data ({bytes32 r}{bytes32 s}{uint8 v})\n function execTransaction(\n address to,\n uint256 value,\n bytes calldata data,\n Enum.Operation operation,\n uint256 safeTxGas,\n uint256 baseGas,\n uint256 gasPrice,\n address gasToken,\n address payable refundReceiver,\n bytes memory signatures\n ) public payable virtual returns (bool success) {\n bytes32 txHash;\n // Use scope here to limit variable lifetime and prevent `stack too deep` errors\n {\n bytes memory txHashData =\n encodeTransactionData(\n // Transaction info\n to,\n value,\n data,\n operation,\n safeTxGas,\n // Payment info\n baseGas,\n gasPrice,\n gasToken,\n refundReceiver,\n // Signature info\n nonce\n );\n // Increase nonce and execute transaction.\n nonce++;\n txHash = keccak256(txHashData);\n checkSignatures(txHash, txHashData, signatures);\n }\n address guard = getGuard();\n {\n if (guard != address(0)) {\n Guard(guard).checkTransaction(\n // Transaction info\n to,\n value,\n data,\n operation,\n safeTxGas,\n // Payment info\n baseGas,\n gasPrice,\n gasToken,\n refundReceiver,\n // Signature info\n signatures,\n msg.sender\n );\n }\n }\n // We require some gas to emit the events (at least 2500) after the execution and some to perform code until the execution (500)\n // We also include the 1/64 in the check that is not send along with a call to counteract potential shortings because of EIP-150\n require(gasleft() >= ((safeTxGas * 64) / 63).max(safeTxGas + 2500) + 500, \"GS010\");\n // Use scope here to limit variable lifetime and prevent `stack too deep` errors\n {\n uint256 gasUsed = gasleft();\n // If the gasPrice is 0 we assume that nearly all available gas can be used (it is always more than safeTxGas)\n // We only substract 2500 (compared to the 3000 before) to ensure that the amount passed is still higher than safeTxGas\n success = execute(to, value, data, operation, gasPrice == 0 ? (gasleft() - 2500) : safeTxGas);\n gasUsed = gasUsed.sub(gasleft());\n // If no safeTxGas and no gasPrice was set (e.g. both are 0), then the internal tx is required to be successful\n // This makes it possible to use `estimateGas` without issues, as it searches for the minimum gas where the tx doesn't revert\n require(success || safeTxGas != 0 || gasPrice != 0, \"GS013\");\n // We transfer the calculated tx costs to the tx.origin to avoid sending it to intermediate contracts that have made calls\n uint256 payment = 0;\n if (gasPrice > 0) {\n payment = handlePayment(gasUsed, baseGas, gasPrice, gasToken, refundReceiver);\n }\n if (success) emit ExecutionSuccess(txHash, payment);\n else emit ExecutionFailure(txHash, payment);\n }\n {\n if (guard != address(0)) {\n Guard(guard).checkAfterExecution(txHash, success);\n }\n }\n }\n\n function handlePayment(\n uint256 gasUsed,\n uint256 baseGas,\n uint256 gasPrice,\n address gasToken,\n address payable refundReceiver\n ) private returns (uint256 payment) {\n // solhint-disable-next-line avoid-tx-origin\n address payable receiver = refundReceiver == address(0) ? payable(tx.origin) : refundReceiver;\n if (gasToken == address(0)) {\n // For ETH we will only adjust the gas price to not be higher than the actual used gas price\n payment = gasUsed.add(baseGas).mul(gasPrice < tx.gasprice ? gasPrice : tx.gasprice);\n require(receiver.send(payment), \"GS011\");\n } else {\n payment = gasUsed.add(baseGas).mul(gasPrice);\n require(transferToken(gasToken, receiver, payment), \"GS012\");\n }\n }\n\n /**\n * @dev Checks whether the signature provided is valid for the provided data, hash. Will revert otherwise.\n * @param dataHash Hash of the data (could be either a message hash or transaction hash)\n * @param data That should be signed (this is passed to an external validator contract)\n * @param signatures Signature data that should be verified. Can be ECDSA signature, contract signature (EIP-1271) or approved hash.\n */\n function checkSignatures(\n bytes32 dataHash,\n bytes memory data,\n bytes memory signatures\n ) public view {\n // Load threshold to avoid multiple storage loads\n uint256 _threshold = threshold;\n // Check that a threshold is set\n require(_threshold > 0, \"GS001\");\n checkNSignatures(dataHash, data, signatures, _threshold);\n }\n\n /**\n * @dev Checks whether the signature provided is valid for the provided data, hash. Will revert otherwise.\n * @param dataHash Hash of the data (could be either a message hash or transaction hash)\n * @param data That should be signed (this is passed to an external validator contract)\n * @param signatures Signature data that should be verified. Can be ECDSA signature, contract signature (EIP-1271) or approved hash.\n * @param requiredSignatures Amount of required valid signatures.\n */\n function checkNSignatures(\n bytes32 dataHash,\n bytes memory data,\n bytes memory signatures,\n uint256 requiredSignatures\n ) public view {\n // Check that the provided signature data is not too short\n require(signatures.length >= requiredSignatures.mul(65), \"GS020\");\n // There cannot be an owner with address 0.\n address lastOwner = address(0);\n address currentOwner;\n uint8 v;\n bytes32 r;\n bytes32 s;\n uint256 i;\n for (i = 0; i < requiredSignatures; i++) {\n (v, r, s) = signatureSplit(signatures, i);\n if (v == 0) {\n // If v is 0 then it is a contract signature\n // When handling contract signatures the address of the contract is encoded into r\n currentOwner = address(uint160(uint256(r)));\n\n // Check that signature data pointer (s) is not pointing inside the static part of the signatures bytes\n // This check is not completely accurate, since it is possible that more signatures than the threshold are send.\n // Here we only check that the pointer is not pointing inside the part that is being processed\n require(uint256(s) >= requiredSignatures.mul(65), \"GS021\");\n\n // Check that signature data pointer (s) is in bounds (points to the length of data -> 32 bytes)\n require(uint256(s).add(32) <= signatures.length, \"GS022\");\n\n // Check if the contract signature is in bounds: start of data is s + 32 and end is start + signature length\n uint256 contractSignatureLen;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n contractSignatureLen := mload(add(add(signatures, s), 0x20))\n }\n require(uint256(s).add(32).add(contractSignatureLen) <= signatures.length, \"GS023\");\n\n // Check signature\n bytes memory contractSignature;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n // The signature data for contract signatures is appended to the concatenated signatures and the offset is stored in s\n contractSignature := add(add(signatures, s), 0x20)\n }\n require(ISignatureValidator(currentOwner).isValidSignature(data, contractSignature) == EIP1271_MAGIC_VALUE, \"GS024\");\n } else if (v == 1) {\n // If v is 1 then it is an approved hash\n // When handling approved hashes the address of the approver is encoded into r\n currentOwner = address(uint160(uint256(r)));\n // Hashes are automatically approved by the sender of the message or when they have been pre-approved via a separate transaction\n require(msg.sender == currentOwner || approvedHashes[currentOwner][dataHash] != 0, \"GS025\");\n } else if (v > 30) {\n // If v > 30 then default va (27,28) has been adjusted for eth_sign flow\n // To support eth_sign and similar we adjust v and hash the messageHash with the Ethereum message prefix before applying ecrecover\n currentOwner = ecrecover(keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", dataHash)), v - 4, r, s);\n } else {\n // Default is the ecrecover flow with the provided data hash\n // Use ecrecover with the messageHash for EOA signatures\n currentOwner = ecrecover(dataHash, v, r, s);\n }\n require(currentOwner > lastOwner && owners[currentOwner] != address(0) && currentOwner != SENTINEL_OWNERS, \"GS026\");\n lastOwner = currentOwner;\n }\n }\n\n /// @dev Allows to estimate a Safe transaction.\n /// This method is only meant for estimation purpose, therefore the call will always revert and encode the result in the revert data.\n /// Since the `estimateGas` function includes refunds, call this method to get an estimated of the costs that are deducted from the safe with `execTransaction`\n /// @param to Destination address of Safe transaction.\n /// @param value Ether value of Safe transaction.\n /// @param data Data payload of Safe transaction.\n /// @param operation Operation type of Safe transaction.\n /// @return Estimate without refunds and overhead fees (base transaction and payload data gas costs).\n /// @notice Deprecated in favor of common/StorageAccessible.sol and will be removed in next version.\n function requiredTxGas(\n address to,\n uint256 value,\n bytes calldata data,\n Enum.Operation operation\n ) external returns (uint256) {\n uint256 startGas = gasleft();\n // We don't provide an error message here, as we use it to return the estimate\n require(execute(to, value, data, operation, gasleft()));\n uint256 requiredGas = startGas - gasleft();\n // Convert response to string and return via error message\n revert(string(abi.encodePacked(requiredGas)));\n }\n\n /**\n * @dev Marks a hash as approved. This can be used to validate a hash that is used by a signature.\n * @param hashToApprove The hash that should be marked as approved for signatures that are verified by this contract.\n */\n function approveHash(bytes32 hashToApprove) external {\n require(owners[msg.sender] != address(0), \"GS030\");\n approvedHashes[msg.sender][hashToApprove] = 1;\n emit ApproveHash(hashToApprove, msg.sender);\n }\n\n /// @dev Returns the chain id used by this contract.\n function getChainId() public view returns (uint256) {\n uint256 id;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n id := chainid()\n }\n return id;\n }\n\n function domainSeparator() public view returns (bytes32) {\n return keccak256(abi.encode(DOMAIN_SEPARATOR_TYPEHASH, getChainId(), this));\n }\n\n /// @dev Returns the bytes that are hashed to be signed by owners.\n /// @param to Destination address.\n /// @param value Ether value.\n /// @param data Data payload.\n /// @param operation Operation type.\n /// @param safeTxGas Gas that should be used for the safe transaction.\n /// @param baseGas Gas costs for that are independent of the transaction execution(e.g. base transaction fee, signature check, payment of the refund)\n /// @param gasPrice Maximum gas price that should be used for this transaction.\n /// @param gasToken Token address (or 0 if ETH) that is used for the payment.\n /// @param refundReceiver Address of receiver of gas payment (or 0 if tx.origin).\n /// @param _nonce Transaction nonce.\n /// @return Transaction hash bytes.\n function encodeTransactionData(\n address to,\n uint256 value,\n bytes calldata data,\n Enum.Operation operation,\n uint256 safeTxGas,\n uint256 baseGas,\n uint256 gasPrice,\n address gasToken,\n address refundReceiver,\n uint256 _nonce\n ) public view returns (bytes memory) {\n bytes32 safeTxHash =\n keccak256(\n abi.encode(\n SAFE_TX_TYPEHASH,\n to,\n value,\n keccak256(data),\n operation,\n safeTxGas,\n baseGas,\n gasPrice,\n gasToken,\n refundReceiver,\n _nonce\n )\n );\n return abi.encodePacked(bytes1(0x19), bytes1(0x01), domainSeparator(), safeTxHash);\n }\n\n /// @dev Returns hash to be signed by owners.\n /// @param to Destination address.\n /// @param value Ether value.\n /// @param data Data payload.\n /// @param operation Operation type.\n /// @param safeTxGas Fas that should be used for the safe transaction.\n /// @param baseGas Gas costs for data used to trigger the safe transaction.\n /// @param gasPrice Maximum gas price that should be used for this transaction.\n /// @param gasToken Token address (or 0 if ETH) that is used for the payment.\n /// @param refundReceiver Address of receiver of gas payment (or 0 if tx.origin).\n /// @param _nonce Transaction nonce.\n /// @return Transaction hash.\n function getTransactionHash(\n address to,\n uint256 value,\n bytes calldata data,\n Enum.Operation operation,\n uint256 safeTxGas,\n uint256 baseGas,\n uint256 gasPrice,\n address gasToken,\n address refundReceiver,\n uint256 _nonce\n ) public view returns (bytes32) {\n return keccak256(encodeTransactionData(to, value, data, operation, safeTxGas, baseGas, gasPrice, gasToken, refundReceiver, _nonce));\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/GnosisSafeL2.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"./GnosisSafe.sol\";\n\n/// @title Gnosis Safe - A multisignature wallet with support for confirmations using signed messages based on ERC191.\n/// @author Stefan George - \n/// @author Richard Meissner - \ncontract GnosisSafeL2 is GnosisSafe {\n event SafeMultiSigTransaction(\n address to,\n uint256 value,\n bytes data,\n Enum.Operation operation,\n uint256 safeTxGas,\n uint256 baseGas,\n uint256 gasPrice,\n address gasToken,\n address payable refundReceiver,\n bytes signatures,\n // We combine nonce, sender and threshold into one to avoid stack too deep\n // Dev note: additionalInfo should not contain `bytes`, as this complicates decoding\n bytes additionalInfo\n );\n\n event SafeModuleTransaction(address module, address to, uint256 value, bytes data, Enum.Operation operation);\n\n /// @dev Allows to execute a Safe transaction confirmed by required number of owners and then pays the account that submitted the transaction.\n /// Note: The fees are always transferred, even if the user transaction fails.\n /// @param to Destination address of Safe transaction.\n /// @param value Ether value of Safe transaction.\n /// @param data Data payload of Safe transaction.\n /// @param operation Operation type of Safe transaction.\n /// @param safeTxGas Gas that should be used for the Safe transaction.\n /// @param baseGas Gas costs that are independent of the transaction execution(e.g. base transaction fee, signature check, payment of the refund)\n /// @param gasPrice Gas price that should be used for the payment calculation.\n /// @param gasToken Token address (or 0 if ETH) that is used for the payment.\n /// @param refundReceiver Address of receiver of gas payment (or 0 if tx.origin).\n /// @param signatures Packed signature data ({bytes32 r}{bytes32 s}{uint8 v})\n function execTransaction(\n address to,\n uint256 value,\n bytes calldata data,\n Enum.Operation operation,\n uint256 safeTxGas,\n uint256 baseGas,\n uint256 gasPrice,\n address gasToken,\n address payable refundReceiver,\n bytes memory signatures\n ) public payable override returns (bool) {\n bytes memory additionalInfo;\n {\n additionalInfo = abi.encode(nonce, msg.sender, threshold);\n }\n emit SafeMultiSigTransaction(\n to,\n value,\n data,\n operation,\n safeTxGas,\n baseGas,\n gasPrice,\n gasToken,\n refundReceiver,\n signatures,\n additionalInfo\n );\n return super.execTransaction(to, value, data, operation, safeTxGas, baseGas, gasPrice, gasToken, refundReceiver, signatures);\n }\n\n /// @dev Allows a Module to execute a Safe transaction without any further confirmations.\n /// @param to Destination address of module transaction.\n /// @param value Ether value of module transaction.\n /// @param data Data payload of module transaction.\n /// @param operation Operation type of module transaction.\n function execTransactionFromModule(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation\n ) public override returns (bool success) {\n emit SafeModuleTransaction(msg.sender, to, value, data, operation);\n success = super.execTransactionFromModule(to, value, data, operation);\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/interfaces/ISignatureValidator.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\ncontract ISignatureValidatorConstants {\n // bytes4(keccak256(\"isValidSignature(bytes,bytes)\")\n bytes4 internal constant EIP1271_MAGIC_VALUE = 0x20c13b0b;\n}\n\nabstract contract ISignatureValidator is ISignatureValidatorConstants {\n /**\n * @dev Should return whether the signature provided is valid for the provided data\n * @param _data Arbitrary length data signed on the behalf of address(this)\n * @param _signature Signature byte array associated with _data\n *\n * MUST return the bytes4 magic value 0x20c13b0b when function passes.\n * MUST NOT modify state (using STATICCALL for solc < 0.5, view modifier for solc > 0.5)\n * MUST allow external calls\n */\n function isValidSignature(bytes memory _data, bytes memory _signature) public view virtual returns (bytes4);\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/libraries/MultiSendCallOnly.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\n/// @title Multi Send Call Only - Allows to batch multiple transactions into one, but only calls\n/// @author Stefan George - \n/// @author Richard Meissner - \n/// @notice The guard logic is not required here as this contract doesn't support nested delegate calls\ncontract MultiSendCallOnly {\n /// @dev Sends multiple transactions and reverts all if one fails.\n /// @param transactions Encoded transactions. Each transaction is encoded as a packed bytes of\n /// operation has to be uint8(0) in this version (=> 1 byte),\n /// to as a address (=> 20 bytes),\n /// value as a uint256 (=> 32 bytes),\n /// data length as a uint256 (=> 32 bytes),\n /// data as bytes.\n /// see abi.encodePacked for more information on packed encoding\n /// @notice The code is for most part the same as the normal MultiSend (to keep compatibility),\n /// but reverts if a transaction tries to use a delegatecall.\n /// @notice This method is payable as delegatecalls keep the msg.value from the previous call\n /// If the calling method (e.g. execTransaction) received ETH this would revert otherwise\n function multiSend(bytes memory transactions) public payable {\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let length := mload(transactions)\n let i := 0x20\n for {\n // Pre block is not used in \"while mode\"\n } lt(i, length) {\n // Post block is not used in \"while mode\"\n } {\n // First byte of the data is the operation.\n // We shift by 248 bits (256 - 8 [operation byte]) it right since mload will always load 32 bytes (a word).\n // This will also zero out unused data.\n let operation := shr(0xf8, mload(add(transactions, i)))\n // We offset the load address by 1 byte (operation byte)\n // We shift it right by 96 bits (256 - 160 [20 address bytes]) to right-align the data and zero out unused data.\n let to := shr(0x60, mload(add(transactions, add(i, 0x01))))\n // We offset the load address by 21 byte (operation byte + 20 address bytes)\n let value := mload(add(transactions, add(i, 0x15)))\n // We offset the load address by 53 byte (operation byte + 20 address bytes + 32 value bytes)\n let dataLength := mload(add(transactions, add(i, 0x35)))\n // We offset the load address by 85 byte (operation byte + 20 address bytes + 32 value bytes + 32 data length bytes)\n let data := add(transactions, add(i, 0x55))\n let success := 0\n switch operation\n case 0 {\n success := call(gas(), to, value, data, dataLength, 0, 0)\n }\n // This version does not allow delegatecalls\n case 1 {\n revert(0, 0)\n }\n if eq(success, 0) {\n revert(0, 0)\n }\n // Next entry starts at 85 byte + data length\n i := add(i, add(0x55, dataLength))\n }\n }\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/proxies/GnosisSafeProxy.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\n/// @title IProxy - Helper interface to access masterCopy of the Proxy on-chain\n/// @author Richard Meissner - \ninterface IProxy {\n function masterCopy() external view returns (address);\n}\n\n/// @title GnosisSafeProxy - Generic proxy contract allows to execute all transactions applying the code of a master contract.\n/// @author Stefan George - \n/// @author Richard Meissner - \ncontract GnosisSafeProxy {\n // 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.\n // To reduce deployment costs this variable is internal and needs to be retrieved via `getStorageAt`\n address internal singleton;\n\n /// @dev Constructor function sets address of singleton contract.\n /// @param _singleton Singleton address.\n constructor(address _singleton) {\n require(_singleton != address(0), \"Invalid singleton address provided\");\n singleton = _singleton;\n }\n\n /// @dev Fallback function forwards all transactions and returns all received return data.\n fallback() external payable {\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let _singleton := and(sload(0), 0xffffffffffffffffffffffffffffffffffffffff)\n // 0xa619486e == keccak(\"masterCopy()\"). The value is right padded to 32-bytes with 0s\n if eq(calldataload(0), 0xa619486e00000000000000000000000000000000000000000000000000000000) {\n mstore(0, _singleton)\n return(0, 0x20)\n }\n calldatacopy(0, 0, calldatasize())\n let success := delegatecall(gas(), _singleton, 0, calldatasize(), 0, 0)\n returndatacopy(0, 0, returndatasize())\n if eq(success, 0) {\n revert(0, returndatasize())\n }\n return(0, returndatasize())\n }\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/proxies/GnosisSafeProxyFactory.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"./GnosisSafeProxy.sol\";\nimport \"./IProxyCreationCallback.sol\";\n\n/// @title Proxy Factory - Allows to create new proxy contact and execute a message call to the new proxy within one transaction.\n/// @author Stefan George - \ncontract GnosisSafeProxyFactory {\n event ProxyCreation(GnosisSafeProxy proxy, address singleton);\n\n /// @dev Allows to create new proxy contact and execute a message call to the new proxy within one transaction.\n /// @param singleton Address of singleton contract.\n /// @param data Payload for message call sent to new proxy contract.\n function createProxy(address singleton, bytes memory data) public returns (GnosisSafeProxy proxy) {\n proxy = new GnosisSafeProxy(singleton);\n if (data.length > 0)\n // solhint-disable-next-line no-inline-assembly\n assembly {\n if eq(call(gas(), proxy, 0, add(data, 0x20), mload(data), 0, 0), 0) {\n revert(0, 0)\n }\n }\n emit ProxyCreation(proxy, singleton);\n }\n\n /// @dev Allows to retrieve the runtime code of a deployed Proxy. This can be used to check that the expected Proxy was deployed.\n function proxyRuntimeCode() public pure returns (bytes memory) {\n return type(GnosisSafeProxy).runtimeCode;\n }\n\n /// @dev Allows to retrieve the creation code used for the Proxy deployment. With this it is easily possible to calculate predicted address.\n function proxyCreationCode() public pure returns (bytes memory) {\n return type(GnosisSafeProxy).creationCode;\n }\n\n /// @dev Allows to create new proxy contact using CREATE2 but it doesn't run the initializer.\n /// This method is only meant as an utility to be called from other methods\n /// @param _singleton Address of singleton contract.\n /// @param initializer Payload for message call sent to new proxy contract.\n /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract.\n function deployProxyWithNonce(\n address _singleton,\n bytes memory initializer,\n uint256 saltNonce\n ) internal returns (GnosisSafeProxy proxy) {\n // If the initializer changes the proxy address should change too. Hashing the initializer data is cheaper than just concatinating it\n bytes32 salt = keccak256(abi.encodePacked(keccak256(initializer), saltNonce));\n bytes memory deploymentData = abi.encodePacked(type(GnosisSafeProxy).creationCode, uint256(uint160(_singleton)));\n // solhint-disable-next-line no-inline-assembly\n assembly {\n proxy := create2(0x0, add(0x20, deploymentData), mload(deploymentData), salt)\n }\n require(address(proxy) != address(0), \"Create2 call failed\");\n }\n\n /// @dev Allows to create new proxy contact and execute a message call to the new proxy within one transaction.\n /// @param _singleton Address of singleton contract.\n /// @param initializer Payload for message call sent to new proxy contract.\n /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract.\n function createProxyWithNonce(\n address _singleton,\n bytes memory initializer,\n uint256 saltNonce\n ) public returns (GnosisSafeProxy proxy) {\n proxy = deployProxyWithNonce(_singleton, initializer, saltNonce);\n if (initializer.length > 0)\n // solhint-disable-next-line no-inline-assembly\n assembly {\n if eq(call(gas(), proxy, 0, add(initializer, 0x20), mload(initializer), 0, 0), 0) {\n revert(0, 0)\n }\n }\n emit ProxyCreation(proxy, _singleton);\n }\n\n /// @dev Allows to create new proxy contact, execute a message call to the new proxy and call a specified callback within one transaction\n /// @param _singleton Address of singleton contract.\n /// @param initializer Payload for message call sent to new proxy contract.\n /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract.\n /// @param callback Callback that will be invoced after the new proxy contract has been successfully deployed and initialized.\n function createProxyWithCallback(\n address _singleton,\n bytes memory initializer,\n uint256 saltNonce,\n IProxyCreationCallback callback\n ) public returns (GnosisSafeProxy proxy) {\n uint256 saltNonceWithCallback = uint256(keccak256(abi.encodePacked(saltNonce, callback)));\n proxy = createProxyWithNonce(_singleton, initializer, saltNonceWithCallback);\n if (address(callback) != address(0)) callback.proxyCreated(proxy, _singleton, initializer, saltNonce);\n }\n\n /// @dev Allows to get the address for a new proxy contact created via `createProxyWithNonce`\n /// This method is only meant for address calculation purpose when you use an initializer that would revert,\n /// therefore the response is returned with a revert. When calling this method set `from` to the address of the proxy factory.\n /// @param _singleton Address of singleton contract.\n /// @param initializer Payload for message call sent to new proxy contract.\n /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract.\n function calculateCreateProxyWithNonceAddress(\n address _singleton,\n bytes calldata initializer,\n uint256 saltNonce\n ) external returns (GnosisSafeProxy proxy) {\n proxy = deployProxyWithNonce(_singleton, initializer, saltNonce);\n revert(string(abi.encodePacked(proxy)));\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/proxies/IProxyCreationCallback.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\nimport \"./GnosisSafeProxy.sol\";\n\ninterface IProxyCreationCallback {\n function proxyCreated(\n GnosisSafeProxy proxy,\n address _singleton,\n bytes calldata initializer,\n uint256 saltNonce\n ) external;\n}\n" + }, + "@gnosis.pm/zodiac/contracts/core/Module.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\n\n/// @title Module Interface - A contract that can pass messages to a Module Manager contract if enabled by that contract.\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"../interfaces/IAvatar.sol\";\nimport \"../factory/FactoryFriendly.sol\";\nimport \"../guard/Guardable.sol\";\n\nabstract contract Module is FactoryFriendly, Guardable {\n /// @dev Address that will ultimately execute function calls.\n address public avatar;\n /// @dev Address that this module will pass transactions to.\n address public target;\n\n /// @dev Emitted each time the avatar is set.\n event AvatarSet(address indexed previousAvatar, address indexed newAvatar);\n /// @dev Emitted each time the Target is set.\n event TargetSet(address indexed previousTarget, address indexed newTarget);\n\n /// @dev Sets the avatar to a new avatar (`newAvatar`).\n /// @notice Can only be called by the current owner.\n function setAvatar(address _avatar) public onlyOwner {\n address previousAvatar = avatar;\n avatar = _avatar;\n emit AvatarSet(previousAvatar, _avatar);\n }\n\n /// @dev Sets the target to a new target (`newTarget`).\n /// @notice Can only be called by the current owner.\n function setTarget(address _target) public onlyOwner {\n address previousTarget = target;\n target = _target;\n emit TargetSet(previousTarget, _target);\n }\n\n /// @dev Passes a transaction to be executed by the avatar.\n /// @notice Can only be called by this contract.\n /// @param to Destination address of module transaction.\n /// @param value Ether value of module transaction.\n /// @param data Data payload of module transaction.\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\n function exec(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation\n ) internal returns (bool success) {\n /// Check if a transactioon guard is enabled.\n if (guard != address(0)) {\n IGuard(guard).checkTransaction(\n /// Transaction info used by module transactions.\n to,\n value,\n data,\n operation,\n /// Zero out the redundant transaction information only used for Safe multisig transctions.\n 0,\n 0,\n 0,\n address(0),\n payable(0),\n bytes(\"0x\"),\n msg.sender\n );\n }\n success = IAvatar(target).execTransactionFromModule(\n to,\n value,\n data,\n operation\n );\n if (guard != address(0)) {\n IGuard(guard).checkAfterExecution(bytes32(\"0x\"), success);\n }\n return success;\n }\n\n /// @dev Passes a transaction to be executed by the target and returns data.\n /// @notice Can only be called by this contract.\n /// @param to Destination address of module transaction.\n /// @param value Ether value of module transaction.\n /// @param data Data payload of module transaction.\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\n function execAndReturnData(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation\n ) internal returns (bool success, bytes memory returnData) {\n /// Check if a transactioon guard is enabled.\n if (guard != address(0)) {\n IGuard(guard).checkTransaction(\n /// Transaction info used by module transactions.\n to,\n value,\n data,\n operation,\n /// Zero out the redundant transaction information only used for Safe multisig transctions.\n 0,\n 0,\n 0,\n address(0),\n payable(0),\n bytes(\"0x\"),\n msg.sender\n );\n }\n (success, returnData) = IAvatar(target)\n .execTransactionFromModuleReturnData(to, value, data, operation);\n if (guard != address(0)) {\n IGuard(guard).checkAfterExecution(bytes32(\"0x\"), success);\n }\n return (success, returnData);\n }\n}\n" + }, + "@gnosis.pm/zodiac/contracts/factory/FactoryFriendly.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\n\n/// @title Zodiac FactoryFriendly - A contract that allows other contracts to be initializable and pass bytes as arguments to define contract state\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\n\nabstract contract FactoryFriendly is OwnableUpgradeable {\n function setUp(bytes memory initializeParams) public virtual;\n}\n" + }, + "@gnosis.pm/zodiac/contracts/factory/ModuleProxyFactory.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.8.0;\n\ncontract ModuleProxyFactory {\n event ModuleProxyCreation(\n address indexed proxy,\n address indexed masterCopy\n );\n\n /// `target` can not be zero.\n error ZeroAddress(address target);\n\n /// `address_` is already taken.\n error TakenAddress(address address_);\n\n /// @notice Initialization failed.\n error FailedInitialization();\n\n function createProxy(address target, bytes32 salt)\n internal\n returns (address result)\n {\n if (address(target) == address(0)) revert ZeroAddress(target);\n bytes memory deployment = abi.encodePacked(\n hex\"602d8060093d393df3363d3d373d3d3d363d73\",\n target,\n hex\"5af43d82803e903d91602b57fd5bf3\"\n );\n // solhint-disable-next-line no-inline-assembly\n assembly {\n result := create2(0, add(deployment, 0x20), mload(deployment), salt)\n }\n if (result == address(0)) revert TakenAddress(result);\n }\n\n function deployModule(\n address masterCopy,\n bytes memory initializer,\n uint256 saltNonce\n ) public returns (address proxy) {\n proxy = createProxy(\n masterCopy,\n keccak256(abi.encodePacked(keccak256(initializer), saltNonce))\n );\n (bool success, ) = proxy.call(initializer);\n if (!success) revert FailedInitialization();\n\n emit ModuleProxyCreation(proxy, masterCopy);\n }\n}\n" + }, + "@gnosis.pm/zodiac/contracts/guard/BaseGuard.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"../interfaces/IGuard.sol\";\n\nabstract contract BaseGuard is IERC165 {\n function supportsInterface(bytes4 interfaceId)\n external\n pure\n override\n returns (bool)\n {\n return\n interfaceId == type(IGuard).interfaceId || // 0xe6d7a83a\n interfaceId == type(IERC165).interfaceId; // 0x01ffc9a7\n }\n\n /// @dev Module transactions only use the first four parameters: to, value, data, and operation.\n /// Module.sol hardcodes the remaining parameters as 0 since they are not used for module transactions.\n /// @notice This interface is used to maintain compatibilty with Gnosis Safe transaction guards.\n function checkTransaction(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation,\n uint256 safeTxGas,\n uint256 baseGas,\n uint256 gasPrice,\n address gasToken,\n address payable refundReceiver,\n bytes memory signatures,\n address msgSender\n ) external virtual;\n\n function checkAfterExecution(bytes32 txHash, bool success) external virtual;\n}\n" + }, + "@gnosis.pm/zodiac/contracts/guard/Guardable.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\";\nimport \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport \"./BaseGuard.sol\";\n\n/// @title Guardable - A contract that manages fallback calls made to this contract\ncontract Guardable is OwnableUpgradeable {\n address public guard;\n\n event ChangedGuard(address guard);\n\n /// `guard_` does not implement IERC165.\n error NotIERC165Compliant(address guard_);\n\n /// @dev Set a guard that checks transactions before execution.\n /// @param _guard The address of the guard to be used or the 0 address to disable the guard.\n function setGuard(address _guard) external onlyOwner {\n if (_guard != address(0)) {\n if (!BaseGuard(_guard).supportsInterface(type(IGuard).interfaceId))\n revert NotIERC165Compliant(_guard);\n }\n guard = _guard;\n emit ChangedGuard(guard);\n }\n\n function getGuard() external view returns (address _guard) {\n return guard;\n }\n}\n" + }, + "@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\n\n/// @title Zodiac Avatar - A contract that manages modules that can execute transactions via this contract.\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\";\n\ninterface IAvatar {\n event EnabledModule(address module);\n event DisabledModule(address module);\n event ExecutionFromModuleSuccess(address indexed module);\n event ExecutionFromModuleFailure(address indexed module);\n\n /// @dev Enables a module on the avatar.\n /// @notice Can only be called by the avatar.\n /// @notice Modules should be stored as a linked list.\n /// @notice Must emit EnabledModule(address module) if successful.\n /// @param module Module to be enabled.\n function enableModule(address module) external;\n\n /// @dev Disables a module on the avatar.\n /// @notice Can only be called by the avatar.\n /// @notice Must emit DisabledModule(address module) if successful.\n /// @param prevModule Address that pointed to the module to be removed in the linked list\n /// @param module Module to be removed.\n function disableModule(address prevModule, address module) external;\n\n /// @dev Allows a Module to execute a transaction.\n /// @notice Can only be called by an enabled module.\n /// @notice Must emit ExecutionFromModuleSuccess(address module) if successful.\n /// @notice Must emit ExecutionFromModuleFailure(address module) if unsuccessful.\n /// @param to Destination address of module transaction.\n /// @param value Ether value of module transaction.\n /// @param data Data payload of module transaction.\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\n function execTransactionFromModule(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation\n ) external returns (bool success);\n\n /// @dev Allows a Module to execute a transaction and return data\n /// @notice Can only be called by an enabled module.\n /// @notice Must emit ExecutionFromModuleSuccess(address module) if successful.\n /// @notice Must emit ExecutionFromModuleFailure(address module) if unsuccessful.\n /// @param to Destination address of module transaction.\n /// @param value Ether value of module transaction.\n /// @param data Data payload of module transaction.\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\n function execTransactionFromModuleReturnData(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation\n ) external returns (bool success, bytes memory returnData);\n\n /// @dev Returns if an module is enabled\n /// @return True if the module is enabled\n function isModuleEnabled(address module) external view returns (bool);\n\n /// @dev Returns array of modules.\n /// @param start Start of the page.\n /// @param pageSize Maximum number of modules that should be returned.\n /// @return array Array of modules.\n /// @return next Start of the next page.\n function getModulesPaginated(address start, uint256 pageSize)\n external\n view\n returns (address[] memory array, address next);\n}\n" + }, + "@gnosis.pm/zodiac/contracts/interfaces/IGuard.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\";\n\ninterface IGuard {\n function checkTransaction(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation,\n uint256 safeTxGas,\n uint256 baseGas,\n uint256 gasPrice,\n address gasToken,\n address payable refundReceiver,\n bytes memory signatures,\n address msgSender\n ) external;\n\n function checkAfterExecution(bytes32 txHash, bool success) external;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../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 * 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 OwnableUpgradeable is Initializable, ContextUpgradeable {\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 function __Ownable_init() internal onlyInitializing {\n __Ownable_init_unchained();\n }\n\n function __Ownable_init_unchained() internal onlyInitializing {\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 anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing 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 /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/governance/utils/IVotesUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (governance/utils/IVotes.sol)\npragma solidity ^0.8.0;\n\n/**\n * @dev Common interface for {ERC20Votes}, {ERC721Votes}, and other {Votes}-enabled contracts.\n *\n * _Available since v4.5._\n */\ninterface IVotesUpgradeable {\n /**\n * @dev Emitted when an account changes their delegate.\n */\n event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);\n\n /**\n * @dev Emitted when a token transfer or delegate change results in changes to a delegate's number of votes.\n */\n event DelegateVotesChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance);\n\n /**\n * @dev Returns the current amount of votes that `account` has.\n */\n function getVotes(address account) external view returns (uint256);\n\n /**\n * @dev Returns the amount of votes that `account` had at the end of a past block (`blockNumber`).\n */\n function getPastVotes(address account, uint256 blockNumber) external view returns (uint256);\n\n /**\n * @dev Returns the total supply of votes available at the end of a past block (`blockNumber`).\n *\n * NOTE: This value is the sum of all available votes, which is not necessarily the sum of all delegated votes.\n * Votes that have not been delegated are still part of total supply, even though they would not participate in a\n * vote.\n */\n function getPastTotalSupply(uint256 blockNumber) external view returns (uint256);\n\n /**\n * @dev Returns the delegate that `account` has chosen.\n */\n function delegates(address account) external view returns (address);\n\n /**\n * @dev Delegates votes from the sender to `delegatee`.\n */\n function delegate(address delegatee) external;\n\n /**\n * @dev Delegates votes from signer to `delegatee`.\n */\n function delegateBySig(\n address delegatee,\n uint256 nonce,\n uint256 expiry,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\n * initialization step. This is essential to configure modules that are added through upgrades and that require\n * initialization.\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 modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized < type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20Upgradeable.sol\";\nimport \"./extensions/IERC20MetadataUpgradeable.sol\";\nimport \"../../utils/ContextUpgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20Upgradeable, IERC20MetadataUpgradeable {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n function __ERC20_init(string memory name_, string memory symbol_) internal onlyInitializing {\n __ERC20_init_unchained(name_, symbol_);\n }\n\n function __ERC20_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n }\n _balances[to] += amount;\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n _balances[account] += amount;\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n }\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[45] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-ERC20PermitUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/extensions/draft-ERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./draft-IERC20PermitUpgradeable.sol\";\nimport \"../ERC20Upgradeable.sol\";\nimport \"../../../utils/cryptography/draft-EIP712Upgradeable.sol\";\nimport \"../../../utils/cryptography/ECDSAUpgradeable.sol\";\nimport \"../../../utils/CountersUpgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation 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 * _Available since v3.4._\n *\n * @custom:storage-size 51\n */\nabstract contract ERC20PermitUpgradeable is Initializable, ERC20Upgradeable, IERC20PermitUpgradeable, EIP712Upgradeable {\n using CountersUpgradeable for CountersUpgradeable.Counter;\n\n mapping(address => CountersUpgradeable.Counter) private _nonces;\n\n // solhint-disable-next-line var-name-mixedcase\n bytes32 private constant _PERMIT_TYPEHASH =\n keccak256(\"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\");\n /**\n * @dev In previous versions `_PERMIT_TYPEHASH` was declared as `immutable`.\n * However, to ensure consistency with the upgradeable transpiler, we will continue\n * to reserve a slot.\n * @custom:oz-renamed-from _PERMIT_TYPEHASH\n */\n // solhint-disable-next-line var-name-mixedcase\n bytes32 private _PERMIT_TYPEHASH_DEPRECATED_SLOT;\n\n /**\n * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `\"1\"`.\n *\n * It's a good idea to use the same `name` that is defined as the ERC20 token name.\n */\n function __ERC20Permit_init(string memory name) internal onlyInitializing {\n __EIP712_init_unchained(name, \"1\");\n }\n\n function __ERC20Permit_init_unchained(string memory) internal onlyInitializing {}\n\n /**\n * @dev See {IERC20Permit-permit}.\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 ) public virtual override {\n require(block.timestamp <= deadline, \"ERC20Permit: expired deadline\");\n\n bytes32 structHash = keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline));\n\n bytes32 hash = _hashTypedDataV4(structHash);\n\n address signer = ECDSAUpgradeable.recover(hash, v, r, s);\n require(signer == owner, \"ERC20Permit: invalid signature\");\n\n _approve(owner, spender, value);\n }\n\n /**\n * @dev See {IERC20Permit-nonces}.\n */\n function nonces(address owner) public view virtual override returns (uint256) {\n return _nonces[owner].current();\n }\n\n /**\n * @dev See {IERC20Permit-DOMAIN_SEPARATOR}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view override returns (bytes32) {\n return _domainSeparatorV4();\n }\n\n /**\n * @dev \"Consume a nonce\": return the current value and increment.\n *\n * _Available since v4.1._\n */\n function _useNonce(address owner) internal virtual returns (uint256 current) {\n CountersUpgradeable.Counter storage nonce = _nonces[owner];\n current = nonce.current();\n nonce.increment();\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\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 */\ninterface IERC20PermitUpgradeable {\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 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-upgradeable/token/ERC20/extensions/ERC20SnapshotUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/extensions/ERC20Snapshot.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC20Upgradeable.sol\";\nimport \"../../../utils/ArraysUpgradeable.sol\";\nimport \"../../../utils/CountersUpgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev This contract extends an ERC20 token with a snapshot mechanism. When a snapshot is created, the balances and\n * total supply at the time are recorded for later access.\n *\n * This can be used to safely create mechanisms based on token balances such as trustless dividends or weighted voting.\n * In naive implementations it's possible to perform a \"double spend\" attack by reusing the same balance from different\n * accounts. By using snapshots to calculate dividends or voting power, those attacks no longer apply. It can also be\n * used to create an efficient ERC20 forking mechanism.\n *\n * Snapshots are created by the internal {_snapshot} function, which will emit the {Snapshot} event and return a\n * snapshot id. To get the total supply at the time of a snapshot, call the function {totalSupplyAt} with the snapshot\n * id. To get the balance of an account at the time of a snapshot, call the {balanceOfAt} function with the snapshot id\n * and the account address.\n *\n * NOTE: Snapshot policy can be customized by overriding the {_getCurrentSnapshotId} method. For example, having it\n * return `block.number` will trigger the creation of snapshot at the beginning of each new block. When overriding this\n * function, be careful about the monotonicity of its result. Non-monotonic snapshot ids will break the contract.\n *\n * Implementing snapshots for every block using this method will incur significant gas costs. For a gas-efficient\n * alternative consider {ERC20Votes}.\n *\n * ==== Gas Costs\n *\n * Snapshots are efficient. Snapshot creation is _O(1)_. Retrieval of balances or total supply from a snapshot is _O(log\n * n)_ in the number of snapshots that have been created, although _n_ for a specific account will generally be much\n * smaller since identical balances in subsequent snapshots are stored as a single entry.\n *\n * There is a constant overhead for normal ERC20 transfers due to the additional snapshot bookkeeping. This overhead is\n * only significant for the first transfer that immediately follows a snapshot for a particular account. Subsequent\n * transfers will have normal cost until the next snapshot, and so on.\n */\n\nabstract contract ERC20SnapshotUpgradeable is Initializable, ERC20Upgradeable {\n function __ERC20Snapshot_init() internal onlyInitializing {\n }\n\n function __ERC20Snapshot_init_unchained() internal onlyInitializing {\n }\n // Inspired by Jordi Baylina's MiniMeToken to record historical balances:\n // https://github.com/Giveth/minime/blob/ea04d950eea153a04c51fa510b068b9dded390cb/contracts/MiniMeToken.sol\n\n using ArraysUpgradeable for uint256[];\n using CountersUpgradeable for CountersUpgradeable.Counter;\n\n // Snapshotted values have arrays of ids and the value corresponding to that id. These could be an array of a\n // Snapshot struct, but that would impede usage of functions that work on an array.\n struct Snapshots {\n uint256[] ids;\n uint256[] values;\n }\n\n mapping(address => Snapshots) private _accountBalanceSnapshots;\n Snapshots private _totalSupplySnapshots;\n\n // Snapshot ids increase monotonically, with the first value being 1. An id of 0 is invalid.\n CountersUpgradeable.Counter private _currentSnapshotId;\n\n /**\n * @dev Emitted by {_snapshot} when a snapshot identified by `id` is created.\n */\n event Snapshot(uint256 id);\n\n /**\n * @dev Creates a new snapshot and returns its snapshot id.\n *\n * Emits a {Snapshot} event that contains the same id.\n *\n * {_snapshot} is `internal` and you have to decide how to expose it externally. Its usage may be restricted to a\n * set of accounts, for example using {AccessControl}, or it may be open to the public.\n *\n * [WARNING]\n * ====\n * While an open way of calling {_snapshot} is required for certain trust minimization mechanisms such as forking,\n * you must consider that it can potentially be used by attackers in two ways.\n *\n * First, it can be used to increase the cost of retrieval of values from snapshots, although it will grow\n * logarithmically thus rendering this attack ineffective in the long term. Second, it can be used to target\n * specific accounts and increase the cost of ERC20 transfers for them, in the ways specified in the Gas Costs\n * section above.\n *\n * We haven't measured the actual numbers; if this is something you're interested in please reach out to us.\n * ====\n */\n function _snapshot() internal virtual returns (uint256) {\n _currentSnapshotId.increment();\n\n uint256 currentId = _getCurrentSnapshotId();\n emit Snapshot(currentId);\n return currentId;\n }\n\n /**\n * @dev Get the current snapshotId\n */\n function _getCurrentSnapshotId() internal view virtual returns (uint256) {\n return _currentSnapshotId.current();\n }\n\n /**\n * @dev Retrieves the balance of `account` at the time `snapshotId` was created.\n */\n function balanceOfAt(address account, uint256 snapshotId) public view virtual returns (uint256) {\n (bool snapshotted, uint256 value) = _valueAt(snapshotId, _accountBalanceSnapshots[account]);\n\n return snapshotted ? value : balanceOf(account);\n }\n\n /**\n * @dev Retrieves the total supply at the time `snapshotId` was created.\n */\n function totalSupplyAt(uint256 snapshotId) public view virtual returns (uint256) {\n (bool snapshotted, uint256 value) = _valueAt(snapshotId, _totalSupplySnapshots);\n\n return snapshotted ? value : totalSupply();\n }\n\n // Update balance and/or total supply snapshots before the values are modified. This is implemented\n // in the _beforeTokenTransfer hook, which is executed for _mint, _burn, and _transfer operations.\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual override {\n super._beforeTokenTransfer(from, to, amount);\n\n if (from == address(0)) {\n // mint\n _updateAccountSnapshot(to);\n _updateTotalSupplySnapshot();\n } else if (to == address(0)) {\n // burn\n _updateAccountSnapshot(from);\n _updateTotalSupplySnapshot();\n } else {\n // transfer\n _updateAccountSnapshot(from);\n _updateAccountSnapshot(to);\n }\n }\n\n function _valueAt(uint256 snapshotId, Snapshots storage snapshots) private view returns (bool, uint256) {\n require(snapshotId > 0, \"ERC20Snapshot: id is 0\");\n require(snapshotId <= _getCurrentSnapshotId(), \"ERC20Snapshot: nonexistent id\");\n\n // When a valid snapshot is queried, there are three possibilities:\n // a) The queried value was not modified after the snapshot was taken. Therefore, a snapshot entry was never\n // created for this id, and all stored snapshot ids are smaller than the requested one. The value that corresponds\n // to this id is the current one.\n // b) The queried value was modified after the snapshot was taken. Therefore, there will be an entry with the\n // requested id, and its value is the one to return.\n // c) More snapshots were created after the requested one, and the queried value was later modified. There will be\n // no entry for the requested id: the value that corresponds to it is that of the smallest snapshot id that is\n // larger than the requested one.\n //\n // In summary, we need to find an element in an array, returning the index of the smallest value that is larger if\n // it is not found, unless said value doesn't exist (e.g. when all values are smaller). Arrays.findUpperBound does\n // exactly this.\n\n uint256 index = snapshots.ids.findUpperBound(snapshotId);\n\n if (index == snapshots.ids.length) {\n return (false, 0);\n } else {\n return (true, snapshots.values[index]);\n }\n }\n\n function _updateAccountSnapshot(address account) private {\n _updateSnapshot(_accountBalanceSnapshots[account], balanceOf(account));\n }\n\n function _updateTotalSupplySnapshot() private {\n _updateSnapshot(_totalSupplySnapshots, totalSupply());\n }\n\n function _updateSnapshot(Snapshots storage snapshots, uint256 currentValue) private {\n uint256 currentId = _getCurrentSnapshotId();\n if (_lastSnapshotId(snapshots.ids) < currentId) {\n snapshots.ids.push(currentId);\n snapshots.values.push(currentValue);\n }\n }\n\n function _lastSnapshotId(uint256[] storage ids) private view returns (uint256) {\n if (ids.length == 0) {\n return 0;\n } else {\n return ids[ids.length - 1];\n }\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[46] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20VotesUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/extensions/ERC20Votes.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./draft-ERC20PermitUpgradeable.sol\";\nimport \"../../../utils/math/MathUpgradeable.sol\";\nimport \"../../../governance/utils/IVotesUpgradeable.sol\";\nimport \"../../../utils/math/SafeCastUpgradeable.sol\";\nimport \"../../../utils/cryptography/ECDSAUpgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Extension of ERC20 to support Compound-like voting and delegation. This version is more generic than Compound's,\n * and supports token supply up to 2^224^ - 1, while COMP is limited to 2^96^ - 1.\n *\n * NOTE: If exact COMP compatibility is required, use the {ERC20VotesComp} variant of this module.\n *\n * This extension keeps a history (checkpoints) of each account's vote power. Vote power can be delegated either\n * by calling the {delegate} function directly, or by providing a signature to be used with {delegateBySig}. Voting\n * power can be queried through the public accessors {getVotes} and {getPastVotes}.\n *\n * By default, token balance does not account for voting power. This makes transfers cheaper. The downside is that it\n * requires users to delegate to themselves in order to activate checkpoints and have their voting power tracked.\n *\n * _Available since v4.2._\n */\nabstract contract ERC20VotesUpgradeable is Initializable, IVotesUpgradeable, ERC20PermitUpgradeable {\n function __ERC20Votes_init() internal onlyInitializing {\n }\n\n function __ERC20Votes_init_unchained() internal onlyInitializing {\n }\n struct Checkpoint {\n uint32 fromBlock;\n uint224 votes;\n }\n\n bytes32 private constant _DELEGATION_TYPEHASH =\n keccak256(\"Delegation(address delegatee,uint256 nonce,uint256 expiry)\");\n\n mapping(address => address) private _delegates;\n mapping(address => Checkpoint[]) private _checkpoints;\n Checkpoint[] private _totalSupplyCheckpoints;\n\n /**\n * @dev Get the `pos`-th checkpoint for `account`.\n */\n function checkpoints(address account, uint32 pos) public view virtual returns (Checkpoint memory) {\n return _checkpoints[account][pos];\n }\n\n /**\n * @dev Get number of checkpoints for `account`.\n */\n function numCheckpoints(address account) public view virtual returns (uint32) {\n return SafeCastUpgradeable.toUint32(_checkpoints[account].length);\n }\n\n /**\n * @dev Get the address `account` is currently delegating to.\n */\n function delegates(address account) public view virtual override returns (address) {\n return _delegates[account];\n }\n\n /**\n * @dev Gets the current votes balance for `account`\n */\n function getVotes(address account) public view virtual override returns (uint256) {\n uint256 pos = _checkpoints[account].length;\n return pos == 0 ? 0 : _checkpoints[account][pos - 1].votes;\n }\n\n /**\n * @dev Retrieve the number of votes for `account` at the end of `blockNumber`.\n *\n * Requirements:\n *\n * - `blockNumber` must have been already mined\n */\n function getPastVotes(address account, uint256 blockNumber) public view virtual override returns (uint256) {\n require(blockNumber < block.number, \"ERC20Votes: block not yet mined\");\n return _checkpointsLookup(_checkpoints[account], blockNumber);\n }\n\n /**\n * @dev Retrieve the `totalSupply` at the end of `blockNumber`. Note, this value is the sum of all balances.\n * It is but NOT the sum of all the delegated votes!\n *\n * Requirements:\n *\n * - `blockNumber` must have been already mined\n */\n function getPastTotalSupply(uint256 blockNumber) public view virtual override returns (uint256) {\n require(blockNumber < block.number, \"ERC20Votes: block not yet mined\");\n return _checkpointsLookup(_totalSupplyCheckpoints, blockNumber);\n }\n\n /**\n * @dev Lookup a value in a list of (sorted) checkpoints.\n */\n function _checkpointsLookup(Checkpoint[] storage ckpts, uint256 blockNumber) private view returns (uint256) {\n // We run a binary search to look for the earliest checkpoint taken after `blockNumber`.\n //\n // During the loop, the index of the wanted checkpoint remains in the range [low-1, high).\n // With each iteration, either `low` or `high` is moved towards the middle of the range to maintain the invariant.\n // - If the middle checkpoint is after `blockNumber`, we look in [low, mid)\n // - If the middle checkpoint is before or equal to `blockNumber`, we look in [mid+1, high)\n // Once we reach a single value (when low == high), we've found the right checkpoint at the index high-1, if not\n // out of bounds (in which case we're looking too far in the past and the result is 0).\n // Note that if the latest checkpoint available is exactly for `blockNumber`, we end up with an index that is\n // past the end of the array, so we technically don't find a checkpoint after `blockNumber`, but it works out\n // the same.\n uint256 high = ckpts.length;\n uint256 low = 0;\n while (low < high) {\n uint256 mid = MathUpgradeable.average(low, high);\n if (ckpts[mid].fromBlock > blockNumber) {\n high = mid;\n } else {\n low = mid + 1;\n }\n }\n\n return high == 0 ? 0 : ckpts[high - 1].votes;\n }\n\n /**\n * @dev Delegate votes from the sender to `delegatee`.\n */\n function delegate(address delegatee) public virtual override {\n _delegate(_msgSender(), delegatee);\n }\n\n /**\n * @dev Delegates votes from signer to `delegatee`\n */\n function delegateBySig(\n address delegatee,\n uint256 nonce,\n uint256 expiry,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) public virtual override {\n require(block.timestamp <= expiry, \"ERC20Votes: signature expired\");\n address signer = ECDSAUpgradeable.recover(\n _hashTypedDataV4(keccak256(abi.encode(_DELEGATION_TYPEHASH, delegatee, nonce, expiry))),\n v,\n r,\n s\n );\n require(nonce == _useNonce(signer), \"ERC20Votes: invalid nonce\");\n _delegate(signer, delegatee);\n }\n\n /**\n * @dev Maximum token supply. Defaults to `type(uint224).max` (2^224^ - 1).\n */\n function _maxSupply() internal view virtual returns (uint224) {\n return type(uint224).max;\n }\n\n /**\n * @dev Snapshots the totalSupply after it has been increased.\n */\n function _mint(address account, uint256 amount) internal virtual override {\n super._mint(account, amount);\n require(totalSupply() <= _maxSupply(), \"ERC20Votes: total supply risks overflowing votes\");\n\n _writeCheckpoint(_totalSupplyCheckpoints, _add, amount);\n }\n\n /**\n * @dev Snapshots the totalSupply after it has been decreased.\n */\n function _burn(address account, uint256 amount) internal virtual override {\n super._burn(account, amount);\n\n _writeCheckpoint(_totalSupplyCheckpoints, _subtract, amount);\n }\n\n /**\n * @dev Move voting power when tokens are transferred.\n *\n * Emits a {DelegateVotesChanged} event.\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual override {\n super._afterTokenTransfer(from, to, amount);\n\n _moveVotingPower(delegates(from), delegates(to), amount);\n }\n\n /**\n * @dev Change delegation for `delegator` to `delegatee`.\n *\n * Emits events {DelegateChanged} and {DelegateVotesChanged}.\n */\n function _delegate(address delegator, address delegatee) internal virtual {\n address currentDelegate = delegates(delegator);\n uint256 delegatorBalance = balanceOf(delegator);\n _delegates[delegator] = delegatee;\n\n emit DelegateChanged(delegator, currentDelegate, delegatee);\n\n _moveVotingPower(currentDelegate, delegatee, delegatorBalance);\n }\n\n function _moveVotingPower(\n address src,\n address dst,\n uint256 amount\n ) private {\n if (src != dst && amount > 0) {\n if (src != address(0)) {\n (uint256 oldWeight, uint256 newWeight) = _writeCheckpoint(_checkpoints[src], _subtract, amount);\n emit DelegateVotesChanged(src, oldWeight, newWeight);\n }\n\n if (dst != address(0)) {\n (uint256 oldWeight, uint256 newWeight) = _writeCheckpoint(_checkpoints[dst], _add, amount);\n emit DelegateVotesChanged(dst, oldWeight, newWeight);\n }\n }\n }\n\n function _writeCheckpoint(\n Checkpoint[] storage ckpts,\n function(uint256, uint256) view returns (uint256) op,\n uint256 delta\n ) private returns (uint256 oldWeight, uint256 newWeight) {\n uint256 pos = ckpts.length;\n oldWeight = pos == 0 ? 0 : ckpts[pos - 1].votes;\n newWeight = op(oldWeight, delta);\n\n if (pos > 0 && ckpts[pos - 1].fromBlock == block.number) {\n ckpts[pos - 1].votes = SafeCastUpgradeable.toUint224(newWeight);\n } else {\n ckpts.push(Checkpoint({fromBlock: SafeCastUpgradeable.toUint32(block.number), votes: SafeCastUpgradeable.toUint224(newWeight)}));\n }\n }\n\n function _add(uint256 a, uint256 b) private pure returns (uint256) {\n return a + b;\n }\n\n function _subtract(uint256 a, uint256 b) private pure returns (uint256) {\n return a - b;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[47] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20WrapperUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/extensions/ERC20Wrapper.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC20Upgradeable.sol\";\nimport \"../utils/SafeERC20Upgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Extension of the ERC20 token contract to support token wrapping.\n *\n * Users can deposit and withdraw \"underlying tokens\" and receive a matching number of \"wrapped tokens\". This is useful\n * in conjunction with other modules. For example, combining this wrapping mechanism with {ERC20Votes} will allow the\n * wrapping of an existing \"basic\" ERC20 into a governance token.\n *\n * _Available since v4.2._\n *\n * @custom:storage-size 51\n */\nabstract contract ERC20WrapperUpgradeable is Initializable, ERC20Upgradeable {\n IERC20Upgradeable public underlying;\n\n function __ERC20Wrapper_init(IERC20Upgradeable underlyingToken) internal onlyInitializing {\n __ERC20Wrapper_init_unchained(underlyingToken);\n }\n\n function __ERC20Wrapper_init_unchained(IERC20Upgradeable underlyingToken) internal onlyInitializing {\n underlying = underlyingToken;\n }\n\n /**\n * @dev See {ERC20-decimals}.\n */\n function decimals() public view virtual override returns (uint8) {\n try IERC20MetadataUpgradeable(address(underlying)).decimals() returns (uint8 value) {\n return value;\n } catch {\n return super.decimals();\n }\n }\n\n /**\n * @dev Allow a user to deposit underlying tokens and mint the corresponding number of wrapped tokens.\n */\n function depositFor(address account, uint256 amount) public virtual returns (bool) {\n SafeERC20Upgradeable.safeTransferFrom(underlying, _msgSender(), address(this), amount);\n _mint(account, amount);\n return true;\n }\n\n /**\n * @dev Allow a user to burn a number of wrapped tokens and withdraw the corresponding number of underlying tokens.\n */\n function withdrawTo(address account, uint256 amount) public virtual returns (bool) {\n _burn(_msgSender(), amount);\n SafeERC20Upgradeable.safeTransfer(underlying, account, amount);\n return true;\n }\n\n /**\n * @dev Mint wrapped token to cover any underlyingTokens that would have been transferred by mistake. Internal\n * function that can be exposed with access control if desired.\n */\n function _recover(address account) internal virtual returns (uint256) {\n uint256 value = underlying.balanceOf(address(this)) - totalSupply();\n _mint(account, value);\n return value;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20Upgradeable.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20MetadataUpgradeable is IERC20Upgradeable {\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-upgradeable/token/ERC20/IERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\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 amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `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 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20Upgradeable.sol\";\nimport \"../extensions/draft-IERC20PermitUpgradeable.sol\";\nimport \"../../../utils/AddressUpgradeable.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 SafeERC20Upgradeable {\n using AddressUpgradeable for address;\n\n function safeTransfer(\n IERC20Upgradeable token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20Upgradeable token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20Upgradeable token,\n address spender,\n uint256 value\n ) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20Upgradeable token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20Upgradeable token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n function safePermit(\n IERC20PermitUpgradeable token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\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(IERC20Upgradeable token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.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 *\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://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @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}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/ArraysUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Arrays.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/MathUpgradeable.sol\";\n\n/**\n * @dev Collection of functions related to array types.\n */\nlibrary ArraysUpgradeable {\n /**\n * @dev Searches a sorted `array` and returns the first index that contains\n * a value greater or equal to `element`. If no such index exists (i.e. all\n * values in the array are strictly less than `element`), the array length is\n * returned. Time complexity O(log n).\n *\n * `array` is expected to be sorted in ascending order, and to contain no\n * repeated elements.\n */\n function findUpperBound(uint256[] storage array, uint256 element) internal view returns (uint256) {\n if (array.length == 0) {\n return 0;\n }\n\n uint256 low = 0;\n uint256 high = array.length;\n\n while (low < high) {\n uint256 mid = MathUpgradeable.average(low, high);\n\n // Note that mid will always be strictly less than high (i.e. it will be a valid array index)\n // because Math.average rounds down (it does integer division with truncation).\n if (array[mid] > element) {\n high = mid;\n } else {\n low = mid + 1;\n }\n }\n\n // At this point `low` is the exclusive upper bound. We will return the inclusive upper bound.\n if (low > 0 && array[low - 1] == element) {\n return low - 1;\n } else {\n return low;\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\nimport \"../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 /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title Counters\n * @author Matt Condon (@shrugs)\n * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number\n * of elements in a mapping, issuing ERC721 ids, or counting request ids.\n *\n * Include with `using Counters for Counters.Counter;`\n */\nlibrary CountersUpgradeable {\n struct Counter {\n // This variable should never be directly accessed by users of the library: interactions must be restricted to\n // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add\n // this feature: see https://github.com/ethereum/solidity/issues/4637\n uint256 _value; // default: 0\n }\n\n function current(Counter storage counter) internal view returns (uint256) {\n return counter._value;\n }\n\n function increment(Counter storage counter) internal {\n unchecked {\n counter._value += 1;\n }\n }\n\n function decrement(Counter storage counter) internal {\n uint256 value = counter._value;\n require(value > 0, \"Counter: decrement overflow\");\n unchecked {\n counter._value = value - 1;\n }\n }\n\n function reset(Counter storage counter) internal {\n counter._value = 0;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/cryptography/draft-EIP712Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/cryptography/draft-EIP712.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./ECDSAUpgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.\n *\n * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,\n * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding\n * they need in their contracts using a combination of `abi.encode` and `keccak256`.\n *\n * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding\n * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA\n * ({_hashTypedDataV4}).\n *\n * The implementation of the domain separator was designed to be as efficient as possible while still properly updating\n * the chain id to protect against replay attacks on an eventual fork of the chain.\n *\n * NOTE: This contract implements the version of the encoding known as \"v4\", as implemented by the JSON RPC method\n * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].\n *\n * _Available since v3.4._\n *\n * @custom:storage-size 52\n */\nabstract contract EIP712Upgradeable is Initializable {\n /* solhint-disable var-name-mixedcase */\n bytes32 private _HASHED_NAME;\n bytes32 private _HASHED_VERSION;\n bytes32 private constant _TYPE_HASH = keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\");\n\n /* solhint-enable var-name-mixedcase */\n\n /**\n * @dev Initializes the domain separator and parameter caches.\n *\n * The meaning of `name` and `version` is specified in\n * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:\n *\n * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.\n * - `version`: the current major version of the signing domain.\n *\n * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart\n * contract upgrade].\n */\n function __EIP712_init(string memory name, string memory version) internal onlyInitializing {\n __EIP712_init_unchained(name, version);\n }\n\n function __EIP712_init_unchained(string memory name, string memory version) internal onlyInitializing {\n bytes32 hashedName = keccak256(bytes(name));\n bytes32 hashedVersion = keccak256(bytes(version));\n _HASHED_NAME = hashedName;\n _HASHED_VERSION = hashedVersion;\n }\n\n /**\n * @dev Returns the domain separator for the current chain.\n */\n function _domainSeparatorV4() internal view returns (bytes32) {\n return _buildDomainSeparator(_TYPE_HASH, _EIP712NameHash(), _EIP712VersionHash());\n }\n\n function _buildDomainSeparator(\n bytes32 typeHash,\n bytes32 nameHash,\n bytes32 versionHash\n ) private view returns (bytes32) {\n return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this)));\n }\n\n /**\n * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this\n * function returns the hash of the fully encoded EIP712 message for this domain.\n *\n * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:\n *\n * ```solidity\n * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(\n * keccak256(\"Mail(address to,string contents)\"),\n * mailTo,\n * keccak256(bytes(mailContents))\n * )));\n * address signer = ECDSA.recover(digest, signature);\n * ```\n */\n function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {\n return ECDSAUpgradeable.toTypedDataHash(_domainSeparatorV4(), structHash);\n }\n\n /**\n * @dev The hash of the name parameter for the EIP712 domain.\n *\n * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs\n * are a concern.\n */\n function _EIP712NameHash() internal virtual view returns (bytes32) {\n return _HASHED_NAME;\n }\n\n /**\n * @dev The hash of the version parameter for the EIP712 domain.\n *\n * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs\n * are a concern.\n */\n function _EIP712VersionHash() internal virtual view returns (bytes32) {\n return _HASHED_VERSION;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.3) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../StringsUpgradeable.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSAUpgradeable {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS,\n InvalidSignatureV\n }\n\n function _throwError(RecoverError error) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert(\"ECDSA: invalid signature\");\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert(\"ECDSA: invalid signature length\");\n } else if (error == RecoverError.InvalidSignatureS) {\n revert(\"ECDSA: invalid signature 's' value\");\n } else if (error == RecoverError.InvalidSignatureV) {\n revert(\"ECDSA: invalid signature 'v' value\");\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature` or error string. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n /// @solidity memory-safe-assembly\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength);\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, signature);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n *\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address, RecoverError) {\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n uint8 v = uint8((uint256(vs) >> 255) + 27);\n return tryRecover(hash, v, r, s);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n *\n * _Available since v4.2._\n */\n function recover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n * `r` and `s` signature fields separately.\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address, RecoverError) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS);\n }\n if (v != 27 && v != 28) {\n return (address(0), RecoverError.InvalidSignatureV);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature);\n }\n\n return (signer, RecoverError.NoError);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", hash));\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from `s`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", StringsUpgradeable.toString(s.length), s));\n }\n\n /**\n * @dev Returns an Ethereum Signed Typed Data, created from a\n * `domainSeparator` and a `structHash`. This produces hash corresponding\n * to the one signed with the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n * JSON-RPC method as part of EIP-712.\n *\n * See {recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x01\", domainSeparator, structHash));\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary MathUpgradeable {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\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 up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 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 denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) 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; // 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 prod0 := mul(x, y)\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 return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n 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. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\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 works\n // 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(\n uint256 x,\n uint256 y,\n uint256 denominator,\n Rounding rounding\n ) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. It the number is not a perfect square, the value is rounded down.\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 // 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)`.\n // We also know that `k`, the position of the most significant bit, is such that `msb(a) = 2**k`.\n // This gives `2**k < a <= 2**(k+1)` → `2**(k/2) <= sqrt(a) < 2 ** (k/2+1)`.\n // Using an algorithm similar to the msb conmputation, we are able to compute `result = 2**(k/2)` which is a\n // good first aproximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1;\n uint256 x = a;\n if (x >> 128 > 0) {\n x >>= 128;\n result <<= 64;\n }\n if (x >> 64 > 0) {\n x >>= 64;\n result <<= 32;\n }\n if (x >> 32 > 0) {\n x >>= 32;\n result <<= 16;\n }\n if (x >> 16 > 0) {\n x >>= 16;\n result <<= 8;\n }\n if (x >> 8 > 0) {\n x >>= 8;\n result <<= 4;\n }\n if (x >> 4 > 0) {\n x >>= 4;\n result <<= 2;\n }\n if (x >> 2 > 0) {\n result <<= 1;\n }\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 uint256 result = sqrt(a);\n if (rounding == Rounding.Up && result * result < a) {\n result += 1;\n }\n return result;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/math/SafeCastUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/math/SafeCast.sol)\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 SafeCastUpgradeable {\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) {\n require(value >= type(int248).min && value <= type(int248).max, \"SafeCast: value doesn't fit in 248 bits\");\n return int248(value);\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) {\n require(value >= type(int240).min && value <= type(int240).max, \"SafeCast: value doesn't fit in 240 bits\");\n return int240(value);\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) {\n require(value >= type(int232).min && value <= type(int232).max, \"SafeCast: value doesn't fit in 232 bits\");\n return int232(value);\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) {\n require(value >= type(int224).min && value <= type(int224).max, \"SafeCast: value doesn't fit in 224 bits\");\n return int224(value);\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) {\n require(value >= type(int216).min && value <= type(int216).max, \"SafeCast: value doesn't fit in 216 bits\");\n return int216(value);\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) {\n require(value >= type(int208).min && value <= type(int208).max, \"SafeCast: value doesn't fit in 208 bits\");\n return int208(value);\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) {\n require(value >= type(int200).min && value <= type(int200).max, \"SafeCast: value doesn't fit in 200 bits\");\n return int200(value);\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) {\n require(value >= type(int192).min && value <= type(int192).max, \"SafeCast: value doesn't fit in 192 bits\");\n return int192(value);\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) {\n require(value >= type(int184).min && value <= type(int184).max, \"SafeCast: value doesn't fit in 184 bits\");\n return int184(value);\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) {\n require(value >= type(int176).min && value <= type(int176).max, \"SafeCast: value doesn't fit in 176 bits\");\n return int176(value);\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) {\n require(value >= type(int168).min && value <= type(int168).max, \"SafeCast: value doesn't fit in 168 bits\");\n return int168(value);\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) {\n require(value >= type(int160).min && value <= type(int160).max, \"SafeCast: value doesn't fit in 160 bits\");\n return int160(value);\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) {\n require(value >= type(int152).min && value <= type(int152).max, \"SafeCast: value doesn't fit in 152 bits\");\n return int152(value);\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) {\n require(value >= type(int144).min && value <= type(int144).max, \"SafeCast: value doesn't fit in 144 bits\");\n return int144(value);\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) {\n require(value >= type(int136).min && value <= type(int136).max, \"SafeCast: value doesn't fit in 136 bits\");\n return int136(value);\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) {\n require(value >= type(int128).min && value <= type(int128).max, \"SafeCast: value doesn't fit in 128 bits\");\n return int128(value);\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) {\n require(value >= type(int120).min && value <= type(int120).max, \"SafeCast: value doesn't fit in 120 bits\");\n return int120(value);\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) {\n require(value >= type(int112).min && value <= type(int112).max, \"SafeCast: value doesn't fit in 112 bits\");\n return int112(value);\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) {\n require(value >= type(int104).min && value <= type(int104).max, \"SafeCast: value doesn't fit in 104 bits\");\n return int104(value);\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) {\n require(value >= type(int96).min && value <= type(int96).max, \"SafeCast: value doesn't fit in 96 bits\");\n return int96(value);\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) {\n require(value >= type(int88).min && value <= type(int88).max, \"SafeCast: value doesn't fit in 88 bits\");\n return int88(value);\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) {\n require(value >= type(int80).min && value <= type(int80).max, \"SafeCast: value doesn't fit in 80 bits\");\n return int80(value);\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) {\n require(value >= type(int72).min && value <= type(int72).max, \"SafeCast: value doesn't fit in 72 bits\");\n return int72(value);\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) {\n require(value >= type(int64).min && value <= type(int64).max, \"SafeCast: value doesn't fit in 64 bits\");\n return int64(value);\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) {\n require(value >= type(int56).min && value <= type(int56).max, \"SafeCast: value doesn't fit in 56 bits\");\n return int56(value);\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) {\n require(value >= type(int48).min && value <= type(int48).max, \"SafeCast: value doesn't fit in 48 bits\");\n return int48(value);\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) {\n require(value >= type(int40).min && value <= type(int40).max, \"SafeCast: value doesn't fit in 40 bits\");\n return int40(value);\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) {\n require(value >= type(int32).min && value <= type(int32).max, \"SafeCast: value doesn't fit in 32 bits\");\n return int32(value);\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) {\n require(value >= type(int24).min && value <= type(int24).max, \"SafeCast: value doesn't fit in 24 bits\");\n return int24(value);\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) {\n require(value >= type(int16).min && value <= type(int16).max, \"SafeCast: value doesn't fit in 16 bits\");\n return int16(value);\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) {\n require(value >= type(int8).min && value <= type(int8).max, \"SafeCast: value doesn't fit in 8 bits\");\n return int8(value);\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" + }, + "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev String operations.\n */\nlibrary StringsUpgradeable {\n bytes16 private constant _HEX_SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\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 // Inspired by OraclizeAPI's implementation - MIT licence\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\n\n if (value == 0) {\n return \"0\";\n }\n uint256 temp = value;\n uint256 digits;\n while (temp != 0) {\n digits++;\n temp /= 10;\n }\n bytes memory buffer = new bytes(digits);\n while (value != 0) {\n digits -= 1;\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\n value /= 10;\n }\n return string(buffer);\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 if (value == 0) {\n return \"0x00\";\n }\n uint256 temp = value;\n uint256 length = 0;\n while (temp != 0) {\n length++;\n temp >>= 8;\n }\n return toHexString(value, length);\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 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_SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\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 representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "@openzeppelin/contracts/governance/utils/IVotes.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (governance/utils/IVotes.sol)\npragma solidity ^0.8.0;\n\n/**\n * @dev Common interface for {ERC20Votes}, {ERC721Votes}, and other {Votes}-enabled contracts.\n *\n * _Available since v4.5._\n */\ninterface IVotes {\n /**\n * @dev Emitted when an account changes their delegate.\n */\n event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);\n\n /**\n * @dev Emitted when a token transfer or delegate change results in changes to a delegate's number of votes.\n */\n event DelegateVotesChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance);\n\n /**\n * @dev Returns the current amount of votes that `account` has.\n */\n function getVotes(address account) external view returns (uint256);\n\n /**\n * @dev Returns the amount of votes that `account` had at the end of a past block (`blockNumber`).\n */\n function getPastVotes(address account, uint256 blockNumber) external view returns (uint256);\n\n /**\n * @dev Returns the total supply of votes available at the end of a past block (`blockNumber`).\n *\n * NOTE: This value is the sum of all available votes, which is not necessarily the sum of all delegated votes.\n * Votes that have not been delegated are still part of total supply, even though they would not participate in a\n * vote.\n */\n function getPastTotalSupply(uint256 blockNumber) external view returns (uint256);\n\n /**\n * @dev Returns the delegate that `account` has chosen.\n */\n function delegates(address account) external view returns (address);\n\n /**\n * @dev Delegates votes from the sender to `delegatee`.\n */\n function delegate(address delegatee) external;\n\n /**\n * @dev Delegates votes from signer to `delegatee`.\n */\n function delegateBySig(\n address delegatee,\n uint256 nonce,\n uint256 expiry,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n}\n" + }, + "@openzeppelin/contracts/interfaces/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/introspection/IERC165.sol\";\n" + }, + "@openzeppelin/contracts/token/ERC20/ERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n }\n _balances[to] += amount;\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n _balances[account] += amount;\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n }\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\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 */\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 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/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\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 v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev 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 amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `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 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../extensions/draft-IERC20Permit.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n function safePermit(\n IERC20Permit token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/ERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721.sol\";\nimport \"./IERC721Receiver.sol\";\nimport \"./extensions/IERC721Metadata.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/Context.sol\";\nimport \"../../utils/Strings.sol\";\nimport \"../../utils/introspection/ERC165.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 */\ncontract ERC721 is Context, ERC165, IERC721, IERC721Metadata {\n using Address for address;\n using Strings for uint256;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to owner address\n mapping(uint256 => address) private _owners;\n\n // Mapping owner address to token count\n mapping(address => uint256) private _balances;\n\n // Mapping from token ID to approved address\n mapping(uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, 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 override returns (uint256) {\n require(owner != address(0), \"ERC721: address zero is not a valid owner\");\n return _balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n address owner = _owners[tokenId];\n require(owner != address(0), \"ERC721: invalid token ID\");\n return owner;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(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 override {\n address owner = ERC721.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not token owner nor approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n _requireMinted(tokenId);\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner nor approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner nor approved\");\n _safeTransfer(from, to, tokenId, data);\n }\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 * `data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\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 `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(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _transfer(from, to, tokenId);\n require(_checkOnERC721Received(from, to, tokenId, data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n * and stop existing when they are burned (`_burn`).\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _owners[tokenId] != address(0);\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n address owner = ERC721.ownerOf(tokenId);\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\n }\n\n /**\n * @dev Safely mints `tokenId` and transfers it to `to`.\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 virtual {\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(\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _mint(to, tokenId);\n require(\n _checkOnERC721Received(address(0), to, tokenId, data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\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 virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId);\n\n _balances[to] += 1;\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId);\n\n // Clear approvals\n _approve(address(0), tokenId);\n\n _balances[owner] -= 1;\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId);\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(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId);\n\n // Clear approvals from the previous owner\n _approve(address(0), tokenId);\n\n _balances[from] -= 1;\n _balances[to] += 1;\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ERC721.ownerOf(tokenId), to, tokenId);\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(\n address owner,\n address operator,\n bool approved\n ) internal virtual {\n require(owner != operator, \"ERC721: approve to caller\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Reverts if the `tokenId` has not been minted yet.\n */\n function _requireMinted(uint256 tokenId) internal view virtual {\n require(_exists(tokenId), \"ERC721: invalid token ID\");\n }\n\n /**\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n * 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 * @return bool whether the call correctly returned the expected magic value\n */\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) private returns (bool) {\n if (to.isContract()) {\n try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n return retval == IERC721Receiver.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\"ERC721: transfer to non ERC721Receiver implementer\");\n } else {\n /// @solidity memory-safe-assembly\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting\n * and burning.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be\n * transferred to `to`.\n * - When `from` is zero, `tokenId` will be minted for `to`.\n * - When `to` is zero, ``from``'s `tokenId` will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../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 v4.7.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n\n /**\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 {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns 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 v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `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/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.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 *\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://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @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}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165Storage.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165Storage.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./ERC165.sol\";\n\n/**\n * @dev Storage based implementation of the {IERC165} interface.\n *\n * Contracts may inherit from this and call {_registerInterface} to declare\n * their support of an interface.\n */\nabstract contract ERC165Storage is ERC165 {\n /**\n * @dev Mapping of interface ids to whether or not it's supported.\n */\n mapping(bytes4 => bool) private _supportedInterfaces;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return super.supportsInterface(interfaceId) || _supportedInterfaces[interfaceId];\n }\n\n /**\n * @dev Registers the contract as an implementer of the interface defined by\n * `interfaceId`. Support of the actual ERC165 interface is automatic and\n * registering its interface id is not required.\n *\n * See {IERC165-supportsInterface}.\n *\n * Requirements:\n *\n * - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`).\n */\n function _registerInterface(bytes4 interfaceId) internal virtual {\n require(interfaceId != 0xffffffff, \"ERC165: invalid interface id\");\n _supportedInterfaces[interfaceId] = true;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _HEX_SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\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 // Inspired by OraclizeAPI's implementation - MIT licence\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\n\n if (value == 0) {\n return \"0\";\n }\n uint256 temp = value;\n uint256 digits;\n while (temp != 0) {\n digits++;\n temp /= 10;\n }\n bytes memory buffer = new bytes(digits);\n while (value != 0) {\n digits -= 1;\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\n value /= 10;\n }\n return string(buffer);\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 if (value == 0) {\n return \"0x00\";\n }\n uint256 temp = value;\n uint256 length = 0;\n while (temp != 0) {\n length++;\n temp >>= 8;\n }\n return toHexString(value, length);\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 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_SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\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 representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "@prb/math/src/Common.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\n// Common.sol\n//\n// Common mathematical functions used in both SD59x18 and UD60x18. Note that these global functions do not\n// always operate with SD59x18 and UD60x18 numbers.\n\n/*//////////////////////////////////////////////////////////////////////////\n CUSTOM ERRORS\n//////////////////////////////////////////////////////////////////////////*/\n\n/// @notice Thrown when the resultant value in {mulDiv} overflows uint256.\nerror PRBMath_MulDiv_Overflow(uint256 x, uint256 y, uint256 denominator);\n\n/// @notice Thrown when the resultant value in {mulDiv18} overflows uint256.\nerror PRBMath_MulDiv18_Overflow(uint256 x, uint256 y);\n\n/// @notice Thrown when one of the inputs passed to {mulDivSigned} is `type(int256).min`.\nerror PRBMath_MulDivSigned_InputTooSmall();\n\n/// @notice Thrown when the resultant value in {mulDivSigned} overflows int256.\nerror PRBMath_MulDivSigned_Overflow(int256 x, int256 y);\n\n/*//////////////////////////////////////////////////////////////////////////\n CONSTANTS\n//////////////////////////////////////////////////////////////////////////*/\n\n/// @dev The maximum value a uint128 number can have.\nuint128 constant MAX_UINT128 = type(uint128).max;\n\n/// @dev The maximum value a uint40 number can have.\nuint40 constant MAX_UINT40 = type(uint40).max;\n\n/// @dev The unit number, which the decimal precision of the fixed-point types.\nuint256 constant UNIT = 1e18;\n\n/// @dev The unit number inverted mod 2^256.\nuint256 constant UNIT_INVERSE = 78156646155174841979727994598816262306175212592076161876661_508869554232690281;\n\n/// @dev The the largest power of two that divides the decimal value of `UNIT`. The logarithm of this value is the least significant\n/// bit in the binary representation of `UNIT`.\nuint256 constant UNIT_LPOTD = 262144;\n\n/*//////////////////////////////////////////////////////////////////////////\n FUNCTIONS\n//////////////////////////////////////////////////////////////////////////*/\n\n/// @notice Calculates the binary exponent of x using the binary fraction method.\n/// @dev Has to use 192.64-bit fixed-point numbers. See https://ethereum.stackexchange.com/a/96594/24693.\n/// @param x The exponent as an unsigned 192.64-bit fixed-point number.\n/// @return result The result as an unsigned 60.18-decimal fixed-point number.\n/// @custom:smtchecker abstract-function-nondet\nfunction exp2(uint256 x) pure returns (uint256 result) {\n unchecked {\n // Start from 0.5 in the 192.64-bit fixed-point format.\n result = 0x800000000000000000000000000000000000000000000000;\n\n // The following logic multiplies the result by $\\sqrt{2^{-i}}$ when the bit at position i is 1. Key points:\n //\n // 1. Intermediate results will not overflow, as the starting point is 2^191 and all magic factors are under 2^65.\n // 2. The rationale for organizing the if statements into groups of 8 is gas savings. If the result of performing\n // a bitwise AND operation between x and any value in the array [0x80; 0x40; 0x20; 0x10; 0x08; 0x04; 0x02; 0x01] is 1,\n // we know that `x & 0xFF` is also 1.\n if (x & 0xFF00000000000000 > 0) {\n if (x & 0x8000000000000000 > 0) {\n result = (result * 0x16A09E667F3BCC909) >> 64;\n }\n if (x & 0x4000000000000000 > 0) {\n result = (result * 0x1306FE0A31B7152DF) >> 64;\n }\n if (x & 0x2000000000000000 > 0) {\n result = (result * 0x1172B83C7D517ADCE) >> 64;\n }\n if (x & 0x1000000000000000 > 0) {\n result = (result * 0x10B5586CF9890F62A) >> 64;\n }\n if (x & 0x800000000000000 > 0) {\n result = (result * 0x1059B0D31585743AE) >> 64;\n }\n if (x & 0x400000000000000 > 0) {\n result = (result * 0x102C9A3E778060EE7) >> 64;\n }\n if (x & 0x200000000000000 > 0) {\n result = (result * 0x10163DA9FB33356D8) >> 64;\n }\n if (x & 0x100000000000000 > 0) {\n result = (result * 0x100B1AFA5ABCBED61) >> 64;\n }\n }\n\n if (x & 0xFF000000000000 > 0) {\n if (x & 0x80000000000000 > 0) {\n result = (result * 0x10058C86DA1C09EA2) >> 64;\n }\n if (x & 0x40000000000000 > 0) {\n result = (result * 0x1002C605E2E8CEC50) >> 64;\n }\n if (x & 0x20000000000000 > 0) {\n result = (result * 0x100162F3904051FA1) >> 64;\n }\n if (x & 0x10000000000000 > 0) {\n result = (result * 0x1000B175EFFDC76BA) >> 64;\n }\n if (x & 0x8000000000000 > 0) {\n result = (result * 0x100058BA01FB9F96D) >> 64;\n }\n if (x & 0x4000000000000 > 0) {\n result = (result * 0x10002C5CC37DA9492) >> 64;\n }\n if (x & 0x2000000000000 > 0) {\n result = (result * 0x1000162E525EE0547) >> 64;\n }\n if (x & 0x1000000000000 > 0) {\n result = (result * 0x10000B17255775C04) >> 64;\n }\n }\n\n if (x & 0xFF0000000000 > 0) {\n if (x & 0x800000000000 > 0) {\n result = (result * 0x1000058B91B5BC9AE) >> 64;\n }\n if (x & 0x400000000000 > 0) {\n result = (result * 0x100002C5C89D5EC6D) >> 64;\n }\n if (x & 0x200000000000 > 0) {\n result = (result * 0x10000162E43F4F831) >> 64;\n }\n if (x & 0x100000000000 > 0) {\n result = (result * 0x100000B1721BCFC9A) >> 64;\n }\n if (x & 0x80000000000 > 0) {\n result = (result * 0x10000058B90CF1E6E) >> 64;\n }\n if (x & 0x40000000000 > 0) {\n result = (result * 0x1000002C5C863B73F) >> 64;\n }\n if (x & 0x20000000000 > 0) {\n result = (result * 0x100000162E430E5A2) >> 64;\n }\n if (x & 0x10000000000 > 0) {\n result = (result * 0x1000000B172183551) >> 64;\n }\n }\n\n if (x & 0xFF00000000 > 0) {\n if (x & 0x8000000000 > 0) {\n result = (result * 0x100000058B90C0B49) >> 64;\n }\n if (x & 0x4000000000 > 0) {\n result = (result * 0x10000002C5C8601CC) >> 64;\n }\n if (x & 0x2000000000 > 0) {\n result = (result * 0x1000000162E42FFF0) >> 64;\n }\n if (x & 0x1000000000 > 0) {\n result = (result * 0x10000000B17217FBB) >> 64;\n }\n if (x & 0x800000000 > 0) {\n result = (result * 0x1000000058B90BFCE) >> 64;\n }\n if (x & 0x400000000 > 0) {\n result = (result * 0x100000002C5C85FE3) >> 64;\n }\n if (x & 0x200000000 > 0) {\n result = (result * 0x10000000162E42FF1) >> 64;\n }\n if (x & 0x100000000 > 0) {\n result = (result * 0x100000000B17217F8) >> 64;\n }\n }\n\n if (x & 0xFF000000 > 0) {\n if (x & 0x80000000 > 0) {\n result = (result * 0x10000000058B90BFC) >> 64;\n }\n if (x & 0x40000000 > 0) {\n result = (result * 0x1000000002C5C85FE) >> 64;\n }\n if (x & 0x20000000 > 0) {\n result = (result * 0x100000000162E42FF) >> 64;\n }\n if (x & 0x10000000 > 0) {\n result = (result * 0x1000000000B17217F) >> 64;\n }\n if (x & 0x8000000 > 0) {\n result = (result * 0x100000000058B90C0) >> 64;\n }\n if (x & 0x4000000 > 0) {\n result = (result * 0x10000000002C5C860) >> 64;\n }\n if (x & 0x2000000 > 0) {\n result = (result * 0x1000000000162E430) >> 64;\n }\n if (x & 0x1000000 > 0) {\n result = (result * 0x10000000000B17218) >> 64;\n }\n }\n\n if (x & 0xFF0000 > 0) {\n if (x & 0x800000 > 0) {\n result = (result * 0x1000000000058B90C) >> 64;\n }\n if (x & 0x400000 > 0) {\n result = (result * 0x100000000002C5C86) >> 64;\n }\n if (x & 0x200000 > 0) {\n result = (result * 0x10000000000162E43) >> 64;\n }\n if (x & 0x100000 > 0) {\n result = (result * 0x100000000000B1721) >> 64;\n }\n if (x & 0x80000 > 0) {\n result = (result * 0x10000000000058B91) >> 64;\n }\n if (x & 0x40000 > 0) {\n result = (result * 0x1000000000002C5C8) >> 64;\n }\n if (x & 0x20000 > 0) {\n result = (result * 0x100000000000162E4) >> 64;\n }\n if (x & 0x10000 > 0) {\n result = (result * 0x1000000000000B172) >> 64;\n }\n }\n\n if (x & 0xFF00 > 0) {\n if (x & 0x8000 > 0) {\n result = (result * 0x100000000000058B9) >> 64;\n }\n if (x & 0x4000 > 0) {\n result = (result * 0x10000000000002C5D) >> 64;\n }\n if (x & 0x2000 > 0) {\n result = (result * 0x1000000000000162E) >> 64;\n }\n if (x & 0x1000 > 0) {\n result = (result * 0x10000000000000B17) >> 64;\n }\n if (x & 0x800 > 0) {\n result = (result * 0x1000000000000058C) >> 64;\n }\n if (x & 0x400 > 0) {\n result = (result * 0x100000000000002C6) >> 64;\n }\n if (x & 0x200 > 0) {\n result = (result * 0x10000000000000163) >> 64;\n }\n if (x & 0x100 > 0) {\n result = (result * 0x100000000000000B1) >> 64;\n }\n }\n\n if (x & 0xFF > 0) {\n if (x & 0x80 > 0) {\n result = (result * 0x10000000000000059) >> 64;\n }\n if (x & 0x40 > 0) {\n result = (result * 0x1000000000000002C) >> 64;\n }\n if (x & 0x20 > 0) {\n result = (result * 0x10000000000000016) >> 64;\n }\n if (x & 0x10 > 0) {\n result = (result * 0x1000000000000000B) >> 64;\n }\n if (x & 0x8 > 0) {\n result = (result * 0x10000000000000006) >> 64;\n }\n if (x & 0x4 > 0) {\n result = (result * 0x10000000000000003) >> 64;\n }\n if (x & 0x2 > 0) {\n result = (result * 0x10000000000000001) >> 64;\n }\n if (x & 0x1 > 0) {\n result = (result * 0x10000000000000001) >> 64;\n }\n }\n\n // In the code snippet below, two operations are executed simultaneously:\n //\n // 1. The result is multiplied by $(2^n + 1)$, where $2^n$ represents the integer part, and the additional 1\n // accounts for the initial guess of 0.5. This is achieved by subtracting from 191 instead of 192.\n // 2. The result is then converted to an unsigned 60.18-decimal fixed-point format.\n //\n // The underlying logic is based on the relationship $2^{191-ip} = 2^{ip} / 2^{191}$, where $ip$ denotes the,\n // integer part, $2^n$.\n result *= UNIT;\n result >>= (191 - (x >> 64));\n }\n}\n\n/// @notice Finds the zero-based index of the first 1 in the binary representation of x.\n///\n/// @dev See the note on \"msb\" in this Wikipedia article: https://en.wikipedia.org/wiki/Find_first_set\n///\n/// Each step in this implementation is equivalent to this high-level code:\n///\n/// ```solidity\n/// if (x >= 2 ** 128) {\n/// x >>= 128;\n/// result += 128;\n/// }\n/// ```\n///\n/// Where 128 is replaced with each respective power of two factor. See the full high-level implementation here:\n/// https://gist.github.com/PaulRBerg/f932f8693f2733e30c4d479e8e980948\n///\n/// The Yul instructions used below are:\n///\n/// - \"gt\" is \"greater than\"\n/// - \"or\" is the OR bitwise operator\n/// - \"shl\" is \"shift left\"\n/// - \"shr\" is \"shift right\"\n///\n/// @param x The uint256 number for which to find the index of the most significant bit.\n/// @return result The index of the most significant bit as a uint256.\n/// @custom:smtchecker abstract-function-nondet\nfunction msb(uint256 x) pure returns (uint256 result) {\n // 2^128\n assembly (\"memory-safe\") {\n let factor := shl(7, gt(x, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))\n x := shr(factor, x)\n result := or(result, factor)\n }\n // 2^64\n assembly (\"memory-safe\") {\n let factor := shl(6, gt(x, 0xFFFFFFFFFFFFFFFF))\n x := shr(factor, x)\n result := or(result, factor)\n }\n // 2^32\n assembly (\"memory-safe\") {\n let factor := shl(5, gt(x, 0xFFFFFFFF))\n x := shr(factor, x)\n result := or(result, factor)\n }\n // 2^16\n assembly (\"memory-safe\") {\n let factor := shl(4, gt(x, 0xFFFF))\n x := shr(factor, x)\n result := or(result, factor)\n }\n // 2^8\n assembly (\"memory-safe\") {\n let factor := shl(3, gt(x, 0xFF))\n x := shr(factor, x)\n result := or(result, factor)\n }\n // 2^4\n assembly (\"memory-safe\") {\n let factor := shl(2, gt(x, 0xF))\n x := shr(factor, x)\n result := or(result, factor)\n }\n // 2^2\n assembly (\"memory-safe\") {\n let factor := shl(1, gt(x, 0x3))\n x := shr(factor, x)\n result := or(result, factor)\n }\n // 2^1\n // No need to shift x any more.\n assembly (\"memory-safe\") {\n let factor := gt(x, 0x1)\n result := or(result, factor)\n }\n}\n\n/// @notice Calculates x*y÷denominator with 512-bit precision.\n///\n/// @dev Credits to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv.\n///\n/// Notes:\n/// - The result is rounded toward zero.\n///\n/// Requirements:\n/// - The denominator must not be zero.\n/// - The result must fit in uint256.\n///\n/// @param x The multiplicand as a uint256.\n/// @param y The multiplier as a uint256.\n/// @param denominator The divisor as a uint256.\n/// @return result The result as a uint256.\n/// @custom:smtchecker abstract-function-nondet\nfunction mulDiv(uint256 x, uint256 y, uint256 denominator) pure returns (uint256 result) {\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; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly (\"memory-safe\") {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\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 unchecked {\n return prod0 / denominator;\n }\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n if (prod1 >= denominator) {\n revert PRBMath_MulDiv_Overflow(x, y, denominator);\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 (\"memory-safe\") {\n // Compute remainder using the mulmod Yul instruction.\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 unchecked {\n // Calculate the largest power of two divisor of the denominator using the unary operator ~. This operation cannot overflow\n // because the denominator cannot be zero at this point in the function execution. The result is always >= 1.\n // For more detail, see https://cs.stackexchange.com/q/138556/92363.\n uint256 lpotdod = denominator & (~denominator + 1);\n uint256 flippedLpotdod;\n\n assembly (\"memory-safe\") {\n // Factor powers of two out of denominator.\n denominator := div(denominator, lpotdod)\n\n // Divide [prod1 prod0] by lpotdod.\n prod0 := div(prod0, lpotdod)\n\n // Get the flipped value `2^256 / lpotdod`. If the `lpotdod` is zero, the flipped value is one.\n // `sub(0, lpotdod)` produces the two's complement version of `lpotdod`, which is equivalent to flipping all the bits.\n // However, `div` interprets this value as an unsigned value: https://ethereum.stackexchange.com/q/147168/24693\n flippedLpotdod := add(div(sub(0, lpotdod), lpotdod), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * flippedLpotdod;\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 works\n // 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 }\n}\n\n/// @notice Calculates x*y÷1e18 with 512-bit precision.\n///\n/// @dev A variant of {mulDiv} with constant folding, i.e. in which the denominator is hard coded to 1e18.\n///\n/// Notes:\n/// - The body is purposely left uncommented; to understand how this works, see the documentation in {mulDiv}.\n/// - The result is rounded toward zero.\n/// - We take as an axiom that the result cannot be `MAX_UINT256` when x and y solve the following system of equations:\n///\n/// $$\n/// \\begin{cases}\n/// x * y = MAX\\_UINT256 * UNIT \\\\\n/// (x * y) \\% UNIT \\geq \\frac{UNIT}{2}\n/// \\end{cases}\n/// $$\n///\n/// Requirements:\n/// - Refer to the requirements in {mulDiv}.\n/// - The result must fit in uint256.\n///\n/// @param x The multiplicand as an unsigned 60.18-decimal fixed-point number.\n/// @param y The multiplier as an unsigned 60.18-decimal fixed-point number.\n/// @return result The result as an unsigned 60.18-decimal fixed-point number.\n/// @custom:smtchecker abstract-function-nondet\nfunction mulDiv18(uint256 x, uint256 y) pure returns (uint256 result) {\n uint256 prod0;\n uint256 prod1;\n assembly (\"memory-safe\") {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n if (prod1 == 0) {\n unchecked {\n return prod0 / UNIT;\n }\n }\n\n if (prod1 >= UNIT) {\n revert PRBMath_MulDiv18_Overflow(x, y);\n }\n\n uint256 remainder;\n assembly (\"memory-safe\") {\n remainder := mulmod(x, y, UNIT)\n result :=\n mul(\n or(\n div(sub(prod0, remainder), UNIT_LPOTD),\n mul(sub(prod1, gt(remainder, prod0)), add(div(sub(0, UNIT_LPOTD), UNIT_LPOTD), 1))\n ),\n UNIT_INVERSE\n )\n }\n}\n\n/// @notice Calculates x*y÷denominator with 512-bit precision.\n///\n/// @dev This is an extension of {mulDiv} for signed numbers, which works by computing the signs and the absolute values separately.\n///\n/// Notes:\n/// - The result is rounded toward zero.\n///\n/// Requirements:\n/// - Refer to the requirements in {mulDiv}.\n/// - None of the inputs can be `type(int256).min`.\n/// - The result must fit in int256.\n///\n/// @param x The multiplicand as an int256.\n/// @param y The multiplier as an int256.\n/// @param denominator The divisor as an int256.\n/// @return result The result as an int256.\n/// @custom:smtchecker abstract-function-nondet\nfunction mulDivSigned(int256 x, int256 y, int256 denominator) pure returns (int256 result) {\n if (x == type(int256).min || y == type(int256).min || denominator == type(int256).min) {\n revert PRBMath_MulDivSigned_InputTooSmall();\n }\n\n // Get hold of the absolute values of x, y and the denominator.\n uint256 xAbs;\n uint256 yAbs;\n uint256 dAbs;\n unchecked {\n xAbs = x < 0 ? uint256(-x) : uint256(x);\n yAbs = y < 0 ? uint256(-y) : uint256(y);\n dAbs = denominator < 0 ? uint256(-denominator) : uint256(denominator);\n }\n\n // Compute the absolute value of x*y÷denominator. The result must fit in int256.\n uint256 resultAbs = mulDiv(xAbs, yAbs, dAbs);\n if (resultAbs > uint256(type(int256).max)) {\n revert PRBMath_MulDivSigned_Overflow(x, y);\n }\n\n // Get the signs of x, y and the denominator.\n uint256 sx;\n uint256 sy;\n uint256 sd;\n assembly (\"memory-safe\") {\n // \"sgt\" is the \"signed greater than\" assembly instruction and \"sub(0,1)\" is -1 in two's complement.\n sx := sgt(x, sub(0, 1))\n sy := sgt(y, sub(0, 1))\n sd := sgt(denominator, sub(0, 1))\n }\n\n // XOR over sx, sy and sd. What this does is to check whether there are 1 or 3 negative signs in the inputs.\n // If there are, the result should be negative. Otherwise, it should be positive.\n unchecked {\n result = sx ^ sy ^ sd == 0 ? -int256(resultAbs) : int256(resultAbs);\n }\n}\n\n/// @notice Calculates the square root of x using the Babylonian method.\n///\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\n///\n/// Notes:\n/// - If x is not a perfect square, the result is rounded down.\n/// - Credits to OpenZeppelin for the explanations in comments below.\n///\n/// @param x The uint256 number for which to calculate the square root.\n/// @return result The result as a uint256.\n/// @custom:smtchecker abstract-function-nondet\nfunction sqrt(uint256 x) pure returns (uint256 result) {\n if (x == 0) {\n return 0;\n }\n\n // For our first guess, we calculate the biggest power of 2 which is smaller than the square root of x.\n //\n // We know that the \"msb\" (most significant bit) of x is a power of 2 such that we have:\n //\n // $$\n // msb(x) <= x <= 2*msb(x)$\n // $$\n //\n // We write $msb(x)$ as $2^k$, and we get:\n //\n // $$\n // k = log_2(x)\n // $$\n //\n // Thus, we can write the initial inequality as:\n //\n // $$\n // 2^{log_2(x)} <= x <= 2*2^{log_2(x)+1} \\\\\n // sqrt(2^k) <= sqrt(x) < sqrt(2^{k+1}) \\\\\n // 2^{k/2} <= sqrt(x) < 2^{(k+1)/2} <= 2^{(k/2)+1}\n // $$\n //\n // Consequently, $2^{log_2(x) /2} is a good first approximation of sqrt(x) with at least one correct bit.\n uint256 xAux = uint256(x);\n result = 1;\n if (xAux >= 2 ** 128) {\n xAux >>= 128;\n result <<= 64;\n }\n if (xAux >= 2 ** 64) {\n xAux >>= 64;\n result <<= 32;\n }\n if (xAux >= 2 ** 32) {\n xAux >>= 32;\n result <<= 16;\n }\n if (xAux >= 2 ** 16) {\n xAux >>= 16;\n result <<= 8;\n }\n if (xAux >= 2 ** 8) {\n xAux >>= 8;\n result <<= 4;\n }\n if (xAux >= 2 ** 4) {\n xAux >>= 4;\n result <<= 2;\n }\n if (xAux >= 2 ** 2) {\n result <<= 1;\n }\n\n // At this point, `result` is an estimation with at least one bit of precision. We know the true value has at\n // most 128 bits, since it is the square root of a uint256. Newton's method converges quadratically (precision\n // doubles at every iteration). We thus need at most 7 iteration to turn our partial result with one bit of\n // precision into the expected uint128 result.\n unchecked {\n result = (result + x / result) >> 1;\n result = (result + x / result) >> 1;\n result = (result + x / result) >> 1;\n result = (result + x / result) >> 1;\n result = (result + x / result) >> 1;\n result = (result + x / result) >> 1;\n result = (result + x / result) >> 1;\n\n // If x is not a perfect square, round the result toward zero.\n uint256 roundedResult = x / result;\n if (result >= roundedResult) {\n result = roundedResult;\n }\n }\n}\n" + }, + "@prb/math/src/sd1x18/Casting.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport \"../Common.sol\" as Common;\nimport \"./Errors.sol\" as CastingErrors;\nimport { SD59x18 } from \"../sd59x18/ValueType.sol\";\nimport { UD2x18 } from \"../ud2x18/ValueType.sol\";\nimport { UD60x18 } from \"../ud60x18/ValueType.sol\";\nimport { SD1x18 } from \"./ValueType.sol\";\n\n/// @notice Casts an SD1x18 number into SD59x18.\n/// @dev There is no overflow check because the domain of SD1x18 is a subset of SD59x18.\nfunction intoSD59x18(SD1x18 x) pure returns (SD59x18 result) {\n result = SD59x18.wrap(int256(SD1x18.unwrap(x)));\n}\n\n/// @notice Casts an SD1x18 number into UD2x18.\n/// - x must be positive.\nfunction intoUD2x18(SD1x18 x) pure returns (UD2x18 result) {\n int64 xInt = SD1x18.unwrap(x);\n if (xInt < 0) {\n revert CastingErrors.PRBMath_SD1x18_ToUD2x18_Underflow(x);\n }\n result = UD2x18.wrap(uint64(xInt));\n}\n\n/// @notice Casts an SD1x18 number into UD60x18.\n/// @dev Requirements:\n/// - x must be positive.\nfunction intoUD60x18(SD1x18 x) pure returns (UD60x18 result) {\n int64 xInt = SD1x18.unwrap(x);\n if (xInt < 0) {\n revert CastingErrors.PRBMath_SD1x18_ToUD60x18_Underflow(x);\n }\n result = UD60x18.wrap(uint64(xInt));\n}\n\n/// @notice Casts an SD1x18 number into uint256.\n/// @dev Requirements:\n/// - x must be positive.\nfunction intoUint256(SD1x18 x) pure returns (uint256 result) {\n int64 xInt = SD1x18.unwrap(x);\n if (xInt < 0) {\n revert CastingErrors.PRBMath_SD1x18_ToUint256_Underflow(x);\n }\n result = uint256(uint64(xInt));\n}\n\n/// @notice Casts an SD1x18 number into uint128.\n/// @dev Requirements:\n/// - x must be positive.\nfunction intoUint128(SD1x18 x) pure returns (uint128 result) {\n int64 xInt = SD1x18.unwrap(x);\n if (xInt < 0) {\n revert CastingErrors.PRBMath_SD1x18_ToUint128_Underflow(x);\n }\n result = uint128(uint64(xInt));\n}\n\n/// @notice Casts an SD1x18 number into uint40.\n/// @dev Requirements:\n/// - x must be positive.\n/// - x must be less than or equal to `MAX_UINT40`.\nfunction intoUint40(SD1x18 x) pure returns (uint40 result) {\n int64 xInt = SD1x18.unwrap(x);\n if (xInt < 0) {\n revert CastingErrors.PRBMath_SD1x18_ToUint40_Underflow(x);\n }\n if (xInt > int64(uint64(Common.MAX_UINT40))) {\n revert CastingErrors.PRBMath_SD1x18_ToUint40_Overflow(x);\n }\n result = uint40(uint64(xInt));\n}\n\n/// @notice Alias for {wrap}.\nfunction sd1x18(int64 x) pure returns (SD1x18 result) {\n result = SD1x18.wrap(x);\n}\n\n/// @notice Unwraps an SD1x18 number into int64.\nfunction unwrap(SD1x18 x) pure returns (int64 result) {\n result = SD1x18.unwrap(x);\n}\n\n/// @notice Wraps an int64 number into SD1x18.\nfunction wrap(int64 x) pure returns (SD1x18 result) {\n result = SD1x18.wrap(x);\n}\n" + }, + "@prb/math/src/sd1x18/Constants.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport { SD1x18 } from \"./ValueType.sol\";\n\n/// @dev Euler's number as an SD1x18 number.\nSD1x18 constant E = SD1x18.wrap(2_718281828459045235);\n\n/// @dev The maximum value an SD1x18 number can have.\nint64 constant uMAX_SD1x18 = 9_223372036854775807;\nSD1x18 constant MAX_SD1x18 = SD1x18.wrap(uMAX_SD1x18);\n\n/// @dev The maximum value an SD1x18 number can have.\nint64 constant uMIN_SD1x18 = -9_223372036854775808;\nSD1x18 constant MIN_SD1x18 = SD1x18.wrap(uMIN_SD1x18);\n\n/// @dev PI as an SD1x18 number.\nSD1x18 constant PI = SD1x18.wrap(3_141592653589793238);\n\n/// @dev The unit number, which gives the decimal precision of SD1x18.\nSD1x18 constant UNIT = SD1x18.wrap(1e18);\nint64 constant uUNIT = 1e18;\n" + }, + "@prb/math/src/sd1x18/Errors.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport { SD1x18 } from \"./ValueType.sol\";\n\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in UD2x18.\nerror PRBMath_SD1x18_ToUD2x18_Underflow(SD1x18 x);\n\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in UD60x18.\nerror PRBMath_SD1x18_ToUD60x18_Underflow(SD1x18 x);\n\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint128.\nerror PRBMath_SD1x18_ToUint128_Underflow(SD1x18 x);\n\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint256.\nerror PRBMath_SD1x18_ToUint256_Underflow(SD1x18 x);\n\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint40.\nerror PRBMath_SD1x18_ToUint40_Overflow(SD1x18 x);\n\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint40.\nerror PRBMath_SD1x18_ToUint40_Underflow(SD1x18 x);\n" + }, + "@prb/math/src/sd1x18/ValueType.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport \"./Casting.sol\" as Casting;\n\n/// @notice The signed 1.18-decimal fixed-point number representation, which can have up to 1 digit and up to 18\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\n/// type int64. This is useful when end users want to use int64 to save gas, e.g. with tight variable packing in contract\n/// storage.\ntype SD1x18 is int64;\n\n/*//////////////////////////////////////////////////////////////////////////\n CASTING\n//////////////////////////////////////////////////////////////////////////*/\n\nusing {\n Casting.intoSD59x18,\n Casting.intoUD2x18,\n Casting.intoUD60x18,\n Casting.intoUint256,\n Casting.intoUint128,\n Casting.intoUint40,\n Casting.unwrap\n} for SD1x18 global;\n" + }, + "@prb/math/src/sd59x18/Casting.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport \"./Errors.sol\" as CastingErrors;\nimport { MAX_UINT128, MAX_UINT40 } from \"../Common.sol\";\nimport { uMAX_SD1x18, uMIN_SD1x18 } from \"../sd1x18/Constants.sol\";\nimport { SD1x18 } from \"../sd1x18/ValueType.sol\";\nimport { uMAX_UD2x18 } from \"../ud2x18/Constants.sol\";\nimport { UD2x18 } from \"../ud2x18/ValueType.sol\";\nimport { UD60x18 } from \"../ud60x18/ValueType.sol\";\nimport { SD59x18 } from \"./ValueType.sol\";\n\n/// @notice Casts an SD59x18 number into int256.\n/// @dev This is basically a functional alias for {unwrap}.\nfunction intoInt256(SD59x18 x) pure returns (int256 result) {\n result = SD59x18.unwrap(x);\n}\n\n/// @notice Casts an SD59x18 number into SD1x18.\n/// @dev Requirements:\n/// - x must be greater than or equal to `uMIN_SD1x18`.\n/// - x must be less than or equal to `uMAX_SD1x18`.\nfunction intoSD1x18(SD59x18 x) pure returns (SD1x18 result) {\n int256 xInt = SD59x18.unwrap(x);\n if (xInt < uMIN_SD1x18) {\n revert CastingErrors.PRBMath_SD59x18_IntoSD1x18_Underflow(x);\n }\n if (xInt > uMAX_SD1x18) {\n revert CastingErrors.PRBMath_SD59x18_IntoSD1x18_Overflow(x);\n }\n result = SD1x18.wrap(int64(xInt));\n}\n\n/// @notice Casts an SD59x18 number into UD2x18.\n/// @dev Requirements:\n/// - x must be positive.\n/// - x must be less than or equal to `uMAX_UD2x18`.\nfunction intoUD2x18(SD59x18 x) pure returns (UD2x18 result) {\n int256 xInt = SD59x18.unwrap(x);\n if (xInt < 0) {\n revert CastingErrors.PRBMath_SD59x18_IntoUD2x18_Underflow(x);\n }\n if (xInt > int256(uint256(uMAX_UD2x18))) {\n revert CastingErrors.PRBMath_SD59x18_IntoUD2x18_Overflow(x);\n }\n result = UD2x18.wrap(uint64(uint256(xInt)));\n}\n\n/// @notice Casts an SD59x18 number into UD60x18.\n/// @dev Requirements:\n/// - x must be positive.\nfunction intoUD60x18(SD59x18 x) pure returns (UD60x18 result) {\n int256 xInt = SD59x18.unwrap(x);\n if (xInt < 0) {\n revert CastingErrors.PRBMath_SD59x18_IntoUD60x18_Underflow(x);\n }\n result = UD60x18.wrap(uint256(xInt));\n}\n\n/// @notice Casts an SD59x18 number into uint256.\n/// @dev Requirements:\n/// - x must be positive.\nfunction intoUint256(SD59x18 x) pure returns (uint256 result) {\n int256 xInt = SD59x18.unwrap(x);\n if (xInt < 0) {\n revert CastingErrors.PRBMath_SD59x18_IntoUint256_Underflow(x);\n }\n result = uint256(xInt);\n}\n\n/// @notice Casts an SD59x18 number into uint128.\n/// @dev Requirements:\n/// - x must be positive.\n/// - x must be less than or equal to `uMAX_UINT128`.\nfunction intoUint128(SD59x18 x) pure returns (uint128 result) {\n int256 xInt = SD59x18.unwrap(x);\n if (xInt < 0) {\n revert CastingErrors.PRBMath_SD59x18_IntoUint128_Underflow(x);\n }\n if (xInt > int256(uint256(MAX_UINT128))) {\n revert CastingErrors.PRBMath_SD59x18_IntoUint128_Overflow(x);\n }\n result = uint128(uint256(xInt));\n}\n\n/// @notice Casts an SD59x18 number into uint40.\n/// @dev Requirements:\n/// - x must be positive.\n/// - x must be less than or equal to `MAX_UINT40`.\nfunction intoUint40(SD59x18 x) pure returns (uint40 result) {\n int256 xInt = SD59x18.unwrap(x);\n if (xInt < 0) {\n revert CastingErrors.PRBMath_SD59x18_IntoUint40_Underflow(x);\n }\n if (xInt > int256(uint256(MAX_UINT40))) {\n revert CastingErrors.PRBMath_SD59x18_IntoUint40_Overflow(x);\n }\n result = uint40(uint256(xInt));\n}\n\n/// @notice Alias for {wrap}.\nfunction sd(int256 x) pure returns (SD59x18 result) {\n result = SD59x18.wrap(x);\n}\n\n/// @notice Alias for {wrap}.\nfunction sd59x18(int256 x) pure returns (SD59x18 result) {\n result = SD59x18.wrap(x);\n}\n\n/// @notice Unwraps an SD59x18 number into int256.\nfunction unwrap(SD59x18 x) pure returns (int256 result) {\n result = SD59x18.unwrap(x);\n}\n\n/// @notice Wraps an int256 number into SD59x18.\nfunction wrap(int256 x) pure returns (SD59x18 result) {\n result = SD59x18.wrap(x);\n}\n" + }, + "@prb/math/src/sd59x18/Constants.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport { SD59x18 } from \"./ValueType.sol\";\n\n// NOTICE: the \"u\" prefix stands for \"unwrapped\".\n\n/// @dev Euler's number as an SD59x18 number.\nSD59x18 constant E = SD59x18.wrap(2_718281828459045235);\n\n/// @dev The maximum input permitted in {exp}.\nint256 constant uEXP_MAX_INPUT = 133_084258667509499440;\nSD59x18 constant EXP_MAX_INPUT = SD59x18.wrap(uEXP_MAX_INPUT);\n\n/// @dev Any value less than this returns 0 in {exp}.\nint256 constant uEXP_MIN_THRESHOLD = -41_446531673892822322;\nSD59x18 constant EXP_MIN_THRESHOLD = SD59x18.wrap(uEXP_MIN_THRESHOLD);\n\n/// @dev The maximum input permitted in {exp2}.\nint256 constant uEXP2_MAX_INPUT = 192e18 - 1;\nSD59x18 constant EXP2_MAX_INPUT = SD59x18.wrap(uEXP2_MAX_INPUT);\n\n/// @dev Any value less than this returns 0 in {exp2}.\nint256 constant uEXP2_MIN_THRESHOLD = -59_794705707972522261;\nSD59x18 constant EXP2_MIN_THRESHOLD = SD59x18.wrap(uEXP2_MIN_THRESHOLD);\n\n/// @dev Half the UNIT number.\nint256 constant uHALF_UNIT = 0.5e18;\nSD59x18 constant HALF_UNIT = SD59x18.wrap(uHALF_UNIT);\n\n/// @dev $log_2(10)$ as an SD59x18 number.\nint256 constant uLOG2_10 = 3_321928094887362347;\nSD59x18 constant LOG2_10 = SD59x18.wrap(uLOG2_10);\n\n/// @dev $log_2(e)$ as an SD59x18 number.\nint256 constant uLOG2_E = 1_442695040888963407;\nSD59x18 constant LOG2_E = SD59x18.wrap(uLOG2_E);\n\n/// @dev The maximum value an SD59x18 number can have.\nint256 constant uMAX_SD59x18 = 57896044618658097711785492504343953926634992332820282019728_792003956564819967;\nSD59x18 constant MAX_SD59x18 = SD59x18.wrap(uMAX_SD59x18);\n\n/// @dev The maximum whole value an SD59x18 number can have.\nint256 constant uMAX_WHOLE_SD59x18 = 57896044618658097711785492504343953926634992332820282019728_000000000000000000;\nSD59x18 constant MAX_WHOLE_SD59x18 = SD59x18.wrap(uMAX_WHOLE_SD59x18);\n\n/// @dev The minimum value an SD59x18 number can have.\nint256 constant uMIN_SD59x18 = -57896044618658097711785492504343953926634992332820282019728_792003956564819968;\nSD59x18 constant MIN_SD59x18 = SD59x18.wrap(uMIN_SD59x18);\n\n/// @dev The minimum whole value an SD59x18 number can have.\nint256 constant uMIN_WHOLE_SD59x18 = -57896044618658097711785492504343953926634992332820282019728_000000000000000000;\nSD59x18 constant MIN_WHOLE_SD59x18 = SD59x18.wrap(uMIN_WHOLE_SD59x18);\n\n/// @dev PI as an SD59x18 number.\nSD59x18 constant PI = SD59x18.wrap(3_141592653589793238);\n\n/// @dev The unit number, which gives the decimal precision of SD59x18.\nint256 constant uUNIT = 1e18;\nSD59x18 constant UNIT = SD59x18.wrap(1e18);\n\n/// @dev The unit number squared.\nint256 constant uUNIT_SQUARED = 1e36;\nSD59x18 constant UNIT_SQUARED = SD59x18.wrap(uUNIT_SQUARED);\n\n/// @dev Zero as an SD59x18 number.\nSD59x18 constant ZERO = SD59x18.wrap(0);\n" + }, + "@prb/math/src/sd59x18/Errors.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport { SD59x18 } from \"./ValueType.sol\";\n\n/// @notice Thrown when taking the absolute value of `MIN_SD59x18`.\nerror PRBMath_SD59x18_Abs_MinSD59x18();\n\n/// @notice Thrown when ceiling a number overflows SD59x18.\nerror PRBMath_SD59x18_Ceil_Overflow(SD59x18 x);\n\n/// @notice Thrown when converting a basic integer to the fixed-point format overflows SD59x18.\nerror PRBMath_SD59x18_Convert_Overflow(int256 x);\n\n/// @notice Thrown when converting a basic integer to the fixed-point format underflows SD59x18.\nerror PRBMath_SD59x18_Convert_Underflow(int256 x);\n\n/// @notice Thrown when dividing two numbers and one of them is `MIN_SD59x18`.\nerror PRBMath_SD59x18_Div_InputTooSmall();\n\n/// @notice Thrown when dividing two numbers and one of the intermediary unsigned results overflows SD59x18.\nerror PRBMath_SD59x18_Div_Overflow(SD59x18 x, SD59x18 y);\n\n/// @notice Thrown when taking the natural exponent of a base greater than 133_084258667509499441.\nerror PRBMath_SD59x18_Exp_InputTooBig(SD59x18 x);\n\n/// @notice Thrown when taking the binary exponent of a base greater than 192e18.\nerror PRBMath_SD59x18_Exp2_InputTooBig(SD59x18 x);\n\n/// @notice Thrown when flooring a number underflows SD59x18.\nerror PRBMath_SD59x18_Floor_Underflow(SD59x18 x);\n\n/// @notice Thrown when taking the geometric mean of two numbers and their product is negative.\nerror PRBMath_SD59x18_Gm_NegativeProduct(SD59x18 x, SD59x18 y);\n\n/// @notice Thrown when taking the geometric mean of two numbers and multiplying them overflows SD59x18.\nerror PRBMath_SD59x18_Gm_Overflow(SD59x18 x, SD59x18 y);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\nerror PRBMath_SD59x18_IntoSD1x18_Overflow(SD59x18 x);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\nerror PRBMath_SD59x18_IntoSD1x18_Underflow(SD59x18 x);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\nerror PRBMath_SD59x18_IntoUD2x18_Overflow(SD59x18 x);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\nerror PRBMath_SD59x18_IntoUD2x18_Underflow(SD59x18 x);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD60x18.\nerror PRBMath_SD59x18_IntoUD60x18_Underflow(SD59x18 x);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\nerror PRBMath_SD59x18_IntoUint128_Overflow(SD59x18 x);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\nerror PRBMath_SD59x18_IntoUint128_Underflow(SD59x18 x);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint256.\nerror PRBMath_SD59x18_IntoUint256_Underflow(SD59x18 x);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\nerror PRBMath_SD59x18_IntoUint40_Overflow(SD59x18 x);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\nerror PRBMath_SD59x18_IntoUint40_Underflow(SD59x18 x);\n\n/// @notice Thrown when taking the logarithm of a number less than or equal to zero.\nerror PRBMath_SD59x18_Log_InputTooSmall(SD59x18 x);\n\n/// @notice Thrown when multiplying two numbers and one of the inputs is `MIN_SD59x18`.\nerror PRBMath_SD59x18_Mul_InputTooSmall();\n\n/// @notice Thrown when multiplying two numbers and the intermediary absolute result overflows SD59x18.\nerror PRBMath_SD59x18_Mul_Overflow(SD59x18 x, SD59x18 y);\n\n/// @notice Thrown when raising a number to a power and the intermediary absolute result overflows SD59x18.\nerror PRBMath_SD59x18_Powu_Overflow(SD59x18 x, uint256 y);\n\n/// @notice Thrown when taking the square root of a negative number.\nerror PRBMath_SD59x18_Sqrt_NegativeInput(SD59x18 x);\n\n/// @notice Thrown when the calculating the square root overflows SD59x18.\nerror PRBMath_SD59x18_Sqrt_Overflow(SD59x18 x);\n" + }, + "@prb/math/src/sd59x18/Helpers.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport { wrap } from \"./Casting.sol\";\nimport { SD59x18 } from \"./ValueType.sol\";\n\n/// @notice Implements the checked addition operation (+) in the SD59x18 type.\nfunction add(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\n return wrap(x.unwrap() + y.unwrap());\n}\n\n/// @notice Implements the AND (&) bitwise operation in the SD59x18 type.\nfunction and(SD59x18 x, int256 bits) pure returns (SD59x18 result) {\n return wrap(x.unwrap() & bits);\n}\n\n/// @notice Implements the AND (&) bitwise operation in the SD59x18 type.\nfunction and2(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\n return wrap(x.unwrap() & y.unwrap());\n}\n\n/// @notice Implements the equal (=) operation in the SD59x18 type.\nfunction eq(SD59x18 x, SD59x18 y) pure returns (bool result) {\n result = x.unwrap() == y.unwrap();\n}\n\n/// @notice Implements the greater than operation (>) in the SD59x18 type.\nfunction gt(SD59x18 x, SD59x18 y) pure returns (bool result) {\n result = x.unwrap() > y.unwrap();\n}\n\n/// @notice Implements the greater than or equal to operation (>=) in the SD59x18 type.\nfunction gte(SD59x18 x, SD59x18 y) pure returns (bool result) {\n result = x.unwrap() >= y.unwrap();\n}\n\n/// @notice Implements a zero comparison check function in the SD59x18 type.\nfunction isZero(SD59x18 x) pure returns (bool result) {\n result = x.unwrap() == 0;\n}\n\n/// @notice Implements the left shift operation (<<) in the SD59x18 type.\nfunction lshift(SD59x18 x, uint256 bits) pure returns (SD59x18 result) {\n result = wrap(x.unwrap() << bits);\n}\n\n/// @notice Implements the lower than operation (<) in the SD59x18 type.\nfunction lt(SD59x18 x, SD59x18 y) pure returns (bool result) {\n result = x.unwrap() < y.unwrap();\n}\n\n/// @notice Implements the lower than or equal to operation (<=) in the SD59x18 type.\nfunction lte(SD59x18 x, SD59x18 y) pure returns (bool result) {\n result = x.unwrap() <= y.unwrap();\n}\n\n/// @notice Implements the unchecked modulo operation (%) in the SD59x18 type.\nfunction mod(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\n result = wrap(x.unwrap() % y.unwrap());\n}\n\n/// @notice Implements the not equal operation (!=) in the SD59x18 type.\nfunction neq(SD59x18 x, SD59x18 y) pure returns (bool result) {\n result = x.unwrap() != y.unwrap();\n}\n\n/// @notice Implements the NOT (~) bitwise operation in the SD59x18 type.\nfunction not(SD59x18 x) pure returns (SD59x18 result) {\n result = wrap(~x.unwrap());\n}\n\n/// @notice Implements the OR (|) bitwise operation in the SD59x18 type.\nfunction or(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\n result = wrap(x.unwrap() | y.unwrap());\n}\n\n/// @notice Implements the right shift operation (>>) in the SD59x18 type.\nfunction rshift(SD59x18 x, uint256 bits) pure returns (SD59x18 result) {\n result = wrap(x.unwrap() >> bits);\n}\n\n/// @notice Implements the checked subtraction operation (-) in the SD59x18 type.\nfunction sub(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\n result = wrap(x.unwrap() - y.unwrap());\n}\n\n/// @notice Implements the checked unary minus operation (-) in the SD59x18 type.\nfunction unary(SD59x18 x) pure returns (SD59x18 result) {\n result = wrap(-x.unwrap());\n}\n\n/// @notice Implements the unchecked addition operation (+) in the SD59x18 type.\nfunction uncheckedAdd(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\n unchecked {\n result = wrap(x.unwrap() + y.unwrap());\n }\n}\n\n/// @notice Implements the unchecked subtraction operation (-) in the SD59x18 type.\nfunction uncheckedSub(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\n unchecked {\n result = wrap(x.unwrap() - y.unwrap());\n }\n}\n\n/// @notice Implements the unchecked unary minus operation (-) in the SD59x18 type.\nfunction uncheckedUnary(SD59x18 x) pure returns (SD59x18 result) {\n unchecked {\n result = wrap(-x.unwrap());\n }\n}\n\n/// @notice Implements the XOR (^) bitwise operation in the SD59x18 type.\nfunction xor(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\n result = wrap(x.unwrap() ^ y.unwrap());\n}\n" + }, + "@prb/math/src/sd59x18/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport \"../Common.sol\" as Common;\nimport \"./Errors.sol\" as Errors;\nimport {\n uEXP_MAX_INPUT,\n uEXP2_MAX_INPUT,\n uEXP_MIN_THRESHOLD,\n uEXP2_MIN_THRESHOLD,\n uHALF_UNIT,\n uLOG2_10,\n uLOG2_E,\n uMAX_SD59x18,\n uMAX_WHOLE_SD59x18,\n uMIN_SD59x18,\n uMIN_WHOLE_SD59x18,\n UNIT,\n uUNIT,\n uUNIT_SQUARED,\n ZERO\n} from \"./Constants.sol\";\nimport { wrap } from \"./Helpers.sol\";\nimport { SD59x18 } from \"./ValueType.sol\";\n\n/// @notice Calculates the absolute value of x.\n///\n/// @dev Requirements:\n/// - x must be greater than `MIN_SD59x18`.\n///\n/// @param x The SD59x18 number for which to calculate the absolute value.\n/// @param result The absolute value of x as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction abs(SD59x18 x) pure returns (SD59x18 result) {\n int256 xInt = x.unwrap();\n if (xInt == uMIN_SD59x18) {\n revert Errors.PRBMath_SD59x18_Abs_MinSD59x18();\n }\n result = xInt < 0 ? wrap(-xInt) : x;\n}\n\n/// @notice Calculates the arithmetic average of x and y.\n///\n/// @dev Notes:\n/// - The result is rounded toward zero.\n///\n/// @param x The first operand as an SD59x18 number.\n/// @param y The second operand as an SD59x18 number.\n/// @return result The arithmetic average as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction avg(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\n int256 xInt = x.unwrap();\n int256 yInt = y.unwrap();\n\n unchecked {\n // This operation is equivalent to `x / 2 + y / 2`, and it can never overflow.\n int256 sum = (xInt >> 1) + (yInt >> 1);\n\n if (sum < 0) {\n // If at least one of x and y is odd, add 1 to the result, because shifting negative numbers to the right\n // rounds toward negative infinity. The right part is equivalent to `sum + (x % 2 == 1 || y % 2 == 1)`.\n assembly (\"memory-safe\") {\n result := add(sum, and(or(xInt, yInt), 1))\n }\n } else {\n // Add 1 if both x and y are odd to account for the double 0.5 remainder truncated after shifting.\n result = wrap(sum + (xInt & yInt & 1));\n }\n }\n}\n\n/// @notice Yields the smallest whole number greater than or equal to x.\n///\n/// @dev Optimized for fractional value inputs, because every whole value has (1e18 - 1) fractional counterparts.\n/// See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\n///\n/// Requirements:\n/// - x must be less than or equal to `MAX_WHOLE_SD59x18`.\n///\n/// @param x The SD59x18 number to ceil.\n/// @param result The smallest whole number greater than or equal to x, as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction ceil(SD59x18 x) pure returns (SD59x18 result) {\n int256 xInt = x.unwrap();\n if (xInt > uMAX_WHOLE_SD59x18) {\n revert Errors.PRBMath_SD59x18_Ceil_Overflow(x);\n }\n\n int256 remainder = xInt % uUNIT;\n if (remainder == 0) {\n result = x;\n } else {\n unchecked {\n // Solidity uses C fmod style, which returns a modulus with the same sign as x.\n int256 resultInt = xInt - remainder;\n if (xInt > 0) {\n resultInt += uUNIT;\n }\n result = wrap(resultInt);\n }\n }\n}\n\n/// @notice Divides two SD59x18 numbers, returning a new SD59x18 number.\n///\n/// @dev This is an extension of {Common.mulDiv} for signed numbers, which works by computing the signs and the absolute\n/// values separately.\n///\n/// Notes:\n/// - Refer to the notes in {Common.mulDiv}.\n/// - The result is rounded toward zero.\n///\n/// Requirements:\n/// - Refer to the requirements in {Common.mulDiv}.\n/// - None of the inputs can be `MIN_SD59x18`.\n/// - The denominator must not be zero.\n/// - The result must fit in SD59x18.\n///\n/// @param x The numerator as an SD59x18 number.\n/// @param y The denominator as an SD59x18 number.\n/// @param result The quotient as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction div(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\n int256 xInt = x.unwrap();\n int256 yInt = y.unwrap();\n if (xInt == uMIN_SD59x18 || yInt == uMIN_SD59x18) {\n revert Errors.PRBMath_SD59x18_Div_InputTooSmall();\n }\n\n // Get hold of the absolute values of x and y.\n uint256 xAbs;\n uint256 yAbs;\n unchecked {\n xAbs = xInt < 0 ? uint256(-xInt) : uint256(xInt);\n yAbs = yInt < 0 ? uint256(-yInt) : uint256(yInt);\n }\n\n // Compute the absolute value (x*UNIT÷y). The resulting value must fit in SD59x18.\n uint256 resultAbs = Common.mulDiv(xAbs, uint256(uUNIT), yAbs);\n if (resultAbs > uint256(uMAX_SD59x18)) {\n revert Errors.PRBMath_SD59x18_Div_Overflow(x, y);\n }\n\n // Check if x and y have the same sign using two's complement representation. The left-most bit represents the sign (1 for\n // negative, 0 for positive or zero).\n bool sameSign = (xInt ^ yInt) > -1;\n\n // If the inputs have the same sign, the result should be positive. Otherwise, it should be negative.\n unchecked {\n result = wrap(sameSign ? int256(resultAbs) : -int256(resultAbs));\n }\n}\n\n/// @notice Calculates the natural exponent of x using the following formula:\n///\n/// $$\n/// e^x = 2^{x * log_2{e}}\n/// $$\n///\n/// @dev Notes:\n/// - Refer to the notes in {exp2}.\n///\n/// Requirements:\n/// - Refer to the requirements in {exp2}.\n/// - x must be less than 133_084258667509499441.\n///\n/// @param x The exponent as an SD59x18 number.\n/// @return result The result as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction exp(SD59x18 x) pure returns (SD59x18 result) {\n int256 xInt = x.unwrap();\n\n // Any input less than the threshold returns zero.\n // This check also prevents an overflow for very small numbers.\n if (xInt < uEXP_MIN_THRESHOLD) {\n return ZERO;\n }\n\n // This check prevents values greater than 192e18 from being passed to {exp2}.\n if (xInt > uEXP_MAX_INPUT) {\n revert Errors.PRBMath_SD59x18_Exp_InputTooBig(x);\n }\n\n unchecked {\n // Inline the fixed-point multiplication to save gas.\n int256 doubleUnitProduct = xInt * uLOG2_E;\n result = exp2(wrap(doubleUnitProduct / uUNIT));\n }\n}\n\n/// @notice Calculates the binary exponent of x using the binary fraction method using the following formula:\n///\n/// $$\n/// 2^{-x} = \\frac{1}{2^x}\n/// $$\n///\n/// @dev See https://ethereum.stackexchange.com/q/79903/24693.\n///\n/// Notes:\n/// - If x is less than -59_794705707972522261, the result is zero.\n///\n/// Requirements:\n/// - x must be less than 192e18.\n/// - The result must fit in SD59x18.\n///\n/// @param x The exponent as an SD59x18 number.\n/// @return result The result as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction exp2(SD59x18 x) pure returns (SD59x18 result) {\n int256 xInt = x.unwrap();\n if (xInt < 0) {\n // The inverse of any number less than the threshold is truncated to zero.\n if (xInt < uEXP2_MIN_THRESHOLD) {\n return ZERO;\n }\n\n unchecked {\n // Inline the fixed-point inversion to save gas.\n result = wrap(uUNIT_SQUARED / exp2(wrap(-xInt)).unwrap());\n }\n } else {\n // Numbers greater than or equal to 192e18 don't fit in the 192.64-bit format.\n if (xInt > uEXP2_MAX_INPUT) {\n revert Errors.PRBMath_SD59x18_Exp2_InputTooBig(x);\n }\n\n unchecked {\n // Convert x to the 192.64-bit fixed-point format.\n uint256 x_192x64 = uint256((xInt << 64) / uUNIT);\n\n // It is safe to cast the result to int256 due to the checks above.\n result = wrap(int256(Common.exp2(x_192x64)));\n }\n }\n}\n\n/// @notice Yields the greatest whole number less than or equal to x.\n///\n/// @dev Optimized for fractional value inputs, because for every whole value there are (1e18 - 1) fractional\n/// counterparts. See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\n///\n/// Requirements:\n/// - x must be greater than or equal to `MIN_WHOLE_SD59x18`.\n///\n/// @param x The SD59x18 number to floor.\n/// @param result The greatest whole number less than or equal to x, as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction floor(SD59x18 x) pure returns (SD59x18 result) {\n int256 xInt = x.unwrap();\n if (xInt < uMIN_WHOLE_SD59x18) {\n revert Errors.PRBMath_SD59x18_Floor_Underflow(x);\n }\n\n int256 remainder = xInt % uUNIT;\n if (remainder == 0) {\n result = x;\n } else {\n unchecked {\n // Solidity uses C fmod style, which returns a modulus with the same sign as x.\n int256 resultInt = xInt - remainder;\n if (xInt < 0) {\n resultInt -= uUNIT;\n }\n result = wrap(resultInt);\n }\n }\n}\n\n/// @notice Yields the excess beyond the floor of x for positive numbers and the part of the number to the right.\n/// of the radix point for negative numbers.\n/// @dev Based on the odd function definition. https://en.wikipedia.org/wiki/Fractional_part\n/// @param x The SD59x18 number to get the fractional part of.\n/// @param result The fractional part of x as an SD59x18 number.\nfunction frac(SD59x18 x) pure returns (SD59x18 result) {\n result = wrap(x.unwrap() % uUNIT);\n}\n\n/// @notice Calculates the geometric mean of x and y, i.e. $\\sqrt{x * y}$.\n///\n/// @dev Notes:\n/// - The result is rounded toward zero.\n///\n/// Requirements:\n/// - x * y must fit in SD59x18.\n/// - x * y must not be negative, since complex numbers are not supported.\n///\n/// @param x The first operand as an SD59x18 number.\n/// @param y The second operand as an SD59x18 number.\n/// @return result The result as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction gm(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\n int256 xInt = x.unwrap();\n int256 yInt = y.unwrap();\n if (xInt == 0 || yInt == 0) {\n return ZERO;\n }\n\n unchecked {\n // Equivalent to `xy / x != y`. Checking for overflow this way is faster than letting Solidity do it.\n int256 xyInt = xInt * yInt;\n if (xyInt / xInt != yInt) {\n revert Errors.PRBMath_SD59x18_Gm_Overflow(x, y);\n }\n\n // The product must not be negative, since complex numbers are not supported.\n if (xyInt < 0) {\n revert Errors.PRBMath_SD59x18_Gm_NegativeProduct(x, y);\n }\n\n // We don't need to multiply the result by `UNIT` here because the x*y product picked up a factor of `UNIT`\n // during multiplication. See the comments in {Common.sqrt}.\n uint256 resultUint = Common.sqrt(uint256(xyInt));\n result = wrap(int256(resultUint));\n }\n}\n\n/// @notice Calculates the inverse of x.\n///\n/// @dev Notes:\n/// - The result is rounded toward zero.\n///\n/// Requirements:\n/// - x must not be zero.\n///\n/// @param x The SD59x18 number for which to calculate the inverse.\n/// @return result The inverse as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction inv(SD59x18 x) pure returns (SD59x18 result) {\n result = wrap(uUNIT_SQUARED / x.unwrap());\n}\n\n/// @notice Calculates the natural logarithm of x using the following formula:\n///\n/// $$\n/// ln{x} = log_2{x} / log_2{e}\n/// $$\n///\n/// @dev Notes:\n/// - Refer to the notes in {log2}.\n/// - The precision isn't sufficiently fine-grained to return exactly `UNIT` when the input is `E`.\n///\n/// Requirements:\n/// - Refer to the requirements in {log2}.\n///\n/// @param x The SD59x18 number for which to calculate the natural logarithm.\n/// @return result The natural logarithm as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction ln(SD59x18 x) pure returns (SD59x18 result) {\n // Inline the fixed-point multiplication to save gas. This is overflow-safe because the maximum value that\n // {log2} can return is ~195_205294292027477728.\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_E);\n}\n\n/// @notice Calculates the common logarithm of x using the following formula:\n///\n/// $$\n/// log_{10}{x} = log_2{x} / log_2{10}\n/// $$\n///\n/// However, if x is an exact power of ten, a hard coded value is returned.\n///\n/// @dev Notes:\n/// - Refer to the notes in {log2}.\n///\n/// Requirements:\n/// - Refer to the requirements in {log2}.\n///\n/// @param x The SD59x18 number for which to calculate the common logarithm.\n/// @return result The common logarithm as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction log10(SD59x18 x) pure returns (SD59x18 result) {\n int256 xInt = x.unwrap();\n if (xInt < 0) {\n revert Errors.PRBMath_SD59x18_Log_InputTooSmall(x);\n }\n\n // Note that the `mul` in this block is the standard multiplication operation, not {SD59x18.mul}.\n // prettier-ignore\n assembly (\"memory-safe\") {\n switch x\n case 1 { result := mul(uUNIT, sub(0, 18)) }\n case 10 { result := mul(uUNIT, sub(1, 18)) }\n case 100 { result := mul(uUNIT, sub(2, 18)) }\n case 1000 { result := mul(uUNIT, sub(3, 18)) }\n case 10000 { result := mul(uUNIT, sub(4, 18)) }\n case 100000 { result := mul(uUNIT, sub(5, 18)) }\n case 1000000 { result := mul(uUNIT, sub(6, 18)) }\n case 10000000 { result := mul(uUNIT, sub(7, 18)) }\n case 100000000 { result := mul(uUNIT, sub(8, 18)) }\n case 1000000000 { result := mul(uUNIT, sub(9, 18)) }\n case 10000000000 { result := mul(uUNIT, sub(10, 18)) }\n case 100000000000 { result := mul(uUNIT, sub(11, 18)) }\n case 1000000000000 { result := mul(uUNIT, sub(12, 18)) }\n case 10000000000000 { result := mul(uUNIT, sub(13, 18)) }\n case 100000000000000 { result := mul(uUNIT, sub(14, 18)) }\n case 1000000000000000 { result := mul(uUNIT, sub(15, 18)) }\n case 10000000000000000 { result := mul(uUNIT, sub(16, 18)) }\n case 100000000000000000 { result := mul(uUNIT, sub(17, 18)) }\n case 1000000000000000000 { result := 0 }\n case 10000000000000000000 { result := uUNIT }\n case 100000000000000000000 { result := mul(uUNIT, 2) }\n case 1000000000000000000000 { result := mul(uUNIT, 3) }\n case 10000000000000000000000 { result := mul(uUNIT, 4) }\n case 100000000000000000000000 { result := mul(uUNIT, 5) }\n case 1000000000000000000000000 { result := mul(uUNIT, 6) }\n case 10000000000000000000000000 { result := mul(uUNIT, 7) }\n case 100000000000000000000000000 { result := mul(uUNIT, 8) }\n case 1000000000000000000000000000 { result := mul(uUNIT, 9) }\n case 10000000000000000000000000000 { result := mul(uUNIT, 10) }\n case 100000000000000000000000000000 { result := mul(uUNIT, 11) }\n case 1000000000000000000000000000000 { result := mul(uUNIT, 12) }\n case 10000000000000000000000000000000 { result := mul(uUNIT, 13) }\n case 100000000000000000000000000000000 { result := mul(uUNIT, 14) }\n case 1000000000000000000000000000000000 { result := mul(uUNIT, 15) }\n case 10000000000000000000000000000000000 { result := mul(uUNIT, 16) }\n case 100000000000000000000000000000000000 { result := mul(uUNIT, 17) }\n case 1000000000000000000000000000000000000 { result := mul(uUNIT, 18) }\n case 10000000000000000000000000000000000000 { result := mul(uUNIT, 19) }\n case 100000000000000000000000000000000000000 { result := mul(uUNIT, 20) }\n case 1000000000000000000000000000000000000000 { result := mul(uUNIT, 21) }\n case 10000000000000000000000000000000000000000 { result := mul(uUNIT, 22) }\n case 100000000000000000000000000000000000000000 { result := mul(uUNIT, 23) }\n case 1000000000000000000000000000000000000000000 { result := mul(uUNIT, 24) }\n case 10000000000000000000000000000000000000000000 { result := mul(uUNIT, 25) }\n case 100000000000000000000000000000000000000000000 { result := mul(uUNIT, 26) }\n case 1000000000000000000000000000000000000000000000 { result := mul(uUNIT, 27) }\n case 10000000000000000000000000000000000000000000000 { result := mul(uUNIT, 28) }\n case 100000000000000000000000000000000000000000000000 { result := mul(uUNIT, 29) }\n case 1000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 30) }\n case 10000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 31) }\n case 100000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 32) }\n case 1000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 33) }\n case 10000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 34) }\n case 100000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 35) }\n case 1000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 36) }\n case 10000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 37) }\n case 100000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 38) }\n case 1000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 39) }\n case 10000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 40) }\n case 100000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 41) }\n case 1000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 42) }\n case 10000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 43) }\n case 100000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 44) }\n case 1000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 45) }\n case 10000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 46) }\n case 100000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 47) }\n case 1000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 48) }\n case 10000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 49) }\n case 100000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 50) }\n case 1000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 51) }\n case 10000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 52) }\n case 100000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 53) }\n case 1000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 54) }\n case 10000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 55) }\n case 100000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 56) }\n case 1000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 57) }\n case 10000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 58) }\n default { result := uMAX_SD59x18 }\n }\n\n if (result.unwrap() == uMAX_SD59x18) {\n unchecked {\n // Inline the fixed-point division to save gas.\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_10);\n }\n }\n}\n\n/// @notice Calculates the binary logarithm of x using the iterative approximation algorithm:\n///\n/// $$\n/// log_2{x} = n + log_2{y}, \\text{ where } y = x*2^{-n}, \\ y \\in [1, 2)\n/// $$\n///\n/// For $0 \\leq x \\lt 1$, the input is inverted:\n///\n/// $$\n/// log_2{x} = -log_2{\\frac{1}{x}}\n/// $$\n///\n/// @dev See https://en.wikipedia.org/wiki/Binary_logarithm#Iterative_approximation.\n///\n/// Notes:\n/// - Due to the lossy precision of the iterative approximation, the results are not perfectly accurate to the last decimal.\n///\n/// Requirements:\n/// - x must be greater than zero.\n///\n/// @param x The SD59x18 number for which to calculate the binary logarithm.\n/// @return result The binary logarithm as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction log2(SD59x18 x) pure returns (SD59x18 result) {\n int256 xInt = x.unwrap();\n if (xInt <= 0) {\n revert Errors.PRBMath_SD59x18_Log_InputTooSmall(x);\n }\n\n unchecked {\n int256 sign;\n if (xInt >= uUNIT) {\n sign = 1;\n } else {\n sign = -1;\n // Inline the fixed-point inversion to save gas.\n xInt = uUNIT_SQUARED / xInt;\n }\n\n // Calculate the integer part of the logarithm.\n uint256 n = Common.msb(uint256(xInt / uUNIT));\n\n // This is the integer part of the logarithm as an SD59x18 number. The operation can't overflow\n // because n is at most 255, `UNIT` is 1e18, and the sign is either 1 or -1.\n int256 resultInt = int256(n) * uUNIT;\n\n // Calculate $y = x * 2^{-n}$.\n int256 y = xInt >> n;\n\n // If y is the unit number, the fractional part is zero.\n if (y == uUNIT) {\n return wrap(resultInt * sign);\n }\n\n // Calculate the fractional part via the iterative approximation.\n // The `delta >>= 1` part is equivalent to `delta /= 2`, but shifting bits is more gas efficient.\n int256 DOUBLE_UNIT = 2e18;\n for (int256 delta = uHALF_UNIT; delta > 0; delta >>= 1) {\n y = (y * y) / uUNIT;\n\n // Is y^2 >= 2e18 and so in the range [2e18, 4e18)?\n if (y >= DOUBLE_UNIT) {\n // Add the 2^{-m} factor to the logarithm.\n resultInt = resultInt + delta;\n\n // Halve y, which corresponds to z/2 in the Wikipedia article.\n y >>= 1;\n }\n }\n resultInt *= sign;\n result = wrap(resultInt);\n }\n}\n\n/// @notice Multiplies two SD59x18 numbers together, returning a new SD59x18 number.\n///\n/// @dev Notes:\n/// - Refer to the notes in {Common.mulDiv18}.\n///\n/// Requirements:\n/// - Refer to the requirements in {Common.mulDiv18}.\n/// - None of the inputs can be `MIN_SD59x18`.\n/// - The result must fit in SD59x18.\n///\n/// @param x The multiplicand as an SD59x18 number.\n/// @param y The multiplier as an SD59x18 number.\n/// @return result The product as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction mul(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\n int256 xInt = x.unwrap();\n int256 yInt = y.unwrap();\n if (xInt == uMIN_SD59x18 || yInt == uMIN_SD59x18) {\n revert Errors.PRBMath_SD59x18_Mul_InputTooSmall();\n }\n\n // Get hold of the absolute values of x and y.\n uint256 xAbs;\n uint256 yAbs;\n unchecked {\n xAbs = xInt < 0 ? uint256(-xInt) : uint256(xInt);\n yAbs = yInt < 0 ? uint256(-yInt) : uint256(yInt);\n }\n\n // Compute the absolute value (x*y÷UNIT). The resulting value must fit in SD59x18.\n uint256 resultAbs = Common.mulDiv18(xAbs, yAbs);\n if (resultAbs > uint256(uMAX_SD59x18)) {\n revert Errors.PRBMath_SD59x18_Mul_Overflow(x, y);\n }\n\n // Check if x and y have the same sign using two's complement representation. The left-most bit represents the sign (1 for\n // negative, 0 for positive or zero).\n bool sameSign = (xInt ^ yInt) > -1;\n\n // If the inputs have the same sign, the result should be positive. Otherwise, it should be negative.\n unchecked {\n result = wrap(sameSign ? int256(resultAbs) : -int256(resultAbs));\n }\n}\n\n/// @notice Raises x to the power of y using the following formula:\n///\n/// $$\n/// x^y = 2^{log_2{x} * y}\n/// $$\n///\n/// @dev Notes:\n/// - Refer to the notes in {exp2}, {log2}, and {mul}.\n/// - Returns `UNIT` for 0^0.\n///\n/// Requirements:\n/// - Refer to the requirements in {exp2}, {log2}, and {mul}.\n///\n/// @param x The base as an SD59x18 number.\n/// @param y Exponent to raise x to, as an SD59x18 number\n/// @return result x raised to power y, as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction pow(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\n int256 xInt = x.unwrap();\n int256 yInt = y.unwrap();\n\n // If both x and y are zero, the result is `UNIT`. If just x is zero, the result is always zero.\n if (xInt == 0) {\n return yInt == 0 ? UNIT : ZERO;\n }\n // If x is `UNIT`, the result is always `UNIT`.\n else if (xInt == uUNIT) {\n return UNIT;\n }\n\n // If y is zero, the result is always `UNIT`.\n if (yInt == 0) {\n return UNIT;\n }\n // If y is `UNIT`, the result is always x.\n else if (yInt == uUNIT) {\n return x;\n }\n\n // Calculate the result using the formula.\n result = exp2(mul(log2(x), y));\n}\n\n/// @notice Raises x (an SD59x18 number) to the power y (an unsigned basic integer) using the well-known\n/// algorithm \"exponentiation by squaring\".\n///\n/// @dev See https://en.wikipedia.org/wiki/Exponentiation_by_squaring.\n///\n/// Notes:\n/// - Refer to the notes in {Common.mulDiv18}.\n/// - Returns `UNIT` for 0^0.\n///\n/// Requirements:\n/// - Refer to the requirements in {abs} and {Common.mulDiv18}.\n/// - The result must fit in SD59x18.\n///\n/// @param x The base as an SD59x18 number.\n/// @param y The exponent as a uint256.\n/// @return result The result as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction powu(SD59x18 x, uint256 y) pure returns (SD59x18 result) {\n uint256 xAbs = uint256(abs(x).unwrap());\n\n // Calculate the first iteration of the loop in advance.\n uint256 resultAbs = y & 1 > 0 ? xAbs : uint256(uUNIT);\n\n // Equivalent to `for(y /= 2; y > 0; y /= 2)`.\n uint256 yAux = y;\n for (yAux >>= 1; yAux > 0; yAux >>= 1) {\n xAbs = Common.mulDiv18(xAbs, xAbs);\n\n // Equivalent to `y % 2 == 1`.\n if (yAux & 1 > 0) {\n resultAbs = Common.mulDiv18(resultAbs, xAbs);\n }\n }\n\n // The result must fit in SD59x18.\n if (resultAbs > uint256(uMAX_SD59x18)) {\n revert Errors.PRBMath_SD59x18_Powu_Overflow(x, y);\n }\n\n unchecked {\n // Is the base negative and the exponent odd? If yes, the result should be negative.\n int256 resultInt = int256(resultAbs);\n bool isNegative = x.unwrap() < 0 && y & 1 == 1;\n if (isNegative) {\n resultInt = -resultInt;\n }\n result = wrap(resultInt);\n }\n}\n\n/// @notice Calculates the square root of x using the Babylonian method.\n///\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\n///\n/// Notes:\n/// - Only the positive root is returned.\n/// - The result is rounded toward zero.\n///\n/// Requirements:\n/// - x cannot be negative, since complex numbers are not supported.\n/// - x must be less than `MAX_SD59x18 / UNIT`.\n///\n/// @param x The SD59x18 number for which to calculate the square root.\n/// @return result The result as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction sqrt(SD59x18 x) pure returns (SD59x18 result) {\n int256 xInt = x.unwrap();\n if (xInt < 0) {\n revert Errors.PRBMath_SD59x18_Sqrt_NegativeInput(x);\n }\n if (xInt > uMAX_SD59x18 / uUNIT) {\n revert Errors.PRBMath_SD59x18_Sqrt_Overflow(x);\n }\n\n unchecked {\n // Multiply x by `UNIT` to account for the factor of `UNIT` picked up when multiplying two SD59x18 numbers.\n // In this case, the two numbers are both the square root.\n uint256 resultUint = Common.sqrt(uint256(xInt * uUNIT));\n result = wrap(int256(resultUint));\n }\n}\n" + }, + "@prb/math/src/sd59x18/ValueType.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport \"./Casting.sol\" as Casting;\nimport \"./Helpers.sol\" as Helpers;\nimport \"./Math.sol\" as Math;\n\n/// @notice The signed 59.18-decimal fixed-point number representation, which can have up to 59 digits and up to 18\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\n/// type int256.\ntype SD59x18 is int256;\n\n/*//////////////////////////////////////////////////////////////////////////\n CASTING\n//////////////////////////////////////////////////////////////////////////*/\n\nusing {\n Casting.intoInt256,\n Casting.intoSD1x18,\n Casting.intoUD2x18,\n Casting.intoUD60x18,\n Casting.intoUint256,\n Casting.intoUint128,\n Casting.intoUint40,\n Casting.unwrap\n} for SD59x18 global;\n\n/*//////////////////////////////////////////////////////////////////////////\n MATHEMATICAL FUNCTIONS\n//////////////////////////////////////////////////////////////////////////*/\n\nusing {\n Math.abs,\n Math.avg,\n Math.ceil,\n Math.div,\n Math.exp,\n Math.exp2,\n Math.floor,\n Math.frac,\n Math.gm,\n Math.inv,\n Math.log10,\n Math.log2,\n Math.ln,\n Math.mul,\n Math.pow,\n Math.powu,\n Math.sqrt\n} for SD59x18 global;\n\n/*//////////////////////////////////////////////////////////////////////////\n HELPER FUNCTIONS\n//////////////////////////////////////////////////////////////////////////*/\n\nusing {\n Helpers.add,\n Helpers.and,\n Helpers.eq,\n Helpers.gt,\n Helpers.gte,\n Helpers.isZero,\n Helpers.lshift,\n Helpers.lt,\n Helpers.lte,\n Helpers.mod,\n Helpers.neq,\n Helpers.not,\n Helpers.or,\n Helpers.rshift,\n Helpers.sub,\n Helpers.uncheckedAdd,\n Helpers.uncheckedSub,\n Helpers.uncheckedUnary,\n Helpers.xor\n} for SD59x18 global;\n\n/*//////////////////////////////////////////////////////////////////////////\n OPERATORS\n//////////////////////////////////////////////////////////////////////////*/\n\n// The global \"using for\" directive makes it possible to use these operators on the SD59x18 type.\nusing {\n Helpers.add as +,\n Helpers.and2 as &,\n Math.div as /,\n Helpers.eq as ==,\n Helpers.gt as >,\n Helpers.gte as >=,\n Helpers.lt as <,\n Helpers.lte as <=,\n Helpers.mod as %,\n Math.mul as *,\n Helpers.neq as !=,\n Helpers.not as ~,\n Helpers.or as |,\n Helpers.sub as -,\n Helpers.unary as -,\n Helpers.xor as ^\n} for SD59x18 global;\n" + }, + "@prb/math/src/UD2x18.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\n/*\n\n██████╗ ██████╗ ██████╗ ███╗ ███╗ █████╗ ████████╗██╗ ██╗\n██╔══██╗██╔══██╗██╔══██╗████╗ ████║██╔══██╗╚══██╔══╝██║ ██║\n██████╔╝██████╔╝██████╔╝██╔████╔██║███████║ ██║ ███████║\n██╔═══╝ ██╔══██╗██╔══██╗██║╚██╔╝██║██╔══██║ ██║ ██╔══██║\n██║ ██║ ██║██████╔╝██║ ╚═╝ ██║██║ ██║ ██║ ██║ ██║\n╚═╝ ╚═╝ ╚═╝╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝\n\n██╗ ██╗██████╗ ██████╗ ██╗ ██╗ ██╗ █████╗\n██║ ██║██╔══██╗╚════██╗╚██╗██╔╝███║██╔══██╗\n██║ ██║██║ ██║ █████╔╝ ╚███╔╝ ╚██║╚█████╔╝\n██║ ██║██║ ██║██╔═══╝ ██╔██╗ ██║██╔══██╗\n╚██████╔╝██████╔╝███████╗██╔╝ ██╗ ██║╚█████╔╝\n ╚═════╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝ ╚═╝ ╚════╝\n\n*/\n\nimport \"./ud2x18/Casting.sol\";\nimport \"./ud2x18/Constants.sol\";\nimport \"./ud2x18/Errors.sol\";\nimport \"./ud2x18/ValueType.sol\";\n" + }, + "@prb/math/src/ud2x18/Casting.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport \"../Common.sol\" as Common;\nimport \"./Errors.sol\" as Errors;\nimport { uMAX_SD1x18 } from \"../sd1x18/Constants.sol\";\nimport { SD1x18 } from \"../sd1x18/ValueType.sol\";\nimport { SD59x18 } from \"../sd59x18/ValueType.sol\";\nimport { UD60x18 } from \"../ud60x18/ValueType.sol\";\nimport { UD2x18 } from \"./ValueType.sol\";\n\n/// @notice Casts a UD2x18 number into SD1x18.\n/// - x must be less than or equal to `uMAX_SD1x18`.\nfunction intoSD1x18(UD2x18 x) pure returns (SD1x18 result) {\n uint64 xUint = UD2x18.unwrap(x);\n if (xUint > uint64(uMAX_SD1x18)) {\n revert Errors.PRBMath_UD2x18_IntoSD1x18_Overflow(x);\n }\n result = SD1x18.wrap(int64(xUint));\n}\n\n/// @notice Casts a UD2x18 number into SD59x18.\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of SD59x18.\nfunction intoSD59x18(UD2x18 x) pure returns (SD59x18 result) {\n result = SD59x18.wrap(int256(uint256(UD2x18.unwrap(x))));\n}\n\n/// @notice Casts a UD2x18 number into UD60x18.\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of UD60x18.\nfunction intoUD60x18(UD2x18 x) pure returns (UD60x18 result) {\n result = UD60x18.wrap(UD2x18.unwrap(x));\n}\n\n/// @notice Casts a UD2x18 number into uint128.\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of uint128.\nfunction intoUint128(UD2x18 x) pure returns (uint128 result) {\n result = uint128(UD2x18.unwrap(x));\n}\n\n/// @notice Casts a UD2x18 number into uint256.\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of uint256.\nfunction intoUint256(UD2x18 x) pure returns (uint256 result) {\n result = uint256(UD2x18.unwrap(x));\n}\n\n/// @notice Casts a UD2x18 number into uint40.\n/// @dev Requirements:\n/// - x must be less than or equal to `MAX_UINT40`.\nfunction intoUint40(UD2x18 x) pure returns (uint40 result) {\n uint64 xUint = UD2x18.unwrap(x);\n if (xUint > uint64(Common.MAX_UINT40)) {\n revert Errors.PRBMath_UD2x18_IntoUint40_Overflow(x);\n }\n result = uint40(xUint);\n}\n\n/// @notice Alias for {wrap}.\nfunction ud2x18(uint64 x) pure returns (UD2x18 result) {\n result = UD2x18.wrap(x);\n}\n\n/// @notice Unwrap a UD2x18 number into uint64.\nfunction unwrap(UD2x18 x) pure returns (uint64 result) {\n result = UD2x18.unwrap(x);\n}\n\n/// @notice Wraps a uint64 number into UD2x18.\nfunction wrap(uint64 x) pure returns (UD2x18 result) {\n result = UD2x18.wrap(x);\n}\n" + }, + "@prb/math/src/ud2x18/Constants.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport { UD2x18 } from \"./ValueType.sol\";\n\n/// @dev Euler's number as a UD2x18 number.\nUD2x18 constant E = UD2x18.wrap(2_718281828459045235);\n\n/// @dev The maximum value a UD2x18 number can have.\nuint64 constant uMAX_UD2x18 = 18_446744073709551615;\nUD2x18 constant MAX_UD2x18 = UD2x18.wrap(uMAX_UD2x18);\n\n/// @dev PI as a UD2x18 number.\nUD2x18 constant PI = UD2x18.wrap(3_141592653589793238);\n\n/// @dev The unit number, which gives the decimal precision of UD2x18.\nUD2x18 constant UNIT = UD2x18.wrap(1e18);\nuint64 constant uUNIT = 1e18;\n" + }, + "@prb/math/src/ud2x18/Errors.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport { UD2x18 } from \"./ValueType.sol\";\n\n/// @notice Thrown when trying to cast a UD2x18 number that doesn't fit in SD1x18.\nerror PRBMath_UD2x18_IntoSD1x18_Overflow(UD2x18 x);\n\n/// @notice Thrown when trying to cast a UD2x18 number that doesn't fit in uint40.\nerror PRBMath_UD2x18_IntoUint40_Overflow(UD2x18 x);\n" + }, + "@prb/math/src/ud2x18/ValueType.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport \"./Casting.sol\" as Casting;\n\n/// @notice The unsigned 2.18-decimal fixed-point number representation, which can have up to 2 digits and up to 18\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\n/// type uint64. This is useful when end users want to use uint64 to save gas, e.g. with tight variable packing in contract\n/// storage.\ntype UD2x18 is uint64;\n\n/*//////////////////////////////////////////////////////////////////////////\n CASTING\n//////////////////////////////////////////////////////////////////////////*/\n\nusing {\n Casting.intoSD1x18,\n Casting.intoSD59x18,\n Casting.intoUD60x18,\n Casting.intoUint256,\n Casting.intoUint128,\n Casting.intoUint40,\n Casting.unwrap\n} for UD2x18 global;\n" + }, + "@prb/math/src/UD60x18.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\n/*\n\n██████╗ ██████╗ ██████╗ ███╗ ███╗ █████╗ ████████╗██╗ ██╗\n██╔══██╗██╔══██╗██╔══██╗████╗ ████║██╔══██╗╚══██╔══╝██║ ██║\n██████╔╝██████╔╝██████╔╝██╔████╔██║███████║ ██║ ███████║\n██╔═══╝ ██╔══██╗██╔══██╗██║╚██╔╝██║██╔══██║ ██║ ██╔══██║\n██║ ██║ ██║██████╔╝██║ ╚═╝ ██║██║ ██║ ██║ ██║ ██║\n╚═╝ ╚═╝ ╚═╝╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝\n\n██╗ ██╗██████╗ ██████╗ ██████╗ ██╗ ██╗ ██╗ █████╗\n██║ ██║██╔══██╗██╔════╝ ██╔═████╗╚██╗██╔╝███║██╔══██╗\n██║ ██║██║ ██║███████╗ ██║██╔██║ ╚███╔╝ ╚██║╚█████╔╝\n██║ ██║██║ ██║██╔═══██╗████╔╝██║ ██╔██╗ ██║██╔══██╗\n╚██████╔╝██████╔╝╚██████╔╝╚██████╔╝██╔╝ ██╗ ██║╚█████╔╝\n ╚═════╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚════╝\n\n*/\n\nimport \"./ud60x18/Casting.sol\";\nimport \"./ud60x18/Constants.sol\";\nimport \"./ud60x18/Conversions.sol\";\nimport \"./ud60x18/Errors.sol\";\nimport \"./ud60x18/Helpers.sol\";\nimport \"./ud60x18/Math.sol\";\nimport \"./ud60x18/ValueType.sol\";\n" + }, + "@prb/math/src/ud60x18/Casting.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport \"./Errors.sol\" as CastingErrors;\nimport { MAX_UINT128, MAX_UINT40 } from \"../Common.sol\";\nimport { uMAX_SD1x18 } from \"../sd1x18/Constants.sol\";\nimport { SD1x18 } from \"../sd1x18/ValueType.sol\";\nimport { uMAX_SD59x18 } from \"../sd59x18/Constants.sol\";\nimport { SD59x18 } from \"../sd59x18/ValueType.sol\";\nimport { uMAX_UD2x18 } from \"../ud2x18/Constants.sol\";\nimport { UD2x18 } from \"../ud2x18/ValueType.sol\";\nimport { UD60x18 } from \"./ValueType.sol\";\n\n/// @notice Casts a UD60x18 number into SD1x18.\n/// @dev Requirements:\n/// - x must be less than or equal to `uMAX_SD1x18`.\nfunction intoSD1x18(UD60x18 x) pure returns (SD1x18 result) {\n uint256 xUint = UD60x18.unwrap(x);\n if (xUint > uint256(int256(uMAX_SD1x18))) {\n revert CastingErrors.PRBMath_UD60x18_IntoSD1x18_Overflow(x);\n }\n result = SD1x18.wrap(int64(uint64(xUint)));\n}\n\n/// @notice Casts a UD60x18 number into UD2x18.\n/// @dev Requirements:\n/// - x must be less than or equal to `uMAX_UD2x18`.\nfunction intoUD2x18(UD60x18 x) pure returns (UD2x18 result) {\n uint256 xUint = UD60x18.unwrap(x);\n if (xUint > uMAX_UD2x18) {\n revert CastingErrors.PRBMath_UD60x18_IntoUD2x18_Overflow(x);\n }\n result = UD2x18.wrap(uint64(xUint));\n}\n\n/// @notice Casts a UD60x18 number into SD59x18.\n/// @dev Requirements:\n/// - x must be less than or equal to `uMAX_SD59x18`.\nfunction intoSD59x18(UD60x18 x) pure returns (SD59x18 result) {\n uint256 xUint = UD60x18.unwrap(x);\n if (xUint > uint256(uMAX_SD59x18)) {\n revert CastingErrors.PRBMath_UD60x18_IntoSD59x18_Overflow(x);\n }\n result = SD59x18.wrap(int256(xUint));\n}\n\n/// @notice Casts a UD60x18 number into uint128.\n/// @dev This is basically an alias for {unwrap}.\nfunction intoUint256(UD60x18 x) pure returns (uint256 result) {\n result = UD60x18.unwrap(x);\n}\n\n/// @notice Casts a UD60x18 number into uint128.\n/// @dev Requirements:\n/// - x must be less than or equal to `MAX_UINT128`.\nfunction intoUint128(UD60x18 x) pure returns (uint128 result) {\n uint256 xUint = UD60x18.unwrap(x);\n if (xUint > MAX_UINT128) {\n revert CastingErrors.PRBMath_UD60x18_IntoUint128_Overflow(x);\n }\n result = uint128(xUint);\n}\n\n/// @notice Casts a UD60x18 number into uint40.\n/// @dev Requirements:\n/// - x must be less than or equal to `MAX_UINT40`.\nfunction intoUint40(UD60x18 x) pure returns (uint40 result) {\n uint256 xUint = UD60x18.unwrap(x);\n if (xUint > MAX_UINT40) {\n revert CastingErrors.PRBMath_UD60x18_IntoUint40_Overflow(x);\n }\n result = uint40(xUint);\n}\n\n/// @notice Alias for {wrap}.\nfunction ud(uint256 x) pure returns (UD60x18 result) {\n result = UD60x18.wrap(x);\n}\n\n/// @notice Alias for {wrap}.\nfunction ud60x18(uint256 x) pure returns (UD60x18 result) {\n result = UD60x18.wrap(x);\n}\n\n/// @notice Unwraps a UD60x18 number into uint256.\nfunction unwrap(UD60x18 x) pure returns (uint256 result) {\n result = UD60x18.unwrap(x);\n}\n\n/// @notice Wraps a uint256 number into the UD60x18 value type.\nfunction wrap(uint256 x) pure returns (UD60x18 result) {\n result = UD60x18.wrap(x);\n}\n" + }, + "@prb/math/src/ud60x18/Constants.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport { UD60x18 } from \"./ValueType.sol\";\n\n// NOTICE: the \"u\" prefix stands for \"unwrapped\".\n\n/// @dev Euler's number as a UD60x18 number.\nUD60x18 constant E = UD60x18.wrap(2_718281828459045235);\n\n/// @dev The maximum input permitted in {exp}.\nuint256 constant uEXP_MAX_INPUT = 133_084258667509499440;\nUD60x18 constant EXP_MAX_INPUT = UD60x18.wrap(uEXP_MAX_INPUT);\n\n/// @dev The maximum input permitted in {exp2}.\nuint256 constant uEXP2_MAX_INPUT = 192e18 - 1;\nUD60x18 constant EXP2_MAX_INPUT = UD60x18.wrap(uEXP2_MAX_INPUT);\n\n/// @dev Half the UNIT number.\nuint256 constant uHALF_UNIT = 0.5e18;\nUD60x18 constant HALF_UNIT = UD60x18.wrap(uHALF_UNIT);\n\n/// @dev $log_2(10)$ as a UD60x18 number.\nuint256 constant uLOG2_10 = 3_321928094887362347;\nUD60x18 constant LOG2_10 = UD60x18.wrap(uLOG2_10);\n\n/// @dev $log_2(e)$ as a UD60x18 number.\nuint256 constant uLOG2_E = 1_442695040888963407;\nUD60x18 constant LOG2_E = UD60x18.wrap(uLOG2_E);\n\n/// @dev The maximum value a UD60x18 number can have.\nuint256 constant uMAX_UD60x18 = 115792089237316195423570985008687907853269984665640564039457_584007913129639935;\nUD60x18 constant MAX_UD60x18 = UD60x18.wrap(uMAX_UD60x18);\n\n/// @dev The maximum whole value a UD60x18 number can have.\nuint256 constant uMAX_WHOLE_UD60x18 = 115792089237316195423570985008687907853269984665640564039457_000000000000000000;\nUD60x18 constant MAX_WHOLE_UD60x18 = UD60x18.wrap(uMAX_WHOLE_UD60x18);\n\n/// @dev PI as a UD60x18 number.\nUD60x18 constant PI = UD60x18.wrap(3_141592653589793238);\n\n/// @dev The unit number, which gives the decimal precision of UD60x18.\nuint256 constant uUNIT = 1e18;\nUD60x18 constant UNIT = UD60x18.wrap(uUNIT);\n\n/// @dev The unit number squared.\nuint256 constant uUNIT_SQUARED = 1e36;\nUD60x18 constant UNIT_SQUARED = UD60x18.wrap(uUNIT_SQUARED);\n\n/// @dev Zero as a UD60x18 number.\nUD60x18 constant ZERO = UD60x18.wrap(0);\n" + }, + "@prb/math/src/ud60x18/Conversions.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport { uMAX_UD60x18, uUNIT } from \"./Constants.sol\";\nimport { PRBMath_UD60x18_Convert_Overflow } from \"./Errors.sol\";\nimport { UD60x18 } from \"./ValueType.sol\";\n\n/// @notice Converts a UD60x18 number to a simple integer by dividing it by `UNIT`.\n/// @dev The result is rounded toward zero.\n/// @param x The UD60x18 number to convert.\n/// @return result The same number in basic integer form.\nfunction convert(UD60x18 x) pure returns (uint256 result) {\n result = UD60x18.unwrap(x) / uUNIT;\n}\n\n/// @notice Converts a simple integer to UD60x18 by multiplying it by `UNIT`.\n///\n/// @dev Requirements:\n/// - x must be less than or equal to `MAX_UD60x18 / UNIT`.\n///\n/// @param x The basic integer to convert.\n/// @param result The same number converted to UD60x18.\nfunction convert(uint256 x) pure returns (UD60x18 result) {\n if (x > uMAX_UD60x18 / uUNIT) {\n revert PRBMath_UD60x18_Convert_Overflow(x);\n }\n unchecked {\n result = UD60x18.wrap(x * uUNIT);\n }\n}\n" + }, + "@prb/math/src/ud60x18/Errors.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport { UD60x18 } from \"./ValueType.sol\";\n\n/// @notice Thrown when ceiling a number overflows UD60x18.\nerror PRBMath_UD60x18_Ceil_Overflow(UD60x18 x);\n\n/// @notice Thrown when converting a basic integer to the fixed-point format overflows UD60x18.\nerror PRBMath_UD60x18_Convert_Overflow(uint256 x);\n\n/// @notice Thrown when taking the natural exponent of a base greater than 133_084258667509499441.\nerror PRBMath_UD60x18_Exp_InputTooBig(UD60x18 x);\n\n/// @notice Thrown when taking the binary exponent of a base greater than 192e18.\nerror PRBMath_UD60x18_Exp2_InputTooBig(UD60x18 x);\n\n/// @notice Thrown when taking the geometric mean of two numbers and multiplying them overflows UD60x18.\nerror PRBMath_UD60x18_Gm_Overflow(UD60x18 x, UD60x18 y);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\nerror PRBMath_UD60x18_IntoSD1x18_Overflow(UD60x18 x);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD59x18.\nerror PRBMath_UD60x18_IntoSD59x18_Overflow(UD60x18 x);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\nerror PRBMath_UD60x18_IntoUD2x18_Overflow(UD60x18 x);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\nerror PRBMath_UD60x18_IntoUint128_Overflow(UD60x18 x);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\nerror PRBMath_UD60x18_IntoUint40_Overflow(UD60x18 x);\n\n/// @notice Thrown when taking the logarithm of a number less than 1.\nerror PRBMath_UD60x18_Log_InputTooSmall(UD60x18 x);\n\n/// @notice Thrown when calculating the square root overflows UD60x18.\nerror PRBMath_UD60x18_Sqrt_Overflow(UD60x18 x);\n" + }, + "@prb/math/src/ud60x18/Helpers.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport { wrap } from \"./Casting.sol\";\nimport { UD60x18 } from \"./ValueType.sol\";\n\n/// @notice Implements the checked addition operation (+) in the UD60x18 type.\nfunction add(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\n result = wrap(x.unwrap() + y.unwrap());\n}\n\n/// @notice Implements the AND (&) bitwise operation in the UD60x18 type.\nfunction and(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\n result = wrap(x.unwrap() & bits);\n}\n\n/// @notice Implements the AND (&) bitwise operation in the UD60x18 type.\nfunction and2(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\n result = wrap(x.unwrap() & y.unwrap());\n}\n\n/// @notice Implements the equal operation (==) in the UD60x18 type.\nfunction eq(UD60x18 x, UD60x18 y) pure returns (bool result) {\n result = x.unwrap() == y.unwrap();\n}\n\n/// @notice Implements the greater than operation (>) in the UD60x18 type.\nfunction gt(UD60x18 x, UD60x18 y) pure returns (bool result) {\n result = x.unwrap() > y.unwrap();\n}\n\n/// @notice Implements the greater than or equal to operation (>=) in the UD60x18 type.\nfunction gte(UD60x18 x, UD60x18 y) pure returns (bool result) {\n result = x.unwrap() >= y.unwrap();\n}\n\n/// @notice Implements a zero comparison check function in the UD60x18 type.\nfunction isZero(UD60x18 x) pure returns (bool result) {\n // This wouldn't work if x could be negative.\n result = x.unwrap() == 0;\n}\n\n/// @notice Implements the left shift operation (<<) in the UD60x18 type.\nfunction lshift(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\n result = wrap(x.unwrap() << bits);\n}\n\n/// @notice Implements the lower than operation (<) in the UD60x18 type.\nfunction lt(UD60x18 x, UD60x18 y) pure returns (bool result) {\n result = x.unwrap() < y.unwrap();\n}\n\n/// @notice Implements the lower than or equal to operation (<=) in the UD60x18 type.\nfunction lte(UD60x18 x, UD60x18 y) pure returns (bool result) {\n result = x.unwrap() <= y.unwrap();\n}\n\n/// @notice Implements the checked modulo operation (%) in the UD60x18 type.\nfunction mod(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\n result = wrap(x.unwrap() % y.unwrap());\n}\n\n/// @notice Implements the not equal operation (!=) in the UD60x18 type.\nfunction neq(UD60x18 x, UD60x18 y) pure returns (bool result) {\n result = x.unwrap() != y.unwrap();\n}\n\n/// @notice Implements the NOT (~) bitwise operation in the UD60x18 type.\nfunction not(UD60x18 x) pure returns (UD60x18 result) {\n result = wrap(~x.unwrap());\n}\n\n/// @notice Implements the OR (|) bitwise operation in the UD60x18 type.\nfunction or(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\n result = wrap(x.unwrap() | y.unwrap());\n}\n\n/// @notice Implements the right shift operation (>>) in the UD60x18 type.\nfunction rshift(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\n result = wrap(x.unwrap() >> bits);\n}\n\n/// @notice Implements the checked subtraction operation (-) in the UD60x18 type.\nfunction sub(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\n result = wrap(x.unwrap() - y.unwrap());\n}\n\n/// @notice Implements the unchecked addition operation (+) in the UD60x18 type.\nfunction uncheckedAdd(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\n unchecked {\n result = wrap(x.unwrap() + y.unwrap());\n }\n}\n\n/// @notice Implements the unchecked subtraction operation (-) in the UD60x18 type.\nfunction uncheckedSub(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\n unchecked {\n result = wrap(x.unwrap() - y.unwrap());\n }\n}\n\n/// @notice Implements the XOR (^) bitwise operation in the UD60x18 type.\nfunction xor(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\n result = wrap(x.unwrap() ^ y.unwrap());\n}\n" + }, + "@prb/math/src/ud60x18/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport \"../Common.sol\" as Common;\nimport \"./Errors.sol\" as Errors;\nimport { wrap } from \"./Casting.sol\";\nimport {\n uEXP_MAX_INPUT,\n uEXP2_MAX_INPUT,\n uHALF_UNIT,\n uLOG2_10,\n uLOG2_E,\n uMAX_UD60x18,\n uMAX_WHOLE_UD60x18,\n UNIT,\n uUNIT,\n uUNIT_SQUARED,\n ZERO\n} from \"./Constants.sol\";\nimport { UD60x18 } from \"./ValueType.sol\";\n\n/*//////////////////////////////////////////////////////////////////////////\n MATHEMATICAL FUNCTIONS\n//////////////////////////////////////////////////////////////////////////*/\n\n/// @notice Calculates the arithmetic average of x and y using the following formula:\n///\n/// $$\n/// avg(x, y) = (x & y) + ((xUint ^ yUint) / 2)\n/// $$\n///\n/// In English, this is what this formula does:\n///\n/// 1. AND x and y.\n/// 2. Calculate half of XOR x and y.\n/// 3. Add the two results together.\n///\n/// This technique is known as SWAR, which stands for \"SIMD within a register\". You can read more about it here:\n/// https://devblogs.microsoft.com/oldnewthing/20220207-00/?p=106223\n///\n/// @dev Notes:\n/// - The result is rounded toward zero.\n///\n/// @param x The first operand as a UD60x18 number.\n/// @param y The second operand as a UD60x18 number.\n/// @return result The arithmetic average as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction avg(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\n uint256 xUint = x.unwrap();\n uint256 yUint = y.unwrap();\n unchecked {\n result = wrap((xUint & yUint) + ((xUint ^ yUint) >> 1));\n }\n}\n\n/// @notice Yields the smallest whole number greater than or equal to x.\n///\n/// @dev This is optimized for fractional value inputs, because for every whole value there are (1e18 - 1) fractional\n/// counterparts. See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\n///\n/// Requirements:\n/// - x must be less than or equal to `MAX_WHOLE_UD60x18`.\n///\n/// @param x The UD60x18 number to ceil.\n/// @param result The smallest whole number greater than or equal to x, as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction ceil(UD60x18 x) pure returns (UD60x18 result) {\n uint256 xUint = x.unwrap();\n if (xUint > uMAX_WHOLE_UD60x18) {\n revert Errors.PRBMath_UD60x18_Ceil_Overflow(x);\n }\n\n assembly (\"memory-safe\") {\n // Equivalent to `x % UNIT`.\n let remainder := mod(x, uUNIT)\n\n // Equivalent to `UNIT - remainder`.\n let delta := sub(uUNIT, remainder)\n\n // Equivalent to `x + remainder > 0 ? delta : 0`.\n result := add(x, mul(delta, gt(remainder, 0)))\n }\n}\n\n/// @notice Divides two UD60x18 numbers, returning a new UD60x18 number.\n///\n/// @dev Uses {Common.mulDiv} to enable overflow-safe multiplication and division.\n///\n/// Notes:\n/// - Refer to the notes in {Common.mulDiv}.\n///\n/// Requirements:\n/// - Refer to the requirements in {Common.mulDiv}.\n///\n/// @param x The numerator as a UD60x18 number.\n/// @param y The denominator as a UD60x18 number.\n/// @param result The quotient as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction div(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\n result = wrap(Common.mulDiv(x.unwrap(), uUNIT, y.unwrap()));\n}\n\n/// @notice Calculates the natural exponent of x using the following formula:\n///\n/// $$\n/// e^x = 2^{x * log_2{e}}\n/// $$\n///\n/// @dev Requirements:\n/// - x must be less than 133_084258667509499441.\n///\n/// @param x The exponent as a UD60x18 number.\n/// @return result The result as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction exp(UD60x18 x) pure returns (UD60x18 result) {\n uint256 xUint = x.unwrap();\n\n // This check prevents values greater than 192e18 from being passed to {exp2}.\n if (xUint > uEXP_MAX_INPUT) {\n revert Errors.PRBMath_UD60x18_Exp_InputTooBig(x);\n }\n\n unchecked {\n // Inline the fixed-point multiplication to save gas.\n uint256 doubleUnitProduct = xUint * uLOG2_E;\n result = exp2(wrap(doubleUnitProduct / uUNIT));\n }\n}\n\n/// @notice Calculates the binary exponent of x using the binary fraction method.\n///\n/// @dev See https://ethereum.stackexchange.com/q/79903/24693\n///\n/// Requirements:\n/// - x must be less than 192e18.\n/// - The result must fit in UD60x18.\n///\n/// @param x The exponent as a UD60x18 number.\n/// @return result The result as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction exp2(UD60x18 x) pure returns (UD60x18 result) {\n uint256 xUint = x.unwrap();\n\n // Numbers greater than or equal to 192e18 don't fit in the 192.64-bit format.\n if (xUint > uEXP2_MAX_INPUT) {\n revert Errors.PRBMath_UD60x18_Exp2_InputTooBig(x);\n }\n\n // Convert x to the 192.64-bit fixed-point format.\n uint256 x_192x64 = (xUint << 64) / uUNIT;\n\n // Pass x to the {Common.exp2} function, which uses the 192.64-bit fixed-point number representation.\n result = wrap(Common.exp2(x_192x64));\n}\n\n/// @notice Yields the greatest whole number less than or equal to x.\n/// @dev Optimized for fractional value inputs, because every whole value has (1e18 - 1) fractional counterparts.\n/// See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\n/// @param x The UD60x18 number to floor.\n/// @param result The greatest whole number less than or equal to x, as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction floor(UD60x18 x) pure returns (UD60x18 result) {\n assembly (\"memory-safe\") {\n // Equivalent to `x % UNIT`.\n let remainder := mod(x, uUNIT)\n\n // Equivalent to `x - remainder > 0 ? remainder : 0)`.\n result := sub(x, mul(remainder, gt(remainder, 0)))\n }\n}\n\n/// @notice Yields the excess beyond the floor of x using the odd function definition.\n/// @dev See https://en.wikipedia.org/wiki/Fractional_part.\n/// @param x The UD60x18 number to get the fractional part of.\n/// @param result The fractional part of x as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction frac(UD60x18 x) pure returns (UD60x18 result) {\n assembly (\"memory-safe\") {\n result := mod(x, uUNIT)\n }\n}\n\n/// @notice Calculates the geometric mean of x and y, i.e. $\\sqrt{x * y}$, rounding down.\n///\n/// @dev Requirements:\n/// - x * y must fit in UD60x18.\n///\n/// @param x The first operand as a UD60x18 number.\n/// @param y The second operand as a UD60x18 number.\n/// @return result The result as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction gm(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\n uint256 xUint = x.unwrap();\n uint256 yUint = y.unwrap();\n if (xUint == 0 || yUint == 0) {\n return ZERO;\n }\n\n unchecked {\n // Checking for overflow this way is faster than letting Solidity do it.\n uint256 xyUint = xUint * yUint;\n if (xyUint / xUint != yUint) {\n revert Errors.PRBMath_UD60x18_Gm_Overflow(x, y);\n }\n\n // We don't need to multiply the result by `UNIT` here because the x*y product picked up a factor of `UNIT`\n // during multiplication. See the comments in {Common.sqrt}.\n result = wrap(Common.sqrt(xyUint));\n }\n}\n\n/// @notice Calculates the inverse of x.\n///\n/// @dev Notes:\n/// - The result is rounded toward zero.\n///\n/// Requirements:\n/// - x must not be zero.\n///\n/// @param x The UD60x18 number for which to calculate the inverse.\n/// @return result The inverse as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction inv(UD60x18 x) pure returns (UD60x18 result) {\n unchecked {\n result = wrap(uUNIT_SQUARED / x.unwrap());\n }\n}\n\n/// @notice Calculates the natural logarithm of x using the following formula:\n///\n/// $$\n/// ln{x} = log_2{x} / log_2{e}\n/// $$\n///\n/// @dev Notes:\n/// - Refer to the notes in {log2}.\n/// - The precision isn't sufficiently fine-grained to return exactly `UNIT` when the input is `E`.\n///\n/// Requirements:\n/// - Refer to the requirements in {log2}.\n///\n/// @param x The UD60x18 number for which to calculate the natural logarithm.\n/// @return result The natural logarithm as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction ln(UD60x18 x) pure returns (UD60x18 result) {\n unchecked {\n // Inline the fixed-point multiplication to save gas. This is overflow-safe because the maximum value that\n // {log2} can return is ~196_205294292027477728.\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_E);\n }\n}\n\n/// @notice Calculates the common logarithm of x using the following formula:\n///\n/// $$\n/// log_{10}{x} = log_2{x} / log_2{10}\n/// $$\n///\n/// However, if x is an exact power of ten, a hard coded value is returned.\n///\n/// @dev Notes:\n/// - Refer to the notes in {log2}.\n///\n/// Requirements:\n/// - Refer to the requirements in {log2}.\n///\n/// @param x The UD60x18 number for which to calculate the common logarithm.\n/// @return result The common logarithm as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction log10(UD60x18 x) pure returns (UD60x18 result) {\n uint256 xUint = x.unwrap();\n if (xUint < uUNIT) {\n revert Errors.PRBMath_UD60x18_Log_InputTooSmall(x);\n }\n\n // Note that the `mul` in this assembly block is the standard multiplication operation, not {UD60x18.mul}.\n // prettier-ignore\n assembly (\"memory-safe\") {\n switch x\n case 1 { result := mul(uUNIT, sub(0, 18)) }\n case 10 { result := mul(uUNIT, sub(1, 18)) }\n case 100 { result := mul(uUNIT, sub(2, 18)) }\n case 1000 { result := mul(uUNIT, sub(3, 18)) }\n case 10000 { result := mul(uUNIT, sub(4, 18)) }\n case 100000 { result := mul(uUNIT, sub(5, 18)) }\n case 1000000 { result := mul(uUNIT, sub(6, 18)) }\n case 10000000 { result := mul(uUNIT, sub(7, 18)) }\n case 100000000 { result := mul(uUNIT, sub(8, 18)) }\n case 1000000000 { result := mul(uUNIT, sub(9, 18)) }\n case 10000000000 { result := mul(uUNIT, sub(10, 18)) }\n case 100000000000 { result := mul(uUNIT, sub(11, 18)) }\n case 1000000000000 { result := mul(uUNIT, sub(12, 18)) }\n case 10000000000000 { result := mul(uUNIT, sub(13, 18)) }\n case 100000000000000 { result := mul(uUNIT, sub(14, 18)) }\n case 1000000000000000 { result := mul(uUNIT, sub(15, 18)) }\n case 10000000000000000 { result := mul(uUNIT, sub(16, 18)) }\n case 100000000000000000 { result := mul(uUNIT, sub(17, 18)) }\n case 1000000000000000000 { result := 0 }\n case 10000000000000000000 { result := uUNIT }\n case 100000000000000000000 { result := mul(uUNIT, 2) }\n case 1000000000000000000000 { result := mul(uUNIT, 3) }\n case 10000000000000000000000 { result := mul(uUNIT, 4) }\n case 100000000000000000000000 { result := mul(uUNIT, 5) }\n case 1000000000000000000000000 { result := mul(uUNIT, 6) }\n case 10000000000000000000000000 { result := mul(uUNIT, 7) }\n case 100000000000000000000000000 { result := mul(uUNIT, 8) }\n case 1000000000000000000000000000 { result := mul(uUNIT, 9) }\n case 10000000000000000000000000000 { result := mul(uUNIT, 10) }\n case 100000000000000000000000000000 { result := mul(uUNIT, 11) }\n case 1000000000000000000000000000000 { result := mul(uUNIT, 12) }\n case 10000000000000000000000000000000 { result := mul(uUNIT, 13) }\n case 100000000000000000000000000000000 { result := mul(uUNIT, 14) }\n case 1000000000000000000000000000000000 { result := mul(uUNIT, 15) }\n case 10000000000000000000000000000000000 { result := mul(uUNIT, 16) }\n case 100000000000000000000000000000000000 { result := mul(uUNIT, 17) }\n case 1000000000000000000000000000000000000 { result := mul(uUNIT, 18) }\n case 10000000000000000000000000000000000000 { result := mul(uUNIT, 19) }\n case 100000000000000000000000000000000000000 { result := mul(uUNIT, 20) }\n case 1000000000000000000000000000000000000000 { result := mul(uUNIT, 21) }\n case 10000000000000000000000000000000000000000 { result := mul(uUNIT, 22) }\n case 100000000000000000000000000000000000000000 { result := mul(uUNIT, 23) }\n case 1000000000000000000000000000000000000000000 { result := mul(uUNIT, 24) }\n case 10000000000000000000000000000000000000000000 { result := mul(uUNIT, 25) }\n case 100000000000000000000000000000000000000000000 { result := mul(uUNIT, 26) }\n case 1000000000000000000000000000000000000000000000 { result := mul(uUNIT, 27) }\n case 10000000000000000000000000000000000000000000000 { result := mul(uUNIT, 28) }\n case 100000000000000000000000000000000000000000000000 { result := mul(uUNIT, 29) }\n case 1000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 30) }\n case 10000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 31) }\n case 100000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 32) }\n case 1000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 33) }\n case 10000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 34) }\n case 100000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 35) }\n case 1000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 36) }\n case 10000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 37) }\n case 100000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 38) }\n case 1000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 39) }\n case 10000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 40) }\n case 100000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 41) }\n case 1000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 42) }\n case 10000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 43) }\n case 100000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 44) }\n case 1000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 45) }\n case 10000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 46) }\n case 100000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 47) }\n case 1000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 48) }\n case 10000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 49) }\n case 100000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 50) }\n case 1000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 51) }\n case 10000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 52) }\n case 100000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 53) }\n case 1000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 54) }\n case 10000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 55) }\n case 100000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 56) }\n case 1000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 57) }\n case 10000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 58) }\n case 100000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 59) }\n default { result := uMAX_UD60x18 }\n }\n\n if (result.unwrap() == uMAX_UD60x18) {\n unchecked {\n // Inline the fixed-point division to save gas.\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_10);\n }\n }\n}\n\n/// @notice Calculates the binary logarithm of x using the iterative approximation algorithm:\n///\n/// $$\n/// log_2{x} = n + log_2{y}, \\text{ where } y = x*2^{-n}, \\ y \\in [1, 2)\n/// $$\n///\n/// For $0 \\leq x \\lt 1$, the input is inverted:\n///\n/// $$\n/// log_2{x} = -log_2{\\frac{1}{x}}\n/// $$\n///\n/// @dev See https://en.wikipedia.org/wiki/Binary_logarithm#Iterative_approximation\n///\n/// Notes:\n/// - Due to the lossy precision of the iterative approximation, the results are not perfectly accurate to the last decimal.\n///\n/// Requirements:\n/// - x must be greater than zero.\n///\n/// @param x The UD60x18 number for which to calculate the binary logarithm.\n/// @return result The binary logarithm as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction log2(UD60x18 x) pure returns (UD60x18 result) {\n uint256 xUint = x.unwrap();\n\n if (xUint < uUNIT) {\n revert Errors.PRBMath_UD60x18_Log_InputTooSmall(x);\n }\n\n unchecked {\n // Calculate the integer part of the logarithm.\n uint256 n = Common.msb(xUint / uUNIT);\n\n // This is the integer part of the logarithm as a UD60x18 number. The operation can't overflow because n\n // n is at most 255 and UNIT is 1e18.\n uint256 resultUint = n * uUNIT;\n\n // Calculate $y = x * 2^{-n}$.\n uint256 y = xUint >> n;\n\n // If y is the unit number, the fractional part is zero.\n if (y == uUNIT) {\n return wrap(resultUint);\n }\n\n // Calculate the fractional part via the iterative approximation.\n // The `delta >>= 1` part is equivalent to `delta /= 2`, but shifting bits is more gas efficient.\n uint256 DOUBLE_UNIT = 2e18;\n for (uint256 delta = uHALF_UNIT; delta > 0; delta >>= 1) {\n y = (y * y) / uUNIT;\n\n // Is y^2 >= 2e18 and so in the range [2e18, 4e18)?\n if (y >= DOUBLE_UNIT) {\n // Add the 2^{-m} factor to the logarithm.\n resultUint += delta;\n\n // Halve y, which corresponds to z/2 in the Wikipedia article.\n y >>= 1;\n }\n }\n result = wrap(resultUint);\n }\n}\n\n/// @notice Multiplies two UD60x18 numbers together, returning a new UD60x18 number.\n///\n/// @dev Uses {Common.mulDiv} to enable overflow-safe multiplication and division.\n///\n/// Notes:\n/// - Refer to the notes in {Common.mulDiv}.\n///\n/// Requirements:\n/// - Refer to the requirements in {Common.mulDiv}.\n///\n/// @dev See the documentation in {Common.mulDiv18}.\n/// @param x The multiplicand as a UD60x18 number.\n/// @param y The multiplier as a UD60x18 number.\n/// @return result The product as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction mul(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\n result = wrap(Common.mulDiv18(x.unwrap(), y.unwrap()));\n}\n\n/// @notice Raises x to the power of y.\n///\n/// For $1 \\leq x \\leq \\infty$, the following standard formula is used:\n///\n/// $$\n/// x^y = 2^{log_2{x} * y}\n/// $$\n///\n/// For $0 \\leq x \\lt 1$, since the unsigned {log2} is undefined, an equivalent formula is used:\n///\n/// $$\n/// i = \\frac{1}{x}\n/// w = 2^{log_2{i} * y}\n/// x^y = \\frac{1}{w}\n/// $$\n///\n/// @dev Notes:\n/// - Refer to the notes in {log2} and {mul}.\n/// - Returns `UNIT` for 0^0.\n/// - It may not perform well with very small values of x. Consider using SD59x18 as an alternative.\n///\n/// Requirements:\n/// - Refer to the requirements in {exp2}, {log2}, and {mul}.\n///\n/// @param x The base as a UD60x18 number.\n/// @param y The exponent as a UD60x18 number.\n/// @return result The result as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction pow(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\n uint256 xUint = x.unwrap();\n uint256 yUint = y.unwrap();\n\n // If both x and y are zero, the result is `UNIT`. If just x is zero, the result is always zero.\n if (xUint == 0) {\n return yUint == 0 ? UNIT : ZERO;\n }\n // If x is `UNIT`, the result is always `UNIT`.\n else if (xUint == uUNIT) {\n return UNIT;\n }\n\n // If y is zero, the result is always `UNIT`.\n if (yUint == 0) {\n return UNIT;\n }\n // If y is `UNIT`, the result is always x.\n else if (yUint == uUNIT) {\n return x;\n }\n\n // If x is greater than `UNIT`, use the standard formula.\n if (xUint > uUNIT) {\n result = exp2(mul(log2(x), y));\n }\n // Conversely, if x is less than `UNIT`, use the equivalent formula.\n else {\n UD60x18 i = wrap(uUNIT_SQUARED / xUint);\n UD60x18 w = exp2(mul(log2(i), y));\n result = wrap(uUNIT_SQUARED / w.unwrap());\n }\n}\n\n/// @notice Raises x (a UD60x18 number) to the power y (an unsigned basic integer) using the well-known\n/// algorithm \"exponentiation by squaring\".\n///\n/// @dev See https://en.wikipedia.org/wiki/Exponentiation_by_squaring.\n///\n/// Notes:\n/// - Refer to the notes in {Common.mulDiv18}.\n/// - Returns `UNIT` for 0^0.\n///\n/// Requirements:\n/// - The result must fit in UD60x18.\n///\n/// @param x The base as a UD60x18 number.\n/// @param y The exponent as a uint256.\n/// @return result The result as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction powu(UD60x18 x, uint256 y) pure returns (UD60x18 result) {\n // Calculate the first iteration of the loop in advance.\n uint256 xUint = x.unwrap();\n uint256 resultUint = y & 1 > 0 ? xUint : uUNIT;\n\n // Equivalent to `for(y /= 2; y > 0; y /= 2)`.\n for (y >>= 1; y > 0; y >>= 1) {\n xUint = Common.mulDiv18(xUint, xUint);\n\n // Equivalent to `y % 2 == 1`.\n if (y & 1 > 0) {\n resultUint = Common.mulDiv18(resultUint, xUint);\n }\n }\n result = wrap(resultUint);\n}\n\n/// @notice Calculates the square root of x using the Babylonian method.\n///\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\n///\n/// Notes:\n/// - The result is rounded toward zero.\n///\n/// Requirements:\n/// - x must be less than `MAX_UD60x18 / UNIT`.\n///\n/// @param x The UD60x18 number for which to calculate the square root.\n/// @return result The result as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction sqrt(UD60x18 x) pure returns (UD60x18 result) {\n uint256 xUint = x.unwrap();\n\n unchecked {\n if (xUint > uMAX_UD60x18 / uUNIT) {\n revert Errors.PRBMath_UD60x18_Sqrt_Overflow(x);\n }\n // Multiply x by `UNIT` to account for the factor of `UNIT` picked up when multiplying two UD60x18 numbers.\n // In this case, the two numbers are both the square root.\n result = wrap(Common.sqrt(xUint * uUNIT));\n }\n}\n" + }, + "@prb/math/src/ud60x18/ValueType.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport \"./Casting.sol\" as Casting;\nimport \"./Helpers.sol\" as Helpers;\nimport \"./Math.sol\" as Math;\n\n/// @notice The unsigned 60.18-decimal fixed-point number representation, which can have up to 60 digits and up to 18\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the Solidity type uint256.\n/// @dev The value type is defined here so it can be imported in all other files.\ntype UD60x18 is uint256;\n\n/*//////////////////////////////////////////////////////////////////////////\n CASTING\n//////////////////////////////////////////////////////////////////////////*/\n\nusing {\n Casting.intoSD1x18,\n Casting.intoUD2x18,\n Casting.intoSD59x18,\n Casting.intoUint128,\n Casting.intoUint256,\n Casting.intoUint40,\n Casting.unwrap\n} for UD60x18 global;\n\n/*//////////////////////////////////////////////////////////////////////////\n MATHEMATICAL FUNCTIONS\n//////////////////////////////////////////////////////////////////////////*/\n\n// The global \"using for\" directive makes the functions in this library callable on the UD60x18 type.\nusing {\n Math.avg,\n Math.ceil,\n Math.div,\n Math.exp,\n Math.exp2,\n Math.floor,\n Math.frac,\n Math.gm,\n Math.inv,\n Math.ln,\n Math.log10,\n Math.log2,\n Math.mul,\n Math.pow,\n Math.powu,\n Math.sqrt\n} for UD60x18 global;\n\n/*//////////////////////////////////////////////////////////////////////////\n HELPER FUNCTIONS\n//////////////////////////////////////////////////////////////////////////*/\n\n// The global \"using for\" directive makes the functions in this library callable on the UD60x18 type.\nusing {\n Helpers.add,\n Helpers.and,\n Helpers.eq,\n Helpers.gt,\n Helpers.gte,\n Helpers.isZero,\n Helpers.lshift,\n Helpers.lt,\n Helpers.lte,\n Helpers.mod,\n Helpers.neq,\n Helpers.not,\n Helpers.or,\n Helpers.rshift,\n Helpers.sub,\n Helpers.uncheckedAdd,\n Helpers.uncheckedSub,\n Helpers.xor\n} for UD60x18 global;\n\n/*//////////////////////////////////////////////////////////////////////////\n OPERATORS\n//////////////////////////////////////////////////////////////////////////*/\n\n// The global \"using for\" directive makes it possible to use these operators on the UD60x18 type.\nusing {\n Helpers.add as +,\n Helpers.and2 as &,\n Math.div as /,\n Helpers.eq as ==,\n Helpers.gt as >,\n Helpers.gte as >=,\n Helpers.lt as <,\n Helpers.lte as <=,\n Helpers.or as |,\n Helpers.mod as %,\n Math.mul as *,\n Helpers.neq as !=,\n Helpers.not as ~,\n Helpers.sub as -,\n Helpers.xor as ^\n} for UD60x18 global;\n" + }, + "contracts/autonomous-admin/DecentAutonomousAdminV1.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.28;\n\nimport {IHats} from \"../interfaces/hats/IHats.sol\";\nimport {IHatsElectionsEligibility} from \"../interfaces/hats/modules/IHatsElectionsEligibility.sol\";\nimport {FactoryFriendly} from \"@gnosis.pm/zodiac/contracts/factory/FactoryFriendly.sol\";\nimport {ERC165} from \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport {IDecentAutonomousAdminV1} from \"../interfaces/autonomous-admin/IDecentAutonomousAdminV1.sol\";\n\ncontract DecentAutonomousAdminV1 is\n IDecentAutonomousAdminV1,\n ERC165,\n FactoryFriendly\n{\n // //////////////////////////////////////////////////////////////\n // initializer\n // //////////////////////////////////////////////////////////////\n function setUp(bytes memory initializeParams) public override initializer {}\n\n // //////////////////////////////////////////////////////////////\n // Public Functions\n // //////////////////////////////////////////////////////////////\n function triggerStartNextTerm(TriggerStartArgs calldata args) public {\n IHatsElectionsEligibility hatsElectionModule = IHatsElectionsEligibility(\n args.hatsProtocol.getHatEligibilityModule(args.hatId)\n );\n\n hatsElectionModule.startNextTerm();\n\n // This will burn the hat if wearer is no longer eligible\n args.hatsProtocol.checkHatWearerStatus(args.hatId, args.currentWearer);\n\n // This will mint the hat to the nominated wearer, if necessary\n if (args.nominatedWearer != args.currentWearer) {\n args.hatsProtocol.mintHat(args.hatId, args.nominatedWearer);\n }\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view override returns (bool) {\n return\n interfaceId == type(IDecentAutonomousAdminV1).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n}\n" + }, + "contracts/hardhat-dependency-compiler/@gnosis.pm/safe-contracts/contracts/GnosisSafeL2.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >0.0.0;\nimport '@gnosis.pm/safe-contracts/contracts/GnosisSafeL2.sol';\n" + }, + "contracts/hardhat-dependency-compiler/@gnosis.pm/safe-contracts/contracts/libraries/MultiSendCallOnly.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >0.0.0;\nimport '@gnosis.pm/safe-contracts/contracts/libraries/MultiSendCallOnly.sol';\n" + }, + "contracts/hardhat-dependency-compiler/@gnosis.pm/safe-contracts/contracts/proxies/GnosisSafeProxyFactory.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >0.0.0;\nimport '@gnosis.pm/safe-contracts/contracts/proxies/GnosisSafeProxyFactory.sol';\n" + }, + "contracts/interfaces/autonomous-admin/IDecentAutonomousAdminV1.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.28;\n\nimport {IHats} from \"../hats/IHats.sol\";\n\ninterface IDecentAutonomousAdminV1 {\n error NotCurrentWearer();\n\n struct TriggerStartArgs {\n address currentWearer;\n IHats hatsProtocol;\n uint256 hatId;\n address nominatedWearer;\n }\n\n function triggerStartNextTerm(TriggerStartArgs calldata args) external;\n}\n" + }, + "contracts/interfaces/hats/HatsErrors.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\n// Copyright (C) 2023 Haberdasher Labs\n//\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU Affero General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU Affero General Public License for more details.\n//\n// You should have received a copy of the GNU Affero General Public License\n// along with this program. If not, see .\n\npragma solidity >=0.8.13;\n\ninterface HatsErrors {\n /// @notice Emitted when `user` is attempting to perform an action on `hatId` but is not wearing one of `hatId`'s admin hats\n /// @dev Can be equivalent to `NotHatWearer(buildHatId(hatId))`, such as when emitted by `approveLinkTopHatToTree` or `relinkTopHatToTree`\n error NotAdmin(address user, uint256 hatId);\n\n /// @notice Emitted when attempting to perform an action as or for an account that is not a wearer of a given hat\n error NotHatWearer();\n\n /// @notice Emitted when attempting to perform an action that requires being either an admin or wearer of a given hat\n error NotAdminOrWearer();\n\n /// @notice Emitted when attempting to mint `hatId` but `hatId`'s maxSupply has been reached\n error AllHatsWorn(uint256 hatId);\n\n /// @notice Emitted when attempting to create a hat with a level 14 hat as its admin\n error MaxLevelsReached();\n\n /// @notice Emitted when an attempted hat id has empty intermediate level(s)\n error InvalidHatId();\n\n /// @notice Emitted when attempting to mint `hatId` to a `wearer` who is already wearing the hat\n error AlreadyWearingHat(address wearer, uint256 hatId);\n\n /// @notice Emitted when attempting to mint a non-existant hat\n error HatDoesNotExist(uint256 hatId);\n\n /// @notice Emmitted when attempting to mint or transfer a hat that is not active\n error HatNotActive();\n\n /// @notice Emitted when attempting to mint or transfer a hat to an ineligible wearer\n error NotEligible();\n\n /// @notice Emitted when attempting to check or set a hat's status from an account that is not that hat's toggle module\n error NotHatsToggle();\n\n /// @notice Emitted when attempting to check or set a hat wearer's status from an account that is not that hat's eligibility module\n error NotHatsEligibility();\n\n /// @notice Emitted when array arguments to a batch function have mismatching lengths\n error BatchArrayLengthMismatch();\n\n /// @notice Emitted when attempting to mutate or transfer an immutable hat\n error Immutable();\n\n /// @notice Emitted when attempting to change a hat's maxSupply to a value lower than its current supply\n error NewMaxSupplyTooLow();\n\n /// @notice Emitted when attempting to link a tophat to a new admin for which the tophat serves as an admin\n error CircularLinkage();\n\n /// @notice Emitted when attempting to link or relink a tophat to a separate tree\n error CrossTreeLinkage();\n\n /// @notice Emitted when attempting to link a tophat without a request\n error LinkageNotRequested();\n\n /// @notice Emitted when attempting to unlink a tophat that does not have a wearer\n /// @dev This ensures that unlinking never results in a bricked tophat\n error InvalidUnlink();\n\n /// @notice Emmited when attempting to change a hat's eligibility or toggle module to the zero address\n error ZeroAddress();\n\n /// @notice Emmitted when attempting to change a hat's details or imageURI to a string with over 7000 bytes (~characters)\n /// @dev This protects against a DOS attack where an admin iteratively extend's a hat's details or imageURI\n /// to be so long that reading it exceeds the block gas limit, breaking `uri()` and `viewHat()`\n error StringTooLong();\n}\n" + }, + "contracts/interfaces/hats/HatsEvents.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\n// Copyright (C) 2023 Haberdasher Labs\n//\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU Affero General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU Affero General Public License for more details.\n//\n// You should have received a copy of the GNU Affero General Public License\n// along with this program. If not, see .\n\npragma solidity >=0.8.13;\n\ninterface HatsEvents {\n /// @notice Emitted when a new hat is created\n /// @param id The id for the new hat\n /// @param details A description of the Hat\n /// @param maxSupply The total instances of the Hat that can be worn at once\n /// @param eligibility The address that can report on the Hat wearer's status\n /// @param toggle The address that can deactivate the Hat\n /// @param mutable_ Whether the hat's properties are changeable after creation\n /// @param imageURI The image uri for this hat and the fallback for its\n event HatCreated(\n uint256 id,\n string details,\n uint32 maxSupply,\n address eligibility,\n address toggle,\n bool mutable_,\n string imageURI\n );\n\n /// @notice Emitted when a hat wearer's standing is updated\n /// @dev Eligibility is excluded since the source of truth for eligibility is the eligibility module and may change without a transaction\n /// @param hatId The id of the wearer's hat\n /// @param wearer The wearer's address\n /// @param wearerStanding Whether the wearer is in good standing for the hat\n event WearerStandingChanged(\n uint256 hatId,\n address wearer,\n bool wearerStanding\n );\n\n /// @notice Emitted when a hat's status is updated\n /// @param hatId The id of the hat\n /// @param newStatus Whether the hat is active\n event HatStatusChanged(uint256 hatId, bool newStatus);\n\n /// @notice Emitted when a hat's details are updated\n /// @param hatId The id of the hat\n /// @param newDetails The updated details\n event HatDetailsChanged(uint256 hatId, string newDetails);\n\n /// @notice Emitted when a hat's eligibility module is updated\n /// @param hatId The id of the hat\n /// @param newEligibility The updated eligibiliy module\n event HatEligibilityChanged(uint256 hatId, address newEligibility);\n\n /// @notice Emitted when a hat's toggle module is updated\n /// @param hatId The id of the hat\n /// @param newToggle The updated toggle module\n event HatToggleChanged(uint256 hatId, address newToggle);\n\n /// @notice Emitted when a hat's mutability is updated\n /// @param hatId The id of the hat\n event HatMutabilityChanged(uint256 hatId);\n\n /// @notice Emitted when a hat's maximum supply is updated\n /// @param hatId The id of the hat\n /// @param newMaxSupply The updated max supply\n event HatMaxSupplyChanged(uint256 hatId, uint32 newMaxSupply);\n\n /// @notice Emitted when a hat's image URI is updated\n /// @param hatId The id of the hat\n /// @param newImageURI The updated image URI\n event HatImageURIChanged(uint256 hatId, string newImageURI);\n\n /// @notice Emitted when a tophat linkage is requested by its admin\n /// @param domain The domain of the tree tophat to link\n /// @param newAdmin The tophat's would-be admin in the parent tree\n event TopHatLinkRequested(uint32 domain, uint256 newAdmin);\n\n /// @notice Emitted when a tophat is linked to a another tree\n /// @param domain The domain of the newly-linked tophat\n /// @param newAdmin The tophat's new admin in the parent tree\n event TopHatLinked(uint32 domain, uint256 newAdmin);\n}\n" + }, + "contracts/interfaces/hats/IHats.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\n// Copyright (C) 2023 Haberdasher Labs\n//\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU Affero General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU Affero General Public License for more details.\n//\n// You should have received a copy of the GNU Affero General Public License\n// along with this program. If not, see .\n\npragma solidity >=0.8.13;\n\nimport \"./IHatsIdUtilities.sol\";\nimport \"./HatsErrors.sol\";\nimport \"./HatsEvents.sol\";\n\ninterface IHats is IHatsIdUtilities, HatsErrors, HatsEvents {\n function mintTopHat(\n address _target,\n string memory _details,\n string memory _imageURI\n ) external returns (uint256 topHatId);\n\n function createHat(\n uint256 _admin,\n string calldata _details,\n uint32 _maxSupply,\n address _eligibility,\n address _toggle,\n bool _mutable,\n string calldata _imageURI\n ) external returns (uint256 newHatId);\n\n function batchCreateHats(\n uint256[] calldata _admins,\n string[] calldata _details,\n uint32[] calldata _maxSupplies,\n address[] memory _eligibilityModules,\n address[] memory _toggleModules,\n bool[] calldata _mutables,\n string[] calldata _imageURIs\n ) external returns (bool success);\n\n function getNextId(uint256 _admin) external view returns (uint256 nextId);\n\n function mintHat(\n uint256 _hatId,\n address _wearer\n ) external returns (bool success);\n\n function batchMintHats(\n uint256[] calldata _hatIds,\n address[] calldata _wearers\n ) external returns (bool success);\n\n function setHatStatus(\n uint256 _hatId,\n bool _newStatus\n ) external returns (bool toggled);\n\n function checkHatStatus(uint256 _hatId) external returns (bool toggled);\n\n function setHatWearerStatus(\n uint256 _hatId,\n address _wearer,\n bool _eligible,\n bool _standing\n ) external returns (bool updated);\n\n function checkHatWearerStatus(\n uint256 _hatId,\n address _wearer\n ) external returns (bool updated);\n\n function renounceHat(uint256 _hatId) external;\n\n function transferHat(uint256 _hatId, address _from, address _to) external;\n\n /*//////////////////////////////////////////////////////////////\n HATS ADMIN FUNCTIONS\n //////////////////////////////////////////////////////////////*/\n\n function makeHatImmutable(uint256 _hatId) external;\n\n function changeHatDetails(\n uint256 _hatId,\n string memory _newDetails\n ) external;\n\n function changeHatEligibility(\n uint256 _hatId,\n address _newEligibility\n ) external;\n\n function changeHatToggle(uint256 _hatId, address _newToggle) external;\n\n function changeHatImageURI(\n uint256 _hatId,\n string memory _newImageURI\n ) external;\n\n function changeHatMaxSupply(uint256 _hatId, uint32 _newMaxSupply) external;\n\n function requestLinkTopHatToTree(\n uint32 _topHatId,\n uint256 _newAdminHat\n ) external;\n\n function approveLinkTopHatToTree(\n uint32 _topHatId,\n uint256 _newAdminHat,\n address _eligibility,\n address _toggle,\n string calldata _details,\n string calldata _imageURI\n ) external;\n\n function unlinkTopHatFromTree(uint32 _topHatId, address _wearer) external;\n\n function relinkTopHatWithinTree(\n uint32 _topHatDomain,\n uint256 _newAdminHat,\n address _eligibility,\n address _toggle,\n string calldata _details,\n string calldata _imageURI\n ) external;\n\n /*//////////////////////////////////////////////////////////////\n VIEW FUNCTIONS\n //////////////////////////////////////////////////////////////*/\n\n function viewHat(\n uint256 _hatId\n )\n external\n view\n returns (\n string memory details,\n uint32 maxSupply,\n uint32 supply,\n address eligibility,\n address toggle,\n string memory imageURI,\n uint16 lastHatId,\n bool mutable_,\n bool active\n );\n\n function isWearerOfHat(\n address _user,\n uint256 _hatId\n ) external view returns (bool isWearer);\n\n function isAdminOfHat(\n address _user,\n uint256 _hatId\n ) external view returns (bool isAdmin);\n\n function isInGoodStanding(\n address _wearer,\n uint256 _hatId\n ) external view returns (bool standing);\n\n function isEligible(\n address _wearer,\n uint256 _hatId\n ) external view returns (bool eligible);\n\n function getHatEligibilityModule(\n uint256 _hatId\n ) external view returns (address eligibility);\n\n function getHatToggleModule(\n uint256 _hatId\n ) external view returns (address toggle);\n\n function getHatMaxSupply(\n uint256 _hatId\n ) external view returns (uint32 maxSupply);\n\n function hatSupply(uint256 _hatId) external view returns (uint32 supply);\n\n function getImageURIForHat(\n uint256 _hatId\n ) external view returns (string memory _uri);\n\n function balanceOf(\n address wearer,\n uint256 hatId\n ) external view returns (uint256 balance);\n\n function balanceOfBatch(\n address[] calldata _wearers,\n uint256[] calldata _hatIds\n ) external view returns (uint256[] memory);\n\n function uri(uint256 id) external view returns (string memory _uri);\n}\n" + }, + "contracts/interfaces/hats/IHatsIdUtilities.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\n// Copyright (C) 2023 Haberdasher Labs\n//\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU Affero General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU Affero General Public License for more details.\n//\n// You should have received a copy of the GNU Affero General Public License\n// along with this program. If not, see .\n\npragma solidity >=0.8.13;\n\ninterface IHatsIdUtilities {\n function buildHatId(\n uint256 _admin,\n uint16 _newHat\n ) external pure returns (uint256 id);\n\n function getHatLevel(uint256 _hatId) external view returns (uint32 level);\n\n function getLocalHatLevel(\n uint256 _hatId\n ) external pure returns (uint32 level);\n\n function isTopHat(uint256 _hatId) external view returns (bool _topHat);\n\n function isLocalTopHat(\n uint256 _hatId\n ) external pure returns (bool _localTopHat);\n\n function isValidHatId(\n uint256 _hatId\n ) external view returns (bool validHatId);\n\n function getAdminAtLevel(\n uint256 _hatId,\n uint32 _level\n ) external view returns (uint256 admin);\n\n function getAdminAtLocalLevel(\n uint256 _hatId,\n uint32 _level\n ) external pure returns (uint256 admin);\n\n function getTopHatDomain(\n uint256 _hatId\n ) external view returns (uint32 domain);\n\n function getTippyTopHatDomain(\n uint32 _topHatDomain\n ) external view returns (uint32 domain);\n\n function noCircularLinkage(\n uint32 _topHatDomain,\n uint256 _linkedAdmin\n ) external view returns (bool notCircular);\n\n function sameTippyTopHatDomain(\n uint32 _topHatDomain,\n uint256 _newAdminHat\n ) external view returns (bool sameDomain);\n}\n" + }, + "contracts/interfaces/hats/IHatsModuleFactory.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\ninterface IHatsModuleFactory {\n error HatsModuleFactory_ModuleAlreadyDeployed(\n address implementation,\n uint256 hatId,\n bytes otherImmutableArgs,\n uint256 saltNonce\n );\n\n error BatchArrayLengthMismatch();\n\n event HatsModuleFactory_ModuleDeployed(\n address implementation,\n address instance,\n uint256 hatId,\n bytes otherImmutableArgs,\n bytes initData,\n uint256 saltNonce\n );\n\n function HATS() external view returns (address);\n\n function version() external view returns (string memory);\n\n function createHatsModule(\n address _implementation,\n uint256 _hatId,\n bytes calldata _otherImmutableArgs,\n bytes calldata _initData,\n uint256 _saltNonce\n ) external returns (address _instance);\n\n function batchCreateHatsModule(\n address[] calldata _implementations,\n uint256[] calldata _hatIds,\n bytes[] calldata _otherImmutableArgsArray,\n bytes[] calldata _initDataArray,\n uint256[] calldata _saltNonces\n ) external returns (bool success);\n\n function getHatsModuleAddress(\n address _implementation,\n uint256 _hatId,\n bytes calldata _otherImmutableArgs,\n uint256 _saltNonce\n ) external view returns (address);\n\n function deployed(\n address _implementation,\n uint256 _hatId,\n bytes calldata _otherImmutableArgs,\n uint256 _saltNonce\n ) external view returns (bool);\n}\n" + }, + "contracts/interfaces/hats/modules/IHatsElectionsEligibility.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.13;\n\ninterface IHatsElectionsEligibility {\n event ElectionOpened(uint128 nextTermEnd);\n event ElectionCompleted(uint128 termEnd, address[] winners);\n event NewTermStarted(uint128 termEnd);\n event Recalled(uint128 termEnd, address[] accounts);\n\n /// @notice Returns the first second after the current term ends.\n /// @dev Also serves as the id for the current term.\n function currentTermEnd() external view returns (uint128);\n\n /// @notice Returns the first second after the next term ends.\n /// @dev Also serves as the id for the next term.\n function nextTermEnd() external view returns (uint128);\n\n /// @notice Returns the election status (open or closed) for a given term end.\n /// @param termEnd The term end timestamp to query.\n function electionStatus(\n uint128 termEnd\n ) external view returns (bool isElectionOpen);\n\n /// @notice Returns whether a candidate was elected in a given term.\n /// @param termEnd The term end timestamp to query.\n /// @param candidate The address of the candidate.\n function electionResults(\n uint128 termEnd,\n address candidate\n ) external view returns (bool elected);\n\n /// @notice Returns the BALLOT_BOX_HAT constant.\n function BALLOT_BOX_HAT() external pure returns (uint256);\n\n /// @notice Returns the ADMIN_HAT constant.\n function ADMIN_HAT() external pure returns (uint256);\n\n /**\n * @notice Submit the results of an election for a specified term.\n * @dev Only callable by the wearer(s) of the BALLOT_BOX_HAT.\n * @param _termEnd The id of the term for which the election results are being submitted.\n * @param _winners The addresses of the winners of the election.\n */\n function elect(uint128 _termEnd, address[] calldata _winners) external;\n\n /**\n * @notice Submit the results of a recall election for a specified term.\n * @dev Only callable by the wearer(s) of the BALLOT_BOX_HAT.\n * @param _termEnd The id of the term for which the recall results are being submitted.\n * @param _recallees The addresses to be recalled.\n */\n function recall(uint128 _termEnd, address[] calldata _recallees) external;\n\n /**\n * @notice Set the next term and open the election for it.\n * @dev Only callable by the wearer(s) of the ADMIN_HAT.\n * @param _newTermEnd The id of the term that will be opened.\n */\n function setNextTerm(uint128 _newTermEnd) external;\n\n /**\n * @notice Start the next term, updating the current term.\n * @dev Can be called by anyone, but will revert if conditions are not met.\n */\n function startNextTerm() external;\n\n /**\n * @notice Determine the eligibility and standing of a wearer for a hat.\n * @param _wearer The address of the hat wearer.\n * @param _hatId The ID of the hat.\n * @return eligible True if the wearer is eligible for the hat.\n * @return standing True if the wearer is in good standing.\n */\n function getWearerStatus(\n address _wearer,\n uint256 _hatId\n ) external view returns (bool eligible, bool standing);\n}\n" + }, + "contracts/interfaces/IERC6551Registry.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IERC6551Registry {\n /**\n * @dev Creates a token bound account for a non-fungible token.\n *\n * If account has already been created, returns the account address without calling create2.\n *\n * Emits ERC6551AccountCreated event.\n *\n * @return account The address of the token bound account\n */\n function createAccount(\n address implementation,\n bytes32 salt,\n uint256 chainId,\n address tokenContract,\n uint256 tokenId\n ) external returns (address account);\n}\n" + }, + "contracts/interfaces/sablier/IAdminable.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\npragma solidity >=0.8.22;\n\n/// @title IAdminable\n/// @notice Contract module that provides a basic access control mechanism, with an admin that can be\n/// granted exclusive access to specific functions. The inheriting contract must set the initial admin\n/// in the constructor.\ninterface IAdminable {\n /*//////////////////////////////////////////////////////////////////////////\n EVENTS\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @notice Emitted when the admin is transferred.\n /// @param oldAdmin The address of the old admin.\n /// @param newAdmin The address of the new admin.\n event TransferAdmin(address indexed oldAdmin, address indexed newAdmin);\n\n /*//////////////////////////////////////////////////////////////////////////\n CONSTANT FUNCTIONS\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @notice The address of the admin account or contract.\n function admin() external view returns (address);\n\n /*//////////////////////////////////////////////////////////////////////////\n NON-CONSTANT FUNCTIONS\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @notice Transfers the contract admin to a new address.\n ///\n /// @dev Notes:\n /// - Does not revert if the admin is the same.\n /// - This function can potentially leave the contract without an admin, thereby removing any\n /// functionality that is only available to the admin.\n ///\n /// Requirements:\n /// - `msg.sender` must be the contract admin.\n ///\n /// @param newAdmin The address of the new admin.\n function transferAdmin(address newAdmin) external;\n}\n" + }, + "contracts/interfaces/sablier/IERC4096.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 \"@openzeppelin/contracts/interfaces/IERC165.sol\";\nimport {IERC721} from \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\n\n/// @title ERC-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" + }, + "contracts/interfaces/sablier/ISablierV2Lockup.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\npragma solidity >=0.8.22;\n\nimport {IERC4906} from \"./IERC4096.sol\";\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {IERC721Metadata} from \"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\";\nimport {UD60x18} from \"@prb/math/src/UD60x18.sol\";\n\nimport {Lockup} from \"./types/DataTypes.sol\";\nimport {IAdminable} from \"./IAdminable.sol\";\nimport {ISablierV2NFTDescriptor} from \"./ISablierV2NFTDescriptor.sol\";\n\n/// @title ISablierV2Lockup\n/// @notice Common logic between all Sablier V2 Lockup contracts.\ninterface ISablierV2Lockup is\n IAdminable, // 0 inherited components\n IERC4906, // 2 inherited components\n IERC721Metadata // 2 inherited components\n{\n /*//////////////////////////////////////////////////////////////////////////\n EVENTS\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @notice Emitted when the admin allows a new recipient contract to hook to Sablier.\n /// @param admin The address of the current contract admin.\n /// @param recipient The address of the recipient contract put on the allowlist.\n event AllowToHook(address indexed admin, address recipient);\n\n /// @notice Emitted when a stream is canceled.\n /// @param streamId The ID of the stream.\n /// @param sender The address of the stream's sender.\n /// @param recipient The address of the stream's recipient.\n /// @param asset The contract address of the ERC-20 asset to be distributed.\n /// @param senderAmount The amount of assets refunded to the stream's sender, denoted in units of the asset's\n /// decimals.\n /// @param recipientAmount The amount of assets left for the stream's recipient to withdraw, denoted in units of the\n /// asset's decimals.\n event CancelLockupStream(\n uint256 streamId,\n address indexed sender,\n address indexed recipient,\n IERC20 indexed asset,\n uint128 senderAmount,\n uint128 recipientAmount\n );\n\n /// @notice Emitted when a sender gives up the right to cancel a stream.\n /// @param streamId The ID of the stream.\n event RenounceLockupStream(uint256 indexed streamId);\n\n /// @notice Emitted when the admin sets a new NFT descriptor contract.\n /// @param admin The address of the current contract admin.\n /// @param oldNFTDescriptor The address of the old NFT descriptor contract.\n /// @param newNFTDescriptor The address of the new NFT descriptor contract.\n event SetNFTDescriptor(\n address indexed admin,\n ISablierV2NFTDescriptor oldNFTDescriptor,\n ISablierV2NFTDescriptor newNFTDescriptor\n );\n\n /// @notice Emitted when assets are withdrawn from a stream.\n /// @param streamId The ID of the stream.\n /// @param to The address that has received the withdrawn assets.\n /// @param asset The contract address of the ERC-20 asset to be distributed.\n /// @param amount The amount of assets withdrawn, denoted in units of the asset's decimals.\n event WithdrawFromLockupStream(\n uint256 indexed streamId,\n address indexed to,\n IERC20 indexed asset,\n uint128 amount\n );\n\n /*//////////////////////////////////////////////////////////////////////////\n CONSTANT FUNCTIONS\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @notice Retrieves the address of the ERC-20 asset to be distributed.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function getAsset(uint256 streamId) external view returns (IERC20 asset);\n\n /// @notice Retrieves the amount deposited in the stream, denoted in units of the asset's decimals.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function getDepositedAmount(\n uint256 streamId\n ) external view returns (uint128 depositedAmount);\n\n /// @notice Retrieves the stream's end time, which is a Unix timestamp.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function getEndTime(\n uint256 streamId\n ) external view returns (uint40 endTime);\n\n /// @notice Retrieves the stream's recipient.\n /// @dev Reverts if the NFT has been burned.\n /// @param streamId The stream ID for the query.\n function getRecipient(\n uint256 streamId\n ) external view returns (address recipient);\n\n /// @notice Retrieves the amount refunded to the sender after a cancellation, denoted in units of the asset's\n /// decimals. This amount is always zero unless the stream was canceled.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function getRefundedAmount(\n uint256 streamId\n ) external view returns (uint128 refundedAmount);\n\n /// @notice Retrieves the stream's sender.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function getSender(uint256 streamId) external view returns (address sender);\n\n /// @notice Retrieves the stream's start time, which is a Unix timestamp.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function getStartTime(\n uint256 streamId\n ) external view returns (uint40 startTime);\n\n /// @notice Retrieves the amount withdrawn from the stream, denoted in units of the asset's decimals.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function getWithdrawnAmount(\n uint256 streamId\n ) external view returns (uint128 withdrawnAmount);\n\n /// @notice Retrieves a flag indicating whether the provided address is a contract allowed to hook to Sablier\n /// when a stream is canceled or when assets are withdrawn.\n /// @dev See {ISablierLockupRecipient} for more information.\n function isAllowedToHook(\n address recipient\n ) external view returns (bool result);\n\n /// @notice Retrieves a flag indicating whether the stream can be canceled. When the stream is cold, this\n /// flag is always `false`.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function isCancelable(uint256 streamId) external view returns (bool result);\n\n /// @notice Retrieves a flag indicating whether the stream is cold, i.e. settled, canceled, or depleted.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function isCold(uint256 streamId) external view returns (bool result);\n\n /// @notice Retrieves a flag indicating whether the stream is depleted.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function isDepleted(uint256 streamId) external view returns (bool result);\n\n /// @notice Retrieves a flag indicating whether the stream exists.\n /// @dev Does not revert if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function isStream(uint256 streamId) external view returns (bool result);\n\n /// @notice Retrieves a flag indicating whether the stream NFT can be transferred.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function isTransferable(\n uint256 streamId\n ) external view returns (bool result);\n\n /// @notice Retrieves a flag indicating whether the stream is warm, i.e. either pending or streaming.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function isWarm(uint256 streamId) external view returns (bool result);\n\n /// @notice Retrieves the maximum broker fee that can be charged by the broker, denoted as a fixed-point\n /// number where 1e18 is 100%.\n /// @dev This value is hard coded as a constant.\n function MAX_BROKER_FEE() external view returns (UD60x18);\n\n /// @notice Counter for stream IDs, used in the create functions.\n function nextStreamId() external view returns (uint256);\n\n /// @notice Contract that generates the non-fungible token URI.\n function nftDescriptor() external view returns (ISablierV2NFTDescriptor);\n\n /// @notice Calculates the amount that the sender would be refunded if the stream were canceled, denoted in units\n /// of the asset's decimals.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function refundableAmountOf(\n uint256 streamId\n ) external view returns (uint128 refundableAmount);\n\n /// @notice Retrieves the stream's status.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function statusOf(\n uint256 streamId\n ) external view returns (Lockup.Status status);\n\n /// @notice Calculates the amount streamed to the recipient, denoted in units of the asset's decimals.\n /// @dev Reverts if `streamId` references a null stream.\n ///\n /// Notes:\n /// - Upon cancellation of the stream, the amount streamed is calculated as the difference between the deposited\n /// amount and the refunded amount. Ultimately, when the stream becomes depleted, the streamed amount is equivalent\n /// to the total amount withdrawn.\n ///\n /// @param streamId The stream ID for the query.\n function streamedAmountOf(\n uint256 streamId\n ) external view returns (uint128 streamedAmount);\n\n /// @notice Retrieves a flag indicating whether the stream was canceled.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function wasCanceled(uint256 streamId) external view returns (bool result);\n\n /// @notice Calculates the amount that the recipient can withdraw from the stream, denoted in units of the asset's\n /// decimals.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function withdrawableAmountOf(\n uint256 streamId\n ) external view returns (uint128 withdrawableAmount);\n\n /*//////////////////////////////////////////////////////////////////////////\n NON-CONSTANT FUNCTIONS\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @notice Allows a recipient contract to hook to Sablier when a stream is canceled or when assets are withdrawn.\n /// Useful for implementing contracts that hold streams on behalf of users, such as vaults or staking contracts.\n ///\n /// @dev Emits an {AllowToHook} event.\n ///\n /// Notes:\n /// - Does not revert if the contract is already on the allowlist.\n /// - This is an irreversible operation. The contract cannot be removed from the allowlist.\n ///\n /// Requirements:\n /// - `msg.sender` must be the contract admin.\n /// - `recipient` must have a non-zero code size.\n /// - `recipient` must implement {ISablierLockupRecipient}.\n ///\n /// @param recipient The address of the contract to allow for hooks.\n function allowToHook(address recipient) external;\n\n /// @notice Burns the NFT associated with the stream.\n ///\n /// @dev Emits a {Transfer} event.\n ///\n /// Requirements:\n /// - Must not be delegate called.\n /// - `streamId` must reference a depleted stream.\n /// - The NFT must exist.\n /// - `msg.sender` must be either the NFT owner or an approved third party.\n ///\n /// @param streamId The ID of the stream NFT to burn.\n function burn(uint256 streamId) external;\n\n /// @notice Cancels the stream and refunds any remaining assets to the sender.\n ///\n /// @dev Emits a {Transfer}, {CancelLockupStream}, and {MetadataUpdate} event.\n ///\n /// Notes:\n /// - If there any assets left for the recipient to withdraw, the stream is marked as canceled. Otherwise, the\n /// stream is marked as depleted.\n /// - This function attempts to invoke a hook on the recipient, if the resolved address is a contract.\n ///\n /// Requirements:\n /// - Must not be delegate called.\n /// - The stream must be warm and cancelable.\n /// - `msg.sender` must be the stream's sender.\n ///\n /// @param streamId The ID of the stream to cancel.\n function cancel(uint256 streamId) external;\n\n /// @notice Cancels multiple streams and refunds any remaining assets to the sender.\n ///\n /// @dev Emits multiple {Transfer}, {CancelLockupStream}, and {MetadataUpdate} events.\n ///\n /// Notes:\n /// - Refer to the notes in {cancel}.\n ///\n /// Requirements:\n /// - All requirements from {cancel} must be met for each stream.\n ///\n /// @param streamIds The IDs of the streams to cancel.\n function cancelMultiple(uint256[] calldata streamIds) external;\n\n /// @notice Removes the right of the stream's sender to cancel the stream.\n ///\n /// @dev Emits a {RenounceLockupStream} and {MetadataUpdate} event.\n ///\n /// Notes:\n /// - This is an irreversible operation.\n ///\n /// Requirements:\n /// - Must not be delegate called.\n /// - `streamId` must reference a warm stream.\n /// - `msg.sender` must be the stream's sender.\n /// - The stream must be cancelable.\n ///\n /// @param streamId The ID of the stream to renounce.\n function renounce(uint256 streamId) external;\n\n /// @notice Sets a new NFT descriptor contract, which produces the URI describing the Sablier stream NFTs.\n ///\n /// @dev Emits a {SetNFTDescriptor} and {BatchMetadataUpdate} event.\n ///\n /// Notes:\n /// - Does not revert if the NFT descriptor is the same.\n ///\n /// Requirements:\n /// - `msg.sender` must be the contract admin.\n ///\n /// @param newNFTDescriptor The address of the new NFT descriptor contract.\n function setNFTDescriptor(\n ISablierV2NFTDescriptor newNFTDescriptor\n ) external;\n\n /// @notice Withdraws the provided amount of assets from the stream to the `to` address.\n ///\n /// @dev Emits a {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} event.\n ///\n /// Notes:\n /// - This function attempts to call a hook on the recipient of the stream, unless `msg.sender` is the recipient.\n ///\n /// Requirements:\n /// - Must not be delegate called.\n /// - `streamId` must not reference a null or depleted stream.\n /// - `to` must not be the zero address.\n /// - `amount` must be greater than zero and must not exceed the withdrawable amount.\n /// - `to` must be the recipient if `msg.sender` is not the stream's recipient or an approved third party.\n ///\n /// @param streamId The ID of the stream to withdraw from.\n /// @param to The address receiving the withdrawn assets.\n /// @param amount The amount to withdraw, denoted in units of the asset's decimals.\n function withdraw(uint256 streamId, address to, uint128 amount) external;\n\n /// @notice Withdraws the maximum withdrawable amount from the stream to the provided address `to`.\n ///\n /// @dev Emits a {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} event.\n ///\n /// Notes:\n /// - Refer to the notes in {withdraw}.\n ///\n /// Requirements:\n /// - Refer to the requirements in {withdraw}.\n ///\n /// @param streamId The ID of the stream to withdraw from.\n /// @param to The address receiving the withdrawn assets.\n /// @return withdrawnAmount The amount withdrawn, denoted in units of the asset's decimals.\n function withdrawMax(\n uint256 streamId,\n address to\n ) external returns (uint128 withdrawnAmount);\n\n /// @notice Withdraws the maximum withdrawable amount from the stream to the current recipient, and transfers the\n /// NFT to `newRecipient`.\n ///\n /// @dev Emits a {WithdrawFromLockupStream} and a {Transfer} event.\n ///\n /// Notes:\n /// - If the withdrawable amount is zero, the withdrawal is skipped.\n /// - Refer to the notes in {withdraw}.\n ///\n /// Requirements:\n /// - `msg.sender` must be the stream's recipient.\n /// - Refer to the requirements in {withdraw}.\n /// - Refer to the requirements in {IERC721.transferFrom}.\n ///\n /// @param streamId The ID of the stream NFT to transfer.\n /// @param newRecipient The address of the new owner of the stream NFT.\n /// @return withdrawnAmount The amount withdrawn, denoted in units of the asset's decimals.\n function withdrawMaxAndTransfer(\n uint256 streamId,\n address newRecipient\n ) external returns (uint128 withdrawnAmount);\n\n /// @notice Withdraws assets from streams to the recipient of each stream.\n ///\n /// @dev Emits multiple {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} events.\n ///\n /// Notes:\n /// - This function attempts to call a hook on the recipient of each stream, unless `msg.sender` is the recipient.\n ///\n /// Requirements:\n /// - Must not be delegate called.\n /// - There must be an equal number of `streamIds` and `amounts`.\n /// - Each stream ID in the array must not reference a null or depleted stream.\n /// - Each amount in the array must be greater than zero and must not exceed the withdrawable amount.\n ///\n /// @param streamIds The IDs of the streams to withdraw from.\n /// @param amounts The amounts to withdraw, denoted in units of the asset's decimals.\n function withdrawMultiple(\n uint256[] calldata streamIds,\n uint128[] calldata amounts\n ) external;\n}\n" + }, + "contracts/interfaces/sablier/ISablierV2LockupLinear.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\npragma solidity >=0.8.22;\n\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\nimport {Lockup, LockupLinear} from \"./types/DataTypes.sol\";\nimport {ISablierV2Lockup} from \"./ISablierV2Lockup.sol\";\n\n/// @title ISablierV2LockupLinear\n/// @notice Creates and manages Lockup streams with a linear distribution function.\ninterface ISablierV2LockupLinear is ISablierV2Lockup {\n /*//////////////////////////////////////////////////////////////////////////\n EVENTS\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @notice Emitted when a stream is created.\n /// @param streamId The ID of the newly created stream.\n /// @param funder The address which funded the stream.\n /// @param sender The address distributing the assets, which will have the ability to cancel the stream.\n /// @param recipient The address receiving the assets.\n /// @param amounts Struct encapsulating (i) the deposit amount, and (ii) the broker fee amount, both denoted\n /// in units of the asset's decimals.\n /// @param asset The contract address of the ERC-20 asset to be distributed.\n /// @param cancelable Boolean indicating whether the stream will be cancelable or not.\n /// @param transferable Boolean indicating whether the stream NFT is transferable or not.\n /// @param timestamps Struct encapsulating (i) the stream's start time, (ii) cliff time, and (iii) end time, all as\n /// Unix timestamps.\n /// @param broker The address of the broker who has helped create the stream, e.g. a front-end website.\n event CreateLockupLinearStream(\n uint256 streamId,\n address funder,\n address indexed sender,\n address indexed recipient,\n Lockup.CreateAmounts amounts,\n IERC20 indexed asset,\n bool cancelable,\n bool transferable,\n LockupLinear.Timestamps timestamps,\n address broker\n );\n\n /*//////////////////////////////////////////////////////////////////////////\n CONSTANT FUNCTIONS\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @notice Retrieves the stream's cliff time, which is a Unix timestamp. A value of zero means there\n /// is no cliff.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function getCliffTime(\n uint256 streamId\n ) external view returns (uint40 cliffTime);\n\n /// @notice Retrieves the full stream details.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n /// @return stream See the documentation in {DataTypes}.\n function getStream(\n uint256 streamId\n ) external view returns (LockupLinear.StreamLL memory stream);\n\n /// @notice Retrieves the stream's start, cliff and end timestamps.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n /// @return timestamps See the documentation in {DataTypes}.\n function getTimestamps(\n uint256 streamId\n ) external view returns (LockupLinear.Timestamps memory timestamps);\n\n /*//////////////////////////////////////////////////////////////////////////\n NON-CONSTANT FUNCTIONS\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @notice Creates a stream by setting the start time to `block.timestamp`, and the end time to\n /// the sum of `block.timestamp` and `params.durations.total`. The stream is funded by `msg.sender` and is wrapped\n /// in an ERC-721 NFT.\n ///\n /// @dev Emits a {Transfer} and {CreateLockupLinearStream} event.\n ///\n /// Requirements:\n /// - All requirements in {createWithTimestamps} must be met for the calculated parameters.\n ///\n /// @param params Struct encapsulating the function parameters, which are documented in {DataTypes}.\n /// @return streamId The ID of the newly created stream.\n function createWithDurations(\n LockupLinear.CreateWithDurations calldata params\n ) external returns (uint256 streamId);\n\n /// @notice Creates a stream with the provided start time and end time. The stream is funded by `msg.sender` and is\n /// wrapped in an ERC-721 NFT.\n ///\n /// @dev Emits a {Transfer} and {CreateLockupLinearStream} event.\n ///\n /// Notes:\n /// - A cliff time of zero means there is no cliff.\n /// - As long as the times are ordered, it is not an error for the start or the cliff time to be in the past.\n ///\n /// Requirements:\n /// - Must not be delegate called.\n /// - `params.totalAmount` must be greater than zero.\n /// - If set, `params.broker.fee` must not be greater than `MAX_BROKER_FEE`.\n /// - `params.timestamps.start` must be greater than zero and less than `params.timestamps.end`.\n /// - If set, `params.timestamps.cliff` must be greater than `params.timestamps.start` and less than\n /// `params.timestamps.end`.\n /// - `params.timestamps.end` must be in the future.\n /// - `params.recipient` must not be the zero address.\n /// - `msg.sender` must have allowed this contract to spend at least `params.totalAmount` assets.\n ///\n /// @param params Struct encapsulating the function parameters, which are documented in {DataTypes}.\n /// @return streamId The ID of the newly created stream.\n function createWithTimestamps(\n LockupLinear.CreateWithTimestamps calldata params\n ) external returns (uint256 streamId);\n}\n" + }, + "contracts/interfaces/sablier/ISablierV2NFTDescriptor.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\npragma solidity >=0.8.22;\n\nimport {IERC721Metadata} from \"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\";\n\n/// @title ISablierV2NFTDescriptor\n/// @notice This contract generates the URI describing the Sablier V2 stream NFTs.\n/// @dev Inspired by Uniswap V3 Positions NFTs.\ninterface ISablierV2NFTDescriptor {\n /// @notice Produces the URI describing a particular stream NFT.\n /// @dev This is a data URI with the JSON contents directly inlined.\n /// @param sablier The address of the Sablier contract the stream was created in.\n /// @param streamId The ID of the stream for which to produce a description.\n /// @return uri The URI of the ERC721-compliant metadata.\n function tokenURI(\n IERC721Metadata sablier,\n uint256 streamId\n ) external view returns (string memory uri);\n}\n" + }, + "contracts/interfaces/sablier/types/DataTypes.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\npragma solidity >=0.8.22;\n\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {UD2x18} from \"@prb/math/src/UD2x18.sol\";\nimport {UD60x18} from \"@prb/math/src/UD60x18.sol\";\n\n// DataTypes.sol\n//\n// This file defines all structs used in V2 Core, most of which are organized under three namespaces:\n//\n// - Lockup\n// - LockupDynamic\n// - LockupLinear\n// - LockupTranched\n//\n// You will notice that some structs contain \"slot\" annotations - they are used to indicate the\n// storage layout of the struct. It is more gas efficient to group small data types together so\n// that they fit in a single 32-byte slot.\n\n/// @notice Struct encapsulating the broker parameters passed to the create functions. Both can be set to zero.\n/// @param account The address receiving the broker's fee.\n/// @param fee The broker's percentage fee from the total amount, denoted as a fixed-point number where 1e18 is 100%.\nstruct Broker {\n address account;\n UD60x18 fee;\n}\n\n/// @notice Namespace for the structs used in both {SablierV2LockupLinear} and {SablierV2LockupDynamic}.\nlibrary Lockup {\n /// @notice Struct encapsulating the deposit, withdrawn, and refunded amounts, all denoted in units of the asset's\n /// decimals.\n /// @dev Because the deposited and the withdrawn amount are often read together, declaring them in the same slot\n /// saves gas.\n /// @param deposited The initial amount deposited in the stream, net of broker fee.\n /// @param withdrawn The cumulative amount withdrawn from the stream.\n /// @param refunded The amount refunded to the sender. Unless the stream was canceled, this is always zero.\n struct Amounts {\n // slot 0\n uint128 deposited;\n uint128 withdrawn;\n // slot 1\n uint128 refunded;\n }\n\n /// @notice Struct encapsulating (i) the deposit amount and (ii) the broker fee amount, both denoted in units of the\n /// asset's decimals.\n /// @param deposit The amount to deposit in the stream.\n /// @param brokerFee The broker fee amount.\n struct CreateAmounts {\n uint128 deposit;\n uint128 brokerFee;\n }\n\n /// @notice Enum representing the different statuses of a stream.\n /// @custom:value0 PENDING Stream created but not started; assets are in a pending state.\n /// @custom:value1 STREAMING Active stream where assets are currently being streamed.\n /// @custom:value2 SETTLED All assets have been streamed; recipient is due to withdraw them.\n /// @custom:value3 CANCELED Canceled stream; remaining assets await recipient's withdrawal.\n /// @custom:value4 DEPLETED Depleted stream; all assets have been withdrawn and/or refunded.\n enum Status {\n PENDING,\n STREAMING,\n SETTLED,\n CANCELED,\n DEPLETED\n }\n\n /// @notice A common data structure to be stored in all {SablierV2Lockup} models.\n /// @dev The fields are arranged like this to save gas via tight variable packing.\n /// @param sender The address distributing the assets, with the ability to cancel the stream.\n /// @param startTime The Unix timestamp indicating the stream's start.\n /// @param endTime The Unix timestamp indicating the stream's end.\n /// @param isCancelable Boolean indicating if the stream is cancelable.\n /// @param wasCanceled Boolean indicating if the stream was canceled.\n /// @param asset The contract address of the ERC-20 asset to be distributed.\n /// @param isDepleted Boolean indicating if the stream is depleted.\n /// @param isStream Boolean indicating if the struct entity exists.\n /// @param isTransferable Boolean indicating if the stream NFT is transferable.\n /// @param amounts Struct encapsulating the deposit, withdrawn, and refunded amounts, all denoted in units of the\n /// asset's decimals.\n struct Stream {\n // slot 0\n address sender;\n uint40 startTime;\n uint40 endTime;\n bool isCancelable;\n bool wasCanceled;\n // slot 1\n IERC20 asset;\n bool isDepleted;\n bool isStream;\n bool isTransferable;\n // slot 2 and 3\n Lockup.Amounts amounts;\n }\n}\n\n/// @notice Namespace for the structs used in {SablierV2LockupDynamic}.\nlibrary LockupDynamic {\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupDynamic.createWithDurations} function.\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\n /// the same as `msg.sender`.\n /// @param recipient The address receiving the assets.\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\n /// broker fee, denoted in units of the asset's decimals.\n /// @param asset The contract address of the ERC-20 asset to be distributed.\n /// @param cancelable Indicates if the stream is cancelable.\n /// @param transferable Indicates if the stream NFT is transferable.\n /// @param segments Segments with durations used to compose the dynamic distribution function. Timestamps are\n /// calculated by starting from `block.timestamp` and adding each duration to the previous timestamp.\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\n struct CreateWithDurations {\n address sender;\n address recipient;\n uint128 totalAmount;\n IERC20 asset;\n bool cancelable;\n bool transferable;\n SegmentWithDuration[] segments;\n Broker broker;\n }\n\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupDynamic.createWithTimestamps} function.\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\n /// the same as `msg.sender`.\n /// @param recipient The address receiving the assets.\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\n /// broker fee, denoted in units of the asset's decimals.\n /// @param asset The contract address of the ERC-20 asset to be distributed.\n /// @param cancelable Indicates if the stream is cancelable.\n /// @param transferable Indicates if the stream NFT is transferable.\n /// @param startTime The Unix timestamp indicating the stream's start.\n /// @param segments Segments used to compose the dynamic distribution function.\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\n struct CreateWithTimestamps {\n address sender;\n address recipient;\n uint128 totalAmount;\n IERC20 asset;\n bool cancelable;\n bool transferable;\n uint40 startTime;\n Segment[] segments;\n Broker broker;\n }\n\n /// @notice Segment struct used in the Lockup Dynamic stream.\n /// @param amount The amount of assets to be streamed in the segment, denoted in units of the asset's decimals.\n /// @param exponent The exponent of the segment, denoted as a fixed-point number.\n /// @param timestamp The Unix timestamp indicating the segment's end.\n struct Segment {\n // slot 0\n uint128 amount;\n UD2x18 exponent;\n uint40 timestamp;\n }\n\n /// @notice Segment struct used at runtime in {SablierV2LockupDynamic.createWithDurations}.\n /// @param amount The amount of assets to be streamed in the segment, denoted in units of the asset's decimals.\n /// @param exponent The exponent of the segment, denoted as a fixed-point number.\n /// @param duration The time difference in seconds between the segment and the previous one.\n struct SegmentWithDuration {\n uint128 amount;\n UD2x18 exponent;\n uint40 duration;\n }\n\n /// @notice Struct encapsulating the full details of a stream.\n /// @dev Extends `Lockup.Stream` by including the recipient and the segments.\n struct StreamLD {\n address sender;\n address recipient;\n uint40 startTime;\n uint40 endTime;\n bool isCancelable;\n bool wasCanceled;\n IERC20 asset;\n bool isDepleted;\n bool isStream;\n bool isTransferable;\n Lockup.Amounts amounts;\n Segment[] segments;\n }\n\n /// @notice Struct encapsulating the LockupDynamic timestamps.\n /// @param start The Unix timestamp indicating the stream's start.\n /// @param end The Unix timestamp indicating the stream's end.\n struct Timestamps {\n uint40 start;\n uint40 end;\n }\n}\n\n/// @notice Namespace for the structs used in {SablierV2LockupLinear}.\nlibrary LockupLinear {\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupLinear.createWithDurations} function.\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\n /// the same as `msg.sender`.\n /// @param recipient The address receiving the assets.\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\n /// broker fee, denoted in units of the asset's decimals.\n /// @param asset The contract address of the ERC-20 asset to be distributed.\n /// @param cancelable Indicates if the stream is cancelable.\n /// @param transferable Indicates if the stream NFT is transferable.\n /// @param durations Struct encapsulating (i) cliff period duration and (ii) total stream duration, both in seconds.\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\n struct CreateWithDurations {\n address sender;\n address recipient;\n uint128 totalAmount;\n IERC20 asset;\n bool cancelable;\n bool transferable;\n Durations durations;\n Broker broker;\n }\n\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupLinear.createWithTimestamps} function.\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\n /// the same as `msg.sender`.\n /// @param recipient The address receiving the assets.\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\n /// broker fee, denoted in units of the asset's decimals.\n /// @param asset The contract address of the ERC-20 asset to be distributed.\n /// @param cancelable Indicates if the stream is cancelable.\n /// @param transferable Indicates if the stream NFT is transferable.\n /// @param timestamps Struct encapsulating (i) the stream's start time, (ii) cliff time, and (iii) end time, all as\n /// Unix timestamps.\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\n struct CreateWithTimestamps {\n address sender;\n address recipient;\n uint128 totalAmount;\n IERC20 asset;\n bool cancelable;\n bool transferable;\n Timestamps timestamps;\n Broker broker;\n }\n\n /// @notice Struct encapsulating the cliff duration and the total duration.\n /// @param cliff The cliff duration in seconds.\n /// @param total The total duration in seconds.\n struct Durations {\n uint40 cliff;\n uint40 total;\n }\n\n /// @notice Struct encapsulating the full details of a stream.\n /// @dev Extends `Lockup.Stream` by including the recipient and the cliff time.\n struct StreamLL {\n address sender;\n address recipient;\n uint40 startTime;\n bool isCancelable;\n bool wasCanceled;\n IERC20 asset;\n uint40 endTime;\n bool isDepleted;\n bool isStream;\n bool isTransferable;\n Lockup.Amounts amounts;\n uint40 cliffTime;\n }\n\n /// @notice Struct encapsulating the LockupLinear timestamps.\n /// @param start The Unix timestamp for the stream's start.\n /// @param cliff The Unix timestamp for the cliff period's end. A value of zero means there is no cliff.\n /// @param end The Unix timestamp for the stream's end.\n struct Timestamps {\n uint40 start;\n uint40 cliff;\n uint40 end;\n }\n}\n\n/// @notice Namespace for the structs used in {SablierV2LockupTranched}.\nlibrary LockupTranched {\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupTranched.createWithDurations} function.\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\n /// the same as `msg.sender`.\n /// @param recipient The address receiving the assets.\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\n /// broker fee, denoted in units of the asset's decimals.\n /// @param asset The contract address of the ERC-20 asset to be distributed.\n /// @param cancelable Indicates if the stream is cancelable.\n /// @param transferable Indicates if the stream NFT is transferable.\n /// @param tranches Tranches with durations used to compose the tranched distribution function. Timestamps are\n /// calculated by starting from `block.timestamp` and adding each duration to the previous timestamp.\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\n struct CreateWithDurations {\n address sender;\n address recipient;\n uint128 totalAmount;\n IERC20 asset;\n bool cancelable;\n bool transferable;\n TrancheWithDuration[] tranches;\n Broker broker;\n }\n\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupTranched.createWithTimestamps} function.\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\n /// the same as `msg.sender`.\n /// @param recipient The address receiving the assets.\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\n /// broker fee, denoted in units of the asset's decimals.\n /// @param asset The contract address of the ERC-20 asset to be distributed.\n /// @param cancelable Indicates if the stream is cancelable.\n /// @param transferable Indicates if the stream NFT is transferable.\n /// @param startTime The Unix timestamp indicating the stream's start.\n /// @param tranches Tranches used to compose the tranched distribution function.\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\n struct CreateWithTimestamps {\n address sender;\n address recipient;\n uint128 totalAmount;\n IERC20 asset;\n bool cancelable;\n bool transferable;\n uint40 startTime;\n Tranche[] tranches;\n Broker broker;\n }\n\n /// @notice Struct encapsulating the full details of a stream.\n /// @dev Extends `Lockup.Stream` by including the recipient and the tranches.\n struct StreamLT {\n address sender;\n address recipient;\n uint40 startTime;\n uint40 endTime;\n bool isCancelable;\n bool wasCanceled;\n IERC20 asset;\n bool isDepleted;\n bool isStream;\n bool isTransferable;\n Lockup.Amounts amounts;\n Tranche[] tranches;\n }\n\n /// @notice Struct encapsulating the LockupTranched timestamps.\n /// @param start The Unix timestamp indicating the stream's start.\n /// @param end The Unix timestamp indicating the stream's end.\n struct Timestamps {\n uint40 start;\n uint40 end;\n }\n\n /// @notice Tranche struct used in the Lockup Tranched stream.\n /// @param amount The amount of assets to be unlocked in the tranche, denoted in units of the asset's decimals.\n /// @param timestamp The Unix timestamp indicating the tranche's end.\n struct Tranche {\n // slot 0\n uint128 amount;\n uint40 timestamp;\n }\n\n /// @notice Tranche struct used at runtime in {SablierV2LockupTranched.createWithDurations}.\n /// @param amount The amount of assets to be unlocked in the tranche, denoted in units of the asset's decimals.\n /// @param duration The time difference in seconds between the tranche and the previous one.\n struct TrancheWithDuration {\n uint128 amount;\n uint40 duration;\n }\n}\n" + }, + "contracts/mocks/ERC6551Registry.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IERC6551Registry {\n /**\n * @dev The registry MUST emit the ERC6551AccountCreated event upon successful account creation.\n */\n event ERC6551AccountCreated(\n address account,\n address indexed implementation,\n bytes32 salt,\n uint256 chainId,\n address indexed tokenContract,\n uint256 indexed tokenId\n );\n\n /**\n * @dev The registry MUST revert with AccountCreationFailed error if the create2 operation fails.\n */\n error AccountCreationFailed();\n\n /**\n * @dev Creates a token bound account for a non-fungible token.\n *\n * If account has already been created, returns the account address without calling create2.\n *\n * Emits ERC6551AccountCreated event.\n *\n * @return account The address of the token bound account\n */\n function createAccount(\n address implementation,\n bytes32 salt,\n uint256 chainId,\n address tokenContract,\n uint256 tokenId\n ) external returns (address account);\n\n /**\n * @dev Returns the computed token bound account address for a non-fungible token.\n *\n * @return account The address of the token bound account\n */\n function account(\n address implementation,\n bytes32 salt,\n uint256 chainId,\n address tokenContract,\n uint256 tokenId\n ) external view returns (address account);\n}\n\ncontract ERC6551Registry is IERC6551Registry {\n function createAccount(\n address implementation,\n bytes32 salt,\n uint256 chainId,\n address tokenContract,\n uint256 tokenId\n ) external returns (address) {\n assembly {\n // Memory Layout:\n // ----\n // 0x00 0xff (1 byte)\n // 0x01 registry (address) (20 bytes)\n // 0x15 salt (bytes32) (32 bytes)\n // 0x35 Bytecode Hash (bytes32) (32 bytes)\n // ----\n // 0x55 ERC-1167 Constructor + Header (20 bytes)\n // 0x69 implementation (address) (20 bytes)\n // 0x5D ERC-1167 Footer (15 bytes)\n // 0x8C salt (uint256) (32 bytes)\n // 0xAC chainId (uint256) (32 bytes)\n // 0xCC tokenContract (address) (32 bytes)\n // 0xEC tokenId (uint256) (32 bytes)\n\n // Silence unused variable warnings\n pop(chainId)\n\n // Copy bytecode + constant data to memory\n calldatacopy(0x8c, 0x24, 0x80) // salt, chainId, tokenContract, tokenId\n mstore(0x6c, 0x5af43d82803e903d91602b57fd5bf3) // ERC-1167 footer\n mstore(0x5d, implementation) // implementation\n mstore(0x49, 0x3d60ad80600a3d3981f3363d3d373d3d3d363d73) // ERC-1167 constructor + header\n\n // Copy create2 computation data to memory\n mstore8(0x00, 0xff) // 0xFF\n mstore(0x35, keccak256(0x55, 0xb7)) // keccak256(bytecode)\n mstore(0x01, shl(96, address())) // registry address\n mstore(0x15, salt) // salt\n\n // Compute account address\n let computed := keccak256(0x00, 0x55)\n\n // If the account has not yet been deployed\n if iszero(extcodesize(computed)) {\n // Deploy account contract\n let deployed := create2(0, 0x55, 0xb7, salt)\n\n // Revert if the deployment fails\n if iszero(deployed) {\n mstore(0x00, 0x20188a59) // `AccountCreationFailed()`\n revert(0x1c, 0x04)\n }\n\n // Store account address in memory before salt and chainId\n mstore(0x6c, deployed)\n\n // Emit the ERC6551AccountCreated event\n log4(\n 0x6c,\n 0x60,\n // `ERC6551AccountCreated(address,address,bytes32,uint256,address,uint256)`\n 0x79f19b3655ee38b1ce526556b7731a20c8f218fbda4a3990b6cc4172fdf88722,\n implementation,\n tokenContract,\n tokenId\n )\n\n // Return the account address\n return(0x6c, 0x20)\n }\n\n // Otherwise, return the computed account address\n mstore(0x00, shr(96, shl(96, computed)))\n return(0x00, 0x20)\n }\n }\n\n function account(\n address implementation,\n bytes32 salt,\n uint256 chainId,\n address tokenContract,\n uint256 tokenId\n ) external view returns (address) {\n assembly {\n // Silence unused variable warnings\n pop(chainId)\n pop(tokenContract)\n pop(tokenId)\n\n // Copy bytecode + constant data to memory\n calldatacopy(0x8c, 0x24, 0x80) // salt, chainId, tokenContract, tokenId\n mstore(0x6c, 0x5af43d82803e903d91602b57fd5bf3) // ERC-1167 footer\n mstore(0x5d, implementation) // implementation\n mstore(0x49, 0x3d60ad80600a3d3981f3363d3d373d3d3d363d73) // ERC-1167 constructor + header\n\n // Copy create2 computation data to memory\n mstore8(0x00, 0xff) // 0xFF\n mstore(0x35, keccak256(0x55, 0xb7)) // keccak256(bytecode)\n mstore(0x01, shl(96, address())) // registry address\n mstore(0x15, salt) // salt\n\n // Store computed account address in memory\n mstore(0x00, shr(96, shl(96, keccak256(0x00, 0x55))))\n\n // Return computed account address\n return(0x00, 0x20)\n }\n }\n}\n" + }, + "contracts/mocks/MockContract.sol": { + "content": "//SPDX-License-Identifier: Unlicense\n\npragma solidity ^0.8.19;\n\n/**\n * Mock contract for testing\n */\ncontract MockContract {\n event DidSomething(string message);\n\n error Reverting();\n\n function doSomething() public {\n doSomethingWithParam(\"doSomething()\");\n }\n\n function doSomethingWithParam(string memory _message) public {\n emit DidSomething(_message);\n }\n\n function returnSomething(string memory _s)\n external\n pure\n returns (string memory)\n {\n return _s;\n }\n\n function revertSomething() external pure {\n revert Reverting();\n }\n}\n" + }, + "contracts/mocks/MockDecentHatsUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.28;\n\nimport {DecentHatsModuleUtils} from \"../modules/DecentHatsModuleUtils.sol\";\n\ncontract MockDecentHatsModuleUtils is DecentHatsModuleUtils {\n // Expose the internal _processHat function for testing\n function processRoleHats(CreateRoleHatsParams calldata params) external {\n _processRoleHats(params);\n }\n}\n" + }, + "contracts/mocks/MockHatsElectionsEligibility.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\nimport {IHatsElectionsEligibility} from \"../interfaces/hats/modules/IHatsElectionsEligibility.sol\";\n\ncontract MockHatsElectionsEligibility is IHatsElectionsEligibility {\n // Storage\n mapping(uint128 termEnd => mapping(address candidates => bool elected))\n public electionResults;\n mapping(uint128 termEnd => bool isElectionOpen) public electionStatus;\n uint128 public currentTermEnd;\n uint128 public nextTermEnd;\n\n // Errors\n error AlreadySetup();\n error ElectionNotOpen();\n error InvalidTermEnd();\n error NoActiveElection();\n error ElectionClosed(uint128 termEnd);\n error TermNotEnded();\n error NextTermNotReady();\n error TooManyWinners();\n\n modifier onlyOnce() {\n if (currentTermEnd != 0) revert AlreadySetup();\n _;\n }\n\n function _setUp(bytes calldata _initData) external onlyOnce {\n // decode init data\n uint128 _firstTermEnd = abi.decode(_initData, (uint128));\n require(\n _firstTermEnd > block.timestamp,\n \"First term must end in the future\"\n );\n\n currentTermEnd = _firstTermEnd;\n\n // open the first election\n electionStatus[_firstTermEnd] = true;\n\n // log the first term\n emit ElectionOpened(_firstTermEnd);\n }\n\n function elect(uint128 _termEnd, address[] calldata _winners) external {\n // results can only be submitted for open elections\n if (!electionStatus[_termEnd]) revert ElectionClosed(_termEnd);\n\n // close the election\n electionStatus[_termEnd] = false;\n\n // set the election results\n for (uint256 i; i < _winners.length; ) {\n electionResults[_termEnd][_winners[i]] = true;\n\n unchecked {\n ++i;\n }\n }\n\n // log the election results\n emit ElectionCompleted(_termEnd, _winners);\n }\n\n function recall(uint128 _termEnd, address[] calldata _recallees) external {\n // loop through the accounts and set their election status to false\n for (uint256 i; i < _recallees.length; ) {\n electionResults[_termEnd][_recallees[i]] = false;\n\n unchecked {\n ++i;\n }\n }\n\n emit Recalled(_termEnd, _recallees);\n }\n\n function setNextTerm(uint128 _newTermEnd) external {\n // new term must end after current term\n if (_newTermEnd <= currentTermEnd) revert InvalidTermEnd();\n\n // if next term is already set, its election must still be open\n uint128 next = nextTermEnd;\n if (next > 0 && !electionStatus[next]) revert ElectionClosed(next);\n\n // set the next term\n nextTermEnd = _newTermEnd;\n\n // open the next election\n electionStatus[_newTermEnd] = true;\n\n // log the new term\n emit ElectionOpened(_newTermEnd);\n }\n\n function startNextTerm() external {\n // current term must be over\n if (block.timestamp < currentTermEnd) revert TermNotEnded();\n\n uint128 next = nextTermEnd; // save SLOADs\n\n // next term must be set and its election must be closed\n if (next == 0 || electionStatus[next]) revert NextTermNotReady();\n\n // set the current term to the next term\n currentTermEnd = next;\n\n // clear the next term\n nextTermEnd = 0;\n\n // log the change\n emit NewTermStarted(next);\n }\n\n function getWearerStatus(\n address _wearer,\n uint256 /* _hatId */\n ) public view override returns (bool eligible, bool standing) {\n /// @dev This eligibility module is not concerned with standing, so we default it to good standing\n standing = true;\n\n uint128 current = currentTermEnd; // save SLOAD\n\n if (block.timestamp < current) {\n // if the current term is still open, the wearer is eligible if they have been elected for the current term\n eligible = electionResults[current][_wearer];\n }\n // if the current term is closed, the wearer is not eligible\n }\n\n // // Test helper functions\n // function setWearerStatus(address wearer, bool eligible) external {\n // electionResults[currentTermEnd][wearer] = eligible;\n // }\n\n function BALLOT_BOX_HAT() external pure override returns (uint256) {}\n\n function ADMIN_HAT() external pure override returns (uint256) {}\n}\n" + }, + "contracts/mocks/MockHatsModuleFactory.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport {IHatsModuleFactory} from \"../interfaces/hats/IHatsModuleFactory.sol\";\nimport {MockHatsElectionsEligibility} from \"./MockHatsElectionsEligibility.sol\";\n\ncontract MockHatsModuleFactory is IHatsModuleFactory {\n function createHatsModule(\n address,\n uint256,\n bytes calldata,\n bytes calldata _initData,\n uint256\n ) external override returns (address _instance) {\n // Deploy a new instance of MockHatsElectionsEligibility\n MockHatsElectionsEligibility newModule = new MockHatsElectionsEligibility();\n newModule._setUp(_initData);\n _instance = address(newModule);\n }\n\n function getHatsModuleAddress(\n address _implementation,\n uint256 _hatId,\n bytes calldata _otherImmutableArgs,\n uint256 _saltNonce\n ) external view returns (address) {}\n\n function HATS() external view override returns (address) {}\n\n function version() external view override returns (string memory) {}\n\n function batchCreateHatsModule(\n address[] calldata _implementations,\n uint256[] calldata _hatIds,\n bytes[] calldata _otherImmutableArgsArray,\n bytes[] calldata _initDataArray,\n uint256[] calldata _saltNonces\n ) external override returns (bool success) {}\n\n function deployed(\n address _implementation,\n uint256 _hatId,\n bytes calldata _otherImmutableArgs,\n uint256 _saltNonce\n ) external view override returns (bool) {}\n}\n" + }, + "contracts/mocks/MockLockupLinear.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\nlibrary MockLockupLinear {\n struct CreateWithTimestamps {\n address sender;\n address recipient;\n uint128 totalAmount;\n IERC20 asset;\n bool cancelable;\n bool transferable;\n Timestamps timestamps;\n Broker broker;\n }\n\n struct Timestamps {\n uint40 start;\n uint40 cliff;\n uint40 end;\n }\n\n struct Broker {\n address account;\n uint256 fee;\n }\n\n struct Stream {\n address sender;\n uint40 startTime;\n uint40 endTime;\n uint40 cliffTime;\n bool cancelable;\n bool wasCanceled;\n address asset;\n bool transferable;\n uint128 totalAmount;\n address recipient;\n }\n\n /// @notice Enum representing the different statuses of a stream.\n /// @custom:value0 PENDING Stream created but not started; assets are in a pending state.\n /// @custom:value1 STREAMING Active stream where assets are currently being streamed.\n /// @custom:value2 SETTLED All assets have been streamed; recipient is due to withdraw them.\n /// @custom:value3 CANCELED Canceled stream; remaining assets await recipient's withdrawal.\n /// @custom:value4 DEPLETED Depleted stream; all assets have been withdrawn and/or refunded.\n enum Status {\n PENDING,\n STREAMING,\n SETTLED,\n CANCELED,\n DEPLETED\n }\n}\n" + }, + "contracts/mocks/MockSablierV2LockupLinear.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.22;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {ISablierV2LockupLinear} from \"../interfaces/sablier/ISablierV2LockupLinear.sol\";\nimport {MockLockupLinear} from \"./MockLockupLinear.sol\";\n\ncontract MockSablierV2LockupLinear {\n mapping(uint256 => MockLockupLinear.Stream) public streams;\n uint256 public nextStreamId = 1;\n\n // Add this event declaration at the contract level\n event StreamCreated(\n uint256 streamId,\n address indexed sender,\n address indexed recipient,\n uint128 totalAmount,\n address indexed asset,\n bool cancelable,\n bool transferable,\n uint40 startTime,\n uint40 cliffTime,\n uint40 endTime\n );\n\n function createWithTimestamps(\n MockLockupLinear.CreateWithTimestamps calldata params\n ) external returns (uint256 streamId) {\n require(\n params.asset.transferFrom(\n msg.sender,\n address(this),\n params.totalAmount\n ),\n \"Token transfer failed\"\n );\n\n streamId = nextStreamId++;\n streams[streamId] = MockLockupLinear.Stream({\n sender: params.sender,\n recipient: params.recipient,\n totalAmount: params.totalAmount,\n asset: address(params.asset),\n cancelable: params.cancelable,\n wasCanceled: false,\n transferable: params.transferable,\n startTime: params.timestamps.start,\n cliffTime: params.timestamps.cliff,\n endTime: params.timestamps.end\n });\n\n // Emit the StreamCreated event\n emit StreamCreated(\n streamId,\n params.sender,\n params.recipient,\n params.totalAmount,\n address(params.asset),\n params.cancelable,\n params.transferable,\n params.timestamps.start,\n params.timestamps.cliff,\n params.timestamps.end\n );\n\n return streamId;\n }\n\n function getStream(\n uint256 streamId\n ) external view returns (MockLockupLinear.Stream memory) {\n return streams[streamId];\n }\n\n function withdrawableAmountOf(\n uint256 streamId\n ) public view returns (uint128) {\n MockLockupLinear.Stream memory stream = streams[streamId];\n if (block.timestamp <= stream.startTime) {\n return 0;\n }\n if (block.timestamp >= stream.endTime) {\n return stream.totalAmount;\n }\n return\n uint128(\n (stream.totalAmount * (block.timestamp - stream.startTime)) /\n (stream.endTime - stream.startTime)\n );\n }\n\n function withdrawMax(\n uint256 streamId,\n address to\n ) external returns (uint128 withdrawnAmount) {\n withdrawnAmount = withdrawableAmountOf(streamId);\n MockLockupLinear.Stream storage stream = streams[streamId];\n\n require(\n msg.sender == stream.recipient,\n \"Only recipient can call withdraw\"\n );\n require(\n withdrawnAmount <= withdrawableAmountOf(streamId),\n \"Insufficient withdrawable amount\"\n );\n\n stream.totalAmount -= withdrawnAmount;\n IERC20(stream.asset).transfer(to, withdrawnAmount);\n }\n\n function cancel(uint256 streamId) external {\n MockLockupLinear.Stream memory stream = streams[streamId];\n require(stream.cancelable, \"Stream is not cancelable\");\n require(msg.sender == stream.sender, \"Only sender can cancel\");\n\n uint128 withdrawableAmount = withdrawableAmountOf(streamId);\n uint128 refundAmount = stream.totalAmount - withdrawableAmount;\n\n streams[streamId].wasCanceled = true;\n\n if (withdrawableAmount > 0) {\n IERC20(stream.asset).transfer(stream.recipient, withdrawableAmount);\n }\n if (refundAmount > 0) {\n IERC20(stream.asset).transfer(stream.sender, refundAmount);\n }\n }\n\n function isCancelable(uint256 streamId) external view returns (bool) {\n return streams[streamId].cancelable;\n }\n\n /// @dev Retrieves the stream's status without performing a null check.\n function statusOf(\n uint256 streamId\n ) public view returns (MockLockupLinear.Status) {\n uint256 withdrawableAmount = withdrawableAmountOf(streamId);\n if (withdrawableAmount == 0) {\n return MockLockupLinear.Status.DEPLETED;\n } else if (streams[streamId].wasCanceled) {\n return MockLockupLinear.Status.CANCELED;\n }\n\n if (block.timestamp < streams[streamId].startTime) {\n return MockLockupLinear.Status.PENDING;\n }\n\n if (block.timestamp < streams[streamId].endTime) {\n return MockLockupLinear.Status.STREAMING;\n } else {\n return MockLockupLinear.Status.SETTLED;\n }\n }\n}\n" + }, + "contracts/modules/DecentHatsCreationModule.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.28;\n\nimport {Enum} from \"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\";\nimport {IAvatar} from \"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol\";\nimport {Strings} from \"@openzeppelin/contracts/utils/Strings.sol\";\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {IERC6551Registry} from \"../interfaces/IERC6551Registry.sol\";\nimport {IHats} from \"../interfaces/hats/IHats.sol\";\nimport {LockupLinear, Broker} from \"../interfaces/sablier/types/DataTypes.sol\";\nimport {IHatsModuleFactory} from \"../interfaces/hats/IHatsModuleFactory.sol\";\nimport {IHatsElectionsEligibility} from \"../interfaces/hats/modules/IHatsElectionsEligibility.sol\";\nimport {ModuleProxyFactory} from \"@gnosis.pm/zodiac/contracts/factory/ModuleProxyFactory.sol\";\nimport {ISablierV2LockupLinear} from \"../interfaces/sablier/ISablierV2LockupLinear.sol\";\nimport {DecentHatsModuleUtils} from \"./DecentHatsModuleUtils.sol\";\n\ncontract DecentHatsCreationModule is DecentHatsModuleUtils {\n struct TopHatParams {\n string details;\n string imageURI;\n }\n\n struct AdminHatParams {\n string details;\n string imageURI;\n bool isMutable;\n }\n\n struct CreateTreeParams {\n IHats hatsProtocol;\n IERC6551Registry erc6551Registry;\n IHatsModuleFactory hatsModuleFactory;\n ModuleProxyFactory moduleProxyFactory;\n address keyValuePairs;\n address decentAutonomousAdminImplementation;\n address hatsAccountImplementation;\n address hatsElectionsEligibilityImplementation;\n TopHatParams topHat;\n AdminHatParams adminHat;\n HatParams[] hats;\n }\n\n /* /////////////////////////////////////////////////////////////////////////////\n EXTERNAL FUNCTIONS\n ///////////////////////////////////////////////////////////////////////////// */\n /**\n * @notice For a safe without any roles previously created on it, this function should be called. It sets up the\n * top hat and admin hat, as well as any other hats and their streams that are provided, then transfers the top hat\n * to the calling safe.\n *\n * @notice This contract should be enabled a module on the Safe for which the role(s) are to be created, and disabled after.\n *\n * @dev For each hat that is included, if the hat is:\n * - termed, its stream funds on are targeted directly at the nominated wearer. The wearer should directly call `withdraw-`\n * on the Sablier contract.\n * - untermed, its stream funds are targeted at the hat's smart account. In order to withdraw funds from the stream, the\n * hat's smart account must be the one call to `withdraw-` on the Sablier contract, setting the recipient arg to its wearer.\n *\n * @dev In order for a Safe to seamlessly create roles even if it has never previously created a role and thus has\n * no hat tree, we defer the creation of the hat tree and its setup to this contract. This way, in a single tx block,\n * the resulting topHatId of the newly created hat can be used to create an admin hat and any other hats needed.\n * We also make use of `KeyValuePairs` to associate the topHatId with the Safe.\n *\n * @param treeParams The parameters for creating the Hat Tree with Roles\n */\n function createAndDeclareTree(\n CreateTreeParams calldata treeParams\n ) external {\n // Create Top Hat\n (uint256 topHatId, address topHatAccount) = _processTopHat(\n treeParams.hatsProtocol,\n treeParams.erc6551Registry,\n treeParams.hatsAccountImplementation,\n treeParams.keyValuePairs,\n treeParams.topHat\n );\n\n // Create Admin Hat\n uint256 adminHatId = _processAdminHat(\n treeParams.hatsProtocol,\n treeParams.erc6551Registry,\n treeParams.hatsAccountImplementation,\n topHatId,\n topHatAccount,\n treeParams.moduleProxyFactory,\n treeParams.decentAutonomousAdminImplementation,\n treeParams.adminHat\n );\n\n // Create Role Hats\n _processRoleHats(\n CreateRoleHatsParams({\n hatsProtocol: treeParams.hatsProtocol,\n erc6551Registry: treeParams.erc6551Registry,\n hatsAccountImplementation: treeParams.hatsAccountImplementation,\n topHatId: topHatId,\n topHatAccount: topHatAccount,\n hatsModuleFactory: treeParams.hatsModuleFactory,\n hatsElectionsEligibilityImplementation: treeParams\n .hatsElectionsEligibilityImplementation,\n adminHatId: adminHatId,\n hats: treeParams.hats,\n keyValuePairs: treeParams.keyValuePairs\n })\n );\n }\n\n /* /////////////////////////////////////////////////////////////////////////////\n INTERNAL FUNCTIONS\n ///////////////////////////////////////////////////////////////////////////// */\n\n function _processTopHat(\n IHats hatsProtocol,\n IERC6551Registry erc6551Registry,\n address hatsAccountImplementation,\n address keyValuePairs,\n TopHatParams calldata topHat\n ) internal returns (uint256 topHatId, address topHatAccount) {\n // Call lastTopHatId() and properly decode the response\n (bool success, bytes memory data) = address(hatsProtocol).call(\n abi.encodeWithSignature(\"lastTopHatId()\")\n );\n require(success, \"Failed to get lastTopHatId\");\n topHatId = (abi.decode(data, (uint256)) + 1) << 224;\n\n // Mint Top Hat to the Safe\n IAvatar(msg.sender).execTransactionFromModule(\n address(hatsProtocol),\n 0,\n abi.encodeWithSignature(\n \"mintTopHat(address,string,string)\",\n msg.sender,\n topHat.details,\n topHat.imageURI\n ),\n Enum.Operation.Call\n );\n\n // Create Top Hat's ERC6551 Account\n topHatAccount = erc6551Registry.createAccount(\n hatsAccountImplementation,\n SALT,\n block.chainid,\n address(hatsProtocol),\n topHatId\n );\n\n // Declare Top Hat ID to Safe via KeyValuePairs\n string[] memory keys = new string[](1);\n string[] memory values = new string[](1);\n keys[0] = \"topHatId\";\n values[0] = Strings.toString(topHatId);\n IAvatar(msg.sender).execTransactionFromModule(\n keyValuePairs,\n 0,\n abi.encodeWithSignature(\n \"updateValues(string[],string[])\",\n keys,\n values\n ),\n Enum.Operation.Call\n );\n }\n\n function _processAdminHat(\n IHats hatsProtocol,\n IERC6551Registry erc6551Registry,\n address hatsAccountImplementation,\n uint256 topHatId,\n address topHatAccount,\n ModuleProxyFactory moduleProxyFactory,\n address decentAutonomousAdminImplementation,\n AdminHatParams calldata adminHat\n ) internal returns (uint256 adminHatId) {\n // Create Admin Hat\n adminHatId = hatsProtocol.getNextId(topHatId);\n IAvatar(msg.sender).execTransactionFromModule(\n address(hatsProtocol),\n 0,\n abi.encodeWithSignature(\n \"createHat(uint256,string,uint32,address,address,bool,string)\",\n topHatId,\n adminHat.details,\n 1, // only one Admin Hat\n topHatAccount,\n topHatAccount,\n adminHat.isMutable,\n adminHat.imageURI\n ),\n Enum.Operation.Call\n );\n\n // Create Admin Hat's ERC6551 Account\n erc6551Registry.createAccount(\n hatsAccountImplementation,\n SALT,\n block.chainid,\n address(hatsProtocol),\n adminHatId\n );\n\n // Deploy Decent Autonomous Admin Module, which will wear the Admin Hat\n address autonomousAdmin = moduleProxyFactory.deployModule(\n decentAutonomousAdminImplementation,\n abi.encodeWithSignature(\"setUp(bytes)\", bytes(\"\")),\n uint256(\n keccak256(\n abi.encodePacked(\n // for the salt, we'll concatenate our static salt\n // with the Admin Hat ID\n SALT,\n adminHatId\n )\n )\n )\n );\n\n // Mint Hat to the Decent Autonomous Admin Module\n IAvatar(msg.sender).execTransactionFromModule(\n address(hatsProtocol),\n 0,\n abi.encodeWithSignature(\n \"mintHat(uint256,address)\",\n adminHatId,\n autonomousAdmin\n ),\n Enum.Operation.Call\n );\n }\n}\n" + }, + "contracts/modules/DecentHatsModificationModule.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.28;\n\nimport {DecentHatsModuleUtils} from \"./DecentHatsModuleUtils.sol\";\n\ncontract DecentHatsModificationModule is DecentHatsModuleUtils {\n /**\n * @notice Creates a new termed or untermed role hat and any streams on it.\n *\n * @notice This contract should be enabled a module on the Safe for which the role is to be created, and disabled after.\n *\n * @dev Stream funds on untermed Roles are targeted at the hat's smart account. In order to withdraw funds from the stream, the\n * hat's smart account must be the one call to `withdraw-` on the Sablier contract, setting the recipient arg to its wearer.\n *\n * @dev Stream funds on termed Roles are targeted directly at the nominated wearer.\n * The wearer should directly call `withdraw-` on the Sablier contract.\n *\n * @dev Role hat creation, minting, smart account creation and stream creation are handled here in order\n * to avoid a race condition where not more than one active proposal to create a new role can exist at a time.\n * See: https://github.com/decentdao/decent-interface/issues/2402\n *\n * @param roleHatsParams An array of params for each role hat to be created.\n */\n function createRoleHats(\n CreateRoleHatsParams calldata roleHatsParams\n ) external {\n _processRoleHats(roleHatsParams);\n }\n}\n" + }, + "contracts/modules/DecentHatsModuleUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.28;\n\nimport {Enum} from \"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\";\nimport {IAvatar} from \"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol\";\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {IERC6551Registry} from \"../interfaces/IERC6551Registry.sol\";\nimport {IHats} from \"../interfaces/hats/IHats.sol\";\nimport {LockupLinear, Broker} from \"../interfaces/sablier/types/DataTypes.sol\";\nimport {IHatsModuleFactory} from \"../interfaces/hats/IHatsModuleFactory.sol\";\nimport {ISablierV2LockupLinear} from \"../interfaces/sablier/ISablierV2LockupLinear.sol\";\nimport {Strings} from \"@openzeppelin/contracts/utils/Strings.sol\";\n\nabstract contract DecentHatsModuleUtils {\n bytes32 public constant SALT =\n 0x5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b5072;\n\n struct SablierStreamParams {\n ISablierV2LockupLinear sablier;\n address sender;\n address asset;\n LockupLinear.Timestamps timestamps;\n Broker broker;\n uint128 totalAmount;\n bool cancelable;\n bool transferable;\n }\n\n struct HatParams {\n address wearer;\n string details;\n string imageURI;\n SablierStreamParams[] sablierStreamsParams;\n uint128 termEndDateTs; // If 0, this is an untermed Hat\n uint32 maxSupply;\n bool isMutable;\n }\n\n struct CreateRoleHatsParams {\n IHats hatsProtocol;\n IERC6551Registry erc6551Registry;\n address hatsAccountImplementation;\n uint256 topHatId;\n address topHatAccount;\n address keyValuePairs;\n IHatsModuleFactory hatsModuleFactory;\n address hatsElectionsEligibilityImplementation;\n uint256 adminHatId;\n HatParams[] hats;\n }\n\n function _processRoleHats(\n CreateRoleHatsParams memory roleHatsParams\n ) internal {\n for (uint256 i = 0; i < roleHatsParams.hats.length; ) {\n HatParams memory hatParams = roleHatsParams.hats[i];\n\n // Create eligibility module if needed\n address eligibilityAddress = _createEligibilityModule(\n roleHatsParams.hatsProtocol,\n roleHatsParams.hatsModuleFactory,\n roleHatsParams.hatsElectionsEligibilityImplementation,\n roleHatsParams.topHatId,\n roleHatsParams.topHatAccount,\n roleHatsParams.adminHatId,\n hatParams.termEndDateTs\n );\n\n // Create and Mint the Role Hat\n uint256 hatId = _createAndMintHat(\n roleHatsParams.hatsProtocol,\n roleHatsParams.adminHatId,\n hatParams,\n eligibilityAddress,\n roleHatsParams.topHatAccount\n );\n\n // Get the stream recipient (based on termed or not)\n address streamRecipient = _setupStreamRecipient(\n roleHatsParams.erc6551Registry,\n roleHatsParams.hatsAccountImplementation,\n address(roleHatsParams.hatsProtocol),\n hatParams.termEndDateTs,\n hatParams.wearer,\n hatId\n );\n\n // Create streams\n _processSablierStreams(\n hatParams.sablierStreamsParams,\n streamRecipient,\n roleHatsParams.keyValuePairs,\n hatId\n );\n\n unchecked {\n ++i;\n }\n }\n }\n\n function _createEligibilityModule(\n IHats hatsProtocol,\n IHatsModuleFactory hatsModuleFactory,\n address hatsElectionsEligibilityImplementation,\n uint256 topHatId,\n address topHatAccount,\n uint256 adminHatId,\n uint128 termEndDateTs\n ) private returns (address) {\n // If the Hat is termed, create the eligibility module\n if (termEndDateTs != 0) {\n return\n hatsModuleFactory.createHatsModule(\n hatsElectionsEligibilityImplementation,\n hatsProtocol.getNextId(adminHatId),\n abi.encode(topHatId, uint256(0)), // [BALLOT_BOX_ID, ADMIN_HAT_ID]\n abi.encode(termEndDateTs),\n uint256(SALT)\n );\n }\n\n // Otherwise, return the Top Hat account\n return topHatAccount;\n }\n\n function _createAndMintHat(\n IHats hatsProtocol,\n uint256 adminHatId,\n HatParams memory hat,\n address eligibilityAddress,\n address topHatAccount\n ) private returns (uint256) {\n // Grab the next Hat ID (before creating it)\n uint256 hatId = hatsProtocol.getNextId(adminHatId);\n\n // Create the new Hat\n IAvatar(msg.sender).execTransactionFromModule(\n address(hatsProtocol),\n 0,\n abi.encodeWithSignature(\n \"createHat(uint256,string,uint32,address,address,bool,string)\",\n adminHatId,\n hat.details,\n hat.maxSupply,\n eligibilityAddress,\n topHatAccount,\n hat.isMutable,\n hat.imageURI\n ),\n Enum.Operation.Call\n );\n\n // If the Hat is termed, nominate the wearer as the eligible member\n if (hat.termEndDateTs != 0) {\n address[] memory nominatedWearers = new address[](1);\n nominatedWearers[0] = hat.wearer;\n\n IAvatar(msg.sender).execTransactionFromModule(\n eligibilityAddress,\n 0,\n abi.encodeWithSignature(\n \"elect(uint128,address[])\",\n hat.termEndDateTs,\n nominatedWearers\n ),\n Enum.Operation.Call\n );\n }\n\n // Mint the Hat\n IAvatar(msg.sender).execTransactionFromModule(\n address(hatsProtocol),\n 0,\n abi.encodeWithSignature(\n \"mintHat(uint256,address)\",\n hatId,\n hat.wearer\n ),\n Enum.Operation.Call\n );\n return hatId;\n }\n\n // Exists to avoid stack too deep errors\n function _setupStreamRecipient(\n IERC6551Registry erc6551Registry,\n address hatsAccountImplementation,\n address hatsProtocol,\n uint128 termEndDateTs,\n address wearer,\n uint256 hatId\n ) private returns (address) {\n // If the hat is termed, the wearer is the stream recipient\n if (termEndDateTs != 0) {\n return wearer;\n }\n\n // Otherwise, the Hat's smart account is the stream recipient\n return\n erc6551Registry.createAccount(\n hatsAccountImplementation,\n SALT,\n block.chainid,\n hatsProtocol,\n hatId\n );\n }\n\n function _processSablierStreams(\n SablierStreamParams[] memory streamParams,\n address streamRecipient,\n address keyValuePairs,\n uint256 hatId\n ) private {\n for (uint256 i = 0; i < streamParams.length; ) {\n SablierStreamParams memory sablierStreamParams = streamParams[i];\n\n // Approve tokens for Sablier\n IAvatar(msg.sender).execTransactionFromModule(\n sablierStreamParams.asset,\n 0,\n abi.encodeWithSignature(\n \"approve(address,uint256)\",\n sablierStreamParams.sablier,\n sablierStreamParams.totalAmount\n ),\n Enum.Operation.Call\n );\n uint256 streamId = ISablierV2LockupLinear(\n sablierStreamParams.sablier\n ).nextStreamId();\n\n // Proxy the Sablier call through IAvatar\n IAvatar(msg.sender).execTransactionFromModule(\n address(sablierStreamParams.sablier),\n 0,\n abi.encodeWithSignature(\n \"createWithTimestamps((address,address,uint128,address,bool,bool,(uint40,uint40,uint40),(address,uint256)))\",\n LockupLinear.CreateWithTimestamps({\n sender: sablierStreamParams.sender,\n recipient: streamRecipient,\n totalAmount: sablierStreamParams.totalAmount,\n asset: IERC20(sablierStreamParams.asset),\n cancelable: sablierStreamParams.cancelable,\n transferable: sablierStreamParams.transferable,\n timestamps: sablierStreamParams.timestamps,\n broker: sablierStreamParams.broker\n })\n ),\n Enum.Operation.Call\n );\n\n // Update KeyValuePairs with the stream ID and Hat ID\n string[] memory keys = new string[](1);\n string[] memory values = new string[](1);\n keys[0] = \"hatIdToStreamId\";\n values[0] = string(\n abi.encodePacked(\n Strings.toString(hatId),\n \":\",\n Strings.toString(streamId)\n )\n );\n\n IAvatar(msg.sender).execTransactionFromModule(\n keyValuePairs,\n 0,\n abi.encodeWithSignature(\n \"updateValues(string[],string[])\",\n keys,\n values\n ),\n Enum.Operation.Call\n );\n\n unchecked {\n ++i;\n }\n }\n }\n}\n" + }, + "contracts/modules/DecentSablierStreamManagementModule.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.28;\n\nimport {Enum} from \"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\";\nimport {IAvatar} from \"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol\";\nimport {ISablierV2Lockup} from \"../interfaces/sablier/ISablierV2Lockup.sol\";\nimport {Lockup} from \"../interfaces/sablier/types/DataTypes.sol\";\n\ncontract DecentSablierStreamManagementModule {\n function withdrawMaxFromStream(\n ISablierV2Lockup sablier,\n address recipientHatAccount,\n uint256 streamId,\n address to\n ) public {\n // Check if there are funds to withdraw\n if (sablier.withdrawableAmountOf(streamId) == 0) {\n return;\n }\n\n // Proxy the Sablier withdrawMax call through IAvatar (Safe)\n IAvatar(msg.sender).execTransactionFromModule(\n recipientHatAccount,\n 0,\n abi.encodeWithSignature(\n \"execute(address,uint256,bytes,uint8)\",\n address(sablier),\n 0,\n abi.encodeWithSignature(\n \"withdrawMax(uint256,address)\",\n streamId,\n to\n ),\n 0\n ),\n Enum.Operation.Call\n );\n }\n\n function cancelStream(ISablierV2Lockup sablier, uint256 streamId) public {\n // Check if the stream can be cancelled\n Lockup.Status streamStatus = sablier.statusOf(streamId);\n if (\n streamStatus != Lockup.Status.PENDING &&\n streamStatus != Lockup.Status.STREAMING\n ) {\n return;\n }\n\n IAvatar(msg.sender).execTransactionFromModule(\n address(sablier),\n 0,\n abi.encodeWithSignature(\"cancel(uint256)\", streamId),\n Enum.Operation.Call\n );\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 200 + }, + "evmVersion": "paris", + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/deployments/mainnet/DecentHatsCreationModule.json b/deployments/mainnet/DecentHatsCreationModule.json index 1c63a54..af88af9 100644 --- a/deployments/mainnet/DecentHatsCreationModule.json +++ b/deployments/mainnet/DecentHatsCreationModule.json @@ -1,5 +1,5 @@ { - "address": "0x97D15b915D33e5b642d42b565644cF43F285e61C", + "address": "0xB487c021789Db58a42D510a0dB0ce4aA3c6c355D", "abi": [ { "inputs": [], @@ -222,28 +222,28 @@ "type": "function" } ], - "transactionHash": "0xd81d23fb36c6c1e0e6d1b46a975f5a4a51a7d8f4255e2f29792e4e410346f749", + "transactionHash": "0x7de35efb73ebfa2c06bdb2666c3a46f0717f22c7992e057ba9e090d1063c1007", "receipt": { "to": null, "from": "0xb5Ca125166C1987A35EDD550E16846Fa1e1D9bB3", - "contractAddress": "0x97D15b915D33e5b642d42b565644cF43F285e61C", - "transactionIndex": 0, - "gasUsed": "1751463", + "contractAddress": "0xB487c021789Db58a42D510a0dB0ce4aA3c6c355D", + "transactionIndex": 3, + "gasUsed": "1887591", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x52244359a6389a115057be0d1cf4590273cc8c17fe3a3f139aa642b394facb0e", - "transactionHash": "0xd81d23fb36c6c1e0e6d1b46a975f5a4a51a7d8f4255e2f29792e4e410346f749", + "blockHash": "0x5c611118d731fa69d6be574b7a7df83c63b6dc0fcceda78905b4009dae1a2a84", + "transactionHash": "0x7de35efb73ebfa2c06bdb2666c3a46f0717f22c7992e057ba9e090d1063c1007", "logs": [], - "blockNumber": 21123494, - "cumulativeGasUsed": "1751463", + "blockNumber": 21243754, + "cumulativeGasUsed": "2652291", "status": 1, "byzantium": true }, "args": [], - "numDeployments": 1, - "solcInputHash": "e3ec7808efccf5e6b24e16a29ead3983", - "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"SALT\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"contract IHats\",\"name\":\"hatsProtocol\",\"type\":\"address\"},{\"internalType\":\"contract IERC6551Registry\",\"name\":\"erc6551Registry\",\"type\":\"address\"},{\"internalType\":\"contract IHatsModuleFactory\",\"name\":\"hatsModuleFactory\",\"type\":\"address\"},{\"internalType\":\"contract ModuleProxyFactory\",\"name\":\"moduleProxyFactory\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"keyValuePairs\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"decentAutonomousAdminImplementation\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"hatsAccountImplementation\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"hatsElectionsEligibilityImplementation\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"string\",\"name\":\"details\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"imageURI\",\"type\":\"string\"}],\"internalType\":\"struct DecentHatsCreationModule.TopHatParams\",\"name\":\"topHat\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"string\",\"name\":\"details\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"imageURI\",\"type\":\"string\"},{\"internalType\":\"bool\",\"name\":\"isMutable\",\"type\":\"bool\"}],\"internalType\":\"struct DecentHatsCreationModule.AdminHatParams\",\"name\":\"adminHat\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"wearer\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"details\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"imageURI\",\"type\":\"string\"},{\"components\":[{\"internalType\":\"contract ISablierV2LockupLinear\",\"name\":\"sablier\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint40\",\"name\":\"start\",\"type\":\"uint40\"},{\"internalType\":\"uint40\",\"name\":\"cliff\",\"type\":\"uint40\"},{\"internalType\":\"uint40\",\"name\":\"end\",\"type\":\"uint40\"}],\"internalType\":\"struct LockupLinear.Timestamps\",\"name\":\"timestamps\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"UD60x18\",\"name\":\"fee\",\"type\":\"uint256\"}],\"internalType\":\"struct Broker\",\"name\":\"broker\",\"type\":\"tuple\"},{\"internalType\":\"uint128\",\"name\":\"totalAmount\",\"type\":\"uint128\"},{\"internalType\":\"bool\",\"name\":\"cancelable\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"transferable\",\"type\":\"bool\"}],\"internalType\":\"struct DecentHatsModuleUtils.SablierStreamParams[]\",\"name\":\"sablierStreamsParams\",\"type\":\"tuple[]\"},{\"internalType\":\"uint128\",\"name\":\"termEndDateTs\",\"type\":\"uint128\"},{\"internalType\":\"uint32\",\"name\":\"maxSupply\",\"type\":\"uint32\"},{\"internalType\":\"bool\",\"name\":\"isMutable\",\"type\":\"bool\"}],\"internalType\":\"struct DecentHatsModuleUtils.HatParams[]\",\"name\":\"hats\",\"type\":\"tuple[]\"}],\"internalType\":\"struct DecentHatsCreationModule.CreateTreeParams\",\"name\":\"treeParams\",\"type\":\"tuple\"}],\"name\":\"createAndDeclareTree\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"createAndDeclareTree((address,address,address,address,address,address,address,address,(string,string),(string,string,bool),(address,string,string,(address,address,address,(uint40,uint40,uint40),(address,uint256),uint128,bool,bool)[],uint128,uint32,bool)[]))\":{\"details\":\"For each hat that is included, if the hat is: - termed, its stream funds on are targeted directly at the nominated wearer. The wearer should directly call `withdraw-` on the Sablier contract. - untermed, its stream funds are targeted at the hat's smart account. In order to withdraw funds from the stream, the hat's smart account must be the one call to `withdraw-` on the Sablier contract, setting the recipient arg to its wearer.In order for a Safe to seamlessly create roles even if it has never previously created a role and thus has no hat tree, we defer the creation of the hat tree and its setup to this contract. This way, in a single tx block, the resulting topHatId of the newly created hat can be used to create an admin hat and any other hats needed. We also make use of `KeyValuePairs` to associate the topHatId with the Safe.\",\"params\":{\"treeParams\":\"The parameters for creating the Hat Tree with Roles\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"createAndDeclareTree((address,address,address,address,address,address,address,address,(string,string),(string,string,bool),(address,string,string,(address,address,address,(uint40,uint40,uint40),(address,uint256),uint128,bool,bool)[],uint128,uint32,bool)[]))\":{\"notice\":\"For a safe without any roles previously created on it, this function should be called. It sets up the top hat and admin hat, as well as any other hats and their streams that are provided, then transfers the top hat to the calling safe.This contract should be enabled a module on the Safe for which the role(s) are to be created, and disabled after.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/modules/DecentHatsCreationModule.sol\":\"DecentHatsCreationModule\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\npragma solidity >=0.7.0 <0.9.0;\\n\\n/// @title Enum - Collection of enums\\n/// @author Richard Meissner - \\ncontract Enum {\\n enum Operation {Call, DelegateCall}\\n}\\n\",\"keccak256\":\"0x473e45b1a5cc47be494b0e123c9127f0c11c1e0992a321ae5a644c0bfdb2c14f\",\"license\":\"LGPL-3.0-only\"},\"@gnosis.pm/zodiac/contracts/factory/ModuleProxyFactory.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\npragma solidity >=0.8.0;\\n\\ncontract ModuleProxyFactory {\\n event ModuleProxyCreation(\\n address indexed proxy,\\n address indexed masterCopy\\n );\\n\\n /// `target` can not be zero.\\n error ZeroAddress(address target);\\n\\n /// `address_` is already taken.\\n error TakenAddress(address address_);\\n\\n /// @notice Initialization failed.\\n error FailedInitialization();\\n\\n function createProxy(address target, bytes32 salt)\\n internal\\n returns (address result)\\n {\\n if (address(target) == address(0)) revert ZeroAddress(target);\\n bytes memory deployment = abi.encodePacked(\\n hex\\\"602d8060093d393df3363d3d373d3d3d363d73\\\",\\n target,\\n hex\\\"5af43d82803e903d91602b57fd5bf3\\\"\\n );\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n result := create2(0, add(deployment, 0x20), mload(deployment), salt)\\n }\\n if (result == address(0)) revert TakenAddress(result);\\n }\\n\\n function deployModule(\\n address masterCopy,\\n bytes memory initializer,\\n uint256 saltNonce\\n ) public returns (address proxy) {\\n proxy = createProxy(\\n masterCopy,\\n keccak256(abi.encodePacked(keccak256(initializer), saltNonce))\\n );\\n (bool success, ) = proxy.call(initializer);\\n if (!success) revert FailedInitialization();\\n\\n emit ModuleProxyCreation(proxy, masterCopy);\\n }\\n}\\n\",\"keccak256\":\"0x70f6f1d88cf3382748e58f85ba87279f5bb8761863c293dd8c197a71ff558761\",\"license\":\"LGPL-3.0-only\"},\"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\n\\n/// @title Zodiac Avatar - A contract that manages modules that can execute transactions via this contract.\\npragma solidity >=0.7.0 <0.9.0;\\n\\nimport \\\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\\\";\\n\\ninterface IAvatar {\\n event EnabledModule(address module);\\n event DisabledModule(address module);\\n event ExecutionFromModuleSuccess(address indexed module);\\n event ExecutionFromModuleFailure(address indexed module);\\n\\n /// @dev Enables a module on the avatar.\\n /// @notice Can only be called by the avatar.\\n /// @notice Modules should be stored as a linked list.\\n /// @notice Must emit EnabledModule(address module) if successful.\\n /// @param module Module to be enabled.\\n function enableModule(address module) external;\\n\\n /// @dev Disables a module on the avatar.\\n /// @notice Can only be called by the avatar.\\n /// @notice Must emit DisabledModule(address module) if successful.\\n /// @param prevModule Address that pointed to the module to be removed in the linked list\\n /// @param module Module to be removed.\\n function disableModule(address prevModule, address module) external;\\n\\n /// @dev Allows a Module to execute a transaction.\\n /// @notice Can only be called by an enabled module.\\n /// @notice Must emit ExecutionFromModuleSuccess(address module) if successful.\\n /// @notice Must emit ExecutionFromModuleFailure(address module) if unsuccessful.\\n /// @param to Destination address of module transaction.\\n /// @param value Ether value of module transaction.\\n /// @param data Data payload of module transaction.\\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\\n function execTransactionFromModule(\\n address to,\\n uint256 value,\\n bytes memory data,\\n Enum.Operation operation\\n ) external returns (bool success);\\n\\n /// @dev Allows a Module to execute a transaction and return data\\n /// @notice Can only be called by an enabled module.\\n /// @notice Must emit ExecutionFromModuleSuccess(address module) if successful.\\n /// @notice Must emit ExecutionFromModuleFailure(address module) if unsuccessful.\\n /// @param to Destination address of module transaction.\\n /// @param value Ether value of module transaction.\\n /// @param data Data payload of module transaction.\\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\\n function execTransactionFromModuleReturnData(\\n address to,\\n uint256 value,\\n bytes memory data,\\n Enum.Operation operation\\n ) external returns (bool success, bytes memory returnData);\\n\\n /// @dev Returns if an module is enabled\\n /// @return True if the module is enabled\\n function isModuleEnabled(address module) external view returns (bool);\\n\\n /// @dev Returns array of modules.\\n /// @param start Start of the page.\\n /// @param pageSize Maximum number of modules that should be returned.\\n /// @return array Array of modules.\\n /// @return next Start of the next page.\\n function getModulesPaginated(address start, uint256 pageSize)\\n external\\n view\\n returns (address[] memory array, address next);\\n}\\n\",\"keccak256\":\"0xcd5508ffe596eef8fbccfd5fc4f10a34397773547ce64e212d48b5212865ec1f\",\"license\":\"LGPL-3.0-only\"},\"@openzeppelin/contracts/interfaces/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/introspection/IERC165.sol\\\";\\n\",\"keccak256\":\"0xd04b0f06e0666f29cf7cccc82894de541e19bb30a765b107b1e40bb7fe5f7d7a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev 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 amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `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 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes calldata data\\n ) external;\\n\\n /**\\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 {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the caller.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool _approved) external;\\n\\n /**\\n * @dev Returns 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\",\"keccak256\":\"0xed6a749c5373af398105ce6ee3ac4763aa450ea7285d268c85d9eeca809cdb1f\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../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\",\"keccak256\":\"0x75b829ff2f26c14355d1cba20e16fe7b29ca58eb5fef665ede48bc0f9c6c74b9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _HEX_SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\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 // Inspired by OraclizeAPI's implementation - MIT licence\\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\\n\\n if (value == 0) {\\n return \\\"0\\\";\\n }\\n uint256 temp = value;\\n uint256 digits;\\n while (temp != 0) {\\n digits++;\\n temp /= 10;\\n }\\n bytes memory buffer = new bytes(digits);\\n while (value != 0) {\\n digits -= 1;\\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\\n value /= 10;\\n }\\n return string(buffer);\\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 if (value == 0) {\\n return \\\"0x00\\\";\\n }\\n uint256 temp = value;\\n uint256 length = 0;\\n while (temp != 0) {\\n length++;\\n temp >>= 8;\\n }\\n return toHexString(value, length);\\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 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_SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\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 representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n}\\n\",\"keccak256\":\"0xaf159a8b1923ad2a26d516089bceca9bdeaeacd04be50983ea00ba63070f08a3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"@prb/math/src/Common.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\n// Common.sol\\n//\\n// Common mathematical functions used in both SD59x18 and UD60x18. Note that these global functions do not\\n// always operate with SD59x18 and UD60x18 numbers.\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CUSTOM ERRORS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @notice Thrown when the resultant value in {mulDiv} overflows uint256.\\nerror PRBMath_MulDiv_Overflow(uint256 x, uint256 y, uint256 denominator);\\n\\n/// @notice Thrown when the resultant value in {mulDiv18} overflows uint256.\\nerror PRBMath_MulDiv18_Overflow(uint256 x, uint256 y);\\n\\n/// @notice Thrown when one of the inputs passed to {mulDivSigned} is `type(int256).min`.\\nerror PRBMath_MulDivSigned_InputTooSmall();\\n\\n/// @notice Thrown when the resultant value in {mulDivSigned} overflows int256.\\nerror PRBMath_MulDivSigned_Overflow(int256 x, int256 y);\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CONSTANTS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @dev The maximum value a uint128 number can have.\\nuint128 constant MAX_UINT128 = type(uint128).max;\\n\\n/// @dev The maximum value a uint40 number can have.\\nuint40 constant MAX_UINT40 = type(uint40).max;\\n\\n/// @dev The unit number, which the decimal precision of the fixed-point types.\\nuint256 constant UNIT = 1e18;\\n\\n/// @dev The unit number inverted mod 2^256.\\nuint256 constant UNIT_INVERSE = 78156646155174841979727994598816262306175212592076161876661_508869554232690281;\\n\\n/// @dev The the largest power of two that divides the decimal value of `UNIT`. The logarithm of this value is the least significant\\n/// bit in the binary representation of `UNIT`.\\nuint256 constant UNIT_LPOTD = 262144;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @notice Calculates the binary exponent of x using the binary fraction method.\\n/// @dev Has to use 192.64-bit fixed-point numbers. See https://ethereum.stackexchange.com/a/96594/24693.\\n/// @param x The exponent as an unsigned 192.64-bit fixed-point number.\\n/// @return result The result as an unsigned 60.18-decimal fixed-point number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp2(uint256 x) pure returns (uint256 result) {\\n unchecked {\\n // Start from 0.5 in the 192.64-bit fixed-point format.\\n result = 0x800000000000000000000000000000000000000000000000;\\n\\n // The following logic multiplies the result by $\\\\sqrt{2^{-i}}$ when the bit at position i is 1. Key points:\\n //\\n // 1. Intermediate results will not overflow, as the starting point is 2^191 and all magic factors are under 2^65.\\n // 2. The rationale for organizing the if statements into groups of 8 is gas savings. If the result of performing\\n // a bitwise AND operation between x and any value in the array [0x80; 0x40; 0x20; 0x10; 0x08; 0x04; 0x02; 0x01] is 1,\\n // we know that `x & 0xFF` is also 1.\\n if (x & 0xFF00000000000000 > 0) {\\n if (x & 0x8000000000000000 > 0) {\\n result = (result * 0x16A09E667F3BCC909) >> 64;\\n }\\n if (x & 0x4000000000000000 > 0) {\\n result = (result * 0x1306FE0A31B7152DF) >> 64;\\n }\\n if (x & 0x2000000000000000 > 0) {\\n result = (result * 0x1172B83C7D517ADCE) >> 64;\\n }\\n if (x & 0x1000000000000000 > 0) {\\n result = (result * 0x10B5586CF9890F62A) >> 64;\\n }\\n if (x & 0x800000000000000 > 0) {\\n result = (result * 0x1059B0D31585743AE) >> 64;\\n }\\n if (x & 0x400000000000000 > 0) {\\n result = (result * 0x102C9A3E778060EE7) >> 64;\\n }\\n if (x & 0x200000000000000 > 0) {\\n result = (result * 0x10163DA9FB33356D8) >> 64;\\n }\\n if (x & 0x100000000000000 > 0) {\\n result = (result * 0x100B1AFA5ABCBED61) >> 64;\\n }\\n }\\n\\n if (x & 0xFF000000000000 > 0) {\\n if (x & 0x80000000000000 > 0) {\\n result = (result * 0x10058C86DA1C09EA2) >> 64;\\n }\\n if (x & 0x40000000000000 > 0) {\\n result = (result * 0x1002C605E2E8CEC50) >> 64;\\n }\\n if (x & 0x20000000000000 > 0) {\\n result = (result * 0x100162F3904051FA1) >> 64;\\n }\\n if (x & 0x10000000000000 > 0) {\\n result = (result * 0x1000B175EFFDC76BA) >> 64;\\n }\\n if (x & 0x8000000000000 > 0) {\\n result = (result * 0x100058BA01FB9F96D) >> 64;\\n }\\n if (x & 0x4000000000000 > 0) {\\n result = (result * 0x10002C5CC37DA9492) >> 64;\\n }\\n if (x & 0x2000000000000 > 0) {\\n result = (result * 0x1000162E525EE0547) >> 64;\\n }\\n if (x & 0x1000000000000 > 0) {\\n result = (result * 0x10000B17255775C04) >> 64;\\n }\\n }\\n\\n if (x & 0xFF0000000000 > 0) {\\n if (x & 0x800000000000 > 0) {\\n result = (result * 0x1000058B91B5BC9AE) >> 64;\\n }\\n if (x & 0x400000000000 > 0) {\\n result = (result * 0x100002C5C89D5EC6D) >> 64;\\n }\\n if (x & 0x200000000000 > 0) {\\n result = (result * 0x10000162E43F4F831) >> 64;\\n }\\n if (x & 0x100000000000 > 0) {\\n result = (result * 0x100000B1721BCFC9A) >> 64;\\n }\\n if (x & 0x80000000000 > 0) {\\n result = (result * 0x10000058B90CF1E6E) >> 64;\\n }\\n if (x & 0x40000000000 > 0) {\\n result = (result * 0x1000002C5C863B73F) >> 64;\\n }\\n if (x & 0x20000000000 > 0) {\\n result = (result * 0x100000162E430E5A2) >> 64;\\n }\\n if (x & 0x10000000000 > 0) {\\n result = (result * 0x1000000B172183551) >> 64;\\n }\\n }\\n\\n if (x & 0xFF00000000 > 0) {\\n if (x & 0x8000000000 > 0) {\\n result = (result * 0x100000058B90C0B49) >> 64;\\n }\\n if (x & 0x4000000000 > 0) {\\n result = (result * 0x10000002C5C8601CC) >> 64;\\n }\\n if (x & 0x2000000000 > 0) {\\n result = (result * 0x1000000162E42FFF0) >> 64;\\n }\\n if (x & 0x1000000000 > 0) {\\n result = (result * 0x10000000B17217FBB) >> 64;\\n }\\n if (x & 0x800000000 > 0) {\\n result = (result * 0x1000000058B90BFCE) >> 64;\\n }\\n if (x & 0x400000000 > 0) {\\n result = (result * 0x100000002C5C85FE3) >> 64;\\n }\\n if (x & 0x200000000 > 0) {\\n result = (result * 0x10000000162E42FF1) >> 64;\\n }\\n if (x & 0x100000000 > 0) {\\n result = (result * 0x100000000B17217F8) >> 64;\\n }\\n }\\n\\n if (x & 0xFF000000 > 0) {\\n if (x & 0x80000000 > 0) {\\n result = (result * 0x10000000058B90BFC) >> 64;\\n }\\n if (x & 0x40000000 > 0) {\\n result = (result * 0x1000000002C5C85FE) >> 64;\\n }\\n if (x & 0x20000000 > 0) {\\n result = (result * 0x100000000162E42FF) >> 64;\\n }\\n if (x & 0x10000000 > 0) {\\n result = (result * 0x1000000000B17217F) >> 64;\\n }\\n if (x & 0x8000000 > 0) {\\n result = (result * 0x100000000058B90C0) >> 64;\\n }\\n if (x & 0x4000000 > 0) {\\n result = (result * 0x10000000002C5C860) >> 64;\\n }\\n if (x & 0x2000000 > 0) {\\n result = (result * 0x1000000000162E430) >> 64;\\n }\\n if (x & 0x1000000 > 0) {\\n result = (result * 0x10000000000B17218) >> 64;\\n }\\n }\\n\\n if (x & 0xFF0000 > 0) {\\n if (x & 0x800000 > 0) {\\n result = (result * 0x1000000000058B90C) >> 64;\\n }\\n if (x & 0x400000 > 0) {\\n result = (result * 0x100000000002C5C86) >> 64;\\n }\\n if (x & 0x200000 > 0) {\\n result = (result * 0x10000000000162E43) >> 64;\\n }\\n if (x & 0x100000 > 0) {\\n result = (result * 0x100000000000B1721) >> 64;\\n }\\n if (x & 0x80000 > 0) {\\n result = (result * 0x10000000000058B91) >> 64;\\n }\\n if (x & 0x40000 > 0) {\\n result = (result * 0x1000000000002C5C8) >> 64;\\n }\\n if (x & 0x20000 > 0) {\\n result = (result * 0x100000000000162E4) >> 64;\\n }\\n if (x & 0x10000 > 0) {\\n result = (result * 0x1000000000000B172) >> 64;\\n }\\n }\\n\\n if (x & 0xFF00 > 0) {\\n if (x & 0x8000 > 0) {\\n result = (result * 0x100000000000058B9) >> 64;\\n }\\n if (x & 0x4000 > 0) {\\n result = (result * 0x10000000000002C5D) >> 64;\\n }\\n if (x & 0x2000 > 0) {\\n result = (result * 0x1000000000000162E) >> 64;\\n }\\n if (x & 0x1000 > 0) {\\n result = (result * 0x10000000000000B17) >> 64;\\n }\\n if (x & 0x800 > 0) {\\n result = (result * 0x1000000000000058C) >> 64;\\n }\\n if (x & 0x400 > 0) {\\n result = (result * 0x100000000000002C6) >> 64;\\n }\\n if (x & 0x200 > 0) {\\n result = (result * 0x10000000000000163) >> 64;\\n }\\n if (x & 0x100 > 0) {\\n result = (result * 0x100000000000000B1) >> 64;\\n }\\n }\\n\\n if (x & 0xFF > 0) {\\n if (x & 0x80 > 0) {\\n result = (result * 0x10000000000000059) >> 64;\\n }\\n if (x & 0x40 > 0) {\\n result = (result * 0x1000000000000002C) >> 64;\\n }\\n if (x & 0x20 > 0) {\\n result = (result * 0x10000000000000016) >> 64;\\n }\\n if (x & 0x10 > 0) {\\n result = (result * 0x1000000000000000B) >> 64;\\n }\\n if (x & 0x8 > 0) {\\n result = (result * 0x10000000000000006) >> 64;\\n }\\n if (x & 0x4 > 0) {\\n result = (result * 0x10000000000000003) >> 64;\\n }\\n if (x & 0x2 > 0) {\\n result = (result * 0x10000000000000001) >> 64;\\n }\\n if (x & 0x1 > 0) {\\n result = (result * 0x10000000000000001) >> 64;\\n }\\n }\\n\\n // In the code snippet below, two operations are executed simultaneously:\\n //\\n // 1. The result is multiplied by $(2^n + 1)$, where $2^n$ represents the integer part, and the additional 1\\n // accounts for the initial guess of 0.5. This is achieved by subtracting from 191 instead of 192.\\n // 2. The result is then converted to an unsigned 60.18-decimal fixed-point format.\\n //\\n // The underlying logic is based on the relationship $2^{191-ip} = 2^{ip} / 2^{191}$, where $ip$ denotes the,\\n // integer part, $2^n$.\\n result *= UNIT;\\n result >>= (191 - (x >> 64));\\n }\\n}\\n\\n/// @notice Finds the zero-based index of the first 1 in the binary representation of x.\\n///\\n/// @dev See the note on \\\"msb\\\" in this Wikipedia article: https://en.wikipedia.org/wiki/Find_first_set\\n///\\n/// Each step in this implementation is equivalent to this high-level code:\\n///\\n/// ```solidity\\n/// if (x >= 2 ** 128) {\\n/// x >>= 128;\\n/// result += 128;\\n/// }\\n/// ```\\n///\\n/// Where 128 is replaced with each respective power of two factor. See the full high-level implementation here:\\n/// https://gist.github.com/PaulRBerg/f932f8693f2733e30c4d479e8e980948\\n///\\n/// The Yul instructions used below are:\\n///\\n/// - \\\"gt\\\" is \\\"greater than\\\"\\n/// - \\\"or\\\" is the OR bitwise operator\\n/// - \\\"shl\\\" is \\\"shift left\\\"\\n/// - \\\"shr\\\" is \\\"shift right\\\"\\n///\\n/// @param x The uint256 number for which to find the index of the most significant bit.\\n/// @return result The index of the most significant bit as a uint256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction msb(uint256 x) pure returns (uint256 result) {\\n // 2^128\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(7, gt(x, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^64\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(6, gt(x, 0xFFFFFFFFFFFFFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^32\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(5, gt(x, 0xFFFFFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^16\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(4, gt(x, 0xFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^8\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(3, gt(x, 0xFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^4\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(2, gt(x, 0xF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^2\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(1, gt(x, 0x3))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^1\\n // No need to shift x any more.\\n assembly (\\\"memory-safe\\\") {\\n let factor := gt(x, 0x1)\\n result := or(result, factor)\\n }\\n}\\n\\n/// @notice Calculates x*y\\u00f7denominator with 512-bit precision.\\n///\\n/// @dev Credits to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv.\\n///\\n/// Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - The denominator must not be zero.\\n/// - The result must fit in uint256.\\n///\\n/// @param x The multiplicand as a uint256.\\n/// @param y The multiplier as a uint256.\\n/// @param denominator The divisor as a uint256.\\n/// @return result The result as a uint256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mulDiv(uint256 x, uint256 y, uint256 denominator) pure returns (uint256 result) {\\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; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly (\\\"memory-safe\\\") {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\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 unchecked {\\n return prod0 / denominator;\\n }\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n if (prod1 >= denominator) {\\n revert PRBMath_MulDiv_Overflow(x, y, denominator);\\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 (\\\"memory-safe\\\") {\\n // Compute remainder using the mulmod Yul instruction.\\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 unchecked {\\n // Calculate the largest power of two divisor of the denominator using the unary operator ~. This operation cannot overflow\\n // because the denominator cannot be zero at this point in the function execution. The result is always >= 1.\\n // For more detail, see https://cs.stackexchange.com/q/138556/92363.\\n uint256 lpotdod = denominator & (~denominator + 1);\\n uint256 flippedLpotdod;\\n\\n assembly (\\\"memory-safe\\\") {\\n // Factor powers of two out of denominator.\\n denominator := div(denominator, lpotdod)\\n\\n // Divide [prod1 prod0] by lpotdod.\\n prod0 := div(prod0, lpotdod)\\n\\n // Get the flipped value `2^256 / lpotdod`. If the `lpotdod` is zero, the flipped value is one.\\n // `sub(0, lpotdod)` produces the two's complement version of `lpotdod`, which is equivalent to flipping all the bits.\\n // However, `div` interprets this value as an unsigned value: https://ethereum.stackexchange.com/q/147168/24693\\n flippedLpotdod := add(div(sub(0, lpotdod), lpotdod), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * flippedLpotdod;\\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 works\\n // 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 }\\n}\\n\\n/// @notice Calculates x*y\\u00f71e18 with 512-bit precision.\\n///\\n/// @dev A variant of {mulDiv} with constant folding, i.e. in which the denominator is hard coded to 1e18.\\n///\\n/// Notes:\\n/// - The body is purposely left uncommented; to understand how this works, see the documentation in {mulDiv}.\\n/// - The result is rounded toward zero.\\n/// - We take as an axiom that the result cannot be `MAX_UINT256` when x and y solve the following system of equations:\\n///\\n/// $$\\n/// \\\\begin{cases}\\n/// x * y = MAX\\\\_UINT256 * UNIT \\\\\\\\\\n/// (x * y) \\\\% UNIT \\\\geq \\\\frac{UNIT}{2}\\n/// \\\\end{cases}\\n/// $$\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {mulDiv}.\\n/// - The result must fit in uint256.\\n///\\n/// @param x The multiplicand as an unsigned 60.18-decimal fixed-point number.\\n/// @param y The multiplier as an unsigned 60.18-decimal fixed-point number.\\n/// @return result The result as an unsigned 60.18-decimal fixed-point number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mulDiv18(uint256 x, uint256 y) pure returns (uint256 result) {\\n uint256 prod0;\\n uint256 prod1;\\n assembly (\\\"memory-safe\\\") {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n if (prod1 == 0) {\\n unchecked {\\n return prod0 / UNIT;\\n }\\n }\\n\\n if (prod1 >= UNIT) {\\n revert PRBMath_MulDiv18_Overflow(x, y);\\n }\\n\\n uint256 remainder;\\n assembly (\\\"memory-safe\\\") {\\n remainder := mulmod(x, y, UNIT)\\n result :=\\n mul(\\n or(\\n div(sub(prod0, remainder), UNIT_LPOTD),\\n mul(sub(prod1, gt(remainder, prod0)), add(div(sub(0, UNIT_LPOTD), UNIT_LPOTD), 1))\\n ),\\n UNIT_INVERSE\\n )\\n }\\n}\\n\\n/// @notice Calculates x*y\\u00f7denominator with 512-bit precision.\\n///\\n/// @dev This is an extension of {mulDiv} for signed numbers, which works by computing the signs and the absolute values separately.\\n///\\n/// Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {mulDiv}.\\n/// - None of the inputs can be `type(int256).min`.\\n/// - The result must fit in int256.\\n///\\n/// @param x The multiplicand as an int256.\\n/// @param y The multiplier as an int256.\\n/// @param denominator The divisor as an int256.\\n/// @return result The result as an int256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mulDivSigned(int256 x, int256 y, int256 denominator) pure returns (int256 result) {\\n if (x == type(int256).min || y == type(int256).min || denominator == type(int256).min) {\\n revert PRBMath_MulDivSigned_InputTooSmall();\\n }\\n\\n // Get hold of the absolute values of x, y and the denominator.\\n uint256 xAbs;\\n uint256 yAbs;\\n uint256 dAbs;\\n unchecked {\\n xAbs = x < 0 ? uint256(-x) : uint256(x);\\n yAbs = y < 0 ? uint256(-y) : uint256(y);\\n dAbs = denominator < 0 ? uint256(-denominator) : uint256(denominator);\\n }\\n\\n // Compute the absolute value of x*y\\u00f7denominator. The result must fit in int256.\\n uint256 resultAbs = mulDiv(xAbs, yAbs, dAbs);\\n if (resultAbs > uint256(type(int256).max)) {\\n revert PRBMath_MulDivSigned_Overflow(x, y);\\n }\\n\\n // Get the signs of x, y and the denominator.\\n uint256 sx;\\n uint256 sy;\\n uint256 sd;\\n assembly (\\\"memory-safe\\\") {\\n // \\\"sgt\\\" is the \\\"signed greater than\\\" assembly instruction and \\\"sub(0,1)\\\" is -1 in two's complement.\\n sx := sgt(x, sub(0, 1))\\n sy := sgt(y, sub(0, 1))\\n sd := sgt(denominator, sub(0, 1))\\n }\\n\\n // XOR over sx, sy and sd. What this does is to check whether there are 1 or 3 negative signs in the inputs.\\n // If there are, the result should be negative. Otherwise, it should be positive.\\n unchecked {\\n result = sx ^ sy ^ sd == 0 ? -int256(resultAbs) : int256(resultAbs);\\n }\\n}\\n\\n/// @notice Calculates the square root of x using the Babylonian method.\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\\n///\\n/// Notes:\\n/// - If x is not a perfect square, the result is rounded down.\\n/// - Credits to OpenZeppelin for the explanations in comments below.\\n///\\n/// @param x The uint256 number for which to calculate the square root.\\n/// @return result The result as a uint256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction sqrt(uint256 x) pure returns (uint256 result) {\\n if (x == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we calculate the biggest power of 2 which is smaller than the square root of x.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of x is a power of 2 such that we have:\\n //\\n // $$\\n // msb(x) <= x <= 2*msb(x)$\\n // $$\\n //\\n // We write $msb(x)$ as $2^k$, and we get:\\n //\\n // $$\\n // k = log_2(x)\\n // $$\\n //\\n // Thus, we can write the initial inequality as:\\n //\\n // $$\\n // 2^{log_2(x)} <= x <= 2*2^{log_2(x)+1} \\\\\\\\\\n // sqrt(2^k) <= sqrt(x) < sqrt(2^{k+1}) \\\\\\\\\\n // 2^{k/2} <= sqrt(x) < 2^{(k+1)/2} <= 2^{(k/2)+1}\\n // $$\\n //\\n // Consequently, $2^{log_2(x) /2} is a good first approximation of sqrt(x) with at least one correct bit.\\n uint256 xAux = uint256(x);\\n result = 1;\\n if (xAux >= 2 ** 128) {\\n xAux >>= 128;\\n result <<= 64;\\n }\\n if (xAux >= 2 ** 64) {\\n xAux >>= 64;\\n result <<= 32;\\n }\\n if (xAux >= 2 ** 32) {\\n xAux >>= 32;\\n result <<= 16;\\n }\\n if (xAux >= 2 ** 16) {\\n xAux >>= 16;\\n result <<= 8;\\n }\\n if (xAux >= 2 ** 8) {\\n xAux >>= 8;\\n result <<= 4;\\n }\\n if (xAux >= 2 ** 4) {\\n xAux >>= 4;\\n result <<= 2;\\n }\\n if (xAux >= 2 ** 2) {\\n result <<= 1;\\n }\\n\\n // At this point, `result` is an estimation with at least one bit of precision. We know the true value has at\\n // most 128 bits, since it is the square root of a uint256. Newton's method converges quadratically (precision\\n // doubles at every iteration). We thus need at most 7 iteration to turn our partial result with one bit of\\n // precision into the expected uint128 result.\\n unchecked {\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n\\n // If x is not a perfect square, round the result toward zero.\\n uint256 roundedResult = x / result;\\n if (result >= roundedResult) {\\n result = roundedResult;\\n }\\n }\\n}\\n\",\"keccak256\":\"0xaa374e2c26cc93e8c22a6953804ee05f811597ef5fa82f76824378b22944778b\",\"license\":\"MIT\"},\"@prb/math/src/UD2x18.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\n/*\\n\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2550\\u2550\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2554\\u2588\\u2588\\u2588\\u2588\\u2554\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551 \\u255a\\u2550\\u255d \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\n\\n\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2550\\u2550\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d \\u255a\\u2588\\u2588\\u2588\\u2554\\u255d \\u255a\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u255d\\n\\n*/\\n\\nimport \\\"./ud2x18/Casting.sol\\\";\\nimport \\\"./ud2x18/Constants.sol\\\";\\nimport \\\"./ud2x18/Errors.sol\\\";\\nimport \\\"./ud2x18/ValueType.sol\\\";\\n\",\"keccak256\":\"0xfb624e24cd8bb790fa08e7827819de85504a86e20e961fa4ad126c65b6d90641\",\"license\":\"MIT\"},\"@prb/math/src/UD60x18.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\n/*\\n\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2550\\u2550\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2554\\u2588\\u2588\\u2588\\u2588\\u2554\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551 \\u255a\\u2550\\u255d \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\n\\n\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2550\\u2588\\u2588\\u2588\\u2588\\u2557\\u255a\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2588\\u2588\\u2551 \\u255a\\u2588\\u2588\\u2588\\u2554\\u255d \\u255a\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2554\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2554\\u255d \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u255d\\n\\n*/\\n\\nimport \\\"./ud60x18/Casting.sol\\\";\\nimport \\\"./ud60x18/Constants.sol\\\";\\nimport \\\"./ud60x18/Conversions.sol\\\";\\nimport \\\"./ud60x18/Errors.sol\\\";\\nimport \\\"./ud60x18/Helpers.sol\\\";\\nimport \\\"./ud60x18/Math.sol\\\";\\nimport \\\"./ud60x18/ValueType.sol\\\";\\n\",\"keccak256\":\"0xb98c6f74275914d279e8af6c502c2b1f50d5f6e1ed418d3b0153f5a193206c48\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as CastingErrors;\\nimport { SD59x18 } from \\\"../sd59x18/ValueType.sol\\\";\\nimport { UD2x18 } from \\\"../ud2x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"../ud60x18/ValueType.sol\\\";\\nimport { SD1x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts an SD1x18 number into SD59x18.\\n/// @dev There is no overflow check because the domain of SD1x18 is a subset of SD59x18.\\nfunction intoSD59x18(SD1x18 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(int256(SD1x18.unwrap(x)));\\n}\\n\\n/// @notice Casts an SD1x18 number into UD2x18.\\n/// - x must be positive.\\nfunction intoUD2x18(SD1x18 x) pure returns (UD2x18 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUD2x18_Underflow(x);\\n }\\n result = UD2x18.wrap(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into UD60x18.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUD60x18(SD1x18 x) pure returns (UD60x18 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUD60x18_Underflow(x);\\n }\\n result = UD60x18.wrap(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into uint256.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUint256(SD1x18 x) pure returns (uint256 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint256_Underflow(x);\\n }\\n result = uint256(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into uint128.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUint128(SD1x18 x) pure returns (uint128 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint128_Underflow(x);\\n }\\n result = uint128(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(SD1x18 x) pure returns (uint40 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint40_Underflow(x);\\n }\\n if (xInt > int64(uint64(Common.MAX_UINT40))) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint40_Overflow(x);\\n }\\n result = uint40(uint64(xInt));\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction sd1x18(int64 x) pure returns (SD1x18 result) {\\n result = SD1x18.wrap(x);\\n}\\n\\n/// @notice Unwraps an SD1x18 number into int64.\\nfunction unwrap(SD1x18 x) pure returns (int64 result) {\\n result = SD1x18.unwrap(x);\\n}\\n\\n/// @notice Wraps an int64 number into SD1x18.\\nfunction wrap(int64 x) pure returns (SD1x18 result) {\\n result = SD1x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x9e49e2b37c1bb845861740805edaaef3fe951a7b96eef16ce84fbf76e8278670\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD1x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @dev Euler's number as an SD1x18 number.\\nSD1x18 constant E = SD1x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum value an SD1x18 number can have.\\nint64 constant uMAX_SD1x18 = 9_223372036854775807;\\nSD1x18 constant MAX_SD1x18 = SD1x18.wrap(uMAX_SD1x18);\\n\\n/// @dev The maximum value an SD1x18 number can have.\\nint64 constant uMIN_SD1x18 = -9_223372036854775808;\\nSD1x18 constant MIN_SD1x18 = SD1x18.wrap(uMIN_SD1x18);\\n\\n/// @dev PI as an SD1x18 number.\\nSD1x18 constant PI = SD1x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of SD1x18.\\nSD1x18 constant UNIT = SD1x18.wrap(1e18);\\nint64 constant uUNIT = 1e18;\\n\",\"keccak256\":\"0x6496165b80552785a4b65a239b96e2a5fedf62fe54f002eeed72d75e566d7585\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD1x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in UD2x18.\\nerror PRBMath_SD1x18_ToUD2x18_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in UD60x18.\\nerror PRBMath_SD1x18_ToUD60x18_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint128.\\nerror PRBMath_SD1x18_ToUint128_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint256.\\nerror PRBMath_SD1x18_ToUint256_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint40.\\nerror PRBMath_SD1x18_ToUint40_Overflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint40.\\nerror PRBMath_SD1x18_ToUint40_Underflow(SD1x18 x);\\n\",\"keccak256\":\"0x836cb42ba619ca369fd4765bc47fefc3c3621369c5861882af14660aca5057ee\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\n\\n/// @notice The signed 1.18-decimal fixed-point number representation, which can have up to 1 digit and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\\n/// type int64. This is useful when end users want to use int64 to save gas, e.g. with tight variable packing in contract\\n/// storage.\\ntype SD1x18 is int64;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoSD59x18,\\n Casting.intoUD2x18,\\n Casting.intoUD60x18,\\n Casting.intoUint256,\\n Casting.intoUint128,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for SD1x18 global;\\n\",\"keccak256\":\"0x2f86f1aa9fca42f40808b51a879b406ac51817647bdb9642f8a79dd8fdb754a7\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Errors.sol\\\" as CastingErrors;\\nimport { MAX_UINT128, MAX_UINT40 } from \\\"../Common.sol\\\";\\nimport { uMAX_SD1x18, uMIN_SD1x18 } from \\\"../sd1x18/Constants.sol\\\";\\nimport { SD1x18 } from \\\"../sd1x18/ValueType.sol\\\";\\nimport { uMAX_UD2x18 } from \\\"../ud2x18/Constants.sol\\\";\\nimport { UD2x18 } from \\\"../ud2x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"../ud60x18/ValueType.sol\\\";\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts an SD59x18 number into int256.\\n/// @dev This is basically a functional alias for {unwrap}.\\nfunction intoInt256(SD59x18 x) pure returns (int256 result) {\\n result = SD59x18.unwrap(x);\\n}\\n\\n/// @notice Casts an SD59x18 number into SD1x18.\\n/// @dev Requirements:\\n/// - x must be greater than or equal to `uMIN_SD1x18`.\\n/// - x must be less than or equal to `uMAX_SD1x18`.\\nfunction intoSD1x18(SD59x18 x) pure returns (SD1x18 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < uMIN_SD1x18) {\\n revert CastingErrors.PRBMath_SD59x18_IntoSD1x18_Underflow(x);\\n }\\n if (xInt > uMAX_SD1x18) {\\n revert CastingErrors.PRBMath_SD59x18_IntoSD1x18_Overflow(x);\\n }\\n result = SD1x18.wrap(int64(xInt));\\n}\\n\\n/// @notice Casts an SD59x18 number into UD2x18.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `uMAX_UD2x18`.\\nfunction intoUD2x18(SD59x18 x) pure returns (UD2x18 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUD2x18_Underflow(x);\\n }\\n if (xInt > int256(uint256(uMAX_UD2x18))) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUD2x18_Overflow(x);\\n }\\n result = UD2x18.wrap(uint64(uint256(xInt)));\\n}\\n\\n/// @notice Casts an SD59x18 number into UD60x18.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUD60x18(SD59x18 x) pure returns (UD60x18 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUD60x18_Underflow(x);\\n }\\n result = UD60x18.wrap(uint256(xInt));\\n}\\n\\n/// @notice Casts an SD59x18 number into uint256.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUint256(SD59x18 x) pure returns (uint256 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint256_Underflow(x);\\n }\\n result = uint256(xInt);\\n}\\n\\n/// @notice Casts an SD59x18 number into uint128.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `uMAX_UINT128`.\\nfunction intoUint128(SD59x18 x) pure returns (uint128 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint128_Underflow(x);\\n }\\n if (xInt > int256(uint256(MAX_UINT128))) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint128_Overflow(x);\\n }\\n result = uint128(uint256(xInt));\\n}\\n\\n/// @notice Casts an SD59x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(SD59x18 x) pure returns (uint40 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint40_Underflow(x);\\n }\\n if (xInt > int256(uint256(MAX_UINT40))) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint40_Overflow(x);\\n }\\n result = uint40(uint256(xInt));\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction sd(int256 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(x);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction sd59x18(int256 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(x);\\n}\\n\\n/// @notice Unwraps an SD59x18 number into int256.\\nfunction unwrap(SD59x18 x) pure returns (int256 result) {\\n result = SD59x18.unwrap(x);\\n}\\n\\n/// @notice Wraps an int256 number into SD59x18.\\nfunction wrap(int256 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x3b21b60ec2998c3ae32f647412da51d3683b3f183a807198cc8d157499484f99\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n// NOTICE: the \\\"u\\\" prefix stands for \\\"unwrapped\\\".\\n\\n/// @dev Euler's number as an SD59x18 number.\\nSD59x18 constant E = SD59x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum input permitted in {exp}.\\nint256 constant uEXP_MAX_INPUT = 133_084258667509499440;\\nSD59x18 constant EXP_MAX_INPUT = SD59x18.wrap(uEXP_MAX_INPUT);\\n\\n/// @dev Any value less than this returns 0 in {exp}.\\nint256 constant uEXP_MIN_THRESHOLD = -41_446531673892822322;\\nSD59x18 constant EXP_MIN_THRESHOLD = SD59x18.wrap(uEXP_MIN_THRESHOLD);\\n\\n/// @dev The maximum input permitted in {exp2}.\\nint256 constant uEXP2_MAX_INPUT = 192e18 - 1;\\nSD59x18 constant EXP2_MAX_INPUT = SD59x18.wrap(uEXP2_MAX_INPUT);\\n\\n/// @dev Any value less than this returns 0 in {exp2}.\\nint256 constant uEXP2_MIN_THRESHOLD = -59_794705707972522261;\\nSD59x18 constant EXP2_MIN_THRESHOLD = SD59x18.wrap(uEXP2_MIN_THRESHOLD);\\n\\n/// @dev Half the UNIT number.\\nint256 constant uHALF_UNIT = 0.5e18;\\nSD59x18 constant HALF_UNIT = SD59x18.wrap(uHALF_UNIT);\\n\\n/// @dev $log_2(10)$ as an SD59x18 number.\\nint256 constant uLOG2_10 = 3_321928094887362347;\\nSD59x18 constant LOG2_10 = SD59x18.wrap(uLOG2_10);\\n\\n/// @dev $log_2(e)$ as an SD59x18 number.\\nint256 constant uLOG2_E = 1_442695040888963407;\\nSD59x18 constant LOG2_E = SD59x18.wrap(uLOG2_E);\\n\\n/// @dev The maximum value an SD59x18 number can have.\\nint256 constant uMAX_SD59x18 = 57896044618658097711785492504343953926634992332820282019728_792003956564819967;\\nSD59x18 constant MAX_SD59x18 = SD59x18.wrap(uMAX_SD59x18);\\n\\n/// @dev The maximum whole value an SD59x18 number can have.\\nint256 constant uMAX_WHOLE_SD59x18 = 57896044618658097711785492504343953926634992332820282019728_000000000000000000;\\nSD59x18 constant MAX_WHOLE_SD59x18 = SD59x18.wrap(uMAX_WHOLE_SD59x18);\\n\\n/// @dev The minimum value an SD59x18 number can have.\\nint256 constant uMIN_SD59x18 = -57896044618658097711785492504343953926634992332820282019728_792003956564819968;\\nSD59x18 constant MIN_SD59x18 = SD59x18.wrap(uMIN_SD59x18);\\n\\n/// @dev The minimum whole value an SD59x18 number can have.\\nint256 constant uMIN_WHOLE_SD59x18 = -57896044618658097711785492504343953926634992332820282019728_000000000000000000;\\nSD59x18 constant MIN_WHOLE_SD59x18 = SD59x18.wrap(uMIN_WHOLE_SD59x18);\\n\\n/// @dev PI as an SD59x18 number.\\nSD59x18 constant PI = SD59x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of SD59x18.\\nint256 constant uUNIT = 1e18;\\nSD59x18 constant UNIT = SD59x18.wrap(1e18);\\n\\n/// @dev The unit number squared.\\nint256 constant uUNIT_SQUARED = 1e36;\\nSD59x18 constant UNIT_SQUARED = SD59x18.wrap(uUNIT_SQUARED);\\n\\n/// @dev Zero as an SD59x18 number.\\nSD59x18 constant ZERO = SD59x18.wrap(0);\\n\",\"keccak256\":\"0x9bcb8dd6b3e886d140ad1c32747a4f6d29a492529ceb835be878ae837aa6cc3a\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when taking the absolute value of `MIN_SD59x18`.\\nerror PRBMath_SD59x18_Abs_MinSD59x18();\\n\\n/// @notice Thrown when ceiling a number overflows SD59x18.\\nerror PRBMath_SD59x18_Ceil_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when converting a basic integer to the fixed-point format overflows SD59x18.\\nerror PRBMath_SD59x18_Convert_Overflow(int256 x);\\n\\n/// @notice Thrown when converting a basic integer to the fixed-point format underflows SD59x18.\\nerror PRBMath_SD59x18_Convert_Underflow(int256 x);\\n\\n/// @notice Thrown when dividing two numbers and one of them is `MIN_SD59x18`.\\nerror PRBMath_SD59x18_Div_InputTooSmall();\\n\\n/// @notice Thrown when dividing two numbers and one of the intermediary unsigned results overflows SD59x18.\\nerror PRBMath_SD59x18_Div_Overflow(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when taking the natural exponent of a base greater than 133_084258667509499441.\\nerror PRBMath_SD59x18_Exp_InputTooBig(SD59x18 x);\\n\\n/// @notice Thrown when taking the binary exponent of a base greater than 192e18.\\nerror PRBMath_SD59x18_Exp2_InputTooBig(SD59x18 x);\\n\\n/// @notice Thrown when flooring a number underflows SD59x18.\\nerror PRBMath_SD59x18_Floor_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when taking the geometric mean of two numbers and their product is negative.\\nerror PRBMath_SD59x18_Gm_NegativeProduct(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when taking the geometric mean of two numbers and multiplying them overflows SD59x18.\\nerror PRBMath_SD59x18_Gm_Overflow(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\\nerror PRBMath_SD59x18_IntoSD1x18_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\\nerror PRBMath_SD59x18_IntoSD1x18_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\\nerror PRBMath_SD59x18_IntoUD2x18_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\\nerror PRBMath_SD59x18_IntoUD2x18_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD60x18.\\nerror PRBMath_SD59x18_IntoUD60x18_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\\nerror PRBMath_SD59x18_IntoUint128_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\\nerror PRBMath_SD59x18_IntoUint128_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint256.\\nerror PRBMath_SD59x18_IntoUint256_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\\nerror PRBMath_SD59x18_IntoUint40_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\\nerror PRBMath_SD59x18_IntoUint40_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when taking the logarithm of a number less than or equal to zero.\\nerror PRBMath_SD59x18_Log_InputTooSmall(SD59x18 x);\\n\\n/// @notice Thrown when multiplying two numbers and one of the inputs is `MIN_SD59x18`.\\nerror PRBMath_SD59x18_Mul_InputTooSmall();\\n\\n/// @notice Thrown when multiplying two numbers and the intermediary absolute result overflows SD59x18.\\nerror PRBMath_SD59x18_Mul_Overflow(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when raising a number to a power and the intermediary absolute result overflows SD59x18.\\nerror PRBMath_SD59x18_Powu_Overflow(SD59x18 x, uint256 y);\\n\\n/// @notice Thrown when taking the square root of a negative number.\\nerror PRBMath_SD59x18_Sqrt_NegativeInput(SD59x18 x);\\n\\n/// @notice Thrown when the calculating the square root overflows SD59x18.\\nerror PRBMath_SD59x18_Sqrt_Overflow(SD59x18 x);\\n\",\"keccak256\":\"0xa6d00fe5efa215ac0df25c896e3da99a12fb61e799644b2ec32da947313d3db4\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Helpers.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { wrap } from \\\"./Casting.sol\\\";\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Implements the checked addition operation (+) in the SD59x18 type.\\nfunction add(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n return wrap(x.unwrap() + y.unwrap());\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the SD59x18 type.\\nfunction and(SD59x18 x, int256 bits) pure returns (SD59x18 result) {\\n return wrap(x.unwrap() & bits);\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the SD59x18 type.\\nfunction and2(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n return wrap(x.unwrap() & y.unwrap());\\n}\\n\\n/// @notice Implements the equal (=) operation in the SD59x18 type.\\nfunction eq(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() == y.unwrap();\\n}\\n\\n/// @notice Implements the greater than operation (>) in the SD59x18 type.\\nfunction gt(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() > y.unwrap();\\n}\\n\\n/// @notice Implements the greater than or equal to operation (>=) in the SD59x18 type.\\nfunction gte(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() >= y.unwrap();\\n}\\n\\n/// @notice Implements a zero comparison check function in the SD59x18 type.\\nfunction isZero(SD59x18 x) pure returns (bool result) {\\n result = x.unwrap() == 0;\\n}\\n\\n/// @notice Implements the left shift operation (<<) in the SD59x18 type.\\nfunction lshift(SD59x18 x, uint256 bits) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() << bits);\\n}\\n\\n/// @notice Implements the lower than operation (<) in the SD59x18 type.\\nfunction lt(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() < y.unwrap();\\n}\\n\\n/// @notice Implements the lower than or equal to operation (<=) in the SD59x18 type.\\nfunction lte(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() <= y.unwrap();\\n}\\n\\n/// @notice Implements the unchecked modulo operation (%) in the SD59x18 type.\\nfunction mod(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() % y.unwrap());\\n}\\n\\n/// @notice Implements the not equal operation (!=) in the SD59x18 type.\\nfunction neq(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() != y.unwrap();\\n}\\n\\n/// @notice Implements the NOT (~) bitwise operation in the SD59x18 type.\\nfunction not(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(~x.unwrap());\\n}\\n\\n/// @notice Implements the OR (|) bitwise operation in the SD59x18 type.\\nfunction or(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() | y.unwrap());\\n}\\n\\n/// @notice Implements the right shift operation (>>) in the SD59x18 type.\\nfunction rshift(SD59x18 x, uint256 bits) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() >> bits);\\n}\\n\\n/// @notice Implements the checked subtraction operation (-) in the SD59x18 type.\\nfunction sub(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() - y.unwrap());\\n}\\n\\n/// @notice Implements the checked unary minus operation (-) in the SD59x18 type.\\nfunction unary(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(-x.unwrap());\\n}\\n\\n/// @notice Implements the unchecked addition operation (+) in the SD59x18 type.\\nfunction uncheckedAdd(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() + y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the unchecked subtraction operation (-) in the SD59x18 type.\\nfunction uncheckedSub(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() - y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the unchecked unary minus operation (-) in the SD59x18 type.\\nfunction uncheckedUnary(SD59x18 x) pure returns (SD59x18 result) {\\n unchecked {\\n result = wrap(-x.unwrap());\\n }\\n}\\n\\n/// @notice Implements the XOR (^) bitwise operation in the SD59x18 type.\\nfunction xor(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() ^ y.unwrap());\\n}\\n\",\"keccak256\":\"0x208570f1657cf730cb6c3d81aa14030e0d45cf906cdedea5059369d7df4bb716\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as Errors;\\nimport {\\n uEXP_MAX_INPUT,\\n uEXP2_MAX_INPUT,\\n uEXP_MIN_THRESHOLD,\\n uEXP2_MIN_THRESHOLD,\\n uHALF_UNIT,\\n uLOG2_10,\\n uLOG2_E,\\n uMAX_SD59x18,\\n uMAX_WHOLE_SD59x18,\\n uMIN_SD59x18,\\n uMIN_WHOLE_SD59x18,\\n UNIT,\\n uUNIT,\\n uUNIT_SQUARED,\\n ZERO\\n} from \\\"./Constants.sol\\\";\\nimport { wrap } from \\\"./Helpers.sol\\\";\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Calculates the absolute value of x.\\n///\\n/// @dev Requirements:\\n/// - x must be greater than `MIN_SD59x18`.\\n///\\n/// @param x The SD59x18 number for which to calculate the absolute value.\\n/// @param result The absolute value of x as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction abs(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt == uMIN_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Abs_MinSD59x18();\\n }\\n result = xInt < 0 ? wrap(-xInt) : x;\\n}\\n\\n/// @notice Calculates the arithmetic average of x and y.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// @param x The first operand as an SD59x18 number.\\n/// @param y The second operand as an SD59x18 number.\\n/// @return result The arithmetic average as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction avg(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n\\n unchecked {\\n // This operation is equivalent to `x / 2 + y / 2`, and it can never overflow.\\n int256 sum = (xInt >> 1) + (yInt >> 1);\\n\\n if (sum < 0) {\\n // If at least one of x and y is odd, add 1 to the result, because shifting negative numbers to the right\\n // rounds toward negative infinity. The right part is equivalent to `sum + (x % 2 == 1 || y % 2 == 1)`.\\n assembly (\\\"memory-safe\\\") {\\n result := add(sum, and(or(xInt, yInt), 1))\\n }\\n } else {\\n // Add 1 if both x and y are odd to account for the double 0.5 remainder truncated after shifting.\\n result = wrap(sum + (xInt & yInt & 1));\\n }\\n }\\n}\\n\\n/// @notice Yields the smallest whole number greater than or equal to x.\\n///\\n/// @dev Optimized for fractional value inputs, because every whole value has (1e18 - 1) fractional counterparts.\\n/// See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n///\\n/// Requirements:\\n/// - x must be less than or equal to `MAX_WHOLE_SD59x18`.\\n///\\n/// @param x The SD59x18 number to ceil.\\n/// @param result The smallest whole number greater than or equal to x, as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ceil(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt > uMAX_WHOLE_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Ceil_Overflow(x);\\n }\\n\\n int256 remainder = xInt % uUNIT;\\n if (remainder == 0) {\\n result = x;\\n } else {\\n unchecked {\\n // Solidity uses C fmod style, which returns a modulus with the same sign as x.\\n int256 resultInt = xInt - remainder;\\n if (xInt > 0) {\\n resultInt += uUNIT;\\n }\\n result = wrap(resultInt);\\n }\\n }\\n}\\n\\n/// @notice Divides two SD59x18 numbers, returning a new SD59x18 number.\\n///\\n/// @dev This is an extension of {Common.mulDiv} for signed numbers, which works by computing the signs and the absolute\\n/// values separately.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv}.\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv}.\\n/// - None of the inputs can be `MIN_SD59x18`.\\n/// - The denominator must not be zero.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The numerator as an SD59x18 number.\\n/// @param y The denominator as an SD59x18 number.\\n/// @param result The quotient as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction div(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n if (xInt == uMIN_SD59x18 || yInt == uMIN_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Div_InputTooSmall();\\n }\\n\\n // Get hold of the absolute values of x and y.\\n uint256 xAbs;\\n uint256 yAbs;\\n unchecked {\\n xAbs = xInt < 0 ? uint256(-xInt) : uint256(xInt);\\n yAbs = yInt < 0 ? uint256(-yInt) : uint256(yInt);\\n }\\n\\n // Compute the absolute value (x*UNIT\\u00f7y). The resulting value must fit in SD59x18.\\n uint256 resultAbs = Common.mulDiv(xAbs, uint256(uUNIT), yAbs);\\n if (resultAbs > uint256(uMAX_SD59x18)) {\\n revert Errors.PRBMath_SD59x18_Div_Overflow(x, y);\\n }\\n\\n // Check if x and y have the same sign using two's complement representation. The left-most bit represents the sign (1 for\\n // negative, 0 for positive or zero).\\n bool sameSign = (xInt ^ yInt) > -1;\\n\\n // If the inputs have the same sign, the result should be positive. Otherwise, it should be negative.\\n unchecked {\\n result = wrap(sameSign ? int256(resultAbs) : -int256(resultAbs));\\n }\\n}\\n\\n/// @notice Calculates the natural exponent of x using the following formula:\\n///\\n/// $$\\n/// e^x = 2^{x * log_2{e}}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {exp2}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {exp2}.\\n/// - x must be less than 133_084258667509499441.\\n///\\n/// @param x The exponent as an SD59x18 number.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n\\n // Any input less than the threshold returns zero.\\n // This check also prevents an overflow for very small numbers.\\n if (xInt < uEXP_MIN_THRESHOLD) {\\n return ZERO;\\n }\\n\\n // This check prevents values greater than 192e18 from being passed to {exp2}.\\n if (xInt > uEXP_MAX_INPUT) {\\n revert Errors.PRBMath_SD59x18_Exp_InputTooBig(x);\\n }\\n\\n unchecked {\\n // Inline the fixed-point multiplication to save gas.\\n int256 doubleUnitProduct = xInt * uLOG2_E;\\n result = exp2(wrap(doubleUnitProduct / uUNIT));\\n }\\n}\\n\\n/// @notice Calculates the binary exponent of x using the binary fraction method using the following formula:\\n///\\n/// $$\\n/// 2^{-x} = \\\\frac{1}{2^x}\\n/// $$\\n///\\n/// @dev See https://ethereum.stackexchange.com/q/79903/24693.\\n///\\n/// Notes:\\n/// - If x is less than -59_794705707972522261, the result is zero.\\n///\\n/// Requirements:\\n/// - x must be less than 192e18.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The exponent as an SD59x18 number.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp2(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < 0) {\\n // The inverse of any number less than the threshold is truncated to zero.\\n if (xInt < uEXP2_MIN_THRESHOLD) {\\n return ZERO;\\n }\\n\\n unchecked {\\n // Inline the fixed-point inversion to save gas.\\n result = wrap(uUNIT_SQUARED / exp2(wrap(-xInt)).unwrap());\\n }\\n } else {\\n // Numbers greater than or equal to 192e18 don't fit in the 192.64-bit format.\\n if (xInt > uEXP2_MAX_INPUT) {\\n revert Errors.PRBMath_SD59x18_Exp2_InputTooBig(x);\\n }\\n\\n unchecked {\\n // Convert x to the 192.64-bit fixed-point format.\\n uint256 x_192x64 = uint256((xInt << 64) / uUNIT);\\n\\n // It is safe to cast the result to int256 due to the checks above.\\n result = wrap(int256(Common.exp2(x_192x64)));\\n }\\n }\\n}\\n\\n/// @notice Yields the greatest whole number less than or equal to x.\\n///\\n/// @dev Optimized for fractional value inputs, because for every whole value there are (1e18 - 1) fractional\\n/// counterparts. See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n///\\n/// Requirements:\\n/// - x must be greater than or equal to `MIN_WHOLE_SD59x18`.\\n///\\n/// @param x The SD59x18 number to floor.\\n/// @param result The greatest whole number less than or equal to x, as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction floor(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < uMIN_WHOLE_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Floor_Underflow(x);\\n }\\n\\n int256 remainder = xInt % uUNIT;\\n if (remainder == 0) {\\n result = x;\\n } else {\\n unchecked {\\n // Solidity uses C fmod style, which returns a modulus with the same sign as x.\\n int256 resultInt = xInt - remainder;\\n if (xInt < 0) {\\n resultInt -= uUNIT;\\n }\\n result = wrap(resultInt);\\n }\\n }\\n}\\n\\n/// @notice Yields the excess beyond the floor of x for positive numbers and the part of the number to the right.\\n/// of the radix point for negative numbers.\\n/// @dev Based on the odd function definition. https://en.wikipedia.org/wiki/Fractional_part\\n/// @param x The SD59x18 number to get the fractional part of.\\n/// @param result The fractional part of x as an SD59x18 number.\\nfunction frac(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() % uUNIT);\\n}\\n\\n/// @notice Calculates the geometric mean of x and y, i.e. $\\\\sqrt{x * y}$.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x * y must fit in SD59x18.\\n/// - x * y must not be negative, since complex numbers are not supported.\\n///\\n/// @param x The first operand as an SD59x18 number.\\n/// @param y The second operand as an SD59x18 number.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction gm(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n if (xInt == 0 || yInt == 0) {\\n return ZERO;\\n }\\n\\n unchecked {\\n // Equivalent to `xy / x != y`. Checking for overflow this way is faster than letting Solidity do it.\\n int256 xyInt = xInt * yInt;\\n if (xyInt / xInt != yInt) {\\n revert Errors.PRBMath_SD59x18_Gm_Overflow(x, y);\\n }\\n\\n // The product must not be negative, since complex numbers are not supported.\\n if (xyInt < 0) {\\n revert Errors.PRBMath_SD59x18_Gm_NegativeProduct(x, y);\\n }\\n\\n // We don't need to multiply the result by `UNIT` here because the x*y product picked up a factor of `UNIT`\\n // during multiplication. See the comments in {Common.sqrt}.\\n uint256 resultUint = Common.sqrt(uint256(xyInt));\\n result = wrap(int256(resultUint));\\n }\\n}\\n\\n/// @notice Calculates the inverse of x.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x must not be zero.\\n///\\n/// @param x The SD59x18 number for which to calculate the inverse.\\n/// @return result The inverse as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction inv(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(uUNIT_SQUARED / x.unwrap());\\n}\\n\\n/// @notice Calculates the natural logarithm of x using the following formula:\\n///\\n/// $$\\n/// ln{x} = log_2{x} / log_2{e}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n/// - The precision isn't sufficiently fine-grained to return exactly `UNIT` when the input is `E`.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The SD59x18 number for which to calculate the natural logarithm.\\n/// @return result The natural logarithm as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ln(SD59x18 x) pure returns (SD59x18 result) {\\n // Inline the fixed-point multiplication to save gas. This is overflow-safe because the maximum value that\\n // {log2} can return is ~195_205294292027477728.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_E);\\n}\\n\\n/// @notice Calculates the common logarithm of x using the following formula:\\n///\\n/// $$\\n/// log_{10}{x} = log_2{x} / log_2{10}\\n/// $$\\n///\\n/// However, if x is an exact power of ten, a hard coded value is returned.\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The SD59x18 number for which to calculate the common logarithm.\\n/// @return result The common logarithm as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log10(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < 0) {\\n revert Errors.PRBMath_SD59x18_Log_InputTooSmall(x);\\n }\\n\\n // Note that the `mul` in this block is the standard multiplication operation, not {SD59x18.mul}.\\n // prettier-ignore\\n assembly (\\\"memory-safe\\\") {\\n switch x\\n case 1 { result := mul(uUNIT, sub(0, 18)) }\\n case 10 { result := mul(uUNIT, sub(1, 18)) }\\n case 100 { result := mul(uUNIT, sub(2, 18)) }\\n case 1000 { result := mul(uUNIT, sub(3, 18)) }\\n case 10000 { result := mul(uUNIT, sub(4, 18)) }\\n case 100000 { result := mul(uUNIT, sub(5, 18)) }\\n case 1000000 { result := mul(uUNIT, sub(6, 18)) }\\n case 10000000 { result := mul(uUNIT, sub(7, 18)) }\\n case 100000000 { result := mul(uUNIT, sub(8, 18)) }\\n case 1000000000 { result := mul(uUNIT, sub(9, 18)) }\\n case 10000000000 { result := mul(uUNIT, sub(10, 18)) }\\n case 100000000000 { result := mul(uUNIT, sub(11, 18)) }\\n case 1000000000000 { result := mul(uUNIT, sub(12, 18)) }\\n case 10000000000000 { result := mul(uUNIT, sub(13, 18)) }\\n case 100000000000000 { result := mul(uUNIT, sub(14, 18)) }\\n case 1000000000000000 { result := mul(uUNIT, sub(15, 18)) }\\n case 10000000000000000 { result := mul(uUNIT, sub(16, 18)) }\\n case 100000000000000000 { result := mul(uUNIT, sub(17, 18)) }\\n case 1000000000000000000 { result := 0 }\\n case 10000000000000000000 { result := uUNIT }\\n case 100000000000000000000 { result := mul(uUNIT, 2) }\\n case 1000000000000000000000 { result := mul(uUNIT, 3) }\\n case 10000000000000000000000 { result := mul(uUNIT, 4) }\\n case 100000000000000000000000 { result := mul(uUNIT, 5) }\\n case 1000000000000000000000000 { result := mul(uUNIT, 6) }\\n case 10000000000000000000000000 { result := mul(uUNIT, 7) }\\n case 100000000000000000000000000 { result := mul(uUNIT, 8) }\\n case 1000000000000000000000000000 { result := mul(uUNIT, 9) }\\n case 10000000000000000000000000000 { result := mul(uUNIT, 10) }\\n case 100000000000000000000000000000 { result := mul(uUNIT, 11) }\\n case 1000000000000000000000000000000 { result := mul(uUNIT, 12) }\\n case 10000000000000000000000000000000 { result := mul(uUNIT, 13) }\\n case 100000000000000000000000000000000 { result := mul(uUNIT, 14) }\\n case 1000000000000000000000000000000000 { result := mul(uUNIT, 15) }\\n case 10000000000000000000000000000000000 { result := mul(uUNIT, 16) }\\n case 100000000000000000000000000000000000 { result := mul(uUNIT, 17) }\\n case 1000000000000000000000000000000000000 { result := mul(uUNIT, 18) }\\n case 10000000000000000000000000000000000000 { result := mul(uUNIT, 19) }\\n case 100000000000000000000000000000000000000 { result := mul(uUNIT, 20) }\\n case 1000000000000000000000000000000000000000 { result := mul(uUNIT, 21) }\\n case 10000000000000000000000000000000000000000 { result := mul(uUNIT, 22) }\\n case 100000000000000000000000000000000000000000 { result := mul(uUNIT, 23) }\\n case 1000000000000000000000000000000000000000000 { result := mul(uUNIT, 24) }\\n case 10000000000000000000000000000000000000000000 { result := mul(uUNIT, 25) }\\n case 100000000000000000000000000000000000000000000 { result := mul(uUNIT, 26) }\\n case 1000000000000000000000000000000000000000000000 { result := mul(uUNIT, 27) }\\n case 10000000000000000000000000000000000000000000000 { result := mul(uUNIT, 28) }\\n case 100000000000000000000000000000000000000000000000 { result := mul(uUNIT, 29) }\\n case 1000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 30) }\\n case 10000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 31) }\\n case 100000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 32) }\\n case 1000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 33) }\\n case 10000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 34) }\\n case 100000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 35) }\\n case 1000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 36) }\\n case 10000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 37) }\\n case 100000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 38) }\\n case 1000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 39) }\\n case 10000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 40) }\\n case 100000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 41) }\\n case 1000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 42) }\\n case 10000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 43) }\\n case 100000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 44) }\\n case 1000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 45) }\\n case 10000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 46) }\\n case 100000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 47) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 48) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 49) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 50) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 51) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 52) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 53) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 54) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 55) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 56) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 57) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 58) }\\n default { result := uMAX_SD59x18 }\\n }\\n\\n if (result.unwrap() == uMAX_SD59x18) {\\n unchecked {\\n // Inline the fixed-point division to save gas.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_10);\\n }\\n }\\n}\\n\\n/// @notice Calculates the binary logarithm of x using the iterative approximation algorithm:\\n///\\n/// $$\\n/// log_2{x} = n + log_2{y}, \\\\text{ where } y = x*2^{-n}, \\\\ y \\\\in [1, 2)\\n/// $$\\n///\\n/// For $0 \\\\leq x \\\\lt 1$, the input is inverted:\\n///\\n/// $$\\n/// log_2{x} = -log_2{\\\\frac{1}{x}}\\n/// $$\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Binary_logarithm#Iterative_approximation.\\n///\\n/// Notes:\\n/// - Due to the lossy precision of the iterative approximation, the results are not perfectly accurate to the last decimal.\\n///\\n/// Requirements:\\n/// - x must be greater than zero.\\n///\\n/// @param x The SD59x18 number for which to calculate the binary logarithm.\\n/// @return result The binary logarithm as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log2(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt <= 0) {\\n revert Errors.PRBMath_SD59x18_Log_InputTooSmall(x);\\n }\\n\\n unchecked {\\n int256 sign;\\n if (xInt >= uUNIT) {\\n sign = 1;\\n } else {\\n sign = -1;\\n // Inline the fixed-point inversion to save gas.\\n xInt = uUNIT_SQUARED / xInt;\\n }\\n\\n // Calculate the integer part of the logarithm.\\n uint256 n = Common.msb(uint256(xInt / uUNIT));\\n\\n // This is the integer part of the logarithm as an SD59x18 number. The operation can't overflow\\n // because n is at most 255, `UNIT` is 1e18, and the sign is either 1 or -1.\\n int256 resultInt = int256(n) * uUNIT;\\n\\n // Calculate $y = x * 2^{-n}$.\\n int256 y = xInt >> n;\\n\\n // If y is the unit number, the fractional part is zero.\\n if (y == uUNIT) {\\n return wrap(resultInt * sign);\\n }\\n\\n // Calculate the fractional part via the iterative approximation.\\n // The `delta >>= 1` part is equivalent to `delta /= 2`, but shifting bits is more gas efficient.\\n int256 DOUBLE_UNIT = 2e18;\\n for (int256 delta = uHALF_UNIT; delta > 0; delta >>= 1) {\\n y = (y * y) / uUNIT;\\n\\n // Is y^2 >= 2e18 and so in the range [2e18, 4e18)?\\n if (y >= DOUBLE_UNIT) {\\n // Add the 2^{-m} factor to the logarithm.\\n resultInt = resultInt + delta;\\n\\n // Halve y, which corresponds to z/2 in the Wikipedia article.\\n y >>= 1;\\n }\\n }\\n resultInt *= sign;\\n result = wrap(resultInt);\\n }\\n}\\n\\n/// @notice Multiplies two SD59x18 numbers together, returning a new SD59x18 number.\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {Common.mulDiv18}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv18}.\\n/// - None of the inputs can be `MIN_SD59x18`.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The multiplicand as an SD59x18 number.\\n/// @param y The multiplier as an SD59x18 number.\\n/// @return result The product as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mul(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n if (xInt == uMIN_SD59x18 || yInt == uMIN_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Mul_InputTooSmall();\\n }\\n\\n // Get hold of the absolute values of x and y.\\n uint256 xAbs;\\n uint256 yAbs;\\n unchecked {\\n xAbs = xInt < 0 ? uint256(-xInt) : uint256(xInt);\\n yAbs = yInt < 0 ? uint256(-yInt) : uint256(yInt);\\n }\\n\\n // Compute the absolute value (x*y\\u00f7UNIT). The resulting value must fit in SD59x18.\\n uint256 resultAbs = Common.mulDiv18(xAbs, yAbs);\\n if (resultAbs > uint256(uMAX_SD59x18)) {\\n revert Errors.PRBMath_SD59x18_Mul_Overflow(x, y);\\n }\\n\\n // Check if x and y have the same sign using two's complement representation. The left-most bit represents the sign (1 for\\n // negative, 0 for positive or zero).\\n bool sameSign = (xInt ^ yInt) > -1;\\n\\n // If the inputs have the same sign, the result should be positive. Otherwise, it should be negative.\\n unchecked {\\n result = wrap(sameSign ? int256(resultAbs) : -int256(resultAbs));\\n }\\n}\\n\\n/// @notice Raises x to the power of y using the following formula:\\n///\\n/// $$\\n/// x^y = 2^{log_2{x} * y}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {exp2}, {log2}, and {mul}.\\n/// - Returns `UNIT` for 0^0.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {exp2}, {log2}, and {mul}.\\n///\\n/// @param x The base as an SD59x18 number.\\n/// @param y Exponent to raise x to, as an SD59x18 number\\n/// @return result x raised to power y, as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction pow(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n\\n // If both x and y are zero, the result is `UNIT`. If just x is zero, the result is always zero.\\n if (xInt == 0) {\\n return yInt == 0 ? UNIT : ZERO;\\n }\\n // If x is `UNIT`, the result is always `UNIT`.\\n else if (xInt == uUNIT) {\\n return UNIT;\\n }\\n\\n // If y is zero, the result is always `UNIT`.\\n if (yInt == 0) {\\n return UNIT;\\n }\\n // If y is `UNIT`, the result is always x.\\n else if (yInt == uUNIT) {\\n return x;\\n }\\n\\n // Calculate the result using the formula.\\n result = exp2(mul(log2(x), y));\\n}\\n\\n/// @notice Raises x (an SD59x18 number) to the power y (an unsigned basic integer) using the well-known\\n/// algorithm \\\"exponentiation by squaring\\\".\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Exponentiation_by_squaring.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv18}.\\n/// - Returns `UNIT` for 0^0.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {abs} and {Common.mulDiv18}.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The base as an SD59x18 number.\\n/// @param y The exponent as a uint256.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction powu(SD59x18 x, uint256 y) pure returns (SD59x18 result) {\\n uint256 xAbs = uint256(abs(x).unwrap());\\n\\n // Calculate the first iteration of the loop in advance.\\n uint256 resultAbs = y & 1 > 0 ? xAbs : uint256(uUNIT);\\n\\n // Equivalent to `for(y /= 2; y > 0; y /= 2)`.\\n uint256 yAux = y;\\n for (yAux >>= 1; yAux > 0; yAux >>= 1) {\\n xAbs = Common.mulDiv18(xAbs, xAbs);\\n\\n // Equivalent to `y % 2 == 1`.\\n if (yAux & 1 > 0) {\\n resultAbs = Common.mulDiv18(resultAbs, xAbs);\\n }\\n }\\n\\n // The result must fit in SD59x18.\\n if (resultAbs > uint256(uMAX_SD59x18)) {\\n revert Errors.PRBMath_SD59x18_Powu_Overflow(x, y);\\n }\\n\\n unchecked {\\n // Is the base negative and the exponent odd? If yes, the result should be negative.\\n int256 resultInt = int256(resultAbs);\\n bool isNegative = x.unwrap() < 0 && y & 1 == 1;\\n if (isNegative) {\\n resultInt = -resultInt;\\n }\\n result = wrap(resultInt);\\n }\\n}\\n\\n/// @notice Calculates the square root of x using the Babylonian method.\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\\n///\\n/// Notes:\\n/// - Only the positive root is returned.\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x cannot be negative, since complex numbers are not supported.\\n/// - x must be less than `MAX_SD59x18 / UNIT`.\\n///\\n/// @param x The SD59x18 number for which to calculate the square root.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction sqrt(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < 0) {\\n revert Errors.PRBMath_SD59x18_Sqrt_NegativeInput(x);\\n }\\n if (xInt > uMAX_SD59x18 / uUNIT) {\\n revert Errors.PRBMath_SD59x18_Sqrt_Overflow(x);\\n }\\n\\n unchecked {\\n // Multiply x by `UNIT` to account for the factor of `UNIT` picked up when multiplying two SD59x18 numbers.\\n // In this case, the two numbers are both the square root.\\n uint256 resultUint = Common.sqrt(uint256(xInt * uUNIT));\\n result = wrap(int256(resultUint));\\n }\\n}\\n\",\"keccak256\":\"0xa074831139fc89ca0e5a36086b30eb50896bb6770cd5823461b1f2769017d2f0\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\nimport \\\"./Helpers.sol\\\" as Helpers;\\nimport \\\"./Math.sol\\\" as Math;\\n\\n/// @notice The signed 59.18-decimal fixed-point number representation, which can have up to 59 digits and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\\n/// type int256.\\ntype SD59x18 is int256;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoInt256,\\n Casting.intoSD1x18,\\n Casting.intoUD2x18,\\n Casting.intoUD60x18,\\n Casting.intoUint256,\\n Casting.intoUint128,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for SD59x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n MATHEMATICAL FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Math.abs,\\n Math.avg,\\n Math.ceil,\\n Math.div,\\n Math.exp,\\n Math.exp2,\\n Math.floor,\\n Math.frac,\\n Math.gm,\\n Math.inv,\\n Math.log10,\\n Math.log2,\\n Math.ln,\\n Math.mul,\\n Math.pow,\\n Math.powu,\\n Math.sqrt\\n} for SD59x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n HELPER FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Helpers.add,\\n Helpers.and,\\n Helpers.eq,\\n Helpers.gt,\\n Helpers.gte,\\n Helpers.isZero,\\n Helpers.lshift,\\n Helpers.lt,\\n Helpers.lte,\\n Helpers.mod,\\n Helpers.neq,\\n Helpers.not,\\n Helpers.or,\\n Helpers.rshift,\\n Helpers.sub,\\n Helpers.uncheckedAdd,\\n Helpers.uncheckedSub,\\n Helpers.uncheckedUnary,\\n Helpers.xor\\n} for SD59x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n OPERATORS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes it possible to use these operators on the SD59x18 type.\\nusing {\\n Helpers.add as +,\\n Helpers.and2 as &,\\n Math.div as /,\\n Helpers.eq as ==,\\n Helpers.gt as >,\\n Helpers.gte as >=,\\n Helpers.lt as <,\\n Helpers.lte as <=,\\n Helpers.mod as %,\\n Math.mul as *,\\n Helpers.neq as !=,\\n Helpers.not as ~,\\n Helpers.or as |,\\n Helpers.sub as -,\\n Helpers.unary as -,\\n Helpers.xor as ^\\n} for SD59x18 global;\\n\",\"keccak256\":\"0xe03112d145dcd5863aff24e5f381debaae29d446acd5666f3d640e3d9af738d7\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as Errors;\\nimport { uMAX_SD1x18 } from \\\"../sd1x18/Constants.sol\\\";\\nimport { SD1x18 } from \\\"../sd1x18/ValueType.sol\\\";\\nimport { SD59x18 } from \\\"../sd59x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"../ud60x18/ValueType.sol\\\";\\nimport { UD2x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts a UD2x18 number into SD1x18.\\n/// - x must be less than or equal to `uMAX_SD1x18`.\\nfunction intoSD1x18(UD2x18 x) pure returns (SD1x18 result) {\\n uint64 xUint = UD2x18.unwrap(x);\\n if (xUint > uint64(uMAX_SD1x18)) {\\n revert Errors.PRBMath_UD2x18_IntoSD1x18_Overflow(x);\\n }\\n result = SD1x18.wrap(int64(xUint));\\n}\\n\\n/// @notice Casts a UD2x18 number into SD59x18.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of SD59x18.\\nfunction intoSD59x18(UD2x18 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(int256(uint256(UD2x18.unwrap(x))));\\n}\\n\\n/// @notice Casts a UD2x18 number into UD60x18.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of UD60x18.\\nfunction intoUD60x18(UD2x18 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(UD2x18.unwrap(x));\\n}\\n\\n/// @notice Casts a UD2x18 number into uint128.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of uint128.\\nfunction intoUint128(UD2x18 x) pure returns (uint128 result) {\\n result = uint128(UD2x18.unwrap(x));\\n}\\n\\n/// @notice Casts a UD2x18 number into uint256.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of uint256.\\nfunction intoUint256(UD2x18 x) pure returns (uint256 result) {\\n result = uint256(UD2x18.unwrap(x));\\n}\\n\\n/// @notice Casts a UD2x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(UD2x18 x) pure returns (uint40 result) {\\n uint64 xUint = UD2x18.unwrap(x);\\n if (xUint > uint64(Common.MAX_UINT40)) {\\n revert Errors.PRBMath_UD2x18_IntoUint40_Overflow(x);\\n }\\n result = uint40(xUint);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction ud2x18(uint64 x) pure returns (UD2x18 result) {\\n result = UD2x18.wrap(x);\\n}\\n\\n/// @notice Unwrap a UD2x18 number into uint64.\\nfunction unwrap(UD2x18 x) pure returns (uint64 result) {\\n result = UD2x18.unwrap(x);\\n}\\n\\n/// @notice Wraps a uint64 number into UD2x18.\\nfunction wrap(uint64 x) pure returns (UD2x18 result) {\\n result = UD2x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x9b1a35d432ef951a415fae8098b3c609a99b630a3d5464b3c8e1efa8893eea07\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD2x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @dev Euler's number as a UD2x18 number.\\nUD2x18 constant E = UD2x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum value a UD2x18 number can have.\\nuint64 constant uMAX_UD2x18 = 18_446744073709551615;\\nUD2x18 constant MAX_UD2x18 = UD2x18.wrap(uMAX_UD2x18);\\n\\n/// @dev PI as a UD2x18 number.\\nUD2x18 constant PI = UD2x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of UD2x18.\\nUD2x18 constant UNIT = UD2x18.wrap(1e18);\\nuint64 constant uUNIT = 1e18;\\n\",\"keccak256\":\"0x29b0e050c865899e1fb9022b460a7829cdee248c44c4299f068ba80695eec3fc\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD2x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when trying to cast a UD2x18 number that doesn't fit in SD1x18.\\nerror PRBMath_UD2x18_IntoSD1x18_Overflow(UD2x18 x);\\n\\n/// @notice Thrown when trying to cast a UD2x18 number that doesn't fit in uint40.\\nerror PRBMath_UD2x18_IntoUint40_Overflow(UD2x18 x);\\n\",\"keccak256\":\"0xdf1e22f0b4c8032bcc8b7f63fe3984e1387f3dc7b2e9ab381822249f75376d33\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\n\\n/// @notice The unsigned 2.18-decimal fixed-point number representation, which can have up to 2 digits and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\\n/// type uint64. This is useful when end users want to use uint64 to save gas, e.g. with tight variable packing in contract\\n/// storage.\\ntype UD2x18 is uint64;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoSD1x18,\\n Casting.intoSD59x18,\\n Casting.intoUD60x18,\\n Casting.intoUint256,\\n Casting.intoUint128,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for UD2x18 global;\\n\",\"keccak256\":\"0x2802edc9869db116a0b5c490cc5f8554742f747183fa30ac5e9c80bb967e61a1\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Errors.sol\\\" as CastingErrors;\\nimport { MAX_UINT128, MAX_UINT40 } from \\\"../Common.sol\\\";\\nimport { uMAX_SD1x18 } from \\\"../sd1x18/Constants.sol\\\";\\nimport { SD1x18 } from \\\"../sd1x18/ValueType.sol\\\";\\nimport { uMAX_SD59x18 } from \\\"../sd59x18/Constants.sol\\\";\\nimport { SD59x18 } from \\\"../sd59x18/ValueType.sol\\\";\\nimport { uMAX_UD2x18 } from \\\"../ud2x18/Constants.sol\\\";\\nimport { UD2x18 } from \\\"../ud2x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts a UD60x18 number into SD1x18.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `uMAX_SD1x18`.\\nfunction intoSD1x18(UD60x18 x) pure returns (SD1x18 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > uint256(int256(uMAX_SD1x18))) {\\n revert CastingErrors.PRBMath_UD60x18_IntoSD1x18_Overflow(x);\\n }\\n result = SD1x18.wrap(int64(uint64(xUint)));\\n}\\n\\n/// @notice Casts a UD60x18 number into UD2x18.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `uMAX_UD2x18`.\\nfunction intoUD2x18(UD60x18 x) pure returns (UD2x18 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > uMAX_UD2x18) {\\n revert CastingErrors.PRBMath_UD60x18_IntoUD2x18_Overflow(x);\\n }\\n result = UD2x18.wrap(uint64(xUint));\\n}\\n\\n/// @notice Casts a UD60x18 number into SD59x18.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `uMAX_SD59x18`.\\nfunction intoSD59x18(UD60x18 x) pure returns (SD59x18 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > uint256(uMAX_SD59x18)) {\\n revert CastingErrors.PRBMath_UD60x18_IntoSD59x18_Overflow(x);\\n }\\n result = SD59x18.wrap(int256(xUint));\\n}\\n\\n/// @notice Casts a UD60x18 number into uint128.\\n/// @dev This is basically an alias for {unwrap}.\\nfunction intoUint256(UD60x18 x) pure returns (uint256 result) {\\n result = UD60x18.unwrap(x);\\n}\\n\\n/// @notice Casts a UD60x18 number into uint128.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UINT128`.\\nfunction intoUint128(UD60x18 x) pure returns (uint128 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > MAX_UINT128) {\\n revert CastingErrors.PRBMath_UD60x18_IntoUint128_Overflow(x);\\n }\\n result = uint128(xUint);\\n}\\n\\n/// @notice Casts a UD60x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(UD60x18 x) pure returns (uint40 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > MAX_UINT40) {\\n revert CastingErrors.PRBMath_UD60x18_IntoUint40_Overflow(x);\\n }\\n result = uint40(xUint);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction ud(uint256 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(x);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction ud60x18(uint256 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(x);\\n}\\n\\n/// @notice Unwraps a UD60x18 number into uint256.\\nfunction unwrap(UD60x18 x) pure returns (uint256 result) {\\n result = UD60x18.unwrap(x);\\n}\\n\\n/// @notice Wraps a uint256 number into the UD60x18 value type.\\nfunction wrap(uint256 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x5bb532da36921cbdac64d1f16de5d366ef1f664502e3b7c07d0ad06917551f85\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n// NOTICE: the \\\"u\\\" prefix stands for \\\"unwrapped\\\".\\n\\n/// @dev Euler's number as a UD60x18 number.\\nUD60x18 constant E = UD60x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum input permitted in {exp}.\\nuint256 constant uEXP_MAX_INPUT = 133_084258667509499440;\\nUD60x18 constant EXP_MAX_INPUT = UD60x18.wrap(uEXP_MAX_INPUT);\\n\\n/// @dev The maximum input permitted in {exp2}.\\nuint256 constant uEXP2_MAX_INPUT = 192e18 - 1;\\nUD60x18 constant EXP2_MAX_INPUT = UD60x18.wrap(uEXP2_MAX_INPUT);\\n\\n/// @dev Half the UNIT number.\\nuint256 constant uHALF_UNIT = 0.5e18;\\nUD60x18 constant HALF_UNIT = UD60x18.wrap(uHALF_UNIT);\\n\\n/// @dev $log_2(10)$ as a UD60x18 number.\\nuint256 constant uLOG2_10 = 3_321928094887362347;\\nUD60x18 constant LOG2_10 = UD60x18.wrap(uLOG2_10);\\n\\n/// @dev $log_2(e)$ as a UD60x18 number.\\nuint256 constant uLOG2_E = 1_442695040888963407;\\nUD60x18 constant LOG2_E = UD60x18.wrap(uLOG2_E);\\n\\n/// @dev The maximum value a UD60x18 number can have.\\nuint256 constant uMAX_UD60x18 = 115792089237316195423570985008687907853269984665640564039457_584007913129639935;\\nUD60x18 constant MAX_UD60x18 = UD60x18.wrap(uMAX_UD60x18);\\n\\n/// @dev The maximum whole value a UD60x18 number can have.\\nuint256 constant uMAX_WHOLE_UD60x18 = 115792089237316195423570985008687907853269984665640564039457_000000000000000000;\\nUD60x18 constant MAX_WHOLE_UD60x18 = UD60x18.wrap(uMAX_WHOLE_UD60x18);\\n\\n/// @dev PI as a UD60x18 number.\\nUD60x18 constant PI = UD60x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of UD60x18.\\nuint256 constant uUNIT = 1e18;\\nUD60x18 constant UNIT = UD60x18.wrap(uUNIT);\\n\\n/// @dev The unit number squared.\\nuint256 constant uUNIT_SQUARED = 1e36;\\nUD60x18 constant UNIT_SQUARED = UD60x18.wrap(uUNIT_SQUARED);\\n\\n/// @dev Zero as a UD60x18 number.\\nUD60x18 constant ZERO = UD60x18.wrap(0);\\n\",\"keccak256\":\"0x2b80d26153d3fdcfb3a9ca772d9309d31ed1275f5b8b54c3ffb54d3652b37d90\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Conversions.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { uMAX_UD60x18, uUNIT } from \\\"./Constants.sol\\\";\\nimport { PRBMath_UD60x18_Convert_Overflow } from \\\"./Errors.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Converts a UD60x18 number to a simple integer by dividing it by `UNIT`.\\n/// @dev The result is rounded toward zero.\\n/// @param x The UD60x18 number to convert.\\n/// @return result The same number in basic integer form.\\nfunction convert(UD60x18 x) pure returns (uint256 result) {\\n result = UD60x18.unwrap(x) / uUNIT;\\n}\\n\\n/// @notice Converts a simple integer to UD60x18 by multiplying it by `UNIT`.\\n///\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UD60x18 / UNIT`.\\n///\\n/// @param x The basic integer to convert.\\n/// @param result The same number converted to UD60x18.\\nfunction convert(uint256 x) pure returns (UD60x18 result) {\\n if (x > uMAX_UD60x18 / uUNIT) {\\n revert PRBMath_UD60x18_Convert_Overflow(x);\\n }\\n unchecked {\\n result = UD60x18.wrap(x * uUNIT);\\n }\\n}\\n\",\"keccak256\":\"0xaf7fc2523413822de3b66ba339fe2884fb3b8c6f6cf38ec90a2c3e3aae71df6b\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when ceiling a number overflows UD60x18.\\nerror PRBMath_UD60x18_Ceil_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when converting a basic integer to the fixed-point format overflows UD60x18.\\nerror PRBMath_UD60x18_Convert_Overflow(uint256 x);\\n\\n/// @notice Thrown when taking the natural exponent of a base greater than 133_084258667509499441.\\nerror PRBMath_UD60x18_Exp_InputTooBig(UD60x18 x);\\n\\n/// @notice Thrown when taking the binary exponent of a base greater than 192e18.\\nerror PRBMath_UD60x18_Exp2_InputTooBig(UD60x18 x);\\n\\n/// @notice Thrown when taking the geometric mean of two numbers and multiplying them overflows UD60x18.\\nerror PRBMath_UD60x18_Gm_Overflow(UD60x18 x, UD60x18 y);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\\nerror PRBMath_UD60x18_IntoSD1x18_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD59x18.\\nerror PRBMath_UD60x18_IntoSD59x18_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\\nerror PRBMath_UD60x18_IntoUD2x18_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\\nerror PRBMath_UD60x18_IntoUint128_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\\nerror PRBMath_UD60x18_IntoUint40_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when taking the logarithm of a number less than 1.\\nerror PRBMath_UD60x18_Log_InputTooSmall(UD60x18 x);\\n\\n/// @notice Thrown when calculating the square root overflows UD60x18.\\nerror PRBMath_UD60x18_Sqrt_Overflow(UD60x18 x);\\n\",\"keccak256\":\"0xa8c60d4066248df22c49c882873efbc017344107edabc48c52209abbc39cb1e3\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Helpers.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { wrap } from \\\"./Casting.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Implements the checked addition operation (+) in the UD60x18 type.\\nfunction add(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() + y.unwrap());\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the UD60x18 type.\\nfunction and(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() & bits);\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the UD60x18 type.\\nfunction and2(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() & y.unwrap());\\n}\\n\\n/// @notice Implements the equal operation (==) in the UD60x18 type.\\nfunction eq(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() == y.unwrap();\\n}\\n\\n/// @notice Implements the greater than operation (>) in the UD60x18 type.\\nfunction gt(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() > y.unwrap();\\n}\\n\\n/// @notice Implements the greater than or equal to operation (>=) in the UD60x18 type.\\nfunction gte(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() >= y.unwrap();\\n}\\n\\n/// @notice Implements a zero comparison check function in the UD60x18 type.\\nfunction isZero(UD60x18 x) pure returns (bool result) {\\n // This wouldn't work if x could be negative.\\n result = x.unwrap() == 0;\\n}\\n\\n/// @notice Implements the left shift operation (<<) in the UD60x18 type.\\nfunction lshift(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() << bits);\\n}\\n\\n/// @notice Implements the lower than operation (<) in the UD60x18 type.\\nfunction lt(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() < y.unwrap();\\n}\\n\\n/// @notice Implements the lower than or equal to operation (<=) in the UD60x18 type.\\nfunction lte(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() <= y.unwrap();\\n}\\n\\n/// @notice Implements the checked modulo operation (%) in the UD60x18 type.\\nfunction mod(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() % y.unwrap());\\n}\\n\\n/// @notice Implements the not equal operation (!=) in the UD60x18 type.\\nfunction neq(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() != y.unwrap();\\n}\\n\\n/// @notice Implements the NOT (~) bitwise operation in the UD60x18 type.\\nfunction not(UD60x18 x) pure returns (UD60x18 result) {\\n result = wrap(~x.unwrap());\\n}\\n\\n/// @notice Implements the OR (|) bitwise operation in the UD60x18 type.\\nfunction or(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() | y.unwrap());\\n}\\n\\n/// @notice Implements the right shift operation (>>) in the UD60x18 type.\\nfunction rshift(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() >> bits);\\n}\\n\\n/// @notice Implements the checked subtraction operation (-) in the UD60x18 type.\\nfunction sub(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() - y.unwrap());\\n}\\n\\n/// @notice Implements the unchecked addition operation (+) in the UD60x18 type.\\nfunction uncheckedAdd(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() + y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the unchecked subtraction operation (-) in the UD60x18 type.\\nfunction uncheckedSub(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() - y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the XOR (^) bitwise operation in the UD60x18 type.\\nfunction xor(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() ^ y.unwrap());\\n}\\n\",\"keccak256\":\"0xf5faff881391d2c060029499a666cc5f0bea90a213150bb476fae8f02a5df268\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as Errors;\\nimport { wrap } from \\\"./Casting.sol\\\";\\nimport {\\n uEXP_MAX_INPUT,\\n uEXP2_MAX_INPUT,\\n uHALF_UNIT,\\n uLOG2_10,\\n uLOG2_E,\\n uMAX_UD60x18,\\n uMAX_WHOLE_UD60x18,\\n UNIT,\\n uUNIT,\\n uUNIT_SQUARED,\\n ZERO\\n} from \\\"./Constants.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n MATHEMATICAL FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @notice Calculates the arithmetic average of x and y using the following formula:\\n///\\n/// $$\\n/// avg(x, y) = (x & y) + ((xUint ^ yUint) / 2)\\n/// $$\\n///\\n/// In English, this is what this formula does:\\n///\\n/// 1. AND x and y.\\n/// 2. Calculate half of XOR x and y.\\n/// 3. Add the two results together.\\n///\\n/// This technique is known as SWAR, which stands for \\\"SIMD within a register\\\". You can read more about it here:\\n/// https://devblogs.microsoft.com/oldnewthing/20220207-00/?p=106223\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// @param x The first operand as a UD60x18 number.\\n/// @param y The second operand as a UD60x18 number.\\n/// @return result The arithmetic average as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction avg(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n uint256 yUint = y.unwrap();\\n unchecked {\\n result = wrap((xUint & yUint) + ((xUint ^ yUint) >> 1));\\n }\\n}\\n\\n/// @notice Yields the smallest whole number greater than or equal to x.\\n///\\n/// @dev This is optimized for fractional value inputs, because for every whole value there are (1e18 - 1) fractional\\n/// counterparts. See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n///\\n/// Requirements:\\n/// - x must be less than or equal to `MAX_WHOLE_UD60x18`.\\n///\\n/// @param x The UD60x18 number to ceil.\\n/// @param result The smallest whole number greater than or equal to x, as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ceil(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n if (xUint > uMAX_WHOLE_UD60x18) {\\n revert Errors.PRBMath_UD60x18_Ceil_Overflow(x);\\n }\\n\\n assembly (\\\"memory-safe\\\") {\\n // Equivalent to `x % UNIT`.\\n let remainder := mod(x, uUNIT)\\n\\n // Equivalent to `UNIT - remainder`.\\n let delta := sub(uUNIT, remainder)\\n\\n // Equivalent to `x + remainder > 0 ? delta : 0`.\\n result := add(x, mul(delta, gt(remainder, 0)))\\n }\\n}\\n\\n/// @notice Divides two UD60x18 numbers, returning a new UD60x18 number.\\n///\\n/// @dev Uses {Common.mulDiv} to enable overflow-safe multiplication and division.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv}.\\n///\\n/// @param x The numerator as a UD60x18 number.\\n/// @param y The denominator as a UD60x18 number.\\n/// @param result The quotient as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction div(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(Common.mulDiv(x.unwrap(), uUNIT, y.unwrap()));\\n}\\n\\n/// @notice Calculates the natural exponent of x using the following formula:\\n///\\n/// $$\\n/// e^x = 2^{x * log_2{e}}\\n/// $$\\n///\\n/// @dev Requirements:\\n/// - x must be less than 133_084258667509499441.\\n///\\n/// @param x The exponent as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n // This check prevents values greater than 192e18 from being passed to {exp2}.\\n if (xUint > uEXP_MAX_INPUT) {\\n revert Errors.PRBMath_UD60x18_Exp_InputTooBig(x);\\n }\\n\\n unchecked {\\n // Inline the fixed-point multiplication to save gas.\\n uint256 doubleUnitProduct = xUint * uLOG2_E;\\n result = exp2(wrap(doubleUnitProduct / uUNIT));\\n }\\n}\\n\\n/// @notice Calculates the binary exponent of x using the binary fraction method.\\n///\\n/// @dev See https://ethereum.stackexchange.com/q/79903/24693\\n///\\n/// Requirements:\\n/// - x must be less than 192e18.\\n/// - The result must fit in UD60x18.\\n///\\n/// @param x The exponent as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp2(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n // Numbers greater than or equal to 192e18 don't fit in the 192.64-bit format.\\n if (xUint > uEXP2_MAX_INPUT) {\\n revert Errors.PRBMath_UD60x18_Exp2_InputTooBig(x);\\n }\\n\\n // Convert x to the 192.64-bit fixed-point format.\\n uint256 x_192x64 = (xUint << 64) / uUNIT;\\n\\n // Pass x to the {Common.exp2} function, which uses the 192.64-bit fixed-point number representation.\\n result = wrap(Common.exp2(x_192x64));\\n}\\n\\n/// @notice Yields the greatest whole number less than or equal to x.\\n/// @dev Optimized for fractional value inputs, because every whole value has (1e18 - 1) fractional counterparts.\\n/// See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n/// @param x The UD60x18 number to floor.\\n/// @param result The greatest whole number less than or equal to x, as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction floor(UD60x18 x) pure returns (UD60x18 result) {\\n assembly (\\\"memory-safe\\\") {\\n // Equivalent to `x % UNIT`.\\n let remainder := mod(x, uUNIT)\\n\\n // Equivalent to `x - remainder > 0 ? remainder : 0)`.\\n result := sub(x, mul(remainder, gt(remainder, 0)))\\n }\\n}\\n\\n/// @notice Yields the excess beyond the floor of x using the odd function definition.\\n/// @dev See https://en.wikipedia.org/wiki/Fractional_part.\\n/// @param x The UD60x18 number to get the fractional part of.\\n/// @param result The fractional part of x as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction frac(UD60x18 x) pure returns (UD60x18 result) {\\n assembly (\\\"memory-safe\\\") {\\n result := mod(x, uUNIT)\\n }\\n}\\n\\n/// @notice Calculates the geometric mean of x and y, i.e. $\\\\sqrt{x * y}$, rounding down.\\n///\\n/// @dev Requirements:\\n/// - x * y must fit in UD60x18.\\n///\\n/// @param x The first operand as a UD60x18 number.\\n/// @param y The second operand as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction gm(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n uint256 yUint = y.unwrap();\\n if (xUint == 0 || yUint == 0) {\\n return ZERO;\\n }\\n\\n unchecked {\\n // Checking for overflow this way is faster than letting Solidity do it.\\n uint256 xyUint = xUint * yUint;\\n if (xyUint / xUint != yUint) {\\n revert Errors.PRBMath_UD60x18_Gm_Overflow(x, y);\\n }\\n\\n // We don't need to multiply the result by `UNIT` here because the x*y product picked up a factor of `UNIT`\\n // during multiplication. See the comments in {Common.sqrt}.\\n result = wrap(Common.sqrt(xyUint));\\n }\\n}\\n\\n/// @notice Calculates the inverse of x.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x must not be zero.\\n///\\n/// @param x The UD60x18 number for which to calculate the inverse.\\n/// @return result The inverse as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction inv(UD60x18 x) pure returns (UD60x18 result) {\\n unchecked {\\n result = wrap(uUNIT_SQUARED / x.unwrap());\\n }\\n}\\n\\n/// @notice Calculates the natural logarithm of x using the following formula:\\n///\\n/// $$\\n/// ln{x} = log_2{x} / log_2{e}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n/// - The precision isn't sufficiently fine-grained to return exactly `UNIT` when the input is `E`.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The UD60x18 number for which to calculate the natural logarithm.\\n/// @return result The natural logarithm as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ln(UD60x18 x) pure returns (UD60x18 result) {\\n unchecked {\\n // Inline the fixed-point multiplication to save gas. This is overflow-safe because the maximum value that\\n // {log2} can return is ~196_205294292027477728.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_E);\\n }\\n}\\n\\n/// @notice Calculates the common logarithm of x using the following formula:\\n///\\n/// $$\\n/// log_{10}{x} = log_2{x} / log_2{10}\\n/// $$\\n///\\n/// However, if x is an exact power of ten, a hard coded value is returned.\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The UD60x18 number for which to calculate the common logarithm.\\n/// @return result The common logarithm as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log10(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n if (xUint < uUNIT) {\\n revert Errors.PRBMath_UD60x18_Log_InputTooSmall(x);\\n }\\n\\n // Note that the `mul` in this assembly block is the standard multiplication operation, not {UD60x18.mul}.\\n // prettier-ignore\\n assembly (\\\"memory-safe\\\") {\\n switch x\\n case 1 { result := mul(uUNIT, sub(0, 18)) }\\n case 10 { result := mul(uUNIT, sub(1, 18)) }\\n case 100 { result := mul(uUNIT, sub(2, 18)) }\\n case 1000 { result := mul(uUNIT, sub(3, 18)) }\\n case 10000 { result := mul(uUNIT, sub(4, 18)) }\\n case 100000 { result := mul(uUNIT, sub(5, 18)) }\\n case 1000000 { result := mul(uUNIT, sub(6, 18)) }\\n case 10000000 { result := mul(uUNIT, sub(7, 18)) }\\n case 100000000 { result := mul(uUNIT, sub(8, 18)) }\\n case 1000000000 { result := mul(uUNIT, sub(9, 18)) }\\n case 10000000000 { result := mul(uUNIT, sub(10, 18)) }\\n case 100000000000 { result := mul(uUNIT, sub(11, 18)) }\\n case 1000000000000 { result := mul(uUNIT, sub(12, 18)) }\\n case 10000000000000 { result := mul(uUNIT, sub(13, 18)) }\\n case 100000000000000 { result := mul(uUNIT, sub(14, 18)) }\\n case 1000000000000000 { result := mul(uUNIT, sub(15, 18)) }\\n case 10000000000000000 { result := mul(uUNIT, sub(16, 18)) }\\n case 100000000000000000 { result := mul(uUNIT, sub(17, 18)) }\\n case 1000000000000000000 { result := 0 }\\n case 10000000000000000000 { result := uUNIT }\\n case 100000000000000000000 { result := mul(uUNIT, 2) }\\n case 1000000000000000000000 { result := mul(uUNIT, 3) }\\n case 10000000000000000000000 { result := mul(uUNIT, 4) }\\n case 100000000000000000000000 { result := mul(uUNIT, 5) }\\n case 1000000000000000000000000 { result := mul(uUNIT, 6) }\\n case 10000000000000000000000000 { result := mul(uUNIT, 7) }\\n case 100000000000000000000000000 { result := mul(uUNIT, 8) }\\n case 1000000000000000000000000000 { result := mul(uUNIT, 9) }\\n case 10000000000000000000000000000 { result := mul(uUNIT, 10) }\\n case 100000000000000000000000000000 { result := mul(uUNIT, 11) }\\n case 1000000000000000000000000000000 { result := mul(uUNIT, 12) }\\n case 10000000000000000000000000000000 { result := mul(uUNIT, 13) }\\n case 100000000000000000000000000000000 { result := mul(uUNIT, 14) }\\n case 1000000000000000000000000000000000 { result := mul(uUNIT, 15) }\\n case 10000000000000000000000000000000000 { result := mul(uUNIT, 16) }\\n case 100000000000000000000000000000000000 { result := mul(uUNIT, 17) }\\n case 1000000000000000000000000000000000000 { result := mul(uUNIT, 18) }\\n case 10000000000000000000000000000000000000 { result := mul(uUNIT, 19) }\\n case 100000000000000000000000000000000000000 { result := mul(uUNIT, 20) }\\n case 1000000000000000000000000000000000000000 { result := mul(uUNIT, 21) }\\n case 10000000000000000000000000000000000000000 { result := mul(uUNIT, 22) }\\n case 100000000000000000000000000000000000000000 { result := mul(uUNIT, 23) }\\n case 1000000000000000000000000000000000000000000 { result := mul(uUNIT, 24) }\\n case 10000000000000000000000000000000000000000000 { result := mul(uUNIT, 25) }\\n case 100000000000000000000000000000000000000000000 { result := mul(uUNIT, 26) }\\n case 1000000000000000000000000000000000000000000000 { result := mul(uUNIT, 27) }\\n case 10000000000000000000000000000000000000000000000 { result := mul(uUNIT, 28) }\\n case 100000000000000000000000000000000000000000000000 { result := mul(uUNIT, 29) }\\n case 1000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 30) }\\n case 10000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 31) }\\n case 100000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 32) }\\n case 1000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 33) }\\n case 10000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 34) }\\n case 100000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 35) }\\n case 1000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 36) }\\n case 10000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 37) }\\n case 100000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 38) }\\n case 1000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 39) }\\n case 10000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 40) }\\n case 100000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 41) }\\n case 1000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 42) }\\n case 10000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 43) }\\n case 100000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 44) }\\n case 1000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 45) }\\n case 10000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 46) }\\n case 100000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 47) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 48) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 49) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 50) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 51) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 52) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 53) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 54) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 55) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 56) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 57) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 58) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 59) }\\n default { result := uMAX_UD60x18 }\\n }\\n\\n if (result.unwrap() == uMAX_UD60x18) {\\n unchecked {\\n // Inline the fixed-point division to save gas.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_10);\\n }\\n }\\n}\\n\\n/// @notice Calculates the binary logarithm of x using the iterative approximation algorithm:\\n///\\n/// $$\\n/// log_2{x} = n + log_2{y}, \\\\text{ where } y = x*2^{-n}, \\\\ y \\\\in [1, 2)\\n/// $$\\n///\\n/// For $0 \\\\leq x \\\\lt 1$, the input is inverted:\\n///\\n/// $$\\n/// log_2{x} = -log_2{\\\\frac{1}{x}}\\n/// $$\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Binary_logarithm#Iterative_approximation\\n///\\n/// Notes:\\n/// - Due to the lossy precision of the iterative approximation, the results are not perfectly accurate to the last decimal.\\n///\\n/// Requirements:\\n/// - x must be greater than zero.\\n///\\n/// @param x The UD60x18 number for which to calculate the binary logarithm.\\n/// @return result The binary logarithm as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log2(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n if (xUint < uUNIT) {\\n revert Errors.PRBMath_UD60x18_Log_InputTooSmall(x);\\n }\\n\\n unchecked {\\n // Calculate the integer part of the logarithm.\\n uint256 n = Common.msb(xUint / uUNIT);\\n\\n // This is the integer part of the logarithm as a UD60x18 number. The operation can't overflow because n\\n // n is at most 255 and UNIT is 1e18.\\n uint256 resultUint = n * uUNIT;\\n\\n // Calculate $y = x * 2^{-n}$.\\n uint256 y = xUint >> n;\\n\\n // If y is the unit number, the fractional part is zero.\\n if (y == uUNIT) {\\n return wrap(resultUint);\\n }\\n\\n // Calculate the fractional part via the iterative approximation.\\n // The `delta >>= 1` part is equivalent to `delta /= 2`, but shifting bits is more gas efficient.\\n uint256 DOUBLE_UNIT = 2e18;\\n for (uint256 delta = uHALF_UNIT; delta > 0; delta >>= 1) {\\n y = (y * y) / uUNIT;\\n\\n // Is y^2 >= 2e18 and so in the range [2e18, 4e18)?\\n if (y >= DOUBLE_UNIT) {\\n // Add the 2^{-m} factor to the logarithm.\\n resultUint += delta;\\n\\n // Halve y, which corresponds to z/2 in the Wikipedia article.\\n y >>= 1;\\n }\\n }\\n result = wrap(resultUint);\\n }\\n}\\n\\n/// @notice Multiplies two UD60x18 numbers together, returning a new UD60x18 number.\\n///\\n/// @dev Uses {Common.mulDiv} to enable overflow-safe multiplication and division.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv}.\\n///\\n/// @dev See the documentation in {Common.mulDiv18}.\\n/// @param x The multiplicand as a UD60x18 number.\\n/// @param y The multiplier as a UD60x18 number.\\n/// @return result The product as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mul(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(Common.mulDiv18(x.unwrap(), y.unwrap()));\\n}\\n\\n/// @notice Raises x to the power of y.\\n///\\n/// For $1 \\\\leq x \\\\leq \\\\infty$, the following standard formula is used:\\n///\\n/// $$\\n/// x^y = 2^{log_2{x} * y}\\n/// $$\\n///\\n/// For $0 \\\\leq x \\\\lt 1$, since the unsigned {log2} is undefined, an equivalent formula is used:\\n///\\n/// $$\\n/// i = \\\\frac{1}{x}\\n/// w = 2^{log_2{i} * y}\\n/// x^y = \\\\frac{1}{w}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2} and {mul}.\\n/// - Returns `UNIT` for 0^0.\\n/// - It may not perform well with very small values of x. Consider using SD59x18 as an alternative.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {exp2}, {log2}, and {mul}.\\n///\\n/// @param x The base as a UD60x18 number.\\n/// @param y The exponent as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction pow(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n uint256 yUint = y.unwrap();\\n\\n // If both x and y are zero, the result is `UNIT`. If just x is zero, the result is always zero.\\n if (xUint == 0) {\\n return yUint == 0 ? UNIT : ZERO;\\n }\\n // If x is `UNIT`, the result is always `UNIT`.\\n else if (xUint == uUNIT) {\\n return UNIT;\\n }\\n\\n // If y is zero, the result is always `UNIT`.\\n if (yUint == 0) {\\n return UNIT;\\n }\\n // If y is `UNIT`, the result is always x.\\n else if (yUint == uUNIT) {\\n return x;\\n }\\n\\n // If x is greater than `UNIT`, use the standard formula.\\n if (xUint > uUNIT) {\\n result = exp2(mul(log2(x), y));\\n }\\n // Conversely, if x is less than `UNIT`, use the equivalent formula.\\n else {\\n UD60x18 i = wrap(uUNIT_SQUARED / xUint);\\n UD60x18 w = exp2(mul(log2(i), y));\\n result = wrap(uUNIT_SQUARED / w.unwrap());\\n }\\n}\\n\\n/// @notice Raises x (a UD60x18 number) to the power y (an unsigned basic integer) using the well-known\\n/// algorithm \\\"exponentiation by squaring\\\".\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Exponentiation_by_squaring.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv18}.\\n/// - Returns `UNIT` for 0^0.\\n///\\n/// Requirements:\\n/// - The result must fit in UD60x18.\\n///\\n/// @param x The base as a UD60x18 number.\\n/// @param y The exponent as a uint256.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction powu(UD60x18 x, uint256 y) pure returns (UD60x18 result) {\\n // Calculate the first iteration of the loop in advance.\\n uint256 xUint = x.unwrap();\\n uint256 resultUint = y & 1 > 0 ? xUint : uUNIT;\\n\\n // Equivalent to `for(y /= 2; y > 0; y /= 2)`.\\n for (y >>= 1; y > 0; y >>= 1) {\\n xUint = Common.mulDiv18(xUint, xUint);\\n\\n // Equivalent to `y % 2 == 1`.\\n if (y & 1 > 0) {\\n resultUint = Common.mulDiv18(resultUint, xUint);\\n }\\n }\\n result = wrap(resultUint);\\n}\\n\\n/// @notice Calculates the square root of x using the Babylonian method.\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\\n///\\n/// Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x must be less than `MAX_UD60x18 / UNIT`.\\n///\\n/// @param x The UD60x18 number for which to calculate the square root.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction sqrt(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n unchecked {\\n if (xUint > uMAX_UD60x18 / uUNIT) {\\n revert Errors.PRBMath_UD60x18_Sqrt_Overflow(x);\\n }\\n // Multiply x by `UNIT` to account for the factor of `UNIT` picked up when multiplying two UD60x18 numbers.\\n // In this case, the two numbers are both the square root.\\n result = wrap(Common.sqrt(xUint * uUNIT));\\n }\\n}\\n\",\"keccak256\":\"0x462144667aac3f96d5f8dba7aa68fe4c5a3f61e1d7bbbc81bee21168817f9c09\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\nimport \\\"./Helpers.sol\\\" as Helpers;\\nimport \\\"./Math.sol\\\" as Math;\\n\\n/// @notice The unsigned 60.18-decimal fixed-point number representation, which can have up to 60 digits and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the Solidity type uint256.\\n/// @dev The value type is defined here so it can be imported in all other files.\\ntype UD60x18 is uint256;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoSD1x18,\\n Casting.intoUD2x18,\\n Casting.intoSD59x18,\\n Casting.intoUint128,\\n Casting.intoUint256,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for UD60x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n MATHEMATICAL FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes the functions in this library callable on the UD60x18 type.\\nusing {\\n Math.avg,\\n Math.ceil,\\n Math.div,\\n Math.exp,\\n Math.exp2,\\n Math.floor,\\n Math.frac,\\n Math.gm,\\n Math.inv,\\n Math.ln,\\n Math.log10,\\n Math.log2,\\n Math.mul,\\n Math.pow,\\n Math.powu,\\n Math.sqrt\\n} for UD60x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n HELPER FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes the functions in this library callable on the UD60x18 type.\\nusing {\\n Helpers.add,\\n Helpers.and,\\n Helpers.eq,\\n Helpers.gt,\\n Helpers.gte,\\n Helpers.isZero,\\n Helpers.lshift,\\n Helpers.lt,\\n Helpers.lte,\\n Helpers.mod,\\n Helpers.neq,\\n Helpers.not,\\n Helpers.or,\\n Helpers.rshift,\\n Helpers.sub,\\n Helpers.uncheckedAdd,\\n Helpers.uncheckedSub,\\n Helpers.xor\\n} for UD60x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n OPERATORS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes it possible to use these operators on the UD60x18 type.\\nusing {\\n Helpers.add as +,\\n Helpers.and2 as &,\\n Math.div as /,\\n Helpers.eq as ==,\\n Helpers.gt as >,\\n Helpers.gte as >=,\\n Helpers.lt as <,\\n Helpers.lte as <=,\\n Helpers.or as |,\\n Helpers.mod as %,\\n Math.mul as *,\\n Helpers.neq as !=,\\n Helpers.not as ~,\\n Helpers.sub as -,\\n Helpers.xor as ^\\n} for UD60x18 global;\\n\",\"keccak256\":\"0xdd873b5124180d9b71498b3a7fe93b1c08c368bec741f7d5f8e17f78a0b70f31\",\"license\":\"MIT\"},\"contracts/interfaces/IERC6551Registry.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\ninterface IERC6551Registry {\\n /**\\n * @dev Creates a token bound account for a non-fungible token.\\n *\\n * If account has already been created, returns the account address without calling create2.\\n *\\n * Emits ERC6551AccountCreated event.\\n *\\n * @return account The address of the token bound account\\n */\\n function createAccount(\\n address implementation,\\n bytes32 salt,\\n uint256 chainId,\\n address tokenContract,\\n uint256 tokenId\\n ) external returns (address account);\\n}\\n\",\"keccak256\":\"0x64c52de8a8e68398e61dd8b42dda8e9af8cf6abf93bb85629c322440991ea568\",\"license\":\"MIT\"},\"contracts/interfaces/hats/HatsErrors.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface HatsErrors {\\n /// @notice Emitted when `user` is attempting to perform an action on `hatId` but is not wearing one of `hatId`'s admin hats\\n /// @dev Can be equivalent to `NotHatWearer(buildHatId(hatId))`, such as when emitted by `approveLinkTopHatToTree` or `relinkTopHatToTree`\\n error NotAdmin(address user, uint256 hatId);\\n\\n /// @notice Emitted when attempting to perform an action as or for an account that is not a wearer of a given hat\\n error NotHatWearer();\\n\\n /// @notice Emitted when attempting to perform an action that requires being either an admin or wearer of a given hat\\n error NotAdminOrWearer();\\n\\n /// @notice Emitted when attempting to mint `hatId` but `hatId`'s maxSupply has been reached\\n error AllHatsWorn(uint256 hatId);\\n\\n /// @notice Emitted when attempting to create a hat with a level 14 hat as its admin\\n error MaxLevelsReached();\\n\\n /// @notice Emitted when an attempted hat id has empty intermediate level(s)\\n error InvalidHatId();\\n\\n /// @notice Emitted when attempting to mint `hatId` to a `wearer` who is already wearing the hat\\n error AlreadyWearingHat(address wearer, uint256 hatId);\\n\\n /// @notice Emitted when attempting to mint a non-existant hat\\n error HatDoesNotExist(uint256 hatId);\\n\\n /// @notice Emmitted when attempting to mint or transfer a hat that is not active\\n error HatNotActive();\\n\\n /// @notice Emitted when attempting to mint or transfer a hat to an ineligible wearer\\n error NotEligible();\\n\\n /// @notice Emitted when attempting to check or set a hat's status from an account that is not that hat's toggle module\\n error NotHatsToggle();\\n\\n /// @notice Emitted when attempting to check or set a hat wearer's status from an account that is not that hat's eligibility module\\n error NotHatsEligibility();\\n\\n /// @notice Emitted when array arguments to a batch function have mismatching lengths\\n error BatchArrayLengthMismatch();\\n\\n /// @notice Emitted when attempting to mutate or transfer an immutable hat\\n error Immutable();\\n\\n /// @notice Emitted when attempting to change a hat's maxSupply to a value lower than its current supply\\n error NewMaxSupplyTooLow();\\n\\n /// @notice Emitted when attempting to link a tophat to a new admin for which the tophat serves as an admin\\n error CircularLinkage();\\n\\n /// @notice Emitted when attempting to link or relink a tophat to a separate tree\\n error CrossTreeLinkage();\\n\\n /// @notice Emitted when attempting to link a tophat without a request\\n error LinkageNotRequested();\\n\\n /// @notice Emitted when attempting to unlink a tophat that does not have a wearer\\n /// @dev This ensures that unlinking never results in a bricked tophat\\n error InvalidUnlink();\\n\\n /// @notice Emmited when attempting to change a hat's eligibility or toggle module to the zero address\\n error ZeroAddress();\\n\\n /// @notice Emmitted when attempting to change a hat's details or imageURI to a string with over 7000 bytes (~characters)\\n /// @dev This protects against a DOS attack where an admin iteratively extend's a hat's details or imageURI\\n /// to be so long that reading it exceeds the block gas limit, breaking `uri()` and `viewHat()`\\n error StringTooLong();\\n}\\n\",\"keccak256\":\"0x81b0056b7bed86eabc07c0e4a9655c586ddb8e6c128320593669b76efd5a08de\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/HatsEvents.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface HatsEvents {\\n /// @notice Emitted when a new hat is created\\n /// @param id The id for the new hat\\n /// @param details A description of the Hat\\n /// @param maxSupply The total instances of the Hat that can be worn at once\\n /// @param eligibility The address that can report on the Hat wearer's status\\n /// @param toggle The address that can deactivate the Hat\\n /// @param mutable_ Whether the hat's properties are changeable after creation\\n /// @param imageURI The image uri for this hat and the fallback for its\\n event HatCreated(\\n uint256 id,\\n string details,\\n uint32 maxSupply,\\n address eligibility,\\n address toggle,\\n bool mutable_,\\n string imageURI\\n );\\n\\n /// @notice Emitted when a hat wearer's standing is updated\\n /// @dev Eligibility is excluded since the source of truth for eligibility is the eligibility module and may change without a transaction\\n /// @param hatId The id of the wearer's hat\\n /// @param wearer The wearer's address\\n /// @param wearerStanding Whether the wearer is in good standing for the hat\\n event WearerStandingChanged(\\n uint256 hatId,\\n address wearer,\\n bool wearerStanding\\n );\\n\\n /// @notice Emitted when a hat's status is updated\\n /// @param hatId The id of the hat\\n /// @param newStatus Whether the hat is active\\n event HatStatusChanged(uint256 hatId, bool newStatus);\\n\\n /// @notice Emitted when a hat's details are updated\\n /// @param hatId The id of the hat\\n /// @param newDetails The updated details\\n event HatDetailsChanged(uint256 hatId, string newDetails);\\n\\n /// @notice Emitted when a hat's eligibility module is updated\\n /// @param hatId The id of the hat\\n /// @param newEligibility The updated eligibiliy module\\n event HatEligibilityChanged(uint256 hatId, address newEligibility);\\n\\n /// @notice Emitted when a hat's toggle module is updated\\n /// @param hatId The id of the hat\\n /// @param newToggle The updated toggle module\\n event HatToggleChanged(uint256 hatId, address newToggle);\\n\\n /// @notice Emitted when a hat's mutability is updated\\n /// @param hatId The id of the hat\\n event HatMutabilityChanged(uint256 hatId);\\n\\n /// @notice Emitted when a hat's maximum supply is updated\\n /// @param hatId The id of the hat\\n /// @param newMaxSupply The updated max supply\\n event HatMaxSupplyChanged(uint256 hatId, uint32 newMaxSupply);\\n\\n /// @notice Emitted when a hat's image URI is updated\\n /// @param hatId The id of the hat\\n /// @param newImageURI The updated image URI\\n event HatImageURIChanged(uint256 hatId, string newImageURI);\\n\\n /// @notice Emitted when a tophat linkage is requested by its admin\\n /// @param domain The domain of the tree tophat to link\\n /// @param newAdmin The tophat's would-be admin in the parent tree\\n event TopHatLinkRequested(uint32 domain, uint256 newAdmin);\\n\\n /// @notice Emitted when a tophat is linked to a another tree\\n /// @param domain The domain of the newly-linked tophat\\n /// @param newAdmin The tophat's new admin in the parent tree\\n event TopHatLinked(uint32 domain, uint256 newAdmin);\\n}\\n\",\"keccak256\":\"0x53413397d15e1636c3cd7bd667656b79bc2886785403b824bcd4ed122667f2c6\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/IHats.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\nimport \\\"./IHatsIdUtilities.sol\\\";\\nimport \\\"./HatsErrors.sol\\\";\\nimport \\\"./HatsEvents.sol\\\";\\n\\ninterface IHats is IHatsIdUtilities, HatsErrors, HatsEvents {\\n function mintTopHat(\\n address _target,\\n string memory _details,\\n string memory _imageURI\\n ) external returns (uint256 topHatId);\\n\\n function createHat(\\n uint256 _admin,\\n string calldata _details,\\n uint32 _maxSupply,\\n address _eligibility,\\n address _toggle,\\n bool _mutable,\\n string calldata _imageURI\\n ) external returns (uint256 newHatId);\\n\\n function batchCreateHats(\\n uint256[] calldata _admins,\\n string[] calldata _details,\\n uint32[] calldata _maxSupplies,\\n address[] memory _eligibilityModules,\\n address[] memory _toggleModules,\\n bool[] calldata _mutables,\\n string[] calldata _imageURIs\\n ) external returns (bool success);\\n\\n function getNextId(uint256 _admin) external view returns (uint256 nextId);\\n\\n function mintHat(\\n uint256 _hatId,\\n address _wearer\\n ) external returns (bool success);\\n\\n function batchMintHats(\\n uint256[] calldata _hatIds,\\n address[] calldata _wearers\\n ) external returns (bool success);\\n\\n function setHatStatus(\\n uint256 _hatId,\\n bool _newStatus\\n ) external returns (bool toggled);\\n\\n function checkHatStatus(uint256 _hatId) external returns (bool toggled);\\n\\n function setHatWearerStatus(\\n uint256 _hatId,\\n address _wearer,\\n bool _eligible,\\n bool _standing\\n ) external returns (bool updated);\\n\\n function checkHatWearerStatus(\\n uint256 _hatId,\\n address _wearer\\n ) external returns (bool updated);\\n\\n function renounceHat(uint256 _hatId) external;\\n\\n function transferHat(uint256 _hatId, address _from, address _to) external;\\n\\n /*//////////////////////////////////////////////////////////////\\n HATS ADMIN FUNCTIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n function makeHatImmutable(uint256 _hatId) external;\\n\\n function changeHatDetails(\\n uint256 _hatId,\\n string memory _newDetails\\n ) external;\\n\\n function changeHatEligibility(\\n uint256 _hatId,\\n address _newEligibility\\n ) external;\\n\\n function changeHatToggle(uint256 _hatId, address _newToggle) external;\\n\\n function changeHatImageURI(\\n uint256 _hatId,\\n string memory _newImageURI\\n ) external;\\n\\n function changeHatMaxSupply(uint256 _hatId, uint32 _newMaxSupply) external;\\n\\n function requestLinkTopHatToTree(\\n uint32 _topHatId,\\n uint256 _newAdminHat\\n ) external;\\n\\n function approveLinkTopHatToTree(\\n uint32 _topHatId,\\n uint256 _newAdminHat,\\n address _eligibility,\\n address _toggle,\\n string calldata _details,\\n string calldata _imageURI\\n ) external;\\n\\n function unlinkTopHatFromTree(uint32 _topHatId, address _wearer) external;\\n\\n function relinkTopHatWithinTree(\\n uint32 _topHatDomain,\\n uint256 _newAdminHat,\\n address _eligibility,\\n address _toggle,\\n string calldata _details,\\n string calldata _imageURI\\n ) external;\\n\\n /*//////////////////////////////////////////////////////////////\\n VIEW FUNCTIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n function viewHat(\\n uint256 _hatId\\n )\\n external\\n view\\n returns (\\n string memory details,\\n uint32 maxSupply,\\n uint32 supply,\\n address eligibility,\\n address toggle,\\n string memory imageURI,\\n uint16 lastHatId,\\n bool mutable_,\\n bool active\\n );\\n\\n function isWearerOfHat(\\n address _user,\\n uint256 _hatId\\n ) external view returns (bool isWearer);\\n\\n function isAdminOfHat(\\n address _user,\\n uint256 _hatId\\n ) external view returns (bool isAdmin);\\n\\n function isInGoodStanding(\\n address _wearer,\\n uint256 _hatId\\n ) external view returns (bool standing);\\n\\n function isEligible(\\n address _wearer,\\n uint256 _hatId\\n ) external view returns (bool eligible);\\n\\n function getHatEligibilityModule(\\n uint256 _hatId\\n ) external view returns (address eligibility);\\n\\n function getHatToggleModule(\\n uint256 _hatId\\n ) external view returns (address toggle);\\n\\n function getHatMaxSupply(\\n uint256 _hatId\\n ) external view returns (uint32 maxSupply);\\n\\n function hatSupply(uint256 _hatId) external view returns (uint32 supply);\\n\\n function getImageURIForHat(\\n uint256 _hatId\\n ) external view returns (string memory _uri);\\n\\n function balanceOf(\\n address wearer,\\n uint256 hatId\\n ) external view returns (uint256 balance);\\n\\n function balanceOfBatch(\\n address[] calldata _wearers,\\n uint256[] calldata _hatIds\\n ) external view returns (uint256[] memory);\\n\\n function uri(uint256 id) external view returns (string memory _uri);\\n}\\n\",\"keccak256\":\"0x2867004bddc5148fa1937f25c0403e5d9977583aaf50fdbdb74bd463f64f21c8\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/IHatsIdUtilities.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface IHatsIdUtilities {\\n function buildHatId(\\n uint256 _admin,\\n uint16 _newHat\\n ) external pure returns (uint256 id);\\n\\n function getHatLevel(uint256 _hatId) external view returns (uint32 level);\\n\\n function getLocalHatLevel(\\n uint256 _hatId\\n ) external pure returns (uint32 level);\\n\\n function isTopHat(uint256 _hatId) external view returns (bool _topHat);\\n\\n function isLocalTopHat(\\n uint256 _hatId\\n ) external pure returns (bool _localTopHat);\\n\\n function isValidHatId(\\n uint256 _hatId\\n ) external view returns (bool validHatId);\\n\\n function getAdminAtLevel(\\n uint256 _hatId,\\n uint32 _level\\n ) external view returns (uint256 admin);\\n\\n function getAdminAtLocalLevel(\\n uint256 _hatId,\\n uint32 _level\\n ) external pure returns (uint256 admin);\\n\\n function getTopHatDomain(\\n uint256 _hatId\\n ) external view returns (uint32 domain);\\n\\n function getTippyTopHatDomain(\\n uint32 _topHatDomain\\n ) external view returns (uint32 domain);\\n\\n function noCircularLinkage(\\n uint32 _topHatDomain,\\n uint256 _linkedAdmin\\n ) external view returns (bool notCircular);\\n\\n function sameTippyTopHatDomain(\\n uint32 _topHatDomain,\\n uint256 _newAdminHat\\n ) external view returns (bool sameDomain);\\n}\\n\",\"keccak256\":\"0x007fcc07b20bf84bacad1f9a2ddf4e30e1a8be961e144b7bef8e98a51781aee9\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/IHatsModuleFactory.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.19;\\n\\ninterface IHatsModuleFactory {\\n error HatsModuleFactory_ModuleAlreadyDeployed(\\n address implementation,\\n uint256 hatId,\\n bytes otherImmutableArgs,\\n uint256 saltNonce\\n );\\n\\n error BatchArrayLengthMismatch();\\n\\n event HatsModuleFactory_ModuleDeployed(\\n address implementation,\\n address instance,\\n uint256 hatId,\\n bytes otherImmutableArgs,\\n bytes initData,\\n uint256 saltNonce\\n );\\n\\n function HATS() external view returns (address);\\n\\n function version() external view returns (string memory);\\n\\n function createHatsModule(\\n address _implementation,\\n uint256 _hatId,\\n bytes calldata _otherImmutableArgs,\\n bytes calldata _initData,\\n uint256 _saltNonce\\n ) external returns (address _instance);\\n\\n function batchCreateHatsModule(\\n address[] calldata _implementations,\\n uint256[] calldata _hatIds,\\n bytes[] calldata _otherImmutableArgsArray,\\n bytes[] calldata _initDataArray,\\n uint256[] calldata _saltNonces\\n ) external returns (bool success);\\n\\n function getHatsModuleAddress(\\n address _implementation,\\n uint256 _hatId,\\n bytes calldata _otherImmutableArgs,\\n uint256 _saltNonce\\n ) external view returns (address);\\n\\n function deployed(\\n address _implementation,\\n uint256 _hatId,\\n bytes calldata _otherImmutableArgs,\\n uint256 _saltNonce\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x861faf40785cedb829243116d492653414a367853408a5c27d201522f6c3bfdd\",\"license\":\"MIT\"},\"contracts/interfaces/hats/modules/IHatsElectionsEligibility.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.13;\\n\\ninterface IHatsElectionsEligibility {\\n event ElectionOpened(uint128 nextTermEnd);\\n event ElectionCompleted(uint128 termEnd, address[] winners);\\n event NewTermStarted(uint128 termEnd);\\n event Recalled(uint128 termEnd, address[] accounts);\\n\\n /// @notice Returns the first second after the current term ends.\\n /// @dev Also serves as the id for the current term.\\n function currentTermEnd() external view returns (uint128);\\n\\n /// @notice Returns the first second after the next term ends.\\n /// @dev Also serves as the id for the next term.\\n function nextTermEnd() external view returns (uint128);\\n\\n /// @notice Returns the election status (open or closed) for a given term end.\\n /// @param termEnd The term end timestamp to query.\\n function electionStatus(\\n uint128 termEnd\\n ) external view returns (bool isElectionOpen);\\n\\n /// @notice Returns whether a candidate was elected in a given term.\\n /// @param termEnd The term end timestamp to query.\\n /// @param candidate The address of the candidate.\\n function electionResults(\\n uint128 termEnd,\\n address candidate\\n ) external view returns (bool elected);\\n\\n /// @notice Returns the BALLOT_BOX_HAT constant.\\n function BALLOT_BOX_HAT() external pure returns (uint256);\\n\\n /// @notice Returns the ADMIN_HAT constant.\\n function ADMIN_HAT() external pure returns (uint256);\\n\\n /**\\n * @notice Submit the results of an election for a specified term.\\n * @dev Only callable by the wearer(s) of the BALLOT_BOX_HAT.\\n * @param _termEnd The id of the term for which the election results are being submitted.\\n * @param _winners The addresses of the winners of the election.\\n */\\n function elect(uint128 _termEnd, address[] calldata _winners) external;\\n\\n /**\\n * @notice Submit the results of a recall election for a specified term.\\n * @dev Only callable by the wearer(s) of the BALLOT_BOX_HAT.\\n * @param _termEnd The id of the term for which the recall results are being submitted.\\n * @param _recallees The addresses to be recalled.\\n */\\n function recall(uint128 _termEnd, address[] calldata _recallees) external;\\n\\n /**\\n * @notice Set the next term and open the election for it.\\n * @dev Only callable by the wearer(s) of the ADMIN_HAT.\\n * @param _newTermEnd The id of the term that will be opened.\\n */\\n function setNextTerm(uint128 _newTermEnd) external;\\n\\n /**\\n * @notice Start the next term, updating the current term.\\n * @dev Can be called by anyone, but will revert if conditions are not met.\\n */\\n function startNextTerm() external;\\n\\n /**\\n * @notice Determine the eligibility and standing of a wearer for a hat.\\n * @param _wearer The address of the hat wearer.\\n * @param _hatId The ID of the hat.\\n * @return eligible True if the wearer is eligible for the hat.\\n * @return standing True if the wearer is in good standing.\\n */\\n function getWearerStatus(\\n address _wearer,\\n uint256 _hatId\\n ) external view returns (bool eligible, bool standing);\\n}\\n\",\"keccak256\":\"0x74dfc5d538d866ddb8ee2ca1b569abf62e02d848c59f308adf6075ecff175c7d\",\"license\":\"MIT\"},\"contracts/interfaces/sablier/IAdminable.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\n/// @title IAdminable\\n/// @notice Contract module that provides a basic access control mechanism, with an admin that can be\\n/// granted exclusive access to specific functions. The inheriting contract must set the initial admin\\n/// in the constructor.\\ninterface IAdminable {\\n /*//////////////////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Emitted when the admin is transferred.\\n /// @param oldAdmin The address of the old admin.\\n /// @param newAdmin The address of the new admin.\\n event TransferAdmin(address indexed oldAdmin, address indexed newAdmin);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice The address of the admin account or contract.\\n function admin() external view returns (address);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n NON-CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Transfers the contract admin to a new address.\\n ///\\n /// @dev Notes:\\n /// - Does not revert if the admin is the same.\\n /// - This function can potentially leave the contract without an admin, thereby removing any\\n /// functionality that is only available to the admin.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the contract admin.\\n ///\\n /// @param newAdmin The address of the new admin.\\n function transferAdmin(address newAdmin) external;\\n}\\n\",\"keccak256\":\"0xa279c49e51228b571329164e36250e82b2c1378e8b549194ab7dd90fca9c3b2b\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/IERC4096.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 \\\"@openzeppelin/contracts/interfaces/IERC165.sol\\\";\\nimport {IERC721} from \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\n\\n/// @title ERC-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\",\"keccak256\":\"0xa34b9c52cbe36be860244f52256f1b05badf0cb797d208664b87337610d0e82d\",\"license\":\"MIT\"},\"contracts/interfaces/sablier/ISablierV2Lockup.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC4906} from \\\"./IERC4096.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IERC721Metadata} from \\\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\\\";\\nimport {UD60x18} from \\\"@prb/math/src/UD60x18.sol\\\";\\n\\nimport {Lockup} from \\\"./types/DataTypes.sol\\\";\\nimport {IAdminable} from \\\"./IAdminable.sol\\\";\\nimport {ISablierV2NFTDescriptor} from \\\"./ISablierV2NFTDescriptor.sol\\\";\\n\\n/// @title ISablierV2Lockup\\n/// @notice Common logic between all Sablier V2 Lockup contracts.\\ninterface ISablierV2Lockup is\\n IAdminable, // 0 inherited components\\n IERC4906, // 2 inherited components\\n IERC721Metadata // 2 inherited components\\n{\\n /*//////////////////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Emitted when the admin allows a new recipient contract to hook to Sablier.\\n /// @param admin The address of the current contract admin.\\n /// @param recipient The address of the recipient contract put on the allowlist.\\n event AllowToHook(address indexed admin, address recipient);\\n\\n /// @notice Emitted when a stream is canceled.\\n /// @param streamId The ID of the stream.\\n /// @param sender The address of the stream's sender.\\n /// @param recipient The address of the stream's recipient.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param senderAmount The amount of assets refunded to the stream's sender, denoted in units of the asset's\\n /// decimals.\\n /// @param recipientAmount The amount of assets left for the stream's recipient to withdraw, denoted in units of the\\n /// asset's decimals.\\n event CancelLockupStream(\\n uint256 streamId,\\n address indexed sender,\\n address indexed recipient,\\n IERC20 indexed asset,\\n uint128 senderAmount,\\n uint128 recipientAmount\\n );\\n\\n /// @notice Emitted when a sender gives up the right to cancel a stream.\\n /// @param streamId The ID of the stream.\\n event RenounceLockupStream(uint256 indexed streamId);\\n\\n /// @notice Emitted when the admin sets a new NFT descriptor contract.\\n /// @param admin The address of the current contract admin.\\n /// @param oldNFTDescriptor The address of the old NFT descriptor contract.\\n /// @param newNFTDescriptor The address of the new NFT descriptor contract.\\n event SetNFTDescriptor(\\n address indexed admin,\\n ISablierV2NFTDescriptor oldNFTDescriptor,\\n ISablierV2NFTDescriptor newNFTDescriptor\\n );\\n\\n /// @notice Emitted when assets are withdrawn from a stream.\\n /// @param streamId The ID of the stream.\\n /// @param to The address that has received the withdrawn assets.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param amount The amount of assets withdrawn, denoted in units of the asset's decimals.\\n event WithdrawFromLockupStream(\\n uint256 indexed streamId,\\n address indexed to,\\n IERC20 indexed asset,\\n uint128 amount\\n );\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Retrieves the address of the ERC-20 asset to be distributed.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getAsset(uint256 streamId) external view returns (IERC20 asset);\\n\\n /// @notice Retrieves the amount deposited in the stream, denoted in units of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getDepositedAmount(\\n uint256 streamId\\n ) external view returns (uint128 depositedAmount);\\n\\n /// @notice Retrieves the stream's end time, which is a Unix timestamp.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getEndTime(\\n uint256 streamId\\n ) external view returns (uint40 endTime);\\n\\n /// @notice Retrieves the stream's recipient.\\n /// @dev Reverts if the NFT has been burned.\\n /// @param streamId The stream ID for the query.\\n function getRecipient(\\n uint256 streamId\\n ) external view returns (address recipient);\\n\\n /// @notice Retrieves the amount refunded to the sender after a cancellation, denoted in units of the asset's\\n /// decimals. This amount is always zero unless the stream was canceled.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getRefundedAmount(\\n uint256 streamId\\n ) external view returns (uint128 refundedAmount);\\n\\n /// @notice Retrieves the stream's sender.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getSender(uint256 streamId) external view returns (address sender);\\n\\n /// @notice Retrieves the stream's start time, which is a Unix timestamp.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getStartTime(\\n uint256 streamId\\n ) external view returns (uint40 startTime);\\n\\n /// @notice Retrieves the amount withdrawn from the stream, denoted in units of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getWithdrawnAmount(\\n uint256 streamId\\n ) external view returns (uint128 withdrawnAmount);\\n\\n /// @notice Retrieves a flag indicating whether the provided address is a contract allowed to hook to Sablier\\n /// when a stream is canceled or when assets are withdrawn.\\n /// @dev See {ISablierLockupRecipient} for more information.\\n function isAllowedToHook(\\n address recipient\\n ) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream can be canceled. When the stream is cold, this\\n /// flag is always `false`.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isCancelable(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream is cold, i.e. settled, canceled, or depleted.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isCold(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream is depleted.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isDepleted(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream exists.\\n /// @dev Does not revert if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isStream(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream NFT can be transferred.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isTransferable(\\n uint256 streamId\\n ) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream is warm, i.e. either pending or streaming.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isWarm(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves the maximum broker fee that can be charged by the broker, denoted as a fixed-point\\n /// number where 1e18 is 100%.\\n /// @dev This value is hard coded as a constant.\\n function MAX_BROKER_FEE() external view returns (UD60x18);\\n\\n /// @notice Counter for stream IDs, used in the create functions.\\n function nextStreamId() external view returns (uint256);\\n\\n /// @notice Contract that generates the non-fungible token URI.\\n function nftDescriptor() external view returns (ISablierV2NFTDescriptor);\\n\\n /// @notice Calculates the amount that the sender would be refunded if the stream were canceled, denoted in units\\n /// of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function refundableAmountOf(\\n uint256 streamId\\n ) external view returns (uint128 refundableAmount);\\n\\n /// @notice Retrieves the stream's status.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function statusOf(\\n uint256 streamId\\n ) external view returns (Lockup.Status status);\\n\\n /// @notice Calculates the amount streamed to the recipient, denoted in units of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n ///\\n /// Notes:\\n /// - Upon cancellation of the stream, the amount streamed is calculated as the difference between the deposited\\n /// amount and the refunded amount. Ultimately, when the stream becomes depleted, the streamed amount is equivalent\\n /// to the total amount withdrawn.\\n ///\\n /// @param streamId The stream ID for the query.\\n function streamedAmountOf(\\n uint256 streamId\\n ) external view returns (uint128 streamedAmount);\\n\\n /// @notice Retrieves a flag indicating whether the stream was canceled.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function wasCanceled(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Calculates the amount that the recipient can withdraw from the stream, denoted in units of the asset's\\n /// decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function withdrawableAmountOf(\\n uint256 streamId\\n ) external view returns (uint128 withdrawableAmount);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n NON-CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Allows a recipient contract to hook to Sablier when a stream is canceled or when assets are withdrawn.\\n /// Useful for implementing contracts that hold streams on behalf of users, such as vaults or staking contracts.\\n ///\\n /// @dev Emits an {AllowToHook} event.\\n ///\\n /// Notes:\\n /// - Does not revert if the contract is already on the allowlist.\\n /// - This is an irreversible operation. The contract cannot be removed from the allowlist.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the contract admin.\\n /// - `recipient` must have a non-zero code size.\\n /// - `recipient` must implement {ISablierLockupRecipient}.\\n ///\\n /// @param recipient The address of the contract to allow for hooks.\\n function allowToHook(address recipient) external;\\n\\n /// @notice Burns the NFT associated with the stream.\\n ///\\n /// @dev Emits a {Transfer} event.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `streamId` must reference a depleted stream.\\n /// - The NFT must exist.\\n /// - `msg.sender` must be either the NFT owner or an approved third party.\\n ///\\n /// @param streamId The ID of the stream NFT to burn.\\n function burn(uint256 streamId) external;\\n\\n /// @notice Cancels the stream and refunds any remaining assets to the sender.\\n ///\\n /// @dev Emits a {Transfer}, {CancelLockupStream}, and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - If there any assets left for the recipient to withdraw, the stream is marked as canceled. Otherwise, the\\n /// stream is marked as depleted.\\n /// - This function attempts to invoke a hook on the recipient, if the resolved address is a contract.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - The stream must be warm and cancelable.\\n /// - `msg.sender` must be the stream's sender.\\n ///\\n /// @param streamId The ID of the stream to cancel.\\n function cancel(uint256 streamId) external;\\n\\n /// @notice Cancels multiple streams and refunds any remaining assets to the sender.\\n ///\\n /// @dev Emits multiple {Transfer}, {CancelLockupStream}, and {MetadataUpdate} events.\\n ///\\n /// Notes:\\n /// - Refer to the notes in {cancel}.\\n ///\\n /// Requirements:\\n /// - All requirements from {cancel} must be met for each stream.\\n ///\\n /// @param streamIds The IDs of the streams to cancel.\\n function cancelMultiple(uint256[] calldata streamIds) external;\\n\\n /// @notice Removes the right of the stream's sender to cancel the stream.\\n ///\\n /// @dev Emits a {RenounceLockupStream} and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - This is an irreversible operation.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `streamId` must reference a warm stream.\\n /// - `msg.sender` must be the stream's sender.\\n /// - The stream must be cancelable.\\n ///\\n /// @param streamId The ID of the stream to renounce.\\n function renounce(uint256 streamId) external;\\n\\n /// @notice Sets a new NFT descriptor contract, which produces the URI describing the Sablier stream NFTs.\\n ///\\n /// @dev Emits a {SetNFTDescriptor} and {BatchMetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - Does not revert if the NFT descriptor is the same.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the contract admin.\\n ///\\n /// @param newNFTDescriptor The address of the new NFT descriptor contract.\\n function setNFTDescriptor(\\n ISablierV2NFTDescriptor newNFTDescriptor\\n ) external;\\n\\n /// @notice Withdraws the provided amount of assets from the stream to the `to` address.\\n ///\\n /// @dev Emits a {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - This function attempts to call a hook on the recipient of the stream, unless `msg.sender` is the recipient.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `streamId` must not reference a null or depleted stream.\\n /// - `to` must not be the zero address.\\n /// - `amount` must be greater than zero and must not exceed the withdrawable amount.\\n /// - `to` must be the recipient if `msg.sender` is not the stream's recipient or an approved third party.\\n ///\\n /// @param streamId The ID of the stream to withdraw from.\\n /// @param to The address receiving the withdrawn assets.\\n /// @param amount The amount to withdraw, denoted in units of the asset's decimals.\\n function withdraw(uint256 streamId, address to, uint128 amount) external;\\n\\n /// @notice Withdraws the maximum withdrawable amount from the stream to the provided address `to`.\\n ///\\n /// @dev Emits a {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - Refer to the notes in {withdraw}.\\n ///\\n /// Requirements:\\n /// - Refer to the requirements in {withdraw}.\\n ///\\n /// @param streamId The ID of the stream to withdraw from.\\n /// @param to The address receiving the withdrawn assets.\\n /// @return withdrawnAmount The amount withdrawn, denoted in units of the asset's decimals.\\n function withdrawMax(\\n uint256 streamId,\\n address to\\n ) external returns (uint128 withdrawnAmount);\\n\\n /// @notice Withdraws the maximum withdrawable amount from the stream to the current recipient, and transfers the\\n /// NFT to `newRecipient`.\\n ///\\n /// @dev Emits a {WithdrawFromLockupStream} and a {Transfer} event.\\n ///\\n /// Notes:\\n /// - If the withdrawable amount is zero, the withdrawal is skipped.\\n /// - Refer to the notes in {withdraw}.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the stream's recipient.\\n /// - Refer to the requirements in {withdraw}.\\n /// - Refer to the requirements in {IERC721.transferFrom}.\\n ///\\n /// @param streamId The ID of the stream NFT to transfer.\\n /// @param newRecipient The address of the new owner of the stream NFT.\\n /// @return withdrawnAmount The amount withdrawn, denoted in units of the asset's decimals.\\n function withdrawMaxAndTransfer(\\n uint256 streamId,\\n address newRecipient\\n ) external returns (uint128 withdrawnAmount);\\n\\n /// @notice Withdraws assets from streams to the recipient of each stream.\\n ///\\n /// @dev Emits multiple {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} events.\\n ///\\n /// Notes:\\n /// - This function attempts to call a hook on the recipient of each stream, unless `msg.sender` is the recipient.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - There must be an equal number of `streamIds` and `amounts`.\\n /// - Each stream ID in the array must not reference a null or depleted stream.\\n /// - Each amount in the array must be greater than zero and must not exceed the withdrawable amount.\\n ///\\n /// @param streamIds The IDs of the streams to withdraw from.\\n /// @param amounts The amounts to withdraw, denoted in units of the asset's decimals.\\n function withdrawMultiple(\\n uint256[] calldata streamIds,\\n uint128[] calldata amounts\\n ) external;\\n}\\n\",\"keccak256\":\"0x3e5541c38a901637bd310965deb5bbde73ef07fe4ee3c752cbec330c6b9d62a3\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/ISablierV2LockupLinear.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\nimport {Lockup, LockupLinear} from \\\"./types/DataTypes.sol\\\";\\nimport {ISablierV2Lockup} from \\\"./ISablierV2Lockup.sol\\\";\\n\\n/// @title ISablierV2LockupLinear\\n/// @notice Creates and manages Lockup streams with a linear distribution function.\\ninterface ISablierV2LockupLinear is ISablierV2Lockup {\\n /*//////////////////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Emitted when a stream is created.\\n /// @param streamId The ID of the newly created stream.\\n /// @param funder The address which funded the stream.\\n /// @param sender The address distributing the assets, which will have the ability to cancel the stream.\\n /// @param recipient The address receiving the assets.\\n /// @param amounts Struct encapsulating (i) the deposit amount, and (ii) the broker fee amount, both denoted\\n /// in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Boolean indicating whether the stream will be cancelable or not.\\n /// @param transferable Boolean indicating whether the stream NFT is transferable or not.\\n /// @param timestamps Struct encapsulating (i) the stream's start time, (ii) cliff time, and (iii) end time, all as\\n /// Unix timestamps.\\n /// @param broker The address of the broker who has helped create the stream, e.g. a front-end website.\\n event CreateLockupLinearStream(\\n uint256 streamId,\\n address funder,\\n address indexed sender,\\n address indexed recipient,\\n Lockup.CreateAmounts amounts,\\n IERC20 indexed asset,\\n bool cancelable,\\n bool transferable,\\n LockupLinear.Timestamps timestamps,\\n address broker\\n );\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Retrieves the stream's cliff time, which is a Unix timestamp. A value of zero means there\\n /// is no cliff.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getCliffTime(\\n uint256 streamId\\n ) external view returns (uint40 cliffTime);\\n\\n /// @notice Retrieves the full stream details.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n /// @return stream See the documentation in {DataTypes}.\\n function getStream(\\n uint256 streamId\\n ) external view returns (LockupLinear.StreamLL memory stream);\\n\\n /// @notice Retrieves the stream's start, cliff and end timestamps.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n /// @return timestamps See the documentation in {DataTypes}.\\n function getTimestamps(\\n uint256 streamId\\n ) external view returns (LockupLinear.Timestamps memory timestamps);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n NON-CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Creates a stream by setting the start time to `block.timestamp`, and the end time to\\n /// the sum of `block.timestamp` and `params.durations.total`. The stream is funded by `msg.sender` and is wrapped\\n /// in an ERC-721 NFT.\\n ///\\n /// @dev Emits a {Transfer} and {CreateLockupLinearStream} event.\\n ///\\n /// Requirements:\\n /// - All requirements in {createWithTimestamps} must be met for the calculated parameters.\\n ///\\n /// @param params Struct encapsulating the function parameters, which are documented in {DataTypes}.\\n /// @return streamId The ID of the newly created stream.\\n function createWithDurations(\\n LockupLinear.CreateWithDurations calldata params\\n ) external returns (uint256 streamId);\\n\\n /// @notice Creates a stream with the provided start time and end time. The stream is funded by `msg.sender` and is\\n /// wrapped in an ERC-721 NFT.\\n ///\\n /// @dev Emits a {Transfer} and {CreateLockupLinearStream} event.\\n ///\\n /// Notes:\\n /// - A cliff time of zero means there is no cliff.\\n /// - As long as the times are ordered, it is not an error for the start or the cliff time to be in the past.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `params.totalAmount` must be greater than zero.\\n /// - If set, `params.broker.fee` must not be greater than `MAX_BROKER_FEE`.\\n /// - `params.timestamps.start` must be greater than zero and less than `params.timestamps.end`.\\n /// - If set, `params.timestamps.cliff` must be greater than `params.timestamps.start` and less than\\n /// `params.timestamps.end`.\\n /// - `params.timestamps.end` must be in the future.\\n /// - `params.recipient` must not be the zero address.\\n /// - `msg.sender` must have allowed this contract to spend at least `params.totalAmount` assets.\\n ///\\n /// @param params Struct encapsulating the function parameters, which are documented in {DataTypes}.\\n /// @return streamId The ID of the newly created stream.\\n function createWithTimestamps(\\n LockupLinear.CreateWithTimestamps calldata params\\n ) external returns (uint256 streamId);\\n}\\n\",\"keccak256\":\"0x064264723114b1f1cf3953fd79874dfcbb42cf313857aee6d5e6b09a23e0010b\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/ISablierV2NFTDescriptor.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC721Metadata} from \\\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\\\";\\n\\n/// @title ISablierV2NFTDescriptor\\n/// @notice This contract generates the URI describing the Sablier V2 stream NFTs.\\n/// @dev Inspired by Uniswap V3 Positions NFTs.\\ninterface ISablierV2NFTDescriptor {\\n /// @notice Produces the URI describing a particular stream NFT.\\n /// @dev This is a data URI with the JSON contents directly inlined.\\n /// @param sablier The address of the Sablier contract the stream was created in.\\n /// @param streamId The ID of the stream for which to produce a description.\\n /// @return uri The URI of the ERC721-compliant metadata.\\n function tokenURI(\\n IERC721Metadata sablier,\\n uint256 streamId\\n ) external view returns (string memory uri);\\n}\\n\",\"keccak256\":\"0x4ed430e553d14161e93efdaaacd1a502f49b38969c9d714b45d2e682a74fa0bc\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/types/DataTypes.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {UD2x18} from \\\"@prb/math/src/UD2x18.sol\\\";\\nimport {UD60x18} from \\\"@prb/math/src/UD60x18.sol\\\";\\n\\n// DataTypes.sol\\n//\\n// This file defines all structs used in V2 Core, most of which are organized under three namespaces:\\n//\\n// - Lockup\\n// - LockupDynamic\\n// - LockupLinear\\n// - LockupTranched\\n//\\n// You will notice that some structs contain \\\"slot\\\" annotations - they are used to indicate the\\n// storage layout of the struct. It is more gas efficient to group small data types together so\\n// that they fit in a single 32-byte slot.\\n\\n/// @notice Struct encapsulating the broker parameters passed to the create functions. Both can be set to zero.\\n/// @param account The address receiving the broker's fee.\\n/// @param fee The broker's percentage fee from the total amount, denoted as a fixed-point number where 1e18 is 100%.\\nstruct Broker {\\n address account;\\n UD60x18 fee;\\n}\\n\\n/// @notice Namespace for the structs used in both {SablierV2LockupLinear} and {SablierV2LockupDynamic}.\\nlibrary Lockup {\\n /// @notice Struct encapsulating the deposit, withdrawn, and refunded amounts, all denoted in units of the asset's\\n /// decimals.\\n /// @dev Because the deposited and the withdrawn amount are often read together, declaring them in the same slot\\n /// saves gas.\\n /// @param deposited The initial amount deposited in the stream, net of broker fee.\\n /// @param withdrawn The cumulative amount withdrawn from the stream.\\n /// @param refunded The amount refunded to the sender. Unless the stream was canceled, this is always zero.\\n struct Amounts {\\n // slot 0\\n uint128 deposited;\\n uint128 withdrawn;\\n // slot 1\\n uint128 refunded;\\n }\\n\\n /// @notice Struct encapsulating (i) the deposit amount and (ii) the broker fee amount, both denoted in units of the\\n /// asset's decimals.\\n /// @param deposit The amount to deposit in the stream.\\n /// @param brokerFee The broker fee amount.\\n struct CreateAmounts {\\n uint128 deposit;\\n uint128 brokerFee;\\n }\\n\\n /// @notice Enum representing the different statuses of a stream.\\n /// @custom:value0 PENDING Stream created but not started; assets are in a pending state.\\n /// @custom:value1 STREAMING Active stream where assets are currently being streamed.\\n /// @custom:value2 SETTLED All assets have been streamed; recipient is due to withdraw them.\\n /// @custom:value3 CANCELED Canceled stream; remaining assets await recipient's withdrawal.\\n /// @custom:value4 DEPLETED Depleted stream; all assets have been withdrawn and/or refunded.\\n enum Status {\\n PENDING,\\n STREAMING,\\n SETTLED,\\n CANCELED,\\n DEPLETED\\n }\\n\\n /// @notice A common data structure to be stored in all {SablierV2Lockup} models.\\n /// @dev The fields are arranged like this to save gas via tight variable packing.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream.\\n /// @param startTime The Unix timestamp indicating the stream's start.\\n /// @param endTime The Unix timestamp indicating the stream's end.\\n /// @param isCancelable Boolean indicating if the stream is cancelable.\\n /// @param wasCanceled Boolean indicating if the stream was canceled.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param isDepleted Boolean indicating if the stream is depleted.\\n /// @param isStream Boolean indicating if the struct entity exists.\\n /// @param isTransferable Boolean indicating if the stream NFT is transferable.\\n /// @param amounts Struct encapsulating the deposit, withdrawn, and refunded amounts, all denoted in units of the\\n /// asset's decimals.\\n struct Stream {\\n // slot 0\\n address sender;\\n uint40 startTime;\\n uint40 endTime;\\n bool isCancelable;\\n bool wasCanceled;\\n // slot 1\\n IERC20 asset;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n // slot 2 and 3\\n Lockup.Amounts amounts;\\n }\\n}\\n\\n/// @notice Namespace for the structs used in {SablierV2LockupDynamic}.\\nlibrary LockupDynamic {\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupDynamic.createWithDurations} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param segments Segments with durations used to compose the dynamic distribution function. Timestamps are\\n /// calculated by starting from `block.timestamp` and adding each duration to the previous timestamp.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithDurations {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n SegmentWithDuration[] segments;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupDynamic.createWithTimestamps} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param startTime The Unix timestamp indicating the stream's start.\\n /// @param segments Segments used to compose the dynamic distribution function.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithTimestamps {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n uint40 startTime;\\n Segment[] segments;\\n Broker broker;\\n }\\n\\n /// @notice Segment struct used in the Lockup Dynamic stream.\\n /// @param amount The amount of assets to be streamed in the segment, denoted in units of the asset's decimals.\\n /// @param exponent The exponent of the segment, denoted as a fixed-point number.\\n /// @param timestamp The Unix timestamp indicating the segment's end.\\n struct Segment {\\n // slot 0\\n uint128 amount;\\n UD2x18 exponent;\\n uint40 timestamp;\\n }\\n\\n /// @notice Segment struct used at runtime in {SablierV2LockupDynamic.createWithDurations}.\\n /// @param amount The amount of assets to be streamed in the segment, denoted in units of the asset's decimals.\\n /// @param exponent The exponent of the segment, denoted as a fixed-point number.\\n /// @param duration The time difference in seconds between the segment and the previous one.\\n struct SegmentWithDuration {\\n uint128 amount;\\n UD2x18 exponent;\\n uint40 duration;\\n }\\n\\n /// @notice Struct encapsulating the full details of a stream.\\n /// @dev Extends `Lockup.Stream` by including the recipient and the segments.\\n struct StreamLD {\\n address sender;\\n address recipient;\\n uint40 startTime;\\n uint40 endTime;\\n bool isCancelable;\\n bool wasCanceled;\\n IERC20 asset;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n Lockup.Amounts amounts;\\n Segment[] segments;\\n }\\n\\n /// @notice Struct encapsulating the LockupDynamic timestamps.\\n /// @param start The Unix timestamp indicating the stream's start.\\n /// @param end The Unix timestamp indicating the stream's end.\\n struct Timestamps {\\n uint40 start;\\n uint40 end;\\n }\\n}\\n\\n/// @notice Namespace for the structs used in {SablierV2LockupLinear}.\\nlibrary LockupLinear {\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupLinear.createWithDurations} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param durations Struct encapsulating (i) cliff period duration and (ii) total stream duration, both in seconds.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithDurations {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n Durations durations;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupLinear.createWithTimestamps} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param timestamps Struct encapsulating (i) the stream's start time, (ii) cliff time, and (iii) end time, all as\\n /// Unix timestamps.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithTimestamps {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n Timestamps timestamps;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the cliff duration and the total duration.\\n /// @param cliff The cliff duration in seconds.\\n /// @param total The total duration in seconds.\\n struct Durations {\\n uint40 cliff;\\n uint40 total;\\n }\\n\\n /// @notice Struct encapsulating the full details of a stream.\\n /// @dev Extends `Lockup.Stream` by including the recipient and the cliff time.\\n struct StreamLL {\\n address sender;\\n address recipient;\\n uint40 startTime;\\n bool isCancelable;\\n bool wasCanceled;\\n IERC20 asset;\\n uint40 endTime;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n Lockup.Amounts amounts;\\n uint40 cliffTime;\\n }\\n\\n /// @notice Struct encapsulating the LockupLinear timestamps.\\n /// @param start The Unix timestamp for the stream's start.\\n /// @param cliff The Unix timestamp for the cliff period's end. A value of zero means there is no cliff.\\n /// @param end The Unix timestamp for the stream's end.\\n struct Timestamps {\\n uint40 start;\\n uint40 cliff;\\n uint40 end;\\n }\\n}\\n\\n/// @notice Namespace for the structs used in {SablierV2LockupTranched}.\\nlibrary LockupTranched {\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupTranched.createWithDurations} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param tranches Tranches with durations used to compose the tranched distribution function. Timestamps are\\n /// calculated by starting from `block.timestamp` and adding each duration to the previous timestamp.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithDurations {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n TrancheWithDuration[] tranches;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupTranched.createWithTimestamps} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param startTime The Unix timestamp indicating the stream's start.\\n /// @param tranches Tranches used to compose the tranched distribution function.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithTimestamps {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n uint40 startTime;\\n Tranche[] tranches;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the full details of a stream.\\n /// @dev Extends `Lockup.Stream` by including the recipient and the tranches.\\n struct StreamLT {\\n address sender;\\n address recipient;\\n uint40 startTime;\\n uint40 endTime;\\n bool isCancelable;\\n bool wasCanceled;\\n IERC20 asset;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n Lockup.Amounts amounts;\\n Tranche[] tranches;\\n }\\n\\n /// @notice Struct encapsulating the LockupTranched timestamps.\\n /// @param start The Unix timestamp indicating the stream's start.\\n /// @param end The Unix timestamp indicating the stream's end.\\n struct Timestamps {\\n uint40 start;\\n uint40 end;\\n }\\n\\n /// @notice Tranche struct used in the Lockup Tranched stream.\\n /// @param amount The amount of assets to be unlocked in the tranche, denoted in units of the asset's decimals.\\n /// @param timestamp The Unix timestamp indicating the tranche's end.\\n struct Tranche {\\n // slot 0\\n uint128 amount;\\n uint40 timestamp;\\n }\\n\\n /// @notice Tranche struct used at runtime in {SablierV2LockupTranched.createWithDurations}.\\n /// @param amount The amount of assets to be unlocked in the tranche, denoted in units of the asset's decimals.\\n /// @param duration The time difference in seconds between the tranche and the previous one.\\n struct TrancheWithDuration {\\n uint128 amount;\\n uint40 duration;\\n }\\n}\\n\",\"keccak256\":\"0x727722c0ec71a76a947b935c9dfcac8fd846d6c3547dfbc8739c7109f3b95068\",\"license\":\"GPL-3.0-or-later\"},\"contracts/modules/DecentHatsCreationModule.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.28;\\n\\nimport {Enum} from \\\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\\\";\\nimport {IAvatar} from \\\"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol\\\";\\nimport {Strings} from \\\"@openzeppelin/contracts/utils/Strings.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IERC6551Registry} from \\\"../interfaces/IERC6551Registry.sol\\\";\\nimport {IHats} from \\\"../interfaces/hats/IHats.sol\\\";\\nimport {LockupLinear, Broker} from \\\"../interfaces/sablier/types/DataTypes.sol\\\";\\nimport {IHatsModuleFactory} from \\\"../interfaces/hats/IHatsModuleFactory.sol\\\";\\nimport {IHatsElectionsEligibility} from \\\"../interfaces/hats/modules/IHatsElectionsEligibility.sol\\\";\\nimport {ModuleProxyFactory} from \\\"@gnosis.pm/zodiac/contracts/factory/ModuleProxyFactory.sol\\\";\\nimport {ISablierV2LockupLinear} from \\\"../interfaces/sablier/ISablierV2LockupLinear.sol\\\";\\nimport {DecentHatsModuleUtils} from \\\"./DecentHatsModuleUtils.sol\\\";\\n\\ncontract DecentHatsCreationModule is DecentHatsModuleUtils {\\n struct TopHatParams {\\n string details;\\n string imageURI;\\n }\\n\\n struct AdminHatParams {\\n string details;\\n string imageURI;\\n bool isMutable;\\n }\\n\\n struct CreateTreeParams {\\n IHats hatsProtocol;\\n IERC6551Registry erc6551Registry;\\n IHatsModuleFactory hatsModuleFactory;\\n ModuleProxyFactory moduleProxyFactory;\\n address keyValuePairs;\\n address decentAutonomousAdminImplementation;\\n address hatsAccountImplementation;\\n address hatsElectionsEligibilityImplementation;\\n TopHatParams topHat;\\n AdminHatParams adminHat;\\n HatParams[] hats;\\n }\\n\\n /* /////////////////////////////////////////////////////////////////////////////\\n EXTERNAL FUNCTIONS\\n ///////////////////////////////////////////////////////////////////////////// */\\n /**\\n * @notice For a safe without any roles previously created on it, this function should be called. It sets up the\\n * top hat and admin hat, as well as any other hats and their streams that are provided, then transfers the top hat\\n * to the calling safe.\\n *\\n * @notice This contract should be enabled a module on the Safe for which the role(s) are to be created, and disabled after.\\n *\\n * @dev For each hat that is included, if the hat is:\\n * - termed, its stream funds on are targeted directly at the nominated wearer. The wearer should directly call `withdraw-`\\n * on the Sablier contract.\\n * - untermed, its stream funds are targeted at the hat's smart account. In order to withdraw funds from the stream, the\\n * hat's smart account must be the one call to `withdraw-` on the Sablier contract, setting the recipient arg to its wearer.\\n *\\n * @dev In order for a Safe to seamlessly create roles even if it has never previously created a role and thus has\\n * no hat tree, we defer the creation of the hat tree and its setup to this contract. This way, in a single tx block,\\n * the resulting topHatId of the newly created hat can be used to create an admin hat and any other hats needed.\\n * We also make use of `KeyValuePairs` to associate the topHatId with the Safe.\\n *\\n * @param treeParams The parameters for creating the Hat Tree with Roles\\n */\\n function createAndDeclareTree(\\n CreateTreeParams calldata treeParams\\n ) external {\\n // Create Top Hat\\n (uint256 topHatId, address topHatAccount) = _processTopHat(\\n treeParams.hatsProtocol,\\n treeParams.erc6551Registry,\\n treeParams.hatsAccountImplementation,\\n treeParams.keyValuePairs,\\n treeParams.topHat\\n );\\n\\n // Create Admin Hat\\n uint256 adminHatId = _processAdminHat(\\n treeParams.hatsProtocol,\\n treeParams.erc6551Registry,\\n treeParams.hatsAccountImplementation,\\n topHatId,\\n topHatAccount,\\n treeParams.moduleProxyFactory,\\n treeParams.decentAutonomousAdminImplementation,\\n treeParams.adminHat\\n );\\n\\n // Create Role Hats\\n _processRoleHats(\\n CreateRoleHatsParams({\\n hatsProtocol: treeParams.hatsProtocol,\\n erc6551Registry: treeParams.erc6551Registry,\\n hatsAccountImplementation: treeParams.hatsAccountImplementation,\\n topHatId: topHatId,\\n topHatAccount: topHatAccount,\\n hatsModuleFactory: treeParams.hatsModuleFactory,\\n hatsElectionsEligibilityImplementation: treeParams\\n .hatsElectionsEligibilityImplementation,\\n adminHatId: adminHatId,\\n hats: treeParams.hats\\n })\\n );\\n }\\n\\n /* /////////////////////////////////////////////////////////////////////////////\\n INTERNAL FUNCTIONS\\n ///////////////////////////////////////////////////////////////////////////// */\\n\\n function _processTopHat(\\n IHats hatsProtocol,\\n IERC6551Registry erc6551Registry,\\n address hatsAccountImplementation,\\n address keyValuePairs,\\n TopHatParams calldata topHat\\n ) internal returns (uint256 topHatId, address topHatAccount) {\\n // Call lastTopHatId() and properly decode the response\\n (bool success, bytes memory data) = address(hatsProtocol).call(\\n abi.encodeWithSignature(\\\"lastTopHatId()\\\")\\n );\\n require(success, \\\"Failed to get lastTopHatId\\\");\\n topHatId = (abi.decode(data, (uint256)) + 1) << 224;\\n\\n // Mint Top Hat to the Safe\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"mintTopHat(address,string,string)\\\",\\n msg.sender,\\n topHat.details,\\n topHat.imageURI\\n ),\\n Enum.Operation.Call\\n );\\n\\n // Create Top Hat's ERC6551 Account\\n topHatAccount = erc6551Registry.createAccount(\\n hatsAccountImplementation,\\n SALT,\\n block.chainid,\\n address(hatsProtocol),\\n topHatId\\n );\\n\\n // Declare Top Hat ID to Safe via KeyValuePairs\\n string[] memory keys = new string[](1);\\n string[] memory values = new string[](1);\\n keys[0] = \\\"topHatId\\\";\\n values[0] = Strings.toString(topHatId);\\n IAvatar(msg.sender).execTransactionFromModule(\\n keyValuePairs,\\n 0,\\n abi.encodeWithSignature(\\n \\\"updateValues(string[],string[])\\\",\\n keys,\\n values\\n ),\\n Enum.Operation.Call\\n );\\n }\\n\\n function _processAdminHat(\\n IHats hatsProtocol,\\n IERC6551Registry erc6551Registry,\\n address hatsAccountImplementation,\\n uint256 topHatId,\\n address topHatAccount,\\n ModuleProxyFactory moduleProxyFactory,\\n address decentAutonomousAdminImplementation,\\n AdminHatParams calldata adminHat\\n ) internal returns (uint256 adminHatId) {\\n // Create Admin Hat\\n adminHatId = hatsProtocol.getNextId(topHatId);\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"createHat(uint256,string,uint32,address,address,bool,string)\\\",\\n topHatId,\\n adminHat.details,\\n 1, // only one Admin Hat\\n topHatAccount,\\n topHatAccount,\\n adminHat.isMutable,\\n adminHat.imageURI\\n ),\\n Enum.Operation.Call\\n );\\n\\n // Create Admin Hat's ERC6551 Account\\n erc6551Registry.createAccount(\\n hatsAccountImplementation,\\n SALT,\\n block.chainid,\\n address(hatsProtocol),\\n adminHatId\\n );\\n\\n // Deploy Decent Autonomous Admin Module, which will wear the Admin Hat\\n address autonomousAdmin = moduleProxyFactory.deployModule(\\n decentAutonomousAdminImplementation,\\n abi.encodeWithSignature(\\\"setUp(bytes)\\\", bytes(\\\"\\\")),\\n uint256(\\n keccak256(\\n abi.encodePacked(\\n // for the salt, we'll concatenate our static salt\\n // with the Admin Hat ID\\n SALT,\\n adminHatId\\n )\\n )\\n )\\n );\\n\\n // Mint Hat to the Decent Autonomous Admin Module\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"mintHat(uint256,address)\\\",\\n adminHatId,\\n autonomousAdmin\\n ),\\n Enum.Operation.Call\\n );\\n }\\n}\\n\",\"keccak256\":\"0x0d952c31bdbe70343c618cdab6930200c3064eee26ccfb6913a94a2be635dd41\",\"license\":\"MIT\"},\"contracts/modules/DecentHatsModuleUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.28;\\n\\nimport {Enum} from \\\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\\\";\\nimport {IAvatar} from \\\"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IERC6551Registry} from \\\"../interfaces/IERC6551Registry.sol\\\";\\nimport {IHats} from \\\"../interfaces/hats/IHats.sol\\\";\\nimport {LockupLinear, Broker} from \\\"../interfaces/sablier/types/DataTypes.sol\\\";\\nimport {IHatsModuleFactory} from \\\"../interfaces/hats/IHatsModuleFactory.sol\\\";\\nimport {ISablierV2LockupLinear} from \\\"../interfaces/sablier/ISablierV2LockupLinear.sol\\\";\\n\\nabstract contract DecentHatsModuleUtils {\\n bytes32 public constant SALT =\\n 0x5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b5072;\\n\\n struct SablierStreamParams {\\n ISablierV2LockupLinear sablier;\\n address sender;\\n address asset;\\n LockupLinear.Timestamps timestamps;\\n Broker broker;\\n uint128 totalAmount;\\n bool cancelable;\\n bool transferable;\\n }\\n\\n struct HatParams {\\n address wearer;\\n string details;\\n string imageURI;\\n SablierStreamParams[] sablierStreamsParams;\\n uint128 termEndDateTs; // If 0, this is an untermed Hat\\n uint32 maxSupply;\\n bool isMutable;\\n }\\n\\n struct CreateRoleHatsParams {\\n IHats hatsProtocol;\\n IERC6551Registry erc6551Registry;\\n address hatsAccountImplementation;\\n uint256 topHatId;\\n address topHatAccount;\\n IHatsModuleFactory hatsModuleFactory;\\n address hatsElectionsEligibilityImplementation;\\n uint256 adminHatId;\\n HatParams[] hats;\\n }\\n\\n function _processRoleHats(\\n CreateRoleHatsParams memory roleHatsParams\\n ) internal {\\n for (uint256 i = 0; i < roleHatsParams.hats.length; ) {\\n HatParams memory hatParams = roleHatsParams.hats[i];\\n\\n // Create eligibility module if needed\\n address eligibilityAddress = _createEligibilityModule(\\n roleHatsParams.hatsProtocol,\\n roleHatsParams.hatsModuleFactory,\\n roleHatsParams.hatsElectionsEligibilityImplementation,\\n roleHatsParams.topHatId,\\n roleHatsParams.topHatAccount,\\n roleHatsParams.adminHatId,\\n hatParams.termEndDateTs\\n );\\n\\n // Create and Mint the Role Hat\\n uint256 hatId = _createAndMintHat(\\n roleHatsParams.hatsProtocol,\\n roleHatsParams.adminHatId,\\n hatParams,\\n eligibilityAddress,\\n roleHatsParams.topHatAccount\\n );\\n\\n // Get the stream recipient (based on termed or not)\\n address streamRecipient = _setupStreamRecipient(\\n roleHatsParams.erc6551Registry,\\n roleHatsParams.hatsAccountImplementation,\\n address(roleHatsParams.hatsProtocol),\\n hatParams.termEndDateTs,\\n hatParams.wearer,\\n hatId\\n );\\n\\n // Create streams\\n _processSablierStreams(\\n hatParams.sablierStreamsParams,\\n streamRecipient\\n );\\n\\n unchecked {\\n ++i;\\n }\\n }\\n }\\n\\n function _createEligibilityModule(\\n IHats hatsProtocol,\\n IHatsModuleFactory hatsModuleFactory,\\n address hatsElectionsEligibilityImplementation,\\n uint256 topHatId,\\n address topHatAccount,\\n uint256 adminHatId,\\n uint128 termEndDateTs\\n ) private returns (address) {\\n // If the Hat is termed, create the eligibility module\\n if (termEndDateTs != 0) {\\n return\\n hatsModuleFactory.createHatsModule(\\n hatsElectionsEligibilityImplementation,\\n hatsProtocol.getNextId(adminHatId),\\n abi.encode(topHatId, uint256(0)), // [BALLOT_BOX_ID, ADMIN_HAT_ID]\\n abi.encode(termEndDateTs),\\n uint256(SALT)\\n );\\n }\\n\\n // Otherwise, return the Top Hat account\\n return topHatAccount;\\n }\\n\\n function _createAndMintHat(\\n IHats hatsProtocol,\\n uint256 adminHatId,\\n HatParams memory hat,\\n address eligibilityAddress,\\n address topHatAccount\\n ) private returns (uint256) {\\n // Grab the next Hat ID (before creating it)\\n uint256 hatId = hatsProtocol.getNextId(adminHatId);\\n\\n // Create the new Hat\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"createHat(uint256,string,uint32,address,address,bool,string)\\\",\\n adminHatId,\\n hat.details,\\n hat.maxSupply,\\n eligibilityAddress,\\n topHatAccount,\\n hat.isMutable,\\n hat.imageURI\\n ),\\n Enum.Operation.Call\\n );\\n\\n // If the Hat is termed, nominate the wearer as the eligible member\\n if (hat.termEndDateTs != 0) {\\n address[] memory nominatedWearers = new address[](1);\\n nominatedWearers[0] = hat.wearer;\\n\\n IAvatar(msg.sender).execTransactionFromModule(\\n eligibilityAddress,\\n 0,\\n abi.encodeWithSignature(\\n \\\"elect(uint128,address[])\\\",\\n hat.termEndDateTs,\\n nominatedWearers\\n ),\\n Enum.Operation.Call\\n );\\n }\\n\\n // Mint the Hat\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"mintHat(uint256,address)\\\",\\n hatId,\\n hat.wearer\\n ),\\n Enum.Operation.Call\\n );\\n return hatId;\\n }\\n\\n // Exists to avoid stack too deep errors\\n function _setupStreamRecipient(\\n IERC6551Registry erc6551Registry,\\n address hatsAccountImplementation,\\n address hatsProtocol,\\n uint128 termEndDateTs,\\n address wearer,\\n uint256 hatId\\n ) private returns (address) {\\n // If the hat is termed, the wearer is the stream recipient\\n if (termEndDateTs != 0) {\\n return wearer;\\n }\\n\\n // Otherwise, the Hat's smart account is the stream recipient\\n return\\n erc6551Registry.createAccount(\\n hatsAccountImplementation,\\n SALT,\\n block.chainid,\\n hatsProtocol,\\n hatId\\n );\\n }\\n\\n function _processSablierStreams(\\n SablierStreamParams[] memory streamParams,\\n address streamRecipient\\n ) private {\\n for (uint256 i = 0; i < streamParams.length; ) {\\n SablierStreamParams memory sablierStreamParams = streamParams[i];\\n\\n // Approve tokens for Sablier\\n IAvatar(msg.sender).execTransactionFromModule(\\n sablierStreamParams.asset,\\n 0,\\n abi.encodeWithSignature(\\n \\\"approve(address,uint256)\\\",\\n sablierStreamParams.sablier,\\n sablierStreamParams.totalAmount\\n ),\\n Enum.Operation.Call\\n );\\n\\n // Proxy the Sablier call through IAvatar\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(sablierStreamParams.sablier),\\n 0,\\n abi.encodeWithSignature(\\n \\\"createWithTimestamps((address,address,uint128,address,bool,bool,(uint40,uint40,uint40),(address,uint256)))\\\",\\n LockupLinear.CreateWithTimestamps({\\n sender: sablierStreamParams.sender,\\n recipient: streamRecipient,\\n totalAmount: sablierStreamParams.totalAmount,\\n asset: IERC20(sablierStreamParams.asset),\\n cancelable: sablierStreamParams.cancelable,\\n transferable: sablierStreamParams.transferable,\\n timestamps: sablierStreamParams.timestamps,\\n broker: sablierStreamParams.broker\\n })\\n ),\\n Enum.Operation.Call\\n );\\n\\n unchecked {\\n ++i;\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x357c5264ecb63f8f15f67ffb7498c7fb55d9efe8d46358790933b4892bd38cde\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x6080604052348015600f57600080fd5b50611eb88061001f6000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c8063ba9a91a51461003b578063d58041b714610062575b600080fd5b610050600080516020611e6383398151915281565b60405190815260200160405180910390f35b6100756100703660046112ff565b610077565b005b6000806100cd61008a6020850185611359565b61009a6040860160208701611359565b6100aa60e0870160c08801611359565b6100ba60a0880160808901611359565b6100c8610100890189611386565b610227565b909250905060006101396100e46020860186611359565b6100f46040870160208801611359565b61010460e0880160c08901611359565b868661011660808b0160608c01611359565b61012660c08c0160a08d01611359565b6101346101208d018d6113a6565b610603565b604080516101208101909152909150610221908061015a6020880188611359565b6001600160a01b0316815260200186602001602081019061017b9190611359565b6001600160a01b0316815260200161019960e0880160c08901611359565b6001600160a01b03168152602001858152602001846001600160a01b031681526020018660400160208101906101cf9190611359565b6001600160a01b031681526020016101ee610100880160e08901611359565b6001600160a01b03168152602081018490526040016102116101408801886113bc565b61021a9161175d565b905261099f565b50505050565b60408051600481526024810182526020810180516001600160e01b0316633f0f816960e21b17905290516000918291829182916001600160a01b038b169161026e916118bf565b6000604051808303816000865af19150503d80600081146102ab576040519150601f19603f3d011682016040523d82523d6000602084013e6102b0565b606091505b5091509150816103065760405162461bcd60e51b815260206004820152601a60248201527f4661696c656420746f20676574206c617374546f704861744964000000000000604482015260640160405180910390fd5b60e08180602001905181019061031c91906118d1565b610327906001611900565b901b93503363468721a78a60008361033f8a80611919565b61034c60208d018d611919565b604051602401610360959493929190611988565b60408051601f198184030181529181526020820180516001600160e01b0316631a64dfad60e01b1790525160e085901b6001600160e01b03191681526103ae939291906000906004016119f8565b6020604051808303816000875af11580156103cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103f19190611a4e565b50604051638a54c52f60e01b81526001600160a01b03891690638a54c52f90610434908a90600080516020611e638339815191529046908f908b90600401611a6b565b6020604051808303816000875af1158015610453573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104779190611a9e565b60408051600180825281830190925291945060009190816020015b606081526020019060019003908161049257505060408051600180825281830190925291925060009190602082015b60608152602001906001900390816104c1579050509050604051806040016040528060088152602001671d1bdc12185d125960c21b8152508260008151811061050c5761050c611abb565b602002602001018190525061052086610a66565b8160008151811061053357610533611abb565b6020026020010181905250336001600160a01b031663468721a78960008585604051602401610563929190611b2d565b60408051601f198184030181529181526020820180516001600160e01b031663579374b960e11b1790525160e085901b6001600160e01b03191681526105b1939291906000906004016119f8565b6020604051808303816000875af11580156105d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105f49190611a4e565b50505050509550959350505050565b60405162460ea360e61b8152600481018690526000906001600160a01b038a1690631183a8c090602401602060405180830381865afa15801561064a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061066e91906118d1565b90503363468721a78a6000896106848780611919565b60018c8061069860608d0160408e01611b5b565b6106a560208e018e611919565b6040516024016106bd99989796959493929190611b78565b60408051601f198184030181529181526020820180516001600160e01b0316635829492f60e11b1790525160e085901b6001600160e01b031916815261070b939291906000906004016119f8565b6020604051808303816000875af115801561072a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061074e9190611a4e565b50604051638a54c52f60e01b81526001600160a01b03891690638a54c52f90610791908a90600080516020611e638339815191529046908f908890600401611a6b565b6020604051808303816000875af11580156107b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107d49190611a9e565b506000846001600160a01b031663f1ab873c85604051806020016040528060008152506040516024016108079190611bdd565b60408051601f19818403018152918152602080830180516001600160e01b031663a4f9edbf60e01b179052905161085991600080516020611e6383398151915291899101918252602082015260400190565b60408051601f198184030181529082905280516020909101206001600160e01b031960e086901b168252610891939291600401611bf0565b6020604051808303816000875af11580156108b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108d49190611a9e565b604051602481018490526001600160a01b0382166044820152909150339063468721a7908c9060009060640160408051601f198184030181529181526020820180516001600160e01b031663320fbbb760e11b1790525160e085901b6001600160e01b031916815261094e939291906000906004016119f8565b6020604051808303816000875af115801561096d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109919190611a4e565b505098975050505050505050565b60005b81610100015151811015610a6257600082610100015182815181106109c9576109c9611abb565b602002602001015190506000610a0084600001518560a001518660c00151876060015188608001518960e001518860800151610b6e565b90506000610a1d85600001518660e0015185858960800151610cd5565b90506000610a438660200151876040015188600001518760800151886000015187611007565b9050610a538460600151826110b1565b846001019450505050506109a2565b5050565b606081600003610a8d5750506040805180820190915260018152600360fc1b602082015290565b8160005b8115610ab75780610aa181611c24565b9150610ab09050600a83611c53565b9150610a91565b6000816001600160401b03811115610ad157610ad161140c565b6040519080825280601f01601f191660200182016040528015610afb576020820181803683370190505b5090505b8415610b6657610b10600183611c67565b9150610b1d600a86611c7a565b610b28906030611900565b60f81b818381518110610b3d57610b3d611abb565b60200101906001600160f81b031916908160001a905350610b5f600a86611c53565b9450610aff565b949350505050565b60006001600160801b03821615610cc757866001600160a01b0316632f7fb7b6878a6001600160a01b0316631183a8c0876040518263ffffffff1660e01b8152600401610bbd91815260200190565b602060405180830381865afa158015610bda573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bfe91906118d1565b886000604051602001610c1b929190918252602082015260400190565b60408051601f198184030181528282526001600160801b0389166020840152910160408051601f19818403018152908290526001600160e01b031960e087901b168252610c7d94939291600080516020611e6383398151915290600401611c8e565b6020604051808303816000875af1158015610c9c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cc09190611a9e565b9050610cca565b50825b979650505050505050565b60405162460ea360e61b81526004810185905260009081906001600160a01b03881690631183a8c090602401602060405180830381865afa158015610d1e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d4291906118d1565b9050336001600160a01b031663468721a78860008989602001518a60a001518a8a8d60c001518e60400151604051602401610d839796959493929190611cda565b60408051601f198184030181529181526020820180516001600160e01b0316635829492f60e11b1790525160e085901b6001600160e01b0319168152610dd1939291906000906004016119f8565b6020604051808303816000875af1158015610df0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e149190611a4e565b5060808501516001600160801b031615610f3f5760408051600180825281830190925260009160208083019080368337019050509050856000015181600081518110610e6257610e62611abb565b60200260200101906001600160a01b031690816001600160a01b031681525050336001600160a01b031663468721a7866000896080015185604051602401610eab929190611d3e565b60408051601f198184030181529181526020820180516001600160e01b0316634a231cef60e01b1790525160e085901b6001600160e01b0319168152610ef9939291906000906004016119f8565b6020604051808303816000875af1158015610f18573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f3c9190611a4e565b50505b8451604051602481018390526001600160a01b039091166044820152339063468721a790899060009060640160408051601f198184030181529181526020820180516001600160e01b031663320fbbb760e11b1790525160e085901b6001600160e01b0319168152610fb9939291906000906004016119f8565b6020604051808303816000875af1158015610fd8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ffc9190611a4e565b509695505050505050565b60006001600160801b0384161561101f5750816110a7565b604051638a54c52f60e01b81526001600160a01b03881690638a54c52f90611061908990600080516020611e638339815191529046908b908990600401611a6b565b6020604051808303816000875af1158015611080573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110a49190611a9e565b90505b9695505050505050565b60005b82518110156112fa5760008382815181106110d1576110d1611abb565b60200260200101519050336001600160a01b031663468721a78260400151600084600001518560a001516040516024016111299291906001600160a01b039290921682526001600160801b0316602082015260400190565b60408051601f198184030181529181526020820180516001600160e01b031663095ea7b360e01b1790525160e085901b6001600160e01b0319168152611177939291906000906004016119f8565b6020604051808303816000875af1158015611196573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111ba9190611a4e565b50336001600160a01b031663468721a78260000151600060405180610100016040528086602001516001600160a01b03168152602001886001600160a01b031681526020018660a001516001600160801b0316815260200186604001516001600160a01b031681526020018660c00151151581526020018660e001511515815260200186606001518152602001866080015181525060405160240161125f9190611d93565b60408051601f198184030181529181526020820180516001600160e01b03166353b1572760e01b1790525160e085901b6001600160e01b03191681526112ad939291906000906004016119f8565b6020604051808303816000875af11580156112cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112f09190611a4e565b50506001016110b4565b505050565b60006020828403121561131157600080fd5b81356001600160401b0381111561132757600080fd5b8201610160818503121561133a57600080fd5b9392505050565b6001600160a01b038116811461135657600080fd5b50565b60006020828403121561136b57600080fd5b813561133a81611341565b803561138181611341565b919050565b60008235603e1983360301811261139c57600080fd5b9190910192915050565b60008235605e1983360301811261139c57600080fd5b6000808335601e198436030181126113d357600080fd5b8301803591506001600160401b038211156113ed57600080fd5b6020019150600581901b360382131561140557600080fd5b9250929050565b634e487b7160e01b600052604160045260246000fd5b60405161010081016001600160401b03811182821017156114455761144561140c565b60405290565b60405160e081016001600160401b03811182821017156114455761144561140c565b604051601f8201601f191681016001600160401b03811182821017156114955761149561140c565b604052919050565b60006001600160401b038211156114b6576114b661140c565b5060051b60200190565b600082601f8301126114d157600080fd5b81356001600160401b038111156114ea576114ea61140c565b6114fd601f8201601f191660200161146d565b81815284602083860101111561151257600080fd5b816020850160208301376000918101602001919091529392505050565b803564ffffffffff8116811461138157600080fd5b60006060828403121561155657600080fd5b604051606081016001600160401b03811182821017156115785761157861140c565b6040529050806115878361152f565b81526115956020840161152f565b60208201526115a66040840161152f565b60408201525092915050565b6000604082840312156115c457600080fd5b604080519081016001600160401b03811182821017156115e6576115e661140c565b60405290508082356115f781611341565b8152602092830135920191909152919050565b80356001600160801b038116811461138157600080fd5b801515811461135657600080fd5b803561138181611621565b600082601f83011261164b57600080fd5b813561165e6116598261149d565b61146d565b808282526020820191506020610160840286010192508583111561168157600080fd5b602085015b8381101561173f57610160818803121561169f57600080fd5b6116a7611422565b6116b082611376565b81526116be60208301611376565b60208201526116cf60408301611376565b60408201526116e18860608401611544565b60608201526116f38860c084016115b2565b6080820152611705610100830161160a565b60a0820152611717610120830161162f565b60c0820152611729610140830161162f565b60e0820152835260209092019161016001611686565b5095945050505050565b803563ffffffff8116811461138157600080fd5b600061176b6116598461149d565b8381526020810190600585901b84013681111561178757600080fd5b845b818110156118905780356001600160401b038111156117a757600080fd5b860160e03682900312156117ba57600080fd5b6117c261144b565b6117cb82611376565b815260208201356001600160401b038111156117e657600080fd5b6117f2368285016114c0565b60208301525060408201356001600160401b0381111561181157600080fd5b61181d368285016114c0565b60408301525060608201356001600160401b0381111561183c57600080fd5b6118483682850161163a565b60608301525061185a6080830161160a565b608082015261186b60a08301611749565b60a082015261187c60c0830161162f565b60c082015285525060209384019301611789565b509095945050505050565b60005b838110156118b657818101518382015260200161189e565b50506000910152565b6000825161139c81846020870161189b565b6000602082840312156118e357600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b80820180821115611913576119136118ea565b92915050565b6000808335601e1984360301811261193057600080fd5b8301803591506001600160401b0382111561194a57600080fd5b60200191503681900382131561140557600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b03861681526060602082018190526000906119ad908301868861195f565b82810360408401526119c081858761195f565b98975050505050505050565b600081518084526119e481602086016020860161189b565b601f01601f19169290920160200192915050565b60018060a01b0385168152836020820152608060408201526000611a1f60808301856119cc565b905060028310611a3f57634e487b7160e01b600052602160045260246000fd5b82606083015295945050505050565b600060208284031215611a6057600080fd5b815161133a81611621565b6001600160a01b039586168152602081019490945260408401929092529092166060820152608081019190915260a00190565b600060208284031215611ab057600080fd5b815161133a81611341565b634e487b7160e01b600052603260045260246000fd5b600082825180855260208501945060208160051b8301016020850160005b83811015611b2157601f19858403018852611b0b8383516119cc565b6020988901989093509190910190600101611aef565b50909695505050505050565b604081526000611b406040830185611ad1565b8281036020840152611b528185611ad1565b95945050505050565b600060208284031215611b6d57600080fd5b813561133a81611621565b89815260e060208201526000611b9260e083018a8c61195f565b60ff891660408401526001600160a01b0388811660608501528716608084015285151560a084015282810360c0840152611bcd81858761195f565b9c9b505050505050505050505050565b60208152600061133a60208301846119cc565b6001600160a01b0384168152606060208201819052600090611c14908301856119cc565b9050826040830152949350505050565b600060018201611c3657611c366118ea565b5060010190565b634e487b7160e01b600052601260045260246000fd5b600082611c6257611c62611c3d565b500490565b81810381811115611913576119136118ea565b600082611c8957611c89611c3d565b500690565b60018060a01b038616815284602082015260a060408201526000611cb560a08301866119cc565b8281036060840152611cc781866119cc565b9150508260808301529695505050505050565b87815260e060208201526000611cf360e08301896119cc565b63ffffffff881660408401526001600160a01b0387811660608501528616608084015284151560a084015282810360c0840152611d3081856119cc565b9a9950505050505050505050565b6000604082016001600160801b03851683526040602084015280845180835260608501915060208601925060005b81811015611b215783516001600160a01b0316835260209384019390920191600101611d6c565b81516001600160a01b0390811682526020808401518216908301526040808401516001600160801b03169083015260608084015191821690830152610160820190506080830151611de8608084018215159052565b5060a0830151611dfc60a084018215159052565b5060c0830151611e3b60c084018264ffffffffff815116825264ffffffffff602082015116602083015264ffffffffff60408201511660408301525050565b5060e0929092015180516001600160a01b031661012083015260200151610140909101529056fe5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b5072a26469706673582212201f5f415bcb47b5bcc3f3fe15fa8e4612de722a3ea1aaa69d546320c040c561ba64736f6c634300081c0033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100365760003560e01c8063ba9a91a51461003b578063d58041b714610062575b600080fd5b610050600080516020611e6383398151915281565b60405190815260200160405180910390f35b6100756100703660046112ff565b610077565b005b6000806100cd61008a6020850185611359565b61009a6040860160208701611359565b6100aa60e0870160c08801611359565b6100ba60a0880160808901611359565b6100c8610100890189611386565b610227565b909250905060006101396100e46020860186611359565b6100f46040870160208801611359565b61010460e0880160c08901611359565b868661011660808b0160608c01611359565b61012660c08c0160a08d01611359565b6101346101208d018d6113a6565b610603565b604080516101208101909152909150610221908061015a6020880188611359565b6001600160a01b0316815260200186602001602081019061017b9190611359565b6001600160a01b0316815260200161019960e0880160c08901611359565b6001600160a01b03168152602001858152602001846001600160a01b031681526020018660400160208101906101cf9190611359565b6001600160a01b031681526020016101ee610100880160e08901611359565b6001600160a01b03168152602081018490526040016102116101408801886113bc565b61021a9161175d565b905261099f565b50505050565b60408051600481526024810182526020810180516001600160e01b0316633f0f816960e21b17905290516000918291829182916001600160a01b038b169161026e916118bf565b6000604051808303816000865af19150503d80600081146102ab576040519150601f19603f3d011682016040523d82523d6000602084013e6102b0565b606091505b5091509150816103065760405162461bcd60e51b815260206004820152601a60248201527f4661696c656420746f20676574206c617374546f704861744964000000000000604482015260640160405180910390fd5b60e08180602001905181019061031c91906118d1565b610327906001611900565b901b93503363468721a78a60008361033f8a80611919565b61034c60208d018d611919565b604051602401610360959493929190611988565b60408051601f198184030181529181526020820180516001600160e01b0316631a64dfad60e01b1790525160e085901b6001600160e01b03191681526103ae939291906000906004016119f8565b6020604051808303816000875af11580156103cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103f19190611a4e565b50604051638a54c52f60e01b81526001600160a01b03891690638a54c52f90610434908a90600080516020611e638339815191529046908f908b90600401611a6b565b6020604051808303816000875af1158015610453573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104779190611a9e565b60408051600180825281830190925291945060009190816020015b606081526020019060019003908161049257505060408051600180825281830190925291925060009190602082015b60608152602001906001900390816104c1579050509050604051806040016040528060088152602001671d1bdc12185d125960c21b8152508260008151811061050c5761050c611abb565b602002602001018190525061052086610a66565b8160008151811061053357610533611abb565b6020026020010181905250336001600160a01b031663468721a78960008585604051602401610563929190611b2d565b60408051601f198184030181529181526020820180516001600160e01b031663579374b960e11b1790525160e085901b6001600160e01b03191681526105b1939291906000906004016119f8565b6020604051808303816000875af11580156105d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105f49190611a4e565b50505050509550959350505050565b60405162460ea360e61b8152600481018690526000906001600160a01b038a1690631183a8c090602401602060405180830381865afa15801561064a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061066e91906118d1565b90503363468721a78a6000896106848780611919565b60018c8061069860608d0160408e01611b5b565b6106a560208e018e611919565b6040516024016106bd99989796959493929190611b78565b60408051601f198184030181529181526020820180516001600160e01b0316635829492f60e11b1790525160e085901b6001600160e01b031916815261070b939291906000906004016119f8565b6020604051808303816000875af115801561072a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061074e9190611a4e565b50604051638a54c52f60e01b81526001600160a01b03891690638a54c52f90610791908a90600080516020611e638339815191529046908f908890600401611a6b565b6020604051808303816000875af11580156107b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107d49190611a9e565b506000846001600160a01b031663f1ab873c85604051806020016040528060008152506040516024016108079190611bdd565b60408051601f19818403018152918152602080830180516001600160e01b031663a4f9edbf60e01b179052905161085991600080516020611e6383398151915291899101918252602082015260400190565b60408051601f198184030181529082905280516020909101206001600160e01b031960e086901b168252610891939291600401611bf0565b6020604051808303816000875af11580156108b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108d49190611a9e565b604051602481018490526001600160a01b0382166044820152909150339063468721a7908c9060009060640160408051601f198184030181529181526020820180516001600160e01b031663320fbbb760e11b1790525160e085901b6001600160e01b031916815261094e939291906000906004016119f8565b6020604051808303816000875af115801561096d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109919190611a4e565b505098975050505050505050565b60005b81610100015151811015610a6257600082610100015182815181106109c9576109c9611abb565b602002602001015190506000610a0084600001518560a001518660c00151876060015188608001518960e001518860800151610b6e565b90506000610a1d85600001518660e0015185858960800151610cd5565b90506000610a438660200151876040015188600001518760800151886000015187611007565b9050610a538460600151826110b1565b846001019450505050506109a2565b5050565b606081600003610a8d5750506040805180820190915260018152600360fc1b602082015290565b8160005b8115610ab75780610aa181611c24565b9150610ab09050600a83611c53565b9150610a91565b6000816001600160401b03811115610ad157610ad161140c565b6040519080825280601f01601f191660200182016040528015610afb576020820181803683370190505b5090505b8415610b6657610b10600183611c67565b9150610b1d600a86611c7a565b610b28906030611900565b60f81b818381518110610b3d57610b3d611abb565b60200101906001600160f81b031916908160001a905350610b5f600a86611c53565b9450610aff565b949350505050565b60006001600160801b03821615610cc757866001600160a01b0316632f7fb7b6878a6001600160a01b0316631183a8c0876040518263ffffffff1660e01b8152600401610bbd91815260200190565b602060405180830381865afa158015610bda573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bfe91906118d1565b886000604051602001610c1b929190918252602082015260400190565b60408051601f198184030181528282526001600160801b0389166020840152910160408051601f19818403018152908290526001600160e01b031960e087901b168252610c7d94939291600080516020611e6383398151915290600401611c8e565b6020604051808303816000875af1158015610c9c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cc09190611a9e565b9050610cca565b50825b979650505050505050565b60405162460ea360e61b81526004810185905260009081906001600160a01b03881690631183a8c090602401602060405180830381865afa158015610d1e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d4291906118d1565b9050336001600160a01b031663468721a78860008989602001518a60a001518a8a8d60c001518e60400151604051602401610d839796959493929190611cda565b60408051601f198184030181529181526020820180516001600160e01b0316635829492f60e11b1790525160e085901b6001600160e01b0319168152610dd1939291906000906004016119f8565b6020604051808303816000875af1158015610df0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e149190611a4e565b5060808501516001600160801b031615610f3f5760408051600180825281830190925260009160208083019080368337019050509050856000015181600081518110610e6257610e62611abb565b60200260200101906001600160a01b031690816001600160a01b031681525050336001600160a01b031663468721a7866000896080015185604051602401610eab929190611d3e565b60408051601f198184030181529181526020820180516001600160e01b0316634a231cef60e01b1790525160e085901b6001600160e01b0319168152610ef9939291906000906004016119f8565b6020604051808303816000875af1158015610f18573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f3c9190611a4e565b50505b8451604051602481018390526001600160a01b039091166044820152339063468721a790899060009060640160408051601f198184030181529181526020820180516001600160e01b031663320fbbb760e11b1790525160e085901b6001600160e01b0319168152610fb9939291906000906004016119f8565b6020604051808303816000875af1158015610fd8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ffc9190611a4e565b509695505050505050565b60006001600160801b0384161561101f5750816110a7565b604051638a54c52f60e01b81526001600160a01b03881690638a54c52f90611061908990600080516020611e638339815191529046908b908990600401611a6b565b6020604051808303816000875af1158015611080573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110a49190611a9e565b90505b9695505050505050565b60005b82518110156112fa5760008382815181106110d1576110d1611abb565b60200260200101519050336001600160a01b031663468721a78260400151600084600001518560a001516040516024016111299291906001600160a01b039290921682526001600160801b0316602082015260400190565b60408051601f198184030181529181526020820180516001600160e01b031663095ea7b360e01b1790525160e085901b6001600160e01b0319168152611177939291906000906004016119f8565b6020604051808303816000875af1158015611196573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111ba9190611a4e565b50336001600160a01b031663468721a78260000151600060405180610100016040528086602001516001600160a01b03168152602001886001600160a01b031681526020018660a001516001600160801b0316815260200186604001516001600160a01b031681526020018660c00151151581526020018660e001511515815260200186606001518152602001866080015181525060405160240161125f9190611d93565b60408051601f198184030181529181526020820180516001600160e01b03166353b1572760e01b1790525160e085901b6001600160e01b03191681526112ad939291906000906004016119f8565b6020604051808303816000875af11580156112cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112f09190611a4e565b50506001016110b4565b505050565b60006020828403121561131157600080fd5b81356001600160401b0381111561132757600080fd5b8201610160818503121561133a57600080fd5b9392505050565b6001600160a01b038116811461135657600080fd5b50565b60006020828403121561136b57600080fd5b813561133a81611341565b803561138181611341565b919050565b60008235603e1983360301811261139c57600080fd5b9190910192915050565b60008235605e1983360301811261139c57600080fd5b6000808335601e198436030181126113d357600080fd5b8301803591506001600160401b038211156113ed57600080fd5b6020019150600581901b360382131561140557600080fd5b9250929050565b634e487b7160e01b600052604160045260246000fd5b60405161010081016001600160401b03811182821017156114455761144561140c565b60405290565b60405160e081016001600160401b03811182821017156114455761144561140c565b604051601f8201601f191681016001600160401b03811182821017156114955761149561140c565b604052919050565b60006001600160401b038211156114b6576114b661140c565b5060051b60200190565b600082601f8301126114d157600080fd5b81356001600160401b038111156114ea576114ea61140c565b6114fd601f8201601f191660200161146d565b81815284602083860101111561151257600080fd5b816020850160208301376000918101602001919091529392505050565b803564ffffffffff8116811461138157600080fd5b60006060828403121561155657600080fd5b604051606081016001600160401b03811182821017156115785761157861140c565b6040529050806115878361152f565b81526115956020840161152f565b60208201526115a66040840161152f565b60408201525092915050565b6000604082840312156115c457600080fd5b604080519081016001600160401b03811182821017156115e6576115e661140c565b60405290508082356115f781611341565b8152602092830135920191909152919050565b80356001600160801b038116811461138157600080fd5b801515811461135657600080fd5b803561138181611621565b600082601f83011261164b57600080fd5b813561165e6116598261149d565b61146d565b808282526020820191506020610160840286010192508583111561168157600080fd5b602085015b8381101561173f57610160818803121561169f57600080fd5b6116a7611422565b6116b082611376565b81526116be60208301611376565b60208201526116cf60408301611376565b60408201526116e18860608401611544565b60608201526116f38860c084016115b2565b6080820152611705610100830161160a565b60a0820152611717610120830161162f565b60c0820152611729610140830161162f565b60e0820152835260209092019161016001611686565b5095945050505050565b803563ffffffff8116811461138157600080fd5b600061176b6116598461149d565b8381526020810190600585901b84013681111561178757600080fd5b845b818110156118905780356001600160401b038111156117a757600080fd5b860160e03682900312156117ba57600080fd5b6117c261144b565b6117cb82611376565b815260208201356001600160401b038111156117e657600080fd5b6117f2368285016114c0565b60208301525060408201356001600160401b0381111561181157600080fd5b61181d368285016114c0565b60408301525060608201356001600160401b0381111561183c57600080fd5b6118483682850161163a565b60608301525061185a6080830161160a565b608082015261186b60a08301611749565b60a082015261187c60c0830161162f565b60c082015285525060209384019301611789565b509095945050505050565b60005b838110156118b657818101518382015260200161189e565b50506000910152565b6000825161139c81846020870161189b565b6000602082840312156118e357600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b80820180821115611913576119136118ea565b92915050565b6000808335601e1984360301811261193057600080fd5b8301803591506001600160401b0382111561194a57600080fd5b60200191503681900382131561140557600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b03861681526060602082018190526000906119ad908301868861195f565b82810360408401526119c081858761195f565b98975050505050505050565b600081518084526119e481602086016020860161189b565b601f01601f19169290920160200192915050565b60018060a01b0385168152836020820152608060408201526000611a1f60808301856119cc565b905060028310611a3f57634e487b7160e01b600052602160045260246000fd5b82606083015295945050505050565b600060208284031215611a6057600080fd5b815161133a81611621565b6001600160a01b039586168152602081019490945260408401929092529092166060820152608081019190915260a00190565b600060208284031215611ab057600080fd5b815161133a81611341565b634e487b7160e01b600052603260045260246000fd5b600082825180855260208501945060208160051b8301016020850160005b83811015611b2157601f19858403018852611b0b8383516119cc565b6020988901989093509190910190600101611aef565b50909695505050505050565b604081526000611b406040830185611ad1565b8281036020840152611b528185611ad1565b95945050505050565b600060208284031215611b6d57600080fd5b813561133a81611621565b89815260e060208201526000611b9260e083018a8c61195f565b60ff891660408401526001600160a01b0388811660608501528716608084015285151560a084015282810360c0840152611bcd81858761195f565b9c9b505050505050505050505050565b60208152600061133a60208301846119cc565b6001600160a01b0384168152606060208201819052600090611c14908301856119cc565b9050826040830152949350505050565b600060018201611c3657611c366118ea565b5060010190565b634e487b7160e01b600052601260045260246000fd5b600082611c6257611c62611c3d565b500490565b81810381811115611913576119136118ea565b600082611c8957611c89611c3d565b500690565b60018060a01b038616815284602082015260a060408201526000611cb560a08301866119cc565b8281036060840152611cc781866119cc565b9150508260808301529695505050505050565b87815260e060208201526000611cf360e08301896119cc565b63ffffffff881660408401526001600160a01b0387811660608501528616608084015284151560a084015282810360c0840152611d3081856119cc565b9a9950505050505050505050565b6000604082016001600160801b03851683526040602084015280845180835260608501915060208601925060005b81811015611b215783516001600160a01b0316835260209384019390920191600101611d6c565b81516001600160a01b0390811682526020808401518216908301526040808401516001600160801b03169083015260608084015191821690830152610160820190506080830151611de8608084018215159052565b5060a0830151611dfc60a084018215159052565b5060c0830151611e3b60c084018264ffffffffff815116825264ffffffffff602082015116602083015264ffffffffff60408201511660408301525050565b5060e0929092015180516001600160a01b031661012083015260200151610140909101529056fe5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b5072a26469706673582212201f5f415bcb47b5bcc3f3fe15fa8e4612de722a3ea1aaa69d546320c040c561ba64736f6c634300081c0033", + "numDeployments": 2, + "solcInputHash": "f1fca9a70591742a2aedd10e2fd7e744", + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"SALT\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"contract IHats\",\"name\":\"hatsProtocol\",\"type\":\"address\"},{\"internalType\":\"contract IERC6551Registry\",\"name\":\"erc6551Registry\",\"type\":\"address\"},{\"internalType\":\"contract IHatsModuleFactory\",\"name\":\"hatsModuleFactory\",\"type\":\"address\"},{\"internalType\":\"contract ModuleProxyFactory\",\"name\":\"moduleProxyFactory\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"keyValuePairs\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"decentAutonomousAdminImplementation\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"hatsAccountImplementation\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"hatsElectionsEligibilityImplementation\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"string\",\"name\":\"details\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"imageURI\",\"type\":\"string\"}],\"internalType\":\"struct DecentHatsCreationModule.TopHatParams\",\"name\":\"topHat\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"string\",\"name\":\"details\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"imageURI\",\"type\":\"string\"},{\"internalType\":\"bool\",\"name\":\"isMutable\",\"type\":\"bool\"}],\"internalType\":\"struct DecentHatsCreationModule.AdminHatParams\",\"name\":\"adminHat\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"wearer\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"details\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"imageURI\",\"type\":\"string\"},{\"components\":[{\"internalType\":\"contract ISablierV2LockupLinear\",\"name\":\"sablier\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint40\",\"name\":\"start\",\"type\":\"uint40\"},{\"internalType\":\"uint40\",\"name\":\"cliff\",\"type\":\"uint40\"},{\"internalType\":\"uint40\",\"name\":\"end\",\"type\":\"uint40\"}],\"internalType\":\"struct LockupLinear.Timestamps\",\"name\":\"timestamps\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"UD60x18\",\"name\":\"fee\",\"type\":\"uint256\"}],\"internalType\":\"struct Broker\",\"name\":\"broker\",\"type\":\"tuple\"},{\"internalType\":\"uint128\",\"name\":\"totalAmount\",\"type\":\"uint128\"},{\"internalType\":\"bool\",\"name\":\"cancelable\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"transferable\",\"type\":\"bool\"}],\"internalType\":\"struct DecentHatsModuleUtils.SablierStreamParams[]\",\"name\":\"sablierStreamsParams\",\"type\":\"tuple[]\"},{\"internalType\":\"uint128\",\"name\":\"termEndDateTs\",\"type\":\"uint128\"},{\"internalType\":\"uint32\",\"name\":\"maxSupply\",\"type\":\"uint32\"},{\"internalType\":\"bool\",\"name\":\"isMutable\",\"type\":\"bool\"}],\"internalType\":\"struct DecentHatsModuleUtils.HatParams[]\",\"name\":\"hats\",\"type\":\"tuple[]\"}],\"internalType\":\"struct DecentHatsCreationModule.CreateTreeParams\",\"name\":\"treeParams\",\"type\":\"tuple\"}],\"name\":\"createAndDeclareTree\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"createAndDeclareTree((address,address,address,address,address,address,address,address,(string,string),(string,string,bool),(address,string,string,(address,address,address,(uint40,uint40,uint40),(address,uint256),uint128,bool,bool)[],uint128,uint32,bool)[]))\":{\"details\":\"For each hat that is included, if the hat is: - termed, its stream funds on are targeted directly at the nominated wearer. The wearer should directly call `withdraw-` on the Sablier contract. - untermed, its stream funds are targeted at the hat's smart account. In order to withdraw funds from the stream, the hat's smart account must be the one call to `withdraw-` on the Sablier contract, setting the recipient arg to its wearer.In order for a Safe to seamlessly create roles even if it has never previously created a role and thus has no hat tree, we defer the creation of the hat tree and its setup to this contract. This way, in a single tx block, the resulting topHatId of the newly created hat can be used to create an admin hat and any other hats needed. We also make use of `KeyValuePairs` to associate the topHatId with the Safe.\",\"params\":{\"treeParams\":\"The parameters for creating the Hat Tree with Roles\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"createAndDeclareTree((address,address,address,address,address,address,address,address,(string,string),(string,string,bool),(address,string,string,(address,address,address,(uint40,uint40,uint40),(address,uint256),uint128,bool,bool)[],uint128,uint32,bool)[]))\":{\"notice\":\"For a safe without any roles previously created on it, this function should be called. It sets up the top hat and admin hat, as well as any other hats and their streams that are provided, then transfers the top hat to the calling safe.This contract should be enabled a module on the Safe for which the role(s) are to be created, and disabled after.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/modules/DecentHatsCreationModule.sol\":\"DecentHatsCreationModule\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\npragma solidity >=0.7.0 <0.9.0;\\n\\n/// @title Enum - Collection of enums\\n/// @author Richard Meissner - \\ncontract Enum {\\n enum Operation {Call, DelegateCall}\\n}\\n\",\"keccak256\":\"0x473e45b1a5cc47be494b0e123c9127f0c11c1e0992a321ae5a644c0bfdb2c14f\",\"license\":\"LGPL-3.0-only\"},\"@gnosis.pm/zodiac/contracts/factory/ModuleProxyFactory.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\npragma solidity >=0.8.0;\\n\\ncontract ModuleProxyFactory {\\n event ModuleProxyCreation(\\n address indexed proxy,\\n address indexed masterCopy\\n );\\n\\n /// `target` can not be zero.\\n error ZeroAddress(address target);\\n\\n /// `address_` is already taken.\\n error TakenAddress(address address_);\\n\\n /// @notice Initialization failed.\\n error FailedInitialization();\\n\\n function createProxy(address target, bytes32 salt)\\n internal\\n returns (address result)\\n {\\n if (address(target) == address(0)) revert ZeroAddress(target);\\n bytes memory deployment = abi.encodePacked(\\n hex\\\"602d8060093d393df3363d3d373d3d3d363d73\\\",\\n target,\\n hex\\\"5af43d82803e903d91602b57fd5bf3\\\"\\n );\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n result := create2(0, add(deployment, 0x20), mload(deployment), salt)\\n }\\n if (result == address(0)) revert TakenAddress(result);\\n }\\n\\n function deployModule(\\n address masterCopy,\\n bytes memory initializer,\\n uint256 saltNonce\\n ) public returns (address proxy) {\\n proxy = createProxy(\\n masterCopy,\\n keccak256(abi.encodePacked(keccak256(initializer), saltNonce))\\n );\\n (bool success, ) = proxy.call(initializer);\\n if (!success) revert FailedInitialization();\\n\\n emit ModuleProxyCreation(proxy, masterCopy);\\n }\\n}\\n\",\"keccak256\":\"0x70f6f1d88cf3382748e58f85ba87279f5bb8761863c293dd8c197a71ff558761\",\"license\":\"LGPL-3.0-only\"},\"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\n\\n/// @title Zodiac Avatar - A contract that manages modules that can execute transactions via this contract.\\npragma solidity >=0.7.0 <0.9.0;\\n\\nimport \\\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\\\";\\n\\ninterface IAvatar {\\n event EnabledModule(address module);\\n event DisabledModule(address module);\\n event ExecutionFromModuleSuccess(address indexed module);\\n event ExecutionFromModuleFailure(address indexed module);\\n\\n /// @dev Enables a module on the avatar.\\n /// @notice Can only be called by the avatar.\\n /// @notice Modules should be stored as a linked list.\\n /// @notice Must emit EnabledModule(address module) if successful.\\n /// @param module Module to be enabled.\\n function enableModule(address module) external;\\n\\n /// @dev Disables a module on the avatar.\\n /// @notice Can only be called by the avatar.\\n /// @notice Must emit DisabledModule(address module) if successful.\\n /// @param prevModule Address that pointed to the module to be removed in the linked list\\n /// @param module Module to be removed.\\n function disableModule(address prevModule, address module) external;\\n\\n /// @dev Allows a Module to execute a transaction.\\n /// @notice Can only be called by an enabled module.\\n /// @notice Must emit ExecutionFromModuleSuccess(address module) if successful.\\n /// @notice Must emit ExecutionFromModuleFailure(address module) if unsuccessful.\\n /// @param to Destination address of module transaction.\\n /// @param value Ether value of module transaction.\\n /// @param data Data payload of module transaction.\\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\\n function execTransactionFromModule(\\n address to,\\n uint256 value,\\n bytes memory data,\\n Enum.Operation operation\\n ) external returns (bool success);\\n\\n /// @dev Allows a Module to execute a transaction and return data\\n /// @notice Can only be called by an enabled module.\\n /// @notice Must emit ExecutionFromModuleSuccess(address module) if successful.\\n /// @notice Must emit ExecutionFromModuleFailure(address module) if unsuccessful.\\n /// @param to Destination address of module transaction.\\n /// @param value Ether value of module transaction.\\n /// @param data Data payload of module transaction.\\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\\n function execTransactionFromModuleReturnData(\\n address to,\\n uint256 value,\\n bytes memory data,\\n Enum.Operation operation\\n ) external returns (bool success, bytes memory returnData);\\n\\n /// @dev Returns if an module is enabled\\n /// @return True if the module is enabled\\n function isModuleEnabled(address module) external view returns (bool);\\n\\n /// @dev Returns array of modules.\\n /// @param start Start of the page.\\n /// @param pageSize Maximum number of modules that should be returned.\\n /// @return array Array of modules.\\n /// @return next Start of the next page.\\n function getModulesPaginated(address start, uint256 pageSize)\\n external\\n view\\n returns (address[] memory array, address next);\\n}\\n\",\"keccak256\":\"0xcd5508ffe596eef8fbccfd5fc4f10a34397773547ce64e212d48b5212865ec1f\",\"license\":\"LGPL-3.0-only\"},\"@openzeppelin/contracts/interfaces/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/introspection/IERC165.sol\\\";\\n\",\"keccak256\":\"0xd04b0f06e0666f29cf7cccc82894de541e19bb30a765b107b1e40bb7fe5f7d7a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev 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 amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `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 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes calldata data\\n ) external;\\n\\n /**\\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 {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the caller.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool _approved) external;\\n\\n /**\\n * @dev Returns 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\",\"keccak256\":\"0xed6a749c5373af398105ce6ee3ac4763aa450ea7285d268c85d9eeca809cdb1f\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../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\",\"keccak256\":\"0x75b829ff2f26c14355d1cba20e16fe7b29ca58eb5fef665ede48bc0f9c6c74b9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _HEX_SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\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 // Inspired by OraclizeAPI's implementation - MIT licence\\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\\n\\n if (value == 0) {\\n return \\\"0\\\";\\n }\\n uint256 temp = value;\\n uint256 digits;\\n while (temp != 0) {\\n digits++;\\n temp /= 10;\\n }\\n bytes memory buffer = new bytes(digits);\\n while (value != 0) {\\n digits -= 1;\\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\\n value /= 10;\\n }\\n return string(buffer);\\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 if (value == 0) {\\n return \\\"0x00\\\";\\n }\\n uint256 temp = value;\\n uint256 length = 0;\\n while (temp != 0) {\\n length++;\\n temp >>= 8;\\n }\\n return toHexString(value, length);\\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 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_SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\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 representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n}\\n\",\"keccak256\":\"0xaf159a8b1923ad2a26d516089bceca9bdeaeacd04be50983ea00ba63070f08a3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"@prb/math/src/Common.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\n// Common.sol\\n//\\n// Common mathematical functions used in both SD59x18 and UD60x18. Note that these global functions do not\\n// always operate with SD59x18 and UD60x18 numbers.\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CUSTOM ERRORS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @notice Thrown when the resultant value in {mulDiv} overflows uint256.\\nerror PRBMath_MulDiv_Overflow(uint256 x, uint256 y, uint256 denominator);\\n\\n/// @notice Thrown when the resultant value in {mulDiv18} overflows uint256.\\nerror PRBMath_MulDiv18_Overflow(uint256 x, uint256 y);\\n\\n/// @notice Thrown when one of the inputs passed to {mulDivSigned} is `type(int256).min`.\\nerror PRBMath_MulDivSigned_InputTooSmall();\\n\\n/// @notice Thrown when the resultant value in {mulDivSigned} overflows int256.\\nerror PRBMath_MulDivSigned_Overflow(int256 x, int256 y);\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CONSTANTS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @dev The maximum value a uint128 number can have.\\nuint128 constant MAX_UINT128 = type(uint128).max;\\n\\n/// @dev The maximum value a uint40 number can have.\\nuint40 constant MAX_UINT40 = type(uint40).max;\\n\\n/// @dev The unit number, which the decimal precision of the fixed-point types.\\nuint256 constant UNIT = 1e18;\\n\\n/// @dev The unit number inverted mod 2^256.\\nuint256 constant UNIT_INVERSE = 78156646155174841979727994598816262306175212592076161876661_508869554232690281;\\n\\n/// @dev The the largest power of two that divides the decimal value of `UNIT`. The logarithm of this value is the least significant\\n/// bit in the binary representation of `UNIT`.\\nuint256 constant UNIT_LPOTD = 262144;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @notice Calculates the binary exponent of x using the binary fraction method.\\n/// @dev Has to use 192.64-bit fixed-point numbers. See https://ethereum.stackexchange.com/a/96594/24693.\\n/// @param x The exponent as an unsigned 192.64-bit fixed-point number.\\n/// @return result The result as an unsigned 60.18-decimal fixed-point number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp2(uint256 x) pure returns (uint256 result) {\\n unchecked {\\n // Start from 0.5 in the 192.64-bit fixed-point format.\\n result = 0x800000000000000000000000000000000000000000000000;\\n\\n // The following logic multiplies the result by $\\\\sqrt{2^{-i}}$ when the bit at position i is 1. Key points:\\n //\\n // 1. Intermediate results will not overflow, as the starting point is 2^191 and all magic factors are under 2^65.\\n // 2. The rationale for organizing the if statements into groups of 8 is gas savings. If the result of performing\\n // a bitwise AND operation between x and any value in the array [0x80; 0x40; 0x20; 0x10; 0x08; 0x04; 0x02; 0x01] is 1,\\n // we know that `x & 0xFF` is also 1.\\n if (x & 0xFF00000000000000 > 0) {\\n if (x & 0x8000000000000000 > 0) {\\n result = (result * 0x16A09E667F3BCC909) >> 64;\\n }\\n if (x & 0x4000000000000000 > 0) {\\n result = (result * 0x1306FE0A31B7152DF) >> 64;\\n }\\n if (x & 0x2000000000000000 > 0) {\\n result = (result * 0x1172B83C7D517ADCE) >> 64;\\n }\\n if (x & 0x1000000000000000 > 0) {\\n result = (result * 0x10B5586CF9890F62A) >> 64;\\n }\\n if (x & 0x800000000000000 > 0) {\\n result = (result * 0x1059B0D31585743AE) >> 64;\\n }\\n if (x & 0x400000000000000 > 0) {\\n result = (result * 0x102C9A3E778060EE7) >> 64;\\n }\\n if (x & 0x200000000000000 > 0) {\\n result = (result * 0x10163DA9FB33356D8) >> 64;\\n }\\n if (x & 0x100000000000000 > 0) {\\n result = (result * 0x100B1AFA5ABCBED61) >> 64;\\n }\\n }\\n\\n if (x & 0xFF000000000000 > 0) {\\n if (x & 0x80000000000000 > 0) {\\n result = (result * 0x10058C86DA1C09EA2) >> 64;\\n }\\n if (x & 0x40000000000000 > 0) {\\n result = (result * 0x1002C605E2E8CEC50) >> 64;\\n }\\n if (x & 0x20000000000000 > 0) {\\n result = (result * 0x100162F3904051FA1) >> 64;\\n }\\n if (x & 0x10000000000000 > 0) {\\n result = (result * 0x1000B175EFFDC76BA) >> 64;\\n }\\n if (x & 0x8000000000000 > 0) {\\n result = (result * 0x100058BA01FB9F96D) >> 64;\\n }\\n if (x & 0x4000000000000 > 0) {\\n result = (result * 0x10002C5CC37DA9492) >> 64;\\n }\\n if (x & 0x2000000000000 > 0) {\\n result = (result * 0x1000162E525EE0547) >> 64;\\n }\\n if (x & 0x1000000000000 > 0) {\\n result = (result * 0x10000B17255775C04) >> 64;\\n }\\n }\\n\\n if (x & 0xFF0000000000 > 0) {\\n if (x & 0x800000000000 > 0) {\\n result = (result * 0x1000058B91B5BC9AE) >> 64;\\n }\\n if (x & 0x400000000000 > 0) {\\n result = (result * 0x100002C5C89D5EC6D) >> 64;\\n }\\n if (x & 0x200000000000 > 0) {\\n result = (result * 0x10000162E43F4F831) >> 64;\\n }\\n if (x & 0x100000000000 > 0) {\\n result = (result * 0x100000B1721BCFC9A) >> 64;\\n }\\n if (x & 0x80000000000 > 0) {\\n result = (result * 0x10000058B90CF1E6E) >> 64;\\n }\\n if (x & 0x40000000000 > 0) {\\n result = (result * 0x1000002C5C863B73F) >> 64;\\n }\\n if (x & 0x20000000000 > 0) {\\n result = (result * 0x100000162E430E5A2) >> 64;\\n }\\n if (x & 0x10000000000 > 0) {\\n result = (result * 0x1000000B172183551) >> 64;\\n }\\n }\\n\\n if (x & 0xFF00000000 > 0) {\\n if (x & 0x8000000000 > 0) {\\n result = (result * 0x100000058B90C0B49) >> 64;\\n }\\n if (x & 0x4000000000 > 0) {\\n result = (result * 0x10000002C5C8601CC) >> 64;\\n }\\n if (x & 0x2000000000 > 0) {\\n result = (result * 0x1000000162E42FFF0) >> 64;\\n }\\n if (x & 0x1000000000 > 0) {\\n result = (result * 0x10000000B17217FBB) >> 64;\\n }\\n if (x & 0x800000000 > 0) {\\n result = (result * 0x1000000058B90BFCE) >> 64;\\n }\\n if (x & 0x400000000 > 0) {\\n result = (result * 0x100000002C5C85FE3) >> 64;\\n }\\n if (x & 0x200000000 > 0) {\\n result = (result * 0x10000000162E42FF1) >> 64;\\n }\\n if (x & 0x100000000 > 0) {\\n result = (result * 0x100000000B17217F8) >> 64;\\n }\\n }\\n\\n if (x & 0xFF000000 > 0) {\\n if (x & 0x80000000 > 0) {\\n result = (result * 0x10000000058B90BFC) >> 64;\\n }\\n if (x & 0x40000000 > 0) {\\n result = (result * 0x1000000002C5C85FE) >> 64;\\n }\\n if (x & 0x20000000 > 0) {\\n result = (result * 0x100000000162E42FF) >> 64;\\n }\\n if (x & 0x10000000 > 0) {\\n result = (result * 0x1000000000B17217F) >> 64;\\n }\\n if (x & 0x8000000 > 0) {\\n result = (result * 0x100000000058B90C0) >> 64;\\n }\\n if (x & 0x4000000 > 0) {\\n result = (result * 0x10000000002C5C860) >> 64;\\n }\\n if (x & 0x2000000 > 0) {\\n result = (result * 0x1000000000162E430) >> 64;\\n }\\n if (x & 0x1000000 > 0) {\\n result = (result * 0x10000000000B17218) >> 64;\\n }\\n }\\n\\n if (x & 0xFF0000 > 0) {\\n if (x & 0x800000 > 0) {\\n result = (result * 0x1000000000058B90C) >> 64;\\n }\\n if (x & 0x400000 > 0) {\\n result = (result * 0x100000000002C5C86) >> 64;\\n }\\n if (x & 0x200000 > 0) {\\n result = (result * 0x10000000000162E43) >> 64;\\n }\\n if (x & 0x100000 > 0) {\\n result = (result * 0x100000000000B1721) >> 64;\\n }\\n if (x & 0x80000 > 0) {\\n result = (result * 0x10000000000058B91) >> 64;\\n }\\n if (x & 0x40000 > 0) {\\n result = (result * 0x1000000000002C5C8) >> 64;\\n }\\n if (x & 0x20000 > 0) {\\n result = (result * 0x100000000000162E4) >> 64;\\n }\\n if (x & 0x10000 > 0) {\\n result = (result * 0x1000000000000B172) >> 64;\\n }\\n }\\n\\n if (x & 0xFF00 > 0) {\\n if (x & 0x8000 > 0) {\\n result = (result * 0x100000000000058B9) >> 64;\\n }\\n if (x & 0x4000 > 0) {\\n result = (result * 0x10000000000002C5D) >> 64;\\n }\\n if (x & 0x2000 > 0) {\\n result = (result * 0x1000000000000162E) >> 64;\\n }\\n if (x & 0x1000 > 0) {\\n result = (result * 0x10000000000000B17) >> 64;\\n }\\n if (x & 0x800 > 0) {\\n result = (result * 0x1000000000000058C) >> 64;\\n }\\n if (x & 0x400 > 0) {\\n result = (result * 0x100000000000002C6) >> 64;\\n }\\n if (x & 0x200 > 0) {\\n result = (result * 0x10000000000000163) >> 64;\\n }\\n if (x & 0x100 > 0) {\\n result = (result * 0x100000000000000B1) >> 64;\\n }\\n }\\n\\n if (x & 0xFF > 0) {\\n if (x & 0x80 > 0) {\\n result = (result * 0x10000000000000059) >> 64;\\n }\\n if (x & 0x40 > 0) {\\n result = (result * 0x1000000000000002C) >> 64;\\n }\\n if (x & 0x20 > 0) {\\n result = (result * 0x10000000000000016) >> 64;\\n }\\n if (x & 0x10 > 0) {\\n result = (result * 0x1000000000000000B) >> 64;\\n }\\n if (x & 0x8 > 0) {\\n result = (result * 0x10000000000000006) >> 64;\\n }\\n if (x & 0x4 > 0) {\\n result = (result * 0x10000000000000003) >> 64;\\n }\\n if (x & 0x2 > 0) {\\n result = (result * 0x10000000000000001) >> 64;\\n }\\n if (x & 0x1 > 0) {\\n result = (result * 0x10000000000000001) >> 64;\\n }\\n }\\n\\n // In the code snippet below, two operations are executed simultaneously:\\n //\\n // 1. The result is multiplied by $(2^n + 1)$, where $2^n$ represents the integer part, and the additional 1\\n // accounts for the initial guess of 0.5. This is achieved by subtracting from 191 instead of 192.\\n // 2. The result is then converted to an unsigned 60.18-decimal fixed-point format.\\n //\\n // The underlying logic is based on the relationship $2^{191-ip} = 2^{ip} / 2^{191}$, where $ip$ denotes the,\\n // integer part, $2^n$.\\n result *= UNIT;\\n result >>= (191 - (x >> 64));\\n }\\n}\\n\\n/// @notice Finds the zero-based index of the first 1 in the binary representation of x.\\n///\\n/// @dev See the note on \\\"msb\\\" in this Wikipedia article: https://en.wikipedia.org/wiki/Find_first_set\\n///\\n/// Each step in this implementation is equivalent to this high-level code:\\n///\\n/// ```solidity\\n/// if (x >= 2 ** 128) {\\n/// x >>= 128;\\n/// result += 128;\\n/// }\\n/// ```\\n///\\n/// Where 128 is replaced with each respective power of two factor. See the full high-level implementation here:\\n/// https://gist.github.com/PaulRBerg/f932f8693f2733e30c4d479e8e980948\\n///\\n/// The Yul instructions used below are:\\n///\\n/// - \\\"gt\\\" is \\\"greater than\\\"\\n/// - \\\"or\\\" is the OR bitwise operator\\n/// - \\\"shl\\\" is \\\"shift left\\\"\\n/// - \\\"shr\\\" is \\\"shift right\\\"\\n///\\n/// @param x The uint256 number for which to find the index of the most significant bit.\\n/// @return result The index of the most significant bit as a uint256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction msb(uint256 x) pure returns (uint256 result) {\\n // 2^128\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(7, gt(x, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^64\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(6, gt(x, 0xFFFFFFFFFFFFFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^32\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(5, gt(x, 0xFFFFFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^16\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(4, gt(x, 0xFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^8\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(3, gt(x, 0xFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^4\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(2, gt(x, 0xF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^2\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(1, gt(x, 0x3))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^1\\n // No need to shift x any more.\\n assembly (\\\"memory-safe\\\") {\\n let factor := gt(x, 0x1)\\n result := or(result, factor)\\n }\\n}\\n\\n/// @notice Calculates x*y\\u00f7denominator with 512-bit precision.\\n///\\n/// @dev Credits to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv.\\n///\\n/// Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - The denominator must not be zero.\\n/// - The result must fit in uint256.\\n///\\n/// @param x The multiplicand as a uint256.\\n/// @param y The multiplier as a uint256.\\n/// @param denominator The divisor as a uint256.\\n/// @return result The result as a uint256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mulDiv(uint256 x, uint256 y, uint256 denominator) pure returns (uint256 result) {\\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; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly (\\\"memory-safe\\\") {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\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 unchecked {\\n return prod0 / denominator;\\n }\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n if (prod1 >= denominator) {\\n revert PRBMath_MulDiv_Overflow(x, y, denominator);\\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 (\\\"memory-safe\\\") {\\n // Compute remainder using the mulmod Yul instruction.\\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 unchecked {\\n // Calculate the largest power of two divisor of the denominator using the unary operator ~. This operation cannot overflow\\n // because the denominator cannot be zero at this point in the function execution. The result is always >= 1.\\n // For more detail, see https://cs.stackexchange.com/q/138556/92363.\\n uint256 lpotdod = denominator & (~denominator + 1);\\n uint256 flippedLpotdod;\\n\\n assembly (\\\"memory-safe\\\") {\\n // Factor powers of two out of denominator.\\n denominator := div(denominator, lpotdod)\\n\\n // Divide [prod1 prod0] by lpotdod.\\n prod0 := div(prod0, lpotdod)\\n\\n // Get the flipped value `2^256 / lpotdod`. If the `lpotdod` is zero, the flipped value is one.\\n // `sub(0, lpotdod)` produces the two's complement version of `lpotdod`, which is equivalent to flipping all the bits.\\n // However, `div` interprets this value as an unsigned value: https://ethereum.stackexchange.com/q/147168/24693\\n flippedLpotdod := add(div(sub(0, lpotdod), lpotdod), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * flippedLpotdod;\\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 works\\n // 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 }\\n}\\n\\n/// @notice Calculates x*y\\u00f71e18 with 512-bit precision.\\n///\\n/// @dev A variant of {mulDiv} with constant folding, i.e. in which the denominator is hard coded to 1e18.\\n///\\n/// Notes:\\n/// - The body is purposely left uncommented; to understand how this works, see the documentation in {mulDiv}.\\n/// - The result is rounded toward zero.\\n/// - We take as an axiom that the result cannot be `MAX_UINT256` when x and y solve the following system of equations:\\n///\\n/// $$\\n/// \\\\begin{cases}\\n/// x * y = MAX\\\\_UINT256 * UNIT \\\\\\\\\\n/// (x * y) \\\\% UNIT \\\\geq \\\\frac{UNIT}{2}\\n/// \\\\end{cases}\\n/// $$\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {mulDiv}.\\n/// - The result must fit in uint256.\\n///\\n/// @param x The multiplicand as an unsigned 60.18-decimal fixed-point number.\\n/// @param y The multiplier as an unsigned 60.18-decimal fixed-point number.\\n/// @return result The result as an unsigned 60.18-decimal fixed-point number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mulDiv18(uint256 x, uint256 y) pure returns (uint256 result) {\\n uint256 prod0;\\n uint256 prod1;\\n assembly (\\\"memory-safe\\\") {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n if (prod1 == 0) {\\n unchecked {\\n return prod0 / UNIT;\\n }\\n }\\n\\n if (prod1 >= UNIT) {\\n revert PRBMath_MulDiv18_Overflow(x, y);\\n }\\n\\n uint256 remainder;\\n assembly (\\\"memory-safe\\\") {\\n remainder := mulmod(x, y, UNIT)\\n result :=\\n mul(\\n or(\\n div(sub(prod0, remainder), UNIT_LPOTD),\\n mul(sub(prod1, gt(remainder, prod0)), add(div(sub(0, UNIT_LPOTD), UNIT_LPOTD), 1))\\n ),\\n UNIT_INVERSE\\n )\\n }\\n}\\n\\n/// @notice Calculates x*y\\u00f7denominator with 512-bit precision.\\n///\\n/// @dev This is an extension of {mulDiv} for signed numbers, which works by computing the signs and the absolute values separately.\\n///\\n/// Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {mulDiv}.\\n/// - None of the inputs can be `type(int256).min`.\\n/// - The result must fit in int256.\\n///\\n/// @param x The multiplicand as an int256.\\n/// @param y The multiplier as an int256.\\n/// @param denominator The divisor as an int256.\\n/// @return result The result as an int256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mulDivSigned(int256 x, int256 y, int256 denominator) pure returns (int256 result) {\\n if (x == type(int256).min || y == type(int256).min || denominator == type(int256).min) {\\n revert PRBMath_MulDivSigned_InputTooSmall();\\n }\\n\\n // Get hold of the absolute values of x, y and the denominator.\\n uint256 xAbs;\\n uint256 yAbs;\\n uint256 dAbs;\\n unchecked {\\n xAbs = x < 0 ? uint256(-x) : uint256(x);\\n yAbs = y < 0 ? uint256(-y) : uint256(y);\\n dAbs = denominator < 0 ? uint256(-denominator) : uint256(denominator);\\n }\\n\\n // Compute the absolute value of x*y\\u00f7denominator. The result must fit in int256.\\n uint256 resultAbs = mulDiv(xAbs, yAbs, dAbs);\\n if (resultAbs > uint256(type(int256).max)) {\\n revert PRBMath_MulDivSigned_Overflow(x, y);\\n }\\n\\n // Get the signs of x, y and the denominator.\\n uint256 sx;\\n uint256 sy;\\n uint256 sd;\\n assembly (\\\"memory-safe\\\") {\\n // \\\"sgt\\\" is the \\\"signed greater than\\\" assembly instruction and \\\"sub(0,1)\\\" is -1 in two's complement.\\n sx := sgt(x, sub(0, 1))\\n sy := sgt(y, sub(0, 1))\\n sd := sgt(denominator, sub(0, 1))\\n }\\n\\n // XOR over sx, sy and sd. What this does is to check whether there are 1 or 3 negative signs in the inputs.\\n // If there are, the result should be negative. Otherwise, it should be positive.\\n unchecked {\\n result = sx ^ sy ^ sd == 0 ? -int256(resultAbs) : int256(resultAbs);\\n }\\n}\\n\\n/// @notice Calculates the square root of x using the Babylonian method.\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\\n///\\n/// Notes:\\n/// - If x is not a perfect square, the result is rounded down.\\n/// - Credits to OpenZeppelin for the explanations in comments below.\\n///\\n/// @param x The uint256 number for which to calculate the square root.\\n/// @return result The result as a uint256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction sqrt(uint256 x) pure returns (uint256 result) {\\n if (x == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we calculate the biggest power of 2 which is smaller than the square root of x.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of x is a power of 2 such that we have:\\n //\\n // $$\\n // msb(x) <= x <= 2*msb(x)$\\n // $$\\n //\\n // We write $msb(x)$ as $2^k$, and we get:\\n //\\n // $$\\n // k = log_2(x)\\n // $$\\n //\\n // Thus, we can write the initial inequality as:\\n //\\n // $$\\n // 2^{log_2(x)} <= x <= 2*2^{log_2(x)+1} \\\\\\\\\\n // sqrt(2^k) <= sqrt(x) < sqrt(2^{k+1}) \\\\\\\\\\n // 2^{k/2} <= sqrt(x) < 2^{(k+1)/2} <= 2^{(k/2)+1}\\n // $$\\n //\\n // Consequently, $2^{log_2(x) /2} is a good first approximation of sqrt(x) with at least one correct bit.\\n uint256 xAux = uint256(x);\\n result = 1;\\n if (xAux >= 2 ** 128) {\\n xAux >>= 128;\\n result <<= 64;\\n }\\n if (xAux >= 2 ** 64) {\\n xAux >>= 64;\\n result <<= 32;\\n }\\n if (xAux >= 2 ** 32) {\\n xAux >>= 32;\\n result <<= 16;\\n }\\n if (xAux >= 2 ** 16) {\\n xAux >>= 16;\\n result <<= 8;\\n }\\n if (xAux >= 2 ** 8) {\\n xAux >>= 8;\\n result <<= 4;\\n }\\n if (xAux >= 2 ** 4) {\\n xAux >>= 4;\\n result <<= 2;\\n }\\n if (xAux >= 2 ** 2) {\\n result <<= 1;\\n }\\n\\n // At this point, `result` is an estimation with at least one bit of precision. We know the true value has at\\n // most 128 bits, since it is the square root of a uint256. Newton's method converges quadratically (precision\\n // doubles at every iteration). We thus need at most 7 iteration to turn our partial result with one bit of\\n // precision into the expected uint128 result.\\n unchecked {\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n\\n // If x is not a perfect square, round the result toward zero.\\n uint256 roundedResult = x / result;\\n if (result >= roundedResult) {\\n result = roundedResult;\\n }\\n }\\n}\\n\",\"keccak256\":\"0xaa374e2c26cc93e8c22a6953804ee05f811597ef5fa82f76824378b22944778b\",\"license\":\"MIT\"},\"@prb/math/src/UD2x18.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\n/*\\n\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2550\\u2550\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2554\\u2588\\u2588\\u2588\\u2588\\u2554\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551 \\u255a\\u2550\\u255d \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\n\\n\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2550\\u2550\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d \\u255a\\u2588\\u2588\\u2588\\u2554\\u255d \\u255a\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u255d\\n\\n*/\\n\\nimport \\\"./ud2x18/Casting.sol\\\";\\nimport \\\"./ud2x18/Constants.sol\\\";\\nimport \\\"./ud2x18/Errors.sol\\\";\\nimport \\\"./ud2x18/ValueType.sol\\\";\\n\",\"keccak256\":\"0xfb624e24cd8bb790fa08e7827819de85504a86e20e961fa4ad126c65b6d90641\",\"license\":\"MIT\"},\"@prb/math/src/UD60x18.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\n/*\\n\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2550\\u2550\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2554\\u2588\\u2588\\u2588\\u2588\\u2554\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551 \\u255a\\u2550\\u255d \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\n\\n\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2550\\u2588\\u2588\\u2588\\u2588\\u2557\\u255a\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2588\\u2588\\u2551 \\u255a\\u2588\\u2588\\u2588\\u2554\\u255d \\u255a\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2554\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2554\\u255d \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u255d\\n\\n*/\\n\\nimport \\\"./ud60x18/Casting.sol\\\";\\nimport \\\"./ud60x18/Constants.sol\\\";\\nimport \\\"./ud60x18/Conversions.sol\\\";\\nimport \\\"./ud60x18/Errors.sol\\\";\\nimport \\\"./ud60x18/Helpers.sol\\\";\\nimport \\\"./ud60x18/Math.sol\\\";\\nimport \\\"./ud60x18/ValueType.sol\\\";\\n\",\"keccak256\":\"0xb98c6f74275914d279e8af6c502c2b1f50d5f6e1ed418d3b0153f5a193206c48\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as CastingErrors;\\nimport { SD59x18 } from \\\"../sd59x18/ValueType.sol\\\";\\nimport { UD2x18 } from \\\"../ud2x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"../ud60x18/ValueType.sol\\\";\\nimport { SD1x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts an SD1x18 number into SD59x18.\\n/// @dev There is no overflow check because the domain of SD1x18 is a subset of SD59x18.\\nfunction intoSD59x18(SD1x18 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(int256(SD1x18.unwrap(x)));\\n}\\n\\n/// @notice Casts an SD1x18 number into UD2x18.\\n/// - x must be positive.\\nfunction intoUD2x18(SD1x18 x) pure returns (UD2x18 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUD2x18_Underflow(x);\\n }\\n result = UD2x18.wrap(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into UD60x18.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUD60x18(SD1x18 x) pure returns (UD60x18 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUD60x18_Underflow(x);\\n }\\n result = UD60x18.wrap(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into uint256.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUint256(SD1x18 x) pure returns (uint256 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint256_Underflow(x);\\n }\\n result = uint256(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into uint128.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUint128(SD1x18 x) pure returns (uint128 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint128_Underflow(x);\\n }\\n result = uint128(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(SD1x18 x) pure returns (uint40 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint40_Underflow(x);\\n }\\n if (xInt > int64(uint64(Common.MAX_UINT40))) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint40_Overflow(x);\\n }\\n result = uint40(uint64(xInt));\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction sd1x18(int64 x) pure returns (SD1x18 result) {\\n result = SD1x18.wrap(x);\\n}\\n\\n/// @notice Unwraps an SD1x18 number into int64.\\nfunction unwrap(SD1x18 x) pure returns (int64 result) {\\n result = SD1x18.unwrap(x);\\n}\\n\\n/// @notice Wraps an int64 number into SD1x18.\\nfunction wrap(int64 x) pure returns (SD1x18 result) {\\n result = SD1x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x9e49e2b37c1bb845861740805edaaef3fe951a7b96eef16ce84fbf76e8278670\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD1x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @dev Euler's number as an SD1x18 number.\\nSD1x18 constant E = SD1x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum value an SD1x18 number can have.\\nint64 constant uMAX_SD1x18 = 9_223372036854775807;\\nSD1x18 constant MAX_SD1x18 = SD1x18.wrap(uMAX_SD1x18);\\n\\n/// @dev The maximum value an SD1x18 number can have.\\nint64 constant uMIN_SD1x18 = -9_223372036854775808;\\nSD1x18 constant MIN_SD1x18 = SD1x18.wrap(uMIN_SD1x18);\\n\\n/// @dev PI as an SD1x18 number.\\nSD1x18 constant PI = SD1x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of SD1x18.\\nSD1x18 constant UNIT = SD1x18.wrap(1e18);\\nint64 constant uUNIT = 1e18;\\n\",\"keccak256\":\"0x6496165b80552785a4b65a239b96e2a5fedf62fe54f002eeed72d75e566d7585\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD1x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in UD2x18.\\nerror PRBMath_SD1x18_ToUD2x18_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in UD60x18.\\nerror PRBMath_SD1x18_ToUD60x18_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint128.\\nerror PRBMath_SD1x18_ToUint128_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint256.\\nerror PRBMath_SD1x18_ToUint256_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint40.\\nerror PRBMath_SD1x18_ToUint40_Overflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint40.\\nerror PRBMath_SD1x18_ToUint40_Underflow(SD1x18 x);\\n\",\"keccak256\":\"0x836cb42ba619ca369fd4765bc47fefc3c3621369c5861882af14660aca5057ee\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\n\\n/// @notice The signed 1.18-decimal fixed-point number representation, which can have up to 1 digit and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\\n/// type int64. This is useful when end users want to use int64 to save gas, e.g. with tight variable packing in contract\\n/// storage.\\ntype SD1x18 is int64;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoSD59x18,\\n Casting.intoUD2x18,\\n Casting.intoUD60x18,\\n Casting.intoUint256,\\n Casting.intoUint128,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for SD1x18 global;\\n\",\"keccak256\":\"0x2f86f1aa9fca42f40808b51a879b406ac51817647bdb9642f8a79dd8fdb754a7\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Errors.sol\\\" as CastingErrors;\\nimport { MAX_UINT128, MAX_UINT40 } from \\\"../Common.sol\\\";\\nimport { uMAX_SD1x18, uMIN_SD1x18 } from \\\"../sd1x18/Constants.sol\\\";\\nimport { SD1x18 } from \\\"../sd1x18/ValueType.sol\\\";\\nimport { uMAX_UD2x18 } from \\\"../ud2x18/Constants.sol\\\";\\nimport { UD2x18 } from \\\"../ud2x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"../ud60x18/ValueType.sol\\\";\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts an SD59x18 number into int256.\\n/// @dev This is basically a functional alias for {unwrap}.\\nfunction intoInt256(SD59x18 x) pure returns (int256 result) {\\n result = SD59x18.unwrap(x);\\n}\\n\\n/// @notice Casts an SD59x18 number into SD1x18.\\n/// @dev Requirements:\\n/// - x must be greater than or equal to `uMIN_SD1x18`.\\n/// - x must be less than or equal to `uMAX_SD1x18`.\\nfunction intoSD1x18(SD59x18 x) pure returns (SD1x18 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < uMIN_SD1x18) {\\n revert CastingErrors.PRBMath_SD59x18_IntoSD1x18_Underflow(x);\\n }\\n if (xInt > uMAX_SD1x18) {\\n revert CastingErrors.PRBMath_SD59x18_IntoSD1x18_Overflow(x);\\n }\\n result = SD1x18.wrap(int64(xInt));\\n}\\n\\n/// @notice Casts an SD59x18 number into UD2x18.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `uMAX_UD2x18`.\\nfunction intoUD2x18(SD59x18 x) pure returns (UD2x18 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUD2x18_Underflow(x);\\n }\\n if (xInt > int256(uint256(uMAX_UD2x18))) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUD2x18_Overflow(x);\\n }\\n result = UD2x18.wrap(uint64(uint256(xInt)));\\n}\\n\\n/// @notice Casts an SD59x18 number into UD60x18.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUD60x18(SD59x18 x) pure returns (UD60x18 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUD60x18_Underflow(x);\\n }\\n result = UD60x18.wrap(uint256(xInt));\\n}\\n\\n/// @notice Casts an SD59x18 number into uint256.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUint256(SD59x18 x) pure returns (uint256 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint256_Underflow(x);\\n }\\n result = uint256(xInt);\\n}\\n\\n/// @notice Casts an SD59x18 number into uint128.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `uMAX_UINT128`.\\nfunction intoUint128(SD59x18 x) pure returns (uint128 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint128_Underflow(x);\\n }\\n if (xInt > int256(uint256(MAX_UINT128))) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint128_Overflow(x);\\n }\\n result = uint128(uint256(xInt));\\n}\\n\\n/// @notice Casts an SD59x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(SD59x18 x) pure returns (uint40 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint40_Underflow(x);\\n }\\n if (xInt > int256(uint256(MAX_UINT40))) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint40_Overflow(x);\\n }\\n result = uint40(uint256(xInt));\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction sd(int256 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(x);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction sd59x18(int256 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(x);\\n}\\n\\n/// @notice Unwraps an SD59x18 number into int256.\\nfunction unwrap(SD59x18 x) pure returns (int256 result) {\\n result = SD59x18.unwrap(x);\\n}\\n\\n/// @notice Wraps an int256 number into SD59x18.\\nfunction wrap(int256 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x3b21b60ec2998c3ae32f647412da51d3683b3f183a807198cc8d157499484f99\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n// NOTICE: the \\\"u\\\" prefix stands for \\\"unwrapped\\\".\\n\\n/// @dev Euler's number as an SD59x18 number.\\nSD59x18 constant E = SD59x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum input permitted in {exp}.\\nint256 constant uEXP_MAX_INPUT = 133_084258667509499440;\\nSD59x18 constant EXP_MAX_INPUT = SD59x18.wrap(uEXP_MAX_INPUT);\\n\\n/// @dev Any value less than this returns 0 in {exp}.\\nint256 constant uEXP_MIN_THRESHOLD = -41_446531673892822322;\\nSD59x18 constant EXP_MIN_THRESHOLD = SD59x18.wrap(uEXP_MIN_THRESHOLD);\\n\\n/// @dev The maximum input permitted in {exp2}.\\nint256 constant uEXP2_MAX_INPUT = 192e18 - 1;\\nSD59x18 constant EXP2_MAX_INPUT = SD59x18.wrap(uEXP2_MAX_INPUT);\\n\\n/// @dev Any value less than this returns 0 in {exp2}.\\nint256 constant uEXP2_MIN_THRESHOLD = -59_794705707972522261;\\nSD59x18 constant EXP2_MIN_THRESHOLD = SD59x18.wrap(uEXP2_MIN_THRESHOLD);\\n\\n/// @dev Half the UNIT number.\\nint256 constant uHALF_UNIT = 0.5e18;\\nSD59x18 constant HALF_UNIT = SD59x18.wrap(uHALF_UNIT);\\n\\n/// @dev $log_2(10)$ as an SD59x18 number.\\nint256 constant uLOG2_10 = 3_321928094887362347;\\nSD59x18 constant LOG2_10 = SD59x18.wrap(uLOG2_10);\\n\\n/// @dev $log_2(e)$ as an SD59x18 number.\\nint256 constant uLOG2_E = 1_442695040888963407;\\nSD59x18 constant LOG2_E = SD59x18.wrap(uLOG2_E);\\n\\n/// @dev The maximum value an SD59x18 number can have.\\nint256 constant uMAX_SD59x18 = 57896044618658097711785492504343953926634992332820282019728_792003956564819967;\\nSD59x18 constant MAX_SD59x18 = SD59x18.wrap(uMAX_SD59x18);\\n\\n/// @dev The maximum whole value an SD59x18 number can have.\\nint256 constant uMAX_WHOLE_SD59x18 = 57896044618658097711785492504343953926634992332820282019728_000000000000000000;\\nSD59x18 constant MAX_WHOLE_SD59x18 = SD59x18.wrap(uMAX_WHOLE_SD59x18);\\n\\n/// @dev The minimum value an SD59x18 number can have.\\nint256 constant uMIN_SD59x18 = -57896044618658097711785492504343953926634992332820282019728_792003956564819968;\\nSD59x18 constant MIN_SD59x18 = SD59x18.wrap(uMIN_SD59x18);\\n\\n/// @dev The minimum whole value an SD59x18 number can have.\\nint256 constant uMIN_WHOLE_SD59x18 = -57896044618658097711785492504343953926634992332820282019728_000000000000000000;\\nSD59x18 constant MIN_WHOLE_SD59x18 = SD59x18.wrap(uMIN_WHOLE_SD59x18);\\n\\n/// @dev PI as an SD59x18 number.\\nSD59x18 constant PI = SD59x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of SD59x18.\\nint256 constant uUNIT = 1e18;\\nSD59x18 constant UNIT = SD59x18.wrap(1e18);\\n\\n/// @dev The unit number squared.\\nint256 constant uUNIT_SQUARED = 1e36;\\nSD59x18 constant UNIT_SQUARED = SD59x18.wrap(uUNIT_SQUARED);\\n\\n/// @dev Zero as an SD59x18 number.\\nSD59x18 constant ZERO = SD59x18.wrap(0);\\n\",\"keccak256\":\"0x9bcb8dd6b3e886d140ad1c32747a4f6d29a492529ceb835be878ae837aa6cc3a\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when taking the absolute value of `MIN_SD59x18`.\\nerror PRBMath_SD59x18_Abs_MinSD59x18();\\n\\n/// @notice Thrown when ceiling a number overflows SD59x18.\\nerror PRBMath_SD59x18_Ceil_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when converting a basic integer to the fixed-point format overflows SD59x18.\\nerror PRBMath_SD59x18_Convert_Overflow(int256 x);\\n\\n/// @notice Thrown when converting a basic integer to the fixed-point format underflows SD59x18.\\nerror PRBMath_SD59x18_Convert_Underflow(int256 x);\\n\\n/// @notice Thrown when dividing two numbers and one of them is `MIN_SD59x18`.\\nerror PRBMath_SD59x18_Div_InputTooSmall();\\n\\n/// @notice Thrown when dividing two numbers and one of the intermediary unsigned results overflows SD59x18.\\nerror PRBMath_SD59x18_Div_Overflow(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when taking the natural exponent of a base greater than 133_084258667509499441.\\nerror PRBMath_SD59x18_Exp_InputTooBig(SD59x18 x);\\n\\n/// @notice Thrown when taking the binary exponent of a base greater than 192e18.\\nerror PRBMath_SD59x18_Exp2_InputTooBig(SD59x18 x);\\n\\n/// @notice Thrown when flooring a number underflows SD59x18.\\nerror PRBMath_SD59x18_Floor_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when taking the geometric mean of two numbers and their product is negative.\\nerror PRBMath_SD59x18_Gm_NegativeProduct(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when taking the geometric mean of two numbers and multiplying them overflows SD59x18.\\nerror PRBMath_SD59x18_Gm_Overflow(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\\nerror PRBMath_SD59x18_IntoSD1x18_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\\nerror PRBMath_SD59x18_IntoSD1x18_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\\nerror PRBMath_SD59x18_IntoUD2x18_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\\nerror PRBMath_SD59x18_IntoUD2x18_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD60x18.\\nerror PRBMath_SD59x18_IntoUD60x18_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\\nerror PRBMath_SD59x18_IntoUint128_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\\nerror PRBMath_SD59x18_IntoUint128_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint256.\\nerror PRBMath_SD59x18_IntoUint256_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\\nerror PRBMath_SD59x18_IntoUint40_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\\nerror PRBMath_SD59x18_IntoUint40_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when taking the logarithm of a number less than or equal to zero.\\nerror PRBMath_SD59x18_Log_InputTooSmall(SD59x18 x);\\n\\n/// @notice Thrown when multiplying two numbers and one of the inputs is `MIN_SD59x18`.\\nerror PRBMath_SD59x18_Mul_InputTooSmall();\\n\\n/// @notice Thrown when multiplying two numbers and the intermediary absolute result overflows SD59x18.\\nerror PRBMath_SD59x18_Mul_Overflow(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when raising a number to a power and the intermediary absolute result overflows SD59x18.\\nerror PRBMath_SD59x18_Powu_Overflow(SD59x18 x, uint256 y);\\n\\n/// @notice Thrown when taking the square root of a negative number.\\nerror PRBMath_SD59x18_Sqrt_NegativeInput(SD59x18 x);\\n\\n/// @notice Thrown when the calculating the square root overflows SD59x18.\\nerror PRBMath_SD59x18_Sqrt_Overflow(SD59x18 x);\\n\",\"keccak256\":\"0xa6d00fe5efa215ac0df25c896e3da99a12fb61e799644b2ec32da947313d3db4\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Helpers.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { wrap } from \\\"./Casting.sol\\\";\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Implements the checked addition operation (+) in the SD59x18 type.\\nfunction add(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n return wrap(x.unwrap() + y.unwrap());\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the SD59x18 type.\\nfunction and(SD59x18 x, int256 bits) pure returns (SD59x18 result) {\\n return wrap(x.unwrap() & bits);\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the SD59x18 type.\\nfunction and2(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n return wrap(x.unwrap() & y.unwrap());\\n}\\n\\n/// @notice Implements the equal (=) operation in the SD59x18 type.\\nfunction eq(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() == y.unwrap();\\n}\\n\\n/// @notice Implements the greater than operation (>) in the SD59x18 type.\\nfunction gt(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() > y.unwrap();\\n}\\n\\n/// @notice Implements the greater than or equal to operation (>=) in the SD59x18 type.\\nfunction gte(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() >= y.unwrap();\\n}\\n\\n/// @notice Implements a zero comparison check function in the SD59x18 type.\\nfunction isZero(SD59x18 x) pure returns (bool result) {\\n result = x.unwrap() == 0;\\n}\\n\\n/// @notice Implements the left shift operation (<<) in the SD59x18 type.\\nfunction lshift(SD59x18 x, uint256 bits) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() << bits);\\n}\\n\\n/// @notice Implements the lower than operation (<) in the SD59x18 type.\\nfunction lt(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() < y.unwrap();\\n}\\n\\n/// @notice Implements the lower than or equal to operation (<=) in the SD59x18 type.\\nfunction lte(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() <= y.unwrap();\\n}\\n\\n/// @notice Implements the unchecked modulo operation (%) in the SD59x18 type.\\nfunction mod(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() % y.unwrap());\\n}\\n\\n/// @notice Implements the not equal operation (!=) in the SD59x18 type.\\nfunction neq(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() != y.unwrap();\\n}\\n\\n/// @notice Implements the NOT (~) bitwise operation in the SD59x18 type.\\nfunction not(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(~x.unwrap());\\n}\\n\\n/// @notice Implements the OR (|) bitwise operation in the SD59x18 type.\\nfunction or(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() | y.unwrap());\\n}\\n\\n/// @notice Implements the right shift operation (>>) in the SD59x18 type.\\nfunction rshift(SD59x18 x, uint256 bits) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() >> bits);\\n}\\n\\n/// @notice Implements the checked subtraction operation (-) in the SD59x18 type.\\nfunction sub(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() - y.unwrap());\\n}\\n\\n/// @notice Implements the checked unary minus operation (-) in the SD59x18 type.\\nfunction unary(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(-x.unwrap());\\n}\\n\\n/// @notice Implements the unchecked addition operation (+) in the SD59x18 type.\\nfunction uncheckedAdd(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() + y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the unchecked subtraction operation (-) in the SD59x18 type.\\nfunction uncheckedSub(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() - y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the unchecked unary minus operation (-) in the SD59x18 type.\\nfunction uncheckedUnary(SD59x18 x) pure returns (SD59x18 result) {\\n unchecked {\\n result = wrap(-x.unwrap());\\n }\\n}\\n\\n/// @notice Implements the XOR (^) bitwise operation in the SD59x18 type.\\nfunction xor(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() ^ y.unwrap());\\n}\\n\",\"keccak256\":\"0x208570f1657cf730cb6c3d81aa14030e0d45cf906cdedea5059369d7df4bb716\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as Errors;\\nimport {\\n uEXP_MAX_INPUT,\\n uEXP2_MAX_INPUT,\\n uEXP_MIN_THRESHOLD,\\n uEXP2_MIN_THRESHOLD,\\n uHALF_UNIT,\\n uLOG2_10,\\n uLOG2_E,\\n uMAX_SD59x18,\\n uMAX_WHOLE_SD59x18,\\n uMIN_SD59x18,\\n uMIN_WHOLE_SD59x18,\\n UNIT,\\n uUNIT,\\n uUNIT_SQUARED,\\n ZERO\\n} from \\\"./Constants.sol\\\";\\nimport { wrap } from \\\"./Helpers.sol\\\";\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Calculates the absolute value of x.\\n///\\n/// @dev Requirements:\\n/// - x must be greater than `MIN_SD59x18`.\\n///\\n/// @param x The SD59x18 number for which to calculate the absolute value.\\n/// @param result The absolute value of x as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction abs(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt == uMIN_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Abs_MinSD59x18();\\n }\\n result = xInt < 0 ? wrap(-xInt) : x;\\n}\\n\\n/// @notice Calculates the arithmetic average of x and y.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// @param x The first operand as an SD59x18 number.\\n/// @param y The second operand as an SD59x18 number.\\n/// @return result The arithmetic average as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction avg(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n\\n unchecked {\\n // This operation is equivalent to `x / 2 + y / 2`, and it can never overflow.\\n int256 sum = (xInt >> 1) + (yInt >> 1);\\n\\n if (sum < 0) {\\n // If at least one of x and y is odd, add 1 to the result, because shifting negative numbers to the right\\n // rounds toward negative infinity. The right part is equivalent to `sum + (x % 2 == 1 || y % 2 == 1)`.\\n assembly (\\\"memory-safe\\\") {\\n result := add(sum, and(or(xInt, yInt), 1))\\n }\\n } else {\\n // Add 1 if both x and y are odd to account for the double 0.5 remainder truncated after shifting.\\n result = wrap(sum + (xInt & yInt & 1));\\n }\\n }\\n}\\n\\n/// @notice Yields the smallest whole number greater than or equal to x.\\n///\\n/// @dev Optimized for fractional value inputs, because every whole value has (1e18 - 1) fractional counterparts.\\n/// See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n///\\n/// Requirements:\\n/// - x must be less than or equal to `MAX_WHOLE_SD59x18`.\\n///\\n/// @param x The SD59x18 number to ceil.\\n/// @param result The smallest whole number greater than or equal to x, as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ceil(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt > uMAX_WHOLE_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Ceil_Overflow(x);\\n }\\n\\n int256 remainder = xInt % uUNIT;\\n if (remainder == 0) {\\n result = x;\\n } else {\\n unchecked {\\n // Solidity uses C fmod style, which returns a modulus with the same sign as x.\\n int256 resultInt = xInt - remainder;\\n if (xInt > 0) {\\n resultInt += uUNIT;\\n }\\n result = wrap(resultInt);\\n }\\n }\\n}\\n\\n/// @notice Divides two SD59x18 numbers, returning a new SD59x18 number.\\n///\\n/// @dev This is an extension of {Common.mulDiv} for signed numbers, which works by computing the signs and the absolute\\n/// values separately.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv}.\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv}.\\n/// - None of the inputs can be `MIN_SD59x18`.\\n/// - The denominator must not be zero.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The numerator as an SD59x18 number.\\n/// @param y The denominator as an SD59x18 number.\\n/// @param result The quotient as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction div(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n if (xInt == uMIN_SD59x18 || yInt == uMIN_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Div_InputTooSmall();\\n }\\n\\n // Get hold of the absolute values of x and y.\\n uint256 xAbs;\\n uint256 yAbs;\\n unchecked {\\n xAbs = xInt < 0 ? uint256(-xInt) : uint256(xInt);\\n yAbs = yInt < 0 ? uint256(-yInt) : uint256(yInt);\\n }\\n\\n // Compute the absolute value (x*UNIT\\u00f7y). The resulting value must fit in SD59x18.\\n uint256 resultAbs = Common.mulDiv(xAbs, uint256(uUNIT), yAbs);\\n if (resultAbs > uint256(uMAX_SD59x18)) {\\n revert Errors.PRBMath_SD59x18_Div_Overflow(x, y);\\n }\\n\\n // Check if x and y have the same sign using two's complement representation. The left-most bit represents the sign (1 for\\n // negative, 0 for positive or zero).\\n bool sameSign = (xInt ^ yInt) > -1;\\n\\n // If the inputs have the same sign, the result should be positive. Otherwise, it should be negative.\\n unchecked {\\n result = wrap(sameSign ? int256(resultAbs) : -int256(resultAbs));\\n }\\n}\\n\\n/// @notice Calculates the natural exponent of x using the following formula:\\n///\\n/// $$\\n/// e^x = 2^{x * log_2{e}}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {exp2}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {exp2}.\\n/// - x must be less than 133_084258667509499441.\\n///\\n/// @param x The exponent as an SD59x18 number.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n\\n // Any input less than the threshold returns zero.\\n // This check also prevents an overflow for very small numbers.\\n if (xInt < uEXP_MIN_THRESHOLD) {\\n return ZERO;\\n }\\n\\n // This check prevents values greater than 192e18 from being passed to {exp2}.\\n if (xInt > uEXP_MAX_INPUT) {\\n revert Errors.PRBMath_SD59x18_Exp_InputTooBig(x);\\n }\\n\\n unchecked {\\n // Inline the fixed-point multiplication to save gas.\\n int256 doubleUnitProduct = xInt * uLOG2_E;\\n result = exp2(wrap(doubleUnitProduct / uUNIT));\\n }\\n}\\n\\n/// @notice Calculates the binary exponent of x using the binary fraction method using the following formula:\\n///\\n/// $$\\n/// 2^{-x} = \\\\frac{1}{2^x}\\n/// $$\\n///\\n/// @dev See https://ethereum.stackexchange.com/q/79903/24693.\\n///\\n/// Notes:\\n/// - If x is less than -59_794705707972522261, the result is zero.\\n///\\n/// Requirements:\\n/// - x must be less than 192e18.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The exponent as an SD59x18 number.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp2(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < 0) {\\n // The inverse of any number less than the threshold is truncated to zero.\\n if (xInt < uEXP2_MIN_THRESHOLD) {\\n return ZERO;\\n }\\n\\n unchecked {\\n // Inline the fixed-point inversion to save gas.\\n result = wrap(uUNIT_SQUARED / exp2(wrap(-xInt)).unwrap());\\n }\\n } else {\\n // Numbers greater than or equal to 192e18 don't fit in the 192.64-bit format.\\n if (xInt > uEXP2_MAX_INPUT) {\\n revert Errors.PRBMath_SD59x18_Exp2_InputTooBig(x);\\n }\\n\\n unchecked {\\n // Convert x to the 192.64-bit fixed-point format.\\n uint256 x_192x64 = uint256((xInt << 64) / uUNIT);\\n\\n // It is safe to cast the result to int256 due to the checks above.\\n result = wrap(int256(Common.exp2(x_192x64)));\\n }\\n }\\n}\\n\\n/// @notice Yields the greatest whole number less than or equal to x.\\n///\\n/// @dev Optimized for fractional value inputs, because for every whole value there are (1e18 - 1) fractional\\n/// counterparts. See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n///\\n/// Requirements:\\n/// - x must be greater than or equal to `MIN_WHOLE_SD59x18`.\\n///\\n/// @param x The SD59x18 number to floor.\\n/// @param result The greatest whole number less than or equal to x, as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction floor(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < uMIN_WHOLE_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Floor_Underflow(x);\\n }\\n\\n int256 remainder = xInt % uUNIT;\\n if (remainder == 0) {\\n result = x;\\n } else {\\n unchecked {\\n // Solidity uses C fmod style, which returns a modulus with the same sign as x.\\n int256 resultInt = xInt - remainder;\\n if (xInt < 0) {\\n resultInt -= uUNIT;\\n }\\n result = wrap(resultInt);\\n }\\n }\\n}\\n\\n/// @notice Yields the excess beyond the floor of x for positive numbers and the part of the number to the right.\\n/// of the radix point for negative numbers.\\n/// @dev Based on the odd function definition. https://en.wikipedia.org/wiki/Fractional_part\\n/// @param x The SD59x18 number to get the fractional part of.\\n/// @param result The fractional part of x as an SD59x18 number.\\nfunction frac(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() % uUNIT);\\n}\\n\\n/// @notice Calculates the geometric mean of x and y, i.e. $\\\\sqrt{x * y}$.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x * y must fit in SD59x18.\\n/// - x * y must not be negative, since complex numbers are not supported.\\n///\\n/// @param x The first operand as an SD59x18 number.\\n/// @param y The second operand as an SD59x18 number.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction gm(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n if (xInt == 0 || yInt == 0) {\\n return ZERO;\\n }\\n\\n unchecked {\\n // Equivalent to `xy / x != y`. Checking for overflow this way is faster than letting Solidity do it.\\n int256 xyInt = xInt * yInt;\\n if (xyInt / xInt != yInt) {\\n revert Errors.PRBMath_SD59x18_Gm_Overflow(x, y);\\n }\\n\\n // The product must not be negative, since complex numbers are not supported.\\n if (xyInt < 0) {\\n revert Errors.PRBMath_SD59x18_Gm_NegativeProduct(x, y);\\n }\\n\\n // We don't need to multiply the result by `UNIT` here because the x*y product picked up a factor of `UNIT`\\n // during multiplication. See the comments in {Common.sqrt}.\\n uint256 resultUint = Common.sqrt(uint256(xyInt));\\n result = wrap(int256(resultUint));\\n }\\n}\\n\\n/// @notice Calculates the inverse of x.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x must not be zero.\\n///\\n/// @param x The SD59x18 number for which to calculate the inverse.\\n/// @return result The inverse as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction inv(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(uUNIT_SQUARED / x.unwrap());\\n}\\n\\n/// @notice Calculates the natural logarithm of x using the following formula:\\n///\\n/// $$\\n/// ln{x} = log_2{x} / log_2{e}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n/// - The precision isn't sufficiently fine-grained to return exactly `UNIT` when the input is `E`.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The SD59x18 number for which to calculate the natural logarithm.\\n/// @return result The natural logarithm as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ln(SD59x18 x) pure returns (SD59x18 result) {\\n // Inline the fixed-point multiplication to save gas. This is overflow-safe because the maximum value that\\n // {log2} can return is ~195_205294292027477728.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_E);\\n}\\n\\n/// @notice Calculates the common logarithm of x using the following formula:\\n///\\n/// $$\\n/// log_{10}{x} = log_2{x} / log_2{10}\\n/// $$\\n///\\n/// However, if x is an exact power of ten, a hard coded value is returned.\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The SD59x18 number for which to calculate the common logarithm.\\n/// @return result The common logarithm as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log10(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < 0) {\\n revert Errors.PRBMath_SD59x18_Log_InputTooSmall(x);\\n }\\n\\n // Note that the `mul` in this block is the standard multiplication operation, not {SD59x18.mul}.\\n // prettier-ignore\\n assembly (\\\"memory-safe\\\") {\\n switch x\\n case 1 { result := mul(uUNIT, sub(0, 18)) }\\n case 10 { result := mul(uUNIT, sub(1, 18)) }\\n case 100 { result := mul(uUNIT, sub(2, 18)) }\\n case 1000 { result := mul(uUNIT, sub(3, 18)) }\\n case 10000 { result := mul(uUNIT, sub(4, 18)) }\\n case 100000 { result := mul(uUNIT, sub(5, 18)) }\\n case 1000000 { result := mul(uUNIT, sub(6, 18)) }\\n case 10000000 { result := mul(uUNIT, sub(7, 18)) }\\n case 100000000 { result := mul(uUNIT, sub(8, 18)) }\\n case 1000000000 { result := mul(uUNIT, sub(9, 18)) }\\n case 10000000000 { result := mul(uUNIT, sub(10, 18)) }\\n case 100000000000 { result := mul(uUNIT, sub(11, 18)) }\\n case 1000000000000 { result := mul(uUNIT, sub(12, 18)) }\\n case 10000000000000 { result := mul(uUNIT, sub(13, 18)) }\\n case 100000000000000 { result := mul(uUNIT, sub(14, 18)) }\\n case 1000000000000000 { result := mul(uUNIT, sub(15, 18)) }\\n case 10000000000000000 { result := mul(uUNIT, sub(16, 18)) }\\n case 100000000000000000 { result := mul(uUNIT, sub(17, 18)) }\\n case 1000000000000000000 { result := 0 }\\n case 10000000000000000000 { result := uUNIT }\\n case 100000000000000000000 { result := mul(uUNIT, 2) }\\n case 1000000000000000000000 { result := mul(uUNIT, 3) }\\n case 10000000000000000000000 { result := mul(uUNIT, 4) }\\n case 100000000000000000000000 { result := mul(uUNIT, 5) }\\n case 1000000000000000000000000 { result := mul(uUNIT, 6) }\\n case 10000000000000000000000000 { result := mul(uUNIT, 7) }\\n case 100000000000000000000000000 { result := mul(uUNIT, 8) }\\n case 1000000000000000000000000000 { result := mul(uUNIT, 9) }\\n case 10000000000000000000000000000 { result := mul(uUNIT, 10) }\\n case 100000000000000000000000000000 { result := mul(uUNIT, 11) }\\n case 1000000000000000000000000000000 { result := mul(uUNIT, 12) }\\n case 10000000000000000000000000000000 { result := mul(uUNIT, 13) }\\n case 100000000000000000000000000000000 { result := mul(uUNIT, 14) }\\n case 1000000000000000000000000000000000 { result := mul(uUNIT, 15) }\\n case 10000000000000000000000000000000000 { result := mul(uUNIT, 16) }\\n case 100000000000000000000000000000000000 { result := mul(uUNIT, 17) }\\n case 1000000000000000000000000000000000000 { result := mul(uUNIT, 18) }\\n case 10000000000000000000000000000000000000 { result := mul(uUNIT, 19) }\\n case 100000000000000000000000000000000000000 { result := mul(uUNIT, 20) }\\n case 1000000000000000000000000000000000000000 { result := mul(uUNIT, 21) }\\n case 10000000000000000000000000000000000000000 { result := mul(uUNIT, 22) }\\n case 100000000000000000000000000000000000000000 { result := mul(uUNIT, 23) }\\n case 1000000000000000000000000000000000000000000 { result := mul(uUNIT, 24) }\\n case 10000000000000000000000000000000000000000000 { result := mul(uUNIT, 25) }\\n case 100000000000000000000000000000000000000000000 { result := mul(uUNIT, 26) }\\n case 1000000000000000000000000000000000000000000000 { result := mul(uUNIT, 27) }\\n case 10000000000000000000000000000000000000000000000 { result := mul(uUNIT, 28) }\\n case 100000000000000000000000000000000000000000000000 { result := mul(uUNIT, 29) }\\n case 1000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 30) }\\n case 10000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 31) }\\n case 100000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 32) }\\n case 1000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 33) }\\n case 10000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 34) }\\n case 100000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 35) }\\n case 1000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 36) }\\n case 10000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 37) }\\n case 100000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 38) }\\n case 1000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 39) }\\n case 10000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 40) }\\n case 100000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 41) }\\n case 1000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 42) }\\n case 10000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 43) }\\n case 100000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 44) }\\n case 1000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 45) }\\n case 10000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 46) }\\n case 100000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 47) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 48) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 49) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 50) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 51) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 52) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 53) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 54) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 55) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 56) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 57) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 58) }\\n default { result := uMAX_SD59x18 }\\n }\\n\\n if (result.unwrap() == uMAX_SD59x18) {\\n unchecked {\\n // Inline the fixed-point division to save gas.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_10);\\n }\\n }\\n}\\n\\n/// @notice Calculates the binary logarithm of x using the iterative approximation algorithm:\\n///\\n/// $$\\n/// log_2{x} = n + log_2{y}, \\\\text{ where } y = x*2^{-n}, \\\\ y \\\\in [1, 2)\\n/// $$\\n///\\n/// For $0 \\\\leq x \\\\lt 1$, the input is inverted:\\n///\\n/// $$\\n/// log_2{x} = -log_2{\\\\frac{1}{x}}\\n/// $$\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Binary_logarithm#Iterative_approximation.\\n///\\n/// Notes:\\n/// - Due to the lossy precision of the iterative approximation, the results are not perfectly accurate to the last decimal.\\n///\\n/// Requirements:\\n/// - x must be greater than zero.\\n///\\n/// @param x The SD59x18 number for which to calculate the binary logarithm.\\n/// @return result The binary logarithm as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log2(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt <= 0) {\\n revert Errors.PRBMath_SD59x18_Log_InputTooSmall(x);\\n }\\n\\n unchecked {\\n int256 sign;\\n if (xInt >= uUNIT) {\\n sign = 1;\\n } else {\\n sign = -1;\\n // Inline the fixed-point inversion to save gas.\\n xInt = uUNIT_SQUARED / xInt;\\n }\\n\\n // Calculate the integer part of the logarithm.\\n uint256 n = Common.msb(uint256(xInt / uUNIT));\\n\\n // This is the integer part of the logarithm as an SD59x18 number. The operation can't overflow\\n // because n is at most 255, `UNIT` is 1e18, and the sign is either 1 or -1.\\n int256 resultInt = int256(n) * uUNIT;\\n\\n // Calculate $y = x * 2^{-n}$.\\n int256 y = xInt >> n;\\n\\n // If y is the unit number, the fractional part is zero.\\n if (y == uUNIT) {\\n return wrap(resultInt * sign);\\n }\\n\\n // Calculate the fractional part via the iterative approximation.\\n // The `delta >>= 1` part is equivalent to `delta /= 2`, but shifting bits is more gas efficient.\\n int256 DOUBLE_UNIT = 2e18;\\n for (int256 delta = uHALF_UNIT; delta > 0; delta >>= 1) {\\n y = (y * y) / uUNIT;\\n\\n // Is y^2 >= 2e18 and so in the range [2e18, 4e18)?\\n if (y >= DOUBLE_UNIT) {\\n // Add the 2^{-m} factor to the logarithm.\\n resultInt = resultInt + delta;\\n\\n // Halve y, which corresponds to z/2 in the Wikipedia article.\\n y >>= 1;\\n }\\n }\\n resultInt *= sign;\\n result = wrap(resultInt);\\n }\\n}\\n\\n/// @notice Multiplies two SD59x18 numbers together, returning a new SD59x18 number.\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {Common.mulDiv18}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv18}.\\n/// - None of the inputs can be `MIN_SD59x18`.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The multiplicand as an SD59x18 number.\\n/// @param y The multiplier as an SD59x18 number.\\n/// @return result The product as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mul(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n if (xInt == uMIN_SD59x18 || yInt == uMIN_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Mul_InputTooSmall();\\n }\\n\\n // Get hold of the absolute values of x and y.\\n uint256 xAbs;\\n uint256 yAbs;\\n unchecked {\\n xAbs = xInt < 0 ? uint256(-xInt) : uint256(xInt);\\n yAbs = yInt < 0 ? uint256(-yInt) : uint256(yInt);\\n }\\n\\n // Compute the absolute value (x*y\\u00f7UNIT). The resulting value must fit in SD59x18.\\n uint256 resultAbs = Common.mulDiv18(xAbs, yAbs);\\n if (resultAbs > uint256(uMAX_SD59x18)) {\\n revert Errors.PRBMath_SD59x18_Mul_Overflow(x, y);\\n }\\n\\n // Check if x and y have the same sign using two's complement representation. The left-most bit represents the sign (1 for\\n // negative, 0 for positive or zero).\\n bool sameSign = (xInt ^ yInt) > -1;\\n\\n // If the inputs have the same sign, the result should be positive. Otherwise, it should be negative.\\n unchecked {\\n result = wrap(sameSign ? int256(resultAbs) : -int256(resultAbs));\\n }\\n}\\n\\n/// @notice Raises x to the power of y using the following formula:\\n///\\n/// $$\\n/// x^y = 2^{log_2{x} * y}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {exp2}, {log2}, and {mul}.\\n/// - Returns `UNIT` for 0^0.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {exp2}, {log2}, and {mul}.\\n///\\n/// @param x The base as an SD59x18 number.\\n/// @param y Exponent to raise x to, as an SD59x18 number\\n/// @return result x raised to power y, as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction pow(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n\\n // If both x and y are zero, the result is `UNIT`. If just x is zero, the result is always zero.\\n if (xInt == 0) {\\n return yInt == 0 ? UNIT : ZERO;\\n }\\n // If x is `UNIT`, the result is always `UNIT`.\\n else if (xInt == uUNIT) {\\n return UNIT;\\n }\\n\\n // If y is zero, the result is always `UNIT`.\\n if (yInt == 0) {\\n return UNIT;\\n }\\n // If y is `UNIT`, the result is always x.\\n else if (yInt == uUNIT) {\\n return x;\\n }\\n\\n // Calculate the result using the formula.\\n result = exp2(mul(log2(x), y));\\n}\\n\\n/// @notice Raises x (an SD59x18 number) to the power y (an unsigned basic integer) using the well-known\\n/// algorithm \\\"exponentiation by squaring\\\".\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Exponentiation_by_squaring.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv18}.\\n/// - Returns `UNIT` for 0^0.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {abs} and {Common.mulDiv18}.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The base as an SD59x18 number.\\n/// @param y The exponent as a uint256.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction powu(SD59x18 x, uint256 y) pure returns (SD59x18 result) {\\n uint256 xAbs = uint256(abs(x).unwrap());\\n\\n // Calculate the first iteration of the loop in advance.\\n uint256 resultAbs = y & 1 > 0 ? xAbs : uint256(uUNIT);\\n\\n // Equivalent to `for(y /= 2; y > 0; y /= 2)`.\\n uint256 yAux = y;\\n for (yAux >>= 1; yAux > 0; yAux >>= 1) {\\n xAbs = Common.mulDiv18(xAbs, xAbs);\\n\\n // Equivalent to `y % 2 == 1`.\\n if (yAux & 1 > 0) {\\n resultAbs = Common.mulDiv18(resultAbs, xAbs);\\n }\\n }\\n\\n // The result must fit in SD59x18.\\n if (resultAbs > uint256(uMAX_SD59x18)) {\\n revert Errors.PRBMath_SD59x18_Powu_Overflow(x, y);\\n }\\n\\n unchecked {\\n // Is the base negative and the exponent odd? If yes, the result should be negative.\\n int256 resultInt = int256(resultAbs);\\n bool isNegative = x.unwrap() < 0 && y & 1 == 1;\\n if (isNegative) {\\n resultInt = -resultInt;\\n }\\n result = wrap(resultInt);\\n }\\n}\\n\\n/// @notice Calculates the square root of x using the Babylonian method.\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\\n///\\n/// Notes:\\n/// - Only the positive root is returned.\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x cannot be negative, since complex numbers are not supported.\\n/// - x must be less than `MAX_SD59x18 / UNIT`.\\n///\\n/// @param x The SD59x18 number for which to calculate the square root.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction sqrt(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < 0) {\\n revert Errors.PRBMath_SD59x18_Sqrt_NegativeInput(x);\\n }\\n if (xInt > uMAX_SD59x18 / uUNIT) {\\n revert Errors.PRBMath_SD59x18_Sqrt_Overflow(x);\\n }\\n\\n unchecked {\\n // Multiply x by `UNIT` to account for the factor of `UNIT` picked up when multiplying two SD59x18 numbers.\\n // In this case, the two numbers are both the square root.\\n uint256 resultUint = Common.sqrt(uint256(xInt * uUNIT));\\n result = wrap(int256(resultUint));\\n }\\n}\\n\",\"keccak256\":\"0xa074831139fc89ca0e5a36086b30eb50896bb6770cd5823461b1f2769017d2f0\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\nimport \\\"./Helpers.sol\\\" as Helpers;\\nimport \\\"./Math.sol\\\" as Math;\\n\\n/// @notice The signed 59.18-decimal fixed-point number representation, which can have up to 59 digits and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\\n/// type int256.\\ntype SD59x18 is int256;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoInt256,\\n Casting.intoSD1x18,\\n Casting.intoUD2x18,\\n Casting.intoUD60x18,\\n Casting.intoUint256,\\n Casting.intoUint128,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for SD59x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n MATHEMATICAL FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Math.abs,\\n Math.avg,\\n Math.ceil,\\n Math.div,\\n Math.exp,\\n Math.exp2,\\n Math.floor,\\n Math.frac,\\n Math.gm,\\n Math.inv,\\n Math.log10,\\n Math.log2,\\n Math.ln,\\n Math.mul,\\n Math.pow,\\n Math.powu,\\n Math.sqrt\\n} for SD59x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n HELPER FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Helpers.add,\\n Helpers.and,\\n Helpers.eq,\\n Helpers.gt,\\n Helpers.gte,\\n Helpers.isZero,\\n Helpers.lshift,\\n Helpers.lt,\\n Helpers.lte,\\n Helpers.mod,\\n Helpers.neq,\\n Helpers.not,\\n Helpers.or,\\n Helpers.rshift,\\n Helpers.sub,\\n Helpers.uncheckedAdd,\\n Helpers.uncheckedSub,\\n Helpers.uncheckedUnary,\\n Helpers.xor\\n} for SD59x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n OPERATORS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes it possible to use these operators on the SD59x18 type.\\nusing {\\n Helpers.add as +,\\n Helpers.and2 as &,\\n Math.div as /,\\n Helpers.eq as ==,\\n Helpers.gt as >,\\n Helpers.gte as >=,\\n Helpers.lt as <,\\n Helpers.lte as <=,\\n Helpers.mod as %,\\n Math.mul as *,\\n Helpers.neq as !=,\\n Helpers.not as ~,\\n Helpers.or as |,\\n Helpers.sub as -,\\n Helpers.unary as -,\\n Helpers.xor as ^\\n} for SD59x18 global;\\n\",\"keccak256\":\"0xe03112d145dcd5863aff24e5f381debaae29d446acd5666f3d640e3d9af738d7\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as Errors;\\nimport { uMAX_SD1x18 } from \\\"../sd1x18/Constants.sol\\\";\\nimport { SD1x18 } from \\\"../sd1x18/ValueType.sol\\\";\\nimport { SD59x18 } from \\\"../sd59x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"../ud60x18/ValueType.sol\\\";\\nimport { UD2x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts a UD2x18 number into SD1x18.\\n/// - x must be less than or equal to `uMAX_SD1x18`.\\nfunction intoSD1x18(UD2x18 x) pure returns (SD1x18 result) {\\n uint64 xUint = UD2x18.unwrap(x);\\n if (xUint > uint64(uMAX_SD1x18)) {\\n revert Errors.PRBMath_UD2x18_IntoSD1x18_Overflow(x);\\n }\\n result = SD1x18.wrap(int64(xUint));\\n}\\n\\n/// @notice Casts a UD2x18 number into SD59x18.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of SD59x18.\\nfunction intoSD59x18(UD2x18 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(int256(uint256(UD2x18.unwrap(x))));\\n}\\n\\n/// @notice Casts a UD2x18 number into UD60x18.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of UD60x18.\\nfunction intoUD60x18(UD2x18 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(UD2x18.unwrap(x));\\n}\\n\\n/// @notice Casts a UD2x18 number into uint128.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of uint128.\\nfunction intoUint128(UD2x18 x) pure returns (uint128 result) {\\n result = uint128(UD2x18.unwrap(x));\\n}\\n\\n/// @notice Casts a UD2x18 number into uint256.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of uint256.\\nfunction intoUint256(UD2x18 x) pure returns (uint256 result) {\\n result = uint256(UD2x18.unwrap(x));\\n}\\n\\n/// @notice Casts a UD2x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(UD2x18 x) pure returns (uint40 result) {\\n uint64 xUint = UD2x18.unwrap(x);\\n if (xUint > uint64(Common.MAX_UINT40)) {\\n revert Errors.PRBMath_UD2x18_IntoUint40_Overflow(x);\\n }\\n result = uint40(xUint);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction ud2x18(uint64 x) pure returns (UD2x18 result) {\\n result = UD2x18.wrap(x);\\n}\\n\\n/// @notice Unwrap a UD2x18 number into uint64.\\nfunction unwrap(UD2x18 x) pure returns (uint64 result) {\\n result = UD2x18.unwrap(x);\\n}\\n\\n/// @notice Wraps a uint64 number into UD2x18.\\nfunction wrap(uint64 x) pure returns (UD2x18 result) {\\n result = UD2x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x9b1a35d432ef951a415fae8098b3c609a99b630a3d5464b3c8e1efa8893eea07\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD2x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @dev Euler's number as a UD2x18 number.\\nUD2x18 constant E = UD2x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum value a UD2x18 number can have.\\nuint64 constant uMAX_UD2x18 = 18_446744073709551615;\\nUD2x18 constant MAX_UD2x18 = UD2x18.wrap(uMAX_UD2x18);\\n\\n/// @dev PI as a UD2x18 number.\\nUD2x18 constant PI = UD2x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of UD2x18.\\nUD2x18 constant UNIT = UD2x18.wrap(1e18);\\nuint64 constant uUNIT = 1e18;\\n\",\"keccak256\":\"0x29b0e050c865899e1fb9022b460a7829cdee248c44c4299f068ba80695eec3fc\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD2x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when trying to cast a UD2x18 number that doesn't fit in SD1x18.\\nerror PRBMath_UD2x18_IntoSD1x18_Overflow(UD2x18 x);\\n\\n/// @notice Thrown when trying to cast a UD2x18 number that doesn't fit in uint40.\\nerror PRBMath_UD2x18_IntoUint40_Overflow(UD2x18 x);\\n\",\"keccak256\":\"0xdf1e22f0b4c8032bcc8b7f63fe3984e1387f3dc7b2e9ab381822249f75376d33\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\n\\n/// @notice The unsigned 2.18-decimal fixed-point number representation, which can have up to 2 digits and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\\n/// type uint64. This is useful when end users want to use uint64 to save gas, e.g. with tight variable packing in contract\\n/// storage.\\ntype UD2x18 is uint64;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoSD1x18,\\n Casting.intoSD59x18,\\n Casting.intoUD60x18,\\n Casting.intoUint256,\\n Casting.intoUint128,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for UD2x18 global;\\n\",\"keccak256\":\"0x2802edc9869db116a0b5c490cc5f8554742f747183fa30ac5e9c80bb967e61a1\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Errors.sol\\\" as CastingErrors;\\nimport { MAX_UINT128, MAX_UINT40 } from \\\"../Common.sol\\\";\\nimport { uMAX_SD1x18 } from \\\"../sd1x18/Constants.sol\\\";\\nimport { SD1x18 } from \\\"../sd1x18/ValueType.sol\\\";\\nimport { uMAX_SD59x18 } from \\\"../sd59x18/Constants.sol\\\";\\nimport { SD59x18 } from \\\"../sd59x18/ValueType.sol\\\";\\nimport { uMAX_UD2x18 } from \\\"../ud2x18/Constants.sol\\\";\\nimport { UD2x18 } from \\\"../ud2x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts a UD60x18 number into SD1x18.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `uMAX_SD1x18`.\\nfunction intoSD1x18(UD60x18 x) pure returns (SD1x18 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > uint256(int256(uMAX_SD1x18))) {\\n revert CastingErrors.PRBMath_UD60x18_IntoSD1x18_Overflow(x);\\n }\\n result = SD1x18.wrap(int64(uint64(xUint)));\\n}\\n\\n/// @notice Casts a UD60x18 number into UD2x18.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `uMAX_UD2x18`.\\nfunction intoUD2x18(UD60x18 x) pure returns (UD2x18 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > uMAX_UD2x18) {\\n revert CastingErrors.PRBMath_UD60x18_IntoUD2x18_Overflow(x);\\n }\\n result = UD2x18.wrap(uint64(xUint));\\n}\\n\\n/// @notice Casts a UD60x18 number into SD59x18.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `uMAX_SD59x18`.\\nfunction intoSD59x18(UD60x18 x) pure returns (SD59x18 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > uint256(uMAX_SD59x18)) {\\n revert CastingErrors.PRBMath_UD60x18_IntoSD59x18_Overflow(x);\\n }\\n result = SD59x18.wrap(int256(xUint));\\n}\\n\\n/// @notice Casts a UD60x18 number into uint128.\\n/// @dev This is basically an alias for {unwrap}.\\nfunction intoUint256(UD60x18 x) pure returns (uint256 result) {\\n result = UD60x18.unwrap(x);\\n}\\n\\n/// @notice Casts a UD60x18 number into uint128.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UINT128`.\\nfunction intoUint128(UD60x18 x) pure returns (uint128 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > MAX_UINT128) {\\n revert CastingErrors.PRBMath_UD60x18_IntoUint128_Overflow(x);\\n }\\n result = uint128(xUint);\\n}\\n\\n/// @notice Casts a UD60x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(UD60x18 x) pure returns (uint40 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > MAX_UINT40) {\\n revert CastingErrors.PRBMath_UD60x18_IntoUint40_Overflow(x);\\n }\\n result = uint40(xUint);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction ud(uint256 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(x);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction ud60x18(uint256 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(x);\\n}\\n\\n/// @notice Unwraps a UD60x18 number into uint256.\\nfunction unwrap(UD60x18 x) pure returns (uint256 result) {\\n result = UD60x18.unwrap(x);\\n}\\n\\n/// @notice Wraps a uint256 number into the UD60x18 value type.\\nfunction wrap(uint256 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x5bb532da36921cbdac64d1f16de5d366ef1f664502e3b7c07d0ad06917551f85\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n// NOTICE: the \\\"u\\\" prefix stands for \\\"unwrapped\\\".\\n\\n/// @dev Euler's number as a UD60x18 number.\\nUD60x18 constant E = UD60x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum input permitted in {exp}.\\nuint256 constant uEXP_MAX_INPUT = 133_084258667509499440;\\nUD60x18 constant EXP_MAX_INPUT = UD60x18.wrap(uEXP_MAX_INPUT);\\n\\n/// @dev The maximum input permitted in {exp2}.\\nuint256 constant uEXP2_MAX_INPUT = 192e18 - 1;\\nUD60x18 constant EXP2_MAX_INPUT = UD60x18.wrap(uEXP2_MAX_INPUT);\\n\\n/// @dev Half the UNIT number.\\nuint256 constant uHALF_UNIT = 0.5e18;\\nUD60x18 constant HALF_UNIT = UD60x18.wrap(uHALF_UNIT);\\n\\n/// @dev $log_2(10)$ as a UD60x18 number.\\nuint256 constant uLOG2_10 = 3_321928094887362347;\\nUD60x18 constant LOG2_10 = UD60x18.wrap(uLOG2_10);\\n\\n/// @dev $log_2(e)$ as a UD60x18 number.\\nuint256 constant uLOG2_E = 1_442695040888963407;\\nUD60x18 constant LOG2_E = UD60x18.wrap(uLOG2_E);\\n\\n/// @dev The maximum value a UD60x18 number can have.\\nuint256 constant uMAX_UD60x18 = 115792089237316195423570985008687907853269984665640564039457_584007913129639935;\\nUD60x18 constant MAX_UD60x18 = UD60x18.wrap(uMAX_UD60x18);\\n\\n/// @dev The maximum whole value a UD60x18 number can have.\\nuint256 constant uMAX_WHOLE_UD60x18 = 115792089237316195423570985008687907853269984665640564039457_000000000000000000;\\nUD60x18 constant MAX_WHOLE_UD60x18 = UD60x18.wrap(uMAX_WHOLE_UD60x18);\\n\\n/// @dev PI as a UD60x18 number.\\nUD60x18 constant PI = UD60x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of UD60x18.\\nuint256 constant uUNIT = 1e18;\\nUD60x18 constant UNIT = UD60x18.wrap(uUNIT);\\n\\n/// @dev The unit number squared.\\nuint256 constant uUNIT_SQUARED = 1e36;\\nUD60x18 constant UNIT_SQUARED = UD60x18.wrap(uUNIT_SQUARED);\\n\\n/// @dev Zero as a UD60x18 number.\\nUD60x18 constant ZERO = UD60x18.wrap(0);\\n\",\"keccak256\":\"0x2b80d26153d3fdcfb3a9ca772d9309d31ed1275f5b8b54c3ffb54d3652b37d90\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Conversions.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { uMAX_UD60x18, uUNIT } from \\\"./Constants.sol\\\";\\nimport { PRBMath_UD60x18_Convert_Overflow } from \\\"./Errors.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Converts a UD60x18 number to a simple integer by dividing it by `UNIT`.\\n/// @dev The result is rounded toward zero.\\n/// @param x The UD60x18 number to convert.\\n/// @return result The same number in basic integer form.\\nfunction convert(UD60x18 x) pure returns (uint256 result) {\\n result = UD60x18.unwrap(x) / uUNIT;\\n}\\n\\n/// @notice Converts a simple integer to UD60x18 by multiplying it by `UNIT`.\\n///\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UD60x18 / UNIT`.\\n///\\n/// @param x The basic integer to convert.\\n/// @param result The same number converted to UD60x18.\\nfunction convert(uint256 x) pure returns (UD60x18 result) {\\n if (x > uMAX_UD60x18 / uUNIT) {\\n revert PRBMath_UD60x18_Convert_Overflow(x);\\n }\\n unchecked {\\n result = UD60x18.wrap(x * uUNIT);\\n }\\n}\\n\",\"keccak256\":\"0xaf7fc2523413822de3b66ba339fe2884fb3b8c6f6cf38ec90a2c3e3aae71df6b\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when ceiling a number overflows UD60x18.\\nerror PRBMath_UD60x18_Ceil_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when converting a basic integer to the fixed-point format overflows UD60x18.\\nerror PRBMath_UD60x18_Convert_Overflow(uint256 x);\\n\\n/// @notice Thrown when taking the natural exponent of a base greater than 133_084258667509499441.\\nerror PRBMath_UD60x18_Exp_InputTooBig(UD60x18 x);\\n\\n/// @notice Thrown when taking the binary exponent of a base greater than 192e18.\\nerror PRBMath_UD60x18_Exp2_InputTooBig(UD60x18 x);\\n\\n/// @notice Thrown when taking the geometric mean of two numbers and multiplying them overflows UD60x18.\\nerror PRBMath_UD60x18_Gm_Overflow(UD60x18 x, UD60x18 y);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\\nerror PRBMath_UD60x18_IntoSD1x18_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD59x18.\\nerror PRBMath_UD60x18_IntoSD59x18_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\\nerror PRBMath_UD60x18_IntoUD2x18_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\\nerror PRBMath_UD60x18_IntoUint128_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\\nerror PRBMath_UD60x18_IntoUint40_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when taking the logarithm of a number less than 1.\\nerror PRBMath_UD60x18_Log_InputTooSmall(UD60x18 x);\\n\\n/// @notice Thrown when calculating the square root overflows UD60x18.\\nerror PRBMath_UD60x18_Sqrt_Overflow(UD60x18 x);\\n\",\"keccak256\":\"0xa8c60d4066248df22c49c882873efbc017344107edabc48c52209abbc39cb1e3\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Helpers.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { wrap } from \\\"./Casting.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Implements the checked addition operation (+) in the UD60x18 type.\\nfunction add(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() + y.unwrap());\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the UD60x18 type.\\nfunction and(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() & bits);\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the UD60x18 type.\\nfunction and2(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() & y.unwrap());\\n}\\n\\n/// @notice Implements the equal operation (==) in the UD60x18 type.\\nfunction eq(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() == y.unwrap();\\n}\\n\\n/// @notice Implements the greater than operation (>) in the UD60x18 type.\\nfunction gt(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() > y.unwrap();\\n}\\n\\n/// @notice Implements the greater than or equal to operation (>=) in the UD60x18 type.\\nfunction gte(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() >= y.unwrap();\\n}\\n\\n/// @notice Implements a zero comparison check function in the UD60x18 type.\\nfunction isZero(UD60x18 x) pure returns (bool result) {\\n // This wouldn't work if x could be negative.\\n result = x.unwrap() == 0;\\n}\\n\\n/// @notice Implements the left shift operation (<<) in the UD60x18 type.\\nfunction lshift(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() << bits);\\n}\\n\\n/// @notice Implements the lower than operation (<) in the UD60x18 type.\\nfunction lt(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() < y.unwrap();\\n}\\n\\n/// @notice Implements the lower than or equal to operation (<=) in the UD60x18 type.\\nfunction lte(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() <= y.unwrap();\\n}\\n\\n/// @notice Implements the checked modulo operation (%) in the UD60x18 type.\\nfunction mod(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() % y.unwrap());\\n}\\n\\n/// @notice Implements the not equal operation (!=) in the UD60x18 type.\\nfunction neq(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() != y.unwrap();\\n}\\n\\n/// @notice Implements the NOT (~) bitwise operation in the UD60x18 type.\\nfunction not(UD60x18 x) pure returns (UD60x18 result) {\\n result = wrap(~x.unwrap());\\n}\\n\\n/// @notice Implements the OR (|) bitwise operation in the UD60x18 type.\\nfunction or(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() | y.unwrap());\\n}\\n\\n/// @notice Implements the right shift operation (>>) in the UD60x18 type.\\nfunction rshift(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() >> bits);\\n}\\n\\n/// @notice Implements the checked subtraction operation (-) in the UD60x18 type.\\nfunction sub(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() - y.unwrap());\\n}\\n\\n/// @notice Implements the unchecked addition operation (+) in the UD60x18 type.\\nfunction uncheckedAdd(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() + y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the unchecked subtraction operation (-) in the UD60x18 type.\\nfunction uncheckedSub(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() - y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the XOR (^) bitwise operation in the UD60x18 type.\\nfunction xor(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() ^ y.unwrap());\\n}\\n\",\"keccak256\":\"0xf5faff881391d2c060029499a666cc5f0bea90a213150bb476fae8f02a5df268\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as Errors;\\nimport { wrap } from \\\"./Casting.sol\\\";\\nimport {\\n uEXP_MAX_INPUT,\\n uEXP2_MAX_INPUT,\\n uHALF_UNIT,\\n uLOG2_10,\\n uLOG2_E,\\n uMAX_UD60x18,\\n uMAX_WHOLE_UD60x18,\\n UNIT,\\n uUNIT,\\n uUNIT_SQUARED,\\n ZERO\\n} from \\\"./Constants.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n MATHEMATICAL FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @notice Calculates the arithmetic average of x and y using the following formula:\\n///\\n/// $$\\n/// avg(x, y) = (x & y) + ((xUint ^ yUint) / 2)\\n/// $$\\n///\\n/// In English, this is what this formula does:\\n///\\n/// 1. AND x and y.\\n/// 2. Calculate half of XOR x and y.\\n/// 3. Add the two results together.\\n///\\n/// This technique is known as SWAR, which stands for \\\"SIMD within a register\\\". You can read more about it here:\\n/// https://devblogs.microsoft.com/oldnewthing/20220207-00/?p=106223\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// @param x The first operand as a UD60x18 number.\\n/// @param y The second operand as a UD60x18 number.\\n/// @return result The arithmetic average as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction avg(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n uint256 yUint = y.unwrap();\\n unchecked {\\n result = wrap((xUint & yUint) + ((xUint ^ yUint) >> 1));\\n }\\n}\\n\\n/// @notice Yields the smallest whole number greater than or equal to x.\\n///\\n/// @dev This is optimized for fractional value inputs, because for every whole value there are (1e18 - 1) fractional\\n/// counterparts. See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n///\\n/// Requirements:\\n/// - x must be less than or equal to `MAX_WHOLE_UD60x18`.\\n///\\n/// @param x The UD60x18 number to ceil.\\n/// @param result The smallest whole number greater than or equal to x, as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ceil(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n if (xUint > uMAX_WHOLE_UD60x18) {\\n revert Errors.PRBMath_UD60x18_Ceil_Overflow(x);\\n }\\n\\n assembly (\\\"memory-safe\\\") {\\n // Equivalent to `x % UNIT`.\\n let remainder := mod(x, uUNIT)\\n\\n // Equivalent to `UNIT - remainder`.\\n let delta := sub(uUNIT, remainder)\\n\\n // Equivalent to `x + remainder > 0 ? delta : 0`.\\n result := add(x, mul(delta, gt(remainder, 0)))\\n }\\n}\\n\\n/// @notice Divides two UD60x18 numbers, returning a new UD60x18 number.\\n///\\n/// @dev Uses {Common.mulDiv} to enable overflow-safe multiplication and division.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv}.\\n///\\n/// @param x The numerator as a UD60x18 number.\\n/// @param y The denominator as a UD60x18 number.\\n/// @param result The quotient as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction div(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(Common.mulDiv(x.unwrap(), uUNIT, y.unwrap()));\\n}\\n\\n/// @notice Calculates the natural exponent of x using the following formula:\\n///\\n/// $$\\n/// e^x = 2^{x * log_2{e}}\\n/// $$\\n///\\n/// @dev Requirements:\\n/// - x must be less than 133_084258667509499441.\\n///\\n/// @param x The exponent as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n // This check prevents values greater than 192e18 from being passed to {exp2}.\\n if (xUint > uEXP_MAX_INPUT) {\\n revert Errors.PRBMath_UD60x18_Exp_InputTooBig(x);\\n }\\n\\n unchecked {\\n // Inline the fixed-point multiplication to save gas.\\n uint256 doubleUnitProduct = xUint * uLOG2_E;\\n result = exp2(wrap(doubleUnitProduct / uUNIT));\\n }\\n}\\n\\n/// @notice Calculates the binary exponent of x using the binary fraction method.\\n///\\n/// @dev See https://ethereum.stackexchange.com/q/79903/24693\\n///\\n/// Requirements:\\n/// - x must be less than 192e18.\\n/// - The result must fit in UD60x18.\\n///\\n/// @param x The exponent as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp2(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n // Numbers greater than or equal to 192e18 don't fit in the 192.64-bit format.\\n if (xUint > uEXP2_MAX_INPUT) {\\n revert Errors.PRBMath_UD60x18_Exp2_InputTooBig(x);\\n }\\n\\n // Convert x to the 192.64-bit fixed-point format.\\n uint256 x_192x64 = (xUint << 64) / uUNIT;\\n\\n // Pass x to the {Common.exp2} function, which uses the 192.64-bit fixed-point number representation.\\n result = wrap(Common.exp2(x_192x64));\\n}\\n\\n/// @notice Yields the greatest whole number less than or equal to x.\\n/// @dev Optimized for fractional value inputs, because every whole value has (1e18 - 1) fractional counterparts.\\n/// See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n/// @param x The UD60x18 number to floor.\\n/// @param result The greatest whole number less than or equal to x, as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction floor(UD60x18 x) pure returns (UD60x18 result) {\\n assembly (\\\"memory-safe\\\") {\\n // Equivalent to `x % UNIT`.\\n let remainder := mod(x, uUNIT)\\n\\n // Equivalent to `x - remainder > 0 ? remainder : 0)`.\\n result := sub(x, mul(remainder, gt(remainder, 0)))\\n }\\n}\\n\\n/// @notice Yields the excess beyond the floor of x using the odd function definition.\\n/// @dev See https://en.wikipedia.org/wiki/Fractional_part.\\n/// @param x The UD60x18 number to get the fractional part of.\\n/// @param result The fractional part of x as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction frac(UD60x18 x) pure returns (UD60x18 result) {\\n assembly (\\\"memory-safe\\\") {\\n result := mod(x, uUNIT)\\n }\\n}\\n\\n/// @notice Calculates the geometric mean of x and y, i.e. $\\\\sqrt{x * y}$, rounding down.\\n///\\n/// @dev Requirements:\\n/// - x * y must fit in UD60x18.\\n///\\n/// @param x The first operand as a UD60x18 number.\\n/// @param y The second operand as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction gm(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n uint256 yUint = y.unwrap();\\n if (xUint == 0 || yUint == 0) {\\n return ZERO;\\n }\\n\\n unchecked {\\n // Checking for overflow this way is faster than letting Solidity do it.\\n uint256 xyUint = xUint * yUint;\\n if (xyUint / xUint != yUint) {\\n revert Errors.PRBMath_UD60x18_Gm_Overflow(x, y);\\n }\\n\\n // We don't need to multiply the result by `UNIT` here because the x*y product picked up a factor of `UNIT`\\n // during multiplication. See the comments in {Common.sqrt}.\\n result = wrap(Common.sqrt(xyUint));\\n }\\n}\\n\\n/// @notice Calculates the inverse of x.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x must not be zero.\\n///\\n/// @param x The UD60x18 number for which to calculate the inverse.\\n/// @return result The inverse as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction inv(UD60x18 x) pure returns (UD60x18 result) {\\n unchecked {\\n result = wrap(uUNIT_SQUARED / x.unwrap());\\n }\\n}\\n\\n/// @notice Calculates the natural logarithm of x using the following formula:\\n///\\n/// $$\\n/// ln{x} = log_2{x} / log_2{e}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n/// - The precision isn't sufficiently fine-grained to return exactly `UNIT` when the input is `E`.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The UD60x18 number for which to calculate the natural logarithm.\\n/// @return result The natural logarithm as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ln(UD60x18 x) pure returns (UD60x18 result) {\\n unchecked {\\n // Inline the fixed-point multiplication to save gas. This is overflow-safe because the maximum value that\\n // {log2} can return is ~196_205294292027477728.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_E);\\n }\\n}\\n\\n/// @notice Calculates the common logarithm of x using the following formula:\\n///\\n/// $$\\n/// log_{10}{x} = log_2{x} / log_2{10}\\n/// $$\\n///\\n/// However, if x is an exact power of ten, a hard coded value is returned.\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The UD60x18 number for which to calculate the common logarithm.\\n/// @return result The common logarithm as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log10(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n if (xUint < uUNIT) {\\n revert Errors.PRBMath_UD60x18_Log_InputTooSmall(x);\\n }\\n\\n // Note that the `mul` in this assembly block is the standard multiplication operation, not {UD60x18.mul}.\\n // prettier-ignore\\n assembly (\\\"memory-safe\\\") {\\n switch x\\n case 1 { result := mul(uUNIT, sub(0, 18)) }\\n case 10 { result := mul(uUNIT, sub(1, 18)) }\\n case 100 { result := mul(uUNIT, sub(2, 18)) }\\n case 1000 { result := mul(uUNIT, sub(3, 18)) }\\n case 10000 { result := mul(uUNIT, sub(4, 18)) }\\n case 100000 { result := mul(uUNIT, sub(5, 18)) }\\n case 1000000 { result := mul(uUNIT, sub(6, 18)) }\\n case 10000000 { result := mul(uUNIT, sub(7, 18)) }\\n case 100000000 { result := mul(uUNIT, sub(8, 18)) }\\n case 1000000000 { result := mul(uUNIT, sub(9, 18)) }\\n case 10000000000 { result := mul(uUNIT, sub(10, 18)) }\\n case 100000000000 { result := mul(uUNIT, sub(11, 18)) }\\n case 1000000000000 { result := mul(uUNIT, sub(12, 18)) }\\n case 10000000000000 { result := mul(uUNIT, sub(13, 18)) }\\n case 100000000000000 { result := mul(uUNIT, sub(14, 18)) }\\n case 1000000000000000 { result := mul(uUNIT, sub(15, 18)) }\\n case 10000000000000000 { result := mul(uUNIT, sub(16, 18)) }\\n case 100000000000000000 { result := mul(uUNIT, sub(17, 18)) }\\n case 1000000000000000000 { result := 0 }\\n case 10000000000000000000 { result := uUNIT }\\n case 100000000000000000000 { result := mul(uUNIT, 2) }\\n case 1000000000000000000000 { result := mul(uUNIT, 3) }\\n case 10000000000000000000000 { result := mul(uUNIT, 4) }\\n case 100000000000000000000000 { result := mul(uUNIT, 5) }\\n case 1000000000000000000000000 { result := mul(uUNIT, 6) }\\n case 10000000000000000000000000 { result := mul(uUNIT, 7) }\\n case 100000000000000000000000000 { result := mul(uUNIT, 8) }\\n case 1000000000000000000000000000 { result := mul(uUNIT, 9) }\\n case 10000000000000000000000000000 { result := mul(uUNIT, 10) }\\n case 100000000000000000000000000000 { result := mul(uUNIT, 11) }\\n case 1000000000000000000000000000000 { result := mul(uUNIT, 12) }\\n case 10000000000000000000000000000000 { result := mul(uUNIT, 13) }\\n case 100000000000000000000000000000000 { result := mul(uUNIT, 14) }\\n case 1000000000000000000000000000000000 { result := mul(uUNIT, 15) }\\n case 10000000000000000000000000000000000 { result := mul(uUNIT, 16) }\\n case 100000000000000000000000000000000000 { result := mul(uUNIT, 17) }\\n case 1000000000000000000000000000000000000 { result := mul(uUNIT, 18) }\\n case 10000000000000000000000000000000000000 { result := mul(uUNIT, 19) }\\n case 100000000000000000000000000000000000000 { result := mul(uUNIT, 20) }\\n case 1000000000000000000000000000000000000000 { result := mul(uUNIT, 21) }\\n case 10000000000000000000000000000000000000000 { result := mul(uUNIT, 22) }\\n case 100000000000000000000000000000000000000000 { result := mul(uUNIT, 23) }\\n case 1000000000000000000000000000000000000000000 { result := mul(uUNIT, 24) }\\n case 10000000000000000000000000000000000000000000 { result := mul(uUNIT, 25) }\\n case 100000000000000000000000000000000000000000000 { result := mul(uUNIT, 26) }\\n case 1000000000000000000000000000000000000000000000 { result := mul(uUNIT, 27) }\\n case 10000000000000000000000000000000000000000000000 { result := mul(uUNIT, 28) }\\n case 100000000000000000000000000000000000000000000000 { result := mul(uUNIT, 29) }\\n case 1000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 30) }\\n case 10000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 31) }\\n case 100000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 32) }\\n case 1000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 33) }\\n case 10000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 34) }\\n case 100000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 35) }\\n case 1000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 36) }\\n case 10000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 37) }\\n case 100000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 38) }\\n case 1000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 39) }\\n case 10000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 40) }\\n case 100000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 41) }\\n case 1000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 42) }\\n case 10000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 43) }\\n case 100000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 44) }\\n case 1000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 45) }\\n case 10000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 46) }\\n case 100000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 47) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 48) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 49) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 50) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 51) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 52) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 53) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 54) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 55) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 56) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 57) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 58) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 59) }\\n default { result := uMAX_UD60x18 }\\n }\\n\\n if (result.unwrap() == uMAX_UD60x18) {\\n unchecked {\\n // Inline the fixed-point division to save gas.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_10);\\n }\\n }\\n}\\n\\n/// @notice Calculates the binary logarithm of x using the iterative approximation algorithm:\\n///\\n/// $$\\n/// log_2{x} = n + log_2{y}, \\\\text{ where } y = x*2^{-n}, \\\\ y \\\\in [1, 2)\\n/// $$\\n///\\n/// For $0 \\\\leq x \\\\lt 1$, the input is inverted:\\n///\\n/// $$\\n/// log_2{x} = -log_2{\\\\frac{1}{x}}\\n/// $$\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Binary_logarithm#Iterative_approximation\\n///\\n/// Notes:\\n/// - Due to the lossy precision of the iterative approximation, the results are not perfectly accurate to the last decimal.\\n///\\n/// Requirements:\\n/// - x must be greater than zero.\\n///\\n/// @param x The UD60x18 number for which to calculate the binary logarithm.\\n/// @return result The binary logarithm as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log2(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n if (xUint < uUNIT) {\\n revert Errors.PRBMath_UD60x18_Log_InputTooSmall(x);\\n }\\n\\n unchecked {\\n // Calculate the integer part of the logarithm.\\n uint256 n = Common.msb(xUint / uUNIT);\\n\\n // This is the integer part of the logarithm as a UD60x18 number. The operation can't overflow because n\\n // n is at most 255 and UNIT is 1e18.\\n uint256 resultUint = n * uUNIT;\\n\\n // Calculate $y = x * 2^{-n}$.\\n uint256 y = xUint >> n;\\n\\n // If y is the unit number, the fractional part is zero.\\n if (y == uUNIT) {\\n return wrap(resultUint);\\n }\\n\\n // Calculate the fractional part via the iterative approximation.\\n // The `delta >>= 1` part is equivalent to `delta /= 2`, but shifting bits is more gas efficient.\\n uint256 DOUBLE_UNIT = 2e18;\\n for (uint256 delta = uHALF_UNIT; delta > 0; delta >>= 1) {\\n y = (y * y) / uUNIT;\\n\\n // Is y^2 >= 2e18 and so in the range [2e18, 4e18)?\\n if (y >= DOUBLE_UNIT) {\\n // Add the 2^{-m} factor to the logarithm.\\n resultUint += delta;\\n\\n // Halve y, which corresponds to z/2 in the Wikipedia article.\\n y >>= 1;\\n }\\n }\\n result = wrap(resultUint);\\n }\\n}\\n\\n/// @notice Multiplies two UD60x18 numbers together, returning a new UD60x18 number.\\n///\\n/// @dev Uses {Common.mulDiv} to enable overflow-safe multiplication and division.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv}.\\n///\\n/// @dev See the documentation in {Common.mulDiv18}.\\n/// @param x The multiplicand as a UD60x18 number.\\n/// @param y The multiplier as a UD60x18 number.\\n/// @return result The product as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mul(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(Common.mulDiv18(x.unwrap(), y.unwrap()));\\n}\\n\\n/// @notice Raises x to the power of y.\\n///\\n/// For $1 \\\\leq x \\\\leq \\\\infty$, the following standard formula is used:\\n///\\n/// $$\\n/// x^y = 2^{log_2{x} * y}\\n/// $$\\n///\\n/// For $0 \\\\leq x \\\\lt 1$, since the unsigned {log2} is undefined, an equivalent formula is used:\\n///\\n/// $$\\n/// i = \\\\frac{1}{x}\\n/// w = 2^{log_2{i} * y}\\n/// x^y = \\\\frac{1}{w}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2} and {mul}.\\n/// - Returns `UNIT` for 0^0.\\n/// - It may not perform well with very small values of x. Consider using SD59x18 as an alternative.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {exp2}, {log2}, and {mul}.\\n///\\n/// @param x The base as a UD60x18 number.\\n/// @param y The exponent as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction pow(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n uint256 yUint = y.unwrap();\\n\\n // If both x and y are zero, the result is `UNIT`. If just x is zero, the result is always zero.\\n if (xUint == 0) {\\n return yUint == 0 ? UNIT : ZERO;\\n }\\n // If x is `UNIT`, the result is always `UNIT`.\\n else if (xUint == uUNIT) {\\n return UNIT;\\n }\\n\\n // If y is zero, the result is always `UNIT`.\\n if (yUint == 0) {\\n return UNIT;\\n }\\n // If y is `UNIT`, the result is always x.\\n else if (yUint == uUNIT) {\\n return x;\\n }\\n\\n // If x is greater than `UNIT`, use the standard formula.\\n if (xUint > uUNIT) {\\n result = exp2(mul(log2(x), y));\\n }\\n // Conversely, if x is less than `UNIT`, use the equivalent formula.\\n else {\\n UD60x18 i = wrap(uUNIT_SQUARED / xUint);\\n UD60x18 w = exp2(mul(log2(i), y));\\n result = wrap(uUNIT_SQUARED / w.unwrap());\\n }\\n}\\n\\n/// @notice Raises x (a UD60x18 number) to the power y (an unsigned basic integer) using the well-known\\n/// algorithm \\\"exponentiation by squaring\\\".\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Exponentiation_by_squaring.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv18}.\\n/// - Returns `UNIT` for 0^0.\\n///\\n/// Requirements:\\n/// - The result must fit in UD60x18.\\n///\\n/// @param x The base as a UD60x18 number.\\n/// @param y The exponent as a uint256.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction powu(UD60x18 x, uint256 y) pure returns (UD60x18 result) {\\n // Calculate the first iteration of the loop in advance.\\n uint256 xUint = x.unwrap();\\n uint256 resultUint = y & 1 > 0 ? xUint : uUNIT;\\n\\n // Equivalent to `for(y /= 2; y > 0; y /= 2)`.\\n for (y >>= 1; y > 0; y >>= 1) {\\n xUint = Common.mulDiv18(xUint, xUint);\\n\\n // Equivalent to `y % 2 == 1`.\\n if (y & 1 > 0) {\\n resultUint = Common.mulDiv18(resultUint, xUint);\\n }\\n }\\n result = wrap(resultUint);\\n}\\n\\n/// @notice Calculates the square root of x using the Babylonian method.\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\\n///\\n/// Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x must be less than `MAX_UD60x18 / UNIT`.\\n///\\n/// @param x The UD60x18 number for which to calculate the square root.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction sqrt(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n unchecked {\\n if (xUint > uMAX_UD60x18 / uUNIT) {\\n revert Errors.PRBMath_UD60x18_Sqrt_Overflow(x);\\n }\\n // Multiply x by `UNIT` to account for the factor of `UNIT` picked up when multiplying two UD60x18 numbers.\\n // In this case, the two numbers are both the square root.\\n result = wrap(Common.sqrt(xUint * uUNIT));\\n }\\n}\\n\",\"keccak256\":\"0x462144667aac3f96d5f8dba7aa68fe4c5a3f61e1d7bbbc81bee21168817f9c09\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\nimport \\\"./Helpers.sol\\\" as Helpers;\\nimport \\\"./Math.sol\\\" as Math;\\n\\n/// @notice The unsigned 60.18-decimal fixed-point number representation, which can have up to 60 digits and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the Solidity type uint256.\\n/// @dev The value type is defined here so it can be imported in all other files.\\ntype UD60x18 is uint256;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoSD1x18,\\n Casting.intoUD2x18,\\n Casting.intoSD59x18,\\n Casting.intoUint128,\\n Casting.intoUint256,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for UD60x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n MATHEMATICAL FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes the functions in this library callable on the UD60x18 type.\\nusing {\\n Math.avg,\\n Math.ceil,\\n Math.div,\\n Math.exp,\\n Math.exp2,\\n Math.floor,\\n Math.frac,\\n Math.gm,\\n Math.inv,\\n Math.ln,\\n Math.log10,\\n Math.log2,\\n Math.mul,\\n Math.pow,\\n Math.powu,\\n Math.sqrt\\n} for UD60x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n HELPER FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes the functions in this library callable on the UD60x18 type.\\nusing {\\n Helpers.add,\\n Helpers.and,\\n Helpers.eq,\\n Helpers.gt,\\n Helpers.gte,\\n Helpers.isZero,\\n Helpers.lshift,\\n Helpers.lt,\\n Helpers.lte,\\n Helpers.mod,\\n Helpers.neq,\\n Helpers.not,\\n Helpers.or,\\n Helpers.rshift,\\n Helpers.sub,\\n Helpers.uncheckedAdd,\\n Helpers.uncheckedSub,\\n Helpers.xor\\n} for UD60x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n OPERATORS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes it possible to use these operators on the UD60x18 type.\\nusing {\\n Helpers.add as +,\\n Helpers.and2 as &,\\n Math.div as /,\\n Helpers.eq as ==,\\n Helpers.gt as >,\\n Helpers.gte as >=,\\n Helpers.lt as <,\\n Helpers.lte as <=,\\n Helpers.or as |,\\n Helpers.mod as %,\\n Math.mul as *,\\n Helpers.neq as !=,\\n Helpers.not as ~,\\n Helpers.sub as -,\\n Helpers.xor as ^\\n} for UD60x18 global;\\n\",\"keccak256\":\"0xdd873b5124180d9b71498b3a7fe93b1c08c368bec741f7d5f8e17f78a0b70f31\",\"license\":\"MIT\"},\"contracts/interfaces/IERC6551Registry.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\ninterface IERC6551Registry {\\n /**\\n * @dev Creates a token bound account for a non-fungible token.\\n *\\n * If account has already been created, returns the account address without calling create2.\\n *\\n * Emits ERC6551AccountCreated event.\\n *\\n * @return account The address of the token bound account\\n */\\n function createAccount(\\n address implementation,\\n bytes32 salt,\\n uint256 chainId,\\n address tokenContract,\\n uint256 tokenId\\n ) external returns (address account);\\n}\\n\",\"keccak256\":\"0x64c52de8a8e68398e61dd8b42dda8e9af8cf6abf93bb85629c322440991ea568\",\"license\":\"MIT\"},\"contracts/interfaces/hats/HatsErrors.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface HatsErrors {\\n /// @notice Emitted when `user` is attempting to perform an action on `hatId` but is not wearing one of `hatId`'s admin hats\\n /// @dev Can be equivalent to `NotHatWearer(buildHatId(hatId))`, such as when emitted by `approveLinkTopHatToTree` or `relinkTopHatToTree`\\n error NotAdmin(address user, uint256 hatId);\\n\\n /// @notice Emitted when attempting to perform an action as or for an account that is not a wearer of a given hat\\n error NotHatWearer();\\n\\n /// @notice Emitted when attempting to perform an action that requires being either an admin or wearer of a given hat\\n error NotAdminOrWearer();\\n\\n /// @notice Emitted when attempting to mint `hatId` but `hatId`'s maxSupply has been reached\\n error AllHatsWorn(uint256 hatId);\\n\\n /// @notice Emitted when attempting to create a hat with a level 14 hat as its admin\\n error MaxLevelsReached();\\n\\n /// @notice Emitted when an attempted hat id has empty intermediate level(s)\\n error InvalidHatId();\\n\\n /// @notice Emitted when attempting to mint `hatId` to a `wearer` who is already wearing the hat\\n error AlreadyWearingHat(address wearer, uint256 hatId);\\n\\n /// @notice Emitted when attempting to mint a non-existant hat\\n error HatDoesNotExist(uint256 hatId);\\n\\n /// @notice Emmitted when attempting to mint or transfer a hat that is not active\\n error HatNotActive();\\n\\n /// @notice Emitted when attempting to mint or transfer a hat to an ineligible wearer\\n error NotEligible();\\n\\n /// @notice Emitted when attempting to check or set a hat's status from an account that is not that hat's toggle module\\n error NotHatsToggle();\\n\\n /// @notice Emitted when attempting to check or set a hat wearer's status from an account that is not that hat's eligibility module\\n error NotHatsEligibility();\\n\\n /// @notice Emitted when array arguments to a batch function have mismatching lengths\\n error BatchArrayLengthMismatch();\\n\\n /// @notice Emitted when attempting to mutate or transfer an immutable hat\\n error Immutable();\\n\\n /// @notice Emitted when attempting to change a hat's maxSupply to a value lower than its current supply\\n error NewMaxSupplyTooLow();\\n\\n /// @notice Emitted when attempting to link a tophat to a new admin for which the tophat serves as an admin\\n error CircularLinkage();\\n\\n /// @notice Emitted when attempting to link or relink a tophat to a separate tree\\n error CrossTreeLinkage();\\n\\n /// @notice Emitted when attempting to link a tophat without a request\\n error LinkageNotRequested();\\n\\n /// @notice Emitted when attempting to unlink a tophat that does not have a wearer\\n /// @dev This ensures that unlinking never results in a bricked tophat\\n error InvalidUnlink();\\n\\n /// @notice Emmited when attempting to change a hat's eligibility or toggle module to the zero address\\n error ZeroAddress();\\n\\n /// @notice Emmitted when attempting to change a hat's details or imageURI to a string with over 7000 bytes (~characters)\\n /// @dev This protects against a DOS attack where an admin iteratively extend's a hat's details or imageURI\\n /// to be so long that reading it exceeds the block gas limit, breaking `uri()` and `viewHat()`\\n error StringTooLong();\\n}\\n\",\"keccak256\":\"0x81b0056b7bed86eabc07c0e4a9655c586ddb8e6c128320593669b76efd5a08de\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/HatsEvents.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface HatsEvents {\\n /// @notice Emitted when a new hat is created\\n /// @param id The id for the new hat\\n /// @param details A description of the Hat\\n /// @param maxSupply The total instances of the Hat that can be worn at once\\n /// @param eligibility The address that can report on the Hat wearer's status\\n /// @param toggle The address that can deactivate the Hat\\n /// @param mutable_ Whether the hat's properties are changeable after creation\\n /// @param imageURI The image uri for this hat and the fallback for its\\n event HatCreated(\\n uint256 id,\\n string details,\\n uint32 maxSupply,\\n address eligibility,\\n address toggle,\\n bool mutable_,\\n string imageURI\\n );\\n\\n /// @notice Emitted when a hat wearer's standing is updated\\n /// @dev Eligibility is excluded since the source of truth for eligibility is the eligibility module and may change without a transaction\\n /// @param hatId The id of the wearer's hat\\n /// @param wearer The wearer's address\\n /// @param wearerStanding Whether the wearer is in good standing for the hat\\n event WearerStandingChanged(\\n uint256 hatId,\\n address wearer,\\n bool wearerStanding\\n );\\n\\n /// @notice Emitted when a hat's status is updated\\n /// @param hatId The id of the hat\\n /// @param newStatus Whether the hat is active\\n event HatStatusChanged(uint256 hatId, bool newStatus);\\n\\n /// @notice Emitted when a hat's details are updated\\n /// @param hatId The id of the hat\\n /// @param newDetails The updated details\\n event HatDetailsChanged(uint256 hatId, string newDetails);\\n\\n /// @notice Emitted when a hat's eligibility module is updated\\n /// @param hatId The id of the hat\\n /// @param newEligibility The updated eligibiliy module\\n event HatEligibilityChanged(uint256 hatId, address newEligibility);\\n\\n /// @notice Emitted when a hat's toggle module is updated\\n /// @param hatId The id of the hat\\n /// @param newToggle The updated toggle module\\n event HatToggleChanged(uint256 hatId, address newToggle);\\n\\n /// @notice Emitted when a hat's mutability is updated\\n /// @param hatId The id of the hat\\n event HatMutabilityChanged(uint256 hatId);\\n\\n /// @notice Emitted when a hat's maximum supply is updated\\n /// @param hatId The id of the hat\\n /// @param newMaxSupply The updated max supply\\n event HatMaxSupplyChanged(uint256 hatId, uint32 newMaxSupply);\\n\\n /// @notice Emitted when a hat's image URI is updated\\n /// @param hatId The id of the hat\\n /// @param newImageURI The updated image URI\\n event HatImageURIChanged(uint256 hatId, string newImageURI);\\n\\n /// @notice Emitted when a tophat linkage is requested by its admin\\n /// @param domain The domain of the tree tophat to link\\n /// @param newAdmin The tophat's would-be admin in the parent tree\\n event TopHatLinkRequested(uint32 domain, uint256 newAdmin);\\n\\n /// @notice Emitted when a tophat is linked to a another tree\\n /// @param domain The domain of the newly-linked tophat\\n /// @param newAdmin The tophat's new admin in the parent tree\\n event TopHatLinked(uint32 domain, uint256 newAdmin);\\n}\\n\",\"keccak256\":\"0x53413397d15e1636c3cd7bd667656b79bc2886785403b824bcd4ed122667f2c6\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/IHats.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\nimport \\\"./IHatsIdUtilities.sol\\\";\\nimport \\\"./HatsErrors.sol\\\";\\nimport \\\"./HatsEvents.sol\\\";\\n\\ninterface IHats is IHatsIdUtilities, HatsErrors, HatsEvents {\\n function mintTopHat(\\n address _target,\\n string memory _details,\\n string memory _imageURI\\n ) external returns (uint256 topHatId);\\n\\n function createHat(\\n uint256 _admin,\\n string calldata _details,\\n uint32 _maxSupply,\\n address _eligibility,\\n address _toggle,\\n bool _mutable,\\n string calldata _imageURI\\n ) external returns (uint256 newHatId);\\n\\n function batchCreateHats(\\n uint256[] calldata _admins,\\n string[] calldata _details,\\n uint32[] calldata _maxSupplies,\\n address[] memory _eligibilityModules,\\n address[] memory _toggleModules,\\n bool[] calldata _mutables,\\n string[] calldata _imageURIs\\n ) external returns (bool success);\\n\\n function getNextId(uint256 _admin) external view returns (uint256 nextId);\\n\\n function mintHat(\\n uint256 _hatId,\\n address _wearer\\n ) external returns (bool success);\\n\\n function batchMintHats(\\n uint256[] calldata _hatIds,\\n address[] calldata _wearers\\n ) external returns (bool success);\\n\\n function setHatStatus(\\n uint256 _hatId,\\n bool _newStatus\\n ) external returns (bool toggled);\\n\\n function checkHatStatus(uint256 _hatId) external returns (bool toggled);\\n\\n function setHatWearerStatus(\\n uint256 _hatId,\\n address _wearer,\\n bool _eligible,\\n bool _standing\\n ) external returns (bool updated);\\n\\n function checkHatWearerStatus(\\n uint256 _hatId,\\n address _wearer\\n ) external returns (bool updated);\\n\\n function renounceHat(uint256 _hatId) external;\\n\\n function transferHat(uint256 _hatId, address _from, address _to) external;\\n\\n /*//////////////////////////////////////////////////////////////\\n HATS ADMIN FUNCTIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n function makeHatImmutable(uint256 _hatId) external;\\n\\n function changeHatDetails(\\n uint256 _hatId,\\n string memory _newDetails\\n ) external;\\n\\n function changeHatEligibility(\\n uint256 _hatId,\\n address _newEligibility\\n ) external;\\n\\n function changeHatToggle(uint256 _hatId, address _newToggle) external;\\n\\n function changeHatImageURI(\\n uint256 _hatId,\\n string memory _newImageURI\\n ) external;\\n\\n function changeHatMaxSupply(uint256 _hatId, uint32 _newMaxSupply) external;\\n\\n function requestLinkTopHatToTree(\\n uint32 _topHatId,\\n uint256 _newAdminHat\\n ) external;\\n\\n function approveLinkTopHatToTree(\\n uint32 _topHatId,\\n uint256 _newAdminHat,\\n address _eligibility,\\n address _toggle,\\n string calldata _details,\\n string calldata _imageURI\\n ) external;\\n\\n function unlinkTopHatFromTree(uint32 _topHatId, address _wearer) external;\\n\\n function relinkTopHatWithinTree(\\n uint32 _topHatDomain,\\n uint256 _newAdminHat,\\n address _eligibility,\\n address _toggle,\\n string calldata _details,\\n string calldata _imageURI\\n ) external;\\n\\n /*//////////////////////////////////////////////////////////////\\n VIEW FUNCTIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n function viewHat(\\n uint256 _hatId\\n )\\n external\\n view\\n returns (\\n string memory details,\\n uint32 maxSupply,\\n uint32 supply,\\n address eligibility,\\n address toggle,\\n string memory imageURI,\\n uint16 lastHatId,\\n bool mutable_,\\n bool active\\n );\\n\\n function isWearerOfHat(\\n address _user,\\n uint256 _hatId\\n ) external view returns (bool isWearer);\\n\\n function isAdminOfHat(\\n address _user,\\n uint256 _hatId\\n ) external view returns (bool isAdmin);\\n\\n function isInGoodStanding(\\n address _wearer,\\n uint256 _hatId\\n ) external view returns (bool standing);\\n\\n function isEligible(\\n address _wearer,\\n uint256 _hatId\\n ) external view returns (bool eligible);\\n\\n function getHatEligibilityModule(\\n uint256 _hatId\\n ) external view returns (address eligibility);\\n\\n function getHatToggleModule(\\n uint256 _hatId\\n ) external view returns (address toggle);\\n\\n function getHatMaxSupply(\\n uint256 _hatId\\n ) external view returns (uint32 maxSupply);\\n\\n function hatSupply(uint256 _hatId) external view returns (uint32 supply);\\n\\n function getImageURIForHat(\\n uint256 _hatId\\n ) external view returns (string memory _uri);\\n\\n function balanceOf(\\n address wearer,\\n uint256 hatId\\n ) external view returns (uint256 balance);\\n\\n function balanceOfBatch(\\n address[] calldata _wearers,\\n uint256[] calldata _hatIds\\n ) external view returns (uint256[] memory);\\n\\n function uri(uint256 id) external view returns (string memory _uri);\\n}\\n\",\"keccak256\":\"0x2867004bddc5148fa1937f25c0403e5d9977583aaf50fdbdb74bd463f64f21c8\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/IHatsIdUtilities.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface IHatsIdUtilities {\\n function buildHatId(\\n uint256 _admin,\\n uint16 _newHat\\n ) external pure returns (uint256 id);\\n\\n function getHatLevel(uint256 _hatId) external view returns (uint32 level);\\n\\n function getLocalHatLevel(\\n uint256 _hatId\\n ) external pure returns (uint32 level);\\n\\n function isTopHat(uint256 _hatId) external view returns (bool _topHat);\\n\\n function isLocalTopHat(\\n uint256 _hatId\\n ) external pure returns (bool _localTopHat);\\n\\n function isValidHatId(\\n uint256 _hatId\\n ) external view returns (bool validHatId);\\n\\n function getAdminAtLevel(\\n uint256 _hatId,\\n uint32 _level\\n ) external view returns (uint256 admin);\\n\\n function getAdminAtLocalLevel(\\n uint256 _hatId,\\n uint32 _level\\n ) external pure returns (uint256 admin);\\n\\n function getTopHatDomain(\\n uint256 _hatId\\n ) external view returns (uint32 domain);\\n\\n function getTippyTopHatDomain(\\n uint32 _topHatDomain\\n ) external view returns (uint32 domain);\\n\\n function noCircularLinkage(\\n uint32 _topHatDomain,\\n uint256 _linkedAdmin\\n ) external view returns (bool notCircular);\\n\\n function sameTippyTopHatDomain(\\n uint32 _topHatDomain,\\n uint256 _newAdminHat\\n ) external view returns (bool sameDomain);\\n}\\n\",\"keccak256\":\"0x007fcc07b20bf84bacad1f9a2ddf4e30e1a8be961e144b7bef8e98a51781aee9\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/IHatsModuleFactory.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.19;\\n\\ninterface IHatsModuleFactory {\\n error HatsModuleFactory_ModuleAlreadyDeployed(\\n address implementation,\\n uint256 hatId,\\n bytes otherImmutableArgs,\\n uint256 saltNonce\\n );\\n\\n error BatchArrayLengthMismatch();\\n\\n event HatsModuleFactory_ModuleDeployed(\\n address implementation,\\n address instance,\\n uint256 hatId,\\n bytes otherImmutableArgs,\\n bytes initData,\\n uint256 saltNonce\\n );\\n\\n function HATS() external view returns (address);\\n\\n function version() external view returns (string memory);\\n\\n function createHatsModule(\\n address _implementation,\\n uint256 _hatId,\\n bytes calldata _otherImmutableArgs,\\n bytes calldata _initData,\\n uint256 _saltNonce\\n ) external returns (address _instance);\\n\\n function batchCreateHatsModule(\\n address[] calldata _implementations,\\n uint256[] calldata _hatIds,\\n bytes[] calldata _otherImmutableArgsArray,\\n bytes[] calldata _initDataArray,\\n uint256[] calldata _saltNonces\\n ) external returns (bool success);\\n\\n function getHatsModuleAddress(\\n address _implementation,\\n uint256 _hatId,\\n bytes calldata _otherImmutableArgs,\\n uint256 _saltNonce\\n ) external view returns (address);\\n\\n function deployed(\\n address _implementation,\\n uint256 _hatId,\\n bytes calldata _otherImmutableArgs,\\n uint256 _saltNonce\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x861faf40785cedb829243116d492653414a367853408a5c27d201522f6c3bfdd\",\"license\":\"MIT\"},\"contracts/interfaces/hats/modules/IHatsElectionsEligibility.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.13;\\n\\ninterface IHatsElectionsEligibility {\\n event ElectionOpened(uint128 nextTermEnd);\\n event ElectionCompleted(uint128 termEnd, address[] winners);\\n event NewTermStarted(uint128 termEnd);\\n event Recalled(uint128 termEnd, address[] accounts);\\n\\n /// @notice Returns the first second after the current term ends.\\n /// @dev Also serves as the id for the current term.\\n function currentTermEnd() external view returns (uint128);\\n\\n /// @notice Returns the first second after the next term ends.\\n /// @dev Also serves as the id for the next term.\\n function nextTermEnd() external view returns (uint128);\\n\\n /// @notice Returns the election status (open or closed) for a given term end.\\n /// @param termEnd The term end timestamp to query.\\n function electionStatus(\\n uint128 termEnd\\n ) external view returns (bool isElectionOpen);\\n\\n /// @notice Returns whether a candidate was elected in a given term.\\n /// @param termEnd The term end timestamp to query.\\n /// @param candidate The address of the candidate.\\n function electionResults(\\n uint128 termEnd,\\n address candidate\\n ) external view returns (bool elected);\\n\\n /// @notice Returns the BALLOT_BOX_HAT constant.\\n function BALLOT_BOX_HAT() external pure returns (uint256);\\n\\n /// @notice Returns the ADMIN_HAT constant.\\n function ADMIN_HAT() external pure returns (uint256);\\n\\n /**\\n * @notice Submit the results of an election for a specified term.\\n * @dev Only callable by the wearer(s) of the BALLOT_BOX_HAT.\\n * @param _termEnd The id of the term for which the election results are being submitted.\\n * @param _winners The addresses of the winners of the election.\\n */\\n function elect(uint128 _termEnd, address[] calldata _winners) external;\\n\\n /**\\n * @notice Submit the results of a recall election for a specified term.\\n * @dev Only callable by the wearer(s) of the BALLOT_BOX_HAT.\\n * @param _termEnd The id of the term for which the recall results are being submitted.\\n * @param _recallees The addresses to be recalled.\\n */\\n function recall(uint128 _termEnd, address[] calldata _recallees) external;\\n\\n /**\\n * @notice Set the next term and open the election for it.\\n * @dev Only callable by the wearer(s) of the ADMIN_HAT.\\n * @param _newTermEnd The id of the term that will be opened.\\n */\\n function setNextTerm(uint128 _newTermEnd) external;\\n\\n /**\\n * @notice Start the next term, updating the current term.\\n * @dev Can be called by anyone, but will revert if conditions are not met.\\n */\\n function startNextTerm() external;\\n\\n /**\\n * @notice Determine the eligibility and standing of a wearer for a hat.\\n * @param _wearer The address of the hat wearer.\\n * @param _hatId The ID of the hat.\\n * @return eligible True if the wearer is eligible for the hat.\\n * @return standing True if the wearer is in good standing.\\n */\\n function getWearerStatus(\\n address _wearer,\\n uint256 _hatId\\n ) external view returns (bool eligible, bool standing);\\n}\\n\",\"keccak256\":\"0x74dfc5d538d866ddb8ee2ca1b569abf62e02d848c59f308adf6075ecff175c7d\",\"license\":\"MIT\"},\"contracts/interfaces/sablier/IAdminable.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\n/// @title IAdminable\\n/// @notice Contract module that provides a basic access control mechanism, with an admin that can be\\n/// granted exclusive access to specific functions. The inheriting contract must set the initial admin\\n/// in the constructor.\\ninterface IAdminable {\\n /*//////////////////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Emitted when the admin is transferred.\\n /// @param oldAdmin The address of the old admin.\\n /// @param newAdmin The address of the new admin.\\n event TransferAdmin(address indexed oldAdmin, address indexed newAdmin);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice The address of the admin account or contract.\\n function admin() external view returns (address);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n NON-CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Transfers the contract admin to a new address.\\n ///\\n /// @dev Notes:\\n /// - Does not revert if the admin is the same.\\n /// - This function can potentially leave the contract without an admin, thereby removing any\\n /// functionality that is only available to the admin.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the contract admin.\\n ///\\n /// @param newAdmin The address of the new admin.\\n function transferAdmin(address newAdmin) external;\\n}\\n\",\"keccak256\":\"0xa279c49e51228b571329164e36250e82b2c1378e8b549194ab7dd90fca9c3b2b\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/IERC4096.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 \\\"@openzeppelin/contracts/interfaces/IERC165.sol\\\";\\nimport {IERC721} from \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\n\\n/// @title ERC-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\",\"keccak256\":\"0xa34b9c52cbe36be860244f52256f1b05badf0cb797d208664b87337610d0e82d\",\"license\":\"MIT\"},\"contracts/interfaces/sablier/ISablierV2Lockup.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC4906} from \\\"./IERC4096.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IERC721Metadata} from \\\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\\\";\\nimport {UD60x18} from \\\"@prb/math/src/UD60x18.sol\\\";\\n\\nimport {Lockup} from \\\"./types/DataTypes.sol\\\";\\nimport {IAdminable} from \\\"./IAdminable.sol\\\";\\nimport {ISablierV2NFTDescriptor} from \\\"./ISablierV2NFTDescriptor.sol\\\";\\n\\n/// @title ISablierV2Lockup\\n/// @notice Common logic between all Sablier V2 Lockup contracts.\\ninterface ISablierV2Lockup is\\n IAdminable, // 0 inherited components\\n IERC4906, // 2 inherited components\\n IERC721Metadata // 2 inherited components\\n{\\n /*//////////////////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Emitted when the admin allows a new recipient contract to hook to Sablier.\\n /// @param admin The address of the current contract admin.\\n /// @param recipient The address of the recipient contract put on the allowlist.\\n event AllowToHook(address indexed admin, address recipient);\\n\\n /// @notice Emitted when a stream is canceled.\\n /// @param streamId The ID of the stream.\\n /// @param sender The address of the stream's sender.\\n /// @param recipient The address of the stream's recipient.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param senderAmount The amount of assets refunded to the stream's sender, denoted in units of the asset's\\n /// decimals.\\n /// @param recipientAmount The amount of assets left for the stream's recipient to withdraw, denoted in units of the\\n /// asset's decimals.\\n event CancelLockupStream(\\n uint256 streamId,\\n address indexed sender,\\n address indexed recipient,\\n IERC20 indexed asset,\\n uint128 senderAmount,\\n uint128 recipientAmount\\n );\\n\\n /// @notice Emitted when a sender gives up the right to cancel a stream.\\n /// @param streamId The ID of the stream.\\n event RenounceLockupStream(uint256 indexed streamId);\\n\\n /// @notice Emitted when the admin sets a new NFT descriptor contract.\\n /// @param admin The address of the current contract admin.\\n /// @param oldNFTDescriptor The address of the old NFT descriptor contract.\\n /// @param newNFTDescriptor The address of the new NFT descriptor contract.\\n event SetNFTDescriptor(\\n address indexed admin,\\n ISablierV2NFTDescriptor oldNFTDescriptor,\\n ISablierV2NFTDescriptor newNFTDescriptor\\n );\\n\\n /// @notice Emitted when assets are withdrawn from a stream.\\n /// @param streamId The ID of the stream.\\n /// @param to The address that has received the withdrawn assets.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param amount The amount of assets withdrawn, denoted in units of the asset's decimals.\\n event WithdrawFromLockupStream(\\n uint256 indexed streamId,\\n address indexed to,\\n IERC20 indexed asset,\\n uint128 amount\\n );\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Retrieves the address of the ERC-20 asset to be distributed.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getAsset(uint256 streamId) external view returns (IERC20 asset);\\n\\n /// @notice Retrieves the amount deposited in the stream, denoted in units of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getDepositedAmount(\\n uint256 streamId\\n ) external view returns (uint128 depositedAmount);\\n\\n /// @notice Retrieves the stream's end time, which is a Unix timestamp.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getEndTime(\\n uint256 streamId\\n ) external view returns (uint40 endTime);\\n\\n /// @notice Retrieves the stream's recipient.\\n /// @dev Reverts if the NFT has been burned.\\n /// @param streamId The stream ID for the query.\\n function getRecipient(\\n uint256 streamId\\n ) external view returns (address recipient);\\n\\n /// @notice Retrieves the amount refunded to the sender after a cancellation, denoted in units of the asset's\\n /// decimals. This amount is always zero unless the stream was canceled.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getRefundedAmount(\\n uint256 streamId\\n ) external view returns (uint128 refundedAmount);\\n\\n /// @notice Retrieves the stream's sender.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getSender(uint256 streamId) external view returns (address sender);\\n\\n /// @notice Retrieves the stream's start time, which is a Unix timestamp.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getStartTime(\\n uint256 streamId\\n ) external view returns (uint40 startTime);\\n\\n /// @notice Retrieves the amount withdrawn from the stream, denoted in units of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getWithdrawnAmount(\\n uint256 streamId\\n ) external view returns (uint128 withdrawnAmount);\\n\\n /// @notice Retrieves a flag indicating whether the provided address is a contract allowed to hook to Sablier\\n /// when a stream is canceled or when assets are withdrawn.\\n /// @dev See {ISablierLockupRecipient} for more information.\\n function isAllowedToHook(\\n address recipient\\n ) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream can be canceled. When the stream is cold, this\\n /// flag is always `false`.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isCancelable(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream is cold, i.e. settled, canceled, or depleted.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isCold(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream is depleted.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isDepleted(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream exists.\\n /// @dev Does not revert if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isStream(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream NFT can be transferred.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isTransferable(\\n uint256 streamId\\n ) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream is warm, i.e. either pending or streaming.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isWarm(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves the maximum broker fee that can be charged by the broker, denoted as a fixed-point\\n /// number where 1e18 is 100%.\\n /// @dev This value is hard coded as a constant.\\n function MAX_BROKER_FEE() external view returns (UD60x18);\\n\\n /// @notice Counter for stream IDs, used in the create functions.\\n function nextStreamId() external view returns (uint256);\\n\\n /// @notice Contract that generates the non-fungible token URI.\\n function nftDescriptor() external view returns (ISablierV2NFTDescriptor);\\n\\n /// @notice Calculates the amount that the sender would be refunded if the stream were canceled, denoted in units\\n /// of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function refundableAmountOf(\\n uint256 streamId\\n ) external view returns (uint128 refundableAmount);\\n\\n /// @notice Retrieves the stream's status.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function statusOf(\\n uint256 streamId\\n ) external view returns (Lockup.Status status);\\n\\n /// @notice Calculates the amount streamed to the recipient, denoted in units of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n ///\\n /// Notes:\\n /// - Upon cancellation of the stream, the amount streamed is calculated as the difference between the deposited\\n /// amount and the refunded amount. Ultimately, when the stream becomes depleted, the streamed amount is equivalent\\n /// to the total amount withdrawn.\\n ///\\n /// @param streamId The stream ID for the query.\\n function streamedAmountOf(\\n uint256 streamId\\n ) external view returns (uint128 streamedAmount);\\n\\n /// @notice Retrieves a flag indicating whether the stream was canceled.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function wasCanceled(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Calculates the amount that the recipient can withdraw from the stream, denoted in units of the asset's\\n /// decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function withdrawableAmountOf(\\n uint256 streamId\\n ) external view returns (uint128 withdrawableAmount);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n NON-CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Allows a recipient contract to hook to Sablier when a stream is canceled or when assets are withdrawn.\\n /// Useful for implementing contracts that hold streams on behalf of users, such as vaults or staking contracts.\\n ///\\n /// @dev Emits an {AllowToHook} event.\\n ///\\n /// Notes:\\n /// - Does not revert if the contract is already on the allowlist.\\n /// - This is an irreversible operation. The contract cannot be removed from the allowlist.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the contract admin.\\n /// - `recipient` must have a non-zero code size.\\n /// - `recipient` must implement {ISablierLockupRecipient}.\\n ///\\n /// @param recipient The address of the contract to allow for hooks.\\n function allowToHook(address recipient) external;\\n\\n /// @notice Burns the NFT associated with the stream.\\n ///\\n /// @dev Emits a {Transfer} event.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `streamId` must reference a depleted stream.\\n /// - The NFT must exist.\\n /// - `msg.sender` must be either the NFT owner or an approved third party.\\n ///\\n /// @param streamId The ID of the stream NFT to burn.\\n function burn(uint256 streamId) external;\\n\\n /// @notice Cancels the stream and refunds any remaining assets to the sender.\\n ///\\n /// @dev Emits a {Transfer}, {CancelLockupStream}, and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - If there any assets left for the recipient to withdraw, the stream is marked as canceled. Otherwise, the\\n /// stream is marked as depleted.\\n /// - This function attempts to invoke a hook on the recipient, if the resolved address is a contract.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - The stream must be warm and cancelable.\\n /// - `msg.sender` must be the stream's sender.\\n ///\\n /// @param streamId The ID of the stream to cancel.\\n function cancel(uint256 streamId) external;\\n\\n /// @notice Cancels multiple streams and refunds any remaining assets to the sender.\\n ///\\n /// @dev Emits multiple {Transfer}, {CancelLockupStream}, and {MetadataUpdate} events.\\n ///\\n /// Notes:\\n /// - Refer to the notes in {cancel}.\\n ///\\n /// Requirements:\\n /// - All requirements from {cancel} must be met for each stream.\\n ///\\n /// @param streamIds The IDs of the streams to cancel.\\n function cancelMultiple(uint256[] calldata streamIds) external;\\n\\n /// @notice Removes the right of the stream's sender to cancel the stream.\\n ///\\n /// @dev Emits a {RenounceLockupStream} and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - This is an irreversible operation.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `streamId` must reference a warm stream.\\n /// - `msg.sender` must be the stream's sender.\\n /// - The stream must be cancelable.\\n ///\\n /// @param streamId The ID of the stream to renounce.\\n function renounce(uint256 streamId) external;\\n\\n /// @notice Sets a new NFT descriptor contract, which produces the URI describing the Sablier stream NFTs.\\n ///\\n /// @dev Emits a {SetNFTDescriptor} and {BatchMetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - Does not revert if the NFT descriptor is the same.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the contract admin.\\n ///\\n /// @param newNFTDescriptor The address of the new NFT descriptor contract.\\n function setNFTDescriptor(\\n ISablierV2NFTDescriptor newNFTDescriptor\\n ) external;\\n\\n /// @notice Withdraws the provided amount of assets from the stream to the `to` address.\\n ///\\n /// @dev Emits a {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - This function attempts to call a hook on the recipient of the stream, unless `msg.sender` is the recipient.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `streamId` must not reference a null or depleted stream.\\n /// - `to` must not be the zero address.\\n /// - `amount` must be greater than zero and must not exceed the withdrawable amount.\\n /// - `to` must be the recipient if `msg.sender` is not the stream's recipient or an approved third party.\\n ///\\n /// @param streamId The ID of the stream to withdraw from.\\n /// @param to The address receiving the withdrawn assets.\\n /// @param amount The amount to withdraw, denoted in units of the asset's decimals.\\n function withdraw(uint256 streamId, address to, uint128 amount) external;\\n\\n /// @notice Withdraws the maximum withdrawable amount from the stream to the provided address `to`.\\n ///\\n /// @dev Emits a {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - Refer to the notes in {withdraw}.\\n ///\\n /// Requirements:\\n /// - Refer to the requirements in {withdraw}.\\n ///\\n /// @param streamId The ID of the stream to withdraw from.\\n /// @param to The address receiving the withdrawn assets.\\n /// @return withdrawnAmount The amount withdrawn, denoted in units of the asset's decimals.\\n function withdrawMax(\\n uint256 streamId,\\n address to\\n ) external returns (uint128 withdrawnAmount);\\n\\n /// @notice Withdraws the maximum withdrawable amount from the stream to the current recipient, and transfers the\\n /// NFT to `newRecipient`.\\n ///\\n /// @dev Emits a {WithdrawFromLockupStream} and a {Transfer} event.\\n ///\\n /// Notes:\\n /// - If the withdrawable amount is zero, the withdrawal is skipped.\\n /// - Refer to the notes in {withdraw}.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the stream's recipient.\\n /// - Refer to the requirements in {withdraw}.\\n /// - Refer to the requirements in {IERC721.transferFrom}.\\n ///\\n /// @param streamId The ID of the stream NFT to transfer.\\n /// @param newRecipient The address of the new owner of the stream NFT.\\n /// @return withdrawnAmount The amount withdrawn, denoted in units of the asset's decimals.\\n function withdrawMaxAndTransfer(\\n uint256 streamId,\\n address newRecipient\\n ) external returns (uint128 withdrawnAmount);\\n\\n /// @notice Withdraws assets from streams to the recipient of each stream.\\n ///\\n /// @dev Emits multiple {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} events.\\n ///\\n /// Notes:\\n /// - This function attempts to call a hook on the recipient of each stream, unless `msg.sender` is the recipient.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - There must be an equal number of `streamIds` and `amounts`.\\n /// - Each stream ID in the array must not reference a null or depleted stream.\\n /// - Each amount in the array must be greater than zero and must not exceed the withdrawable amount.\\n ///\\n /// @param streamIds The IDs of the streams to withdraw from.\\n /// @param amounts The amounts to withdraw, denoted in units of the asset's decimals.\\n function withdrawMultiple(\\n uint256[] calldata streamIds,\\n uint128[] calldata amounts\\n ) external;\\n}\\n\",\"keccak256\":\"0x3e5541c38a901637bd310965deb5bbde73ef07fe4ee3c752cbec330c6b9d62a3\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/ISablierV2LockupLinear.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\nimport {Lockup, LockupLinear} from \\\"./types/DataTypes.sol\\\";\\nimport {ISablierV2Lockup} from \\\"./ISablierV2Lockup.sol\\\";\\n\\n/// @title ISablierV2LockupLinear\\n/// @notice Creates and manages Lockup streams with a linear distribution function.\\ninterface ISablierV2LockupLinear is ISablierV2Lockup {\\n /*//////////////////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Emitted when a stream is created.\\n /// @param streamId The ID of the newly created stream.\\n /// @param funder The address which funded the stream.\\n /// @param sender The address distributing the assets, which will have the ability to cancel the stream.\\n /// @param recipient The address receiving the assets.\\n /// @param amounts Struct encapsulating (i) the deposit amount, and (ii) the broker fee amount, both denoted\\n /// in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Boolean indicating whether the stream will be cancelable or not.\\n /// @param transferable Boolean indicating whether the stream NFT is transferable or not.\\n /// @param timestamps Struct encapsulating (i) the stream's start time, (ii) cliff time, and (iii) end time, all as\\n /// Unix timestamps.\\n /// @param broker The address of the broker who has helped create the stream, e.g. a front-end website.\\n event CreateLockupLinearStream(\\n uint256 streamId,\\n address funder,\\n address indexed sender,\\n address indexed recipient,\\n Lockup.CreateAmounts amounts,\\n IERC20 indexed asset,\\n bool cancelable,\\n bool transferable,\\n LockupLinear.Timestamps timestamps,\\n address broker\\n );\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Retrieves the stream's cliff time, which is a Unix timestamp. A value of zero means there\\n /// is no cliff.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getCliffTime(\\n uint256 streamId\\n ) external view returns (uint40 cliffTime);\\n\\n /// @notice Retrieves the full stream details.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n /// @return stream See the documentation in {DataTypes}.\\n function getStream(\\n uint256 streamId\\n ) external view returns (LockupLinear.StreamLL memory stream);\\n\\n /// @notice Retrieves the stream's start, cliff and end timestamps.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n /// @return timestamps See the documentation in {DataTypes}.\\n function getTimestamps(\\n uint256 streamId\\n ) external view returns (LockupLinear.Timestamps memory timestamps);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n NON-CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Creates a stream by setting the start time to `block.timestamp`, and the end time to\\n /// the sum of `block.timestamp` and `params.durations.total`. The stream is funded by `msg.sender` and is wrapped\\n /// in an ERC-721 NFT.\\n ///\\n /// @dev Emits a {Transfer} and {CreateLockupLinearStream} event.\\n ///\\n /// Requirements:\\n /// - All requirements in {createWithTimestamps} must be met for the calculated parameters.\\n ///\\n /// @param params Struct encapsulating the function parameters, which are documented in {DataTypes}.\\n /// @return streamId The ID of the newly created stream.\\n function createWithDurations(\\n LockupLinear.CreateWithDurations calldata params\\n ) external returns (uint256 streamId);\\n\\n /// @notice Creates a stream with the provided start time and end time. The stream is funded by `msg.sender` and is\\n /// wrapped in an ERC-721 NFT.\\n ///\\n /// @dev Emits a {Transfer} and {CreateLockupLinearStream} event.\\n ///\\n /// Notes:\\n /// - A cliff time of zero means there is no cliff.\\n /// - As long as the times are ordered, it is not an error for the start or the cliff time to be in the past.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `params.totalAmount` must be greater than zero.\\n /// - If set, `params.broker.fee` must not be greater than `MAX_BROKER_FEE`.\\n /// - `params.timestamps.start` must be greater than zero and less than `params.timestamps.end`.\\n /// - If set, `params.timestamps.cliff` must be greater than `params.timestamps.start` and less than\\n /// `params.timestamps.end`.\\n /// - `params.timestamps.end` must be in the future.\\n /// - `params.recipient` must not be the zero address.\\n /// - `msg.sender` must have allowed this contract to spend at least `params.totalAmount` assets.\\n ///\\n /// @param params Struct encapsulating the function parameters, which are documented in {DataTypes}.\\n /// @return streamId The ID of the newly created stream.\\n function createWithTimestamps(\\n LockupLinear.CreateWithTimestamps calldata params\\n ) external returns (uint256 streamId);\\n}\\n\",\"keccak256\":\"0x064264723114b1f1cf3953fd79874dfcbb42cf313857aee6d5e6b09a23e0010b\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/ISablierV2NFTDescriptor.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC721Metadata} from \\\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\\\";\\n\\n/// @title ISablierV2NFTDescriptor\\n/// @notice This contract generates the URI describing the Sablier V2 stream NFTs.\\n/// @dev Inspired by Uniswap V3 Positions NFTs.\\ninterface ISablierV2NFTDescriptor {\\n /// @notice Produces the URI describing a particular stream NFT.\\n /// @dev This is a data URI with the JSON contents directly inlined.\\n /// @param sablier The address of the Sablier contract the stream was created in.\\n /// @param streamId The ID of the stream for which to produce a description.\\n /// @return uri The URI of the ERC721-compliant metadata.\\n function tokenURI(\\n IERC721Metadata sablier,\\n uint256 streamId\\n ) external view returns (string memory uri);\\n}\\n\",\"keccak256\":\"0x4ed430e553d14161e93efdaaacd1a502f49b38969c9d714b45d2e682a74fa0bc\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/types/DataTypes.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {UD2x18} from \\\"@prb/math/src/UD2x18.sol\\\";\\nimport {UD60x18} from \\\"@prb/math/src/UD60x18.sol\\\";\\n\\n// DataTypes.sol\\n//\\n// This file defines all structs used in V2 Core, most of which are organized under three namespaces:\\n//\\n// - Lockup\\n// - LockupDynamic\\n// - LockupLinear\\n// - LockupTranched\\n//\\n// You will notice that some structs contain \\\"slot\\\" annotations - they are used to indicate the\\n// storage layout of the struct. It is more gas efficient to group small data types together so\\n// that they fit in a single 32-byte slot.\\n\\n/// @notice Struct encapsulating the broker parameters passed to the create functions. Both can be set to zero.\\n/// @param account The address receiving the broker's fee.\\n/// @param fee The broker's percentage fee from the total amount, denoted as a fixed-point number where 1e18 is 100%.\\nstruct Broker {\\n address account;\\n UD60x18 fee;\\n}\\n\\n/// @notice Namespace for the structs used in both {SablierV2LockupLinear} and {SablierV2LockupDynamic}.\\nlibrary Lockup {\\n /// @notice Struct encapsulating the deposit, withdrawn, and refunded amounts, all denoted in units of the asset's\\n /// decimals.\\n /// @dev Because the deposited and the withdrawn amount are often read together, declaring them in the same slot\\n /// saves gas.\\n /// @param deposited The initial amount deposited in the stream, net of broker fee.\\n /// @param withdrawn The cumulative amount withdrawn from the stream.\\n /// @param refunded The amount refunded to the sender. Unless the stream was canceled, this is always zero.\\n struct Amounts {\\n // slot 0\\n uint128 deposited;\\n uint128 withdrawn;\\n // slot 1\\n uint128 refunded;\\n }\\n\\n /// @notice Struct encapsulating (i) the deposit amount and (ii) the broker fee amount, both denoted in units of the\\n /// asset's decimals.\\n /// @param deposit The amount to deposit in the stream.\\n /// @param brokerFee The broker fee amount.\\n struct CreateAmounts {\\n uint128 deposit;\\n uint128 brokerFee;\\n }\\n\\n /// @notice Enum representing the different statuses of a stream.\\n /// @custom:value0 PENDING Stream created but not started; assets are in a pending state.\\n /// @custom:value1 STREAMING Active stream where assets are currently being streamed.\\n /// @custom:value2 SETTLED All assets have been streamed; recipient is due to withdraw them.\\n /// @custom:value3 CANCELED Canceled stream; remaining assets await recipient's withdrawal.\\n /// @custom:value4 DEPLETED Depleted stream; all assets have been withdrawn and/or refunded.\\n enum Status {\\n PENDING,\\n STREAMING,\\n SETTLED,\\n CANCELED,\\n DEPLETED\\n }\\n\\n /// @notice A common data structure to be stored in all {SablierV2Lockup} models.\\n /// @dev The fields are arranged like this to save gas via tight variable packing.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream.\\n /// @param startTime The Unix timestamp indicating the stream's start.\\n /// @param endTime The Unix timestamp indicating the stream's end.\\n /// @param isCancelable Boolean indicating if the stream is cancelable.\\n /// @param wasCanceled Boolean indicating if the stream was canceled.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param isDepleted Boolean indicating if the stream is depleted.\\n /// @param isStream Boolean indicating if the struct entity exists.\\n /// @param isTransferable Boolean indicating if the stream NFT is transferable.\\n /// @param amounts Struct encapsulating the deposit, withdrawn, and refunded amounts, all denoted in units of the\\n /// asset's decimals.\\n struct Stream {\\n // slot 0\\n address sender;\\n uint40 startTime;\\n uint40 endTime;\\n bool isCancelable;\\n bool wasCanceled;\\n // slot 1\\n IERC20 asset;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n // slot 2 and 3\\n Lockup.Amounts amounts;\\n }\\n}\\n\\n/// @notice Namespace for the structs used in {SablierV2LockupDynamic}.\\nlibrary LockupDynamic {\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupDynamic.createWithDurations} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param segments Segments with durations used to compose the dynamic distribution function. Timestamps are\\n /// calculated by starting from `block.timestamp` and adding each duration to the previous timestamp.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithDurations {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n SegmentWithDuration[] segments;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupDynamic.createWithTimestamps} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param startTime The Unix timestamp indicating the stream's start.\\n /// @param segments Segments used to compose the dynamic distribution function.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithTimestamps {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n uint40 startTime;\\n Segment[] segments;\\n Broker broker;\\n }\\n\\n /// @notice Segment struct used in the Lockup Dynamic stream.\\n /// @param amount The amount of assets to be streamed in the segment, denoted in units of the asset's decimals.\\n /// @param exponent The exponent of the segment, denoted as a fixed-point number.\\n /// @param timestamp The Unix timestamp indicating the segment's end.\\n struct Segment {\\n // slot 0\\n uint128 amount;\\n UD2x18 exponent;\\n uint40 timestamp;\\n }\\n\\n /// @notice Segment struct used at runtime in {SablierV2LockupDynamic.createWithDurations}.\\n /// @param amount The amount of assets to be streamed in the segment, denoted in units of the asset's decimals.\\n /// @param exponent The exponent of the segment, denoted as a fixed-point number.\\n /// @param duration The time difference in seconds between the segment and the previous one.\\n struct SegmentWithDuration {\\n uint128 amount;\\n UD2x18 exponent;\\n uint40 duration;\\n }\\n\\n /// @notice Struct encapsulating the full details of a stream.\\n /// @dev Extends `Lockup.Stream` by including the recipient and the segments.\\n struct StreamLD {\\n address sender;\\n address recipient;\\n uint40 startTime;\\n uint40 endTime;\\n bool isCancelable;\\n bool wasCanceled;\\n IERC20 asset;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n Lockup.Amounts amounts;\\n Segment[] segments;\\n }\\n\\n /// @notice Struct encapsulating the LockupDynamic timestamps.\\n /// @param start The Unix timestamp indicating the stream's start.\\n /// @param end The Unix timestamp indicating the stream's end.\\n struct Timestamps {\\n uint40 start;\\n uint40 end;\\n }\\n}\\n\\n/// @notice Namespace for the structs used in {SablierV2LockupLinear}.\\nlibrary LockupLinear {\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupLinear.createWithDurations} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param durations Struct encapsulating (i) cliff period duration and (ii) total stream duration, both in seconds.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithDurations {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n Durations durations;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupLinear.createWithTimestamps} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param timestamps Struct encapsulating (i) the stream's start time, (ii) cliff time, and (iii) end time, all as\\n /// Unix timestamps.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithTimestamps {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n Timestamps timestamps;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the cliff duration and the total duration.\\n /// @param cliff The cliff duration in seconds.\\n /// @param total The total duration in seconds.\\n struct Durations {\\n uint40 cliff;\\n uint40 total;\\n }\\n\\n /// @notice Struct encapsulating the full details of a stream.\\n /// @dev Extends `Lockup.Stream` by including the recipient and the cliff time.\\n struct StreamLL {\\n address sender;\\n address recipient;\\n uint40 startTime;\\n bool isCancelable;\\n bool wasCanceled;\\n IERC20 asset;\\n uint40 endTime;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n Lockup.Amounts amounts;\\n uint40 cliffTime;\\n }\\n\\n /// @notice Struct encapsulating the LockupLinear timestamps.\\n /// @param start The Unix timestamp for the stream's start.\\n /// @param cliff The Unix timestamp for the cliff period's end. A value of zero means there is no cliff.\\n /// @param end The Unix timestamp for the stream's end.\\n struct Timestamps {\\n uint40 start;\\n uint40 cliff;\\n uint40 end;\\n }\\n}\\n\\n/// @notice Namespace for the structs used in {SablierV2LockupTranched}.\\nlibrary LockupTranched {\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupTranched.createWithDurations} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param tranches Tranches with durations used to compose the tranched distribution function. Timestamps are\\n /// calculated by starting from `block.timestamp` and adding each duration to the previous timestamp.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithDurations {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n TrancheWithDuration[] tranches;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupTranched.createWithTimestamps} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param startTime The Unix timestamp indicating the stream's start.\\n /// @param tranches Tranches used to compose the tranched distribution function.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithTimestamps {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n uint40 startTime;\\n Tranche[] tranches;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the full details of a stream.\\n /// @dev Extends `Lockup.Stream` by including the recipient and the tranches.\\n struct StreamLT {\\n address sender;\\n address recipient;\\n uint40 startTime;\\n uint40 endTime;\\n bool isCancelable;\\n bool wasCanceled;\\n IERC20 asset;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n Lockup.Amounts amounts;\\n Tranche[] tranches;\\n }\\n\\n /// @notice Struct encapsulating the LockupTranched timestamps.\\n /// @param start The Unix timestamp indicating the stream's start.\\n /// @param end The Unix timestamp indicating the stream's end.\\n struct Timestamps {\\n uint40 start;\\n uint40 end;\\n }\\n\\n /// @notice Tranche struct used in the Lockup Tranched stream.\\n /// @param amount The amount of assets to be unlocked in the tranche, denoted in units of the asset's decimals.\\n /// @param timestamp The Unix timestamp indicating the tranche's end.\\n struct Tranche {\\n // slot 0\\n uint128 amount;\\n uint40 timestamp;\\n }\\n\\n /// @notice Tranche struct used at runtime in {SablierV2LockupTranched.createWithDurations}.\\n /// @param amount The amount of assets to be unlocked in the tranche, denoted in units of the asset's decimals.\\n /// @param duration The time difference in seconds between the tranche and the previous one.\\n struct TrancheWithDuration {\\n uint128 amount;\\n uint40 duration;\\n }\\n}\\n\",\"keccak256\":\"0x727722c0ec71a76a947b935c9dfcac8fd846d6c3547dfbc8739c7109f3b95068\",\"license\":\"GPL-3.0-or-later\"},\"contracts/modules/DecentHatsCreationModule.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.28;\\n\\nimport {Enum} from \\\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\\\";\\nimport {IAvatar} from \\\"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol\\\";\\nimport {Strings} from \\\"@openzeppelin/contracts/utils/Strings.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IERC6551Registry} from \\\"../interfaces/IERC6551Registry.sol\\\";\\nimport {IHats} from \\\"../interfaces/hats/IHats.sol\\\";\\nimport {LockupLinear, Broker} from \\\"../interfaces/sablier/types/DataTypes.sol\\\";\\nimport {IHatsModuleFactory} from \\\"../interfaces/hats/IHatsModuleFactory.sol\\\";\\nimport {IHatsElectionsEligibility} from \\\"../interfaces/hats/modules/IHatsElectionsEligibility.sol\\\";\\nimport {ModuleProxyFactory} from \\\"@gnosis.pm/zodiac/contracts/factory/ModuleProxyFactory.sol\\\";\\nimport {ISablierV2LockupLinear} from \\\"../interfaces/sablier/ISablierV2LockupLinear.sol\\\";\\nimport {DecentHatsModuleUtils} from \\\"./DecentHatsModuleUtils.sol\\\";\\n\\ncontract DecentHatsCreationModule is DecentHatsModuleUtils {\\n struct TopHatParams {\\n string details;\\n string imageURI;\\n }\\n\\n struct AdminHatParams {\\n string details;\\n string imageURI;\\n bool isMutable;\\n }\\n\\n struct CreateTreeParams {\\n IHats hatsProtocol;\\n IERC6551Registry erc6551Registry;\\n IHatsModuleFactory hatsModuleFactory;\\n ModuleProxyFactory moduleProxyFactory;\\n address keyValuePairs;\\n address decentAutonomousAdminImplementation;\\n address hatsAccountImplementation;\\n address hatsElectionsEligibilityImplementation;\\n TopHatParams topHat;\\n AdminHatParams adminHat;\\n HatParams[] hats;\\n }\\n\\n /* /////////////////////////////////////////////////////////////////////////////\\n EXTERNAL FUNCTIONS\\n ///////////////////////////////////////////////////////////////////////////// */\\n /**\\n * @notice For a safe without any roles previously created on it, this function should be called. It sets up the\\n * top hat and admin hat, as well as any other hats and their streams that are provided, then transfers the top hat\\n * to the calling safe.\\n *\\n * @notice This contract should be enabled a module on the Safe for which the role(s) are to be created, and disabled after.\\n *\\n * @dev For each hat that is included, if the hat is:\\n * - termed, its stream funds on are targeted directly at the nominated wearer. The wearer should directly call `withdraw-`\\n * on the Sablier contract.\\n * - untermed, its stream funds are targeted at the hat's smart account. In order to withdraw funds from the stream, the\\n * hat's smart account must be the one call to `withdraw-` on the Sablier contract, setting the recipient arg to its wearer.\\n *\\n * @dev In order for a Safe to seamlessly create roles even if it has never previously created a role and thus has\\n * no hat tree, we defer the creation of the hat tree and its setup to this contract. This way, in a single tx block,\\n * the resulting topHatId of the newly created hat can be used to create an admin hat and any other hats needed.\\n * We also make use of `KeyValuePairs` to associate the topHatId with the Safe.\\n *\\n * @param treeParams The parameters for creating the Hat Tree with Roles\\n */\\n function createAndDeclareTree(\\n CreateTreeParams calldata treeParams\\n ) external {\\n // Create Top Hat\\n (uint256 topHatId, address topHatAccount) = _processTopHat(\\n treeParams.hatsProtocol,\\n treeParams.erc6551Registry,\\n treeParams.hatsAccountImplementation,\\n treeParams.keyValuePairs,\\n treeParams.topHat\\n );\\n\\n // Create Admin Hat\\n uint256 adminHatId = _processAdminHat(\\n treeParams.hatsProtocol,\\n treeParams.erc6551Registry,\\n treeParams.hatsAccountImplementation,\\n topHatId,\\n topHatAccount,\\n treeParams.moduleProxyFactory,\\n treeParams.decentAutonomousAdminImplementation,\\n treeParams.adminHat\\n );\\n\\n // Create Role Hats\\n _processRoleHats(\\n CreateRoleHatsParams({\\n hatsProtocol: treeParams.hatsProtocol,\\n erc6551Registry: treeParams.erc6551Registry,\\n hatsAccountImplementation: treeParams.hatsAccountImplementation,\\n topHatId: topHatId,\\n topHatAccount: topHatAccount,\\n hatsModuleFactory: treeParams.hatsModuleFactory,\\n hatsElectionsEligibilityImplementation: treeParams\\n .hatsElectionsEligibilityImplementation,\\n adminHatId: adminHatId,\\n hats: treeParams.hats,\\n keyValuePairs: treeParams.keyValuePairs\\n })\\n );\\n }\\n\\n /* /////////////////////////////////////////////////////////////////////////////\\n INTERNAL FUNCTIONS\\n ///////////////////////////////////////////////////////////////////////////// */\\n\\n function _processTopHat(\\n IHats hatsProtocol,\\n IERC6551Registry erc6551Registry,\\n address hatsAccountImplementation,\\n address keyValuePairs,\\n TopHatParams calldata topHat\\n ) internal returns (uint256 topHatId, address topHatAccount) {\\n // Call lastTopHatId() and properly decode the response\\n (bool success, bytes memory data) = address(hatsProtocol).call(\\n abi.encodeWithSignature(\\\"lastTopHatId()\\\")\\n );\\n require(success, \\\"Failed to get lastTopHatId\\\");\\n topHatId = (abi.decode(data, (uint256)) + 1) << 224;\\n\\n // Mint Top Hat to the Safe\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"mintTopHat(address,string,string)\\\",\\n msg.sender,\\n topHat.details,\\n topHat.imageURI\\n ),\\n Enum.Operation.Call\\n );\\n\\n // Create Top Hat's ERC6551 Account\\n topHatAccount = erc6551Registry.createAccount(\\n hatsAccountImplementation,\\n SALT,\\n block.chainid,\\n address(hatsProtocol),\\n topHatId\\n );\\n\\n // Declare Top Hat ID to Safe via KeyValuePairs\\n string[] memory keys = new string[](1);\\n string[] memory values = new string[](1);\\n keys[0] = \\\"topHatId\\\";\\n values[0] = Strings.toString(topHatId);\\n IAvatar(msg.sender).execTransactionFromModule(\\n keyValuePairs,\\n 0,\\n abi.encodeWithSignature(\\n \\\"updateValues(string[],string[])\\\",\\n keys,\\n values\\n ),\\n Enum.Operation.Call\\n );\\n }\\n\\n function _processAdminHat(\\n IHats hatsProtocol,\\n IERC6551Registry erc6551Registry,\\n address hatsAccountImplementation,\\n uint256 topHatId,\\n address topHatAccount,\\n ModuleProxyFactory moduleProxyFactory,\\n address decentAutonomousAdminImplementation,\\n AdminHatParams calldata adminHat\\n ) internal returns (uint256 adminHatId) {\\n // Create Admin Hat\\n adminHatId = hatsProtocol.getNextId(topHatId);\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"createHat(uint256,string,uint32,address,address,bool,string)\\\",\\n topHatId,\\n adminHat.details,\\n 1, // only one Admin Hat\\n topHatAccount,\\n topHatAccount,\\n adminHat.isMutable,\\n adminHat.imageURI\\n ),\\n Enum.Operation.Call\\n );\\n\\n // Create Admin Hat's ERC6551 Account\\n erc6551Registry.createAccount(\\n hatsAccountImplementation,\\n SALT,\\n block.chainid,\\n address(hatsProtocol),\\n adminHatId\\n );\\n\\n // Deploy Decent Autonomous Admin Module, which will wear the Admin Hat\\n address autonomousAdmin = moduleProxyFactory.deployModule(\\n decentAutonomousAdminImplementation,\\n abi.encodeWithSignature(\\\"setUp(bytes)\\\", bytes(\\\"\\\")),\\n uint256(\\n keccak256(\\n abi.encodePacked(\\n // for the salt, we'll concatenate our static salt\\n // with the Admin Hat ID\\n SALT,\\n adminHatId\\n )\\n )\\n )\\n );\\n\\n // Mint Hat to the Decent Autonomous Admin Module\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"mintHat(uint256,address)\\\",\\n adminHatId,\\n autonomousAdmin\\n ),\\n Enum.Operation.Call\\n );\\n }\\n}\\n\",\"keccak256\":\"0x5c95f7e83ded3c184dddd6b769791c92a68794eeb49deaccec4422497935c7c2\",\"license\":\"MIT\"},\"contracts/modules/DecentHatsModuleUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.28;\\n\\nimport {Enum} from \\\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\\\";\\nimport {IAvatar} from \\\"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IERC6551Registry} from \\\"../interfaces/IERC6551Registry.sol\\\";\\nimport {IHats} from \\\"../interfaces/hats/IHats.sol\\\";\\nimport {LockupLinear, Broker} from \\\"../interfaces/sablier/types/DataTypes.sol\\\";\\nimport {IHatsModuleFactory} from \\\"../interfaces/hats/IHatsModuleFactory.sol\\\";\\nimport {ISablierV2LockupLinear} from \\\"../interfaces/sablier/ISablierV2LockupLinear.sol\\\";\\nimport {Strings} from \\\"@openzeppelin/contracts/utils/Strings.sol\\\";\\n\\nabstract contract DecentHatsModuleUtils {\\n bytes32 public constant SALT =\\n 0x5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b5072;\\n\\n struct SablierStreamParams {\\n ISablierV2LockupLinear sablier;\\n address sender;\\n address asset;\\n LockupLinear.Timestamps timestamps;\\n Broker broker;\\n uint128 totalAmount;\\n bool cancelable;\\n bool transferable;\\n }\\n\\n struct HatParams {\\n address wearer;\\n string details;\\n string imageURI;\\n SablierStreamParams[] sablierStreamsParams;\\n uint128 termEndDateTs; // If 0, this is an untermed Hat\\n uint32 maxSupply;\\n bool isMutable;\\n }\\n\\n struct CreateRoleHatsParams {\\n IHats hatsProtocol;\\n IERC6551Registry erc6551Registry;\\n address hatsAccountImplementation;\\n uint256 topHatId;\\n address topHatAccount;\\n address keyValuePairs;\\n IHatsModuleFactory hatsModuleFactory;\\n address hatsElectionsEligibilityImplementation;\\n uint256 adminHatId;\\n HatParams[] hats;\\n }\\n\\n function _processRoleHats(\\n CreateRoleHatsParams memory roleHatsParams\\n ) internal {\\n for (uint256 i = 0; i < roleHatsParams.hats.length; ) {\\n HatParams memory hatParams = roleHatsParams.hats[i];\\n\\n // Create eligibility module if needed\\n address eligibilityAddress = _createEligibilityModule(\\n roleHatsParams.hatsProtocol,\\n roleHatsParams.hatsModuleFactory,\\n roleHatsParams.hatsElectionsEligibilityImplementation,\\n roleHatsParams.topHatId,\\n roleHatsParams.topHatAccount,\\n roleHatsParams.adminHatId,\\n hatParams.termEndDateTs\\n );\\n\\n // Create and Mint the Role Hat\\n uint256 hatId = _createAndMintHat(\\n roleHatsParams.hatsProtocol,\\n roleHatsParams.adminHatId,\\n hatParams,\\n eligibilityAddress,\\n roleHatsParams.topHatAccount\\n );\\n\\n // Get the stream recipient (based on termed or not)\\n address streamRecipient = _setupStreamRecipient(\\n roleHatsParams.erc6551Registry,\\n roleHatsParams.hatsAccountImplementation,\\n address(roleHatsParams.hatsProtocol),\\n hatParams.termEndDateTs,\\n hatParams.wearer,\\n hatId\\n );\\n\\n // Create streams\\n _processSablierStreams(\\n hatParams.sablierStreamsParams,\\n streamRecipient,\\n roleHatsParams.keyValuePairs,\\n hatId\\n );\\n\\n unchecked {\\n ++i;\\n }\\n }\\n }\\n\\n function _createEligibilityModule(\\n IHats hatsProtocol,\\n IHatsModuleFactory hatsModuleFactory,\\n address hatsElectionsEligibilityImplementation,\\n uint256 topHatId,\\n address topHatAccount,\\n uint256 adminHatId,\\n uint128 termEndDateTs\\n ) private returns (address) {\\n // If the Hat is termed, create the eligibility module\\n if (termEndDateTs != 0) {\\n return\\n hatsModuleFactory.createHatsModule(\\n hatsElectionsEligibilityImplementation,\\n hatsProtocol.getNextId(adminHatId),\\n abi.encode(topHatId, uint256(0)), // [BALLOT_BOX_ID, ADMIN_HAT_ID]\\n abi.encode(termEndDateTs),\\n uint256(SALT)\\n );\\n }\\n\\n // Otherwise, return the Top Hat account\\n return topHatAccount;\\n }\\n\\n function _createAndMintHat(\\n IHats hatsProtocol,\\n uint256 adminHatId,\\n HatParams memory hat,\\n address eligibilityAddress,\\n address topHatAccount\\n ) private returns (uint256) {\\n // Grab the next Hat ID (before creating it)\\n uint256 hatId = hatsProtocol.getNextId(adminHatId);\\n\\n // Create the new Hat\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"createHat(uint256,string,uint32,address,address,bool,string)\\\",\\n adminHatId,\\n hat.details,\\n hat.maxSupply,\\n eligibilityAddress,\\n topHatAccount,\\n hat.isMutable,\\n hat.imageURI\\n ),\\n Enum.Operation.Call\\n );\\n\\n // If the Hat is termed, nominate the wearer as the eligible member\\n if (hat.termEndDateTs != 0) {\\n address[] memory nominatedWearers = new address[](1);\\n nominatedWearers[0] = hat.wearer;\\n\\n IAvatar(msg.sender).execTransactionFromModule(\\n eligibilityAddress,\\n 0,\\n abi.encodeWithSignature(\\n \\\"elect(uint128,address[])\\\",\\n hat.termEndDateTs,\\n nominatedWearers\\n ),\\n Enum.Operation.Call\\n );\\n }\\n\\n // Mint the Hat\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"mintHat(uint256,address)\\\",\\n hatId,\\n hat.wearer\\n ),\\n Enum.Operation.Call\\n );\\n return hatId;\\n }\\n\\n // Exists to avoid stack too deep errors\\n function _setupStreamRecipient(\\n IERC6551Registry erc6551Registry,\\n address hatsAccountImplementation,\\n address hatsProtocol,\\n uint128 termEndDateTs,\\n address wearer,\\n uint256 hatId\\n ) private returns (address) {\\n // If the hat is termed, the wearer is the stream recipient\\n if (termEndDateTs != 0) {\\n return wearer;\\n }\\n\\n // Otherwise, the Hat's smart account is the stream recipient\\n return\\n erc6551Registry.createAccount(\\n hatsAccountImplementation,\\n SALT,\\n block.chainid,\\n hatsProtocol,\\n hatId\\n );\\n }\\n\\n function _processSablierStreams(\\n SablierStreamParams[] memory streamParams,\\n address streamRecipient,\\n address keyValuePairs,\\n uint256 hatId\\n ) private {\\n for (uint256 i = 0; i < streamParams.length; ) {\\n SablierStreamParams memory sablierStreamParams = streamParams[i];\\n\\n // Approve tokens for Sablier\\n IAvatar(msg.sender).execTransactionFromModule(\\n sablierStreamParams.asset,\\n 0,\\n abi.encodeWithSignature(\\n \\\"approve(address,uint256)\\\",\\n sablierStreamParams.sablier,\\n sablierStreamParams.totalAmount\\n ),\\n Enum.Operation.Call\\n );\\n uint256 streamId = ISablierV2LockupLinear(\\n sablierStreamParams.sablier\\n ).nextStreamId();\\n\\n // Proxy the Sablier call through IAvatar\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(sablierStreamParams.sablier),\\n 0,\\n abi.encodeWithSignature(\\n \\\"createWithTimestamps((address,address,uint128,address,bool,bool,(uint40,uint40,uint40),(address,uint256)))\\\",\\n LockupLinear.CreateWithTimestamps({\\n sender: sablierStreamParams.sender,\\n recipient: streamRecipient,\\n totalAmount: sablierStreamParams.totalAmount,\\n asset: IERC20(sablierStreamParams.asset),\\n cancelable: sablierStreamParams.cancelable,\\n transferable: sablierStreamParams.transferable,\\n timestamps: sablierStreamParams.timestamps,\\n broker: sablierStreamParams.broker\\n })\\n ),\\n Enum.Operation.Call\\n );\\n\\n // Update KeyValuePairs with the stream ID and Hat ID\\n string[] memory keys = new string[](1);\\n string[] memory values = new string[](1);\\n keys[0] = \\\"hatIdToStreamId\\\";\\n values[0] = string(\\n abi.encodePacked(\\n Strings.toString(hatId),\\n \\\":\\\",\\n Strings.toString(streamId)\\n )\\n );\\n\\n IAvatar(msg.sender).execTransactionFromModule(\\n keyValuePairs,\\n 0,\\n abi.encodeWithSignature(\\n \\\"updateValues(string[],string[])\\\",\\n keys,\\n values\\n ),\\n Enum.Operation.Call\\n );\\n\\n unchecked {\\n ++i;\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xcf91d6de2291dd71d2491292ee2d1120c444b8f4f11b8c31429ed4c630013e69\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052348015600f57600080fd5b5061212e8061001f6000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c8063ba9a91a51461003b578063d58041b714610062575b600080fd5b6100506000805160206120d983398151915281565b60405190815260200160405180910390f35b610075610070366004611539565b610077565b005b6000806100cd61008a6020850185611593565b61009a6040860160208701611593565b6100aa60e0870160c08801611593565b6100ba60a0880160808901611593565b6100c86101008901896115c0565b61023d565b909250905060006101396100e46020860186611593565b6100f46040870160208801611593565b61010460e0880160c08901611593565b868661011660808b0160608c01611593565b61012660c08c0160a08d01611593565b6101346101208d018d6115e0565b610619565b604080516101408101909152909150610237908061015a6020880188611593565b6001600160a01b0316815260200186602001602081019061017b9190611593565b6001600160a01b0316815260200161019960e0880160c08901611593565b6001600160a01b03908116825260208201879052851660408201526060016101c760a0880160808901611593565b6001600160a01b031681526020016101e56060880160408901611593565b6001600160a01b03168152602001610204610100880160e08901611593565b6001600160a01b03168152602081018490526040016102276101408801886115f6565b61023091611997565b90526109b5565b50505050565b60408051600481526024810182526020810180516001600160e01b0316633f0f816960e21b17905290516000918291829182916001600160a01b038b169161028491611af9565b6000604051808303816000865af19150503d80600081146102c1576040519150601f19603f3d011682016040523d82523d6000602084013e6102c6565b606091505b50915091508161031c5760405162461bcd60e51b815260206004820152601a60248201527f4661696c656420746f20676574206c617374546f704861744964000000000000604482015260640160405180910390fd5b60e0818060200190518101906103329190611b0b565b61033d906001611b3a565b901b93503363468721a78a6000836103558a80611b53565b61036260208d018d611b53565b604051602401610376959493929190611bc2565b60408051601f198184030181529181526020820180516001600160e01b0316631a64dfad60e01b1790525160e085901b6001600160e01b03191681526103c493929190600090600401611c32565b6020604051808303816000875af11580156103e3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104079190611c88565b50604051638a54c52f60e01b81526001600160a01b03891690638a54c52f9061044a908a906000805160206120d98339815191529046908f908b90600401611ca5565b6020604051808303816000875af1158015610469573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061048d9190611cd8565b60408051600180825281830190925291945060009190816020015b60608152602001906001900390816104a857505060408051600180825281830190925291925060009190602082015b60608152602001906001900390816104d7579050509050604051806040016040528060088152602001671d1bdc12185d125960c21b8152508260008151811061052257610522611cf5565b602002602001018190525061053686610a84565b8160008151811061054957610549611cf5565b6020026020010181905250336001600160a01b031663468721a78960008585604051602401610579929190611d67565b60408051601f198184030181529181526020820180516001600160e01b031663579374b960e11b1790525160e085901b6001600160e01b03191681526105c793929190600090600401611c32565b6020604051808303816000875af11580156105e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061060a9190611c88565b50505050509550959350505050565b60405162460ea360e61b8152600481018690526000906001600160a01b038a1690631183a8c090602401602060405180830381865afa158015610660573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106849190611b0b565b90503363468721a78a60008961069a8780611b53565b60018c806106ae60608d0160408e01611d95565b6106bb60208e018e611b53565b6040516024016106d399989796959493929190611db2565b60408051601f198184030181529181526020820180516001600160e01b0316635829492f60e11b1790525160e085901b6001600160e01b031916815261072193929190600090600401611c32565b6020604051808303816000875af1158015610740573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107649190611c88565b50604051638a54c52f60e01b81526001600160a01b03891690638a54c52f906107a7908a906000805160206120d98339815191529046908f908890600401611ca5565b6020604051808303816000875af11580156107c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ea9190611cd8565b506000846001600160a01b031663f1ab873c856040518060200160405280600081525060405160240161081d9190611e17565b60408051601f19818403018152918152602080830180516001600160e01b031663a4f9edbf60e01b179052905161086f916000805160206120d983398151915291899101918252602082015260400190565b60408051601f198184030181529082905280516020909101206001600160e01b031960e086901b1682526108a7939291600401611e2a565b6020604051808303816000875af11580156108c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108ea9190611cd8565b604051602481018490526001600160a01b0382166044820152909150339063468721a7908c9060009060640160408051601f198184030181529181526020820180516001600160e01b031663320fbbb760e11b1790525160e085901b6001600160e01b031916815261096493929190600090600401611c32565b6020604051808303816000875af1158015610983573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109a79190611c88565b505098975050505050505050565b60005b81610120015151811015610a8057600082610120015182815181106109df576109df611cf5565b602002602001015190506000610a1784600001518560c001518660e00151876060015188608001518961010001518860800151610b8c565b90506000610a35856000015186610100015185858960800151610cf3565b90506000610a5b8660200151876040015188600001518760800151886000015187611025565b9050610a718460600151828860a00151856110cf565b846001019450505050506109b8565b5050565b606081600003610aab5750506040805180820190915260018152600360fc1b602082015290565b8160005b8115610ad55780610abf81611e5e565b9150610ace9050600a83611e8d565b9150610aaf565b6000816001600160401b03811115610aef57610aef611646565b6040519080825280601f01601f191660200182016040528015610b19576020820181803683370190505b5090505b8415610b8457610b2e600183611ea1565b9150610b3b600a86611eb4565b610b46906030611b3a565b60f81b818381518110610b5b57610b5b611cf5565b60200101906001600160f81b031916908160001a905350610b7d600a86611e8d565b9450610b1d565b949350505050565b60006001600160801b03821615610ce557866001600160a01b0316632f7fb7b6878a6001600160a01b0316631183a8c0876040518263ffffffff1660e01b8152600401610bdb91815260200190565b602060405180830381865afa158015610bf8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c1c9190611b0b565b886000604051602001610c39929190918252602082015260400190565b60408051601f198184030181528282526001600160801b0389166020840152910160408051601f19818403018152908290526001600160e01b031960e087901b168252610c9b949392916000805160206120d983398151915290600401611ec8565b6020604051808303816000875af1158015610cba573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cde9190611cd8565b9050610ce8565b50825b979650505050505050565b60405162460ea360e61b81526004810185905260009081906001600160a01b03881690631183a8c090602401602060405180830381865afa158015610d3c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d609190611b0b565b9050336001600160a01b031663468721a78860008989602001518a60a001518a8a8d60c001518e60400151604051602401610da19796959493929190611f14565b60408051601f198184030181529181526020820180516001600160e01b0316635829492f60e11b1790525160e085901b6001600160e01b0319168152610def93929190600090600401611c32565b6020604051808303816000875af1158015610e0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e329190611c88565b5060808501516001600160801b031615610f5d5760408051600180825281830190925260009160208083019080368337019050509050856000015181600081518110610e8057610e80611cf5565b60200260200101906001600160a01b031690816001600160a01b031681525050336001600160a01b031663468721a7866000896080015185604051602401610ec9929190611f78565b60408051601f198184030181529181526020820180516001600160e01b0316634a231cef60e01b1790525160e085901b6001600160e01b0319168152610f1793929190600090600401611c32565b6020604051808303816000875af1158015610f36573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f5a9190611c88565b50505b8451604051602481018390526001600160a01b039091166044820152339063468721a790899060009060640160408051601f198184030181529181526020820180516001600160e01b031663320fbbb760e11b1790525160e085901b6001600160e01b0319168152610fd793929190600090600401611c32565b6020604051808303816000875af1158015610ff6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061101a9190611c88565b509695505050505050565b60006001600160801b0384161561103d5750816110c5565b604051638a54c52f60e01b81526001600160a01b03881690638a54c52f9061107f9089906000805160206120d98339815191529046908b908990600401611ca5565b6020604051808303816000875af115801561109e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110c29190611cd8565b90505b9695505050505050565b60005b84518110156115325760008582815181106110ef576110ef611cf5565b60200260200101519050336001600160a01b031663468721a78260400151600084600001518560a001516040516024016111479291906001600160a01b039290921682526001600160801b0316602082015260400190565b60408051601f198184030181529181526020820180516001600160e01b031663095ea7b360e01b1790525160e085901b6001600160e01b031916815261119593929190600090600401611c32565b6020604051808303816000875af11580156111b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111d89190611c88565b50600081600001516001600160a01b0316631e99d5696040518163ffffffff1660e01b8152600401602060405180830381865afa15801561121d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112419190611b0b565b9050336001600160a01b031663468721a78360000151600060405180610100016040528087602001516001600160a01b031681526020018b6001600160a01b031681526020018760a001516001600160801b0316815260200187604001516001600160a01b031681526020018760c00151151581526020018760e00151151581526020018760600151815260200187608001518152506040516024016112e79190611fcd565b60408051601f198184030181529181526020820180516001600160e01b03166353b1572760e01b1790525160e085901b6001600160e01b031916815261133593929190600090600401611c32565b6020604051808303816000875af1158015611354573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113789190611c88565b50604080516001808252818301909252600091816020015b606081526020019060019003908161139057505060408051600180825281830190925291925060009190602082015b60608152602001906001900390816113bf5790505090506040518060400160405280600f81526020016e1a185d1259151bd4dd1c99585b5259608a1b8152508260008151811061141157611411611cf5565b602002602001018190525061142586610a84565b61142e84610a84565b60405160200161143f92919061209c565b6040516020818303038152906040528160008151811061146157611461611cf5565b6020026020010181905250336001600160a01b031663468721a78860008585604051602401611491929190611d67565b60408051601f198184030181529181526020820180516001600160e01b031663579374b960e11b1790525160e085901b6001600160e01b03191681526114df93929190600090600401611c32565b6020604051808303816000875af11580156114fe573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115229190611c88565b50846001019450505050506110d2565b5050505050565b60006020828403121561154b57600080fd5b81356001600160401b0381111561156157600080fd5b8201610160818503121561157457600080fd5b9392505050565b6001600160a01b038116811461159057600080fd5b50565b6000602082840312156115a557600080fd5b81356115748161157b565b80356115bb8161157b565b919050565b60008235603e198336030181126115d657600080fd5b9190910192915050565b60008235605e198336030181126115d657600080fd5b6000808335601e1984360301811261160d57600080fd5b8301803591506001600160401b0382111561162757600080fd5b6020019150600581901b360382131561163f57600080fd5b9250929050565b634e487b7160e01b600052604160045260246000fd5b60405161010081016001600160401b038111828210171561167f5761167f611646565b60405290565b60405160e081016001600160401b038111828210171561167f5761167f611646565b604051601f8201601f191681016001600160401b03811182821017156116cf576116cf611646565b604052919050565b60006001600160401b038211156116f0576116f0611646565b5060051b60200190565b600082601f83011261170b57600080fd5b81356001600160401b0381111561172457611724611646565b611737601f8201601f19166020016116a7565b81815284602083860101111561174c57600080fd5b816020850160208301376000918101602001919091529392505050565b803564ffffffffff811681146115bb57600080fd5b60006060828403121561179057600080fd5b604051606081016001600160401b03811182821017156117b2576117b2611646565b6040529050806117c183611769565b81526117cf60208401611769565b60208201526117e060408401611769565b60408201525092915050565b6000604082840312156117fe57600080fd5b604080519081016001600160401b038111828210171561182057611820611646565b60405290508082356118318161157b565b8152602092830135920191909152919050565b80356001600160801b03811681146115bb57600080fd5b801515811461159057600080fd5b80356115bb8161185b565b600082601f83011261188557600080fd5b8135611898611893826116d7565b6116a7565b80828252602082019150602061016084028601019250858311156118bb57600080fd5b602085015b838110156119795761016081880312156118d957600080fd5b6118e161165c565b6118ea826115b0565b81526118f8602083016115b0565b6020820152611909604083016115b0565b604082015261191b886060840161177e565b606082015261192d8860c084016117ec565b608082015261193f6101008301611844565b60a08201526119516101208301611869565b60c08201526119636101408301611869565b60e08201528352602090920191610160016118c0565b5095945050505050565b803563ffffffff811681146115bb57600080fd5b60006119a5611893846116d7565b8381526020810190600585901b8401368111156119c157600080fd5b845b81811015611aca5780356001600160401b038111156119e157600080fd5b860160e03682900312156119f457600080fd5b6119fc611685565b611a05826115b0565b815260208201356001600160401b03811115611a2057600080fd5b611a2c368285016116fa565b60208301525060408201356001600160401b03811115611a4b57600080fd5b611a57368285016116fa565b60408301525060608201356001600160401b03811115611a7657600080fd5b611a8236828501611874565b606083015250611a9460808301611844565b6080820152611aa560a08301611983565b60a0820152611ab660c08301611869565b60c0820152855250602093840193016119c3565b509095945050505050565b60005b83811015611af0578181015183820152602001611ad8565b50506000910152565b600082516115d6818460208701611ad5565b600060208284031215611b1d57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b80820180821115611b4d57611b4d611b24565b92915050565b6000808335601e19843603018112611b6a57600080fd5b8301803591506001600160401b03821115611b8457600080fd5b60200191503681900382131561163f57600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b0386168152606060208201819052600090611be79083018688611b99565b8281036040840152611bfa818587611b99565b98975050505050505050565b60008151808452611c1e816020860160208601611ad5565b601f01601f19169290920160200192915050565b60018060a01b0385168152836020820152608060408201526000611c596080830185611c06565b905060028310611c7957634e487b7160e01b600052602160045260246000fd5b82606083015295945050505050565b600060208284031215611c9a57600080fd5b81516115748161185b565b6001600160a01b039586168152602081019490945260408401929092529092166060820152608081019190915260a00190565b600060208284031215611cea57600080fd5b81516115748161157b565b634e487b7160e01b600052603260045260246000fd5b600082825180855260208501945060208160051b8301016020850160005b83811015611d5b57601f19858403018852611d45838351611c06565b6020988901989093509190910190600101611d29565b50909695505050505050565b604081526000611d7a6040830185611d0b565b8281036020840152611d8c8185611d0b565b95945050505050565b600060208284031215611da757600080fd5b81356115748161185b565b89815260e060208201526000611dcc60e083018a8c611b99565b60ff891660408401526001600160a01b0388811660608501528716608084015285151560a084015282810360c0840152611e07818587611b99565b9c9b505050505050505050505050565b6020815260006115746020830184611c06565b6001600160a01b0384168152606060208201819052600090611e4e90830185611c06565b9050826040830152949350505050565b600060018201611e7057611e70611b24565b5060010190565b634e487b7160e01b600052601260045260246000fd5b600082611e9c57611e9c611e77565b500490565b81810381811115611b4d57611b4d611b24565b600082611ec357611ec3611e77565b500690565b60018060a01b038616815284602082015260a060408201526000611eef60a0830186611c06565b8281036060840152611f018186611c06565b9150508260808301529695505050505050565b87815260e060208201526000611f2d60e0830189611c06565b63ffffffff881660408401526001600160a01b0387811660608501528616608084015284151560a084015282810360c0840152611f6a8185611c06565b9a9950505050505050505050565b6000604082016001600160801b03851683526040602084015280845180835260608501915060208601925060005b81811015611d5b5783516001600160a01b0316835260209384019390920191600101611fa6565b81516001600160a01b0390811682526020808401518216908301526040808401516001600160801b03169083015260608084015191821690830152610160820190506080830151612022608084018215159052565b5060a083015161203660a084018215159052565b5060c083015161207560c084018264ffffffffff815116825264ffffffffff602082015116602083015264ffffffffff60408201511660408301525050565b5060e0929092015180516001600160a01b0316610120830152602001516101409091015290565b600083516120ae818460208801611ad5565b601d60f91b90830190815283516120cc816001840160208801611ad5565b0160010194935050505056fe5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b5072a26469706673582212200934c93692d281e9d89ed2e17022e289297dd78e723d3ba32c6645f05d3b8df864736f6c634300081c0033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100365760003560e01c8063ba9a91a51461003b578063d58041b714610062575b600080fd5b6100506000805160206120d983398151915281565b60405190815260200160405180910390f35b610075610070366004611539565b610077565b005b6000806100cd61008a6020850185611593565b61009a6040860160208701611593565b6100aa60e0870160c08801611593565b6100ba60a0880160808901611593565b6100c86101008901896115c0565b61023d565b909250905060006101396100e46020860186611593565b6100f46040870160208801611593565b61010460e0880160c08901611593565b868661011660808b0160608c01611593565b61012660c08c0160a08d01611593565b6101346101208d018d6115e0565b610619565b604080516101408101909152909150610237908061015a6020880188611593565b6001600160a01b0316815260200186602001602081019061017b9190611593565b6001600160a01b0316815260200161019960e0880160c08901611593565b6001600160a01b03908116825260208201879052851660408201526060016101c760a0880160808901611593565b6001600160a01b031681526020016101e56060880160408901611593565b6001600160a01b03168152602001610204610100880160e08901611593565b6001600160a01b03168152602081018490526040016102276101408801886115f6565b61023091611997565b90526109b5565b50505050565b60408051600481526024810182526020810180516001600160e01b0316633f0f816960e21b17905290516000918291829182916001600160a01b038b169161028491611af9565b6000604051808303816000865af19150503d80600081146102c1576040519150601f19603f3d011682016040523d82523d6000602084013e6102c6565b606091505b50915091508161031c5760405162461bcd60e51b815260206004820152601a60248201527f4661696c656420746f20676574206c617374546f704861744964000000000000604482015260640160405180910390fd5b60e0818060200190518101906103329190611b0b565b61033d906001611b3a565b901b93503363468721a78a6000836103558a80611b53565b61036260208d018d611b53565b604051602401610376959493929190611bc2565b60408051601f198184030181529181526020820180516001600160e01b0316631a64dfad60e01b1790525160e085901b6001600160e01b03191681526103c493929190600090600401611c32565b6020604051808303816000875af11580156103e3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104079190611c88565b50604051638a54c52f60e01b81526001600160a01b03891690638a54c52f9061044a908a906000805160206120d98339815191529046908f908b90600401611ca5565b6020604051808303816000875af1158015610469573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061048d9190611cd8565b60408051600180825281830190925291945060009190816020015b60608152602001906001900390816104a857505060408051600180825281830190925291925060009190602082015b60608152602001906001900390816104d7579050509050604051806040016040528060088152602001671d1bdc12185d125960c21b8152508260008151811061052257610522611cf5565b602002602001018190525061053686610a84565b8160008151811061054957610549611cf5565b6020026020010181905250336001600160a01b031663468721a78960008585604051602401610579929190611d67565b60408051601f198184030181529181526020820180516001600160e01b031663579374b960e11b1790525160e085901b6001600160e01b03191681526105c793929190600090600401611c32565b6020604051808303816000875af11580156105e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061060a9190611c88565b50505050509550959350505050565b60405162460ea360e61b8152600481018690526000906001600160a01b038a1690631183a8c090602401602060405180830381865afa158015610660573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106849190611b0b565b90503363468721a78a60008961069a8780611b53565b60018c806106ae60608d0160408e01611d95565b6106bb60208e018e611b53565b6040516024016106d399989796959493929190611db2565b60408051601f198184030181529181526020820180516001600160e01b0316635829492f60e11b1790525160e085901b6001600160e01b031916815261072193929190600090600401611c32565b6020604051808303816000875af1158015610740573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107649190611c88565b50604051638a54c52f60e01b81526001600160a01b03891690638a54c52f906107a7908a906000805160206120d98339815191529046908f908890600401611ca5565b6020604051808303816000875af11580156107c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ea9190611cd8565b506000846001600160a01b031663f1ab873c856040518060200160405280600081525060405160240161081d9190611e17565b60408051601f19818403018152918152602080830180516001600160e01b031663a4f9edbf60e01b179052905161086f916000805160206120d983398151915291899101918252602082015260400190565b60408051601f198184030181529082905280516020909101206001600160e01b031960e086901b1682526108a7939291600401611e2a565b6020604051808303816000875af11580156108c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108ea9190611cd8565b604051602481018490526001600160a01b0382166044820152909150339063468721a7908c9060009060640160408051601f198184030181529181526020820180516001600160e01b031663320fbbb760e11b1790525160e085901b6001600160e01b031916815261096493929190600090600401611c32565b6020604051808303816000875af1158015610983573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109a79190611c88565b505098975050505050505050565b60005b81610120015151811015610a8057600082610120015182815181106109df576109df611cf5565b602002602001015190506000610a1784600001518560c001518660e00151876060015188608001518961010001518860800151610b8c565b90506000610a35856000015186610100015185858960800151610cf3565b90506000610a5b8660200151876040015188600001518760800151886000015187611025565b9050610a718460600151828860a00151856110cf565b846001019450505050506109b8565b5050565b606081600003610aab5750506040805180820190915260018152600360fc1b602082015290565b8160005b8115610ad55780610abf81611e5e565b9150610ace9050600a83611e8d565b9150610aaf565b6000816001600160401b03811115610aef57610aef611646565b6040519080825280601f01601f191660200182016040528015610b19576020820181803683370190505b5090505b8415610b8457610b2e600183611ea1565b9150610b3b600a86611eb4565b610b46906030611b3a565b60f81b818381518110610b5b57610b5b611cf5565b60200101906001600160f81b031916908160001a905350610b7d600a86611e8d565b9450610b1d565b949350505050565b60006001600160801b03821615610ce557866001600160a01b0316632f7fb7b6878a6001600160a01b0316631183a8c0876040518263ffffffff1660e01b8152600401610bdb91815260200190565b602060405180830381865afa158015610bf8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c1c9190611b0b565b886000604051602001610c39929190918252602082015260400190565b60408051601f198184030181528282526001600160801b0389166020840152910160408051601f19818403018152908290526001600160e01b031960e087901b168252610c9b949392916000805160206120d983398151915290600401611ec8565b6020604051808303816000875af1158015610cba573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cde9190611cd8565b9050610ce8565b50825b979650505050505050565b60405162460ea360e61b81526004810185905260009081906001600160a01b03881690631183a8c090602401602060405180830381865afa158015610d3c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d609190611b0b565b9050336001600160a01b031663468721a78860008989602001518a60a001518a8a8d60c001518e60400151604051602401610da19796959493929190611f14565b60408051601f198184030181529181526020820180516001600160e01b0316635829492f60e11b1790525160e085901b6001600160e01b0319168152610def93929190600090600401611c32565b6020604051808303816000875af1158015610e0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e329190611c88565b5060808501516001600160801b031615610f5d5760408051600180825281830190925260009160208083019080368337019050509050856000015181600081518110610e8057610e80611cf5565b60200260200101906001600160a01b031690816001600160a01b031681525050336001600160a01b031663468721a7866000896080015185604051602401610ec9929190611f78565b60408051601f198184030181529181526020820180516001600160e01b0316634a231cef60e01b1790525160e085901b6001600160e01b0319168152610f1793929190600090600401611c32565b6020604051808303816000875af1158015610f36573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f5a9190611c88565b50505b8451604051602481018390526001600160a01b039091166044820152339063468721a790899060009060640160408051601f198184030181529181526020820180516001600160e01b031663320fbbb760e11b1790525160e085901b6001600160e01b0319168152610fd793929190600090600401611c32565b6020604051808303816000875af1158015610ff6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061101a9190611c88565b509695505050505050565b60006001600160801b0384161561103d5750816110c5565b604051638a54c52f60e01b81526001600160a01b03881690638a54c52f9061107f9089906000805160206120d98339815191529046908b908990600401611ca5565b6020604051808303816000875af115801561109e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110c29190611cd8565b90505b9695505050505050565b60005b84518110156115325760008582815181106110ef576110ef611cf5565b60200260200101519050336001600160a01b031663468721a78260400151600084600001518560a001516040516024016111479291906001600160a01b039290921682526001600160801b0316602082015260400190565b60408051601f198184030181529181526020820180516001600160e01b031663095ea7b360e01b1790525160e085901b6001600160e01b031916815261119593929190600090600401611c32565b6020604051808303816000875af11580156111b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111d89190611c88565b50600081600001516001600160a01b0316631e99d5696040518163ffffffff1660e01b8152600401602060405180830381865afa15801561121d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112419190611b0b565b9050336001600160a01b031663468721a78360000151600060405180610100016040528087602001516001600160a01b031681526020018b6001600160a01b031681526020018760a001516001600160801b0316815260200187604001516001600160a01b031681526020018760c00151151581526020018760e00151151581526020018760600151815260200187608001518152506040516024016112e79190611fcd565b60408051601f198184030181529181526020820180516001600160e01b03166353b1572760e01b1790525160e085901b6001600160e01b031916815261133593929190600090600401611c32565b6020604051808303816000875af1158015611354573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113789190611c88565b50604080516001808252818301909252600091816020015b606081526020019060019003908161139057505060408051600180825281830190925291925060009190602082015b60608152602001906001900390816113bf5790505090506040518060400160405280600f81526020016e1a185d1259151bd4dd1c99585b5259608a1b8152508260008151811061141157611411611cf5565b602002602001018190525061142586610a84565b61142e84610a84565b60405160200161143f92919061209c565b6040516020818303038152906040528160008151811061146157611461611cf5565b6020026020010181905250336001600160a01b031663468721a78860008585604051602401611491929190611d67565b60408051601f198184030181529181526020820180516001600160e01b031663579374b960e11b1790525160e085901b6001600160e01b03191681526114df93929190600090600401611c32565b6020604051808303816000875af11580156114fe573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115229190611c88565b50846001019450505050506110d2565b5050505050565b60006020828403121561154b57600080fd5b81356001600160401b0381111561156157600080fd5b8201610160818503121561157457600080fd5b9392505050565b6001600160a01b038116811461159057600080fd5b50565b6000602082840312156115a557600080fd5b81356115748161157b565b80356115bb8161157b565b919050565b60008235603e198336030181126115d657600080fd5b9190910192915050565b60008235605e198336030181126115d657600080fd5b6000808335601e1984360301811261160d57600080fd5b8301803591506001600160401b0382111561162757600080fd5b6020019150600581901b360382131561163f57600080fd5b9250929050565b634e487b7160e01b600052604160045260246000fd5b60405161010081016001600160401b038111828210171561167f5761167f611646565b60405290565b60405160e081016001600160401b038111828210171561167f5761167f611646565b604051601f8201601f191681016001600160401b03811182821017156116cf576116cf611646565b604052919050565b60006001600160401b038211156116f0576116f0611646565b5060051b60200190565b600082601f83011261170b57600080fd5b81356001600160401b0381111561172457611724611646565b611737601f8201601f19166020016116a7565b81815284602083860101111561174c57600080fd5b816020850160208301376000918101602001919091529392505050565b803564ffffffffff811681146115bb57600080fd5b60006060828403121561179057600080fd5b604051606081016001600160401b03811182821017156117b2576117b2611646565b6040529050806117c183611769565b81526117cf60208401611769565b60208201526117e060408401611769565b60408201525092915050565b6000604082840312156117fe57600080fd5b604080519081016001600160401b038111828210171561182057611820611646565b60405290508082356118318161157b565b8152602092830135920191909152919050565b80356001600160801b03811681146115bb57600080fd5b801515811461159057600080fd5b80356115bb8161185b565b600082601f83011261188557600080fd5b8135611898611893826116d7565b6116a7565b80828252602082019150602061016084028601019250858311156118bb57600080fd5b602085015b838110156119795761016081880312156118d957600080fd5b6118e161165c565b6118ea826115b0565b81526118f8602083016115b0565b6020820152611909604083016115b0565b604082015261191b886060840161177e565b606082015261192d8860c084016117ec565b608082015261193f6101008301611844565b60a08201526119516101208301611869565b60c08201526119636101408301611869565b60e08201528352602090920191610160016118c0565b5095945050505050565b803563ffffffff811681146115bb57600080fd5b60006119a5611893846116d7565b8381526020810190600585901b8401368111156119c157600080fd5b845b81811015611aca5780356001600160401b038111156119e157600080fd5b860160e03682900312156119f457600080fd5b6119fc611685565b611a05826115b0565b815260208201356001600160401b03811115611a2057600080fd5b611a2c368285016116fa565b60208301525060408201356001600160401b03811115611a4b57600080fd5b611a57368285016116fa565b60408301525060608201356001600160401b03811115611a7657600080fd5b611a8236828501611874565b606083015250611a9460808301611844565b6080820152611aa560a08301611983565b60a0820152611ab660c08301611869565b60c0820152855250602093840193016119c3565b509095945050505050565b60005b83811015611af0578181015183820152602001611ad8565b50506000910152565b600082516115d6818460208701611ad5565b600060208284031215611b1d57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b80820180821115611b4d57611b4d611b24565b92915050565b6000808335601e19843603018112611b6a57600080fd5b8301803591506001600160401b03821115611b8457600080fd5b60200191503681900382131561163f57600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b0386168152606060208201819052600090611be79083018688611b99565b8281036040840152611bfa818587611b99565b98975050505050505050565b60008151808452611c1e816020860160208601611ad5565b601f01601f19169290920160200192915050565b60018060a01b0385168152836020820152608060408201526000611c596080830185611c06565b905060028310611c7957634e487b7160e01b600052602160045260246000fd5b82606083015295945050505050565b600060208284031215611c9a57600080fd5b81516115748161185b565b6001600160a01b039586168152602081019490945260408401929092529092166060820152608081019190915260a00190565b600060208284031215611cea57600080fd5b81516115748161157b565b634e487b7160e01b600052603260045260246000fd5b600082825180855260208501945060208160051b8301016020850160005b83811015611d5b57601f19858403018852611d45838351611c06565b6020988901989093509190910190600101611d29565b50909695505050505050565b604081526000611d7a6040830185611d0b565b8281036020840152611d8c8185611d0b565b95945050505050565b600060208284031215611da757600080fd5b81356115748161185b565b89815260e060208201526000611dcc60e083018a8c611b99565b60ff891660408401526001600160a01b0388811660608501528716608084015285151560a084015282810360c0840152611e07818587611b99565b9c9b505050505050505050505050565b6020815260006115746020830184611c06565b6001600160a01b0384168152606060208201819052600090611e4e90830185611c06565b9050826040830152949350505050565b600060018201611e7057611e70611b24565b5060010190565b634e487b7160e01b600052601260045260246000fd5b600082611e9c57611e9c611e77565b500490565b81810381811115611b4d57611b4d611b24565b600082611ec357611ec3611e77565b500690565b60018060a01b038616815284602082015260a060408201526000611eef60a0830186611c06565b8281036060840152611f018186611c06565b9150508260808301529695505050505050565b87815260e060208201526000611f2d60e0830189611c06565b63ffffffff881660408401526001600160a01b0387811660608501528616608084015284151560a084015282810360c0840152611f6a8185611c06565b9a9950505050505050505050565b6000604082016001600160801b03851683526040602084015280845180835260608501915060208601925060005b81811015611d5b5783516001600160a01b0316835260209384019390920191600101611fa6565b81516001600160a01b0390811682526020808401518216908301526040808401516001600160801b03169083015260608084015191821690830152610160820190506080830151612022608084018215159052565b5060a083015161203660a084018215159052565b5060c083015161207560c084018264ffffffffff815116825264ffffffffff602082015116602083015264ffffffffff60408201511660408301525050565b5060e0929092015180516001600160a01b0316610120830152602001516101409091015290565b600083516120ae818460208801611ad5565b601d60f91b90830190815283516120cc816001840160208801611ad5565b0160010194935050505056fe5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b5072a26469706673582212200934c93692d281e9d89ed2e17022e289297dd78e723d3ba32c6645f05d3b8df864736f6c634300081c0033", "devdoc": { "kind": "dev", "methods": { diff --git a/deployments/mainnet/DecentHatsModificationModule.json b/deployments/mainnet/DecentHatsModificationModule.json index 718c5f6..af4bf0e 100644 --- a/deployments/mainnet/DecentHatsModificationModule.json +++ b/deployments/mainnet/DecentHatsModificationModule.json @@ -1,5 +1,5 @@ { - "address": "0x6DC755EDe0faA526b06fb21DccaA64f3c218fa0a", + "address": "0x9755dD7E27E90b4fC00E50EC14DD2D08a79064d3", "abi": [ { "inputs": [], @@ -43,6 +43,11 @@ "name": "topHatAccount", "type": "address" }, + { + "internalType": "address", + "name": "keyValuePairs", + "type": "address" + }, { "internalType": "contract IHatsModuleFactory", "name": "hatsModuleFactory", @@ -183,32 +188,32 @@ "type": "function" } ], - "transactionHash": "0x4f73e8fbafb32946116aca87a698ca57fa6be6d07b9651ace81c9c58a73764cb", + "transactionHash": "0x8b230d50eba66fa8c1d1ef8c61d4597f01c209a25d01523819d272fff34fdcad", "receipt": { "to": null, "from": "0xb5Ca125166C1987A35EDD550E16846Fa1e1D9bB3", - "contractAddress": "0x6DC755EDe0faA526b06fb21DccaA64f3c218fa0a", - "transactionIndex": 79, - "gasUsed": "1061522", + "contractAddress": "0x9755dD7E27E90b4fC00E50EC14DD2D08a79064d3", + "transactionIndex": 104, + "gasUsed": "1316194", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x070cdbafac2eb7b1468a3365d354e72919921da3afc69d594c7c6a2ccedde47b", - "transactionHash": "0x4f73e8fbafb32946116aca87a698ca57fa6be6d07b9651ace81c9c58a73764cb", + "blockHash": "0xdd131f0f8f370b1e83f019729cdee5053c302a5088429d8aa0b48c7ee401aa68", + "transactionHash": "0x8b230d50eba66fa8c1d1ef8c61d4597f01c209a25d01523819d272fff34fdcad", "logs": [], - "blockNumber": 21123495, - "cumulativeGasUsed": "18254783", + "blockNumber": 21243755, + "cumulativeGasUsed": "10226912", "status": 1, "byzantium": true }, "args": [], - "numDeployments": 1, - "solcInputHash": "e3ec7808efccf5e6b24e16a29ead3983", - "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"SALT\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"contract IHats\",\"name\":\"hatsProtocol\",\"type\":\"address\"},{\"internalType\":\"contract IERC6551Registry\",\"name\":\"erc6551Registry\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"hatsAccountImplementation\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"topHatId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"topHatAccount\",\"type\":\"address\"},{\"internalType\":\"contract IHatsModuleFactory\",\"name\":\"hatsModuleFactory\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"hatsElectionsEligibilityImplementation\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"adminHatId\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"wearer\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"details\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"imageURI\",\"type\":\"string\"},{\"components\":[{\"internalType\":\"contract ISablierV2LockupLinear\",\"name\":\"sablier\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint40\",\"name\":\"start\",\"type\":\"uint40\"},{\"internalType\":\"uint40\",\"name\":\"cliff\",\"type\":\"uint40\"},{\"internalType\":\"uint40\",\"name\":\"end\",\"type\":\"uint40\"}],\"internalType\":\"struct LockupLinear.Timestamps\",\"name\":\"timestamps\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"UD60x18\",\"name\":\"fee\",\"type\":\"uint256\"}],\"internalType\":\"struct Broker\",\"name\":\"broker\",\"type\":\"tuple\"},{\"internalType\":\"uint128\",\"name\":\"totalAmount\",\"type\":\"uint128\"},{\"internalType\":\"bool\",\"name\":\"cancelable\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"transferable\",\"type\":\"bool\"}],\"internalType\":\"struct DecentHatsModuleUtils.SablierStreamParams[]\",\"name\":\"sablierStreamsParams\",\"type\":\"tuple[]\"},{\"internalType\":\"uint128\",\"name\":\"termEndDateTs\",\"type\":\"uint128\"},{\"internalType\":\"uint32\",\"name\":\"maxSupply\",\"type\":\"uint32\"},{\"internalType\":\"bool\",\"name\":\"isMutable\",\"type\":\"bool\"}],\"internalType\":\"struct DecentHatsModuleUtils.HatParams[]\",\"name\":\"hats\",\"type\":\"tuple[]\"}],\"internalType\":\"struct DecentHatsModuleUtils.CreateRoleHatsParams\",\"name\":\"roleHatsParams\",\"type\":\"tuple\"}],\"name\":\"createRoleHats\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"createRoleHats((address,address,address,uint256,address,address,address,uint256,(address,string,string,(address,address,address,(uint40,uint40,uint40),(address,uint256),uint128,bool,bool)[],uint128,uint32,bool)[]))\":{\"details\":\"Stream funds on untermed Roles are targeted at the hat's smart account. In order to withdraw funds from the stream, the hat's smart account must be the one call to `withdraw-` on the Sablier contract, setting the recipient arg to its wearer.Stream funds on termed Roles are targeted directly at the nominated wearer. The wearer should directly call `withdraw-` on the Sablier contract.Role hat creation, minting, smart account creation and stream creation are handled here in order to avoid a race condition where not more than one active proposal to create a new role can exist at a time. See: https://github.com/decentdao/decent-interface/issues/2402\",\"params\":{\"roleHatsParams\":\"An array of params for each role hat to be created.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"createRoleHats((address,address,address,uint256,address,address,address,uint256,(address,string,string,(address,address,address,(uint40,uint40,uint40),(address,uint256),uint128,bool,bool)[],uint128,uint32,bool)[]))\":{\"notice\":\"Creates a new termed or untermed role hat and any streams on it.This contract should be enabled a module on the Safe for which the role is to be created, and disabled after.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/modules/DecentHatsModificationModule.sol\":\"DecentHatsModificationModule\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\npragma solidity >=0.7.0 <0.9.0;\\n\\n/// @title Enum - Collection of enums\\n/// @author Richard Meissner - \\ncontract Enum {\\n enum Operation {Call, DelegateCall}\\n}\\n\",\"keccak256\":\"0x473e45b1a5cc47be494b0e123c9127f0c11c1e0992a321ae5a644c0bfdb2c14f\",\"license\":\"LGPL-3.0-only\"},\"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\n\\n/// @title Zodiac Avatar - A contract that manages modules that can execute transactions via this contract.\\npragma solidity >=0.7.0 <0.9.0;\\n\\nimport \\\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\\\";\\n\\ninterface IAvatar {\\n event EnabledModule(address module);\\n event DisabledModule(address module);\\n event ExecutionFromModuleSuccess(address indexed module);\\n event ExecutionFromModuleFailure(address indexed module);\\n\\n /// @dev Enables a module on the avatar.\\n /// @notice Can only be called by the avatar.\\n /// @notice Modules should be stored as a linked list.\\n /// @notice Must emit EnabledModule(address module) if successful.\\n /// @param module Module to be enabled.\\n function enableModule(address module) external;\\n\\n /// @dev Disables a module on the avatar.\\n /// @notice Can only be called by the avatar.\\n /// @notice Must emit DisabledModule(address module) if successful.\\n /// @param prevModule Address that pointed to the module to be removed in the linked list\\n /// @param module Module to be removed.\\n function disableModule(address prevModule, address module) external;\\n\\n /// @dev Allows a Module to execute a transaction.\\n /// @notice Can only be called by an enabled module.\\n /// @notice Must emit ExecutionFromModuleSuccess(address module) if successful.\\n /// @notice Must emit ExecutionFromModuleFailure(address module) if unsuccessful.\\n /// @param to Destination address of module transaction.\\n /// @param value Ether value of module transaction.\\n /// @param data Data payload of module transaction.\\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\\n function execTransactionFromModule(\\n address to,\\n uint256 value,\\n bytes memory data,\\n Enum.Operation operation\\n ) external returns (bool success);\\n\\n /// @dev Allows a Module to execute a transaction and return data\\n /// @notice Can only be called by an enabled module.\\n /// @notice Must emit ExecutionFromModuleSuccess(address module) if successful.\\n /// @notice Must emit ExecutionFromModuleFailure(address module) if unsuccessful.\\n /// @param to Destination address of module transaction.\\n /// @param value Ether value of module transaction.\\n /// @param data Data payload of module transaction.\\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\\n function execTransactionFromModuleReturnData(\\n address to,\\n uint256 value,\\n bytes memory data,\\n Enum.Operation operation\\n ) external returns (bool success, bytes memory returnData);\\n\\n /// @dev Returns if an module is enabled\\n /// @return True if the module is enabled\\n function isModuleEnabled(address module) external view returns (bool);\\n\\n /// @dev Returns array of modules.\\n /// @param start Start of the page.\\n /// @param pageSize Maximum number of modules that should be returned.\\n /// @return array Array of modules.\\n /// @return next Start of the next page.\\n function getModulesPaginated(address start, uint256 pageSize)\\n external\\n view\\n returns (address[] memory array, address next);\\n}\\n\",\"keccak256\":\"0xcd5508ffe596eef8fbccfd5fc4f10a34397773547ce64e212d48b5212865ec1f\",\"license\":\"LGPL-3.0-only\"},\"@openzeppelin/contracts/interfaces/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/introspection/IERC165.sol\\\";\\n\",\"keccak256\":\"0xd04b0f06e0666f29cf7cccc82894de541e19bb30a765b107b1e40bb7fe5f7d7a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev 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 amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `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 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes calldata data\\n ) external;\\n\\n /**\\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 {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the caller.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool _approved) external;\\n\\n /**\\n * @dev Returns 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\",\"keccak256\":\"0xed6a749c5373af398105ce6ee3ac4763aa450ea7285d268c85d9eeca809cdb1f\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../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\",\"keccak256\":\"0x75b829ff2f26c14355d1cba20e16fe7b29ca58eb5fef665ede48bc0f9c6c74b9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"@prb/math/src/Common.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\n// Common.sol\\n//\\n// Common mathematical functions used in both SD59x18 and UD60x18. Note that these global functions do not\\n// always operate with SD59x18 and UD60x18 numbers.\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CUSTOM ERRORS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @notice Thrown when the resultant value in {mulDiv} overflows uint256.\\nerror PRBMath_MulDiv_Overflow(uint256 x, uint256 y, uint256 denominator);\\n\\n/// @notice Thrown when the resultant value in {mulDiv18} overflows uint256.\\nerror PRBMath_MulDiv18_Overflow(uint256 x, uint256 y);\\n\\n/// @notice Thrown when one of the inputs passed to {mulDivSigned} is `type(int256).min`.\\nerror PRBMath_MulDivSigned_InputTooSmall();\\n\\n/// @notice Thrown when the resultant value in {mulDivSigned} overflows int256.\\nerror PRBMath_MulDivSigned_Overflow(int256 x, int256 y);\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CONSTANTS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @dev The maximum value a uint128 number can have.\\nuint128 constant MAX_UINT128 = type(uint128).max;\\n\\n/// @dev The maximum value a uint40 number can have.\\nuint40 constant MAX_UINT40 = type(uint40).max;\\n\\n/// @dev The unit number, which the decimal precision of the fixed-point types.\\nuint256 constant UNIT = 1e18;\\n\\n/// @dev The unit number inverted mod 2^256.\\nuint256 constant UNIT_INVERSE = 78156646155174841979727994598816262306175212592076161876661_508869554232690281;\\n\\n/// @dev The the largest power of two that divides the decimal value of `UNIT`. The logarithm of this value is the least significant\\n/// bit in the binary representation of `UNIT`.\\nuint256 constant UNIT_LPOTD = 262144;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @notice Calculates the binary exponent of x using the binary fraction method.\\n/// @dev Has to use 192.64-bit fixed-point numbers. See https://ethereum.stackexchange.com/a/96594/24693.\\n/// @param x The exponent as an unsigned 192.64-bit fixed-point number.\\n/// @return result The result as an unsigned 60.18-decimal fixed-point number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp2(uint256 x) pure returns (uint256 result) {\\n unchecked {\\n // Start from 0.5 in the 192.64-bit fixed-point format.\\n result = 0x800000000000000000000000000000000000000000000000;\\n\\n // The following logic multiplies the result by $\\\\sqrt{2^{-i}}$ when the bit at position i is 1. Key points:\\n //\\n // 1. Intermediate results will not overflow, as the starting point is 2^191 and all magic factors are under 2^65.\\n // 2. The rationale for organizing the if statements into groups of 8 is gas savings. If the result of performing\\n // a bitwise AND operation between x and any value in the array [0x80; 0x40; 0x20; 0x10; 0x08; 0x04; 0x02; 0x01] is 1,\\n // we know that `x & 0xFF` is also 1.\\n if (x & 0xFF00000000000000 > 0) {\\n if (x & 0x8000000000000000 > 0) {\\n result = (result * 0x16A09E667F3BCC909) >> 64;\\n }\\n if (x & 0x4000000000000000 > 0) {\\n result = (result * 0x1306FE0A31B7152DF) >> 64;\\n }\\n if (x & 0x2000000000000000 > 0) {\\n result = (result * 0x1172B83C7D517ADCE) >> 64;\\n }\\n if (x & 0x1000000000000000 > 0) {\\n result = (result * 0x10B5586CF9890F62A) >> 64;\\n }\\n if (x & 0x800000000000000 > 0) {\\n result = (result * 0x1059B0D31585743AE) >> 64;\\n }\\n if (x & 0x400000000000000 > 0) {\\n result = (result * 0x102C9A3E778060EE7) >> 64;\\n }\\n if (x & 0x200000000000000 > 0) {\\n result = (result * 0x10163DA9FB33356D8) >> 64;\\n }\\n if (x & 0x100000000000000 > 0) {\\n result = (result * 0x100B1AFA5ABCBED61) >> 64;\\n }\\n }\\n\\n if (x & 0xFF000000000000 > 0) {\\n if (x & 0x80000000000000 > 0) {\\n result = (result * 0x10058C86DA1C09EA2) >> 64;\\n }\\n if (x & 0x40000000000000 > 0) {\\n result = (result * 0x1002C605E2E8CEC50) >> 64;\\n }\\n if (x & 0x20000000000000 > 0) {\\n result = (result * 0x100162F3904051FA1) >> 64;\\n }\\n if (x & 0x10000000000000 > 0) {\\n result = (result * 0x1000B175EFFDC76BA) >> 64;\\n }\\n if (x & 0x8000000000000 > 0) {\\n result = (result * 0x100058BA01FB9F96D) >> 64;\\n }\\n if (x & 0x4000000000000 > 0) {\\n result = (result * 0x10002C5CC37DA9492) >> 64;\\n }\\n if (x & 0x2000000000000 > 0) {\\n result = (result * 0x1000162E525EE0547) >> 64;\\n }\\n if (x & 0x1000000000000 > 0) {\\n result = (result * 0x10000B17255775C04) >> 64;\\n }\\n }\\n\\n if (x & 0xFF0000000000 > 0) {\\n if (x & 0x800000000000 > 0) {\\n result = (result * 0x1000058B91B5BC9AE) >> 64;\\n }\\n if (x & 0x400000000000 > 0) {\\n result = (result * 0x100002C5C89D5EC6D) >> 64;\\n }\\n if (x & 0x200000000000 > 0) {\\n result = (result * 0x10000162E43F4F831) >> 64;\\n }\\n if (x & 0x100000000000 > 0) {\\n result = (result * 0x100000B1721BCFC9A) >> 64;\\n }\\n if (x & 0x80000000000 > 0) {\\n result = (result * 0x10000058B90CF1E6E) >> 64;\\n }\\n if (x & 0x40000000000 > 0) {\\n result = (result * 0x1000002C5C863B73F) >> 64;\\n }\\n if (x & 0x20000000000 > 0) {\\n result = (result * 0x100000162E430E5A2) >> 64;\\n }\\n if (x & 0x10000000000 > 0) {\\n result = (result * 0x1000000B172183551) >> 64;\\n }\\n }\\n\\n if (x & 0xFF00000000 > 0) {\\n if (x & 0x8000000000 > 0) {\\n result = (result * 0x100000058B90C0B49) >> 64;\\n }\\n if (x & 0x4000000000 > 0) {\\n result = (result * 0x10000002C5C8601CC) >> 64;\\n }\\n if (x & 0x2000000000 > 0) {\\n result = (result * 0x1000000162E42FFF0) >> 64;\\n }\\n if (x & 0x1000000000 > 0) {\\n result = (result * 0x10000000B17217FBB) >> 64;\\n }\\n if (x & 0x800000000 > 0) {\\n result = (result * 0x1000000058B90BFCE) >> 64;\\n }\\n if (x & 0x400000000 > 0) {\\n result = (result * 0x100000002C5C85FE3) >> 64;\\n }\\n if (x & 0x200000000 > 0) {\\n result = (result * 0x10000000162E42FF1) >> 64;\\n }\\n if (x & 0x100000000 > 0) {\\n result = (result * 0x100000000B17217F8) >> 64;\\n }\\n }\\n\\n if (x & 0xFF000000 > 0) {\\n if (x & 0x80000000 > 0) {\\n result = (result * 0x10000000058B90BFC) >> 64;\\n }\\n if (x & 0x40000000 > 0) {\\n result = (result * 0x1000000002C5C85FE) >> 64;\\n }\\n if (x & 0x20000000 > 0) {\\n result = (result * 0x100000000162E42FF) >> 64;\\n }\\n if (x & 0x10000000 > 0) {\\n result = (result * 0x1000000000B17217F) >> 64;\\n }\\n if (x & 0x8000000 > 0) {\\n result = (result * 0x100000000058B90C0) >> 64;\\n }\\n if (x & 0x4000000 > 0) {\\n result = (result * 0x10000000002C5C860) >> 64;\\n }\\n if (x & 0x2000000 > 0) {\\n result = (result * 0x1000000000162E430) >> 64;\\n }\\n if (x & 0x1000000 > 0) {\\n result = (result * 0x10000000000B17218) >> 64;\\n }\\n }\\n\\n if (x & 0xFF0000 > 0) {\\n if (x & 0x800000 > 0) {\\n result = (result * 0x1000000000058B90C) >> 64;\\n }\\n if (x & 0x400000 > 0) {\\n result = (result * 0x100000000002C5C86) >> 64;\\n }\\n if (x & 0x200000 > 0) {\\n result = (result * 0x10000000000162E43) >> 64;\\n }\\n if (x & 0x100000 > 0) {\\n result = (result * 0x100000000000B1721) >> 64;\\n }\\n if (x & 0x80000 > 0) {\\n result = (result * 0x10000000000058B91) >> 64;\\n }\\n if (x & 0x40000 > 0) {\\n result = (result * 0x1000000000002C5C8) >> 64;\\n }\\n if (x & 0x20000 > 0) {\\n result = (result * 0x100000000000162E4) >> 64;\\n }\\n if (x & 0x10000 > 0) {\\n result = (result * 0x1000000000000B172) >> 64;\\n }\\n }\\n\\n if (x & 0xFF00 > 0) {\\n if (x & 0x8000 > 0) {\\n result = (result * 0x100000000000058B9) >> 64;\\n }\\n if (x & 0x4000 > 0) {\\n result = (result * 0x10000000000002C5D) >> 64;\\n }\\n if (x & 0x2000 > 0) {\\n result = (result * 0x1000000000000162E) >> 64;\\n }\\n if (x & 0x1000 > 0) {\\n result = (result * 0x10000000000000B17) >> 64;\\n }\\n if (x & 0x800 > 0) {\\n result = (result * 0x1000000000000058C) >> 64;\\n }\\n if (x & 0x400 > 0) {\\n result = (result * 0x100000000000002C6) >> 64;\\n }\\n if (x & 0x200 > 0) {\\n result = (result * 0x10000000000000163) >> 64;\\n }\\n if (x & 0x100 > 0) {\\n result = (result * 0x100000000000000B1) >> 64;\\n }\\n }\\n\\n if (x & 0xFF > 0) {\\n if (x & 0x80 > 0) {\\n result = (result * 0x10000000000000059) >> 64;\\n }\\n if (x & 0x40 > 0) {\\n result = (result * 0x1000000000000002C) >> 64;\\n }\\n if (x & 0x20 > 0) {\\n result = (result * 0x10000000000000016) >> 64;\\n }\\n if (x & 0x10 > 0) {\\n result = (result * 0x1000000000000000B) >> 64;\\n }\\n if (x & 0x8 > 0) {\\n result = (result * 0x10000000000000006) >> 64;\\n }\\n if (x & 0x4 > 0) {\\n result = (result * 0x10000000000000003) >> 64;\\n }\\n if (x & 0x2 > 0) {\\n result = (result * 0x10000000000000001) >> 64;\\n }\\n if (x & 0x1 > 0) {\\n result = (result * 0x10000000000000001) >> 64;\\n }\\n }\\n\\n // In the code snippet below, two operations are executed simultaneously:\\n //\\n // 1. The result is multiplied by $(2^n + 1)$, where $2^n$ represents the integer part, and the additional 1\\n // accounts for the initial guess of 0.5. This is achieved by subtracting from 191 instead of 192.\\n // 2. The result is then converted to an unsigned 60.18-decimal fixed-point format.\\n //\\n // The underlying logic is based on the relationship $2^{191-ip} = 2^{ip} / 2^{191}$, where $ip$ denotes the,\\n // integer part, $2^n$.\\n result *= UNIT;\\n result >>= (191 - (x >> 64));\\n }\\n}\\n\\n/// @notice Finds the zero-based index of the first 1 in the binary representation of x.\\n///\\n/// @dev See the note on \\\"msb\\\" in this Wikipedia article: https://en.wikipedia.org/wiki/Find_first_set\\n///\\n/// Each step in this implementation is equivalent to this high-level code:\\n///\\n/// ```solidity\\n/// if (x >= 2 ** 128) {\\n/// x >>= 128;\\n/// result += 128;\\n/// }\\n/// ```\\n///\\n/// Where 128 is replaced with each respective power of two factor. See the full high-level implementation here:\\n/// https://gist.github.com/PaulRBerg/f932f8693f2733e30c4d479e8e980948\\n///\\n/// The Yul instructions used below are:\\n///\\n/// - \\\"gt\\\" is \\\"greater than\\\"\\n/// - \\\"or\\\" is the OR bitwise operator\\n/// - \\\"shl\\\" is \\\"shift left\\\"\\n/// - \\\"shr\\\" is \\\"shift right\\\"\\n///\\n/// @param x The uint256 number for which to find the index of the most significant bit.\\n/// @return result The index of the most significant bit as a uint256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction msb(uint256 x) pure returns (uint256 result) {\\n // 2^128\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(7, gt(x, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^64\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(6, gt(x, 0xFFFFFFFFFFFFFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^32\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(5, gt(x, 0xFFFFFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^16\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(4, gt(x, 0xFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^8\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(3, gt(x, 0xFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^4\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(2, gt(x, 0xF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^2\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(1, gt(x, 0x3))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^1\\n // No need to shift x any more.\\n assembly (\\\"memory-safe\\\") {\\n let factor := gt(x, 0x1)\\n result := or(result, factor)\\n }\\n}\\n\\n/// @notice Calculates x*y\\u00f7denominator with 512-bit precision.\\n///\\n/// @dev Credits to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv.\\n///\\n/// Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - The denominator must not be zero.\\n/// - The result must fit in uint256.\\n///\\n/// @param x The multiplicand as a uint256.\\n/// @param y The multiplier as a uint256.\\n/// @param denominator The divisor as a uint256.\\n/// @return result The result as a uint256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mulDiv(uint256 x, uint256 y, uint256 denominator) pure returns (uint256 result) {\\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; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly (\\\"memory-safe\\\") {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\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 unchecked {\\n return prod0 / denominator;\\n }\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n if (prod1 >= denominator) {\\n revert PRBMath_MulDiv_Overflow(x, y, denominator);\\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 (\\\"memory-safe\\\") {\\n // Compute remainder using the mulmod Yul instruction.\\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 unchecked {\\n // Calculate the largest power of two divisor of the denominator using the unary operator ~. This operation cannot overflow\\n // because the denominator cannot be zero at this point in the function execution. The result is always >= 1.\\n // For more detail, see https://cs.stackexchange.com/q/138556/92363.\\n uint256 lpotdod = denominator & (~denominator + 1);\\n uint256 flippedLpotdod;\\n\\n assembly (\\\"memory-safe\\\") {\\n // Factor powers of two out of denominator.\\n denominator := div(denominator, lpotdod)\\n\\n // Divide [prod1 prod0] by lpotdod.\\n prod0 := div(prod0, lpotdod)\\n\\n // Get the flipped value `2^256 / lpotdod`. If the `lpotdod` is zero, the flipped value is one.\\n // `sub(0, lpotdod)` produces the two's complement version of `lpotdod`, which is equivalent to flipping all the bits.\\n // However, `div` interprets this value as an unsigned value: https://ethereum.stackexchange.com/q/147168/24693\\n flippedLpotdod := add(div(sub(0, lpotdod), lpotdod), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * flippedLpotdod;\\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 works\\n // 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 }\\n}\\n\\n/// @notice Calculates x*y\\u00f71e18 with 512-bit precision.\\n///\\n/// @dev A variant of {mulDiv} with constant folding, i.e. in which the denominator is hard coded to 1e18.\\n///\\n/// Notes:\\n/// - The body is purposely left uncommented; to understand how this works, see the documentation in {mulDiv}.\\n/// - The result is rounded toward zero.\\n/// - We take as an axiom that the result cannot be `MAX_UINT256` when x and y solve the following system of equations:\\n///\\n/// $$\\n/// \\\\begin{cases}\\n/// x * y = MAX\\\\_UINT256 * UNIT \\\\\\\\\\n/// (x * y) \\\\% UNIT \\\\geq \\\\frac{UNIT}{2}\\n/// \\\\end{cases}\\n/// $$\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {mulDiv}.\\n/// - The result must fit in uint256.\\n///\\n/// @param x The multiplicand as an unsigned 60.18-decimal fixed-point number.\\n/// @param y The multiplier as an unsigned 60.18-decimal fixed-point number.\\n/// @return result The result as an unsigned 60.18-decimal fixed-point number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mulDiv18(uint256 x, uint256 y) pure returns (uint256 result) {\\n uint256 prod0;\\n uint256 prod1;\\n assembly (\\\"memory-safe\\\") {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n if (prod1 == 0) {\\n unchecked {\\n return prod0 / UNIT;\\n }\\n }\\n\\n if (prod1 >= UNIT) {\\n revert PRBMath_MulDiv18_Overflow(x, y);\\n }\\n\\n uint256 remainder;\\n assembly (\\\"memory-safe\\\") {\\n remainder := mulmod(x, y, UNIT)\\n result :=\\n mul(\\n or(\\n div(sub(prod0, remainder), UNIT_LPOTD),\\n mul(sub(prod1, gt(remainder, prod0)), add(div(sub(0, UNIT_LPOTD), UNIT_LPOTD), 1))\\n ),\\n UNIT_INVERSE\\n )\\n }\\n}\\n\\n/// @notice Calculates x*y\\u00f7denominator with 512-bit precision.\\n///\\n/// @dev This is an extension of {mulDiv} for signed numbers, which works by computing the signs and the absolute values separately.\\n///\\n/// Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {mulDiv}.\\n/// - None of the inputs can be `type(int256).min`.\\n/// - The result must fit in int256.\\n///\\n/// @param x The multiplicand as an int256.\\n/// @param y The multiplier as an int256.\\n/// @param denominator The divisor as an int256.\\n/// @return result The result as an int256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mulDivSigned(int256 x, int256 y, int256 denominator) pure returns (int256 result) {\\n if (x == type(int256).min || y == type(int256).min || denominator == type(int256).min) {\\n revert PRBMath_MulDivSigned_InputTooSmall();\\n }\\n\\n // Get hold of the absolute values of x, y and the denominator.\\n uint256 xAbs;\\n uint256 yAbs;\\n uint256 dAbs;\\n unchecked {\\n xAbs = x < 0 ? uint256(-x) : uint256(x);\\n yAbs = y < 0 ? uint256(-y) : uint256(y);\\n dAbs = denominator < 0 ? uint256(-denominator) : uint256(denominator);\\n }\\n\\n // Compute the absolute value of x*y\\u00f7denominator. The result must fit in int256.\\n uint256 resultAbs = mulDiv(xAbs, yAbs, dAbs);\\n if (resultAbs > uint256(type(int256).max)) {\\n revert PRBMath_MulDivSigned_Overflow(x, y);\\n }\\n\\n // Get the signs of x, y and the denominator.\\n uint256 sx;\\n uint256 sy;\\n uint256 sd;\\n assembly (\\\"memory-safe\\\") {\\n // \\\"sgt\\\" is the \\\"signed greater than\\\" assembly instruction and \\\"sub(0,1)\\\" is -1 in two's complement.\\n sx := sgt(x, sub(0, 1))\\n sy := sgt(y, sub(0, 1))\\n sd := sgt(denominator, sub(0, 1))\\n }\\n\\n // XOR over sx, sy and sd. What this does is to check whether there are 1 or 3 negative signs in the inputs.\\n // If there are, the result should be negative. Otherwise, it should be positive.\\n unchecked {\\n result = sx ^ sy ^ sd == 0 ? -int256(resultAbs) : int256(resultAbs);\\n }\\n}\\n\\n/// @notice Calculates the square root of x using the Babylonian method.\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\\n///\\n/// Notes:\\n/// - If x is not a perfect square, the result is rounded down.\\n/// - Credits to OpenZeppelin for the explanations in comments below.\\n///\\n/// @param x The uint256 number for which to calculate the square root.\\n/// @return result The result as a uint256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction sqrt(uint256 x) pure returns (uint256 result) {\\n if (x == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we calculate the biggest power of 2 which is smaller than the square root of x.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of x is a power of 2 such that we have:\\n //\\n // $$\\n // msb(x) <= x <= 2*msb(x)$\\n // $$\\n //\\n // We write $msb(x)$ as $2^k$, and we get:\\n //\\n // $$\\n // k = log_2(x)\\n // $$\\n //\\n // Thus, we can write the initial inequality as:\\n //\\n // $$\\n // 2^{log_2(x)} <= x <= 2*2^{log_2(x)+1} \\\\\\\\\\n // sqrt(2^k) <= sqrt(x) < sqrt(2^{k+1}) \\\\\\\\\\n // 2^{k/2} <= sqrt(x) < 2^{(k+1)/2} <= 2^{(k/2)+1}\\n // $$\\n //\\n // Consequently, $2^{log_2(x) /2} is a good first approximation of sqrt(x) with at least one correct bit.\\n uint256 xAux = uint256(x);\\n result = 1;\\n if (xAux >= 2 ** 128) {\\n xAux >>= 128;\\n result <<= 64;\\n }\\n if (xAux >= 2 ** 64) {\\n xAux >>= 64;\\n result <<= 32;\\n }\\n if (xAux >= 2 ** 32) {\\n xAux >>= 32;\\n result <<= 16;\\n }\\n if (xAux >= 2 ** 16) {\\n xAux >>= 16;\\n result <<= 8;\\n }\\n if (xAux >= 2 ** 8) {\\n xAux >>= 8;\\n result <<= 4;\\n }\\n if (xAux >= 2 ** 4) {\\n xAux >>= 4;\\n result <<= 2;\\n }\\n if (xAux >= 2 ** 2) {\\n result <<= 1;\\n }\\n\\n // At this point, `result` is an estimation with at least one bit of precision. We know the true value has at\\n // most 128 bits, since it is the square root of a uint256. Newton's method converges quadratically (precision\\n // doubles at every iteration). We thus need at most 7 iteration to turn our partial result with one bit of\\n // precision into the expected uint128 result.\\n unchecked {\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n\\n // If x is not a perfect square, round the result toward zero.\\n uint256 roundedResult = x / result;\\n if (result >= roundedResult) {\\n result = roundedResult;\\n }\\n }\\n}\\n\",\"keccak256\":\"0xaa374e2c26cc93e8c22a6953804ee05f811597ef5fa82f76824378b22944778b\",\"license\":\"MIT\"},\"@prb/math/src/UD2x18.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\n/*\\n\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2550\\u2550\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2554\\u2588\\u2588\\u2588\\u2588\\u2554\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551 \\u255a\\u2550\\u255d \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\n\\n\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2550\\u2550\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d \\u255a\\u2588\\u2588\\u2588\\u2554\\u255d \\u255a\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u255d\\n\\n*/\\n\\nimport \\\"./ud2x18/Casting.sol\\\";\\nimport \\\"./ud2x18/Constants.sol\\\";\\nimport \\\"./ud2x18/Errors.sol\\\";\\nimport \\\"./ud2x18/ValueType.sol\\\";\\n\",\"keccak256\":\"0xfb624e24cd8bb790fa08e7827819de85504a86e20e961fa4ad126c65b6d90641\",\"license\":\"MIT\"},\"@prb/math/src/UD60x18.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\n/*\\n\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2550\\u2550\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2554\\u2588\\u2588\\u2588\\u2588\\u2554\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551 \\u255a\\u2550\\u255d \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\n\\n\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2550\\u2588\\u2588\\u2588\\u2588\\u2557\\u255a\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2588\\u2588\\u2551 \\u255a\\u2588\\u2588\\u2588\\u2554\\u255d \\u255a\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2554\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2554\\u255d \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u255d\\n\\n*/\\n\\nimport \\\"./ud60x18/Casting.sol\\\";\\nimport \\\"./ud60x18/Constants.sol\\\";\\nimport \\\"./ud60x18/Conversions.sol\\\";\\nimport \\\"./ud60x18/Errors.sol\\\";\\nimport \\\"./ud60x18/Helpers.sol\\\";\\nimport \\\"./ud60x18/Math.sol\\\";\\nimport \\\"./ud60x18/ValueType.sol\\\";\\n\",\"keccak256\":\"0xb98c6f74275914d279e8af6c502c2b1f50d5f6e1ed418d3b0153f5a193206c48\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as CastingErrors;\\nimport { SD59x18 } from \\\"../sd59x18/ValueType.sol\\\";\\nimport { UD2x18 } from \\\"../ud2x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"../ud60x18/ValueType.sol\\\";\\nimport { SD1x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts an SD1x18 number into SD59x18.\\n/// @dev There is no overflow check because the domain of SD1x18 is a subset of SD59x18.\\nfunction intoSD59x18(SD1x18 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(int256(SD1x18.unwrap(x)));\\n}\\n\\n/// @notice Casts an SD1x18 number into UD2x18.\\n/// - x must be positive.\\nfunction intoUD2x18(SD1x18 x) pure returns (UD2x18 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUD2x18_Underflow(x);\\n }\\n result = UD2x18.wrap(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into UD60x18.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUD60x18(SD1x18 x) pure returns (UD60x18 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUD60x18_Underflow(x);\\n }\\n result = UD60x18.wrap(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into uint256.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUint256(SD1x18 x) pure returns (uint256 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint256_Underflow(x);\\n }\\n result = uint256(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into uint128.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUint128(SD1x18 x) pure returns (uint128 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint128_Underflow(x);\\n }\\n result = uint128(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(SD1x18 x) pure returns (uint40 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint40_Underflow(x);\\n }\\n if (xInt > int64(uint64(Common.MAX_UINT40))) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint40_Overflow(x);\\n }\\n result = uint40(uint64(xInt));\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction sd1x18(int64 x) pure returns (SD1x18 result) {\\n result = SD1x18.wrap(x);\\n}\\n\\n/// @notice Unwraps an SD1x18 number into int64.\\nfunction unwrap(SD1x18 x) pure returns (int64 result) {\\n result = SD1x18.unwrap(x);\\n}\\n\\n/// @notice Wraps an int64 number into SD1x18.\\nfunction wrap(int64 x) pure returns (SD1x18 result) {\\n result = SD1x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x9e49e2b37c1bb845861740805edaaef3fe951a7b96eef16ce84fbf76e8278670\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD1x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @dev Euler's number as an SD1x18 number.\\nSD1x18 constant E = SD1x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum value an SD1x18 number can have.\\nint64 constant uMAX_SD1x18 = 9_223372036854775807;\\nSD1x18 constant MAX_SD1x18 = SD1x18.wrap(uMAX_SD1x18);\\n\\n/// @dev The maximum value an SD1x18 number can have.\\nint64 constant uMIN_SD1x18 = -9_223372036854775808;\\nSD1x18 constant MIN_SD1x18 = SD1x18.wrap(uMIN_SD1x18);\\n\\n/// @dev PI as an SD1x18 number.\\nSD1x18 constant PI = SD1x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of SD1x18.\\nSD1x18 constant UNIT = SD1x18.wrap(1e18);\\nint64 constant uUNIT = 1e18;\\n\",\"keccak256\":\"0x6496165b80552785a4b65a239b96e2a5fedf62fe54f002eeed72d75e566d7585\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD1x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in UD2x18.\\nerror PRBMath_SD1x18_ToUD2x18_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in UD60x18.\\nerror PRBMath_SD1x18_ToUD60x18_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint128.\\nerror PRBMath_SD1x18_ToUint128_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint256.\\nerror PRBMath_SD1x18_ToUint256_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint40.\\nerror PRBMath_SD1x18_ToUint40_Overflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint40.\\nerror PRBMath_SD1x18_ToUint40_Underflow(SD1x18 x);\\n\",\"keccak256\":\"0x836cb42ba619ca369fd4765bc47fefc3c3621369c5861882af14660aca5057ee\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\n\\n/// @notice The signed 1.18-decimal fixed-point number representation, which can have up to 1 digit and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\\n/// type int64. This is useful when end users want to use int64 to save gas, e.g. with tight variable packing in contract\\n/// storage.\\ntype SD1x18 is int64;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoSD59x18,\\n Casting.intoUD2x18,\\n Casting.intoUD60x18,\\n Casting.intoUint256,\\n Casting.intoUint128,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for SD1x18 global;\\n\",\"keccak256\":\"0x2f86f1aa9fca42f40808b51a879b406ac51817647bdb9642f8a79dd8fdb754a7\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Errors.sol\\\" as CastingErrors;\\nimport { MAX_UINT128, MAX_UINT40 } from \\\"../Common.sol\\\";\\nimport { uMAX_SD1x18, uMIN_SD1x18 } from \\\"../sd1x18/Constants.sol\\\";\\nimport { SD1x18 } from \\\"../sd1x18/ValueType.sol\\\";\\nimport { uMAX_UD2x18 } from \\\"../ud2x18/Constants.sol\\\";\\nimport { UD2x18 } from \\\"../ud2x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"../ud60x18/ValueType.sol\\\";\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts an SD59x18 number into int256.\\n/// @dev This is basically a functional alias for {unwrap}.\\nfunction intoInt256(SD59x18 x) pure returns (int256 result) {\\n result = SD59x18.unwrap(x);\\n}\\n\\n/// @notice Casts an SD59x18 number into SD1x18.\\n/// @dev Requirements:\\n/// - x must be greater than or equal to `uMIN_SD1x18`.\\n/// - x must be less than or equal to `uMAX_SD1x18`.\\nfunction intoSD1x18(SD59x18 x) pure returns (SD1x18 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < uMIN_SD1x18) {\\n revert CastingErrors.PRBMath_SD59x18_IntoSD1x18_Underflow(x);\\n }\\n if (xInt > uMAX_SD1x18) {\\n revert CastingErrors.PRBMath_SD59x18_IntoSD1x18_Overflow(x);\\n }\\n result = SD1x18.wrap(int64(xInt));\\n}\\n\\n/// @notice Casts an SD59x18 number into UD2x18.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `uMAX_UD2x18`.\\nfunction intoUD2x18(SD59x18 x) pure returns (UD2x18 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUD2x18_Underflow(x);\\n }\\n if (xInt > int256(uint256(uMAX_UD2x18))) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUD2x18_Overflow(x);\\n }\\n result = UD2x18.wrap(uint64(uint256(xInt)));\\n}\\n\\n/// @notice Casts an SD59x18 number into UD60x18.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUD60x18(SD59x18 x) pure returns (UD60x18 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUD60x18_Underflow(x);\\n }\\n result = UD60x18.wrap(uint256(xInt));\\n}\\n\\n/// @notice Casts an SD59x18 number into uint256.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUint256(SD59x18 x) pure returns (uint256 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint256_Underflow(x);\\n }\\n result = uint256(xInt);\\n}\\n\\n/// @notice Casts an SD59x18 number into uint128.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `uMAX_UINT128`.\\nfunction intoUint128(SD59x18 x) pure returns (uint128 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint128_Underflow(x);\\n }\\n if (xInt > int256(uint256(MAX_UINT128))) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint128_Overflow(x);\\n }\\n result = uint128(uint256(xInt));\\n}\\n\\n/// @notice Casts an SD59x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(SD59x18 x) pure returns (uint40 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint40_Underflow(x);\\n }\\n if (xInt > int256(uint256(MAX_UINT40))) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint40_Overflow(x);\\n }\\n result = uint40(uint256(xInt));\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction sd(int256 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(x);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction sd59x18(int256 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(x);\\n}\\n\\n/// @notice Unwraps an SD59x18 number into int256.\\nfunction unwrap(SD59x18 x) pure returns (int256 result) {\\n result = SD59x18.unwrap(x);\\n}\\n\\n/// @notice Wraps an int256 number into SD59x18.\\nfunction wrap(int256 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x3b21b60ec2998c3ae32f647412da51d3683b3f183a807198cc8d157499484f99\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n// NOTICE: the \\\"u\\\" prefix stands for \\\"unwrapped\\\".\\n\\n/// @dev Euler's number as an SD59x18 number.\\nSD59x18 constant E = SD59x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum input permitted in {exp}.\\nint256 constant uEXP_MAX_INPUT = 133_084258667509499440;\\nSD59x18 constant EXP_MAX_INPUT = SD59x18.wrap(uEXP_MAX_INPUT);\\n\\n/// @dev Any value less than this returns 0 in {exp}.\\nint256 constant uEXP_MIN_THRESHOLD = -41_446531673892822322;\\nSD59x18 constant EXP_MIN_THRESHOLD = SD59x18.wrap(uEXP_MIN_THRESHOLD);\\n\\n/// @dev The maximum input permitted in {exp2}.\\nint256 constant uEXP2_MAX_INPUT = 192e18 - 1;\\nSD59x18 constant EXP2_MAX_INPUT = SD59x18.wrap(uEXP2_MAX_INPUT);\\n\\n/// @dev Any value less than this returns 0 in {exp2}.\\nint256 constant uEXP2_MIN_THRESHOLD = -59_794705707972522261;\\nSD59x18 constant EXP2_MIN_THRESHOLD = SD59x18.wrap(uEXP2_MIN_THRESHOLD);\\n\\n/// @dev Half the UNIT number.\\nint256 constant uHALF_UNIT = 0.5e18;\\nSD59x18 constant HALF_UNIT = SD59x18.wrap(uHALF_UNIT);\\n\\n/// @dev $log_2(10)$ as an SD59x18 number.\\nint256 constant uLOG2_10 = 3_321928094887362347;\\nSD59x18 constant LOG2_10 = SD59x18.wrap(uLOG2_10);\\n\\n/// @dev $log_2(e)$ as an SD59x18 number.\\nint256 constant uLOG2_E = 1_442695040888963407;\\nSD59x18 constant LOG2_E = SD59x18.wrap(uLOG2_E);\\n\\n/// @dev The maximum value an SD59x18 number can have.\\nint256 constant uMAX_SD59x18 = 57896044618658097711785492504343953926634992332820282019728_792003956564819967;\\nSD59x18 constant MAX_SD59x18 = SD59x18.wrap(uMAX_SD59x18);\\n\\n/// @dev The maximum whole value an SD59x18 number can have.\\nint256 constant uMAX_WHOLE_SD59x18 = 57896044618658097711785492504343953926634992332820282019728_000000000000000000;\\nSD59x18 constant MAX_WHOLE_SD59x18 = SD59x18.wrap(uMAX_WHOLE_SD59x18);\\n\\n/// @dev The minimum value an SD59x18 number can have.\\nint256 constant uMIN_SD59x18 = -57896044618658097711785492504343953926634992332820282019728_792003956564819968;\\nSD59x18 constant MIN_SD59x18 = SD59x18.wrap(uMIN_SD59x18);\\n\\n/// @dev The minimum whole value an SD59x18 number can have.\\nint256 constant uMIN_WHOLE_SD59x18 = -57896044618658097711785492504343953926634992332820282019728_000000000000000000;\\nSD59x18 constant MIN_WHOLE_SD59x18 = SD59x18.wrap(uMIN_WHOLE_SD59x18);\\n\\n/// @dev PI as an SD59x18 number.\\nSD59x18 constant PI = SD59x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of SD59x18.\\nint256 constant uUNIT = 1e18;\\nSD59x18 constant UNIT = SD59x18.wrap(1e18);\\n\\n/// @dev The unit number squared.\\nint256 constant uUNIT_SQUARED = 1e36;\\nSD59x18 constant UNIT_SQUARED = SD59x18.wrap(uUNIT_SQUARED);\\n\\n/// @dev Zero as an SD59x18 number.\\nSD59x18 constant ZERO = SD59x18.wrap(0);\\n\",\"keccak256\":\"0x9bcb8dd6b3e886d140ad1c32747a4f6d29a492529ceb835be878ae837aa6cc3a\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when taking the absolute value of `MIN_SD59x18`.\\nerror PRBMath_SD59x18_Abs_MinSD59x18();\\n\\n/// @notice Thrown when ceiling a number overflows SD59x18.\\nerror PRBMath_SD59x18_Ceil_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when converting a basic integer to the fixed-point format overflows SD59x18.\\nerror PRBMath_SD59x18_Convert_Overflow(int256 x);\\n\\n/// @notice Thrown when converting a basic integer to the fixed-point format underflows SD59x18.\\nerror PRBMath_SD59x18_Convert_Underflow(int256 x);\\n\\n/// @notice Thrown when dividing two numbers and one of them is `MIN_SD59x18`.\\nerror PRBMath_SD59x18_Div_InputTooSmall();\\n\\n/// @notice Thrown when dividing two numbers and one of the intermediary unsigned results overflows SD59x18.\\nerror PRBMath_SD59x18_Div_Overflow(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when taking the natural exponent of a base greater than 133_084258667509499441.\\nerror PRBMath_SD59x18_Exp_InputTooBig(SD59x18 x);\\n\\n/// @notice Thrown when taking the binary exponent of a base greater than 192e18.\\nerror PRBMath_SD59x18_Exp2_InputTooBig(SD59x18 x);\\n\\n/// @notice Thrown when flooring a number underflows SD59x18.\\nerror PRBMath_SD59x18_Floor_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when taking the geometric mean of two numbers and their product is negative.\\nerror PRBMath_SD59x18_Gm_NegativeProduct(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when taking the geometric mean of two numbers and multiplying them overflows SD59x18.\\nerror PRBMath_SD59x18_Gm_Overflow(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\\nerror PRBMath_SD59x18_IntoSD1x18_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\\nerror PRBMath_SD59x18_IntoSD1x18_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\\nerror PRBMath_SD59x18_IntoUD2x18_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\\nerror PRBMath_SD59x18_IntoUD2x18_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD60x18.\\nerror PRBMath_SD59x18_IntoUD60x18_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\\nerror PRBMath_SD59x18_IntoUint128_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\\nerror PRBMath_SD59x18_IntoUint128_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint256.\\nerror PRBMath_SD59x18_IntoUint256_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\\nerror PRBMath_SD59x18_IntoUint40_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\\nerror PRBMath_SD59x18_IntoUint40_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when taking the logarithm of a number less than or equal to zero.\\nerror PRBMath_SD59x18_Log_InputTooSmall(SD59x18 x);\\n\\n/// @notice Thrown when multiplying two numbers and one of the inputs is `MIN_SD59x18`.\\nerror PRBMath_SD59x18_Mul_InputTooSmall();\\n\\n/// @notice Thrown when multiplying two numbers and the intermediary absolute result overflows SD59x18.\\nerror PRBMath_SD59x18_Mul_Overflow(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when raising a number to a power and the intermediary absolute result overflows SD59x18.\\nerror PRBMath_SD59x18_Powu_Overflow(SD59x18 x, uint256 y);\\n\\n/// @notice Thrown when taking the square root of a negative number.\\nerror PRBMath_SD59x18_Sqrt_NegativeInput(SD59x18 x);\\n\\n/// @notice Thrown when the calculating the square root overflows SD59x18.\\nerror PRBMath_SD59x18_Sqrt_Overflow(SD59x18 x);\\n\",\"keccak256\":\"0xa6d00fe5efa215ac0df25c896e3da99a12fb61e799644b2ec32da947313d3db4\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Helpers.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { wrap } from \\\"./Casting.sol\\\";\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Implements the checked addition operation (+) in the SD59x18 type.\\nfunction add(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n return wrap(x.unwrap() + y.unwrap());\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the SD59x18 type.\\nfunction and(SD59x18 x, int256 bits) pure returns (SD59x18 result) {\\n return wrap(x.unwrap() & bits);\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the SD59x18 type.\\nfunction and2(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n return wrap(x.unwrap() & y.unwrap());\\n}\\n\\n/// @notice Implements the equal (=) operation in the SD59x18 type.\\nfunction eq(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() == y.unwrap();\\n}\\n\\n/// @notice Implements the greater than operation (>) in the SD59x18 type.\\nfunction gt(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() > y.unwrap();\\n}\\n\\n/// @notice Implements the greater than or equal to operation (>=) in the SD59x18 type.\\nfunction gte(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() >= y.unwrap();\\n}\\n\\n/// @notice Implements a zero comparison check function in the SD59x18 type.\\nfunction isZero(SD59x18 x) pure returns (bool result) {\\n result = x.unwrap() == 0;\\n}\\n\\n/// @notice Implements the left shift operation (<<) in the SD59x18 type.\\nfunction lshift(SD59x18 x, uint256 bits) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() << bits);\\n}\\n\\n/// @notice Implements the lower than operation (<) in the SD59x18 type.\\nfunction lt(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() < y.unwrap();\\n}\\n\\n/// @notice Implements the lower than or equal to operation (<=) in the SD59x18 type.\\nfunction lte(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() <= y.unwrap();\\n}\\n\\n/// @notice Implements the unchecked modulo operation (%) in the SD59x18 type.\\nfunction mod(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() % y.unwrap());\\n}\\n\\n/// @notice Implements the not equal operation (!=) in the SD59x18 type.\\nfunction neq(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() != y.unwrap();\\n}\\n\\n/// @notice Implements the NOT (~) bitwise operation in the SD59x18 type.\\nfunction not(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(~x.unwrap());\\n}\\n\\n/// @notice Implements the OR (|) bitwise operation in the SD59x18 type.\\nfunction or(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() | y.unwrap());\\n}\\n\\n/// @notice Implements the right shift operation (>>) in the SD59x18 type.\\nfunction rshift(SD59x18 x, uint256 bits) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() >> bits);\\n}\\n\\n/// @notice Implements the checked subtraction operation (-) in the SD59x18 type.\\nfunction sub(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() - y.unwrap());\\n}\\n\\n/// @notice Implements the checked unary minus operation (-) in the SD59x18 type.\\nfunction unary(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(-x.unwrap());\\n}\\n\\n/// @notice Implements the unchecked addition operation (+) in the SD59x18 type.\\nfunction uncheckedAdd(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() + y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the unchecked subtraction operation (-) in the SD59x18 type.\\nfunction uncheckedSub(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() - y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the unchecked unary minus operation (-) in the SD59x18 type.\\nfunction uncheckedUnary(SD59x18 x) pure returns (SD59x18 result) {\\n unchecked {\\n result = wrap(-x.unwrap());\\n }\\n}\\n\\n/// @notice Implements the XOR (^) bitwise operation in the SD59x18 type.\\nfunction xor(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() ^ y.unwrap());\\n}\\n\",\"keccak256\":\"0x208570f1657cf730cb6c3d81aa14030e0d45cf906cdedea5059369d7df4bb716\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as Errors;\\nimport {\\n uEXP_MAX_INPUT,\\n uEXP2_MAX_INPUT,\\n uEXP_MIN_THRESHOLD,\\n uEXP2_MIN_THRESHOLD,\\n uHALF_UNIT,\\n uLOG2_10,\\n uLOG2_E,\\n uMAX_SD59x18,\\n uMAX_WHOLE_SD59x18,\\n uMIN_SD59x18,\\n uMIN_WHOLE_SD59x18,\\n UNIT,\\n uUNIT,\\n uUNIT_SQUARED,\\n ZERO\\n} from \\\"./Constants.sol\\\";\\nimport { wrap } from \\\"./Helpers.sol\\\";\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Calculates the absolute value of x.\\n///\\n/// @dev Requirements:\\n/// - x must be greater than `MIN_SD59x18`.\\n///\\n/// @param x The SD59x18 number for which to calculate the absolute value.\\n/// @param result The absolute value of x as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction abs(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt == uMIN_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Abs_MinSD59x18();\\n }\\n result = xInt < 0 ? wrap(-xInt) : x;\\n}\\n\\n/// @notice Calculates the arithmetic average of x and y.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// @param x The first operand as an SD59x18 number.\\n/// @param y The second operand as an SD59x18 number.\\n/// @return result The arithmetic average as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction avg(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n\\n unchecked {\\n // This operation is equivalent to `x / 2 + y / 2`, and it can never overflow.\\n int256 sum = (xInt >> 1) + (yInt >> 1);\\n\\n if (sum < 0) {\\n // If at least one of x and y is odd, add 1 to the result, because shifting negative numbers to the right\\n // rounds toward negative infinity. The right part is equivalent to `sum + (x % 2 == 1 || y % 2 == 1)`.\\n assembly (\\\"memory-safe\\\") {\\n result := add(sum, and(or(xInt, yInt), 1))\\n }\\n } else {\\n // Add 1 if both x and y are odd to account for the double 0.5 remainder truncated after shifting.\\n result = wrap(sum + (xInt & yInt & 1));\\n }\\n }\\n}\\n\\n/// @notice Yields the smallest whole number greater than or equal to x.\\n///\\n/// @dev Optimized for fractional value inputs, because every whole value has (1e18 - 1) fractional counterparts.\\n/// See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n///\\n/// Requirements:\\n/// - x must be less than or equal to `MAX_WHOLE_SD59x18`.\\n///\\n/// @param x The SD59x18 number to ceil.\\n/// @param result The smallest whole number greater than or equal to x, as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ceil(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt > uMAX_WHOLE_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Ceil_Overflow(x);\\n }\\n\\n int256 remainder = xInt % uUNIT;\\n if (remainder == 0) {\\n result = x;\\n } else {\\n unchecked {\\n // Solidity uses C fmod style, which returns a modulus with the same sign as x.\\n int256 resultInt = xInt - remainder;\\n if (xInt > 0) {\\n resultInt += uUNIT;\\n }\\n result = wrap(resultInt);\\n }\\n }\\n}\\n\\n/// @notice Divides two SD59x18 numbers, returning a new SD59x18 number.\\n///\\n/// @dev This is an extension of {Common.mulDiv} for signed numbers, which works by computing the signs and the absolute\\n/// values separately.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv}.\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv}.\\n/// - None of the inputs can be `MIN_SD59x18`.\\n/// - The denominator must not be zero.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The numerator as an SD59x18 number.\\n/// @param y The denominator as an SD59x18 number.\\n/// @param result The quotient as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction div(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n if (xInt == uMIN_SD59x18 || yInt == uMIN_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Div_InputTooSmall();\\n }\\n\\n // Get hold of the absolute values of x and y.\\n uint256 xAbs;\\n uint256 yAbs;\\n unchecked {\\n xAbs = xInt < 0 ? uint256(-xInt) : uint256(xInt);\\n yAbs = yInt < 0 ? uint256(-yInt) : uint256(yInt);\\n }\\n\\n // Compute the absolute value (x*UNIT\\u00f7y). The resulting value must fit in SD59x18.\\n uint256 resultAbs = Common.mulDiv(xAbs, uint256(uUNIT), yAbs);\\n if (resultAbs > uint256(uMAX_SD59x18)) {\\n revert Errors.PRBMath_SD59x18_Div_Overflow(x, y);\\n }\\n\\n // Check if x and y have the same sign using two's complement representation. The left-most bit represents the sign (1 for\\n // negative, 0 for positive or zero).\\n bool sameSign = (xInt ^ yInt) > -1;\\n\\n // If the inputs have the same sign, the result should be positive. Otherwise, it should be negative.\\n unchecked {\\n result = wrap(sameSign ? int256(resultAbs) : -int256(resultAbs));\\n }\\n}\\n\\n/// @notice Calculates the natural exponent of x using the following formula:\\n///\\n/// $$\\n/// e^x = 2^{x * log_2{e}}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {exp2}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {exp2}.\\n/// - x must be less than 133_084258667509499441.\\n///\\n/// @param x The exponent as an SD59x18 number.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n\\n // Any input less than the threshold returns zero.\\n // This check also prevents an overflow for very small numbers.\\n if (xInt < uEXP_MIN_THRESHOLD) {\\n return ZERO;\\n }\\n\\n // This check prevents values greater than 192e18 from being passed to {exp2}.\\n if (xInt > uEXP_MAX_INPUT) {\\n revert Errors.PRBMath_SD59x18_Exp_InputTooBig(x);\\n }\\n\\n unchecked {\\n // Inline the fixed-point multiplication to save gas.\\n int256 doubleUnitProduct = xInt * uLOG2_E;\\n result = exp2(wrap(doubleUnitProduct / uUNIT));\\n }\\n}\\n\\n/// @notice Calculates the binary exponent of x using the binary fraction method using the following formula:\\n///\\n/// $$\\n/// 2^{-x} = \\\\frac{1}{2^x}\\n/// $$\\n///\\n/// @dev See https://ethereum.stackexchange.com/q/79903/24693.\\n///\\n/// Notes:\\n/// - If x is less than -59_794705707972522261, the result is zero.\\n///\\n/// Requirements:\\n/// - x must be less than 192e18.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The exponent as an SD59x18 number.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp2(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < 0) {\\n // The inverse of any number less than the threshold is truncated to zero.\\n if (xInt < uEXP2_MIN_THRESHOLD) {\\n return ZERO;\\n }\\n\\n unchecked {\\n // Inline the fixed-point inversion to save gas.\\n result = wrap(uUNIT_SQUARED / exp2(wrap(-xInt)).unwrap());\\n }\\n } else {\\n // Numbers greater than or equal to 192e18 don't fit in the 192.64-bit format.\\n if (xInt > uEXP2_MAX_INPUT) {\\n revert Errors.PRBMath_SD59x18_Exp2_InputTooBig(x);\\n }\\n\\n unchecked {\\n // Convert x to the 192.64-bit fixed-point format.\\n uint256 x_192x64 = uint256((xInt << 64) / uUNIT);\\n\\n // It is safe to cast the result to int256 due to the checks above.\\n result = wrap(int256(Common.exp2(x_192x64)));\\n }\\n }\\n}\\n\\n/// @notice Yields the greatest whole number less than or equal to x.\\n///\\n/// @dev Optimized for fractional value inputs, because for every whole value there are (1e18 - 1) fractional\\n/// counterparts. See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n///\\n/// Requirements:\\n/// - x must be greater than or equal to `MIN_WHOLE_SD59x18`.\\n///\\n/// @param x The SD59x18 number to floor.\\n/// @param result The greatest whole number less than or equal to x, as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction floor(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < uMIN_WHOLE_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Floor_Underflow(x);\\n }\\n\\n int256 remainder = xInt % uUNIT;\\n if (remainder == 0) {\\n result = x;\\n } else {\\n unchecked {\\n // Solidity uses C fmod style, which returns a modulus with the same sign as x.\\n int256 resultInt = xInt - remainder;\\n if (xInt < 0) {\\n resultInt -= uUNIT;\\n }\\n result = wrap(resultInt);\\n }\\n }\\n}\\n\\n/// @notice Yields the excess beyond the floor of x for positive numbers and the part of the number to the right.\\n/// of the radix point for negative numbers.\\n/// @dev Based on the odd function definition. https://en.wikipedia.org/wiki/Fractional_part\\n/// @param x The SD59x18 number to get the fractional part of.\\n/// @param result The fractional part of x as an SD59x18 number.\\nfunction frac(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() % uUNIT);\\n}\\n\\n/// @notice Calculates the geometric mean of x and y, i.e. $\\\\sqrt{x * y}$.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x * y must fit in SD59x18.\\n/// - x * y must not be negative, since complex numbers are not supported.\\n///\\n/// @param x The first operand as an SD59x18 number.\\n/// @param y The second operand as an SD59x18 number.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction gm(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n if (xInt == 0 || yInt == 0) {\\n return ZERO;\\n }\\n\\n unchecked {\\n // Equivalent to `xy / x != y`. Checking for overflow this way is faster than letting Solidity do it.\\n int256 xyInt = xInt * yInt;\\n if (xyInt / xInt != yInt) {\\n revert Errors.PRBMath_SD59x18_Gm_Overflow(x, y);\\n }\\n\\n // The product must not be negative, since complex numbers are not supported.\\n if (xyInt < 0) {\\n revert Errors.PRBMath_SD59x18_Gm_NegativeProduct(x, y);\\n }\\n\\n // We don't need to multiply the result by `UNIT` here because the x*y product picked up a factor of `UNIT`\\n // during multiplication. See the comments in {Common.sqrt}.\\n uint256 resultUint = Common.sqrt(uint256(xyInt));\\n result = wrap(int256(resultUint));\\n }\\n}\\n\\n/// @notice Calculates the inverse of x.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x must not be zero.\\n///\\n/// @param x The SD59x18 number for which to calculate the inverse.\\n/// @return result The inverse as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction inv(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(uUNIT_SQUARED / x.unwrap());\\n}\\n\\n/// @notice Calculates the natural logarithm of x using the following formula:\\n///\\n/// $$\\n/// ln{x} = log_2{x} / log_2{e}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n/// - The precision isn't sufficiently fine-grained to return exactly `UNIT` when the input is `E`.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The SD59x18 number for which to calculate the natural logarithm.\\n/// @return result The natural logarithm as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ln(SD59x18 x) pure returns (SD59x18 result) {\\n // Inline the fixed-point multiplication to save gas. This is overflow-safe because the maximum value that\\n // {log2} can return is ~195_205294292027477728.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_E);\\n}\\n\\n/// @notice Calculates the common logarithm of x using the following formula:\\n///\\n/// $$\\n/// log_{10}{x} = log_2{x} / log_2{10}\\n/// $$\\n///\\n/// However, if x is an exact power of ten, a hard coded value is returned.\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The SD59x18 number for which to calculate the common logarithm.\\n/// @return result The common logarithm as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log10(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < 0) {\\n revert Errors.PRBMath_SD59x18_Log_InputTooSmall(x);\\n }\\n\\n // Note that the `mul` in this block is the standard multiplication operation, not {SD59x18.mul}.\\n // prettier-ignore\\n assembly (\\\"memory-safe\\\") {\\n switch x\\n case 1 { result := mul(uUNIT, sub(0, 18)) }\\n case 10 { result := mul(uUNIT, sub(1, 18)) }\\n case 100 { result := mul(uUNIT, sub(2, 18)) }\\n case 1000 { result := mul(uUNIT, sub(3, 18)) }\\n case 10000 { result := mul(uUNIT, sub(4, 18)) }\\n case 100000 { result := mul(uUNIT, sub(5, 18)) }\\n case 1000000 { result := mul(uUNIT, sub(6, 18)) }\\n case 10000000 { result := mul(uUNIT, sub(7, 18)) }\\n case 100000000 { result := mul(uUNIT, sub(8, 18)) }\\n case 1000000000 { result := mul(uUNIT, sub(9, 18)) }\\n case 10000000000 { result := mul(uUNIT, sub(10, 18)) }\\n case 100000000000 { result := mul(uUNIT, sub(11, 18)) }\\n case 1000000000000 { result := mul(uUNIT, sub(12, 18)) }\\n case 10000000000000 { result := mul(uUNIT, sub(13, 18)) }\\n case 100000000000000 { result := mul(uUNIT, sub(14, 18)) }\\n case 1000000000000000 { result := mul(uUNIT, sub(15, 18)) }\\n case 10000000000000000 { result := mul(uUNIT, sub(16, 18)) }\\n case 100000000000000000 { result := mul(uUNIT, sub(17, 18)) }\\n case 1000000000000000000 { result := 0 }\\n case 10000000000000000000 { result := uUNIT }\\n case 100000000000000000000 { result := mul(uUNIT, 2) }\\n case 1000000000000000000000 { result := mul(uUNIT, 3) }\\n case 10000000000000000000000 { result := mul(uUNIT, 4) }\\n case 100000000000000000000000 { result := mul(uUNIT, 5) }\\n case 1000000000000000000000000 { result := mul(uUNIT, 6) }\\n case 10000000000000000000000000 { result := mul(uUNIT, 7) }\\n case 100000000000000000000000000 { result := mul(uUNIT, 8) }\\n case 1000000000000000000000000000 { result := mul(uUNIT, 9) }\\n case 10000000000000000000000000000 { result := mul(uUNIT, 10) }\\n case 100000000000000000000000000000 { result := mul(uUNIT, 11) }\\n case 1000000000000000000000000000000 { result := mul(uUNIT, 12) }\\n case 10000000000000000000000000000000 { result := mul(uUNIT, 13) }\\n case 100000000000000000000000000000000 { result := mul(uUNIT, 14) }\\n case 1000000000000000000000000000000000 { result := mul(uUNIT, 15) }\\n case 10000000000000000000000000000000000 { result := mul(uUNIT, 16) }\\n case 100000000000000000000000000000000000 { result := mul(uUNIT, 17) }\\n case 1000000000000000000000000000000000000 { result := mul(uUNIT, 18) }\\n case 10000000000000000000000000000000000000 { result := mul(uUNIT, 19) }\\n case 100000000000000000000000000000000000000 { result := mul(uUNIT, 20) }\\n case 1000000000000000000000000000000000000000 { result := mul(uUNIT, 21) }\\n case 10000000000000000000000000000000000000000 { result := mul(uUNIT, 22) }\\n case 100000000000000000000000000000000000000000 { result := mul(uUNIT, 23) }\\n case 1000000000000000000000000000000000000000000 { result := mul(uUNIT, 24) }\\n case 10000000000000000000000000000000000000000000 { result := mul(uUNIT, 25) }\\n case 100000000000000000000000000000000000000000000 { result := mul(uUNIT, 26) }\\n case 1000000000000000000000000000000000000000000000 { result := mul(uUNIT, 27) }\\n case 10000000000000000000000000000000000000000000000 { result := mul(uUNIT, 28) }\\n case 100000000000000000000000000000000000000000000000 { result := mul(uUNIT, 29) }\\n case 1000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 30) }\\n case 10000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 31) }\\n case 100000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 32) }\\n case 1000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 33) }\\n case 10000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 34) }\\n case 100000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 35) }\\n case 1000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 36) }\\n case 10000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 37) }\\n case 100000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 38) }\\n case 1000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 39) }\\n case 10000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 40) }\\n case 100000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 41) }\\n case 1000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 42) }\\n case 10000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 43) }\\n case 100000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 44) }\\n case 1000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 45) }\\n case 10000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 46) }\\n case 100000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 47) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 48) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 49) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 50) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 51) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 52) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 53) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 54) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 55) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 56) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 57) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 58) }\\n default { result := uMAX_SD59x18 }\\n }\\n\\n if (result.unwrap() == uMAX_SD59x18) {\\n unchecked {\\n // Inline the fixed-point division to save gas.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_10);\\n }\\n }\\n}\\n\\n/// @notice Calculates the binary logarithm of x using the iterative approximation algorithm:\\n///\\n/// $$\\n/// log_2{x} = n + log_2{y}, \\\\text{ where } y = x*2^{-n}, \\\\ y \\\\in [1, 2)\\n/// $$\\n///\\n/// For $0 \\\\leq x \\\\lt 1$, the input is inverted:\\n///\\n/// $$\\n/// log_2{x} = -log_2{\\\\frac{1}{x}}\\n/// $$\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Binary_logarithm#Iterative_approximation.\\n///\\n/// Notes:\\n/// - Due to the lossy precision of the iterative approximation, the results are not perfectly accurate to the last decimal.\\n///\\n/// Requirements:\\n/// - x must be greater than zero.\\n///\\n/// @param x The SD59x18 number for which to calculate the binary logarithm.\\n/// @return result The binary logarithm as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log2(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt <= 0) {\\n revert Errors.PRBMath_SD59x18_Log_InputTooSmall(x);\\n }\\n\\n unchecked {\\n int256 sign;\\n if (xInt >= uUNIT) {\\n sign = 1;\\n } else {\\n sign = -1;\\n // Inline the fixed-point inversion to save gas.\\n xInt = uUNIT_SQUARED / xInt;\\n }\\n\\n // Calculate the integer part of the logarithm.\\n uint256 n = Common.msb(uint256(xInt / uUNIT));\\n\\n // This is the integer part of the logarithm as an SD59x18 number. The operation can't overflow\\n // because n is at most 255, `UNIT` is 1e18, and the sign is either 1 or -1.\\n int256 resultInt = int256(n) * uUNIT;\\n\\n // Calculate $y = x * 2^{-n}$.\\n int256 y = xInt >> n;\\n\\n // If y is the unit number, the fractional part is zero.\\n if (y == uUNIT) {\\n return wrap(resultInt * sign);\\n }\\n\\n // Calculate the fractional part via the iterative approximation.\\n // The `delta >>= 1` part is equivalent to `delta /= 2`, but shifting bits is more gas efficient.\\n int256 DOUBLE_UNIT = 2e18;\\n for (int256 delta = uHALF_UNIT; delta > 0; delta >>= 1) {\\n y = (y * y) / uUNIT;\\n\\n // Is y^2 >= 2e18 and so in the range [2e18, 4e18)?\\n if (y >= DOUBLE_UNIT) {\\n // Add the 2^{-m} factor to the logarithm.\\n resultInt = resultInt + delta;\\n\\n // Halve y, which corresponds to z/2 in the Wikipedia article.\\n y >>= 1;\\n }\\n }\\n resultInt *= sign;\\n result = wrap(resultInt);\\n }\\n}\\n\\n/// @notice Multiplies two SD59x18 numbers together, returning a new SD59x18 number.\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {Common.mulDiv18}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv18}.\\n/// - None of the inputs can be `MIN_SD59x18`.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The multiplicand as an SD59x18 number.\\n/// @param y The multiplier as an SD59x18 number.\\n/// @return result The product as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mul(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n if (xInt == uMIN_SD59x18 || yInt == uMIN_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Mul_InputTooSmall();\\n }\\n\\n // Get hold of the absolute values of x and y.\\n uint256 xAbs;\\n uint256 yAbs;\\n unchecked {\\n xAbs = xInt < 0 ? uint256(-xInt) : uint256(xInt);\\n yAbs = yInt < 0 ? uint256(-yInt) : uint256(yInt);\\n }\\n\\n // Compute the absolute value (x*y\\u00f7UNIT). The resulting value must fit in SD59x18.\\n uint256 resultAbs = Common.mulDiv18(xAbs, yAbs);\\n if (resultAbs > uint256(uMAX_SD59x18)) {\\n revert Errors.PRBMath_SD59x18_Mul_Overflow(x, y);\\n }\\n\\n // Check if x and y have the same sign using two's complement representation. The left-most bit represents the sign (1 for\\n // negative, 0 for positive or zero).\\n bool sameSign = (xInt ^ yInt) > -1;\\n\\n // If the inputs have the same sign, the result should be positive. Otherwise, it should be negative.\\n unchecked {\\n result = wrap(sameSign ? int256(resultAbs) : -int256(resultAbs));\\n }\\n}\\n\\n/// @notice Raises x to the power of y using the following formula:\\n///\\n/// $$\\n/// x^y = 2^{log_2{x} * y}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {exp2}, {log2}, and {mul}.\\n/// - Returns `UNIT` for 0^0.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {exp2}, {log2}, and {mul}.\\n///\\n/// @param x The base as an SD59x18 number.\\n/// @param y Exponent to raise x to, as an SD59x18 number\\n/// @return result x raised to power y, as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction pow(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n\\n // If both x and y are zero, the result is `UNIT`. If just x is zero, the result is always zero.\\n if (xInt == 0) {\\n return yInt == 0 ? UNIT : ZERO;\\n }\\n // If x is `UNIT`, the result is always `UNIT`.\\n else if (xInt == uUNIT) {\\n return UNIT;\\n }\\n\\n // If y is zero, the result is always `UNIT`.\\n if (yInt == 0) {\\n return UNIT;\\n }\\n // If y is `UNIT`, the result is always x.\\n else if (yInt == uUNIT) {\\n return x;\\n }\\n\\n // Calculate the result using the formula.\\n result = exp2(mul(log2(x), y));\\n}\\n\\n/// @notice Raises x (an SD59x18 number) to the power y (an unsigned basic integer) using the well-known\\n/// algorithm \\\"exponentiation by squaring\\\".\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Exponentiation_by_squaring.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv18}.\\n/// - Returns `UNIT` for 0^0.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {abs} and {Common.mulDiv18}.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The base as an SD59x18 number.\\n/// @param y The exponent as a uint256.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction powu(SD59x18 x, uint256 y) pure returns (SD59x18 result) {\\n uint256 xAbs = uint256(abs(x).unwrap());\\n\\n // Calculate the first iteration of the loop in advance.\\n uint256 resultAbs = y & 1 > 0 ? xAbs : uint256(uUNIT);\\n\\n // Equivalent to `for(y /= 2; y > 0; y /= 2)`.\\n uint256 yAux = y;\\n for (yAux >>= 1; yAux > 0; yAux >>= 1) {\\n xAbs = Common.mulDiv18(xAbs, xAbs);\\n\\n // Equivalent to `y % 2 == 1`.\\n if (yAux & 1 > 0) {\\n resultAbs = Common.mulDiv18(resultAbs, xAbs);\\n }\\n }\\n\\n // The result must fit in SD59x18.\\n if (resultAbs > uint256(uMAX_SD59x18)) {\\n revert Errors.PRBMath_SD59x18_Powu_Overflow(x, y);\\n }\\n\\n unchecked {\\n // Is the base negative and the exponent odd? If yes, the result should be negative.\\n int256 resultInt = int256(resultAbs);\\n bool isNegative = x.unwrap() < 0 && y & 1 == 1;\\n if (isNegative) {\\n resultInt = -resultInt;\\n }\\n result = wrap(resultInt);\\n }\\n}\\n\\n/// @notice Calculates the square root of x using the Babylonian method.\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\\n///\\n/// Notes:\\n/// - Only the positive root is returned.\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x cannot be negative, since complex numbers are not supported.\\n/// - x must be less than `MAX_SD59x18 / UNIT`.\\n///\\n/// @param x The SD59x18 number for which to calculate the square root.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction sqrt(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < 0) {\\n revert Errors.PRBMath_SD59x18_Sqrt_NegativeInput(x);\\n }\\n if (xInt > uMAX_SD59x18 / uUNIT) {\\n revert Errors.PRBMath_SD59x18_Sqrt_Overflow(x);\\n }\\n\\n unchecked {\\n // Multiply x by `UNIT` to account for the factor of `UNIT` picked up when multiplying two SD59x18 numbers.\\n // In this case, the two numbers are both the square root.\\n uint256 resultUint = Common.sqrt(uint256(xInt * uUNIT));\\n result = wrap(int256(resultUint));\\n }\\n}\\n\",\"keccak256\":\"0xa074831139fc89ca0e5a36086b30eb50896bb6770cd5823461b1f2769017d2f0\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\nimport \\\"./Helpers.sol\\\" as Helpers;\\nimport \\\"./Math.sol\\\" as Math;\\n\\n/// @notice The signed 59.18-decimal fixed-point number representation, which can have up to 59 digits and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\\n/// type int256.\\ntype SD59x18 is int256;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoInt256,\\n Casting.intoSD1x18,\\n Casting.intoUD2x18,\\n Casting.intoUD60x18,\\n Casting.intoUint256,\\n Casting.intoUint128,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for SD59x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n MATHEMATICAL FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Math.abs,\\n Math.avg,\\n Math.ceil,\\n Math.div,\\n Math.exp,\\n Math.exp2,\\n Math.floor,\\n Math.frac,\\n Math.gm,\\n Math.inv,\\n Math.log10,\\n Math.log2,\\n Math.ln,\\n Math.mul,\\n Math.pow,\\n Math.powu,\\n Math.sqrt\\n} for SD59x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n HELPER FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Helpers.add,\\n Helpers.and,\\n Helpers.eq,\\n Helpers.gt,\\n Helpers.gte,\\n Helpers.isZero,\\n Helpers.lshift,\\n Helpers.lt,\\n Helpers.lte,\\n Helpers.mod,\\n Helpers.neq,\\n Helpers.not,\\n Helpers.or,\\n Helpers.rshift,\\n Helpers.sub,\\n Helpers.uncheckedAdd,\\n Helpers.uncheckedSub,\\n Helpers.uncheckedUnary,\\n Helpers.xor\\n} for SD59x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n OPERATORS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes it possible to use these operators on the SD59x18 type.\\nusing {\\n Helpers.add as +,\\n Helpers.and2 as &,\\n Math.div as /,\\n Helpers.eq as ==,\\n Helpers.gt as >,\\n Helpers.gte as >=,\\n Helpers.lt as <,\\n Helpers.lte as <=,\\n Helpers.mod as %,\\n Math.mul as *,\\n Helpers.neq as !=,\\n Helpers.not as ~,\\n Helpers.or as |,\\n Helpers.sub as -,\\n Helpers.unary as -,\\n Helpers.xor as ^\\n} for SD59x18 global;\\n\",\"keccak256\":\"0xe03112d145dcd5863aff24e5f381debaae29d446acd5666f3d640e3d9af738d7\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as Errors;\\nimport { uMAX_SD1x18 } from \\\"../sd1x18/Constants.sol\\\";\\nimport { SD1x18 } from \\\"../sd1x18/ValueType.sol\\\";\\nimport { SD59x18 } from \\\"../sd59x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"../ud60x18/ValueType.sol\\\";\\nimport { UD2x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts a UD2x18 number into SD1x18.\\n/// - x must be less than or equal to `uMAX_SD1x18`.\\nfunction intoSD1x18(UD2x18 x) pure returns (SD1x18 result) {\\n uint64 xUint = UD2x18.unwrap(x);\\n if (xUint > uint64(uMAX_SD1x18)) {\\n revert Errors.PRBMath_UD2x18_IntoSD1x18_Overflow(x);\\n }\\n result = SD1x18.wrap(int64(xUint));\\n}\\n\\n/// @notice Casts a UD2x18 number into SD59x18.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of SD59x18.\\nfunction intoSD59x18(UD2x18 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(int256(uint256(UD2x18.unwrap(x))));\\n}\\n\\n/// @notice Casts a UD2x18 number into UD60x18.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of UD60x18.\\nfunction intoUD60x18(UD2x18 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(UD2x18.unwrap(x));\\n}\\n\\n/// @notice Casts a UD2x18 number into uint128.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of uint128.\\nfunction intoUint128(UD2x18 x) pure returns (uint128 result) {\\n result = uint128(UD2x18.unwrap(x));\\n}\\n\\n/// @notice Casts a UD2x18 number into uint256.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of uint256.\\nfunction intoUint256(UD2x18 x) pure returns (uint256 result) {\\n result = uint256(UD2x18.unwrap(x));\\n}\\n\\n/// @notice Casts a UD2x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(UD2x18 x) pure returns (uint40 result) {\\n uint64 xUint = UD2x18.unwrap(x);\\n if (xUint > uint64(Common.MAX_UINT40)) {\\n revert Errors.PRBMath_UD2x18_IntoUint40_Overflow(x);\\n }\\n result = uint40(xUint);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction ud2x18(uint64 x) pure returns (UD2x18 result) {\\n result = UD2x18.wrap(x);\\n}\\n\\n/// @notice Unwrap a UD2x18 number into uint64.\\nfunction unwrap(UD2x18 x) pure returns (uint64 result) {\\n result = UD2x18.unwrap(x);\\n}\\n\\n/// @notice Wraps a uint64 number into UD2x18.\\nfunction wrap(uint64 x) pure returns (UD2x18 result) {\\n result = UD2x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x9b1a35d432ef951a415fae8098b3c609a99b630a3d5464b3c8e1efa8893eea07\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD2x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @dev Euler's number as a UD2x18 number.\\nUD2x18 constant E = UD2x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum value a UD2x18 number can have.\\nuint64 constant uMAX_UD2x18 = 18_446744073709551615;\\nUD2x18 constant MAX_UD2x18 = UD2x18.wrap(uMAX_UD2x18);\\n\\n/// @dev PI as a UD2x18 number.\\nUD2x18 constant PI = UD2x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of UD2x18.\\nUD2x18 constant UNIT = UD2x18.wrap(1e18);\\nuint64 constant uUNIT = 1e18;\\n\",\"keccak256\":\"0x29b0e050c865899e1fb9022b460a7829cdee248c44c4299f068ba80695eec3fc\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD2x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when trying to cast a UD2x18 number that doesn't fit in SD1x18.\\nerror PRBMath_UD2x18_IntoSD1x18_Overflow(UD2x18 x);\\n\\n/// @notice Thrown when trying to cast a UD2x18 number that doesn't fit in uint40.\\nerror PRBMath_UD2x18_IntoUint40_Overflow(UD2x18 x);\\n\",\"keccak256\":\"0xdf1e22f0b4c8032bcc8b7f63fe3984e1387f3dc7b2e9ab381822249f75376d33\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\n\\n/// @notice The unsigned 2.18-decimal fixed-point number representation, which can have up to 2 digits and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\\n/// type uint64. This is useful when end users want to use uint64 to save gas, e.g. with tight variable packing in contract\\n/// storage.\\ntype UD2x18 is uint64;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoSD1x18,\\n Casting.intoSD59x18,\\n Casting.intoUD60x18,\\n Casting.intoUint256,\\n Casting.intoUint128,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for UD2x18 global;\\n\",\"keccak256\":\"0x2802edc9869db116a0b5c490cc5f8554742f747183fa30ac5e9c80bb967e61a1\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Errors.sol\\\" as CastingErrors;\\nimport { MAX_UINT128, MAX_UINT40 } from \\\"../Common.sol\\\";\\nimport { uMAX_SD1x18 } from \\\"../sd1x18/Constants.sol\\\";\\nimport { SD1x18 } from \\\"../sd1x18/ValueType.sol\\\";\\nimport { uMAX_SD59x18 } from \\\"../sd59x18/Constants.sol\\\";\\nimport { SD59x18 } from \\\"../sd59x18/ValueType.sol\\\";\\nimport { uMAX_UD2x18 } from \\\"../ud2x18/Constants.sol\\\";\\nimport { UD2x18 } from \\\"../ud2x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts a UD60x18 number into SD1x18.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `uMAX_SD1x18`.\\nfunction intoSD1x18(UD60x18 x) pure returns (SD1x18 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > uint256(int256(uMAX_SD1x18))) {\\n revert CastingErrors.PRBMath_UD60x18_IntoSD1x18_Overflow(x);\\n }\\n result = SD1x18.wrap(int64(uint64(xUint)));\\n}\\n\\n/// @notice Casts a UD60x18 number into UD2x18.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `uMAX_UD2x18`.\\nfunction intoUD2x18(UD60x18 x) pure returns (UD2x18 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > uMAX_UD2x18) {\\n revert CastingErrors.PRBMath_UD60x18_IntoUD2x18_Overflow(x);\\n }\\n result = UD2x18.wrap(uint64(xUint));\\n}\\n\\n/// @notice Casts a UD60x18 number into SD59x18.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `uMAX_SD59x18`.\\nfunction intoSD59x18(UD60x18 x) pure returns (SD59x18 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > uint256(uMAX_SD59x18)) {\\n revert CastingErrors.PRBMath_UD60x18_IntoSD59x18_Overflow(x);\\n }\\n result = SD59x18.wrap(int256(xUint));\\n}\\n\\n/// @notice Casts a UD60x18 number into uint128.\\n/// @dev This is basically an alias for {unwrap}.\\nfunction intoUint256(UD60x18 x) pure returns (uint256 result) {\\n result = UD60x18.unwrap(x);\\n}\\n\\n/// @notice Casts a UD60x18 number into uint128.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UINT128`.\\nfunction intoUint128(UD60x18 x) pure returns (uint128 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > MAX_UINT128) {\\n revert CastingErrors.PRBMath_UD60x18_IntoUint128_Overflow(x);\\n }\\n result = uint128(xUint);\\n}\\n\\n/// @notice Casts a UD60x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(UD60x18 x) pure returns (uint40 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > MAX_UINT40) {\\n revert CastingErrors.PRBMath_UD60x18_IntoUint40_Overflow(x);\\n }\\n result = uint40(xUint);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction ud(uint256 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(x);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction ud60x18(uint256 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(x);\\n}\\n\\n/// @notice Unwraps a UD60x18 number into uint256.\\nfunction unwrap(UD60x18 x) pure returns (uint256 result) {\\n result = UD60x18.unwrap(x);\\n}\\n\\n/// @notice Wraps a uint256 number into the UD60x18 value type.\\nfunction wrap(uint256 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x5bb532da36921cbdac64d1f16de5d366ef1f664502e3b7c07d0ad06917551f85\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n// NOTICE: the \\\"u\\\" prefix stands for \\\"unwrapped\\\".\\n\\n/// @dev Euler's number as a UD60x18 number.\\nUD60x18 constant E = UD60x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum input permitted in {exp}.\\nuint256 constant uEXP_MAX_INPUT = 133_084258667509499440;\\nUD60x18 constant EXP_MAX_INPUT = UD60x18.wrap(uEXP_MAX_INPUT);\\n\\n/// @dev The maximum input permitted in {exp2}.\\nuint256 constant uEXP2_MAX_INPUT = 192e18 - 1;\\nUD60x18 constant EXP2_MAX_INPUT = UD60x18.wrap(uEXP2_MAX_INPUT);\\n\\n/// @dev Half the UNIT number.\\nuint256 constant uHALF_UNIT = 0.5e18;\\nUD60x18 constant HALF_UNIT = UD60x18.wrap(uHALF_UNIT);\\n\\n/// @dev $log_2(10)$ as a UD60x18 number.\\nuint256 constant uLOG2_10 = 3_321928094887362347;\\nUD60x18 constant LOG2_10 = UD60x18.wrap(uLOG2_10);\\n\\n/// @dev $log_2(e)$ as a UD60x18 number.\\nuint256 constant uLOG2_E = 1_442695040888963407;\\nUD60x18 constant LOG2_E = UD60x18.wrap(uLOG2_E);\\n\\n/// @dev The maximum value a UD60x18 number can have.\\nuint256 constant uMAX_UD60x18 = 115792089237316195423570985008687907853269984665640564039457_584007913129639935;\\nUD60x18 constant MAX_UD60x18 = UD60x18.wrap(uMAX_UD60x18);\\n\\n/// @dev The maximum whole value a UD60x18 number can have.\\nuint256 constant uMAX_WHOLE_UD60x18 = 115792089237316195423570985008687907853269984665640564039457_000000000000000000;\\nUD60x18 constant MAX_WHOLE_UD60x18 = UD60x18.wrap(uMAX_WHOLE_UD60x18);\\n\\n/// @dev PI as a UD60x18 number.\\nUD60x18 constant PI = UD60x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of UD60x18.\\nuint256 constant uUNIT = 1e18;\\nUD60x18 constant UNIT = UD60x18.wrap(uUNIT);\\n\\n/// @dev The unit number squared.\\nuint256 constant uUNIT_SQUARED = 1e36;\\nUD60x18 constant UNIT_SQUARED = UD60x18.wrap(uUNIT_SQUARED);\\n\\n/// @dev Zero as a UD60x18 number.\\nUD60x18 constant ZERO = UD60x18.wrap(0);\\n\",\"keccak256\":\"0x2b80d26153d3fdcfb3a9ca772d9309d31ed1275f5b8b54c3ffb54d3652b37d90\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Conversions.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { uMAX_UD60x18, uUNIT } from \\\"./Constants.sol\\\";\\nimport { PRBMath_UD60x18_Convert_Overflow } from \\\"./Errors.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Converts a UD60x18 number to a simple integer by dividing it by `UNIT`.\\n/// @dev The result is rounded toward zero.\\n/// @param x The UD60x18 number to convert.\\n/// @return result The same number in basic integer form.\\nfunction convert(UD60x18 x) pure returns (uint256 result) {\\n result = UD60x18.unwrap(x) / uUNIT;\\n}\\n\\n/// @notice Converts a simple integer to UD60x18 by multiplying it by `UNIT`.\\n///\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UD60x18 / UNIT`.\\n///\\n/// @param x The basic integer to convert.\\n/// @param result The same number converted to UD60x18.\\nfunction convert(uint256 x) pure returns (UD60x18 result) {\\n if (x > uMAX_UD60x18 / uUNIT) {\\n revert PRBMath_UD60x18_Convert_Overflow(x);\\n }\\n unchecked {\\n result = UD60x18.wrap(x * uUNIT);\\n }\\n}\\n\",\"keccak256\":\"0xaf7fc2523413822de3b66ba339fe2884fb3b8c6f6cf38ec90a2c3e3aae71df6b\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when ceiling a number overflows UD60x18.\\nerror PRBMath_UD60x18_Ceil_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when converting a basic integer to the fixed-point format overflows UD60x18.\\nerror PRBMath_UD60x18_Convert_Overflow(uint256 x);\\n\\n/// @notice Thrown when taking the natural exponent of a base greater than 133_084258667509499441.\\nerror PRBMath_UD60x18_Exp_InputTooBig(UD60x18 x);\\n\\n/// @notice Thrown when taking the binary exponent of a base greater than 192e18.\\nerror PRBMath_UD60x18_Exp2_InputTooBig(UD60x18 x);\\n\\n/// @notice Thrown when taking the geometric mean of two numbers and multiplying them overflows UD60x18.\\nerror PRBMath_UD60x18_Gm_Overflow(UD60x18 x, UD60x18 y);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\\nerror PRBMath_UD60x18_IntoSD1x18_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD59x18.\\nerror PRBMath_UD60x18_IntoSD59x18_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\\nerror PRBMath_UD60x18_IntoUD2x18_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\\nerror PRBMath_UD60x18_IntoUint128_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\\nerror PRBMath_UD60x18_IntoUint40_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when taking the logarithm of a number less than 1.\\nerror PRBMath_UD60x18_Log_InputTooSmall(UD60x18 x);\\n\\n/// @notice Thrown when calculating the square root overflows UD60x18.\\nerror PRBMath_UD60x18_Sqrt_Overflow(UD60x18 x);\\n\",\"keccak256\":\"0xa8c60d4066248df22c49c882873efbc017344107edabc48c52209abbc39cb1e3\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Helpers.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { wrap } from \\\"./Casting.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Implements the checked addition operation (+) in the UD60x18 type.\\nfunction add(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() + y.unwrap());\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the UD60x18 type.\\nfunction and(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() & bits);\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the UD60x18 type.\\nfunction and2(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() & y.unwrap());\\n}\\n\\n/// @notice Implements the equal operation (==) in the UD60x18 type.\\nfunction eq(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() == y.unwrap();\\n}\\n\\n/// @notice Implements the greater than operation (>) in the UD60x18 type.\\nfunction gt(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() > y.unwrap();\\n}\\n\\n/// @notice Implements the greater than or equal to operation (>=) in the UD60x18 type.\\nfunction gte(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() >= y.unwrap();\\n}\\n\\n/// @notice Implements a zero comparison check function in the UD60x18 type.\\nfunction isZero(UD60x18 x) pure returns (bool result) {\\n // This wouldn't work if x could be negative.\\n result = x.unwrap() == 0;\\n}\\n\\n/// @notice Implements the left shift operation (<<) in the UD60x18 type.\\nfunction lshift(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() << bits);\\n}\\n\\n/// @notice Implements the lower than operation (<) in the UD60x18 type.\\nfunction lt(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() < y.unwrap();\\n}\\n\\n/// @notice Implements the lower than or equal to operation (<=) in the UD60x18 type.\\nfunction lte(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() <= y.unwrap();\\n}\\n\\n/// @notice Implements the checked modulo operation (%) in the UD60x18 type.\\nfunction mod(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() % y.unwrap());\\n}\\n\\n/// @notice Implements the not equal operation (!=) in the UD60x18 type.\\nfunction neq(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() != y.unwrap();\\n}\\n\\n/// @notice Implements the NOT (~) bitwise operation in the UD60x18 type.\\nfunction not(UD60x18 x) pure returns (UD60x18 result) {\\n result = wrap(~x.unwrap());\\n}\\n\\n/// @notice Implements the OR (|) bitwise operation in the UD60x18 type.\\nfunction or(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() | y.unwrap());\\n}\\n\\n/// @notice Implements the right shift operation (>>) in the UD60x18 type.\\nfunction rshift(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() >> bits);\\n}\\n\\n/// @notice Implements the checked subtraction operation (-) in the UD60x18 type.\\nfunction sub(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() - y.unwrap());\\n}\\n\\n/// @notice Implements the unchecked addition operation (+) in the UD60x18 type.\\nfunction uncheckedAdd(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() + y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the unchecked subtraction operation (-) in the UD60x18 type.\\nfunction uncheckedSub(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() - y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the XOR (^) bitwise operation in the UD60x18 type.\\nfunction xor(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() ^ y.unwrap());\\n}\\n\",\"keccak256\":\"0xf5faff881391d2c060029499a666cc5f0bea90a213150bb476fae8f02a5df268\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as Errors;\\nimport { wrap } from \\\"./Casting.sol\\\";\\nimport {\\n uEXP_MAX_INPUT,\\n uEXP2_MAX_INPUT,\\n uHALF_UNIT,\\n uLOG2_10,\\n uLOG2_E,\\n uMAX_UD60x18,\\n uMAX_WHOLE_UD60x18,\\n UNIT,\\n uUNIT,\\n uUNIT_SQUARED,\\n ZERO\\n} from \\\"./Constants.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n MATHEMATICAL FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @notice Calculates the arithmetic average of x and y using the following formula:\\n///\\n/// $$\\n/// avg(x, y) = (x & y) + ((xUint ^ yUint) / 2)\\n/// $$\\n///\\n/// In English, this is what this formula does:\\n///\\n/// 1. AND x and y.\\n/// 2. Calculate half of XOR x and y.\\n/// 3. Add the two results together.\\n///\\n/// This technique is known as SWAR, which stands for \\\"SIMD within a register\\\". You can read more about it here:\\n/// https://devblogs.microsoft.com/oldnewthing/20220207-00/?p=106223\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// @param x The first operand as a UD60x18 number.\\n/// @param y The second operand as a UD60x18 number.\\n/// @return result The arithmetic average as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction avg(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n uint256 yUint = y.unwrap();\\n unchecked {\\n result = wrap((xUint & yUint) + ((xUint ^ yUint) >> 1));\\n }\\n}\\n\\n/// @notice Yields the smallest whole number greater than or equal to x.\\n///\\n/// @dev This is optimized for fractional value inputs, because for every whole value there are (1e18 - 1) fractional\\n/// counterparts. See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n///\\n/// Requirements:\\n/// - x must be less than or equal to `MAX_WHOLE_UD60x18`.\\n///\\n/// @param x The UD60x18 number to ceil.\\n/// @param result The smallest whole number greater than or equal to x, as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ceil(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n if (xUint > uMAX_WHOLE_UD60x18) {\\n revert Errors.PRBMath_UD60x18_Ceil_Overflow(x);\\n }\\n\\n assembly (\\\"memory-safe\\\") {\\n // Equivalent to `x % UNIT`.\\n let remainder := mod(x, uUNIT)\\n\\n // Equivalent to `UNIT - remainder`.\\n let delta := sub(uUNIT, remainder)\\n\\n // Equivalent to `x + remainder > 0 ? delta : 0`.\\n result := add(x, mul(delta, gt(remainder, 0)))\\n }\\n}\\n\\n/// @notice Divides two UD60x18 numbers, returning a new UD60x18 number.\\n///\\n/// @dev Uses {Common.mulDiv} to enable overflow-safe multiplication and division.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv}.\\n///\\n/// @param x The numerator as a UD60x18 number.\\n/// @param y The denominator as a UD60x18 number.\\n/// @param result The quotient as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction div(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(Common.mulDiv(x.unwrap(), uUNIT, y.unwrap()));\\n}\\n\\n/// @notice Calculates the natural exponent of x using the following formula:\\n///\\n/// $$\\n/// e^x = 2^{x * log_2{e}}\\n/// $$\\n///\\n/// @dev Requirements:\\n/// - x must be less than 133_084258667509499441.\\n///\\n/// @param x The exponent as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n // This check prevents values greater than 192e18 from being passed to {exp2}.\\n if (xUint > uEXP_MAX_INPUT) {\\n revert Errors.PRBMath_UD60x18_Exp_InputTooBig(x);\\n }\\n\\n unchecked {\\n // Inline the fixed-point multiplication to save gas.\\n uint256 doubleUnitProduct = xUint * uLOG2_E;\\n result = exp2(wrap(doubleUnitProduct / uUNIT));\\n }\\n}\\n\\n/// @notice Calculates the binary exponent of x using the binary fraction method.\\n///\\n/// @dev See https://ethereum.stackexchange.com/q/79903/24693\\n///\\n/// Requirements:\\n/// - x must be less than 192e18.\\n/// - The result must fit in UD60x18.\\n///\\n/// @param x The exponent as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp2(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n // Numbers greater than or equal to 192e18 don't fit in the 192.64-bit format.\\n if (xUint > uEXP2_MAX_INPUT) {\\n revert Errors.PRBMath_UD60x18_Exp2_InputTooBig(x);\\n }\\n\\n // Convert x to the 192.64-bit fixed-point format.\\n uint256 x_192x64 = (xUint << 64) / uUNIT;\\n\\n // Pass x to the {Common.exp2} function, which uses the 192.64-bit fixed-point number representation.\\n result = wrap(Common.exp2(x_192x64));\\n}\\n\\n/// @notice Yields the greatest whole number less than or equal to x.\\n/// @dev Optimized for fractional value inputs, because every whole value has (1e18 - 1) fractional counterparts.\\n/// See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n/// @param x The UD60x18 number to floor.\\n/// @param result The greatest whole number less than or equal to x, as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction floor(UD60x18 x) pure returns (UD60x18 result) {\\n assembly (\\\"memory-safe\\\") {\\n // Equivalent to `x % UNIT`.\\n let remainder := mod(x, uUNIT)\\n\\n // Equivalent to `x - remainder > 0 ? remainder : 0)`.\\n result := sub(x, mul(remainder, gt(remainder, 0)))\\n }\\n}\\n\\n/// @notice Yields the excess beyond the floor of x using the odd function definition.\\n/// @dev See https://en.wikipedia.org/wiki/Fractional_part.\\n/// @param x The UD60x18 number to get the fractional part of.\\n/// @param result The fractional part of x as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction frac(UD60x18 x) pure returns (UD60x18 result) {\\n assembly (\\\"memory-safe\\\") {\\n result := mod(x, uUNIT)\\n }\\n}\\n\\n/// @notice Calculates the geometric mean of x and y, i.e. $\\\\sqrt{x * y}$, rounding down.\\n///\\n/// @dev Requirements:\\n/// - x * y must fit in UD60x18.\\n///\\n/// @param x The first operand as a UD60x18 number.\\n/// @param y The second operand as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction gm(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n uint256 yUint = y.unwrap();\\n if (xUint == 0 || yUint == 0) {\\n return ZERO;\\n }\\n\\n unchecked {\\n // Checking for overflow this way is faster than letting Solidity do it.\\n uint256 xyUint = xUint * yUint;\\n if (xyUint / xUint != yUint) {\\n revert Errors.PRBMath_UD60x18_Gm_Overflow(x, y);\\n }\\n\\n // We don't need to multiply the result by `UNIT` here because the x*y product picked up a factor of `UNIT`\\n // during multiplication. See the comments in {Common.sqrt}.\\n result = wrap(Common.sqrt(xyUint));\\n }\\n}\\n\\n/// @notice Calculates the inverse of x.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x must not be zero.\\n///\\n/// @param x The UD60x18 number for which to calculate the inverse.\\n/// @return result The inverse as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction inv(UD60x18 x) pure returns (UD60x18 result) {\\n unchecked {\\n result = wrap(uUNIT_SQUARED / x.unwrap());\\n }\\n}\\n\\n/// @notice Calculates the natural logarithm of x using the following formula:\\n///\\n/// $$\\n/// ln{x} = log_2{x} / log_2{e}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n/// - The precision isn't sufficiently fine-grained to return exactly `UNIT` when the input is `E`.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The UD60x18 number for which to calculate the natural logarithm.\\n/// @return result The natural logarithm as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ln(UD60x18 x) pure returns (UD60x18 result) {\\n unchecked {\\n // Inline the fixed-point multiplication to save gas. This is overflow-safe because the maximum value that\\n // {log2} can return is ~196_205294292027477728.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_E);\\n }\\n}\\n\\n/// @notice Calculates the common logarithm of x using the following formula:\\n///\\n/// $$\\n/// log_{10}{x} = log_2{x} / log_2{10}\\n/// $$\\n///\\n/// However, if x is an exact power of ten, a hard coded value is returned.\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The UD60x18 number for which to calculate the common logarithm.\\n/// @return result The common logarithm as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log10(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n if (xUint < uUNIT) {\\n revert Errors.PRBMath_UD60x18_Log_InputTooSmall(x);\\n }\\n\\n // Note that the `mul` in this assembly block is the standard multiplication operation, not {UD60x18.mul}.\\n // prettier-ignore\\n assembly (\\\"memory-safe\\\") {\\n switch x\\n case 1 { result := mul(uUNIT, sub(0, 18)) }\\n case 10 { result := mul(uUNIT, sub(1, 18)) }\\n case 100 { result := mul(uUNIT, sub(2, 18)) }\\n case 1000 { result := mul(uUNIT, sub(3, 18)) }\\n case 10000 { result := mul(uUNIT, sub(4, 18)) }\\n case 100000 { result := mul(uUNIT, sub(5, 18)) }\\n case 1000000 { result := mul(uUNIT, sub(6, 18)) }\\n case 10000000 { result := mul(uUNIT, sub(7, 18)) }\\n case 100000000 { result := mul(uUNIT, sub(8, 18)) }\\n case 1000000000 { result := mul(uUNIT, sub(9, 18)) }\\n case 10000000000 { result := mul(uUNIT, sub(10, 18)) }\\n case 100000000000 { result := mul(uUNIT, sub(11, 18)) }\\n case 1000000000000 { result := mul(uUNIT, sub(12, 18)) }\\n case 10000000000000 { result := mul(uUNIT, sub(13, 18)) }\\n case 100000000000000 { result := mul(uUNIT, sub(14, 18)) }\\n case 1000000000000000 { result := mul(uUNIT, sub(15, 18)) }\\n case 10000000000000000 { result := mul(uUNIT, sub(16, 18)) }\\n case 100000000000000000 { result := mul(uUNIT, sub(17, 18)) }\\n case 1000000000000000000 { result := 0 }\\n case 10000000000000000000 { result := uUNIT }\\n case 100000000000000000000 { result := mul(uUNIT, 2) }\\n case 1000000000000000000000 { result := mul(uUNIT, 3) }\\n case 10000000000000000000000 { result := mul(uUNIT, 4) }\\n case 100000000000000000000000 { result := mul(uUNIT, 5) }\\n case 1000000000000000000000000 { result := mul(uUNIT, 6) }\\n case 10000000000000000000000000 { result := mul(uUNIT, 7) }\\n case 100000000000000000000000000 { result := mul(uUNIT, 8) }\\n case 1000000000000000000000000000 { result := mul(uUNIT, 9) }\\n case 10000000000000000000000000000 { result := mul(uUNIT, 10) }\\n case 100000000000000000000000000000 { result := mul(uUNIT, 11) }\\n case 1000000000000000000000000000000 { result := mul(uUNIT, 12) }\\n case 10000000000000000000000000000000 { result := mul(uUNIT, 13) }\\n case 100000000000000000000000000000000 { result := mul(uUNIT, 14) }\\n case 1000000000000000000000000000000000 { result := mul(uUNIT, 15) }\\n case 10000000000000000000000000000000000 { result := mul(uUNIT, 16) }\\n case 100000000000000000000000000000000000 { result := mul(uUNIT, 17) }\\n case 1000000000000000000000000000000000000 { result := mul(uUNIT, 18) }\\n case 10000000000000000000000000000000000000 { result := mul(uUNIT, 19) }\\n case 100000000000000000000000000000000000000 { result := mul(uUNIT, 20) }\\n case 1000000000000000000000000000000000000000 { result := mul(uUNIT, 21) }\\n case 10000000000000000000000000000000000000000 { result := mul(uUNIT, 22) }\\n case 100000000000000000000000000000000000000000 { result := mul(uUNIT, 23) }\\n case 1000000000000000000000000000000000000000000 { result := mul(uUNIT, 24) }\\n case 10000000000000000000000000000000000000000000 { result := mul(uUNIT, 25) }\\n case 100000000000000000000000000000000000000000000 { result := mul(uUNIT, 26) }\\n case 1000000000000000000000000000000000000000000000 { result := mul(uUNIT, 27) }\\n case 10000000000000000000000000000000000000000000000 { result := mul(uUNIT, 28) }\\n case 100000000000000000000000000000000000000000000000 { result := mul(uUNIT, 29) }\\n case 1000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 30) }\\n case 10000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 31) }\\n case 100000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 32) }\\n case 1000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 33) }\\n case 10000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 34) }\\n case 100000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 35) }\\n case 1000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 36) }\\n case 10000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 37) }\\n case 100000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 38) }\\n case 1000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 39) }\\n case 10000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 40) }\\n case 100000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 41) }\\n case 1000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 42) }\\n case 10000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 43) }\\n case 100000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 44) }\\n case 1000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 45) }\\n case 10000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 46) }\\n case 100000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 47) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 48) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 49) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 50) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 51) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 52) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 53) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 54) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 55) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 56) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 57) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 58) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 59) }\\n default { result := uMAX_UD60x18 }\\n }\\n\\n if (result.unwrap() == uMAX_UD60x18) {\\n unchecked {\\n // Inline the fixed-point division to save gas.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_10);\\n }\\n }\\n}\\n\\n/// @notice Calculates the binary logarithm of x using the iterative approximation algorithm:\\n///\\n/// $$\\n/// log_2{x} = n + log_2{y}, \\\\text{ where } y = x*2^{-n}, \\\\ y \\\\in [1, 2)\\n/// $$\\n///\\n/// For $0 \\\\leq x \\\\lt 1$, the input is inverted:\\n///\\n/// $$\\n/// log_2{x} = -log_2{\\\\frac{1}{x}}\\n/// $$\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Binary_logarithm#Iterative_approximation\\n///\\n/// Notes:\\n/// - Due to the lossy precision of the iterative approximation, the results are not perfectly accurate to the last decimal.\\n///\\n/// Requirements:\\n/// - x must be greater than zero.\\n///\\n/// @param x The UD60x18 number for which to calculate the binary logarithm.\\n/// @return result The binary logarithm as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log2(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n if (xUint < uUNIT) {\\n revert Errors.PRBMath_UD60x18_Log_InputTooSmall(x);\\n }\\n\\n unchecked {\\n // Calculate the integer part of the logarithm.\\n uint256 n = Common.msb(xUint / uUNIT);\\n\\n // This is the integer part of the logarithm as a UD60x18 number. The operation can't overflow because n\\n // n is at most 255 and UNIT is 1e18.\\n uint256 resultUint = n * uUNIT;\\n\\n // Calculate $y = x * 2^{-n}$.\\n uint256 y = xUint >> n;\\n\\n // If y is the unit number, the fractional part is zero.\\n if (y == uUNIT) {\\n return wrap(resultUint);\\n }\\n\\n // Calculate the fractional part via the iterative approximation.\\n // The `delta >>= 1` part is equivalent to `delta /= 2`, but shifting bits is more gas efficient.\\n uint256 DOUBLE_UNIT = 2e18;\\n for (uint256 delta = uHALF_UNIT; delta > 0; delta >>= 1) {\\n y = (y * y) / uUNIT;\\n\\n // Is y^2 >= 2e18 and so in the range [2e18, 4e18)?\\n if (y >= DOUBLE_UNIT) {\\n // Add the 2^{-m} factor to the logarithm.\\n resultUint += delta;\\n\\n // Halve y, which corresponds to z/2 in the Wikipedia article.\\n y >>= 1;\\n }\\n }\\n result = wrap(resultUint);\\n }\\n}\\n\\n/// @notice Multiplies two UD60x18 numbers together, returning a new UD60x18 number.\\n///\\n/// @dev Uses {Common.mulDiv} to enable overflow-safe multiplication and division.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv}.\\n///\\n/// @dev See the documentation in {Common.mulDiv18}.\\n/// @param x The multiplicand as a UD60x18 number.\\n/// @param y The multiplier as a UD60x18 number.\\n/// @return result The product as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mul(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(Common.mulDiv18(x.unwrap(), y.unwrap()));\\n}\\n\\n/// @notice Raises x to the power of y.\\n///\\n/// For $1 \\\\leq x \\\\leq \\\\infty$, the following standard formula is used:\\n///\\n/// $$\\n/// x^y = 2^{log_2{x} * y}\\n/// $$\\n///\\n/// For $0 \\\\leq x \\\\lt 1$, since the unsigned {log2} is undefined, an equivalent formula is used:\\n///\\n/// $$\\n/// i = \\\\frac{1}{x}\\n/// w = 2^{log_2{i} * y}\\n/// x^y = \\\\frac{1}{w}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2} and {mul}.\\n/// - Returns `UNIT` for 0^0.\\n/// - It may not perform well with very small values of x. Consider using SD59x18 as an alternative.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {exp2}, {log2}, and {mul}.\\n///\\n/// @param x The base as a UD60x18 number.\\n/// @param y The exponent as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction pow(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n uint256 yUint = y.unwrap();\\n\\n // If both x and y are zero, the result is `UNIT`. If just x is zero, the result is always zero.\\n if (xUint == 0) {\\n return yUint == 0 ? UNIT : ZERO;\\n }\\n // If x is `UNIT`, the result is always `UNIT`.\\n else if (xUint == uUNIT) {\\n return UNIT;\\n }\\n\\n // If y is zero, the result is always `UNIT`.\\n if (yUint == 0) {\\n return UNIT;\\n }\\n // If y is `UNIT`, the result is always x.\\n else if (yUint == uUNIT) {\\n return x;\\n }\\n\\n // If x is greater than `UNIT`, use the standard formula.\\n if (xUint > uUNIT) {\\n result = exp2(mul(log2(x), y));\\n }\\n // Conversely, if x is less than `UNIT`, use the equivalent formula.\\n else {\\n UD60x18 i = wrap(uUNIT_SQUARED / xUint);\\n UD60x18 w = exp2(mul(log2(i), y));\\n result = wrap(uUNIT_SQUARED / w.unwrap());\\n }\\n}\\n\\n/// @notice Raises x (a UD60x18 number) to the power y (an unsigned basic integer) using the well-known\\n/// algorithm \\\"exponentiation by squaring\\\".\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Exponentiation_by_squaring.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv18}.\\n/// - Returns `UNIT` for 0^0.\\n///\\n/// Requirements:\\n/// - The result must fit in UD60x18.\\n///\\n/// @param x The base as a UD60x18 number.\\n/// @param y The exponent as a uint256.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction powu(UD60x18 x, uint256 y) pure returns (UD60x18 result) {\\n // Calculate the first iteration of the loop in advance.\\n uint256 xUint = x.unwrap();\\n uint256 resultUint = y & 1 > 0 ? xUint : uUNIT;\\n\\n // Equivalent to `for(y /= 2; y > 0; y /= 2)`.\\n for (y >>= 1; y > 0; y >>= 1) {\\n xUint = Common.mulDiv18(xUint, xUint);\\n\\n // Equivalent to `y % 2 == 1`.\\n if (y & 1 > 0) {\\n resultUint = Common.mulDiv18(resultUint, xUint);\\n }\\n }\\n result = wrap(resultUint);\\n}\\n\\n/// @notice Calculates the square root of x using the Babylonian method.\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\\n///\\n/// Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x must be less than `MAX_UD60x18 / UNIT`.\\n///\\n/// @param x The UD60x18 number for which to calculate the square root.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction sqrt(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n unchecked {\\n if (xUint > uMAX_UD60x18 / uUNIT) {\\n revert Errors.PRBMath_UD60x18_Sqrt_Overflow(x);\\n }\\n // Multiply x by `UNIT` to account for the factor of `UNIT` picked up when multiplying two UD60x18 numbers.\\n // In this case, the two numbers are both the square root.\\n result = wrap(Common.sqrt(xUint * uUNIT));\\n }\\n}\\n\",\"keccak256\":\"0x462144667aac3f96d5f8dba7aa68fe4c5a3f61e1d7bbbc81bee21168817f9c09\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\nimport \\\"./Helpers.sol\\\" as Helpers;\\nimport \\\"./Math.sol\\\" as Math;\\n\\n/// @notice The unsigned 60.18-decimal fixed-point number representation, which can have up to 60 digits and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the Solidity type uint256.\\n/// @dev The value type is defined here so it can be imported in all other files.\\ntype UD60x18 is uint256;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoSD1x18,\\n Casting.intoUD2x18,\\n Casting.intoSD59x18,\\n Casting.intoUint128,\\n Casting.intoUint256,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for UD60x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n MATHEMATICAL FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes the functions in this library callable on the UD60x18 type.\\nusing {\\n Math.avg,\\n Math.ceil,\\n Math.div,\\n Math.exp,\\n Math.exp2,\\n Math.floor,\\n Math.frac,\\n Math.gm,\\n Math.inv,\\n Math.ln,\\n Math.log10,\\n Math.log2,\\n Math.mul,\\n Math.pow,\\n Math.powu,\\n Math.sqrt\\n} for UD60x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n HELPER FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes the functions in this library callable on the UD60x18 type.\\nusing {\\n Helpers.add,\\n Helpers.and,\\n Helpers.eq,\\n Helpers.gt,\\n Helpers.gte,\\n Helpers.isZero,\\n Helpers.lshift,\\n Helpers.lt,\\n Helpers.lte,\\n Helpers.mod,\\n Helpers.neq,\\n Helpers.not,\\n Helpers.or,\\n Helpers.rshift,\\n Helpers.sub,\\n Helpers.uncheckedAdd,\\n Helpers.uncheckedSub,\\n Helpers.xor\\n} for UD60x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n OPERATORS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes it possible to use these operators on the UD60x18 type.\\nusing {\\n Helpers.add as +,\\n Helpers.and2 as &,\\n Math.div as /,\\n Helpers.eq as ==,\\n Helpers.gt as >,\\n Helpers.gte as >=,\\n Helpers.lt as <,\\n Helpers.lte as <=,\\n Helpers.or as |,\\n Helpers.mod as %,\\n Math.mul as *,\\n Helpers.neq as !=,\\n Helpers.not as ~,\\n Helpers.sub as -,\\n Helpers.xor as ^\\n} for UD60x18 global;\\n\",\"keccak256\":\"0xdd873b5124180d9b71498b3a7fe93b1c08c368bec741f7d5f8e17f78a0b70f31\",\"license\":\"MIT\"},\"contracts/interfaces/IERC6551Registry.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\ninterface IERC6551Registry {\\n /**\\n * @dev Creates a token bound account for a non-fungible token.\\n *\\n * If account has already been created, returns the account address without calling create2.\\n *\\n * Emits ERC6551AccountCreated event.\\n *\\n * @return account The address of the token bound account\\n */\\n function createAccount(\\n address implementation,\\n bytes32 salt,\\n uint256 chainId,\\n address tokenContract,\\n uint256 tokenId\\n ) external returns (address account);\\n}\\n\",\"keccak256\":\"0x64c52de8a8e68398e61dd8b42dda8e9af8cf6abf93bb85629c322440991ea568\",\"license\":\"MIT\"},\"contracts/interfaces/hats/HatsErrors.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface HatsErrors {\\n /// @notice Emitted when `user` is attempting to perform an action on `hatId` but is not wearing one of `hatId`'s admin hats\\n /// @dev Can be equivalent to `NotHatWearer(buildHatId(hatId))`, such as when emitted by `approveLinkTopHatToTree` or `relinkTopHatToTree`\\n error NotAdmin(address user, uint256 hatId);\\n\\n /// @notice Emitted when attempting to perform an action as or for an account that is not a wearer of a given hat\\n error NotHatWearer();\\n\\n /// @notice Emitted when attempting to perform an action that requires being either an admin or wearer of a given hat\\n error NotAdminOrWearer();\\n\\n /// @notice Emitted when attempting to mint `hatId` but `hatId`'s maxSupply has been reached\\n error AllHatsWorn(uint256 hatId);\\n\\n /// @notice Emitted when attempting to create a hat with a level 14 hat as its admin\\n error MaxLevelsReached();\\n\\n /// @notice Emitted when an attempted hat id has empty intermediate level(s)\\n error InvalidHatId();\\n\\n /// @notice Emitted when attempting to mint `hatId` to a `wearer` who is already wearing the hat\\n error AlreadyWearingHat(address wearer, uint256 hatId);\\n\\n /// @notice Emitted when attempting to mint a non-existant hat\\n error HatDoesNotExist(uint256 hatId);\\n\\n /// @notice Emmitted when attempting to mint or transfer a hat that is not active\\n error HatNotActive();\\n\\n /// @notice Emitted when attempting to mint or transfer a hat to an ineligible wearer\\n error NotEligible();\\n\\n /// @notice Emitted when attempting to check or set a hat's status from an account that is not that hat's toggle module\\n error NotHatsToggle();\\n\\n /// @notice Emitted when attempting to check or set a hat wearer's status from an account that is not that hat's eligibility module\\n error NotHatsEligibility();\\n\\n /// @notice Emitted when array arguments to a batch function have mismatching lengths\\n error BatchArrayLengthMismatch();\\n\\n /// @notice Emitted when attempting to mutate or transfer an immutable hat\\n error Immutable();\\n\\n /// @notice Emitted when attempting to change a hat's maxSupply to a value lower than its current supply\\n error NewMaxSupplyTooLow();\\n\\n /// @notice Emitted when attempting to link a tophat to a new admin for which the tophat serves as an admin\\n error CircularLinkage();\\n\\n /// @notice Emitted when attempting to link or relink a tophat to a separate tree\\n error CrossTreeLinkage();\\n\\n /// @notice Emitted when attempting to link a tophat without a request\\n error LinkageNotRequested();\\n\\n /// @notice Emitted when attempting to unlink a tophat that does not have a wearer\\n /// @dev This ensures that unlinking never results in a bricked tophat\\n error InvalidUnlink();\\n\\n /// @notice Emmited when attempting to change a hat's eligibility or toggle module to the zero address\\n error ZeroAddress();\\n\\n /// @notice Emmitted when attempting to change a hat's details or imageURI to a string with over 7000 bytes (~characters)\\n /// @dev This protects against a DOS attack where an admin iteratively extend's a hat's details or imageURI\\n /// to be so long that reading it exceeds the block gas limit, breaking `uri()` and `viewHat()`\\n error StringTooLong();\\n}\\n\",\"keccak256\":\"0x81b0056b7bed86eabc07c0e4a9655c586ddb8e6c128320593669b76efd5a08de\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/HatsEvents.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface HatsEvents {\\n /// @notice Emitted when a new hat is created\\n /// @param id The id for the new hat\\n /// @param details A description of the Hat\\n /// @param maxSupply The total instances of the Hat that can be worn at once\\n /// @param eligibility The address that can report on the Hat wearer's status\\n /// @param toggle The address that can deactivate the Hat\\n /// @param mutable_ Whether the hat's properties are changeable after creation\\n /// @param imageURI The image uri for this hat and the fallback for its\\n event HatCreated(\\n uint256 id,\\n string details,\\n uint32 maxSupply,\\n address eligibility,\\n address toggle,\\n bool mutable_,\\n string imageURI\\n );\\n\\n /// @notice Emitted when a hat wearer's standing is updated\\n /// @dev Eligibility is excluded since the source of truth for eligibility is the eligibility module and may change without a transaction\\n /// @param hatId The id of the wearer's hat\\n /// @param wearer The wearer's address\\n /// @param wearerStanding Whether the wearer is in good standing for the hat\\n event WearerStandingChanged(\\n uint256 hatId,\\n address wearer,\\n bool wearerStanding\\n );\\n\\n /// @notice Emitted when a hat's status is updated\\n /// @param hatId The id of the hat\\n /// @param newStatus Whether the hat is active\\n event HatStatusChanged(uint256 hatId, bool newStatus);\\n\\n /// @notice Emitted when a hat's details are updated\\n /// @param hatId The id of the hat\\n /// @param newDetails The updated details\\n event HatDetailsChanged(uint256 hatId, string newDetails);\\n\\n /// @notice Emitted when a hat's eligibility module is updated\\n /// @param hatId The id of the hat\\n /// @param newEligibility The updated eligibiliy module\\n event HatEligibilityChanged(uint256 hatId, address newEligibility);\\n\\n /// @notice Emitted when a hat's toggle module is updated\\n /// @param hatId The id of the hat\\n /// @param newToggle The updated toggle module\\n event HatToggleChanged(uint256 hatId, address newToggle);\\n\\n /// @notice Emitted when a hat's mutability is updated\\n /// @param hatId The id of the hat\\n event HatMutabilityChanged(uint256 hatId);\\n\\n /// @notice Emitted when a hat's maximum supply is updated\\n /// @param hatId The id of the hat\\n /// @param newMaxSupply The updated max supply\\n event HatMaxSupplyChanged(uint256 hatId, uint32 newMaxSupply);\\n\\n /// @notice Emitted when a hat's image URI is updated\\n /// @param hatId The id of the hat\\n /// @param newImageURI The updated image URI\\n event HatImageURIChanged(uint256 hatId, string newImageURI);\\n\\n /// @notice Emitted when a tophat linkage is requested by its admin\\n /// @param domain The domain of the tree tophat to link\\n /// @param newAdmin The tophat's would-be admin in the parent tree\\n event TopHatLinkRequested(uint32 domain, uint256 newAdmin);\\n\\n /// @notice Emitted when a tophat is linked to a another tree\\n /// @param domain The domain of the newly-linked tophat\\n /// @param newAdmin The tophat's new admin in the parent tree\\n event TopHatLinked(uint32 domain, uint256 newAdmin);\\n}\\n\",\"keccak256\":\"0x53413397d15e1636c3cd7bd667656b79bc2886785403b824bcd4ed122667f2c6\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/IHats.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\nimport \\\"./IHatsIdUtilities.sol\\\";\\nimport \\\"./HatsErrors.sol\\\";\\nimport \\\"./HatsEvents.sol\\\";\\n\\ninterface IHats is IHatsIdUtilities, HatsErrors, HatsEvents {\\n function mintTopHat(\\n address _target,\\n string memory _details,\\n string memory _imageURI\\n ) external returns (uint256 topHatId);\\n\\n function createHat(\\n uint256 _admin,\\n string calldata _details,\\n uint32 _maxSupply,\\n address _eligibility,\\n address _toggle,\\n bool _mutable,\\n string calldata _imageURI\\n ) external returns (uint256 newHatId);\\n\\n function batchCreateHats(\\n uint256[] calldata _admins,\\n string[] calldata _details,\\n uint32[] calldata _maxSupplies,\\n address[] memory _eligibilityModules,\\n address[] memory _toggleModules,\\n bool[] calldata _mutables,\\n string[] calldata _imageURIs\\n ) external returns (bool success);\\n\\n function getNextId(uint256 _admin) external view returns (uint256 nextId);\\n\\n function mintHat(\\n uint256 _hatId,\\n address _wearer\\n ) external returns (bool success);\\n\\n function batchMintHats(\\n uint256[] calldata _hatIds,\\n address[] calldata _wearers\\n ) external returns (bool success);\\n\\n function setHatStatus(\\n uint256 _hatId,\\n bool _newStatus\\n ) external returns (bool toggled);\\n\\n function checkHatStatus(uint256 _hatId) external returns (bool toggled);\\n\\n function setHatWearerStatus(\\n uint256 _hatId,\\n address _wearer,\\n bool _eligible,\\n bool _standing\\n ) external returns (bool updated);\\n\\n function checkHatWearerStatus(\\n uint256 _hatId,\\n address _wearer\\n ) external returns (bool updated);\\n\\n function renounceHat(uint256 _hatId) external;\\n\\n function transferHat(uint256 _hatId, address _from, address _to) external;\\n\\n /*//////////////////////////////////////////////////////////////\\n HATS ADMIN FUNCTIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n function makeHatImmutable(uint256 _hatId) external;\\n\\n function changeHatDetails(\\n uint256 _hatId,\\n string memory _newDetails\\n ) external;\\n\\n function changeHatEligibility(\\n uint256 _hatId,\\n address _newEligibility\\n ) external;\\n\\n function changeHatToggle(uint256 _hatId, address _newToggle) external;\\n\\n function changeHatImageURI(\\n uint256 _hatId,\\n string memory _newImageURI\\n ) external;\\n\\n function changeHatMaxSupply(uint256 _hatId, uint32 _newMaxSupply) external;\\n\\n function requestLinkTopHatToTree(\\n uint32 _topHatId,\\n uint256 _newAdminHat\\n ) external;\\n\\n function approveLinkTopHatToTree(\\n uint32 _topHatId,\\n uint256 _newAdminHat,\\n address _eligibility,\\n address _toggle,\\n string calldata _details,\\n string calldata _imageURI\\n ) external;\\n\\n function unlinkTopHatFromTree(uint32 _topHatId, address _wearer) external;\\n\\n function relinkTopHatWithinTree(\\n uint32 _topHatDomain,\\n uint256 _newAdminHat,\\n address _eligibility,\\n address _toggle,\\n string calldata _details,\\n string calldata _imageURI\\n ) external;\\n\\n /*//////////////////////////////////////////////////////////////\\n VIEW FUNCTIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n function viewHat(\\n uint256 _hatId\\n )\\n external\\n view\\n returns (\\n string memory details,\\n uint32 maxSupply,\\n uint32 supply,\\n address eligibility,\\n address toggle,\\n string memory imageURI,\\n uint16 lastHatId,\\n bool mutable_,\\n bool active\\n );\\n\\n function isWearerOfHat(\\n address _user,\\n uint256 _hatId\\n ) external view returns (bool isWearer);\\n\\n function isAdminOfHat(\\n address _user,\\n uint256 _hatId\\n ) external view returns (bool isAdmin);\\n\\n function isInGoodStanding(\\n address _wearer,\\n uint256 _hatId\\n ) external view returns (bool standing);\\n\\n function isEligible(\\n address _wearer,\\n uint256 _hatId\\n ) external view returns (bool eligible);\\n\\n function getHatEligibilityModule(\\n uint256 _hatId\\n ) external view returns (address eligibility);\\n\\n function getHatToggleModule(\\n uint256 _hatId\\n ) external view returns (address toggle);\\n\\n function getHatMaxSupply(\\n uint256 _hatId\\n ) external view returns (uint32 maxSupply);\\n\\n function hatSupply(uint256 _hatId) external view returns (uint32 supply);\\n\\n function getImageURIForHat(\\n uint256 _hatId\\n ) external view returns (string memory _uri);\\n\\n function balanceOf(\\n address wearer,\\n uint256 hatId\\n ) external view returns (uint256 balance);\\n\\n function balanceOfBatch(\\n address[] calldata _wearers,\\n uint256[] calldata _hatIds\\n ) external view returns (uint256[] memory);\\n\\n function uri(uint256 id) external view returns (string memory _uri);\\n}\\n\",\"keccak256\":\"0x2867004bddc5148fa1937f25c0403e5d9977583aaf50fdbdb74bd463f64f21c8\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/IHatsIdUtilities.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface IHatsIdUtilities {\\n function buildHatId(\\n uint256 _admin,\\n uint16 _newHat\\n ) external pure returns (uint256 id);\\n\\n function getHatLevel(uint256 _hatId) external view returns (uint32 level);\\n\\n function getLocalHatLevel(\\n uint256 _hatId\\n ) external pure returns (uint32 level);\\n\\n function isTopHat(uint256 _hatId) external view returns (bool _topHat);\\n\\n function isLocalTopHat(\\n uint256 _hatId\\n ) external pure returns (bool _localTopHat);\\n\\n function isValidHatId(\\n uint256 _hatId\\n ) external view returns (bool validHatId);\\n\\n function getAdminAtLevel(\\n uint256 _hatId,\\n uint32 _level\\n ) external view returns (uint256 admin);\\n\\n function getAdminAtLocalLevel(\\n uint256 _hatId,\\n uint32 _level\\n ) external pure returns (uint256 admin);\\n\\n function getTopHatDomain(\\n uint256 _hatId\\n ) external view returns (uint32 domain);\\n\\n function getTippyTopHatDomain(\\n uint32 _topHatDomain\\n ) external view returns (uint32 domain);\\n\\n function noCircularLinkage(\\n uint32 _topHatDomain,\\n uint256 _linkedAdmin\\n ) external view returns (bool notCircular);\\n\\n function sameTippyTopHatDomain(\\n uint32 _topHatDomain,\\n uint256 _newAdminHat\\n ) external view returns (bool sameDomain);\\n}\\n\",\"keccak256\":\"0x007fcc07b20bf84bacad1f9a2ddf4e30e1a8be961e144b7bef8e98a51781aee9\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/IHatsModuleFactory.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.19;\\n\\ninterface IHatsModuleFactory {\\n error HatsModuleFactory_ModuleAlreadyDeployed(\\n address implementation,\\n uint256 hatId,\\n bytes otherImmutableArgs,\\n uint256 saltNonce\\n );\\n\\n error BatchArrayLengthMismatch();\\n\\n event HatsModuleFactory_ModuleDeployed(\\n address implementation,\\n address instance,\\n uint256 hatId,\\n bytes otherImmutableArgs,\\n bytes initData,\\n uint256 saltNonce\\n );\\n\\n function HATS() external view returns (address);\\n\\n function version() external view returns (string memory);\\n\\n function createHatsModule(\\n address _implementation,\\n uint256 _hatId,\\n bytes calldata _otherImmutableArgs,\\n bytes calldata _initData,\\n uint256 _saltNonce\\n ) external returns (address _instance);\\n\\n function batchCreateHatsModule(\\n address[] calldata _implementations,\\n uint256[] calldata _hatIds,\\n bytes[] calldata _otherImmutableArgsArray,\\n bytes[] calldata _initDataArray,\\n uint256[] calldata _saltNonces\\n ) external returns (bool success);\\n\\n function getHatsModuleAddress(\\n address _implementation,\\n uint256 _hatId,\\n bytes calldata _otherImmutableArgs,\\n uint256 _saltNonce\\n ) external view returns (address);\\n\\n function deployed(\\n address _implementation,\\n uint256 _hatId,\\n bytes calldata _otherImmutableArgs,\\n uint256 _saltNonce\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x861faf40785cedb829243116d492653414a367853408a5c27d201522f6c3bfdd\",\"license\":\"MIT\"},\"contracts/interfaces/sablier/IAdminable.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\n/// @title IAdminable\\n/// @notice Contract module that provides a basic access control mechanism, with an admin that can be\\n/// granted exclusive access to specific functions. The inheriting contract must set the initial admin\\n/// in the constructor.\\ninterface IAdminable {\\n /*//////////////////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Emitted when the admin is transferred.\\n /// @param oldAdmin The address of the old admin.\\n /// @param newAdmin The address of the new admin.\\n event TransferAdmin(address indexed oldAdmin, address indexed newAdmin);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice The address of the admin account or contract.\\n function admin() external view returns (address);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n NON-CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Transfers the contract admin to a new address.\\n ///\\n /// @dev Notes:\\n /// - Does not revert if the admin is the same.\\n /// - This function can potentially leave the contract without an admin, thereby removing any\\n /// functionality that is only available to the admin.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the contract admin.\\n ///\\n /// @param newAdmin The address of the new admin.\\n function transferAdmin(address newAdmin) external;\\n}\\n\",\"keccak256\":\"0xa279c49e51228b571329164e36250e82b2c1378e8b549194ab7dd90fca9c3b2b\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/IERC4096.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 \\\"@openzeppelin/contracts/interfaces/IERC165.sol\\\";\\nimport {IERC721} from \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\n\\n/// @title ERC-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\",\"keccak256\":\"0xa34b9c52cbe36be860244f52256f1b05badf0cb797d208664b87337610d0e82d\",\"license\":\"MIT\"},\"contracts/interfaces/sablier/ISablierV2Lockup.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC4906} from \\\"./IERC4096.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IERC721Metadata} from \\\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\\\";\\nimport {UD60x18} from \\\"@prb/math/src/UD60x18.sol\\\";\\n\\nimport {Lockup} from \\\"./types/DataTypes.sol\\\";\\nimport {IAdminable} from \\\"./IAdminable.sol\\\";\\nimport {ISablierV2NFTDescriptor} from \\\"./ISablierV2NFTDescriptor.sol\\\";\\n\\n/// @title ISablierV2Lockup\\n/// @notice Common logic between all Sablier V2 Lockup contracts.\\ninterface ISablierV2Lockup is\\n IAdminable, // 0 inherited components\\n IERC4906, // 2 inherited components\\n IERC721Metadata // 2 inherited components\\n{\\n /*//////////////////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Emitted when the admin allows a new recipient contract to hook to Sablier.\\n /// @param admin The address of the current contract admin.\\n /// @param recipient The address of the recipient contract put on the allowlist.\\n event AllowToHook(address indexed admin, address recipient);\\n\\n /// @notice Emitted when a stream is canceled.\\n /// @param streamId The ID of the stream.\\n /// @param sender The address of the stream's sender.\\n /// @param recipient The address of the stream's recipient.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param senderAmount The amount of assets refunded to the stream's sender, denoted in units of the asset's\\n /// decimals.\\n /// @param recipientAmount The amount of assets left for the stream's recipient to withdraw, denoted in units of the\\n /// asset's decimals.\\n event CancelLockupStream(\\n uint256 streamId,\\n address indexed sender,\\n address indexed recipient,\\n IERC20 indexed asset,\\n uint128 senderAmount,\\n uint128 recipientAmount\\n );\\n\\n /// @notice Emitted when a sender gives up the right to cancel a stream.\\n /// @param streamId The ID of the stream.\\n event RenounceLockupStream(uint256 indexed streamId);\\n\\n /// @notice Emitted when the admin sets a new NFT descriptor contract.\\n /// @param admin The address of the current contract admin.\\n /// @param oldNFTDescriptor The address of the old NFT descriptor contract.\\n /// @param newNFTDescriptor The address of the new NFT descriptor contract.\\n event SetNFTDescriptor(\\n address indexed admin,\\n ISablierV2NFTDescriptor oldNFTDescriptor,\\n ISablierV2NFTDescriptor newNFTDescriptor\\n );\\n\\n /// @notice Emitted when assets are withdrawn from a stream.\\n /// @param streamId The ID of the stream.\\n /// @param to The address that has received the withdrawn assets.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param amount The amount of assets withdrawn, denoted in units of the asset's decimals.\\n event WithdrawFromLockupStream(\\n uint256 indexed streamId,\\n address indexed to,\\n IERC20 indexed asset,\\n uint128 amount\\n );\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Retrieves the address of the ERC-20 asset to be distributed.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getAsset(uint256 streamId) external view returns (IERC20 asset);\\n\\n /// @notice Retrieves the amount deposited in the stream, denoted in units of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getDepositedAmount(\\n uint256 streamId\\n ) external view returns (uint128 depositedAmount);\\n\\n /// @notice Retrieves the stream's end time, which is a Unix timestamp.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getEndTime(\\n uint256 streamId\\n ) external view returns (uint40 endTime);\\n\\n /// @notice Retrieves the stream's recipient.\\n /// @dev Reverts if the NFT has been burned.\\n /// @param streamId The stream ID for the query.\\n function getRecipient(\\n uint256 streamId\\n ) external view returns (address recipient);\\n\\n /// @notice Retrieves the amount refunded to the sender after a cancellation, denoted in units of the asset's\\n /// decimals. This amount is always zero unless the stream was canceled.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getRefundedAmount(\\n uint256 streamId\\n ) external view returns (uint128 refundedAmount);\\n\\n /// @notice Retrieves the stream's sender.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getSender(uint256 streamId) external view returns (address sender);\\n\\n /// @notice Retrieves the stream's start time, which is a Unix timestamp.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getStartTime(\\n uint256 streamId\\n ) external view returns (uint40 startTime);\\n\\n /// @notice Retrieves the amount withdrawn from the stream, denoted in units of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getWithdrawnAmount(\\n uint256 streamId\\n ) external view returns (uint128 withdrawnAmount);\\n\\n /// @notice Retrieves a flag indicating whether the provided address is a contract allowed to hook to Sablier\\n /// when a stream is canceled or when assets are withdrawn.\\n /// @dev See {ISablierLockupRecipient} for more information.\\n function isAllowedToHook(\\n address recipient\\n ) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream can be canceled. When the stream is cold, this\\n /// flag is always `false`.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isCancelable(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream is cold, i.e. settled, canceled, or depleted.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isCold(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream is depleted.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isDepleted(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream exists.\\n /// @dev Does not revert if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isStream(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream NFT can be transferred.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isTransferable(\\n uint256 streamId\\n ) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream is warm, i.e. either pending or streaming.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isWarm(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves the maximum broker fee that can be charged by the broker, denoted as a fixed-point\\n /// number where 1e18 is 100%.\\n /// @dev This value is hard coded as a constant.\\n function MAX_BROKER_FEE() external view returns (UD60x18);\\n\\n /// @notice Counter for stream IDs, used in the create functions.\\n function nextStreamId() external view returns (uint256);\\n\\n /// @notice Contract that generates the non-fungible token URI.\\n function nftDescriptor() external view returns (ISablierV2NFTDescriptor);\\n\\n /// @notice Calculates the amount that the sender would be refunded if the stream were canceled, denoted in units\\n /// of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function refundableAmountOf(\\n uint256 streamId\\n ) external view returns (uint128 refundableAmount);\\n\\n /// @notice Retrieves the stream's status.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function statusOf(\\n uint256 streamId\\n ) external view returns (Lockup.Status status);\\n\\n /// @notice Calculates the amount streamed to the recipient, denoted in units of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n ///\\n /// Notes:\\n /// - Upon cancellation of the stream, the amount streamed is calculated as the difference between the deposited\\n /// amount and the refunded amount. Ultimately, when the stream becomes depleted, the streamed amount is equivalent\\n /// to the total amount withdrawn.\\n ///\\n /// @param streamId The stream ID for the query.\\n function streamedAmountOf(\\n uint256 streamId\\n ) external view returns (uint128 streamedAmount);\\n\\n /// @notice Retrieves a flag indicating whether the stream was canceled.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function wasCanceled(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Calculates the amount that the recipient can withdraw from the stream, denoted in units of the asset's\\n /// decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function withdrawableAmountOf(\\n uint256 streamId\\n ) external view returns (uint128 withdrawableAmount);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n NON-CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Allows a recipient contract to hook to Sablier when a stream is canceled or when assets are withdrawn.\\n /// Useful for implementing contracts that hold streams on behalf of users, such as vaults or staking contracts.\\n ///\\n /// @dev Emits an {AllowToHook} event.\\n ///\\n /// Notes:\\n /// - Does not revert if the contract is already on the allowlist.\\n /// - This is an irreversible operation. The contract cannot be removed from the allowlist.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the contract admin.\\n /// - `recipient` must have a non-zero code size.\\n /// - `recipient` must implement {ISablierLockupRecipient}.\\n ///\\n /// @param recipient The address of the contract to allow for hooks.\\n function allowToHook(address recipient) external;\\n\\n /// @notice Burns the NFT associated with the stream.\\n ///\\n /// @dev Emits a {Transfer} event.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `streamId` must reference a depleted stream.\\n /// - The NFT must exist.\\n /// - `msg.sender` must be either the NFT owner or an approved third party.\\n ///\\n /// @param streamId The ID of the stream NFT to burn.\\n function burn(uint256 streamId) external;\\n\\n /// @notice Cancels the stream and refunds any remaining assets to the sender.\\n ///\\n /// @dev Emits a {Transfer}, {CancelLockupStream}, and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - If there any assets left for the recipient to withdraw, the stream is marked as canceled. Otherwise, the\\n /// stream is marked as depleted.\\n /// - This function attempts to invoke a hook on the recipient, if the resolved address is a contract.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - The stream must be warm and cancelable.\\n /// - `msg.sender` must be the stream's sender.\\n ///\\n /// @param streamId The ID of the stream to cancel.\\n function cancel(uint256 streamId) external;\\n\\n /// @notice Cancels multiple streams and refunds any remaining assets to the sender.\\n ///\\n /// @dev Emits multiple {Transfer}, {CancelLockupStream}, and {MetadataUpdate} events.\\n ///\\n /// Notes:\\n /// - Refer to the notes in {cancel}.\\n ///\\n /// Requirements:\\n /// - All requirements from {cancel} must be met for each stream.\\n ///\\n /// @param streamIds The IDs of the streams to cancel.\\n function cancelMultiple(uint256[] calldata streamIds) external;\\n\\n /// @notice Removes the right of the stream's sender to cancel the stream.\\n ///\\n /// @dev Emits a {RenounceLockupStream} and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - This is an irreversible operation.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `streamId` must reference a warm stream.\\n /// - `msg.sender` must be the stream's sender.\\n /// - The stream must be cancelable.\\n ///\\n /// @param streamId The ID of the stream to renounce.\\n function renounce(uint256 streamId) external;\\n\\n /// @notice Sets a new NFT descriptor contract, which produces the URI describing the Sablier stream NFTs.\\n ///\\n /// @dev Emits a {SetNFTDescriptor} and {BatchMetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - Does not revert if the NFT descriptor is the same.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the contract admin.\\n ///\\n /// @param newNFTDescriptor The address of the new NFT descriptor contract.\\n function setNFTDescriptor(\\n ISablierV2NFTDescriptor newNFTDescriptor\\n ) external;\\n\\n /// @notice Withdraws the provided amount of assets from the stream to the `to` address.\\n ///\\n /// @dev Emits a {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - This function attempts to call a hook on the recipient of the stream, unless `msg.sender` is the recipient.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `streamId` must not reference a null or depleted stream.\\n /// - `to` must not be the zero address.\\n /// - `amount` must be greater than zero and must not exceed the withdrawable amount.\\n /// - `to` must be the recipient if `msg.sender` is not the stream's recipient or an approved third party.\\n ///\\n /// @param streamId The ID of the stream to withdraw from.\\n /// @param to The address receiving the withdrawn assets.\\n /// @param amount The amount to withdraw, denoted in units of the asset's decimals.\\n function withdraw(uint256 streamId, address to, uint128 amount) external;\\n\\n /// @notice Withdraws the maximum withdrawable amount from the stream to the provided address `to`.\\n ///\\n /// @dev Emits a {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - Refer to the notes in {withdraw}.\\n ///\\n /// Requirements:\\n /// - Refer to the requirements in {withdraw}.\\n ///\\n /// @param streamId The ID of the stream to withdraw from.\\n /// @param to The address receiving the withdrawn assets.\\n /// @return withdrawnAmount The amount withdrawn, denoted in units of the asset's decimals.\\n function withdrawMax(\\n uint256 streamId,\\n address to\\n ) external returns (uint128 withdrawnAmount);\\n\\n /// @notice Withdraws the maximum withdrawable amount from the stream to the current recipient, and transfers the\\n /// NFT to `newRecipient`.\\n ///\\n /// @dev Emits a {WithdrawFromLockupStream} and a {Transfer} event.\\n ///\\n /// Notes:\\n /// - If the withdrawable amount is zero, the withdrawal is skipped.\\n /// - Refer to the notes in {withdraw}.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the stream's recipient.\\n /// - Refer to the requirements in {withdraw}.\\n /// - Refer to the requirements in {IERC721.transferFrom}.\\n ///\\n /// @param streamId The ID of the stream NFT to transfer.\\n /// @param newRecipient The address of the new owner of the stream NFT.\\n /// @return withdrawnAmount The amount withdrawn, denoted in units of the asset's decimals.\\n function withdrawMaxAndTransfer(\\n uint256 streamId,\\n address newRecipient\\n ) external returns (uint128 withdrawnAmount);\\n\\n /// @notice Withdraws assets from streams to the recipient of each stream.\\n ///\\n /// @dev Emits multiple {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} events.\\n ///\\n /// Notes:\\n /// - This function attempts to call a hook on the recipient of each stream, unless `msg.sender` is the recipient.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - There must be an equal number of `streamIds` and `amounts`.\\n /// - Each stream ID in the array must not reference a null or depleted stream.\\n /// - Each amount in the array must be greater than zero and must not exceed the withdrawable amount.\\n ///\\n /// @param streamIds The IDs of the streams to withdraw from.\\n /// @param amounts The amounts to withdraw, denoted in units of the asset's decimals.\\n function withdrawMultiple(\\n uint256[] calldata streamIds,\\n uint128[] calldata amounts\\n ) external;\\n}\\n\",\"keccak256\":\"0x3e5541c38a901637bd310965deb5bbde73ef07fe4ee3c752cbec330c6b9d62a3\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/ISablierV2LockupLinear.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\nimport {Lockup, LockupLinear} from \\\"./types/DataTypes.sol\\\";\\nimport {ISablierV2Lockup} from \\\"./ISablierV2Lockup.sol\\\";\\n\\n/// @title ISablierV2LockupLinear\\n/// @notice Creates and manages Lockup streams with a linear distribution function.\\ninterface ISablierV2LockupLinear is ISablierV2Lockup {\\n /*//////////////////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Emitted when a stream is created.\\n /// @param streamId The ID of the newly created stream.\\n /// @param funder The address which funded the stream.\\n /// @param sender The address distributing the assets, which will have the ability to cancel the stream.\\n /// @param recipient The address receiving the assets.\\n /// @param amounts Struct encapsulating (i) the deposit amount, and (ii) the broker fee amount, both denoted\\n /// in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Boolean indicating whether the stream will be cancelable or not.\\n /// @param transferable Boolean indicating whether the stream NFT is transferable or not.\\n /// @param timestamps Struct encapsulating (i) the stream's start time, (ii) cliff time, and (iii) end time, all as\\n /// Unix timestamps.\\n /// @param broker The address of the broker who has helped create the stream, e.g. a front-end website.\\n event CreateLockupLinearStream(\\n uint256 streamId,\\n address funder,\\n address indexed sender,\\n address indexed recipient,\\n Lockup.CreateAmounts amounts,\\n IERC20 indexed asset,\\n bool cancelable,\\n bool transferable,\\n LockupLinear.Timestamps timestamps,\\n address broker\\n );\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Retrieves the stream's cliff time, which is a Unix timestamp. A value of zero means there\\n /// is no cliff.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getCliffTime(\\n uint256 streamId\\n ) external view returns (uint40 cliffTime);\\n\\n /// @notice Retrieves the full stream details.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n /// @return stream See the documentation in {DataTypes}.\\n function getStream(\\n uint256 streamId\\n ) external view returns (LockupLinear.StreamLL memory stream);\\n\\n /// @notice Retrieves the stream's start, cliff and end timestamps.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n /// @return timestamps See the documentation in {DataTypes}.\\n function getTimestamps(\\n uint256 streamId\\n ) external view returns (LockupLinear.Timestamps memory timestamps);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n NON-CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Creates a stream by setting the start time to `block.timestamp`, and the end time to\\n /// the sum of `block.timestamp` and `params.durations.total`. The stream is funded by `msg.sender` and is wrapped\\n /// in an ERC-721 NFT.\\n ///\\n /// @dev Emits a {Transfer} and {CreateLockupLinearStream} event.\\n ///\\n /// Requirements:\\n /// - All requirements in {createWithTimestamps} must be met for the calculated parameters.\\n ///\\n /// @param params Struct encapsulating the function parameters, which are documented in {DataTypes}.\\n /// @return streamId The ID of the newly created stream.\\n function createWithDurations(\\n LockupLinear.CreateWithDurations calldata params\\n ) external returns (uint256 streamId);\\n\\n /// @notice Creates a stream with the provided start time and end time. The stream is funded by `msg.sender` and is\\n /// wrapped in an ERC-721 NFT.\\n ///\\n /// @dev Emits a {Transfer} and {CreateLockupLinearStream} event.\\n ///\\n /// Notes:\\n /// - A cliff time of zero means there is no cliff.\\n /// - As long as the times are ordered, it is not an error for the start or the cliff time to be in the past.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `params.totalAmount` must be greater than zero.\\n /// - If set, `params.broker.fee` must not be greater than `MAX_BROKER_FEE`.\\n /// - `params.timestamps.start` must be greater than zero and less than `params.timestamps.end`.\\n /// - If set, `params.timestamps.cliff` must be greater than `params.timestamps.start` and less than\\n /// `params.timestamps.end`.\\n /// - `params.timestamps.end` must be in the future.\\n /// - `params.recipient` must not be the zero address.\\n /// - `msg.sender` must have allowed this contract to spend at least `params.totalAmount` assets.\\n ///\\n /// @param params Struct encapsulating the function parameters, which are documented in {DataTypes}.\\n /// @return streamId The ID of the newly created stream.\\n function createWithTimestamps(\\n LockupLinear.CreateWithTimestamps calldata params\\n ) external returns (uint256 streamId);\\n}\\n\",\"keccak256\":\"0x064264723114b1f1cf3953fd79874dfcbb42cf313857aee6d5e6b09a23e0010b\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/ISablierV2NFTDescriptor.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC721Metadata} from \\\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\\\";\\n\\n/// @title ISablierV2NFTDescriptor\\n/// @notice This contract generates the URI describing the Sablier V2 stream NFTs.\\n/// @dev Inspired by Uniswap V3 Positions NFTs.\\ninterface ISablierV2NFTDescriptor {\\n /// @notice Produces the URI describing a particular stream NFT.\\n /// @dev This is a data URI with the JSON contents directly inlined.\\n /// @param sablier The address of the Sablier contract the stream was created in.\\n /// @param streamId The ID of the stream for which to produce a description.\\n /// @return uri The URI of the ERC721-compliant metadata.\\n function tokenURI(\\n IERC721Metadata sablier,\\n uint256 streamId\\n ) external view returns (string memory uri);\\n}\\n\",\"keccak256\":\"0x4ed430e553d14161e93efdaaacd1a502f49b38969c9d714b45d2e682a74fa0bc\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/types/DataTypes.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {UD2x18} from \\\"@prb/math/src/UD2x18.sol\\\";\\nimport {UD60x18} from \\\"@prb/math/src/UD60x18.sol\\\";\\n\\n// DataTypes.sol\\n//\\n// This file defines all structs used in V2 Core, most of which are organized under three namespaces:\\n//\\n// - Lockup\\n// - LockupDynamic\\n// - LockupLinear\\n// - LockupTranched\\n//\\n// You will notice that some structs contain \\\"slot\\\" annotations - they are used to indicate the\\n// storage layout of the struct. It is more gas efficient to group small data types together so\\n// that they fit in a single 32-byte slot.\\n\\n/// @notice Struct encapsulating the broker parameters passed to the create functions. Both can be set to zero.\\n/// @param account The address receiving the broker's fee.\\n/// @param fee The broker's percentage fee from the total amount, denoted as a fixed-point number where 1e18 is 100%.\\nstruct Broker {\\n address account;\\n UD60x18 fee;\\n}\\n\\n/// @notice Namespace for the structs used in both {SablierV2LockupLinear} and {SablierV2LockupDynamic}.\\nlibrary Lockup {\\n /// @notice Struct encapsulating the deposit, withdrawn, and refunded amounts, all denoted in units of the asset's\\n /// decimals.\\n /// @dev Because the deposited and the withdrawn amount are often read together, declaring them in the same slot\\n /// saves gas.\\n /// @param deposited The initial amount deposited in the stream, net of broker fee.\\n /// @param withdrawn The cumulative amount withdrawn from the stream.\\n /// @param refunded The amount refunded to the sender. Unless the stream was canceled, this is always zero.\\n struct Amounts {\\n // slot 0\\n uint128 deposited;\\n uint128 withdrawn;\\n // slot 1\\n uint128 refunded;\\n }\\n\\n /// @notice Struct encapsulating (i) the deposit amount and (ii) the broker fee amount, both denoted in units of the\\n /// asset's decimals.\\n /// @param deposit The amount to deposit in the stream.\\n /// @param brokerFee The broker fee amount.\\n struct CreateAmounts {\\n uint128 deposit;\\n uint128 brokerFee;\\n }\\n\\n /// @notice Enum representing the different statuses of a stream.\\n /// @custom:value0 PENDING Stream created but not started; assets are in a pending state.\\n /// @custom:value1 STREAMING Active stream where assets are currently being streamed.\\n /// @custom:value2 SETTLED All assets have been streamed; recipient is due to withdraw them.\\n /// @custom:value3 CANCELED Canceled stream; remaining assets await recipient's withdrawal.\\n /// @custom:value4 DEPLETED Depleted stream; all assets have been withdrawn and/or refunded.\\n enum Status {\\n PENDING,\\n STREAMING,\\n SETTLED,\\n CANCELED,\\n DEPLETED\\n }\\n\\n /// @notice A common data structure to be stored in all {SablierV2Lockup} models.\\n /// @dev The fields are arranged like this to save gas via tight variable packing.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream.\\n /// @param startTime The Unix timestamp indicating the stream's start.\\n /// @param endTime The Unix timestamp indicating the stream's end.\\n /// @param isCancelable Boolean indicating if the stream is cancelable.\\n /// @param wasCanceled Boolean indicating if the stream was canceled.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param isDepleted Boolean indicating if the stream is depleted.\\n /// @param isStream Boolean indicating if the struct entity exists.\\n /// @param isTransferable Boolean indicating if the stream NFT is transferable.\\n /// @param amounts Struct encapsulating the deposit, withdrawn, and refunded amounts, all denoted in units of the\\n /// asset's decimals.\\n struct Stream {\\n // slot 0\\n address sender;\\n uint40 startTime;\\n uint40 endTime;\\n bool isCancelable;\\n bool wasCanceled;\\n // slot 1\\n IERC20 asset;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n // slot 2 and 3\\n Lockup.Amounts amounts;\\n }\\n}\\n\\n/// @notice Namespace for the structs used in {SablierV2LockupDynamic}.\\nlibrary LockupDynamic {\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupDynamic.createWithDurations} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param segments Segments with durations used to compose the dynamic distribution function. Timestamps are\\n /// calculated by starting from `block.timestamp` and adding each duration to the previous timestamp.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithDurations {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n SegmentWithDuration[] segments;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupDynamic.createWithTimestamps} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param startTime The Unix timestamp indicating the stream's start.\\n /// @param segments Segments used to compose the dynamic distribution function.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithTimestamps {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n uint40 startTime;\\n Segment[] segments;\\n Broker broker;\\n }\\n\\n /// @notice Segment struct used in the Lockup Dynamic stream.\\n /// @param amount The amount of assets to be streamed in the segment, denoted in units of the asset's decimals.\\n /// @param exponent The exponent of the segment, denoted as a fixed-point number.\\n /// @param timestamp The Unix timestamp indicating the segment's end.\\n struct Segment {\\n // slot 0\\n uint128 amount;\\n UD2x18 exponent;\\n uint40 timestamp;\\n }\\n\\n /// @notice Segment struct used at runtime in {SablierV2LockupDynamic.createWithDurations}.\\n /// @param amount The amount of assets to be streamed in the segment, denoted in units of the asset's decimals.\\n /// @param exponent The exponent of the segment, denoted as a fixed-point number.\\n /// @param duration The time difference in seconds between the segment and the previous one.\\n struct SegmentWithDuration {\\n uint128 amount;\\n UD2x18 exponent;\\n uint40 duration;\\n }\\n\\n /// @notice Struct encapsulating the full details of a stream.\\n /// @dev Extends `Lockup.Stream` by including the recipient and the segments.\\n struct StreamLD {\\n address sender;\\n address recipient;\\n uint40 startTime;\\n uint40 endTime;\\n bool isCancelable;\\n bool wasCanceled;\\n IERC20 asset;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n Lockup.Amounts amounts;\\n Segment[] segments;\\n }\\n\\n /// @notice Struct encapsulating the LockupDynamic timestamps.\\n /// @param start The Unix timestamp indicating the stream's start.\\n /// @param end The Unix timestamp indicating the stream's end.\\n struct Timestamps {\\n uint40 start;\\n uint40 end;\\n }\\n}\\n\\n/// @notice Namespace for the structs used in {SablierV2LockupLinear}.\\nlibrary LockupLinear {\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupLinear.createWithDurations} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param durations Struct encapsulating (i) cliff period duration and (ii) total stream duration, both in seconds.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithDurations {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n Durations durations;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupLinear.createWithTimestamps} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param timestamps Struct encapsulating (i) the stream's start time, (ii) cliff time, and (iii) end time, all as\\n /// Unix timestamps.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithTimestamps {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n Timestamps timestamps;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the cliff duration and the total duration.\\n /// @param cliff The cliff duration in seconds.\\n /// @param total The total duration in seconds.\\n struct Durations {\\n uint40 cliff;\\n uint40 total;\\n }\\n\\n /// @notice Struct encapsulating the full details of a stream.\\n /// @dev Extends `Lockup.Stream` by including the recipient and the cliff time.\\n struct StreamLL {\\n address sender;\\n address recipient;\\n uint40 startTime;\\n bool isCancelable;\\n bool wasCanceled;\\n IERC20 asset;\\n uint40 endTime;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n Lockup.Amounts amounts;\\n uint40 cliffTime;\\n }\\n\\n /// @notice Struct encapsulating the LockupLinear timestamps.\\n /// @param start The Unix timestamp for the stream's start.\\n /// @param cliff The Unix timestamp for the cliff period's end. A value of zero means there is no cliff.\\n /// @param end The Unix timestamp for the stream's end.\\n struct Timestamps {\\n uint40 start;\\n uint40 cliff;\\n uint40 end;\\n }\\n}\\n\\n/// @notice Namespace for the structs used in {SablierV2LockupTranched}.\\nlibrary LockupTranched {\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupTranched.createWithDurations} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param tranches Tranches with durations used to compose the tranched distribution function. Timestamps are\\n /// calculated by starting from `block.timestamp` and adding each duration to the previous timestamp.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithDurations {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n TrancheWithDuration[] tranches;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupTranched.createWithTimestamps} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param startTime The Unix timestamp indicating the stream's start.\\n /// @param tranches Tranches used to compose the tranched distribution function.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithTimestamps {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n uint40 startTime;\\n Tranche[] tranches;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the full details of a stream.\\n /// @dev Extends `Lockup.Stream` by including the recipient and the tranches.\\n struct StreamLT {\\n address sender;\\n address recipient;\\n uint40 startTime;\\n uint40 endTime;\\n bool isCancelable;\\n bool wasCanceled;\\n IERC20 asset;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n Lockup.Amounts amounts;\\n Tranche[] tranches;\\n }\\n\\n /// @notice Struct encapsulating the LockupTranched timestamps.\\n /// @param start The Unix timestamp indicating the stream's start.\\n /// @param end The Unix timestamp indicating the stream's end.\\n struct Timestamps {\\n uint40 start;\\n uint40 end;\\n }\\n\\n /// @notice Tranche struct used in the Lockup Tranched stream.\\n /// @param amount The amount of assets to be unlocked in the tranche, denoted in units of the asset's decimals.\\n /// @param timestamp The Unix timestamp indicating the tranche's end.\\n struct Tranche {\\n // slot 0\\n uint128 amount;\\n uint40 timestamp;\\n }\\n\\n /// @notice Tranche struct used at runtime in {SablierV2LockupTranched.createWithDurations}.\\n /// @param amount The amount of assets to be unlocked in the tranche, denoted in units of the asset's decimals.\\n /// @param duration The time difference in seconds between the tranche and the previous one.\\n struct TrancheWithDuration {\\n uint128 amount;\\n uint40 duration;\\n }\\n}\\n\",\"keccak256\":\"0x727722c0ec71a76a947b935c9dfcac8fd846d6c3547dfbc8739c7109f3b95068\",\"license\":\"GPL-3.0-or-later\"},\"contracts/modules/DecentHatsModificationModule.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.28;\\n\\nimport {DecentHatsModuleUtils} from \\\"./DecentHatsModuleUtils.sol\\\";\\n\\ncontract DecentHatsModificationModule is DecentHatsModuleUtils {\\n /**\\n * @notice Creates a new termed or untermed role hat and any streams on it.\\n *\\n * @notice This contract should be enabled a module on the Safe for which the role is to be created, and disabled after.\\n *\\n * @dev Stream funds on untermed Roles are targeted at the hat's smart account. In order to withdraw funds from the stream, the\\n * hat's smart account must be the one call to `withdraw-` on the Sablier contract, setting the recipient arg to its wearer.\\n *\\n * @dev Stream funds on termed Roles are targeted directly at the nominated wearer.\\n * The wearer should directly call `withdraw-` on the Sablier contract.\\n *\\n * @dev Role hat creation, minting, smart account creation and stream creation are handled here in order\\n * to avoid a race condition where not more than one active proposal to create a new role can exist at a time.\\n * See: https://github.com/decentdao/decent-interface/issues/2402\\n *\\n * @param roleHatsParams An array of params for each role hat to be created.\\n */\\n function createRoleHats(\\n CreateRoleHatsParams calldata roleHatsParams\\n ) external {\\n _processRoleHats(roleHatsParams);\\n }\\n}\\n\",\"keccak256\":\"0x45b9470e000a416382deebea44a8c8734a2d6b453e8c7fbba5ea9bc6fdd4917c\",\"license\":\"MIT\"},\"contracts/modules/DecentHatsModuleUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.28;\\n\\nimport {Enum} from \\\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\\\";\\nimport {IAvatar} from \\\"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IERC6551Registry} from \\\"../interfaces/IERC6551Registry.sol\\\";\\nimport {IHats} from \\\"../interfaces/hats/IHats.sol\\\";\\nimport {LockupLinear, Broker} from \\\"../interfaces/sablier/types/DataTypes.sol\\\";\\nimport {IHatsModuleFactory} from \\\"../interfaces/hats/IHatsModuleFactory.sol\\\";\\nimport {ISablierV2LockupLinear} from \\\"../interfaces/sablier/ISablierV2LockupLinear.sol\\\";\\n\\nabstract contract DecentHatsModuleUtils {\\n bytes32 public constant SALT =\\n 0x5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b5072;\\n\\n struct SablierStreamParams {\\n ISablierV2LockupLinear sablier;\\n address sender;\\n address asset;\\n LockupLinear.Timestamps timestamps;\\n Broker broker;\\n uint128 totalAmount;\\n bool cancelable;\\n bool transferable;\\n }\\n\\n struct HatParams {\\n address wearer;\\n string details;\\n string imageURI;\\n SablierStreamParams[] sablierStreamsParams;\\n uint128 termEndDateTs; // If 0, this is an untermed Hat\\n uint32 maxSupply;\\n bool isMutable;\\n }\\n\\n struct CreateRoleHatsParams {\\n IHats hatsProtocol;\\n IERC6551Registry erc6551Registry;\\n address hatsAccountImplementation;\\n uint256 topHatId;\\n address topHatAccount;\\n IHatsModuleFactory hatsModuleFactory;\\n address hatsElectionsEligibilityImplementation;\\n uint256 adminHatId;\\n HatParams[] hats;\\n }\\n\\n function _processRoleHats(\\n CreateRoleHatsParams memory roleHatsParams\\n ) internal {\\n for (uint256 i = 0; i < roleHatsParams.hats.length; ) {\\n HatParams memory hatParams = roleHatsParams.hats[i];\\n\\n // Create eligibility module if needed\\n address eligibilityAddress = _createEligibilityModule(\\n roleHatsParams.hatsProtocol,\\n roleHatsParams.hatsModuleFactory,\\n roleHatsParams.hatsElectionsEligibilityImplementation,\\n roleHatsParams.topHatId,\\n roleHatsParams.topHatAccount,\\n roleHatsParams.adminHatId,\\n hatParams.termEndDateTs\\n );\\n\\n // Create and Mint the Role Hat\\n uint256 hatId = _createAndMintHat(\\n roleHatsParams.hatsProtocol,\\n roleHatsParams.adminHatId,\\n hatParams,\\n eligibilityAddress,\\n roleHatsParams.topHatAccount\\n );\\n\\n // Get the stream recipient (based on termed or not)\\n address streamRecipient = _setupStreamRecipient(\\n roleHatsParams.erc6551Registry,\\n roleHatsParams.hatsAccountImplementation,\\n address(roleHatsParams.hatsProtocol),\\n hatParams.termEndDateTs,\\n hatParams.wearer,\\n hatId\\n );\\n\\n // Create streams\\n _processSablierStreams(\\n hatParams.sablierStreamsParams,\\n streamRecipient\\n );\\n\\n unchecked {\\n ++i;\\n }\\n }\\n }\\n\\n function _createEligibilityModule(\\n IHats hatsProtocol,\\n IHatsModuleFactory hatsModuleFactory,\\n address hatsElectionsEligibilityImplementation,\\n uint256 topHatId,\\n address topHatAccount,\\n uint256 adminHatId,\\n uint128 termEndDateTs\\n ) private returns (address) {\\n // If the Hat is termed, create the eligibility module\\n if (termEndDateTs != 0) {\\n return\\n hatsModuleFactory.createHatsModule(\\n hatsElectionsEligibilityImplementation,\\n hatsProtocol.getNextId(adminHatId),\\n abi.encode(topHatId, uint256(0)), // [BALLOT_BOX_ID, ADMIN_HAT_ID]\\n abi.encode(termEndDateTs),\\n uint256(SALT)\\n );\\n }\\n\\n // Otherwise, return the Top Hat account\\n return topHatAccount;\\n }\\n\\n function _createAndMintHat(\\n IHats hatsProtocol,\\n uint256 adminHatId,\\n HatParams memory hat,\\n address eligibilityAddress,\\n address topHatAccount\\n ) private returns (uint256) {\\n // Grab the next Hat ID (before creating it)\\n uint256 hatId = hatsProtocol.getNextId(adminHatId);\\n\\n // Create the new Hat\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"createHat(uint256,string,uint32,address,address,bool,string)\\\",\\n adminHatId,\\n hat.details,\\n hat.maxSupply,\\n eligibilityAddress,\\n topHatAccount,\\n hat.isMutable,\\n hat.imageURI\\n ),\\n Enum.Operation.Call\\n );\\n\\n // If the Hat is termed, nominate the wearer as the eligible member\\n if (hat.termEndDateTs != 0) {\\n address[] memory nominatedWearers = new address[](1);\\n nominatedWearers[0] = hat.wearer;\\n\\n IAvatar(msg.sender).execTransactionFromModule(\\n eligibilityAddress,\\n 0,\\n abi.encodeWithSignature(\\n \\\"elect(uint128,address[])\\\",\\n hat.termEndDateTs,\\n nominatedWearers\\n ),\\n Enum.Operation.Call\\n );\\n }\\n\\n // Mint the Hat\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"mintHat(uint256,address)\\\",\\n hatId,\\n hat.wearer\\n ),\\n Enum.Operation.Call\\n );\\n return hatId;\\n }\\n\\n // Exists to avoid stack too deep errors\\n function _setupStreamRecipient(\\n IERC6551Registry erc6551Registry,\\n address hatsAccountImplementation,\\n address hatsProtocol,\\n uint128 termEndDateTs,\\n address wearer,\\n uint256 hatId\\n ) private returns (address) {\\n // If the hat is termed, the wearer is the stream recipient\\n if (termEndDateTs != 0) {\\n return wearer;\\n }\\n\\n // Otherwise, the Hat's smart account is the stream recipient\\n return\\n erc6551Registry.createAccount(\\n hatsAccountImplementation,\\n SALT,\\n block.chainid,\\n hatsProtocol,\\n hatId\\n );\\n }\\n\\n function _processSablierStreams(\\n SablierStreamParams[] memory streamParams,\\n address streamRecipient\\n ) private {\\n for (uint256 i = 0; i < streamParams.length; ) {\\n SablierStreamParams memory sablierStreamParams = streamParams[i];\\n\\n // Approve tokens for Sablier\\n IAvatar(msg.sender).execTransactionFromModule(\\n sablierStreamParams.asset,\\n 0,\\n abi.encodeWithSignature(\\n \\\"approve(address,uint256)\\\",\\n sablierStreamParams.sablier,\\n sablierStreamParams.totalAmount\\n ),\\n Enum.Operation.Call\\n );\\n\\n // Proxy the Sablier call through IAvatar\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(sablierStreamParams.sablier),\\n 0,\\n abi.encodeWithSignature(\\n \\\"createWithTimestamps((address,address,uint128,address,bool,bool,(uint40,uint40,uint40),(address,uint256)))\\\",\\n LockupLinear.CreateWithTimestamps({\\n sender: sablierStreamParams.sender,\\n recipient: streamRecipient,\\n totalAmount: sablierStreamParams.totalAmount,\\n asset: IERC20(sablierStreamParams.asset),\\n cancelable: sablierStreamParams.cancelable,\\n transferable: sablierStreamParams.transferable,\\n timestamps: sablierStreamParams.timestamps,\\n broker: sablierStreamParams.broker\\n })\\n ),\\n Enum.Operation.Call\\n );\\n\\n unchecked {\\n ++i;\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x357c5264ecb63f8f15f67ffb7498c7fb55d9efe8d46358790933b4892bd38cde\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x6080604052348015600f57600080fd5b5061123d8061001f6000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80633dac44e81461003b578063ba9a91a514610050575b600080fd5b61004e610049366004610929565b610089565b005b6100777f5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b507281565b60405190815260200160405180910390f35b61009a61009582610e60565b61009d565b50565b60005b8161010001515181101561016057600082610100015182815181106100c7576100c7610f22565b6020026020010151905060006100fe84600001518560a001518660c00151876060015188608001518960e001518860800151610164565b9050600061011b85600001518660e00151858589608001516102dd565b90506000610141866020015187604001518860000151876080015188600001518761060f565b90506101518460600151826106db565b846001019450505050506100a0565b5050565b60006001600160801b038216156102cf57866001600160a01b0316632f7fb7b6878a6001600160a01b0316631183a8c0876040518263ffffffff1660e01b81526004016101b391815260200190565b602060405180830381865afa1580156101d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101f49190610f38565b886000604051602001610211929190918252602082015260400190565b60408051601f198184030181528282526001600160801b0389166020840152910160408051601f19818403018152908290526001600160e01b031960e087901b168252610285949392917f5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b507290600401610f97565b6020604051808303816000875af11580156102a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102c89190610fe3565b90506102d2565b50825b979650505050505050565b60405162460ea360e61b81526004810185905260009081906001600160a01b03881690631183a8c090602401602060405180830381865afa158015610326573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061034a9190610f38565b9050336001600160a01b031663468721a78860008989602001518a60a001518a8a8d60c001518e6040015160405160240161038b9796959493929190611000565b60408051601f198184030181529181526020820180516001600160e01b0316635829492f60e11b1790525160e085901b6001600160e01b03191681526103d993929190600090600401611064565b6020604051808303816000875af11580156103f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061041c91906110ba565b5060808501516001600160801b031615610547576040805160018082528183019092526000916020808301908036833701905050905085600001518160008151811061046a5761046a610f22565b60200260200101906001600160a01b031690816001600160a01b031681525050336001600160a01b031663468721a78660008960800151856040516024016104b39291906110d7565b60408051601f198184030181529181526020820180516001600160e01b0316634a231cef60e01b1790525160e085901b6001600160e01b031916815261050193929190600090600401611064565b6020604051808303816000875af1158015610520573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061054491906110ba565b50505b8451604051602481018390526001600160a01b039091166044820152339063468721a790899060009060640160408051601f198184030181529181526020820180516001600160e01b031663320fbbb760e11b1790525160e085901b6001600160e01b03191681526105c193929190600090600401611064565b6020604051808303816000875af11580156105e0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061060491906110ba565b509695505050505050565b60006001600160801b038416156106275750816106d1565b604051638a54c52f60e01b81526001600160a01b0387811660048301527f5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b50726024830152466044830152868116606483015260848201849052881690638a54c52f9060a4016020604051808303816000875af11580156106aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106ce9190610fe3565b90505b9695505050505050565b60005b82518110156109245760008382815181106106fb576106fb610f22565b60200260200101519050336001600160a01b031663468721a78260400151600084600001518560a001516040516024016107539291906001600160a01b039290921682526001600160801b0316602082015260400190565b60408051601f198184030181529181526020820180516001600160e01b031663095ea7b360e01b1790525160e085901b6001600160e01b03191681526107a193929190600090600401611064565b6020604051808303816000875af11580156107c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107e491906110ba565b50336001600160a01b031663468721a78260000151600060405180610100016040528086602001516001600160a01b03168152602001886001600160a01b031681526020018660a001516001600160801b0316815260200186604001516001600160a01b031681526020018660c00151151581526020018660e00151151581526020018660600151815260200186608001518152506040516024016108899190611138565b60408051601f198184030181529181526020820180516001600160e01b03166353b1572760e01b1790525160e085901b6001600160e01b03191681526108d793929190600090600401611064565b6020604051808303816000875af11580156108f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061091a91906110ba565b50506001016106de565b505050565b60006020828403121561093b57600080fd5b81356001600160401b0381111561095157600080fd5b8201610120818503121561096457600080fd5b9392505050565b634e487b7160e01b600052604160045260246000fd5b60405161010081016001600160401b03811182821017156109a4576109a461096b565b60405290565b60405160e081016001600160401b03811182821017156109a4576109a461096b565b60405161012081016001600160401b03811182821017156109a4576109a461096b565b604051601f8201601f191681016001600160401b0381118282101715610a1757610a1761096b565b604052919050565b6001600160a01b038116811461009a57600080fd5b8035610a3f81610a1f565b919050565b60006001600160401b03821115610a5d57610a5d61096b565b5060051b60200190565b600082601f830112610a7857600080fd5b81356001600160401b03811115610a9157610a9161096b565b610aa4601f8201601f19166020016109ef565b818152846020838601011115610ab957600080fd5b816020850160208301376000918101602001919091529392505050565b803564ffffffffff81168114610a3f57600080fd5b600060608284031215610afd57600080fd5b604051606081016001600160401b0381118282101715610b1f57610b1f61096b565b604052905080610b2e83610ad6565b8152610b3c60208401610ad6565b6020820152610b4d60408401610ad6565b60408201525092915050565b600060408284031215610b6b57600080fd5b604080519081016001600160401b0381118282101715610b8d57610b8d61096b565b6040529050808235610b9e81610a1f565b8152602092830135920191909152919050565b80356001600160801b0381168114610a3f57600080fd5b801515811461009a57600080fd5b8035610a3f81610bc8565b600082601f830112610bf257600080fd5b8135610c05610c0082610a44565b6109ef565b8082825260208201915060206101608402860101925085831115610c2857600080fd5b602085015b83811015610ce6576101608188031215610c4657600080fd5b610c4e610981565b610c5782610a34565b8152610c6560208301610a34565b6020820152610c7660408301610a34565b6040820152610c888860608401610aeb565b6060820152610c9a8860c08401610b59565b6080820152610cac6101008301610bb1565b60a0820152610cbe6101208301610bd6565b60c0820152610cd06101408301610bd6565b60e0820152835260209092019161016001610c2d565b5095945050505050565b803563ffffffff81168114610a3f57600080fd5b600082601f830112610d1557600080fd5b8135610d23610c0082610a44565b8082825260208201915060208360051b860101925085831115610d4557600080fd5b602085015b83811015610ce65780356001600160401b03811115610d6857600080fd5b860160e0818903601f19011215610d7e57600080fd5b610d866109aa565b610d9260208301610a34565b815260408201356001600160401b03811115610dad57600080fd5b610dbc8a602083860101610a67565b60208301525060608201356001600160401b03811115610ddb57600080fd5b610dea8a602083860101610a67565b60408301525060808201356001600160401b03811115610e0957600080fd5b610e188a602083860101610be1565b606083015250610e2a60a08301610bb1565b6080820152610e3b60c08301610cf0565b60a0820152610e4c60e08301610bd6565b60c082015284525060209283019201610d4a565b60006101208236031215610e7357600080fd5b610e7b6109cc565b610e8483610a34565b8152610e9260208401610a34565b6020820152610ea360408401610a34565b604082015260608381013590820152610ebe60808401610a34565b6080820152610ecf60a08401610a34565b60a0820152610ee060c08401610a34565b60c082015260e083810135908201526101008301356001600160401b03811115610f0957600080fd5b610f1536828601610d04565b6101008301525092915050565b634e487b7160e01b600052603260045260246000fd5b600060208284031215610f4a57600080fd5b5051919050565b6000815180845260005b81811015610f7757602081850181015186830182015201610f5b565b506000602082860101526020601f19601f83011685010191505092915050565b60018060a01b038616815284602082015260a060408201526000610fbe60a0830186610f51565b8281036060840152610fd08186610f51565b9150508260808301529695505050505050565b600060208284031215610ff557600080fd5b815161096481610a1f565b87815260e06020820152600061101960e0830189610f51565b63ffffffff881660408401526001600160a01b0387811660608501528616608084015284151560a084015282810360c08401526110568185610f51565b9a9950505050505050505050565b60018060a01b038516815283602082015260806040820152600061108b6080830185610f51565b9050600283106110ab57634e487b7160e01b600052602160045260246000fd5b82606083015295945050505050565b6000602082840312156110cc57600080fd5b815161096481610bc8565b6000604082016001600160801b03851683526040602084015280845180835260608501915060208601925060005b8181101561112c5783516001600160a01b0316835260209384019390920191600101611105565b50909695505050505050565b81516001600160a01b0390811682526020808401518216908301526040808401516001600160801b0316908301526060808401519182169083015261016082019050608083015161118d608084018215159052565b5060a08301516111a160a084018215159052565b5060c08301516111e060c084018264ffffffffff815116825264ffffffffff602082015116602083015264ffffffffff60408201511660408301525050565b5060e0929092015180516001600160a01b031661012083015260200151610140909101529056fea26469706673582212208ecde80de6a92bc6f34289d7626d01b9bebb41eb9991597e67fb6a0be17a938664736f6c634300081c0033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100365760003560e01c80633dac44e81461003b578063ba9a91a514610050575b600080fd5b61004e610049366004610929565b610089565b005b6100777f5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b507281565b60405190815260200160405180910390f35b61009a61009582610e60565b61009d565b50565b60005b8161010001515181101561016057600082610100015182815181106100c7576100c7610f22565b6020026020010151905060006100fe84600001518560a001518660c00151876060015188608001518960e001518860800151610164565b9050600061011b85600001518660e00151858589608001516102dd565b90506000610141866020015187604001518860000151876080015188600001518761060f565b90506101518460600151826106db565b846001019450505050506100a0565b5050565b60006001600160801b038216156102cf57866001600160a01b0316632f7fb7b6878a6001600160a01b0316631183a8c0876040518263ffffffff1660e01b81526004016101b391815260200190565b602060405180830381865afa1580156101d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101f49190610f38565b886000604051602001610211929190918252602082015260400190565b60408051601f198184030181528282526001600160801b0389166020840152910160408051601f19818403018152908290526001600160e01b031960e087901b168252610285949392917f5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b507290600401610f97565b6020604051808303816000875af11580156102a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102c89190610fe3565b90506102d2565b50825b979650505050505050565b60405162460ea360e61b81526004810185905260009081906001600160a01b03881690631183a8c090602401602060405180830381865afa158015610326573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061034a9190610f38565b9050336001600160a01b031663468721a78860008989602001518a60a001518a8a8d60c001518e6040015160405160240161038b9796959493929190611000565b60408051601f198184030181529181526020820180516001600160e01b0316635829492f60e11b1790525160e085901b6001600160e01b03191681526103d993929190600090600401611064565b6020604051808303816000875af11580156103f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061041c91906110ba565b5060808501516001600160801b031615610547576040805160018082528183019092526000916020808301908036833701905050905085600001518160008151811061046a5761046a610f22565b60200260200101906001600160a01b031690816001600160a01b031681525050336001600160a01b031663468721a78660008960800151856040516024016104b39291906110d7565b60408051601f198184030181529181526020820180516001600160e01b0316634a231cef60e01b1790525160e085901b6001600160e01b031916815261050193929190600090600401611064565b6020604051808303816000875af1158015610520573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061054491906110ba565b50505b8451604051602481018390526001600160a01b039091166044820152339063468721a790899060009060640160408051601f198184030181529181526020820180516001600160e01b031663320fbbb760e11b1790525160e085901b6001600160e01b03191681526105c193929190600090600401611064565b6020604051808303816000875af11580156105e0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061060491906110ba565b509695505050505050565b60006001600160801b038416156106275750816106d1565b604051638a54c52f60e01b81526001600160a01b0387811660048301527f5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b50726024830152466044830152868116606483015260848201849052881690638a54c52f9060a4016020604051808303816000875af11580156106aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106ce9190610fe3565b90505b9695505050505050565b60005b82518110156109245760008382815181106106fb576106fb610f22565b60200260200101519050336001600160a01b031663468721a78260400151600084600001518560a001516040516024016107539291906001600160a01b039290921682526001600160801b0316602082015260400190565b60408051601f198184030181529181526020820180516001600160e01b031663095ea7b360e01b1790525160e085901b6001600160e01b03191681526107a193929190600090600401611064565b6020604051808303816000875af11580156107c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107e491906110ba565b50336001600160a01b031663468721a78260000151600060405180610100016040528086602001516001600160a01b03168152602001886001600160a01b031681526020018660a001516001600160801b0316815260200186604001516001600160a01b031681526020018660c00151151581526020018660e00151151581526020018660600151815260200186608001518152506040516024016108899190611138565b60408051601f198184030181529181526020820180516001600160e01b03166353b1572760e01b1790525160e085901b6001600160e01b03191681526108d793929190600090600401611064565b6020604051808303816000875af11580156108f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061091a91906110ba565b50506001016106de565b505050565b60006020828403121561093b57600080fd5b81356001600160401b0381111561095157600080fd5b8201610120818503121561096457600080fd5b9392505050565b634e487b7160e01b600052604160045260246000fd5b60405161010081016001600160401b03811182821017156109a4576109a461096b565b60405290565b60405160e081016001600160401b03811182821017156109a4576109a461096b565b60405161012081016001600160401b03811182821017156109a4576109a461096b565b604051601f8201601f191681016001600160401b0381118282101715610a1757610a1761096b565b604052919050565b6001600160a01b038116811461009a57600080fd5b8035610a3f81610a1f565b919050565b60006001600160401b03821115610a5d57610a5d61096b565b5060051b60200190565b600082601f830112610a7857600080fd5b81356001600160401b03811115610a9157610a9161096b565b610aa4601f8201601f19166020016109ef565b818152846020838601011115610ab957600080fd5b816020850160208301376000918101602001919091529392505050565b803564ffffffffff81168114610a3f57600080fd5b600060608284031215610afd57600080fd5b604051606081016001600160401b0381118282101715610b1f57610b1f61096b565b604052905080610b2e83610ad6565b8152610b3c60208401610ad6565b6020820152610b4d60408401610ad6565b60408201525092915050565b600060408284031215610b6b57600080fd5b604080519081016001600160401b0381118282101715610b8d57610b8d61096b565b6040529050808235610b9e81610a1f565b8152602092830135920191909152919050565b80356001600160801b0381168114610a3f57600080fd5b801515811461009a57600080fd5b8035610a3f81610bc8565b600082601f830112610bf257600080fd5b8135610c05610c0082610a44565b6109ef565b8082825260208201915060206101608402860101925085831115610c2857600080fd5b602085015b83811015610ce6576101608188031215610c4657600080fd5b610c4e610981565b610c5782610a34565b8152610c6560208301610a34565b6020820152610c7660408301610a34565b6040820152610c888860608401610aeb565b6060820152610c9a8860c08401610b59565b6080820152610cac6101008301610bb1565b60a0820152610cbe6101208301610bd6565b60c0820152610cd06101408301610bd6565b60e0820152835260209092019161016001610c2d565b5095945050505050565b803563ffffffff81168114610a3f57600080fd5b600082601f830112610d1557600080fd5b8135610d23610c0082610a44565b8082825260208201915060208360051b860101925085831115610d4557600080fd5b602085015b83811015610ce65780356001600160401b03811115610d6857600080fd5b860160e0818903601f19011215610d7e57600080fd5b610d866109aa565b610d9260208301610a34565b815260408201356001600160401b03811115610dad57600080fd5b610dbc8a602083860101610a67565b60208301525060608201356001600160401b03811115610ddb57600080fd5b610dea8a602083860101610a67565b60408301525060808201356001600160401b03811115610e0957600080fd5b610e188a602083860101610be1565b606083015250610e2a60a08301610bb1565b6080820152610e3b60c08301610cf0565b60a0820152610e4c60e08301610bd6565b60c082015284525060209283019201610d4a565b60006101208236031215610e7357600080fd5b610e7b6109cc565b610e8483610a34565b8152610e9260208401610a34565b6020820152610ea360408401610a34565b604082015260608381013590820152610ebe60808401610a34565b6080820152610ecf60a08401610a34565b60a0820152610ee060c08401610a34565b60c082015260e083810135908201526101008301356001600160401b03811115610f0957600080fd5b610f1536828601610d04565b6101008301525092915050565b634e487b7160e01b600052603260045260246000fd5b600060208284031215610f4a57600080fd5b5051919050565b6000815180845260005b81811015610f7757602081850181015186830182015201610f5b565b506000602082860101526020601f19601f83011685010191505092915050565b60018060a01b038616815284602082015260a060408201526000610fbe60a0830186610f51565b8281036060840152610fd08186610f51565b9150508260808301529695505050505050565b600060208284031215610ff557600080fd5b815161096481610a1f565b87815260e06020820152600061101960e0830189610f51565b63ffffffff881660408401526001600160a01b0387811660608501528616608084015284151560a084015282810360c08401526110568185610f51565b9a9950505050505050505050565b60018060a01b038516815283602082015260806040820152600061108b6080830185610f51565b9050600283106110ab57634e487b7160e01b600052602160045260246000fd5b82606083015295945050505050565b6000602082840312156110cc57600080fd5b815161096481610bc8565b6000604082016001600160801b03851683526040602084015280845180835260608501915060208601925060005b8181101561112c5783516001600160a01b0316835260209384019390920191600101611105565b50909695505050505050565b81516001600160a01b0390811682526020808401518216908301526040808401516001600160801b0316908301526060808401519182169083015261016082019050608083015161118d608084018215159052565b5060a08301516111a160a084018215159052565b5060c08301516111e060c084018264ffffffffff815116825264ffffffffff602082015116602083015264ffffffffff60408201511660408301525050565b5060e0929092015180516001600160a01b031661012083015260200151610140909101529056fea26469706673582212208ecde80de6a92bc6f34289d7626d01b9bebb41eb9991597e67fb6a0be17a938664736f6c634300081c0033", + "numDeployments": 2, + "solcInputHash": "f1fca9a70591742a2aedd10e2fd7e744", + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"SALT\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"contract IHats\",\"name\":\"hatsProtocol\",\"type\":\"address\"},{\"internalType\":\"contract IERC6551Registry\",\"name\":\"erc6551Registry\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"hatsAccountImplementation\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"topHatId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"topHatAccount\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"keyValuePairs\",\"type\":\"address\"},{\"internalType\":\"contract IHatsModuleFactory\",\"name\":\"hatsModuleFactory\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"hatsElectionsEligibilityImplementation\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"adminHatId\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"wearer\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"details\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"imageURI\",\"type\":\"string\"},{\"components\":[{\"internalType\":\"contract ISablierV2LockupLinear\",\"name\":\"sablier\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint40\",\"name\":\"start\",\"type\":\"uint40\"},{\"internalType\":\"uint40\",\"name\":\"cliff\",\"type\":\"uint40\"},{\"internalType\":\"uint40\",\"name\":\"end\",\"type\":\"uint40\"}],\"internalType\":\"struct LockupLinear.Timestamps\",\"name\":\"timestamps\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"UD60x18\",\"name\":\"fee\",\"type\":\"uint256\"}],\"internalType\":\"struct Broker\",\"name\":\"broker\",\"type\":\"tuple\"},{\"internalType\":\"uint128\",\"name\":\"totalAmount\",\"type\":\"uint128\"},{\"internalType\":\"bool\",\"name\":\"cancelable\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"transferable\",\"type\":\"bool\"}],\"internalType\":\"struct DecentHatsModuleUtils.SablierStreamParams[]\",\"name\":\"sablierStreamsParams\",\"type\":\"tuple[]\"},{\"internalType\":\"uint128\",\"name\":\"termEndDateTs\",\"type\":\"uint128\"},{\"internalType\":\"uint32\",\"name\":\"maxSupply\",\"type\":\"uint32\"},{\"internalType\":\"bool\",\"name\":\"isMutable\",\"type\":\"bool\"}],\"internalType\":\"struct DecentHatsModuleUtils.HatParams[]\",\"name\":\"hats\",\"type\":\"tuple[]\"}],\"internalType\":\"struct DecentHatsModuleUtils.CreateRoleHatsParams\",\"name\":\"roleHatsParams\",\"type\":\"tuple\"}],\"name\":\"createRoleHats\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"createRoleHats((address,address,address,uint256,address,address,address,address,uint256,(address,string,string,(address,address,address,(uint40,uint40,uint40),(address,uint256),uint128,bool,bool)[],uint128,uint32,bool)[]))\":{\"details\":\"Stream funds on untermed Roles are targeted at the hat's smart account. In order to withdraw funds from the stream, the hat's smart account must be the one call to `withdraw-` on the Sablier contract, setting the recipient arg to its wearer.Stream funds on termed Roles are targeted directly at the nominated wearer. The wearer should directly call `withdraw-` on the Sablier contract.Role hat creation, minting, smart account creation and stream creation are handled here in order to avoid a race condition where not more than one active proposal to create a new role can exist at a time. See: https://github.com/decentdao/decent-interface/issues/2402\",\"params\":{\"roleHatsParams\":\"An array of params for each role hat to be created.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"createRoleHats((address,address,address,uint256,address,address,address,address,uint256,(address,string,string,(address,address,address,(uint40,uint40,uint40),(address,uint256),uint128,bool,bool)[],uint128,uint32,bool)[]))\":{\"notice\":\"Creates a new termed or untermed role hat and any streams on it.This contract should be enabled a module on the Safe for which the role is to be created, and disabled after.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/modules/DecentHatsModificationModule.sol\":\"DecentHatsModificationModule\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\npragma solidity >=0.7.0 <0.9.0;\\n\\n/// @title Enum - Collection of enums\\n/// @author Richard Meissner - \\ncontract Enum {\\n enum Operation {Call, DelegateCall}\\n}\\n\",\"keccak256\":\"0x473e45b1a5cc47be494b0e123c9127f0c11c1e0992a321ae5a644c0bfdb2c14f\",\"license\":\"LGPL-3.0-only\"},\"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\n\\n/// @title Zodiac Avatar - A contract that manages modules that can execute transactions via this contract.\\npragma solidity >=0.7.0 <0.9.0;\\n\\nimport \\\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\\\";\\n\\ninterface IAvatar {\\n event EnabledModule(address module);\\n event DisabledModule(address module);\\n event ExecutionFromModuleSuccess(address indexed module);\\n event ExecutionFromModuleFailure(address indexed module);\\n\\n /// @dev Enables a module on the avatar.\\n /// @notice Can only be called by the avatar.\\n /// @notice Modules should be stored as a linked list.\\n /// @notice Must emit EnabledModule(address module) if successful.\\n /// @param module Module to be enabled.\\n function enableModule(address module) external;\\n\\n /// @dev Disables a module on the avatar.\\n /// @notice Can only be called by the avatar.\\n /// @notice Must emit DisabledModule(address module) if successful.\\n /// @param prevModule Address that pointed to the module to be removed in the linked list\\n /// @param module Module to be removed.\\n function disableModule(address prevModule, address module) external;\\n\\n /// @dev Allows a Module to execute a transaction.\\n /// @notice Can only be called by an enabled module.\\n /// @notice Must emit ExecutionFromModuleSuccess(address module) if successful.\\n /// @notice Must emit ExecutionFromModuleFailure(address module) if unsuccessful.\\n /// @param to Destination address of module transaction.\\n /// @param value Ether value of module transaction.\\n /// @param data Data payload of module transaction.\\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\\n function execTransactionFromModule(\\n address to,\\n uint256 value,\\n bytes memory data,\\n Enum.Operation operation\\n ) external returns (bool success);\\n\\n /// @dev Allows a Module to execute a transaction and return data\\n /// @notice Can only be called by an enabled module.\\n /// @notice Must emit ExecutionFromModuleSuccess(address module) if successful.\\n /// @notice Must emit ExecutionFromModuleFailure(address module) if unsuccessful.\\n /// @param to Destination address of module transaction.\\n /// @param value Ether value of module transaction.\\n /// @param data Data payload of module transaction.\\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\\n function execTransactionFromModuleReturnData(\\n address to,\\n uint256 value,\\n bytes memory data,\\n Enum.Operation operation\\n ) external returns (bool success, bytes memory returnData);\\n\\n /// @dev Returns if an module is enabled\\n /// @return True if the module is enabled\\n function isModuleEnabled(address module) external view returns (bool);\\n\\n /// @dev Returns array of modules.\\n /// @param start Start of the page.\\n /// @param pageSize Maximum number of modules that should be returned.\\n /// @return array Array of modules.\\n /// @return next Start of the next page.\\n function getModulesPaginated(address start, uint256 pageSize)\\n external\\n view\\n returns (address[] memory array, address next);\\n}\\n\",\"keccak256\":\"0xcd5508ffe596eef8fbccfd5fc4f10a34397773547ce64e212d48b5212865ec1f\",\"license\":\"LGPL-3.0-only\"},\"@openzeppelin/contracts/interfaces/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/introspection/IERC165.sol\\\";\\n\",\"keccak256\":\"0xd04b0f06e0666f29cf7cccc82894de541e19bb30a765b107b1e40bb7fe5f7d7a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev 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 amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `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 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes calldata data\\n ) external;\\n\\n /**\\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 {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the caller.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool _approved) external;\\n\\n /**\\n * @dev Returns 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\",\"keccak256\":\"0xed6a749c5373af398105ce6ee3ac4763aa450ea7285d268c85d9eeca809cdb1f\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../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\",\"keccak256\":\"0x75b829ff2f26c14355d1cba20e16fe7b29ca58eb5fef665ede48bc0f9c6c74b9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _HEX_SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\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 // Inspired by OraclizeAPI's implementation - MIT licence\\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\\n\\n if (value == 0) {\\n return \\\"0\\\";\\n }\\n uint256 temp = value;\\n uint256 digits;\\n while (temp != 0) {\\n digits++;\\n temp /= 10;\\n }\\n bytes memory buffer = new bytes(digits);\\n while (value != 0) {\\n digits -= 1;\\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\\n value /= 10;\\n }\\n return string(buffer);\\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 if (value == 0) {\\n return \\\"0x00\\\";\\n }\\n uint256 temp = value;\\n uint256 length = 0;\\n while (temp != 0) {\\n length++;\\n temp >>= 8;\\n }\\n return toHexString(value, length);\\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 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_SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\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 representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n}\\n\",\"keccak256\":\"0xaf159a8b1923ad2a26d516089bceca9bdeaeacd04be50983ea00ba63070f08a3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"@prb/math/src/Common.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\n// Common.sol\\n//\\n// Common mathematical functions used in both SD59x18 and UD60x18. Note that these global functions do not\\n// always operate with SD59x18 and UD60x18 numbers.\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CUSTOM ERRORS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @notice Thrown when the resultant value in {mulDiv} overflows uint256.\\nerror PRBMath_MulDiv_Overflow(uint256 x, uint256 y, uint256 denominator);\\n\\n/// @notice Thrown when the resultant value in {mulDiv18} overflows uint256.\\nerror PRBMath_MulDiv18_Overflow(uint256 x, uint256 y);\\n\\n/// @notice Thrown when one of the inputs passed to {mulDivSigned} is `type(int256).min`.\\nerror PRBMath_MulDivSigned_InputTooSmall();\\n\\n/// @notice Thrown when the resultant value in {mulDivSigned} overflows int256.\\nerror PRBMath_MulDivSigned_Overflow(int256 x, int256 y);\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CONSTANTS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @dev The maximum value a uint128 number can have.\\nuint128 constant MAX_UINT128 = type(uint128).max;\\n\\n/// @dev The maximum value a uint40 number can have.\\nuint40 constant MAX_UINT40 = type(uint40).max;\\n\\n/// @dev The unit number, which the decimal precision of the fixed-point types.\\nuint256 constant UNIT = 1e18;\\n\\n/// @dev The unit number inverted mod 2^256.\\nuint256 constant UNIT_INVERSE = 78156646155174841979727994598816262306175212592076161876661_508869554232690281;\\n\\n/// @dev The the largest power of two that divides the decimal value of `UNIT`. The logarithm of this value is the least significant\\n/// bit in the binary representation of `UNIT`.\\nuint256 constant UNIT_LPOTD = 262144;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @notice Calculates the binary exponent of x using the binary fraction method.\\n/// @dev Has to use 192.64-bit fixed-point numbers. See https://ethereum.stackexchange.com/a/96594/24693.\\n/// @param x The exponent as an unsigned 192.64-bit fixed-point number.\\n/// @return result The result as an unsigned 60.18-decimal fixed-point number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp2(uint256 x) pure returns (uint256 result) {\\n unchecked {\\n // Start from 0.5 in the 192.64-bit fixed-point format.\\n result = 0x800000000000000000000000000000000000000000000000;\\n\\n // The following logic multiplies the result by $\\\\sqrt{2^{-i}}$ when the bit at position i is 1. Key points:\\n //\\n // 1. Intermediate results will not overflow, as the starting point is 2^191 and all magic factors are under 2^65.\\n // 2. The rationale for organizing the if statements into groups of 8 is gas savings. If the result of performing\\n // a bitwise AND operation between x and any value in the array [0x80; 0x40; 0x20; 0x10; 0x08; 0x04; 0x02; 0x01] is 1,\\n // we know that `x & 0xFF` is also 1.\\n if (x & 0xFF00000000000000 > 0) {\\n if (x & 0x8000000000000000 > 0) {\\n result = (result * 0x16A09E667F3BCC909) >> 64;\\n }\\n if (x & 0x4000000000000000 > 0) {\\n result = (result * 0x1306FE0A31B7152DF) >> 64;\\n }\\n if (x & 0x2000000000000000 > 0) {\\n result = (result * 0x1172B83C7D517ADCE) >> 64;\\n }\\n if (x & 0x1000000000000000 > 0) {\\n result = (result * 0x10B5586CF9890F62A) >> 64;\\n }\\n if (x & 0x800000000000000 > 0) {\\n result = (result * 0x1059B0D31585743AE) >> 64;\\n }\\n if (x & 0x400000000000000 > 0) {\\n result = (result * 0x102C9A3E778060EE7) >> 64;\\n }\\n if (x & 0x200000000000000 > 0) {\\n result = (result * 0x10163DA9FB33356D8) >> 64;\\n }\\n if (x & 0x100000000000000 > 0) {\\n result = (result * 0x100B1AFA5ABCBED61) >> 64;\\n }\\n }\\n\\n if (x & 0xFF000000000000 > 0) {\\n if (x & 0x80000000000000 > 0) {\\n result = (result * 0x10058C86DA1C09EA2) >> 64;\\n }\\n if (x & 0x40000000000000 > 0) {\\n result = (result * 0x1002C605E2E8CEC50) >> 64;\\n }\\n if (x & 0x20000000000000 > 0) {\\n result = (result * 0x100162F3904051FA1) >> 64;\\n }\\n if (x & 0x10000000000000 > 0) {\\n result = (result * 0x1000B175EFFDC76BA) >> 64;\\n }\\n if (x & 0x8000000000000 > 0) {\\n result = (result * 0x100058BA01FB9F96D) >> 64;\\n }\\n if (x & 0x4000000000000 > 0) {\\n result = (result * 0x10002C5CC37DA9492) >> 64;\\n }\\n if (x & 0x2000000000000 > 0) {\\n result = (result * 0x1000162E525EE0547) >> 64;\\n }\\n if (x & 0x1000000000000 > 0) {\\n result = (result * 0x10000B17255775C04) >> 64;\\n }\\n }\\n\\n if (x & 0xFF0000000000 > 0) {\\n if (x & 0x800000000000 > 0) {\\n result = (result * 0x1000058B91B5BC9AE) >> 64;\\n }\\n if (x & 0x400000000000 > 0) {\\n result = (result * 0x100002C5C89D5EC6D) >> 64;\\n }\\n if (x & 0x200000000000 > 0) {\\n result = (result * 0x10000162E43F4F831) >> 64;\\n }\\n if (x & 0x100000000000 > 0) {\\n result = (result * 0x100000B1721BCFC9A) >> 64;\\n }\\n if (x & 0x80000000000 > 0) {\\n result = (result * 0x10000058B90CF1E6E) >> 64;\\n }\\n if (x & 0x40000000000 > 0) {\\n result = (result * 0x1000002C5C863B73F) >> 64;\\n }\\n if (x & 0x20000000000 > 0) {\\n result = (result * 0x100000162E430E5A2) >> 64;\\n }\\n if (x & 0x10000000000 > 0) {\\n result = (result * 0x1000000B172183551) >> 64;\\n }\\n }\\n\\n if (x & 0xFF00000000 > 0) {\\n if (x & 0x8000000000 > 0) {\\n result = (result * 0x100000058B90C0B49) >> 64;\\n }\\n if (x & 0x4000000000 > 0) {\\n result = (result * 0x10000002C5C8601CC) >> 64;\\n }\\n if (x & 0x2000000000 > 0) {\\n result = (result * 0x1000000162E42FFF0) >> 64;\\n }\\n if (x & 0x1000000000 > 0) {\\n result = (result * 0x10000000B17217FBB) >> 64;\\n }\\n if (x & 0x800000000 > 0) {\\n result = (result * 0x1000000058B90BFCE) >> 64;\\n }\\n if (x & 0x400000000 > 0) {\\n result = (result * 0x100000002C5C85FE3) >> 64;\\n }\\n if (x & 0x200000000 > 0) {\\n result = (result * 0x10000000162E42FF1) >> 64;\\n }\\n if (x & 0x100000000 > 0) {\\n result = (result * 0x100000000B17217F8) >> 64;\\n }\\n }\\n\\n if (x & 0xFF000000 > 0) {\\n if (x & 0x80000000 > 0) {\\n result = (result * 0x10000000058B90BFC) >> 64;\\n }\\n if (x & 0x40000000 > 0) {\\n result = (result * 0x1000000002C5C85FE) >> 64;\\n }\\n if (x & 0x20000000 > 0) {\\n result = (result * 0x100000000162E42FF) >> 64;\\n }\\n if (x & 0x10000000 > 0) {\\n result = (result * 0x1000000000B17217F) >> 64;\\n }\\n if (x & 0x8000000 > 0) {\\n result = (result * 0x100000000058B90C0) >> 64;\\n }\\n if (x & 0x4000000 > 0) {\\n result = (result * 0x10000000002C5C860) >> 64;\\n }\\n if (x & 0x2000000 > 0) {\\n result = (result * 0x1000000000162E430) >> 64;\\n }\\n if (x & 0x1000000 > 0) {\\n result = (result * 0x10000000000B17218) >> 64;\\n }\\n }\\n\\n if (x & 0xFF0000 > 0) {\\n if (x & 0x800000 > 0) {\\n result = (result * 0x1000000000058B90C) >> 64;\\n }\\n if (x & 0x400000 > 0) {\\n result = (result * 0x100000000002C5C86) >> 64;\\n }\\n if (x & 0x200000 > 0) {\\n result = (result * 0x10000000000162E43) >> 64;\\n }\\n if (x & 0x100000 > 0) {\\n result = (result * 0x100000000000B1721) >> 64;\\n }\\n if (x & 0x80000 > 0) {\\n result = (result * 0x10000000000058B91) >> 64;\\n }\\n if (x & 0x40000 > 0) {\\n result = (result * 0x1000000000002C5C8) >> 64;\\n }\\n if (x & 0x20000 > 0) {\\n result = (result * 0x100000000000162E4) >> 64;\\n }\\n if (x & 0x10000 > 0) {\\n result = (result * 0x1000000000000B172) >> 64;\\n }\\n }\\n\\n if (x & 0xFF00 > 0) {\\n if (x & 0x8000 > 0) {\\n result = (result * 0x100000000000058B9) >> 64;\\n }\\n if (x & 0x4000 > 0) {\\n result = (result * 0x10000000000002C5D) >> 64;\\n }\\n if (x & 0x2000 > 0) {\\n result = (result * 0x1000000000000162E) >> 64;\\n }\\n if (x & 0x1000 > 0) {\\n result = (result * 0x10000000000000B17) >> 64;\\n }\\n if (x & 0x800 > 0) {\\n result = (result * 0x1000000000000058C) >> 64;\\n }\\n if (x & 0x400 > 0) {\\n result = (result * 0x100000000000002C6) >> 64;\\n }\\n if (x & 0x200 > 0) {\\n result = (result * 0x10000000000000163) >> 64;\\n }\\n if (x & 0x100 > 0) {\\n result = (result * 0x100000000000000B1) >> 64;\\n }\\n }\\n\\n if (x & 0xFF > 0) {\\n if (x & 0x80 > 0) {\\n result = (result * 0x10000000000000059) >> 64;\\n }\\n if (x & 0x40 > 0) {\\n result = (result * 0x1000000000000002C) >> 64;\\n }\\n if (x & 0x20 > 0) {\\n result = (result * 0x10000000000000016) >> 64;\\n }\\n if (x & 0x10 > 0) {\\n result = (result * 0x1000000000000000B) >> 64;\\n }\\n if (x & 0x8 > 0) {\\n result = (result * 0x10000000000000006) >> 64;\\n }\\n if (x & 0x4 > 0) {\\n result = (result * 0x10000000000000003) >> 64;\\n }\\n if (x & 0x2 > 0) {\\n result = (result * 0x10000000000000001) >> 64;\\n }\\n if (x & 0x1 > 0) {\\n result = (result * 0x10000000000000001) >> 64;\\n }\\n }\\n\\n // In the code snippet below, two operations are executed simultaneously:\\n //\\n // 1. The result is multiplied by $(2^n + 1)$, where $2^n$ represents the integer part, and the additional 1\\n // accounts for the initial guess of 0.5. This is achieved by subtracting from 191 instead of 192.\\n // 2. The result is then converted to an unsigned 60.18-decimal fixed-point format.\\n //\\n // The underlying logic is based on the relationship $2^{191-ip} = 2^{ip} / 2^{191}$, where $ip$ denotes the,\\n // integer part, $2^n$.\\n result *= UNIT;\\n result >>= (191 - (x >> 64));\\n }\\n}\\n\\n/// @notice Finds the zero-based index of the first 1 in the binary representation of x.\\n///\\n/// @dev See the note on \\\"msb\\\" in this Wikipedia article: https://en.wikipedia.org/wiki/Find_first_set\\n///\\n/// Each step in this implementation is equivalent to this high-level code:\\n///\\n/// ```solidity\\n/// if (x >= 2 ** 128) {\\n/// x >>= 128;\\n/// result += 128;\\n/// }\\n/// ```\\n///\\n/// Where 128 is replaced with each respective power of two factor. See the full high-level implementation here:\\n/// https://gist.github.com/PaulRBerg/f932f8693f2733e30c4d479e8e980948\\n///\\n/// The Yul instructions used below are:\\n///\\n/// - \\\"gt\\\" is \\\"greater than\\\"\\n/// - \\\"or\\\" is the OR bitwise operator\\n/// - \\\"shl\\\" is \\\"shift left\\\"\\n/// - \\\"shr\\\" is \\\"shift right\\\"\\n///\\n/// @param x The uint256 number for which to find the index of the most significant bit.\\n/// @return result The index of the most significant bit as a uint256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction msb(uint256 x) pure returns (uint256 result) {\\n // 2^128\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(7, gt(x, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^64\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(6, gt(x, 0xFFFFFFFFFFFFFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^32\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(5, gt(x, 0xFFFFFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^16\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(4, gt(x, 0xFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^8\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(3, gt(x, 0xFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^4\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(2, gt(x, 0xF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^2\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(1, gt(x, 0x3))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^1\\n // No need to shift x any more.\\n assembly (\\\"memory-safe\\\") {\\n let factor := gt(x, 0x1)\\n result := or(result, factor)\\n }\\n}\\n\\n/// @notice Calculates x*y\\u00f7denominator with 512-bit precision.\\n///\\n/// @dev Credits to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv.\\n///\\n/// Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - The denominator must not be zero.\\n/// - The result must fit in uint256.\\n///\\n/// @param x The multiplicand as a uint256.\\n/// @param y The multiplier as a uint256.\\n/// @param denominator The divisor as a uint256.\\n/// @return result The result as a uint256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mulDiv(uint256 x, uint256 y, uint256 denominator) pure returns (uint256 result) {\\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; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly (\\\"memory-safe\\\") {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\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 unchecked {\\n return prod0 / denominator;\\n }\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n if (prod1 >= denominator) {\\n revert PRBMath_MulDiv_Overflow(x, y, denominator);\\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 (\\\"memory-safe\\\") {\\n // Compute remainder using the mulmod Yul instruction.\\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 unchecked {\\n // Calculate the largest power of two divisor of the denominator using the unary operator ~. This operation cannot overflow\\n // because the denominator cannot be zero at this point in the function execution. The result is always >= 1.\\n // For more detail, see https://cs.stackexchange.com/q/138556/92363.\\n uint256 lpotdod = denominator & (~denominator + 1);\\n uint256 flippedLpotdod;\\n\\n assembly (\\\"memory-safe\\\") {\\n // Factor powers of two out of denominator.\\n denominator := div(denominator, lpotdod)\\n\\n // Divide [prod1 prod0] by lpotdod.\\n prod0 := div(prod0, lpotdod)\\n\\n // Get the flipped value `2^256 / lpotdod`. If the `lpotdod` is zero, the flipped value is one.\\n // `sub(0, lpotdod)` produces the two's complement version of `lpotdod`, which is equivalent to flipping all the bits.\\n // However, `div` interprets this value as an unsigned value: https://ethereum.stackexchange.com/q/147168/24693\\n flippedLpotdod := add(div(sub(0, lpotdod), lpotdod), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * flippedLpotdod;\\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 works\\n // 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 }\\n}\\n\\n/// @notice Calculates x*y\\u00f71e18 with 512-bit precision.\\n///\\n/// @dev A variant of {mulDiv} with constant folding, i.e. in which the denominator is hard coded to 1e18.\\n///\\n/// Notes:\\n/// - The body is purposely left uncommented; to understand how this works, see the documentation in {mulDiv}.\\n/// - The result is rounded toward zero.\\n/// - We take as an axiom that the result cannot be `MAX_UINT256` when x and y solve the following system of equations:\\n///\\n/// $$\\n/// \\\\begin{cases}\\n/// x * y = MAX\\\\_UINT256 * UNIT \\\\\\\\\\n/// (x * y) \\\\% UNIT \\\\geq \\\\frac{UNIT}{2}\\n/// \\\\end{cases}\\n/// $$\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {mulDiv}.\\n/// - The result must fit in uint256.\\n///\\n/// @param x The multiplicand as an unsigned 60.18-decimal fixed-point number.\\n/// @param y The multiplier as an unsigned 60.18-decimal fixed-point number.\\n/// @return result The result as an unsigned 60.18-decimal fixed-point number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mulDiv18(uint256 x, uint256 y) pure returns (uint256 result) {\\n uint256 prod0;\\n uint256 prod1;\\n assembly (\\\"memory-safe\\\") {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n if (prod1 == 0) {\\n unchecked {\\n return prod0 / UNIT;\\n }\\n }\\n\\n if (prod1 >= UNIT) {\\n revert PRBMath_MulDiv18_Overflow(x, y);\\n }\\n\\n uint256 remainder;\\n assembly (\\\"memory-safe\\\") {\\n remainder := mulmod(x, y, UNIT)\\n result :=\\n mul(\\n or(\\n div(sub(prod0, remainder), UNIT_LPOTD),\\n mul(sub(prod1, gt(remainder, prod0)), add(div(sub(0, UNIT_LPOTD), UNIT_LPOTD), 1))\\n ),\\n UNIT_INVERSE\\n )\\n }\\n}\\n\\n/// @notice Calculates x*y\\u00f7denominator with 512-bit precision.\\n///\\n/// @dev This is an extension of {mulDiv} for signed numbers, which works by computing the signs and the absolute values separately.\\n///\\n/// Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {mulDiv}.\\n/// - None of the inputs can be `type(int256).min`.\\n/// - The result must fit in int256.\\n///\\n/// @param x The multiplicand as an int256.\\n/// @param y The multiplier as an int256.\\n/// @param denominator The divisor as an int256.\\n/// @return result The result as an int256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mulDivSigned(int256 x, int256 y, int256 denominator) pure returns (int256 result) {\\n if (x == type(int256).min || y == type(int256).min || denominator == type(int256).min) {\\n revert PRBMath_MulDivSigned_InputTooSmall();\\n }\\n\\n // Get hold of the absolute values of x, y and the denominator.\\n uint256 xAbs;\\n uint256 yAbs;\\n uint256 dAbs;\\n unchecked {\\n xAbs = x < 0 ? uint256(-x) : uint256(x);\\n yAbs = y < 0 ? uint256(-y) : uint256(y);\\n dAbs = denominator < 0 ? uint256(-denominator) : uint256(denominator);\\n }\\n\\n // Compute the absolute value of x*y\\u00f7denominator. The result must fit in int256.\\n uint256 resultAbs = mulDiv(xAbs, yAbs, dAbs);\\n if (resultAbs > uint256(type(int256).max)) {\\n revert PRBMath_MulDivSigned_Overflow(x, y);\\n }\\n\\n // Get the signs of x, y and the denominator.\\n uint256 sx;\\n uint256 sy;\\n uint256 sd;\\n assembly (\\\"memory-safe\\\") {\\n // \\\"sgt\\\" is the \\\"signed greater than\\\" assembly instruction and \\\"sub(0,1)\\\" is -1 in two's complement.\\n sx := sgt(x, sub(0, 1))\\n sy := sgt(y, sub(0, 1))\\n sd := sgt(denominator, sub(0, 1))\\n }\\n\\n // XOR over sx, sy and sd. What this does is to check whether there are 1 or 3 negative signs in the inputs.\\n // If there are, the result should be negative. Otherwise, it should be positive.\\n unchecked {\\n result = sx ^ sy ^ sd == 0 ? -int256(resultAbs) : int256(resultAbs);\\n }\\n}\\n\\n/// @notice Calculates the square root of x using the Babylonian method.\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\\n///\\n/// Notes:\\n/// - If x is not a perfect square, the result is rounded down.\\n/// - Credits to OpenZeppelin for the explanations in comments below.\\n///\\n/// @param x The uint256 number for which to calculate the square root.\\n/// @return result The result as a uint256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction sqrt(uint256 x) pure returns (uint256 result) {\\n if (x == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we calculate the biggest power of 2 which is smaller than the square root of x.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of x is a power of 2 such that we have:\\n //\\n // $$\\n // msb(x) <= x <= 2*msb(x)$\\n // $$\\n //\\n // We write $msb(x)$ as $2^k$, and we get:\\n //\\n // $$\\n // k = log_2(x)\\n // $$\\n //\\n // Thus, we can write the initial inequality as:\\n //\\n // $$\\n // 2^{log_2(x)} <= x <= 2*2^{log_2(x)+1} \\\\\\\\\\n // sqrt(2^k) <= sqrt(x) < sqrt(2^{k+1}) \\\\\\\\\\n // 2^{k/2} <= sqrt(x) < 2^{(k+1)/2} <= 2^{(k/2)+1}\\n // $$\\n //\\n // Consequently, $2^{log_2(x) /2} is a good first approximation of sqrt(x) with at least one correct bit.\\n uint256 xAux = uint256(x);\\n result = 1;\\n if (xAux >= 2 ** 128) {\\n xAux >>= 128;\\n result <<= 64;\\n }\\n if (xAux >= 2 ** 64) {\\n xAux >>= 64;\\n result <<= 32;\\n }\\n if (xAux >= 2 ** 32) {\\n xAux >>= 32;\\n result <<= 16;\\n }\\n if (xAux >= 2 ** 16) {\\n xAux >>= 16;\\n result <<= 8;\\n }\\n if (xAux >= 2 ** 8) {\\n xAux >>= 8;\\n result <<= 4;\\n }\\n if (xAux >= 2 ** 4) {\\n xAux >>= 4;\\n result <<= 2;\\n }\\n if (xAux >= 2 ** 2) {\\n result <<= 1;\\n }\\n\\n // At this point, `result` is an estimation with at least one bit of precision. We know the true value has at\\n // most 128 bits, since it is the square root of a uint256. Newton's method converges quadratically (precision\\n // doubles at every iteration). We thus need at most 7 iteration to turn our partial result with one bit of\\n // precision into the expected uint128 result.\\n unchecked {\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n\\n // If x is not a perfect square, round the result toward zero.\\n uint256 roundedResult = x / result;\\n if (result >= roundedResult) {\\n result = roundedResult;\\n }\\n }\\n}\\n\",\"keccak256\":\"0xaa374e2c26cc93e8c22a6953804ee05f811597ef5fa82f76824378b22944778b\",\"license\":\"MIT\"},\"@prb/math/src/UD2x18.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\n/*\\n\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2550\\u2550\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2554\\u2588\\u2588\\u2588\\u2588\\u2554\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551 \\u255a\\u2550\\u255d \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\n\\n\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2550\\u2550\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d \\u255a\\u2588\\u2588\\u2588\\u2554\\u255d \\u255a\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u255d\\n\\n*/\\n\\nimport \\\"./ud2x18/Casting.sol\\\";\\nimport \\\"./ud2x18/Constants.sol\\\";\\nimport \\\"./ud2x18/Errors.sol\\\";\\nimport \\\"./ud2x18/ValueType.sol\\\";\\n\",\"keccak256\":\"0xfb624e24cd8bb790fa08e7827819de85504a86e20e961fa4ad126c65b6d90641\",\"license\":\"MIT\"},\"@prb/math/src/UD60x18.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\n/*\\n\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2550\\u2550\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2554\\u2588\\u2588\\u2588\\u2588\\u2554\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551 \\u255a\\u2550\\u255d \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\n\\n\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2550\\u2588\\u2588\\u2588\\u2588\\u2557\\u255a\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2588\\u2588\\u2551 \\u255a\\u2588\\u2588\\u2588\\u2554\\u255d \\u255a\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2554\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2554\\u255d \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u255d\\n\\n*/\\n\\nimport \\\"./ud60x18/Casting.sol\\\";\\nimport \\\"./ud60x18/Constants.sol\\\";\\nimport \\\"./ud60x18/Conversions.sol\\\";\\nimport \\\"./ud60x18/Errors.sol\\\";\\nimport \\\"./ud60x18/Helpers.sol\\\";\\nimport \\\"./ud60x18/Math.sol\\\";\\nimport \\\"./ud60x18/ValueType.sol\\\";\\n\",\"keccak256\":\"0xb98c6f74275914d279e8af6c502c2b1f50d5f6e1ed418d3b0153f5a193206c48\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as CastingErrors;\\nimport { SD59x18 } from \\\"../sd59x18/ValueType.sol\\\";\\nimport { UD2x18 } from \\\"../ud2x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"../ud60x18/ValueType.sol\\\";\\nimport { SD1x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts an SD1x18 number into SD59x18.\\n/// @dev There is no overflow check because the domain of SD1x18 is a subset of SD59x18.\\nfunction intoSD59x18(SD1x18 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(int256(SD1x18.unwrap(x)));\\n}\\n\\n/// @notice Casts an SD1x18 number into UD2x18.\\n/// - x must be positive.\\nfunction intoUD2x18(SD1x18 x) pure returns (UD2x18 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUD2x18_Underflow(x);\\n }\\n result = UD2x18.wrap(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into UD60x18.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUD60x18(SD1x18 x) pure returns (UD60x18 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUD60x18_Underflow(x);\\n }\\n result = UD60x18.wrap(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into uint256.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUint256(SD1x18 x) pure returns (uint256 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint256_Underflow(x);\\n }\\n result = uint256(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into uint128.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUint128(SD1x18 x) pure returns (uint128 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint128_Underflow(x);\\n }\\n result = uint128(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(SD1x18 x) pure returns (uint40 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint40_Underflow(x);\\n }\\n if (xInt > int64(uint64(Common.MAX_UINT40))) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint40_Overflow(x);\\n }\\n result = uint40(uint64(xInt));\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction sd1x18(int64 x) pure returns (SD1x18 result) {\\n result = SD1x18.wrap(x);\\n}\\n\\n/// @notice Unwraps an SD1x18 number into int64.\\nfunction unwrap(SD1x18 x) pure returns (int64 result) {\\n result = SD1x18.unwrap(x);\\n}\\n\\n/// @notice Wraps an int64 number into SD1x18.\\nfunction wrap(int64 x) pure returns (SD1x18 result) {\\n result = SD1x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x9e49e2b37c1bb845861740805edaaef3fe951a7b96eef16ce84fbf76e8278670\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD1x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @dev Euler's number as an SD1x18 number.\\nSD1x18 constant E = SD1x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum value an SD1x18 number can have.\\nint64 constant uMAX_SD1x18 = 9_223372036854775807;\\nSD1x18 constant MAX_SD1x18 = SD1x18.wrap(uMAX_SD1x18);\\n\\n/// @dev The maximum value an SD1x18 number can have.\\nint64 constant uMIN_SD1x18 = -9_223372036854775808;\\nSD1x18 constant MIN_SD1x18 = SD1x18.wrap(uMIN_SD1x18);\\n\\n/// @dev PI as an SD1x18 number.\\nSD1x18 constant PI = SD1x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of SD1x18.\\nSD1x18 constant UNIT = SD1x18.wrap(1e18);\\nint64 constant uUNIT = 1e18;\\n\",\"keccak256\":\"0x6496165b80552785a4b65a239b96e2a5fedf62fe54f002eeed72d75e566d7585\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD1x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in UD2x18.\\nerror PRBMath_SD1x18_ToUD2x18_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in UD60x18.\\nerror PRBMath_SD1x18_ToUD60x18_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint128.\\nerror PRBMath_SD1x18_ToUint128_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint256.\\nerror PRBMath_SD1x18_ToUint256_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint40.\\nerror PRBMath_SD1x18_ToUint40_Overflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint40.\\nerror PRBMath_SD1x18_ToUint40_Underflow(SD1x18 x);\\n\",\"keccak256\":\"0x836cb42ba619ca369fd4765bc47fefc3c3621369c5861882af14660aca5057ee\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\n\\n/// @notice The signed 1.18-decimal fixed-point number representation, which can have up to 1 digit and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\\n/// type int64. This is useful when end users want to use int64 to save gas, e.g. with tight variable packing in contract\\n/// storage.\\ntype SD1x18 is int64;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoSD59x18,\\n Casting.intoUD2x18,\\n Casting.intoUD60x18,\\n Casting.intoUint256,\\n Casting.intoUint128,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for SD1x18 global;\\n\",\"keccak256\":\"0x2f86f1aa9fca42f40808b51a879b406ac51817647bdb9642f8a79dd8fdb754a7\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Errors.sol\\\" as CastingErrors;\\nimport { MAX_UINT128, MAX_UINT40 } from \\\"../Common.sol\\\";\\nimport { uMAX_SD1x18, uMIN_SD1x18 } from \\\"../sd1x18/Constants.sol\\\";\\nimport { SD1x18 } from \\\"../sd1x18/ValueType.sol\\\";\\nimport { uMAX_UD2x18 } from \\\"../ud2x18/Constants.sol\\\";\\nimport { UD2x18 } from \\\"../ud2x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"../ud60x18/ValueType.sol\\\";\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts an SD59x18 number into int256.\\n/// @dev This is basically a functional alias for {unwrap}.\\nfunction intoInt256(SD59x18 x) pure returns (int256 result) {\\n result = SD59x18.unwrap(x);\\n}\\n\\n/// @notice Casts an SD59x18 number into SD1x18.\\n/// @dev Requirements:\\n/// - x must be greater than or equal to `uMIN_SD1x18`.\\n/// - x must be less than or equal to `uMAX_SD1x18`.\\nfunction intoSD1x18(SD59x18 x) pure returns (SD1x18 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < uMIN_SD1x18) {\\n revert CastingErrors.PRBMath_SD59x18_IntoSD1x18_Underflow(x);\\n }\\n if (xInt > uMAX_SD1x18) {\\n revert CastingErrors.PRBMath_SD59x18_IntoSD1x18_Overflow(x);\\n }\\n result = SD1x18.wrap(int64(xInt));\\n}\\n\\n/// @notice Casts an SD59x18 number into UD2x18.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `uMAX_UD2x18`.\\nfunction intoUD2x18(SD59x18 x) pure returns (UD2x18 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUD2x18_Underflow(x);\\n }\\n if (xInt > int256(uint256(uMAX_UD2x18))) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUD2x18_Overflow(x);\\n }\\n result = UD2x18.wrap(uint64(uint256(xInt)));\\n}\\n\\n/// @notice Casts an SD59x18 number into UD60x18.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUD60x18(SD59x18 x) pure returns (UD60x18 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUD60x18_Underflow(x);\\n }\\n result = UD60x18.wrap(uint256(xInt));\\n}\\n\\n/// @notice Casts an SD59x18 number into uint256.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUint256(SD59x18 x) pure returns (uint256 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint256_Underflow(x);\\n }\\n result = uint256(xInt);\\n}\\n\\n/// @notice Casts an SD59x18 number into uint128.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `uMAX_UINT128`.\\nfunction intoUint128(SD59x18 x) pure returns (uint128 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint128_Underflow(x);\\n }\\n if (xInt > int256(uint256(MAX_UINT128))) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint128_Overflow(x);\\n }\\n result = uint128(uint256(xInt));\\n}\\n\\n/// @notice Casts an SD59x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(SD59x18 x) pure returns (uint40 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint40_Underflow(x);\\n }\\n if (xInt > int256(uint256(MAX_UINT40))) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint40_Overflow(x);\\n }\\n result = uint40(uint256(xInt));\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction sd(int256 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(x);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction sd59x18(int256 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(x);\\n}\\n\\n/// @notice Unwraps an SD59x18 number into int256.\\nfunction unwrap(SD59x18 x) pure returns (int256 result) {\\n result = SD59x18.unwrap(x);\\n}\\n\\n/// @notice Wraps an int256 number into SD59x18.\\nfunction wrap(int256 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x3b21b60ec2998c3ae32f647412da51d3683b3f183a807198cc8d157499484f99\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n// NOTICE: the \\\"u\\\" prefix stands for \\\"unwrapped\\\".\\n\\n/// @dev Euler's number as an SD59x18 number.\\nSD59x18 constant E = SD59x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum input permitted in {exp}.\\nint256 constant uEXP_MAX_INPUT = 133_084258667509499440;\\nSD59x18 constant EXP_MAX_INPUT = SD59x18.wrap(uEXP_MAX_INPUT);\\n\\n/// @dev Any value less than this returns 0 in {exp}.\\nint256 constant uEXP_MIN_THRESHOLD = -41_446531673892822322;\\nSD59x18 constant EXP_MIN_THRESHOLD = SD59x18.wrap(uEXP_MIN_THRESHOLD);\\n\\n/// @dev The maximum input permitted in {exp2}.\\nint256 constant uEXP2_MAX_INPUT = 192e18 - 1;\\nSD59x18 constant EXP2_MAX_INPUT = SD59x18.wrap(uEXP2_MAX_INPUT);\\n\\n/// @dev Any value less than this returns 0 in {exp2}.\\nint256 constant uEXP2_MIN_THRESHOLD = -59_794705707972522261;\\nSD59x18 constant EXP2_MIN_THRESHOLD = SD59x18.wrap(uEXP2_MIN_THRESHOLD);\\n\\n/// @dev Half the UNIT number.\\nint256 constant uHALF_UNIT = 0.5e18;\\nSD59x18 constant HALF_UNIT = SD59x18.wrap(uHALF_UNIT);\\n\\n/// @dev $log_2(10)$ as an SD59x18 number.\\nint256 constant uLOG2_10 = 3_321928094887362347;\\nSD59x18 constant LOG2_10 = SD59x18.wrap(uLOG2_10);\\n\\n/// @dev $log_2(e)$ as an SD59x18 number.\\nint256 constant uLOG2_E = 1_442695040888963407;\\nSD59x18 constant LOG2_E = SD59x18.wrap(uLOG2_E);\\n\\n/// @dev The maximum value an SD59x18 number can have.\\nint256 constant uMAX_SD59x18 = 57896044618658097711785492504343953926634992332820282019728_792003956564819967;\\nSD59x18 constant MAX_SD59x18 = SD59x18.wrap(uMAX_SD59x18);\\n\\n/// @dev The maximum whole value an SD59x18 number can have.\\nint256 constant uMAX_WHOLE_SD59x18 = 57896044618658097711785492504343953926634992332820282019728_000000000000000000;\\nSD59x18 constant MAX_WHOLE_SD59x18 = SD59x18.wrap(uMAX_WHOLE_SD59x18);\\n\\n/// @dev The minimum value an SD59x18 number can have.\\nint256 constant uMIN_SD59x18 = -57896044618658097711785492504343953926634992332820282019728_792003956564819968;\\nSD59x18 constant MIN_SD59x18 = SD59x18.wrap(uMIN_SD59x18);\\n\\n/// @dev The minimum whole value an SD59x18 number can have.\\nint256 constant uMIN_WHOLE_SD59x18 = -57896044618658097711785492504343953926634992332820282019728_000000000000000000;\\nSD59x18 constant MIN_WHOLE_SD59x18 = SD59x18.wrap(uMIN_WHOLE_SD59x18);\\n\\n/// @dev PI as an SD59x18 number.\\nSD59x18 constant PI = SD59x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of SD59x18.\\nint256 constant uUNIT = 1e18;\\nSD59x18 constant UNIT = SD59x18.wrap(1e18);\\n\\n/// @dev The unit number squared.\\nint256 constant uUNIT_SQUARED = 1e36;\\nSD59x18 constant UNIT_SQUARED = SD59x18.wrap(uUNIT_SQUARED);\\n\\n/// @dev Zero as an SD59x18 number.\\nSD59x18 constant ZERO = SD59x18.wrap(0);\\n\",\"keccak256\":\"0x9bcb8dd6b3e886d140ad1c32747a4f6d29a492529ceb835be878ae837aa6cc3a\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when taking the absolute value of `MIN_SD59x18`.\\nerror PRBMath_SD59x18_Abs_MinSD59x18();\\n\\n/// @notice Thrown when ceiling a number overflows SD59x18.\\nerror PRBMath_SD59x18_Ceil_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when converting a basic integer to the fixed-point format overflows SD59x18.\\nerror PRBMath_SD59x18_Convert_Overflow(int256 x);\\n\\n/// @notice Thrown when converting a basic integer to the fixed-point format underflows SD59x18.\\nerror PRBMath_SD59x18_Convert_Underflow(int256 x);\\n\\n/// @notice Thrown when dividing two numbers and one of them is `MIN_SD59x18`.\\nerror PRBMath_SD59x18_Div_InputTooSmall();\\n\\n/// @notice Thrown when dividing two numbers and one of the intermediary unsigned results overflows SD59x18.\\nerror PRBMath_SD59x18_Div_Overflow(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when taking the natural exponent of a base greater than 133_084258667509499441.\\nerror PRBMath_SD59x18_Exp_InputTooBig(SD59x18 x);\\n\\n/// @notice Thrown when taking the binary exponent of a base greater than 192e18.\\nerror PRBMath_SD59x18_Exp2_InputTooBig(SD59x18 x);\\n\\n/// @notice Thrown when flooring a number underflows SD59x18.\\nerror PRBMath_SD59x18_Floor_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when taking the geometric mean of two numbers and their product is negative.\\nerror PRBMath_SD59x18_Gm_NegativeProduct(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when taking the geometric mean of two numbers and multiplying them overflows SD59x18.\\nerror PRBMath_SD59x18_Gm_Overflow(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\\nerror PRBMath_SD59x18_IntoSD1x18_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\\nerror PRBMath_SD59x18_IntoSD1x18_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\\nerror PRBMath_SD59x18_IntoUD2x18_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\\nerror PRBMath_SD59x18_IntoUD2x18_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD60x18.\\nerror PRBMath_SD59x18_IntoUD60x18_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\\nerror PRBMath_SD59x18_IntoUint128_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\\nerror PRBMath_SD59x18_IntoUint128_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint256.\\nerror PRBMath_SD59x18_IntoUint256_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\\nerror PRBMath_SD59x18_IntoUint40_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\\nerror PRBMath_SD59x18_IntoUint40_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when taking the logarithm of a number less than or equal to zero.\\nerror PRBMath_SD59x18_Log_InputTooSmall(SD59x18 x);\\n\\n/// @notice Thrown when multiplying two numbers and one of the inputs is `MIN_SD59x18`.\\nerror PRBMath_SD59x18_Mul_InputTooSmall();\\n\\n/// @notice Thrown when multiplying two numbers and the intermediary absolute result overflows SD59x18.\\nerror PRBMath_SD59x18_Mul_Overflow(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when raising a number to a power and the intermediary absolute result overflows SD59x18.\\nerror PRBMath_SD59x18_Powu_Overflow(SD59x18 x, uint256 y);\\n\\n/// @notice Thrown when taking the square root of a negative number.\\nerror PRBMath_SD59x18_Sqrt_NegativeInput(SD59x18 x);\\n\\n/// @notice Thrown when the calculating the square root overflows SD59x18.\\nerror PRBMath_SD59x18_Sqrt_Overflow(SD59x18 x);\\n\",\"keccak256\":\"0xa6d00fe5efa215ac0df25c896e3da99a12fb61e799644b2ec32da947313d3db4\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Helpers.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { wrap } from \\\"./Casting.sol\\\";\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Implements the checked addition operation (+) in the SD59x18 type.\\nfunction add(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n return wrap(x.unwrap() + y.unwrap());\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the SD59x18 type.\\nfunction and(SD59x18 x, int256 bits) pure returns (SD59x18 result) {\\n return wrap(x.unwrap() & bits);\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the SD59x18 type.\\nfunction and2(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n return wrap(x.unwrap() & y.unwrap());\\n}\\n\\n/// @notice Implements the equal (=) operation in the SD59x18 type.\\nfunction eq(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() == y.unwrap();\\n}\\n\\n/// @notice Implements the greater than operation (>) in the SD59x18 type.\\nfunction gt(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() > y.unwrap();\\n}\\n\\n/// @notice Implements the greater than or equal to operation (>=) in the SD59x18 type.\\nfunction gte(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() >= y.unwrap();\\n}\\n\\n/// @notice Implements a zero comparison check function in the SD59x18 type.\\nfunction isZero(SD59x18 x) pure returns (bool result) {\\n result = x.unwrap() == 0;\\n}\\n\\n/// @notice Implements the left shift operation (<<) in the SD59x18 type.\\nfunction lshift(SD59x18 x, uint256 bits) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() << bits);\\n}\\n\\n/// @notice Implements the lower than operation (<) in the SD59x18 type.\\nfunction lt(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() < y.unwrap();\\n}\\n\\n/// @notice Implements the lower than or equal to operation (<=) in the SD59x18 type.\\nfunction lte(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() <= y.unwrap();\\n}\\n\\n/// @notice Implements the unchecked modulo operation (%) in the SD59x18 type.\\nfunction mod(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() % y.unwrap());\\n}\\n\\n/// @notice Implements the not equal operation (!=) in the SD59x18 type.\\nfunction neq(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() != y.unwrap();\\n}\\n\\n/// @notice Implements the NOT (~) bitwise operation in the SD59x18 type.\\nfunction not(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(~x.unwrap());\\n}\\n\\n/// @notice Implements the OR (|) bitwise operation in the SD59x18 type.\\nfunction or(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() | y.unwrap());\\n}\\n\\n/// @notice Implements the right shift operation (>>) in the SD59x18 type.\\nfunction rshift(SD59x18 x, uint256 bits) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() >> bits);\\n}\\n\\n/// @notice Implements the checked subtraction operation (-) in the SD59x18 type.\\nfunction sub(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() - y.unwrap());\\n}\\n\\n/// @notice Implements the checked unary minus operation (-) in the SD59x18 type.\\nfunction unary(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(-x.unwrap());\\n}\\n\\n/// @notice Implements the unchecked addition operation (+) in the SD59x18 type.\\nfunction uncheckedAdd(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() + y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the unchecked subtraction operation (-) in the SD59x18 type.\\nfunction uncheckedSub(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() - y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the unchecked unary minus operation (-) in the SD59x18 type.\\nfunction uncheckedUnary(SD59x18 x) pure returns (SD59x18 result) {\\n unchecked {\\n result = wrap(-x.unwrap());\\n }\\n}\\n\\n/// @notice Implements the XOR (^) bitwise operation in the SD59x18 type.\\nfunction xor(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() ^ y.unwrap());\\n}\\n\",\"keccak256\":\"0x208570f1657cf730cb6c3d81aa14030e0d45cf906cdedea5059369d7df4bb716\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as Errors;\\nimport {\\n uEXP_MAX_INPUT,\\n uEXP2_MAX_INPUT,\\n uEXP_MIN_THRESHOLD,\\n uEXP2_MIN_THRESHOLD,\\n uHALF_UNIT,\\n uLOG2_10,\\n uLOG2_E,\\n uMAX_SD59x18,\\n uMAX_WHOLE_SD59x18,\\n uMIN_SD59x18,\\n uMIN_WHOLE_SD59x18,\\n UNIT,\\n uUNIT,\\n uUNIT_SQUARED,\\n ZERO\\n} from \\\"./Constants.sol\\\";\\nimport { wrap } from \\\"./Helpers.sol\\\";\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Calculates the absolute value of x.\\n///\\n/// @dev Requirements:\\n/// - x must be greater than `MIN_SD59x18`.\\n///\\n/// @param x The SD59x18 number for which to calculate the absolute value.\\n/// @param result The absolute value of x as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction abs(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt == uMIN_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Abs_MinSD59x18();\\n }\\n result = xInt < 0 ? wrap(-xInt) : x;\\n}\\n\\n/// @notice Calculates the arithmetic average of x and y.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// @param x The first operand as an SD59x18 number.\\n/// @param y The second operand as an SD59x18 number.\\n/// @return result The arithmetic average as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction avg(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n\\n unchecked {\\n // This operation is equivalent to `x / 2 + y / 2`, and it can never overflow.\\n int256 sum = (xInt >> 1) + (yInt >> 1);\\n\\n if (sum < 0) {\\n // If at least one of x and y is odd, add 1 to the result, because shifting negative numbers to the right\\n // rounds toward negative infinity. The right part is equivalent to `sum + (x % 2 == 1 || y % 2 == 1)`.\\n assembly (\\\"memory-safe\\\") {\\n result := add(sum, and(or(xInt, yInt), 1))\\n }\\n } else {\\n // Add 1 if both x and y are odd to account for the double 0.5 remainder truncated after shifting.\\n result = wrap(sum + (xInt & yInt & 1));\\n }\\n }\\n}\\n\\n/// @notice Yields the smallest whole number greater than or equal to x.\\n///\\n/// @dev Optimized for fractional value inputs, because every whole value has (1e18 - 1) fractional counterparts.\\n/// See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n///\\n/// Requirements:\\n/// - x must be less than or equal to `MAX_WHOLE_SD59x18`.\\n///\\n/// @param x The SD59x18 number to ceil.\\n/// @param result The smallest whole number greater than or equal to x, as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ceil(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt > uMAX_WHOLE_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Ceil_Overflow(x);\\n }\\n\\n int256 remainder = xInt % uUNIT;\\n if (remainder == 0) {\\n result = x;\\n } else {\\n unchecked {\\n // Solidity uses C fmod style, which returns a modulus with the same sign as x.\\n int256 resultInt = xInt - remainder;\\n if (xInt > 0) {\\n resultInt += uUNIT;\\n }\\n result = wrap(resultInt);\\n }\\n }\\n}\\n\\n/// @notice Divides two SD59x18 numbers, returning a new SD59x18 number.\\n///\\n/// @dev This is an extension of {Common.mulDiv} for signed numbers, which works by computing the signs and the absolute\\n/// values separately.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv}.\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv}.\\n/// - None of the inputs can be `MIN_SD59x18`.\\n/// - The denominator must not be zero.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The numerator as an SD59x18 number.\\n/// @param y The denominator as an SD59x18 number.\\n/// @param result The quotient as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction div(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n if (xInt == uMIN_SD59x18 || yInt == uMIN_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Div_InputTooSmall();\\n }\\n\\n // Get hold of the absolute values of x and y.\\n uint256 xAbs;\\n uint256 yAbs;\\n unchecked {\\n xAbs = xInt < 0 ? uint256(-xInt) : uint256(xInt);\\n yAbs = yInt < 0 ? uint256(-yInt) : uint256(yInt);\\n }\\n\\n // Compute the absolute value (x*UNIT\\u00f7y). The resulting value must fit in SD59x18.\\n uint256 resultAbs = Common.mulDiv(xAbs, uint256(uUNIT), yAbs);\\n if (resultAbs > uint256(uMAX_SD59x18)) {\\n revert Errors.PRBMath_SD59x18_Div_Overflow(x, y);\\n }\\n\\n // Check if x and y have the same sign using two's complement representation. The left-most bit represents the sign (1 for\\n // negative, 0 for positive or zero).\\n bool sameSign = (xInt ^ yInt) > -1;\\n\\n // If the inputs have the same sign, the result should be positive. Otherwise, it should be negative.\\n unchecked {\\n result = wrap(sameSign ? int256(resultAbs) : -int256(resultAbs));\\n }\\n}\\n\\n/// @notice Calculates the natural exponent of x using the following formula:\\n///\\n/// $$\\n/// e^x = 2^{x * log_2{e}}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {exp2}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {exp2}.\\n/// - x must be less than 133_084258667509499441.\\n///\\n/// @param x The exponent as an SD59x18 number.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n\\n // Any input less than the threshold returns zero.\\n // This check also prevents an overflow for very small numbers.\\n if (xInt < uEXP_MIN_THRESHOLD) {\\n return ZERO;\\n }\\n\\n // This check prevents values greater than 192e18 from being passed to {exp2}.\\n if (xInt > uEXP_MAX_INPUT) {\\n revert Errors.PRBMath_SD59x18_Exp_InputTooBig(x);\\n }\\n\\n unchecked {\\n // Inline the fixed-point multiplication to save gas.\\n int256 doubleUnitProduct = xInt * uLOG2_E;\\n result = exp2(wrap(doubleUnitProduct / uUNIT));\\n }\\n}\\n\\n/// @notice Calculates the binary exponent of x using the binary fraction method using the following formula:\\n///\\n/// $$\\n/// 2^{-x} = \\\\frac{1}{2^x}\\n/// $$\\n///\\n/// @dev See https://ethereum.stackexchange.com/q/79903/24693.\\n///\\n/// Notes:\\n/// - If x is less than -59_794705707972522261, the result is zero.\\n///\\n/// Requirements:\\n/// - x must be less than 192e18.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The exponent as an SD59x18 number.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp2(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < 0) {\\n // The inverse of any number less than the threshold is truncated to zero.\\n if (xInt < uEXP2_MIN_THRESHOLD) {\\n return ZERO;\\n }\\n\\n unchecked {\\n // Inline the fixed-point inversion to save gas.\\n result = wrap(uUNIT_SQUARED / exp2(wrap(-xInt)).unwrap());\\n }\\n } else {\\n // Numbers greater than or equal to 192e18 don't fit in the 192.64-bit format.\\n if (xInt > uEXP2_MAX_INPUT) {\\n revert Errors.PRBMath_SD59x18_Exp2_InputTooBig(x);\\n }\\n\\n unchecked {\\n // Convert x to the 192.64-bit fixed-point format.\\n uint256 x_192x64 = uint256((xInt << 64) / uUNIT);\\n\\n // It is safe to cast the result to int256 due to the checks above.\\n result = wrap(int256(Common.exp2(x_192x64)));\\n }\\n }\\n}\\n\\n/// @notice Yields the greatest whole number less than or equal to x.\\n///\\n/// @dev Optimized for fractional value inputs, because for every whole value there are (1e18 - 1) fractional\\n/// counterparts. See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n///\\n/// Requirements:\\n/// - x must be greater than or equal to `MIN_WHOLE_SD59x18`.\\n///\\n/// @param x The SD59x18 number to floor.\\n/// @param result The greatest whole number less than or equal to x, as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction floor(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < uMIN_WHOLE_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Floor_Underflow(x);\\n }\\n\\n int256 remainder = xInt % uUNIT;\\n if (remainder == 0) {\\n result = x;\\n } else {\\n unchecked {\\n // Solidity uses C fmod style, which returns a modulus with the same sign as x.\\n int256 resultInt = xInt - remainder;\\n if (xInt < 0) {\\n resultInt -= uUNIT;\\n }\\n result = wrap(resultInt);\\n }\\n }\\n}\\n\\n/// @notice Yields the excess beyond the floor of x for positive numbers and the part of the number to the right.\\n/// of the radix point for negative numbers.\\n/// @dev Based on the odd function definition. https://en.wikipedia.org/wiki/Fractional_part\\n/// @param x The SD59x18 number to get the fractional part of.\\n/// @param result The fractional part of x as an SD59x18 number.\\nfunction frac(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() % uUNIT);\\n}\\n\\n/// @notice Calculates the geometric mean of x and y, i.e. $\\\\sqrt{x * y}$.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x * y must fit in SD59x18.\\n/// - x * y must not be negative, since complex numbers are not supported.\\n///\\n/// @param x The first operand as an SD59x18 number.\\n/// @param y The second operand as an SD59x18 number.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction gm(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n if (xInt == 0 || yInt == 0) {\\n return ZERO;\\n }\\n\\n unchecked {\\n // Equivalent to `xy / x != y`. Checking for overflow this way is faster than letting Solidity do it.\\n int256 xyInt = xInt * yInt;\\n if (xyInt / xInt != yInt) {\\n revert Errors.PRBMath_SD59x18_Gm_Overflow(x, y);\\n }\\n\\n // The product must not be negative, since complex numbers are not supported.\\n if (xyInt < 0) {\\n revert Errors.PRBMath_SD59x18_Gm_NegativeProduct(x, y);\\n }\\n\\n // We don't need to multiply the result by `UNIT` here because the x*y product picked up a factor of `UNIT`\\n // during multiplication. See the comments in {Common.sqrt}.\\n uint256 resultUint = Common.sqrt(uint256(xyInt));\\n result = wrap(int256(resultUint));\\n }\\n}\\n\\n/// @notice Calculates the inverse of x.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x must not be zero.\\n///\\n/// @param x The SD59x18 number for which to calculate the inverse.\\n/// @return result The inverse as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction inv(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(uUNIT_SQUARED / x.unwrap());\\n}\\n\\n/// @notice Calculates the natural logarithm of x using the following formula:\\n///\\n/// $$\\n/// ln{x} = log_2{x} / log_2{e}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n/// - The precision isn't sufficiently fine-grained to return exactly `UNIT` when the input is `E`.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The SD59x18 number for which to calculate the natural logarithm.\\n/// @return result The natural logarithm as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ln(SD59x18 x) pure returns (SD59x18 result) {\\n // Inline the fixed-point multiplication to save gas. This is overflow-safe because the maximum value that\\n // {log2} can return is ~195_205294292027477728.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_E);\\n}\\n\\n/// @notice Calculates the common logarithm of x using the following formula:\\n///\\n/// $$\\n/// log_{10}{x} = log_2{x} / log_2{10}\\n/// $$\\n///\\n/// However, if x is an exact power of ten, a hard coded value is returned.\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The SD59x18 number for which to calculate the common logarithm.\\n/// @return result The common logarithm as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log10(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < 0) {\\n revert Errors.PRBMath_SD59x18_Log_InputTooSmall(x);\\n }\\n\\n // Note that the `mul` in this block is the standard multiplication operation, not {SD59x18.mul}.\\n // prettier-ignore\\n assembly (\\\"memory-safe\\\") {\\n switch x\\n case 1 { result := mul(uUNIT, sub(0, 18)) }\\n case 10 { result := mul(uUNIT, sub(1, 18)) }\\n case 100 { result := mul(uUNIT, sub(2, 18)) }\\n case 1000 { result := mul(uUNIT, sub(3, 18)) }\\n case 10000 { result := mul(uUNIT, sub(4, 18)) }\\n case 100000 { result := mul(uUNIT, sub(5, 18)) }\\n case 1000000 { result := mul(uUNIT, sub(6, 18)) }\\n case 10000000 { result := mul(uUNIT, sub(7, 18)) }\\n case 100000000 { result := mul(uUNIT, sub(8, 18)) }\\n case 1000000000 { result := mul(uUNIT, sub(9, 18)) }\\n case 10000000000 { result := mul(uUNIT, sub(10, 18)) }\\n case 100000000000 { result := mul(uUNIT, sub(11, 18)) }\\n case 1000000000000 { result := mul(uUNIT, sub(12, 18)) }\\n case 10000000000000 { result := mul(uUNIT, sub(13, 18)) }\\n case 100000000000000 { result := mul(uUNIT, sub(14, 18)) }\\n case 1000000000000000 { result := mul(uUNIT, sub(15, 18)) }\\n case 10000000000000000 { result := mul(uUNIT, sub(16, 18)) }\\n case 100000000000000000 { result := mul(uUNIT, sub(17, 18)) }\\n case 1000000000000000000 { result := 0 }\\n case 10000000000000000000 { result := uUNIT }\\n case 100000000000000000000 { result := mul(uUNIT, 2) }\\n case 1000000000000000000000 { result := mul(uUNIT, 3) }\\n case 10000000000000000000000 { result := mul(uUNIT, 4) }\\n case 100000000000000000000000 { result := mul(uUNIT, 5) }\\n case 1000000000000000000000000 { result := mul(uUNIT, 6) }\\n case 10000000000000000000000000 { result := mul(uUNIT, 7) }\\n case 100000000000000000000000000 { result := mul(uUNIT, 8) }\\n case 1000000000000000000000000000 { result := mul(uUNIT, 9) }\\n case 10000000000000000000000000000 { result := mul(uUNIT, 10) }\\n case 100000000000000000000000000000 { result := mul(uUNIT, 11) }\\n case 1000000000000000000000000000000 { result := mul(uUNIT, 12) }\\n case 10000000000000000000000000000000 { result := mul(uUNIT, 13) }\\n case 100000000000000000000000000000000 { result := mul(uUNIT, 14) }\\n case 1000000000000000000000000000000000 { result := mul(uUNIT, 15) }\\n case 10000000000000000000000000000000000 { result := mul(uUNIT, 16) }\\n case 100000000000000000000000000000000000 { result := mul(uUNIT, 17) }\\n case 1000000000000000000000000000000000000 { result := mul(uUNIT, 18) }\\n case 10000000000000000000000000000000000000 { result := mul(uUNIT, 19) }\\n case 100000000000000000000000000000000000000 { result := mul(uUNIT, 20) }\\n case 1000000000000000000000000000000000000000 { result := mul(uUNIT, 21) }\\n case 10000000000000000000000000000000000000000 { result := mul(uUNIT, 22) }\\n case 100000000000000000000000000000000000000000 { result := mul(uUNIT, 23) }\\n case 1000000000000000000000000000000000000000000 { result := mul(uUNIT, 24) }\\n case 10000000000000000000000000000000000000000000 { result := mul(uUNIT, 25) }\\n case 100000000000000000000000000000000000000000000 { result := mul(uUNIT, 26) }\\n case 1000000000000000000000000000000000000000000000 { result := mul(uUNIT, 27) }\\n case 10000000000000000000000000000000000000000000000 { result := mul(uUNIT, 28) }\\n case 100000000000000000000000000000000000000000000000 { result := mul(uUNIT, 29) }\\n case 1000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 30) }\\n case 10000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 31) }\\n case 100000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 32) }\\n case 1000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 33) }\\n case 10000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 34) }\\n case 100000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 35) }\\n case 1000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 36) }\\n case 10000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 37) }\\n case 100000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 38) }\\n case 1000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 39) }\\n case 10000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 40) }\\n case 100000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 41) }\\n case 1000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 42) }\\n case 10000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 43) }\\n case 100000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 44) }\\n case 1000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 45) }\\n case 10000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 46) }\\n case 100000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 47) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 48) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 49) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 50) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 51) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 52) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 53) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 54) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 55) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 56) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 57) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 58) }\\n default { result := uMAX_SD59x18 }\\n }\\n\\n if (result.unwrap() == uMAX_SD59x18) {\\n unchecked {\\n // Inline the fixed-point division to save gas.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_10);\\n }\\n }\\n}\\n\\n/// @notice Calculates the binary logarithm of x using the iterative approximation algorithm:\\n///\\n/// $$\\n/// log_2{x} = n + log_2{y}, \\\\text{ where } y = x*2^{-n}, \\\\ y \\\\in [1, 2)\\n/// $$\\n///\\n/// For $0 \\\\leq x \\\\lt 1$, the input is inverted:\\n///\\n/// $$\\n/// log_2{x} = -log_2{\\\\frac{1}{x}}\\n/// $$\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Binary_logarithm#Iterative_approximation.\\n///\\n/// Notes:\\n/// - Due to the lossy precision of the iterative approximation, the results are not perfectly accurate to the last decimal.\\n///\\n/// Requirements:\\n/// - x must be greater than zero.\\n///\\n/// @param x The SD59x18 number for which to calculate the binary logarithm.\\n/// @return result The binary logarithm as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log2(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt <= 0) {\\n revert Errors.PRBMath_SD59x18_Log_InputTooSmall(x);\\n }\\n\\n unchecked {\\n int256 sign;\\n if (xInt >= uUNIT) {\\n sign = 1;\\n } else {\\n sign = -1;\\n // Inline the fixed-point inversion to save gas.\\n xInt = uUNIT_SQUARED / xInt;\\n }\\n\\n // Calculate the integer part of the logarithm.\\n uint256 n = Common.msb(uint256(xInt / uUNIT));\\n\\n // This is the integer part of the logarithm as an SD59x18 number. The operation can't overflow\\n // because n is at most 255, `UNIT` is 1e18, and the sign is either 1 or -1.\\n int256 resultInt = int256(n) * uUNIT;\\n\\n // Calculate $y = x * 2^{-n}$.\\n int256 y = xInt >> n;\\n\\n // If y is the unit number, the fractional part is zero.\\n if (y == uUNIT) {\\n return wrap(resultInt * sign);\\n }\\n\\n // Calculate the fractional part via the iterative approximation.\\n // The `delta >>= 1` part is equivalent to `delta /= 2`, but shifting bits is more gas efficient.\\n int256 DOUBLE_UNIT = 2e18;\\n for (int256 delta = uHALF_UNIT; delta > 0; delta >>= 1) {\\n y = (y * y) / uUNIT;\\n\\n // Is y^2 >= 2e18 and so in the range [2e18, 4e18)?\\n if (y >= DOUBLE_UNIT) {\\n // Add the 2^{-m} factor to the logarithm.\\n resultInt = resultInt + delta;\\n\\n // Halve y, which corresponds to z/2 in the Wikipedia article.\\n y >>= 1;\\n }\\n }\\n resultInt *= sign;\\n result = wrap(resultInt);\\n }\\n}\\n\\n/// @notice Multiplies two SD59x18 numbers together, returning a new SD59x18 number.\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {Common.mulDiv18}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv18}.\\n/// - None of the inputs can be `MIN_SD59x18`.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The multiplicand as an SD59x18 number.\\n/// @param y The multiplier as an SD59x18 number.\\n/// @return result The product as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mul(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n if (xInt == uMIN_SD59x18 || yInt == uMIN_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Mul_InputTooSmall();\\n }\\n\\n // Get hold of the absolute values of x and y.\\n uint256 xAbs;\\n uint256 yAbs;\\n unchecked {\\n xAbs = xInt < 0 ? uint256(-xInt) : uint256(xInt);\\n yAbs = yInt < 0 ? uint256(-yInt) : uint256(yInt);\\n }\\n\\n // Compute the absolute value (x*y\\u00f7UNIT). The resulting value must fit in SD59x18.\\n uint256 resultAbs = Common.mulDiv18(xAbs, yAbs);\\n if (resultAbs > uint256(uMAX_SD59x18)) {\\n revert Errors.PRBMath_SD59x18_Mul_Overflow(x, y);\\n }\\n\\n // Check if x and y have the same sign using two's complement representation. The left-most bit represents the sign (1 for\\n // negative, 0 for positive or zero).\\n bool sameSign = (xInt ^ yInt) > -1;\\n\\n // If the inputs have the same sign, the result should be positive. Otherwise, it should be negative.\\n unchecked {\\n result = wrap(sameSign ? int256(resultAbs) : -int256(resultAbs));\\n }\\n}\\n\\n/// @notice Raises x to the power of y using the following formula:\\n///\\n/// $$\\n/// x^y = 2^{log_2{x} * y}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {exp2}, {log2}, and {mul}.\\n/// - Returns `UNIT` for 0^0.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {exp2}, {log2}, and {mul}.\\n///\\n/// @param x The base as an SD59x18 number.\\n/// @param y Exponent to raise x to, as an SD59x18 number\\n/// @return result x raised to power y, as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction pow(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n\\n // If both x and y are zero, the result is `UNIT`. If just x is zero, the result is always zero.\\n if (xInt == 0) {\\n return yInt == 0 ? UNIT : ZERO;\\n }\\n // If x is `UNIT`, the result is always `UNIT`.\\n else if (xInt == uUNIT) {\\n return UNIT;\\n }\\n\\n // If y is zero, the result is always `UNIT`.\\n if (yInt == 0) {\\n return UNIT;\\n }\\n // If y is `UNIT`, the result is always x.\\n else if (yInt == uUNIT) {\\n return x;\\n }\\n\\n // Calculate the result using the formula.\\n result = exp2(mul(log2(x), y));\\n}\\n\\n/// @notice Raises x (an SD59x18 number) to the power y (an unsigned basic integer) using the well-known\\n/// algorithm \\\"exponentiation by squaring\\\".\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Exponentiation_by_squaring.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv18}.\\n/// - Returns `UNIT` for 0^0.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {abs} and {Common.mulDiv18}.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The base as an SD59x18 number.\\n/// @param y The exponent as a uint256.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction powu(SD59x18 x, uint256 y) pure returns (SD59x18 result) {\\n uint256 xAbs = uint256(abs(x).unwrap());\\n\\n // Calculate the first iteration of the loop in advance.\\n uint256 resultAbs = y & 1 > 0 ? xAbs : uint256(uUNIT);\\n\\n // Equivalent to `for(y /= 2; y > 0; y /= 2)`.\\n uint256 yAux = y;\\n for (yAux >>= 1; yAux > 0; yAux >>= 1) {\\n xAbs = Common.mulDiv18(xAbs, xAbs);\\n\\n // Equivalent to `y % 2 == 1`.\\n if (yAux & 1 > 0) {\\n resultAbs = Common.mulDiv18(resultAbs, xAbs);\\n }\\n }\\n\\n // The result must fit in SD59x18.\\n if (resultAbs > uint256(uMAX_SD59x18)) {\\n revert Errors.PRBMath_SD59x18_Powu_Overflow(x, y);\\n }\\n\\n unchecked {\\n // Is the base negative and the exponent odd? If yes, the result should be negative.\\n int256 resultInt = int256(resultAbs);\\n bool isNegative = x.unwrap() < 0 && y & 1 == 1;\\n if (isNegative) {\\n resultInt = -resultInt;\\n }\\n result = wrap(resultInt);\\n }\\n}\\n\\n/// @notice Calculates the square root of x using the Babylonian method.\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\\n///\\n/// Notes:\\n/// - Only the positive root is returned.\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x cannot be negative, since complex numbers are not supported.\\n/// - x must be less than `MAX_SD59x18 / UNIT`.\\n///\\n/// @param x The SD59x18 number for which to calculate the square root.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction sqrt(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < 0) {\\n revert Errors.PRBMath_SD59x18_Sqrt_NegativeInput(x);\\n }\\n if (xInt > uMAX_SD59x18 / uUNIT) {\\n revert Errors.PRBMath_SD59x18_Sqrt_Overflow(x);\\n }\\n\\n unchecked {\\n // Multiply x by `UNIT` to account for the factor of `UNIT` picked up when multiplying two SD59x18 numbers.\\n // In this case, the two numbers are both the square root.\\n uint256 resultUint = Common.sqrt(uint256(xInt * uUNIT));\\n result = wrap(int256(resultUint));\\n }\\n}\\n\",\"keccak256\":\"0xa074831139fc89ca0e5a36086b30eb50896bb6770cd5823461b1f2769017d2f0\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\nimport \\\"./Helpers.sol\\\" as Helpers;\\nimport \\\"./Math.sol\\\" as Math;\\n\\n/// @notice The signed 59.18-decimal fixed-point number representation, which can have up to 59 digits and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\\n/// type int256.\\ntype SD59x18 is int256;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoInt256,\\n Casting.intoSD1x18,\\n Casting.intoUD2x18,\\n Casting.intoUD60x18,\\n Casting.intoUint256,\\n Casting.intoUint128,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for SD59x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n MATHEMATICAL FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Math.abs,\\n Math.avg,\\n Math.ceil,\\n Math.div,\\n Math.exp,\\n Math.exp2,\\n Math.floor,\\n Math.frac,\\n Math.gm,\\n Math.inv,\\n Math.log10,\\n Math.log2,\\n Math.ln,\\n Math.mul,\\n Math.pow,\\n Math.powu,\\n Math.sqrt\\n} for SD59x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n HELPER FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Helpers.add,\\n Helpers.and,\\n Helpers.eq,\\n Helpers.gt,\\n Helpers.gte,\\n Helpers.isZero,\\n Helpers.lshift,\\n Helpers.lt,\\n Helpers.lte,\\n Helpers.mod,\\n Helpers.neq,\\n Helpers.not,\\n Helpers.or,\\n Helpers.rshift,\\n Helpers.sub,\\n Helpers.uncheckedAdd,\\n Helpers.uncheckedSub,\\n Helpers.uncheckedUnary,\\n Helpers.xor\\n} for SD59x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n OPERATORS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes it possible to use these operators on the SD59x18 type.\\nusing {\\n Helpers.add as +,\\n Helpers.and2 as &,\\n Math.div as /,\\n Helpers.eq as ==,\\n Helpers.gt as >,\\n Helpers.gte as >=,\\n Helpers.lt as <,\\n Helpers.lte as <=,\\n Helpers.mod as %,\\n Math.mul as *,\\n Helpers.neq as !=,\\n Helpers.not as ~,\\n Helpers.or as |,\\n Helpers.sub as -,\\n Helpers.unary as -,\\n Helpers.xor as ^\\n} for SD59x18 global;\\n\",\"keccak256\":\"0xe03112d145dcd5863aff24e5f381debaae29d446acd5666f3d640e3d9af738d7\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as Errors;\\nimport { uMAX_SD1x18 } from \\\"../sd1x18/Constants.sol\\\";\\nimport { SD1x18 } from \\\"../sd1x18/ValueType.sol\\\";\\nimport { SD59x18 } from \\\"../sd59x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"../ud60x18/ValueType.sol\\\";\\nimport { UD2x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts a UD2x18 number into SD1x18.\\n/// - x must be less than or equal to `uMAX_SD1x18`.\\nfunction intoSD1x18(UD2x18 x) pure returns (SD1x18 result) {\\n uint64 xUint = UD2x18.unwrap(x);\\n if (xUint > uint64(uMAX_SD1x18)) {\\n revert Errors.PRBMath_UD2x18_IntoSD1x18_Overflow(x);\\n }\\n result = SD1x18.wrap(int64(xUint));\\n}\\n\\n/// @notice Casts a UD2x18 number into SD59x18.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of SD59x18.\\nfunction intoSD59x18(UD2x18 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(int256(uint256(UD2x18.unwrap(x))));\\n}\\n\\n/// @notice Casts a UD2x18 number into UD60x18.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of UD60x18.\\nfunction intoUD60x18(UD2x18 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(UD2x18.unwrap(x));\\n}\\n\\n/// @notice Casts a UD2x18 number into uint128.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of uint128.\\nfunction intoUint128(UD2x18 x) pure returns (uint128 result) {\\n result = uint128(UD2x18.unwrap(x));\\n}\\n\\n/// @notice Casts a UD2x18 number into uint256.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of uint256.\\nfunction intoUint256(UD2x18 x) pure returns (uint256 result) {\\n result = uint256(UD2x18.unwrap(x));\\n}\\n\\n/// @notice Casts a UD2x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(UD2x18 x) pure returns (uint40 result) {\\n uint64 xUint = UD2x18.unwrap(x);\\n if (xUint > uint64(Common.MAX_UINT40)) {\\n revert Errors.PRBMath_UD2x18_IntoUint40_Overflow(x);\\n }\\n result = uint40(xUint);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction ud2x18(uint64 x) pure returns (UD2x18 result) {\\n result = UD2x18.wrap(x);\\n}\\n\\n/// @notice Unwrap a UD2x18 number into uint64.\\nfunction unwrap(UD2x18 x) pure returns (uint64 result) {\\n result = UD2x18.unwrap(x);\\n}\\n\\n/// @notice Wraps a uint64 number into UD2x18.\\nfunction wrap(uint64 x) pure returns (UD2x18 result) {\\n result = UD2x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x9b1a35d432ef951a415fae8098b3c609a99b630a3d5464b3c8e1efa8893eea07\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD2x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @dev Euler's number as a UD2x18 number.\\nUD2x18 constant E = UD2x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum value a UD2x18 number can have.\\nuint64 constant uMAX_UD2x18 = 18_446744073709551615;\\nUD2x18 constant MAX_UD2x18 = UD2x18.wrap(uMAX_UD2x18);\\n\\n/// @dev PI as a UD2x18 number.\\nUD2x18 constant PI = UD2x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of UD2x18.\\nUD2x18 constant UNIT = UD2x18.wrap(1e18);\\nuint64 constant uUNIT = 1e18;\\n\",\"keccak256\":\"0x29b0e050c865899e1fb9022b460a7829cdee248c44c4299f068ba80695eec3fc\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD2x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when trying to cast a UD2x18 number that doesn't fit in SD1x18.\\nerror PRBMath_UD2x18_IntoSD1x18_Overflow(UD2x18 x);\\n\\n/// @notice Thrown when trying to cast a UD2x18 number that doesn't fit in uint40.\\nerror PRBMath_UD2x18_IntoUint40_Overflow(UD2x18 x);\\n\",\"keccak256\":\"0xdf1e22f0b4c8032bcc8b7f63fe3984e1387f3dc7b2e9ab381822249f75376d33\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\n\\n/// @notice The unsigned 2.18-decimal fixed-point number representation, which can have up to 2 digits and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\\n/// type uint64. This is useful when end users want to use uint64 to save gas, e.g. with tight variable packing in contract\\n/// storage.\\ntype UD2x18 is uint64;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoSD1x18,\\n Casting.intoSD59x18,\\n Casting.intoUD60x18,\\n Casting.intoUint256,\\n Casting.intoUint128,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for UD2x18 global;\\n\",\"keccak256\":\"0x2802edc9869db116a0b5c490cc5f8554742f747183fa30ac5e9c80bb967e61a1\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Errors.sol\\\" as CastingErrors;\\nimport { MAX_UINT128, MAX_UINT40 } from \\\"../Common.sol\\\";\\nimport { uMAX_SD1x18 } from \\\"../sd1x18/Constants.sol\\\";\\nimport { SD1x18 } from \\\"../sd1x18/ValueType.sol\\\";\\nimport { uMAX_SD59x18 } from \\\"../sd59x18/Constants.sol\\\";\\nimport { SD59x18 } from \\\"../sd59x18/ValueType.sol\\\";\\nimport { uMAX_UD2x18 } from \\\"../ud2x18/Constants.sol\\\";\\nimport { UD2x18 } from \\\"../ud2x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts a UD60x18 number into SD1x18.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `uMAX_SD1x18`.\\nfunction intoSD1x18(UD60x18 x) pure returns (SD1x18 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > uint256(int256(uMAX_SD1x18))) {\\n revert CastingErrors.PRBMath_UD60x18_IntoSD1x18_Overflow(x);\\n }\\n result = SD1x18.wrap(int64(uint64(xUint)));\\n}\\n\\n/// @notice Casts a UD60x18 number into UD2x18.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `uMAX_UD2x18`.\\nfunction intoUD2x18(UD60x18 x) pure returns (UD2x18 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > uMAX_UD2x18) {\\n revert CastingErrors.PRBMath_UD60x18_IntoUD2x18_Overflow(x);\\n }\\n result = UD2x18.wrap(uint64(xUint));\\n}\\n\\n/// @notice Casts a UD60x18 number into SD59x18.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `uMAX_SD59x18`.\\nfunction intoSD59x18(UD60x18 x) pure returns (SD59x18 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > uint256(uMAX_SD59x18)) {\\n revert CastingErrors.PRBMath_UD60x18_IntoSD59x18_Overflow(x);\\n }\\n result = SD59x18.wrap(int256(xUint));\\n}\\n\\n/// @notice Casts a UD60x18 number into uint128.\\n/// @dev This is basically an alias for {unwrap}.\\nfunction intoUint256(UD60x18 x) pure returns (uint256 result) {\\n result = UD60x18.unwrap(x);\\n}\\n\\n/// @notice Casts a UD60x18 number into uint128.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UINT128`.\\nfunction intoUint128(UD60x18 x) pure returns (uint128 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > MAX_UINT128) {\\n revert CastingErrors.PRBMath_UD60x18_IntoUint128_Overflow(x);\\n }\\n result = uint128(xUint);\\n}\\n\\n/// @notice Casts a UD60x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(UD60x18 x) pure returns (uint40 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > MAX_UINT40) {\\n revert CastingErrors.PRBMath_UD60x18_IntoUint40_Overflow(x);\\n }\\n result = uint40(xUint);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction ud(uint256 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(x);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction ud60x18(uint256 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(x);\\n}\\n\\n/// @notice Unwraps a UD60x18 number into uint256.\\nfunction unwrap(UD60x18 x) pure returns (uint256 result) {\\n result = UD60x18.unwrap(x);\\n}\\n\\n/// @notice Wraps a uint256 number into the UD60x18 value type.\\nfunction wrap(uint256 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x5bb532da36921cbdac64d1f16de5d366ef1f664502e3b7c07d0ad06917551f85\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n// NOTICE: the \\\"u\\\" prefix stands for \\\"unwrapped\\\".\\n\\n/// @dev Euler's number as a UD60x18 number.\\nUD60x18 constant E = UD60x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum input permitted in {exp}.\\nuint256 constant uEXP_MAX_INPUT = 133_084258667509499440;\\nUD60x18 constant EXP_MAX_INPUT = UD60x18.wrap(uEXP_MAX_INPUT);\\n\\n/// @dev The maximum input permitted in {exp2}.\\nuint256 constant uEXP2_MAX_INPUT = 192e18 - 1;\\nUD60x18 constant EXP2_MAX_INPUT = UD60x18.wrap(uEXP2_MAX_INPUT);\\n\\n/// @dev Half the UNIT number.\\nuint256 constant uHALF_UNIT = 0.5e18;\\nUD60x18 constant HALF_UNIT = UD60x18.wrap(uHALF_UNIT);\\n\\n/// @dev $log_2(10)$ as a UD60x18 number.\\nuint256 constant uLOG2_10 = 3_321928094887362347;\\nUD60x18 constant LOG2_10 = UD60x18.wrap(uLOG2_10);\\n\\n/// @dev $log_2(e)$ as a UD60x18 number.\\nuint256 constant uLOG2_E = 1_442695040888963407;\\nUD60x18 constant LOG2_E = UD60x18.wrap(uLOG2_E);\\n\\n/// @dev The maximum value a UD60x18 number can have.\\nuint256 constant uMAX_UD60x18 = 115792089237316195423570985008687907853269984665640564039457_584007913129639935;\\nUD60x18 constant MAX_UD60x18 = UD60x18.wrap(uMAX_UD60x18);\\n\\n/// @dev The maximum whole value a UD60x18 number can have.\\nuint256 constant uMAX_WHOLE_UD60x18 = 115792089237316195423570985008687907853269984665640564039457_000000000000000000;\\nUD60x18 constant MAX_WHOLE_UD60x18 = UD60x18.wrap(uMAX_WHOLE_UD60x18);\\n\\n/// @dev PI as a UD60x18 number.\\nUD60x18 constant PI = UD60x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of UD60x18.\\nuint256 constant uUNIT = 1e18;\\nUD60x18 constant UNIT = UD60x18.wrap(uUNIT);\\n\\n/// @dev The unit number squared.\\nuint256 constant uUNIT_SQUARED = 1e36;\\nUD60x18 constant UNIT_SQUARED = UD60x18.wrap(uUNIT_SQUARED);\\n\\n/// @dev Zero as a UD60x18 number.\\nUD60x18 constant ZERO = UD60x18.wrap(0);\\n\",\"keccak256\":\"0x2b80d26153d3fdcfb3a9ca772d9309d31ed1275f5b8b54c3ffb54d3652b37d90\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Conversions.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { uMAX_UD60x18, uUNIT } from \\\"./Constants.sol\\\";\\nimport { PRBMath_UD60x18_Convert_Overflow } from \\\"./Errors.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Converts a UD60x18 number to a simple integer by dividing it by `UNIT`.\\n/// @dev The result is rounded toward zero.\\n/// @param x The UD60x18 number to convert.\\n/// @return result The same number in basic integer form.\\nfunction convert(UD60x18 x) pure returns (uint256 result) {\\n result = UD60x18.unwrap(x) / uUNIT;\\n}\\n\\n/// @notice Converts a simple integer to UD60x18 by multiplying it by `UNIT`.\\n///\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UD60x18 / UNIT`.\\n///\\n/// @param x The basic integer to convert.\\n/// @param result The same number converted to UD60x18.\\nfunction convert(uint256 x) pure returns (UD60x18 result) {\\n if (x > uMAX_UD60x18 / uUNIT) {\\n revert PRBMath_UD60x18_Convert_Overflow(x);\\n }\\n unchecked {\\n result = UD60x18.wrap(x * uUNIT);\\n }\\n}\\n\",\"keccak256\":\"0xaf7fc2523413822de3b66ba339fe2884fb3b8c6f6cf38ec90a2c3e3aae71df6b\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when ceiling a number overflows UD60x18.\\nerror PRBMath_UD60x18_Ceil_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when converting a basic integer to the fixed-point format overflows UD60x18.\\nerror PRBMath_UD60x18_Convert_Overflow(uint256 x);\\n\\n/// @notice Thrown when taking the natural exponent of a base greater than 133_084258667509499441.\\nerror PRBMath_UD60x18_Exp_InputTooBig(UD60x18 x);\\n\\n/// @notice Thrown when taking the binary exponent of a base greater than 192e18.\\nerror PRBMath_UD60x18_Exp2_InputTooBig(UD60x18 x);\\n\\n/// @notice Thrown when taking the geometric mean of two numbers and multiplying them overflows UD60x18.\\nerror PRBMath_UD60x18_Gm_Overflow(UD60x18 x, UD60x18 y);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\\nerror PRBMath_UD60x18_IntoSD1x18_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD59x18.\\nerror PRBMath_UD60x18_IntoSD59x18_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\\nerror PRBMath_UD60x18_IntoUD2x18_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\\nerror PRBMath_UD60x18_IntoUint128_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\\nerror PRBMath_UD60x18_IntoUint40_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when taking the logarithm of a number less than 1.\\nerror PRBMath_UD60x18_Log_InputTooSmall(UD60x18 x);\\n\\n/// @notice Thrown when calculating the square root overflows UD60x18.\\nerror PRBMath_UD60x18_Sqrt_Overflow(UD60x18 x);\\n\",\"keccak256\":\"0xa8c60d4066248df22c49c882873efbc017344107edabc48c52209abbc39cb1e3\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Helpers.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { wrap } from \\\"./Casting.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Implements the checked addition operation (+) in the UD60x18 type.\\nfunction add(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() + y.unwrap());\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the UD60x18 type.\\nfunction and(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() & bits);\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the UD60x18 type.\\nfunction and2(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() & y.unwrap());\\n}\\n\\n/// @notice Implements the equal operation (==) in the UD60x18 type.\\nfunction eq(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() == y.unwrap();\\n}\\n\\n/// @notice Implements the greater than operation (>) in the UD60x18 type.\\nfunction gt(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() > y.unwrap();\\n}\\n\\n/// @notice Implements the greater than or equal to operation (>=) in the UD60x18 type.\\nfunction gte(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() >= y.unwrap();\\n}\\n\\n/// @notice Implements a zero comparison check function in the UD60x18 type.\\nfunction isZero(UD60x18 x) pure returns (bool result) {\\n // This wouldn't work if x could be negative.\\n result = x.unwrap() == 0;\\n}\\n\\n/// @notice Implements the left shift operation (<<) in the UD60x18 type.\\nfunction lshift(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() << bits);\\n}\\n\\n/// @notice Implements the lower than operation (<) in the UD60x18 type.\\nfunction lt(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() < y.unwrap();\\n}\\n\\n/// @notice Implements the lower than or equal to operation (<=) in the UD60x18 type.\\nfunction lte(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() <= y.unwrap();\\n}\\n\\n/// @notice Implements the checked modulo operation (%) in the UD60x18 type.\\nfunction mod(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() % y.unwrap());\\n}\\n\\n/// @notice Implements the not equal operation (!=) in the UD60x18 type.\\nfunction neq(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() != y.unwrap();\\n}\\n\\n/// @notice Implements the NOT (~) bitwise operation in the UD60x18 type.\\nfunction not(UD60x18 x) pure returns (UD60x18 result) {\\n result = wrap(~x.unwrap());\\n}\\n\\n/// @notice Implements the OR (|) bitwise operation in the UD60x18 type.\\nfunction or(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() | y.unwrap());\\n}\\n\\n/// @notice Implements the right shift operation (>>) in the UD60x18 type.\\nfunction rshift(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() >> bits);\\n}\\n\\n/// @notice Implements the checked subtraction operation (-) in the UD60x18 type.\\nfunction sub(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() - y.unwrap());\\n}\\n\\n/// @notice Implements the unchecked addition operation (+) in the UD60x18 type.\\nfunction uncheckedAdd(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() + y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the unchecked subtraction operation (-) in the UD60x18 type.\\nfunction uncheckedSub(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() - y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the XOR (^) bitwise operation in the UD60x18 type.\\nfunction xor(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() ^ y.unwrap());\\n}\\n\",\"keccak256\":\"0xf5faff881391d2c060029499a666cc5f0bea90a213150bb476fae8f02a5df268\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as Errors;\\nimport { wrap } from \\\"./Casting.sol\\\";\\nimport {\\n uEXP_MAX_INPUT,\\n uEXP2_MAX_INPUT,\\n uHALF_UNIT,\\n uLOG2_10,\\n uLOG2_E,\\n uMAX_UD60x18,\\n uMAX_WHOLE_UD60x18,\\n UNIT,\\n uUNIT,\\n uUNIT_SQUARED,\\n ZERO\\n} from \\\"./Constants.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n MATHEMATICAL FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @notice Calculates the arithmetic average of x and y using the following formula:\\n///\\n/// $$\\n/// avg(x, y) = (x & y) + ((xUint ^ yUint) / 2)\\n/// $$\\n///\\n/// In English, this is what this formula does:\\n///\\n/// 1. AND x and y.\\n/// 2. Calculate half of XOR x and y.\\n/// 3. Add the two results together.\\n///\\n/// This technique is known as SWAR, which stands for \\\"SIMD within a register\\\". You can read more about it here:\\n/// https://devblogs.microsoft.com/oldnewthing/20220207-00/?p=106223\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// @param x The first operand as a UD60x18 number.\\n/// @param y The second operand as a UD60x18 number.\\n/// @return result The arithmetic average as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction avg(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n uint256 yUint = y.unwrap();\\n unchecked {\\n result = wrap((xUint & yUint) + ((xUint ^ yUint) >> 1));\\n }\\n}\\n\\n/// @notice Yields the smallest whole number greater than or equal to x.\\n///\\n/// @dev This is optimized for fractional value inputs, because for every whole value there are (1e18 - 1) fractional\\n/// counterparts. See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n///\\n/// Requirements:\\n/// - x must be less than or equal to `MAX_WHOLE_UD60x18`.\\n///\\n/// @param x The UD60x18 number to ceil.\\n/// @param result The smallest whole number greater than or equal to x, as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ceil(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n if (xUint > uMAX_WHOLE_UD60x18) {\\n revert Errors.PRBMath_UD60x18_Ceil_Overflow(x);\\n }\\n\\n assembly (\\\"memory-safe\\\") {\\n // Equivalent to `x % UNIT`.\\n let remainder := mod(x, uUNIT)\\n\\n // Equivalent to `UNIT - remainder`.\\n let delta := sub(uUNIT, remainder)\\n\\n // Equivalent to `x + remainder > 0 ? delta : 0`.\\n result := add(x, mul(delta, gt(remainder, 0)))\\n }\\n}\\n\\n/// @notice Divides two UD60x18 numbers, returning a new UD60x18 number.\\n///\\n/// @dev Uses {Common.mulDiv} to enable overflow-safe multiplication and division.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv}.\\n///\\n/// @param x The numerator as a UD60x18 number.\\n/// @param y The denominator as a UD60x18 number.\\n/// @param result The quotient as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction div(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(Common.mulDiv(x.unwrap(), uUNIT, y.unwrap()));\\n}\\n\\n/// @notice Calculates the natural exponent of x using the following formula:\\n///\\n/// $$\\n/// e^x = 2^{x * log_2{e}}\\n/// $$\\n///\\n/// @dev Requirements:\\n/// - x must be less than 133_084258667509499441.\\n///\\n/// @param x The exponent as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n // This check prevents values greater than 192e18 from being passed to {exp2}.\\n if (xUint > uEXP_MAX_INPUT) {\\n revert Errors.PRBMath_UD60x18_Exp_InputTooBig(x);\\n }\\n\\n unchecked {\\n // Inline the fixed-point multiplication to save gas.\\n uint256 doubleUnitProduct = xUint * uLOG2_E;\\n result = exp2(wrap(doubleUnitProduct / uUNIT));\\n }\\n}\\n\\n/// @notice Calculates the binary exponent of x using the binary fraction method.\\n///\\n/// @dev See https://ethereum.stackexchange.com/q/79903/24693\\n///\\n/// Requirements:\\n/// - x must be less than 192e18.\\n/// - The result must fit in UD60x18.\\n///\\n/// @param x The exponent as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp2(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n // Numbers greater than or equal to 192e18 don't fit in the 192.64-bit format.\\n if (xUint > uEXP2_MAX_INPUT) {\\n revert Errors.PRBMath_UD60x18_Exp2_InputTooBig(x);\\n }\\n\\n // Convert x to the 192.64-bit fixed-point format.\\n uint256 x_192x64 = (xUint << 64) / uUNIT;\\n\\n // Pass x to the {Common.exp2} function, which uses the 192.64-bit fixed-point number representation.\\n result = wrap(Common.exp2(x_192x64));\\n}\\n\\n/// @notice Yields the greatest whole number less than or equal to x.\\n/// @dev Optimized for fractional value inputs, because every whole value has (1e18 - 1) fractional counterparts.\\n/// See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n/// @param x The UD60x18 number to floor.\\n/// @param result The greatest whole number less than or equal to x, as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction floor(UD60x18 x) pure returns (UD60x18 result) {\\n assembly (\\\"memory-safe\\\") {\\n // Equivalent to `x % UNIT`.\\n let remainder := mod(x, uUNIT)\\n\\n // Equivalent to `x - remainder > 0 ? remainder : 0)`.\\n result := sub(x, mul(remainder, gt(remainder, 0)))\\n }\\n}\\n\\n/// @notice Yields the excess beyond the floor of x using the odd function definition.\\n/// @dev See https://en.wikipedia.org/wiki/Fractional_part.\\n/// @param x The UD60x18 number to get the fractional part of.\\n/// @param result The fractional part of x as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction frac(UD60x18 x) pure returns (UD60x18 result) {\\n assembly (\\\"memory-safe\\\") {\\n result := mod(x, uUNIT)\\n }\\n}\\n\\n/// @notice Calculates the geometric mean of x and y, i.e. $\\\\sqrt{x * y}$, rounding down.\\n///\\n/// @dev Requirements:\\n/// - x * y must fit in UD60x18.\\n///\\n/// @param x The first operand as a UD60x18 number.\\n/// @param y The second operand as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction gm(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n uint256 yUint = y.unwrap();\\n if (xUint == 0 || yUint == 0) {\\n return ZERO;\\n }\\n\\n unchecked {\\n // Checking for overflow this way is faster than letting Solidity do it.\\n uint256 xyUint = xUint * yUint;\\n if (xyUint / xUint != yUint) {\\n revert Errors.PRBMath_UD60x18_Gm_Overflow(x, y);\\n }\\n\\n // We don't need to multiply the result by `UNIT` here because the x*y product picked up a factor of `UNIT`\\n // during multiplication. See the comments in {Common.sqrt}.\\n result = wrap(Common.sqrt(xyUint));\\n }\\n}\\n\\n/// @notice Calculates the inverse of x.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x must not be zero.\\n///\\n/// @param x The UD60x18 number for which to calculate the inverse.\\n/// @return result The inverse as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction inv(UD60x18 x) pure returns (UD60x18 result) {\\n unchecked {\\n result = wrap(uUNIT_SQUARED / x.unwrap());\\n }\\n}\\n\\n/// @notice Calculates the natural logarithm of x using the following formula:\\n///\\n/// $$\\n/// ln{x} = log_2{x} / log_2{e}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n/// - The precision isn't sufficiently fine-grained to return exactly `UNIT` when the input is `E`.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The UD60x18 number for which to calculate the natural logarithm.\\n/// @return result The natural logarithm as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ln(UD60x18 x) pure returns (UD60x18 result) {\\n unchecked {\\n // Inline the fixed-point multiplication to save gas. This is overflow-safe because the maximum value that\\n // {log2} can return is ~196_205294292027477728.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_E);\\n }\\n}\\n\\n/// @notice Calculates the common logarithm of x using the following formula:\\n///\\n/// $$\\n/// log_{10}{x} = log_2{x} / log_2{10}\\n/// $$\\n///\\n/// However, if x is an exact power of ten, a hard coded value is returned.\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The UD60x18 number for which to calculate the common logarithm.\\n/// @return result The common logarithm as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log10(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n if (xUint < uUNIT) {\\n revert Errors.PRBMath_UD60x18_Log_InputTooSmall(x);\\n }\\n\\n // Note that the `mul` in this assembly block is the standard multiplication operation, not {UD60x18.mul}.\\n // prettier-ignore\\n assembly (\\\"memory-safe\\\") {\\n switch x\\n case 1 { result := mul(uUNIT, sub(0, 18)) }\\n case 10 { result := mul(uUNIT, sub(1, 18)) }\\n case 100 { result := mul(uUNIT, sub(2, 18)) }\\n case 1000 { result := mul(uUNIT, sub(3, 18)) }\\n case 10000 { result := mul(uUNIT, sub(4, 18)) }\\n case 100000 { result := mul(uUNIT, sub(5, 18)) }\\n case 1000000 { result := mul(uUNIT, sub(6, 18)) }\\n case 10000000 { result := mul(uUNIT, sub(7, 18)) }\\n case 100000000 { result := mul(uUNIT, sub(8, 18)) }\\n case 1000000000 { result := mul(uUNIT, sub(9, 18)) }\\n case 10000000000 { result := mul(uUNIT, sub(10, 18)) }\\n case 100000000000 { result := mul(uUNIT, sub(11, 18)) }\\n case 1000000000000 { result := mul(uUNIT, sub(12, 18)) }\\n case 10000000000000 { result := mul(uUNIT, sub(13, 18)) }\\n case 100000000000000 { result := mul(uUNIT, sub(14, 18)) }\\n case 1000000000000000 { result := mul(uUNIT, sub(15, 18)) }\\n case 10000000000000000 { result := mul(uUNIT, sub(16, 18)) }\\n case 100000000000000000 { result := mul(uUNIT, sub(17, 18)) }\\n case 1000000000000000000 { result := 0 }\\n case 10000000000000000000 { result := uUNIT }\\n case 100000000000000000000 { result := mul(uUNIT, 2) }\\n case 1000000000000000000000 { result := mul(uUNIT, 3) }\\n case 10000000000000000000000 { result := mul(uUNIT, 4) }\\n case 100000000000000000000000 { result := mul(uUNIT, 5) }\\n case 1000000000000000000000000 { result := mul(uUNIT, 6) }\\n case 10000000000000000000000000 { result := mul(uUNIT, 7) }\\n case 100000000000000000000000000 { result := mul(uUNIT, 8) }\\n case 1000000000000000000000000000 { result := mul(uUNIT, 9) }\\n case 10000000000000000000000000000 { result := mul(uUNIT, 10) }\\n case 100000000000000000000000000000 { result := mul(uUNIT, 11) }\\n case 1000000000000000000000000000000 { result := mul(uUNIT, 12) }\\n case 10000000000000000000000000000000 { result := mul(uUNIT, 13) }\\n case 100000000000000000000000000000000 { result := mul(uUNIT, 14) }\\n case 1000000000000000000000000000000000 { result := mul(uUNIT, 15) }\\n case 10000000000000000000000000000000000 { result := mul(uUNIT, 16) }\\n case 100000000000000000000000000000000000 { result := mul(uUNIT, 17) }\\n case 1000000000000000000000000000000000000 { result := mul(uUNIT, 18) }\\n case 10000000000000000000000000000000000000 { result := mul(uUNIT, 19) }\\n case 100000000000000000000000000000000000000 { result := mul(uUNIT, 20) }\\n case 1000000000000000000000000000000000000000 { result := mul(uUNIT, 21) }\\n case 10000000000000000000000000000000000000000 { result := mul(uUNIT, 22) }\\n case 100000000000000000000000000000000000000000 { result := mul(uUNIT, 23) }\\n case 1000000000000000000000000000000000000000000 { result := mul(uUNIT, 24) }\\n case 10000000000000000000000000000000000000000000 { result := mul(uUNIT, 25) }\\n case 100000000000000000000000000000000000000000000 { result := mul(uUNIT, 26) }\\n case 1000000000000000000000000000000000000000000000 { result := mul(uUNIT, 27) }\\n case 10000000000000000000000000000000000000000000000 { result := mul(uUNIT, 28) }\\n case 100000000000000000000000000000000000000000000000 { result := mul(uUNIT, 29) }\\n case 1000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 30) }\\n case 10000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 31) }\\n case 100000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 32) }\\n case 1000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 33) }\\n case 10000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 34) }\\n case 100000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 35) }\\n case 1000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 36) }\\n case 10000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 37) }\\n case 100000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 38) }\\n case 1000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 39) }\\n case 10000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 40) }\\n case 100000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 41) }\\n case 1000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 42) }\\n case 10000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 43) }\\n case 100000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 44) }\\n case 1000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 45) }\\n case 10000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 46) }\\n case 100000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 47) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 48) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 49) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 50) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 51) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 52) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 53) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 54) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 55) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 56) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 57) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 58) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 59) }\\n default { result := uMAX_UD60x18 }\\n }\\n\\n if (result.unwrap() == uMAX_UD60x18) {\\n unchecked {\\n // Inline the fixed-point division to save gas.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_10);\\n }\\n }\\n}\\n\\n/// @notice Calculates the binary logarithm of x using the iterative approximation algorithm:\\n///\\n/// $$\\n/// log_2{x} = n + log_2{y}, \\\\text{ where } y = x*2^{-n}, \\\\ y \\\\in [1, 2)\\n/// $$\\n///\\n/// For $0 \\\\leq x \\\\lt 1$, the input is inverted:\\n///\\n/// $$\\n/// log_2{x} = -log_2{\\\\frac{1}{x}}\\n/// $$\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Binary_logarithm#Iterative_approximation\\n///\\n/// Notes:\\n/// - Due to the lossy precision of the iterative approximation, the results are not perfectly accurate to the last decimal.\\n///\\n/// Requirements:\\n/// - x must be greater than zero.\\n///\\n/// @param x The UD60x18 number for which to calculate the binary logarithm.\\n/// @return result The binary logarithm as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log2(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n if (xUint < uUNIT) {\\n revert Errors.PRBMath_UD60x18_Log_InputTooSmall(x);\\n }\\n\\n unchecked {\\n // Calculate the integer part of the logarithm.\\n uint256 n = Common.msb(xUint / uUNIT);\\n\\n // This is the integer part of the logarithm as a UD60x18 number. The operation can't overflow because n\\n // n is at most 255 and UNIT is 1e18.\\n uint256 resultUint = n * uUNIT;\\n\\n // Calculate $y = x * 2^{-n}$.\\n uint256 y = xUint >> n;\\n\\n // If y is the unit number, the fractional part is zero.\\n if (y == uUNIT) {\\n return wrap(resultUint);\\n }\\n\\n // Calculate the fractional part via the iterative approximation.\\n // The `delta >>= 1` part is equivalent to `delta /= 2`, but shifting bits is more gas efficient.\\n uint256 DOUBLE_UNIT = 2e18;\\n for (uint256 delta = uHALF_UNIT; delta > 0; delta >>= 1) {\\n y = (y * y) / uUNIT;\\n\\n // Is y^2 >= 2e18 and so in the range [2e18, 4e18)?\\n if (y >= DOUBLE_UNIT) {\\n // Add the 2^{-m} factor to the logarithm.\\n resultUint += delta;\\n\\n // Halve y, which corresponds to z/2 in the Wikipedia article.\\n y >>= 1;\\n }\\n }\\n result = wrap(resultUint);\\n }\\n}\\n\\n/// @notice Multiplies two UD60x18 numbers together, returning a new UD60x18 number.\\n///\\n/// @dev Uses {Common.mulDiv} to enable overflow-safe multiplication and division.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv}.\\n///\\n/// @dev See the documentation in {Common.mulDiv18}.\\n/// @param x The multiplicand as a UD60x18 number.\\n/// @param y The multiplier as a UD60x18 number.\\n/// @return result The product as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mul(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(Common.mulDiv18(x.unwrap(), y.unwrap()));\\n}\\n\\n/// @notice Raises x to the power of y.\\n///\\n/// For $1 \\\\leq x \\\\leq \\\\infty$, the following standard formula is used:\\n///\\n/// $$\\n/// x^y = 2^{log_2{x} * y}\\n/// $$\\n///\\n/// For $0 \\\\leq x \\\\lt 1$, since the unsigned {log2} is undefined, an equivalent formula is used:\\n///\\n/// $$\\n/// i = \\\\frac{1}{x}\\n/// w = 2^{log_2{i} * y}\\n/// x^y = \\\\frac{1}{w}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2} and {mul}.\\n/// - Returns `UNIT` for 0^0.\\n/// - It may not perform well with very small values of x. Consider using SD59x18 as an alternative.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {exp2}, {log2}, and {mul}.\\n///\\n/// @param x The base as a UD60x18 number.\\n/// @param y The exponent as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction pow(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n uint256 yUint = y.unwrap();\\n\\n // If both x and y are zero, the result is `UNIT`. If just x is zero, the result is always zero.\\n if (xUint == 0) {\\n return yUint == 0 ? UNIT : ZERO;\\n }\\n // If x is `UNIT`, the result is always `UNIT`.\\n else if (xUint == uUNIT) {\\n return UNIT;\\n }\\n\\n // If y is zero, the result is always `UNIT`.\\n if (yUint == 0) {\\n return UNIT;\\n }\\n // If y is `UNIT`, the result is always x.\\n else if (yUint == uUNIT) {\\n return x;\\n }\\n\\n // If x is greater than `UNIT`, use the standard formula.\\n if (xUint > uUNIT) {\\n result = exp2(mul(log2(x), y));\\n }\\n // Conversely, if x is less than `UNIT`, use the equivalent formula.\\n else {\\n UD60x18 i = wrap(uUNIT_SQUARED / xUint);\\n UD60x18 w = exp2(mul(log2(i), y));\\n result = wrap(uUNIT_SQUARED / w.unwrap());\\n }\\n}\\n\\n/// @notice Raises x (a UD60x18 number) to the power y (an unsigned basic integer) using the well-known\\n/// algorithm \\\"exponentiation by squaring\\\".\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Exponentiation_by_squaring.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv18}.\\n/// - Returns `UNIT` for 0^0.\\n///\\n/// Requirements:\\n/// - The result must fit in UD60x18.\\n///\\n/// @param x The base as a UD60x18 number.\\n/// @param y The exponent as a uint256.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction powu(UD60x18 x, uint256 y) pure returns (UD60x18 result) {\\n // Calculate the first iteration of the loop in advance.\\n uint256 xUint = x.unwrap();\\n uint256 resultUint = y & 1 > 0 ? xUint : uUNIT;\\n\\n // Equivalent to `for(y /= 2; y > 0; y /= 2)`.\\n for (y >>= 1; y > 0; y >>= 1) {\\n xUint = Common.mulDiv18(xUint, xUint);\\n\\n // Equivalent to `y % 2 == 1`.\\n if (y & 1 > 0) {\\n resultUint = Common.mulDiv18(resultUint, xUint);\\n }\\n }\\n result = wrap(resultUint);\\n}\\n\\n/// @notice Calculates the square root of x using the Babylonian method.\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\\n///\\n/// Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x must be less than `MAX_UD60x18 / UNIT`.\\n///\\n/// @param x The UD60x18 number for which to calculate the square root.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction sqrt(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n unchecked {\\n if (xUint > uMAX_UD60x18 / uUNIT) {\\n revert Errors.PRBMath_UD60x18_Sqrt_Overflow(x);\\n }\\n // Multiply x by `UNIT` to account for the factor of `UNIT` picked up when multiplying two UD60x18 numbers.\\n // In this case, the two numbers are both the square root.\\n result = wrap(Common.sqrt(xUint * uUNIT));\\n }\\n}\\n\",\"keccak256\":\"0x462144667aac3f96d5f8dba7aa68fe4c5a3f61e1d7bbbc81bee21168817f9c09\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\nimport \\\"./Helpers.sol\\\" as Helpers;\\nimport \\\"./Math.sol\\\" as Math;\\n\\n/// @notice The unsigned 60.18-decimal fixed-point number representation, which can have up to 60 digits and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the Solidity type uint256.\\n/// @dev The value type is defined here so it can be imported in all other files.\\ntype UD60x18 is uint256;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoSD1x18,\\n Casting.intoUD2x18,\\n Casting.intoSD59x18,\\n Casting.intoUint128,\\n Casting.intoUint256,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for UD60x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n MATHEMATICAL FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes the functions in this library callable on the UD60x18 type.\\nusing {\\n Math.avg,\\n Math.ceil,\\n Math.div,\\n Math.exp,\\n Math.exp2,\\n Math.floor,\\n Math.frac,\\n Math.gm,\\n Math.inv,\\n Math.ln,\\n Math.log10,\\n Math.log2,\\n Math.mul,\\n Math.pow,\\n Math.powu,\\n Math.sqrt\\n} for UD60x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n HELPER FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes the functions in this library callable on the UD60x18 type.\\nusing {\\n Helpers.add,\\n Helpers.and,\\n Helpers.eq,\\n Helpers.gt,\\n Helpers.gte,\\n Helpers.isZero,\\n Helpers.lshift,\\n Helpers.lt,\\n Helpers.lte,\\n Helpers.mod,\\n Helpers.neq,\\n Helpers.not,\\n Helpers.or,\\n Helpers.rshift,\\n Helpers.sub,\\n Helpers.uncheckedAdd,\\n Helpers.uncheckedSub,\\n Helpers.xor\\n} for UD60x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n OPERATORS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes it possible to use these operators on the UD60x18 type.\\nusing {\\n Helpers.add as +,\\n Helpers.and2 as &,\\n Math.div as /,\\n Helpers.eq as ==,\\n Helpers.gt as >,\\n Helpers.gte as >=,\\n Helpers.lt as <,\\n Helpers.lte as <=,\\n Helpers.or as |,\\n Helpers.mod as %,\\n Math.mul as *,\\n Helpers.neq as !=,\\n Helpers.not as ~,\\n Helpers.sub as -,\\n Helpers.xor as ^\\n} for UD60x18 global;\\n\",\"keccak256\":\"0xdd873b5124180d9b71498b3a7fe93b1c08c368bec741f7d5f8e17f78a0b70f31\",\"license\":\"MIT\"},\"contracts/interfaces/IERC6551Registry.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\ninterface IERC6551Registry {\\n /**\\n * @dev Creates a token bound account for a non-fungible token.\\n *\\n * If account has already been created, returns the account address without calling create2.\\n *\\n * Emits ERC6551AccountCreated event.\\n *\\n * @return account The address of the token bound account\\n */\\n function createAccount(\\n address implementation,\\n bytes32 salt,\\n uint256 chainId,\\n address tokenContract,\\n uint256 tokenId\\n ) external returns (address account);\\n}\\n\",\"keccak256\":\"0x64c52de8a8e68398e61dd8b42dda8e9af8cf6abf93bb85629c322440991ea568\",\"license\":\"MIT\"},\"contracts/interfaces/hats/HatsErrors.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface HatsErrors {\\n /// @notice Emitted when `user` is attempting to perform an action on `hatId` but is not wearing one of `hatId`'s admin hats\\n /// @dev Can be equivalent to `NotHatWearer(buildHatId(hatId))`, such as when emitted by `approveLinkTopHatToTree` or `relinkTopHatToTree`\\n error NotAdmin(address user, uint256 hatId);\\n\\n /// @notice Emitted when attempting to perform an action as or for an account that is not a wearer of a given hat\\n error NotHatWearer();\\n\\n /// @notice Emitted when attempting to perform an action that requires being either an admin or wearer of a given hat\\n error NotAdminOrWearer();\\n\\n /// @notice Emitted when attempting to mint `hatId` but `hatId`'s maxSupply has been reached\\n error AllHatsWorn(uint256 hatId);\\n\\n /// @notice Emitted when attempting to create a hat with a level 14 hat as its admin\\n error MaxLevelsReached();\\n\\n /// @notice Emitted when an attempted hat id has empty intermediate level(s)\\n error InvalidHatId();\\n\\n /// @notice Emitted when attempting to mint `hatId` to a `wearer` who is already wearing the hat\\n error AlreadyWearingHat(address wearer, uint256 hatId);\\n\\n /// @notice Emitted when attempting to mint a non-existant hat\\n error HatDoesNotExist(uint256 hatId);\\n\\n /// @notice Emmitted when attempting to mint or transfer a hat that is not active\\n error HatNotActive();\\n\\n /// @notice Emitted when attempting to mint or transfer a hat to an ineligible wearer\\n error NotEligible();\\n\\n /// @notice Emitted when attempting to check or set a hat's status from an account that is not that hat's toggle module\\n error NotHatsToggle();\\n\\n /// @notice Emitted when attempting to check or set a hat wearer's status from an account that is not that hat's eligibility module\\n error NotHatsEligibility();\\n\\n /// @notice Emitted when array arguments to a batch function have mismatching lengths\\n error BatchArrayLengthMismatch();\\n\\n /// @notice Emitted when attempting to mutate or transfer an immutable hat\\n error Immutable();\\n\\n /// @notice Emitted when attempting to change a hat's maxSupply to a value lower than its current supply\\n error NewMaxSupplyTooLow();\\n\\n /// @notice Emitted when attempting to link a tophat to a new admin for which the tophat serves as an admin\\n error CircularLinkage();\\n\\n /// @notice Emitted when attempting to link or relink a tophat to a separate tree\\n error CrossTreeLinkage();\\n\\n /// @notice Emitted when attempting to link a tophat without a request\\n error LinkageNotRequested();\\n\\n /// @notice Emitted when attempting to unlink a tophat that does not have a wearer\\n /// @dev This ensures that unlinking never results in a bricked tophat\\n error InvalidUnlink();\\n\\n /// @notice Emmited when attempting to change a hat's eligibility or toggle module to the zero address\\n error ZeroAddress();\\n\\n /// @notice Emmitted when attempting to change a hat's details or imageURI to a string with over 7000 bytes (~characters)\\n /// @dev This protects against a DOS attack where an admin iteratively extend's a hat's details or imageURI\\n /// to be so long that reading it exceeds the block gas limit, breaking `uri()` and `viewHat()`\\n error StringTooLong();\\n}\\n\",\"keccak256\":\"0x81b0056b7bed86eabc07c0e4a9655c586ddb8e6c128320593669b76efd5a08de\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/HatsEvents.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface HatsEvents {\\n /// @notice Emitted when a new hat is created\\n /// @param id The id for the new hat\\n /// @param details A description of the Hat\\n /// @param maxSupply The total instances of the Hat that can be worn at once\\n /// @param eligibility The address that can report on the Hat wearer's status\\n /// @param toggle The address that can deactivate the Hat\\n /// @param mutable_ Whether the hat's properties are changeable after creation\\n /// @param imageURI The image uri for this hat and the fallback for its\\n event HatCreated(\\n uint256 id,\\n string details,\\n uint32 maxSupply,\\n address eligibility,\\n address toggle,\\n bool mutable_,\\n string imageURI\\n );\\n\\n /// @notice Emitted when a hat wearer's standing is updated\\n /// @dev Eligibility is excluded since the source of truth for eligibility is the eligibility module and may change without a transaction\\n /// @param hatId The id of the wearer's hat\\n /// @param wearer The wearer's address\\n /// @param wearerStanding Whether the wearer is in good standing for the hat\\n event WearerStandingChanged(\\n uint256 hatId,\\n address wearer,\\n bool wearerStanding\\n );\\n\\n /// @notice Emitted when a hat's status is updated\\n /// @param hatId The id of the hat\\n /// @param newStatus Whether the hat is active\\n event HatStatusChanged(uint256 hatId, bool newStatus);\\n\\n /// @notice Emitted when a hat's details are updated\\n /// @param hatId The id of the hat\\n /// @param newDetails The updated details\\n event HatDetailsChanged(uint256 hatId, string newDetails);\\n\\n /// @notice Emitted when a hat's eligibility module is updated\\n /// @param hatId The id of the hat\\n /// @param newEligibility The updated eligibiliy module\\n event HatEligibilityChanged(uint256 hatId, address newEligibility);\\n\\n /// @notice Emitted when a hat's toggle module is updated\\n /// @param hatId The id of the hat\\n /// @param newToggle The updated toggle module\\n event HatToggleChanged(uint256 hatId, address newToggle);\\n\\n /// @notice Emitted when a hat's mutability is updated\\n /// @param hatId The id of the hat\\n event HatMutabilityChanged(uint256 hatId);\\n\\n /// @notice Emitted when a hat's maximum supply is updated\\n /// @param hatId The id of the hat\\n /// @param newMaxSupply The updated max supply\\n event HatMaxSupplyChanged(uint256 hatId, uint32 newMaxSupply);\\n\\n /// @notice Emitted when a hat's image URI is updated\\n /// @param hatId The id of the hat\\n /// @param newImageURI The updated image URI\\n event HatImageURIChanged(uint256 hatId, string newImageURI);\\n\\n /// @notice Emitted when a tophat linkage is requested by its admin\\n /// @param domain The domain of the tree tophat to link\\n /// @param newAdmin The tophat's would-be admin in the parent tree\\n event TopHatLinkRequested(uint32 domain, uint256 newAdmin);\\n\\n /// @notice Emitted when a tophat is linked to a another tree\\n /// @param domain The domain of the newly-linked tophat\\n /// @param newAdmin The tophat's new admin in the parent tree\\n event TopHatLinked(uint32 domain, uint256 newAdmin);\\n}\\n\",\"keccak256\":\"0x53413397d15e1636c3cd7bd667656b79bc2886785403b824bcd4ed122667f2c6\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/IHats.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\nimport \\\"./IHatsIdUtilities.sol\\\";\\nimport \\\"./HatsErrors.sol\\\";\\nimport \\\"./HatsEvents.sol\\\";\\n\\ninterface IHats is IHatsIdUtilities, HatsErrors, HatsEvents {\\n function mintTopHat(\\n address _target,\\n string memory _details,\\n string memory _imageURI\\n ) external returns (uint256 topHatId);\\n\\n function createHat(\\n uint256 _admin,\\n string calldata _details,\\n uint32 _maxSupply,\\n address _eligibility,\\n address _toggle,\\n bool _mutable,\\n string calldata _imageURI\\n ) external returns (uint256 newHatId);\\n\\n function batchCreateHats(\\n uint256[] calldata _admins,\\n string[] calldata _details,\\n uint32[] calldata _maxSupplies,\\n address[] memory _eligibilityModules,\\n address[] memory _toggleModules,\\n bool[] calldata _mutables,\\n string[] calldata _imageURIs\\n ) external returns (bool success);\\n\\n function getNextId(uint256 _admin) external view returns (uint256 nextId);\\n\\n function mintHat(\\n uint256 _hatId,\\n address _wearer\\n ) external returns (bool success);\\n\\n function batchMintHats(\\n uint256[] calldata _hatIds,\\n address[] calldata _wearers\\n ) external returns (bool success);\\n\\n function setHatStatus(\\n uint256 _hatId,\\n bool _newStatus\\n ) external returns (bool toggled);\\n\\n function checkHatStatus(uint256 _hatId) external returns (bool toggled);\\n\\n function setHatWearerStatus(\\n uint256 _hatId,\\n address _wearer,\\n bool _eligible,\\n bool _standing\\n ) external returns (bool updated);\\n\\n function checkHatWearerStatus(\\n uint256 _hatId,\\n address _wearer\\n ) external returns (bool updated);\\n\\n function renounceHat(uint256 _hatId) external;\\n\\n function transferHat(uint256 _hatId, address _from, address _to) external;\\n\\n /*//////////////////////////////////////////////////////////////\\n HATS ADMIN FUNCTIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n function makeHatImmutable(uint256 _hatId) external;\\n\\n function changeHatDetails(\\n uint256 _hatId,\\n string memory _newDetails\\n ) external;\\n\\n function changeHatEligibility(\\n uint256 _hatId,\\n address _newEligibility\\n ) external;\\n\\n function changeHatToggle(uint256 _hatId, address _newToggle) external;\\n\\n function changeHatImageURI(\\n uint256 _hatId,\\n string memory _newImageURI\\n ) external;\\n\\n function changeHatMaxSupply(uint256 _hatId, uint32 _newMaxSupply) external;\\n\\n function requestLinkTopHatToTree(\\n uint32 _topHatId,\\n uint256 _newAdminHat\\n ) external;\\n\\n function approveLinkTopHatToTree(\\n uint32 _topHatId,\\n uint256 _newAdminHat,\\n address _eligibility,\\n address _toggle,\\n string calldata _details,\\n string calldata _imageURI\\n ) external;\\n\\n function unlinkTopHatFromTree(uint32 _topHatId, address _wearer) external;\\n\\n function relinkTopHatWithinTree(\\n uint32 _topHatDomain,\\n uint256 _newAdminHat,\\n address _eligibility,\\n address _toggle,\\n string calldata _details,\\n string calldata _imageURI\\n ) external;\\n\\n /*//////////////////////////////////////////////////////////////\\n VIEW FUNCTIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n function viewHat(\\n uint256 _hatId\\n )\\n external\\n view\\n returns (\\n string memory details,\\n uint32 maxSupply,\\n uint32 supply,\\n address eligibility,\\n address toggle,\\n string memory imageURI,\\n uint16 lastHatId,\\n bool mutable_,\\n bool active\\n );\\n\\n function isWearerOfHat(\\n address _user,\\n uint256 _hatId\\n ) external view returns (bool isWearer);\\n\\n function isAdminOfHat(\\n address _user,\\n uint256 _hatId\\n ) external view returns (bool isAdmin);\\n\\n function isInGoodStanding(\\n address _wearer,\\n uint256 _hatId\\n ) external view returns (bool standing);\\n\\n function isEligible(\\n address _wearer,\\n uint256 _hatId\\n ) external view returns (bool eligible);\\n\\n function getHatEligibilityModule(\\n uint256 _hatId\\n ) external view returns (address eligibility);\\n\\n function getHatToggleModule(\\n uint256 _hatId\\n ) external view returns (address toggle);\\n\\n function getHatMaxSupply(\\n uint256 _hatId\\n ) external view returns (uint32 maxSupply);\\n\\n function hatSupply(uint256 _hatId) external view returns (uint32 supply);\\n\\n function getImageURIForHat(\\n uint256 _hatId\\n ) external view returns (string memory _uri);\\n\\n function balanceOf(\\n address wearer,\\n uint256 hatId\\n ) external view returns (uint256 balance);\\n\\n function balanceOfBatch(\\n address[] calldata _wearers,\\n uint256[] calldata _hatIds\\n ) external view returns (uint256[] memory);\\n\\n function uri(uint256 id) external view returns (string memory _uri);\\n}\\n\",\"keccak256\":\"0x2867004bddc5148fa1937f25c0403e5d9977583aaf50fdbdb74bd463f64f21c8\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/IHatsIdUtilities.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface IHatsIdUtilities {\\n function buildHatId(\\n uint256 _admin,\\n uint16 _newHat\\n ) external pure returns (uint256 id);\\n\\n function getHatLevel(uint256 _hatId) external view returns (uint32 level);\\n\\n function getLocalHatLevel(\\n uint256 _hatId\\n ) external pure returns (uint32 level);\\n\\n function isTopHat(uint256 _hatId) external view returns (bool _topHat);\\n\\n function isLocalTopHat(\\n uint256 _hatId\\n ) external pure returns (bool _localTopHat);\\n\\n function isValidHatId(\\n uint256 _hatId\\n ) external view returns (bool validHatId);\\n\\n function getAdminAtLevel(\\n uint256 _hatId,\\n uint32 _level\\n ) external view returns (uint256 admin);\\n\\n function getAdminAtLocalLevel(\\n uint256 _hatId,\\n uint32 _level\\n ) external pure returns (uint256 admin);\\n\\n function getTopHatDomain(\\n uint256 _hatId\\n ) external view returns (uint32 domain);\\n\\n function getTippyTopHatDomain(\\n uint32 _topHatDomain\\n ) external view returns (uint32 domain);\\n\\n function noCircularLinkage(\\n uint32 _topHatDomain,\\n uint256 _linkedAdmin\\n ) external view returns (bool notCircular);\\n\\n function sameTippyTopHatDomain(\\n uint32 _topHatDomain,\\n uint256 _newAdminHat\\n ) external view returns (bool sameDomain);\\n}\\n\",\"keccak256\":\"0x007fcc07b20bf84bacad1f9a2ddf4e30e1a8be961e144b7bef8e98a51781aee9\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/IHatsModuleFactory.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.19;\\n\\ninterface IHatsModuleFactory {\\n error HatsModuleFactory_ModuleAlreadyDeployed(\\n address implementation,\\n uint256 hatId,\\n bytes otherImmutableArgs,\\n uint256 saltNonce\\n );\\n\\n error BatchArrayLengthMismatch();\\n\\n event HatsModuleFactory_ModuleDeployed(\\n address implementation,\\n address instance,\\n uint256 hatId,\\n bytes otherImmutableArgs,\\n bytes initData,\\n uint256 saltNonce\\n );\\n\\n function HATS() external view returns (address);\\n\\n function version() external view returns (string memory);\\n\\n function createHatsModule(\\n address _implementation,\\n uint256 _hatId,\\n bytes calldata _otherImmutableArgs,\\n bytes calldata _initData,\\n uint256 _saltNonce\\n ) external returns (address _instance);\\n\\n function batchCreateHatsModule(\\n address[] calldata _implementations,\\n uint256[] calldata _hatIds,\\n bytes[] calldata _otherImmutableArgsArray,\\n bytes[] calldata _initDataArray,\\n uint256[] calldata _saltNonces\\n ) external returns (bool success);\\n\\n function getHatsModuleAddress(\\n address _implementation,\\n uint256 _hatId,\\n bytes calldata _otherImmutableArgs,\\n uint256 _saltNonce\\n ) external view returns (address);\\n\\n function deployed(\\n address _implementation,\\n uint256 _hatId,\\n bytes calldata _otherImmutableArgs,\\n uint256 _saltNonce\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x861faf40785cedb829243116d492653414a367853408a5c27d201522f6c3bfdd\",\"license\":\"MIT\"},\"contracts/interfaces/sablier/IAdminable.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\n/// @title IAdminable\\n/// @notice Contract module that provides a basic access control mechanism, with an admin that can be\\n/// granted exclusive access to specific functions. The inheriting contract must set the initial admin\\n/// in the constructor.\\ninterface IAdminable {\\n /*//////////////////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Emitted when the admin is transferred.\\n /// @param oldAdmin The address of the old admin.\\n /// @param newAdmin The address of the new admin.\\n event TransferAdmin(address indexed oldAdmin, address indexed newAdmin);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice The address of the admin account or contract.\\n function admin() external view returns (address);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n NON-CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Transfers the contract admin to a new address.\\n ///\\n /// @dev Notes:\\n /// - Does not revert if the admin is the same.\\n /// - This function can potentially leave the contract without an admin, thereby removing any\\n /// functionality that is only available to the admin.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the contract admin.\\n ///\\n /// @param newAdmin The address of the new admin.\\n function transferAdmin(address newAdmin) external;\\n}\\n\",\"keccak256\":\"0xa279c49e51228b571329164e36250e82b2c1378e8b549194ab7dd90fca9c3b2b\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/IERC4096.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 \\\"@openzeppelin/contracts/interfaces/IERC165.sol\\\";\\nimport {IERC721} from \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\n\\n/// @title ERC-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\",\"keccak256\":\"0xa34b9c52cbe36be860244f52256f1b05badf0cb797d208664b87337610d0e82d\",\"license\":\"MIT\"},\"contracts/interfaces/sablier/ISablierV2Lockup.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC4906} from \\\"./IERC4096.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IERC721Metadata} from \\\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\\\";\\nimport {UD60x18} from \\\"@prb/math/src/UD60x18.sol\\\";\\n\\nimport {Lockup} from \\\"./types/DataTypes.sol\\\";\\nimport {IAdminable} from \\\"./IAdminable.sol\\\";\\nimport {ISablierV2NFTDescriptor} from \\\"./ISablierV2NFTDescriptor.sol\\\";\\n\\n/// @title ISablierV2Lockup\\n/// @notice Common logic between all Sablier V2 Lockup contracts.\\ninterface ISablierV2Lockup is\\n IAdminable, // 0 inherited components\\n IERC4906, // 2 inherited components\\n IERC721Metadata // 2 inherited components\\n{\\n /*//////////////////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Emitted when the admin allows a new recipient contract to hook to Sablier.\\n /// @param admin The address of the current contract admin.\\n /// @param recipient The address of the recipient contract put on the allowlist.\\n event AllowToHook(address indexed admin, address recipient);\\n\\n /// @notice Emitted when a stream is canceled.\\n /// @param streamId The ID of the stream.\\n /// @param sender The address of the stream's sender.\\n /// @param recipient The address of the stream's recipient.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param senderAmount The amount of assets refunded to the stream's sender, denoted in units of the asset's\\n /// decimals.\\n /// @param recipientAmount The amount of assets left for the stream's recipient to withdraw, denoted in units of the\\n /// asset's decimals.\\n event CancelLockupStream(\\n uint256 streamId,\\n address indexed sender,\\n address indexed recipient,\\n IERC20 indexed asset,\\n uint128 senderAmount,\\n uint128 recipientAmount\\n );\\n\\n /// @notice Emitted when a sender gives up the right to cancel a stream.\\n /// @param streamId The ID of the stream.\\n event RenounceLockupStream(uint256 indexed streamId);\\n\\n /// @notice Emitted when the admin sets a new NFT descriptor contract.\\n /// @param admin The address of the current contract admin.\\n /// @param oldNFTDescriptor The address of the old NFT descriptor contract.\\n /// @param newNFTDescriptor The address of the new NFT descriptor contract.\\n event SetNFTDescriptor(\\n address indexed admin,\\n ISablierV2NFTDescriptor oldNFTDescriptor,\\n ISablierV2NFTDescriptor newNFTDescriptor\\n );\\n\\n /// @notice Emitted when assets are withdrawn from a stream.\\n /// @param streamId The ID of the stream.\\n /// @param to The address that has received the withdrawn assets.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param amount The amount of assets withdrawn, denoted in units of the asset's decimals.\\n event WithdrawFromLockupStream(\\n uint256 indexed streamId,\\n address indexed to,\\n IERC20 indexed asset,\\n uint128 amount\\n );\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Retrieves the address of the ERC-20 asset to be distributed.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getAsset(uint256 streamId) external view returns (IERC20 asset);\\n\\n /// @notice Retrieves the amount deposited in the stream, denoted in units of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getDepositedAmount(\\n uint256 streamId\\n ) external view returns (uint128 depositedAmount);\\n\\n /// @notice Retrieves the stream's end time, which is a Unix timestamp.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getEndTime(\\n uint256 streamId\\n ) external view returns (uint40 endTime);\\n\\n /// @notice Retrieves the stream's recipient.\\n /// @dev Reverts if the NFT has been burned.\\n /// @param streamId The stream ID for the query.\\n function getRecipient(\\n uint256 streamId\\n ) external view returns (address recipient);\\n\\n /// @notice Retrieves the amount refunded to the sender after a cancellation, denoted in units of the asset's\\n /// decimals. This amount is always zero unless the stream was canceled.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getRefundedAmount(\\n uint256 streamId\\n ) external view returns (uint128 refundedAmount);\\n\\n /// @notice Retrieves the stream's sender.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getSender(uint256 streamId) external view returns (address sender);\\n\\n /// @notice Retrieves the stream's start time, which is a Unix timestamp.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getStartTime(\\n uint256 streamId\\n ) external view returns (uint40 startTime);\\n\\n /// @notice Retrieves the amount withdrawn from the stream, denoted in units of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getWithdrawnAmount(\\n uint256 streamId\\n ) external view returns (uint128 withdrawnAmount);\\n\\n /// @notice Retrieves a flag indicating whether the provided address is a contract allowed to hook to Sablier\\n /// when a stream is canceled or when assets are withdrawn.\\n /// @dev See {ISablierLockupRecipient} for more information.\\n function isAllowedToHook(\\n address recipient\\n ) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream can be canceled. When the stream is cold, this\\n /// flag is always `false`.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isCancelable(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream is cold, i.e. settled, canceled, or depleted.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isCold(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream is depleted.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isDepleted(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream exists.\\n /// @dev Does not revert if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isStream(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream NFT can be transferred.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isTransferable(\\n uint256 streamId\\n ) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream is warm, i.e. either pending or streaming.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isWarm(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves the maximum broker fee that can be charged by the broker, denoted as a fixed-point\\n /// number where 1e18 is 100%.\\n /// @dev This value is hard coded as a constant.\\n function MAX_BROKER_FEE() external view returns (UD60x18);\\n\\n /// @notice Counter for stream IDs, used in the create functions.\\n function nextStreamId() external view returns (uint256);\\n\\n /// @notice Contract that generates the non-fungible token URI.\\n function nftDescriptor() external view returns (ISablierV2NFTDescriptor);\\n\\n /// @notice Calculates the amount that the sender would be refunded if the stream were canceled, denoted in units\\n /// of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function refundableAmountOf(\\n uint256 streamId\\n ) external view returns (uint128 refundableAmount);\\n\\n /// @notice Retrieves the stream's status.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function statusOf(\\n uint256 streamId\\n ) external view returns (Lockup.Status status);\\n\\n /// @notice Calculates the amount streamed to the recipient, denoted in units of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n ///\\n /// Notes:\\n /// - Upon cancellation of the stream, the amount streamed is calculated as the difference between the deposited\\n /// amount and the refunded amount. Ultimately, when the stream becomes depleted, the streamed amount is equivalent\\n /// to the total amount withdrawn.\\n ///\\n /// @param streamId The stream ID for the query.\\n function streamedAmountOf(\\n uint256 streamId\\n ) external view returns (uint128 streamedAmount);\\n\\n /// @notice Retrieves a flag indicating whether the stream was canceled.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function wasCanceled(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Calculates the amount that the recipient can withdraw from the stream, denoted in units of the asset's\\n /// decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function withdrawableAmountOf(\\n uint256 streamId\\n ) external view returns (uint128 withdrawableAmount);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n NON-CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Allows a recipient contract to hook to Sablier when a stream is canceled or when assets are withdrawn.\\n /// Useful for implementing contracts that hold streams on behalf of users, such as vaults or staking contracts.\\n ///\\n /// @dev Emits an {AllowToHook} event.\\n ///\\n /// Notes:\\n /// - Does not revert if the contract is already on the allowlist.\\n /// - This is an irreversible operation. The contract cannot be removed from the allowlist.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the contract admin.\\n /// - `recipient` must have a non-zero code size.\\n /// - `recipient` must implement {ISablierLockupRecipient}.\\n ///\\n /// @param recipient The address of the contract to allow for hooks.\\n function allowToHook(address recipient) external;\\n\\n /// @notice Burns the NFT associated with the stream.\\n ///\\n /// @dev Emits a {Transfer} event.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `streamId` must reference a depleted stream.\\n /// - The NFT must exist.\\n /// - `msg.sender` must be either the NFT owner or an approved third party.\\n ///\\n /// @param streamId The ID of the stream NFT to burn.\\n function burn(uint256 streamId) external;\\n\\n /// @notice Cancels the stream and refunds any remaining assets to the sender.\\n ///\\n /// @dev Emits a {Transfer}, {CancelLockupStream}, and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - If there any assets left for the recipient to withdraw, the stream is marked as canceled. Otherwise, the\\n /// stream is marked as depleted.\\n /// - This function attempts to invoke a hook on the recipient, if the resolved address is a contract.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - The stream must be warm and cancelable.\\n /// - `msg.sender` must be the stream's sender.\\n ///\\n /// @param streamId The ID of the stream to cancel.\\n function cancel(uint256 streamId) external;\\n\\n /// @notice Cancels multiple streams and refunds any remaining assets to the sender.\\n ///\\n /// @dev Emits multiple {Transfer}, {CancelLockupStream}, and {MetadataUpdate} events.\\n ///\\n /// Notes:\\n /// - Refer to the notes in {cancel}.\\n ///\\n /// Requirements:\\n /// - All requirements from {cancel} must be met for each stream.\\n ///\\n /// @param streamIds The IDs of the streams to cancel.\\n function cancelMultiple(uint256[] calldata streamIds) external;\\n\\n /// @notice Removes the right of the stream's sender to cancel the stream.\\n ///\\n /// @dev Emits a {RenounceLockupStream} and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - This is an irreversible operation.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `streamId` must reference a warm stream.\\n /// - `msg.sender` must be the stream's sender.\\n /// - The stream must be cancelable.\\n ///\\n /// @param streamId The ID of the stream to renounce.\\n function renounce(uint256 streamId) external;\\n\\n /// @notice Sets a new NFT descriptor contract, which produces the URI describing the Sablier stream NFTs.\\n ///\\n /// @dev Emits a {SetNFTDescriptor} and {BatchMetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - Does not revert if the NFT descriptor is the same.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the contract admin.\\n ///\\n /// @param newNFTDescriptor The address of the new NFT descriptor contract.\\n function setNFTDescriptor(\\n ISablierV2NFTDescriptor newNFTDescriptor\\n ) external;\\n\\n /// @notice Withdraws the provided amount of assets from the stream to the `to` address.\\n ///\\n /// @dev Emits a {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - This function attempts to call a hook on the recipient of the stream, unless `msg.sender` is the recipient.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `streamId` must not reference a null or depleted stream.\\n /// - `to` must not be the zero address.\\n /// - `amount` must be greater than zero and must not exceed the withdrawable amount.\\n /// - `to` must be the recipient if `msg.sender` is not the stream's recipient or an approved third party.\\n ///\\n /// @param streamId The ID of the stream to withdraw from.\\n /// @param to The address receiving the withdrawn assets.\\n /// @param amount The amount to withdraw, denoted in units of the asset's decimals.\\n function withdraw(uint256 streamId, address to, uint128 amount) external;\\n\\n /// @notice Withdraws the maximum withdrawable amount from the stream to the provided address `to`.\\n ///\\n /// @dev Emits a {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - Refer to the notes in {withdraw}.\\n ///\\n /// Requirements:\\n /// - Refer to the requirements in {withdraw}.\\n ///\\n /// @param streamId The ID of the stream to withdraw from.\\n /// @param to The address receiving the withdrawn assets.\\n /// @return withdrawnAmount The amount withdrawn, denoted in units of the asset's decimals.\\n function withdrawMax(\\n uint256 streamId,\\n address to\\n ) external returns (uint128 withdrawnAmount);\\n\\n /// @notice Withdraws the maximum withdrawable amount from the stream to the current recipient, and transfers the\\n /// NFT to `newRecipient`.\\n ///\\n /// @dev Emits a {WithdrawFromLockupStream} and a {Transfer} event.\\n ///\\n /// Notes:\\n /// - If the withdrawable amount is zero, the withdrawal is skipped.\\n /// - Refer to the notes in {withdraw}.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the stream's recipient.\\n /// - Refer to the requirements in {withdraw}.\\n /// - Refer to the requirements in {IERC721.transferFrom}.\\n ///\\n /// @param streamId The ID of the stream NFT to transfer.\\n /// @param newRecipient The address of the new owner of the stream NFT.\\n /// @return withdrawnAmount The amount withdrawn, denoted in units of the asset's decimals.\\n function withdrawMaxAndTransfer(\\n uint256 streamId,\\n address newRecipient\\n ) external returns (uint128 withdrawnAmount);\\n\\n /// @notice Withdraws assets from streams to the recipient of each stream.\\n ///\\n /// @dev Emits multiple {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} events.\\n ///\\n /// Notes:\\n /// - This function attempts to call a hook on the recipient of each stream, unless `msg.sender` is the recipient.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - There must be an equal number of `streamIds` and `amounts`.\\n /// - Each stream ID in the array must not reference a null or depleted stream.\\n /// - Each amount in the array must be greater than zero and must not exceed the withdrawable amount.\\n ///\\n /// @param streamIds The IDs of the streams to withdraw from.\\n /// @param amounts The amounts to withdraw, denoted in units of the asset's decimals.\\n function withdrawMultiple(\\n uint256[] calldata streamIds,\\n uint128[] calldata amounts\\n ) external;\\n}\\n\",\"keccak256\":\"0x3e5541c38a901637bd310965deb5bbde73ef07fe4ee3c752cbec330c6b9d62a3\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/ISablierV2LockupLinear.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\nimport {Lockup, LockupLinear} from \\\"./types/DataTypes.sol\\\";\\nimport {ISablierV2Lockup} from \\\"./ISablierV2Lockup.sol\\\";\\n\\n/// @title ISablierV2LockupLinear\\n/// @notice Creates and manages Lockup streams with a linear distribution function.\\ninterface ISablierV2LockupLinear is ISablierV2Lockup {\\n /*//////////////////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Emitted when a stream is created.\\n /// @param streamId The ID of the newly created stream.\\n /// @param funder The address which funded the stream.\\n /// @param sender The address distributing the assets, which will have the ability to cancel the stream.\\n /// @param recipient The address receiving the assets.\\n /// @param amounts Struct encapsulating (i) the deposit amount, and (ii) the broker fee amount, both denoted\\n /// in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Boolean indicating whether the stream will be cancelable or not.\\n /// @param transferable Boolean indicating whether the stream NFT is transferable or not.\\n /// @param timestamps Struct encapsulating (i) the stream's start time, (ii) cliff time, and (iii) end time, all as\\n /// Unix timestamps.\\n /// @param broker The address of the broker who has helped create the stream, e.g. a front-end website.\\n event CreateLockupLinearStream(\\n uint256 streamId,\\n address funder,\\n address indexed sender,\\n address indexed recipient,\\n Lockup.CreateAmounts amounts,\\n IERC20 indexed asset,\\n bool cancelable,\\n bool transferable,\\n LockupLinear.Timestamps timestamps,\\n address broker\\n );\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Retrieves the stream's cliff time, which is a Unix timestamp. A value of zero means there\\n /// is no cliff.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getCliffTime(\\n uint256 streamId\\n ) external view returns (uint40 cliffTime);\\n\\n /// @notice Retrieves the full stream details.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n /// @return stream See the documentation in {DataTypes}.\\n function getStream(\\n uint256 streamId\\n ) external view returns (LockupLinear.StreamLL memory stream);\\n\\n /// @notice Retrieves the stream's start, cliff and end timestamps.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n /// @return timestamps See the documentation in {DataTypes}.\\n function getTimestamps(\\n uint256 streamId\\n ) external view returns (LockupLinear.Timestamps memory timestamps);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n NON-CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Creates a stream by setting the start time to `block.timestamp`, and the end time to\\n /// the sum of `block.timestamp` and `params.durations.total`. The stream is funded by `msg.sender` and is wrapped\\n /// in an ERC-721 NFT.\\n ///\\n /// @dev Emits a {Transfer} and {CreateLockupLinearStream} event.\\n ///\\n /// Requirements:\\n /// - All requirements in {createWithTimestamps} must be met for the calculated parameters.\\n ///\\n /// @param params Struct encapsulating the function parameters, which are documented in {DataTypes}.\\n /// @return streamId The ID of the newly created stream.\\n function createWithDurations(\\n LockupLinear.CreateWithDurations calldata params\\n ) external returns (uint256 streamId);\\n\\n /// @notice Creates a stream with the provided start time and end time. The stream is funded by `msg.sender` and is\\n /// wrapped in an ERC-721 NFT.\\n ///\\n /// @dev Emits a {Transfer} and {CreateLockupLinearStream} event.\\n ///\\n /// Notes:\\n /// - A cliff time of zero means there is no cliff.\\n /// - As long as the times are ordered, it is not an error for the start or the cliff time to be in the past.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `params.totalAmount` must be greater than zero.\\n /// - If set, `params.broker.fee` must not be greater than `MAX_BROKER_FEE`.\\n /// - `params.timestamps.start` must be greater than zero and less than `params.timestamps.end`.\\n /// - If set, `params.timestamps.cliff` must be greater than `params.timestamps.start` and less than\\n /// `params.timestamps.end`.\\n /// - `params.timestamps.end` must be in the future.\\n /// - `params.recipient` must not be the zero address.\\n /// - `msg.sender` must have allowed this contract to spend at least `params.totalAmount` assets.\\n ///\\n /// @param params Struct encapsulating the function parameters, which are documented in {DataTypes}.\\n /// @return streamId The ID of the newly created stream.\\n function createWithTimestamps(\\n LockupLinear.CreateWithTimestamps calldata params\\n ) external returns (uint256 streamId);\\n}\\n\",\"keccak256\":\"0x064264723114b1f1cf3953fd79874dfcbb42cf313857aee6d5e6b09a23e0010b\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/ISablierV2NFTDescriptor.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC721Metadata} from \\\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\\\";\\n\\n/// @title ISablierV2NFTDescriptor\\n/// @notice This contract generates the URI describing the Sablier V2 stream NFTs.\\n/// @dev Inspired by Uniswap V3 Positions NFTs.\\ninterface ISablierV2NFTDescriptor {\\n /// @notice Produces the URI describing a particular stream NFT.\\n /// @dev This is a data URI with the JSON contents directly inlined.\\n /// @param sablier The address of the Sablier contract the stream was created in.\\n /// @param streamId The ID of the stream for which to produce a description.\\n /// @return uri The URI of the ERC721-compliant metadata.\\n function tokenURI(\\n IERC721Metadata sablier,\\n uint256 streamId\\n ) external view returns (string memory uri);\\n}\\n\",\"keccak256\":\"0x4ed430e553d14161e93efdaaacd1a502f49b38969c9d714b45d2e682a74fa0bc\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/types/DataTypes.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {UD2x18} from \\\"@prb/math/src/UD2x18.sol\\\";\\nimport {UD60x18} from \\\"@prb/math/src/UD60x18.sol\\\";\\n\\n// DataTypes.sol\\n//\\n// This file defines all structs used in V2 Core, most of which are organized under three namespaces:\\n//\\n// - Lockup\\n// - LockupDynamic\\n// - LockupLinear\\n// - LockupTranched\\n//\\n// You will notice that some structs contain \\\"slot\\\" annotations - they are used to indicate the\\n// storage layout of the struct. It is more gas efficient to group small data types together so\\n// that they fit in a single 32-byte slot.\\n\\n/// @notice Struct encapsulating the broker parameters passed to the create functions. Both can be set to zero.\\n/// @param account The address receiving the broker's fee.\\n/// @param fee The broker's percentage fee from the total amount, denoted as a fixed-point number where 1e18 is 100%.\\nstruct Broker {\\n address account;\\n UD60x18 fee;\\n}\\n\\n/// @notice Namespace for the structs used in both {SablierV2LockupLinear} and {SablierV2LockupDynamic}.\\nlibrary Lockup {\\n /// @notice Struct encapsulating the deposit, withdrawn, and refunded amounts, all denoted in units of the asset's\\n /// decimals.\\n /// @dev Because the deposited and the withdrawn amount are often read together, declaring them in the same slot\\n /// saves gas.\\n /// @param deposited The initial amount deposited in the stream, net of broker fee.\\n /// @param withdrawn The cumulative amount withdrawn from the stream.\\n /// @param refunded The amount refunded to the sender. Unless the stream was canceled, this is always zero.\\n struct Amounts {\\n // slot 0\\n uint128 deposited;\\n uint128 withdrawn;\\n // slot 1\\n uint128 refunded;\\n }\\n\\n /// @notice Struct encapsulating (i) the deposit amount and (ii) the broker fee amount, both denoted in units of the\\n /// asset's decimals.\\n /// @param deposit The amount to deposit in the stream.\\n /// @param brokerFee The broker fee amount.\\n struct CreateAmounts {\\n uint128 deposit;\\n uint128 brokerFee;\\n }\\n\\n /// @notice Enum representing the different statuses of a stream.\\n /// @custom:value0 PENDING Stream created but not started; assets are in a pending state.\\n /// @custom:value1 STREAMING Active stream where assets are currently being streamed.\\n /// @custom:value2 SETTLED All assets have been streamed; recipient is due to withdraw them.\\n /// @custom:value3 CANCELED Canceled stream; remaining assets await recipient's withdrawal.\\n /// @custom:value4 DEPLETED Depleted stream; all assets have been withdrawn and/or refunded.\\n enum Status {\\n PENDING,\\n STREAMING,\\n SETTLED,\\n CANCELED,\\n DEPLETED\\n }\\n\\n /// @notice A common data structure to be stored in all {SablierV2Lockup} models.\\n /// @dev The fields are arranged like this to save gas via tight variable packing.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream.\\n /// @param startTime The Unix timestamp indicating the stream's start.\\n /// @param endTime The Unix timestamp indicating the stream's end.\\n /// @param isCancelable Boolean indicating if the stream is cancelable.\\n /// @param wasCanceled Boolean indicating if the stream was canceled.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param isDepleted Boolean indicating if the stream is depleted.\\n /// @param isStream Boolean indicating if the struct entity exists.\\n /// @param isTransferable Boolean indicating if the stream NFT is transferable.\\n /// @param amounts Struct encapsulating the deposit, withdrawn, and refunded amounts, all denoted in units of the\\n /// asset's decimals.\\n struct Stream {\\n // slot 0\\n address sender;\\n uint40 startTime;\\n uint40 endTime;\\n bool isCancelable;\\n bool wasCanceled;\\n // slot 1\\n IERC20 asset;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n // slot 2 and 3\\n Lockup.Amounts amounts;\\n }\\n}\\n\\n/// @notice Namespace for the structs used in {SablierV2LockupDynamic}.\\nlibrary LockupDynamic {\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupDynamic.createWithDurations} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param segments Segments with durations used to compose the dynamic distribution function. Timestamps are\\n /// calculated by starting from `block.timestamp` and adding each duration to the previous timestamp.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithDurations {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n SegmentWithDuration[] segments;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupDynamic.createWithTimestamps} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param startTime The Unix timestamp indicating the stream's start.\\n /// @param segments Segments used to compose the dynamic distribution function.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithTimestamps {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n uint40 startTime;\\n Segment[] segments;\\n Broker broker;\\n }\\n\\n /// @notice Segment struct used in the Lockup Dynamic stream.\\n /// @param amount The amount of assets to be streamed in the segment, denoted in units of the asset's decimals.\\n /// @param exponent The exponent of the segment, denoted as a fixed-point number.\\n /// @param timestamp The Unix timestamp indicating the segment's end.\\n struct Segment {\\n // slot 0\\n uint128 amount;\\n UD2x18 exponent;\\n uint40 timestamp;\\n }\\n\\n /// @notice Segment struct used at runtime in {SablierV2LockupDynamic.createWithDurations}.\\n /// @param amount The amount of assets to be streamed in the segment, denoted in units of the asset's decimals.\\n /// @param exponent The exponent of the segment, denoted as a fixed-point number.\\n /// @param duration The time difference in seconds between the segment and the previous one.\\n struct SegmentWithDuration {\\n uint128 amount;\\n UD2x18 exponent;\\n uint40 duration;\\n }\\n\\n /// @notice Struct encapsulating the full details of a stream.\\n /// @dev Extends `Lockup.Stream` by including the recipient and the segments.\\n struct StreamLD {\\n address sender;\\n address recipient;\\n uint40 startTime;\\n uint40 endTime;\\n bool isCancelable;\\n bool wasCanceled;\\n IERC20 asset;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n Lockup.Amounts amounts;\\n Segment[] segments;\\n }\\n\\n /// @notice Struct encapsulating the LockupDynamic timestamps.\\n /// @param start The Unix timestamp indicating the stream's start.\\n /// @param end The Unix timestamp indicating the stream's end.\\n struct Timestamps {\\n uint40 start;\\n uint40 end;\\n }\\n}\\n\\n/// @notice Namespace for the structs used in {SablierV2LockupLinear}.\\nlibrary LockupLinear {\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupLinear.createWithDurations} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param durations Struct encapsulating (i) cliff period duration and (ii) total stream duration, both in seconds.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithDurations {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n Durations durations;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupLinear.createWithTimestamps} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param timestamps Struct encapsulating (i) the stream's start time, (ii) cliff time, and (iii) end time, all as\\n /// Unix timestamps.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithTimestamps {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n Timestamps timestamps;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the cliff duration and the total duration.\\n /// @param cliff The cliff duration in seconds.\\n /// @param total The total duration in seconds.\\n struct Durations {\\n uint40 cliff;\\n uint40 total;\\n }\\n\\n /// @notice Struct encapsulating the full details of a stream.\\n /// @dev Extends `Lockup.Stream` by including the recipient and the cliff time.\\n struct StreamLL {\\n address sender;\\n address recipient;\\n uint40 startTime;\\n bool isCancelable;\\n bool wasCanceled;\\n IERC20 asset;\\n uint40 endTime;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n Lockup.Amounts amounts;\\n uint40 cliffTime;\\n }\\n\\n /// @notice Struct encapsulating the LockupLinear timestamps.\\n /// @param start The Unix timestamp for the stream's start.\\n /// @param cliff The Unix timestamp for the cliff period's end. A value of zero means there is no cliff.\\n /// @param end The Unix timestamp for the stream's end.\\n struct Timestamps {\\n uint40 start;\\n uint40 cliff;\\n uint40 end;\\n }\\n}\\n\\n/// @notice Namespace for the structs used in {SablierV2LockupTranched}.\\nlibrary LockupTranched {\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupTranched.createWithDurations} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param tranches Tranches with durations used to compose the tranched distribution function. Timestamps are\\n /// calculated by starting from `block.timestamp` and adding each duration to the previous timestamp.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithDurations {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n TrancheWithDuration[] tranches;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupTranched.createWithTimestamps} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param startTime The Unix timestamp indicating the stream's start.\\n /// @param tranches Tranches used to compose the tranched distribution function.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithTimestamps {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n uint40 startTime;\\n Tranche[] tranches;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the full details of a stream.\\n /// @dev Extends `Lockup.Stream` by including the recipient and the tranches.\\n struct StreamLT {\\n address sender;\\n address recipient;\\n uint40 startTime;\\n uint40 endTime;\\n bool isCancelable;\\n bool wasCanceled;\\n IERC20 asset;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n Lockup.Amounts amounts;\\n Tranche[] tranches;\\n }\\n\\n /// @notice Struct encapsulating the LockupTranched timestamps.\\n /// @param start The Unix timestamp indicating the stream's start.\\n /// @param end The Unix timestamp indicating the stream's end.\\n struct Timestamps {\\n uint40 start;\\n uint40 end;\\n }\\n\\n /// @notice Tranche struct used in the Lockup Tranched stream.\\n /// @param amount The amount of assets to be unlocked in the tranche, denoted in units of the asset's decimals.\\n /// @param timestamp The Unix timestamp indicating the tranche's end.\\n struct Tranche {\\n // slot 0\\n uint128 amount;\\n uint40 timestamp;\\n }\\n\\n /// @notice Tranche struct used at runtime in {SablierV2LockupTranched.createWithDurations}.\\n /// @param amount The amount of assets to be unlocked in the tranche, denoted in units of the asset's decimals.\\n /// @param duration The time difference in seconds between the tranche and the previous one.\\n struct TrancheWithDuration {\\n uint128 amount;\\n uint40 duration;\\n }\\n}\\n\",\"keccak256\":\"0x727722c0ec71a76a947b935c9dfcac8fd846d6c3547dfbc8739c7109f3b95068\",\"license\":\"GPL-3.0-or-later\"},\"contracts/modules/DecentHatsModificationModule.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.28;\\n\\nimport {DecentHatsModuleUtils} from \\\"./DecentHatsModuleUtils.sol\\\";\\n\\ncontract DecentHatsModificationModule is DecentHatsModuleUtils {\\n /**\\n * @notice Creates a new termed or untermed role hat and any streams on it.\\n *\\n * @notice This contract should be enabled a module on the Safe for which the role is to be created, and disabled after.\\n *\\n * @dev Stream funds on untermed Roles are targeted at the hat's smart account. In order to withdraw funds from the stream, the\\n * hat's smart account must be the one call to `withdraw-` on the Sablier contract, setting the recipient arg to its wearer.\\n *\\n * @dev Stream funds on termed Roles are targeted directly at the nominated wearer.\\n * The wearer should directly call `withdraw-` on the Sablier contract.\\n *\\n * @dev Role hat creation, minting, smart account creation and stream creation are handled here in order\\n * to avoid a race condition where not more than one active proposal to create a new role can exist at a time.\\n * See: https://github.com/decentdao/decent-interface/issues/2402\\n *\\n * @param roleHatsParams An array of params for each role hat to be created.\\n */\\n function createRoleHats(\\n CreateRoleHatsParams calldata roleHatsParams\\n ) external {\\n _processRoleHats(roleHatsParams);\\n }\\n}\\n\",\"keccak256\":\"0x45b9470e000a416382deebea44a8c8734a2d6b453e8c7fbba5ea9bc6fdd4917c\",\"license\":\"MIT\"},\"contracts/modules/DecentHatsModuleUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.28;\\n\\nimport {Enum} from \\\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\\\";\\nimport {IAvatar} from \\\"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IERC6551Registry} from \\\"../interfaces/IERC6551Registry.sol\\\";\\nimport {IHats} from \\\"../interfaces/hats/IHats.sol\\\";\\nimport {LockupLinear, Broker} from \\\"../interfaces/sablier/types/DataTypes.sol\\\";\\nimport {IHatsModuleFactory} from \\\"../interfaces/hats/IHatsModuleFactory.sol\\\";\\nimport {ISablierV2LockupLinear} from \\\"../interfaces/sablier/ISablierV2LockupLinear.sol\\\";\\nimport {Strings} from \\\"@openzeppelin/contracts/utils/Strings.sol\\\";\\n\\nabstract contract DecentHatsModuleUtils {\\n bytes32 public constant SALT =\\n 0x5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b5072;\\n\\n struct SablierStreamParams {\\n ISablierV2LockupLinear sablier;\\n address sender;\\n address asset;\\n LockupLinear.Timestamps timestamps;\\n Broker broker;\\n uint128 totalAmount;\\n bool cancelable;\\n bool transferable;\\n }\\n\\n struct HatParams {\\n address wearer;\\n string details;\\n string imageURI;\\n SablierStreamParams[] sablierStreamsParams;\\n uint128 termEndDateTs; // If 0, this is an untermed Hat\\n uint32 maxSupply;\\n bool isMutable;\\n }\\n\\n struct CreateRoleHatsParams {\\n IHats hatsProtocol;\\n IERC6551Registry erc6551Registry;\\n address hatsAccountImplementation;\\n uint256 topHatId;\\n address topHatAccount;\\n address keyValuePairs;\\n IHatsModuleFactory hatsModuleFactory;\\n address hatsElectionsEligibilityImplementation;\\n uint256 adminHatId;\\n HatParams[] hats;\\n }\\n\\n function _processRoleHats(\\n CreateRoleHatsParams memory roleHatsParams\\n ) internal {\\n for (uint256 i = 0; i < roleHatsParams.hats.length; ) {\\n HatParams memory hatParams = roleHatsParams.hats[i];\\n\\n // Create eligibility module if needed\\n address eligibilityAddress = _createEligibilityModule(\\n roleHatsParams.hatsProtocol,\\n roleHatsParams.hatsModuleFactory,\\n roleHatsParams.hatsElectionsEligibilityImplementation,\\n roleHatsParams.topHatId,\\n roleHatsParams.topHatAccount,\\n roleHatsParams.adminHatId,\\n hatParams.termEndDateTs\\n );\\n\\n // Create and Mint the Role Hat\\n uint256 hatId = _createAndMintHat(\\n roleHatsParams.hatsProtocol,\\n roleHatsParams.adminHatId,\\n hatParams,\\n eligibilityAddress,\\n roleHatsParams.topHatAccount\\n );\\n\\n // Get the stream recipient (based on termed or not)\\n address streamRecipient = _setupStreamRecipient(\\n roleHatsParams.erc6551Registry,\\n roleHatsParams.hatsAccountImplementation,\\n address(roleHatsParams.hatsProtocol),\\n hatParams.termEndDateTs,\\n hatParams.wearer,\\n hatId\\n );\\n\\n // Create streams\\n _processSablierStreams(\\n hatParams.sablierStreamsParams,\\n streamRecipient,\\n roleHatsParams.keyValuePairs,\\n hatId\\n );\\n\\n unchecked {\\n ++i;\\n }\\n }\\n }\\n\\n function _createEligibilityModule(\\n IHats hatsProtocol,\\n IHatsModuleFactory hatsModuleFactory,\\n address hatsElectionsEligibilityImplementation,\\n uint256 topHatId,\\n address topHatAccount,\\n uint256 adminHatId,\\n uint128 termEndDateTs\\n ) private returns (address) {\\n // If the Hat is termed, create the eligibility module\\n if (termEndDateTs != 0) {\\n return\\n hatsModuleFactory.createHatsModule(\\n hatsElectionsEligibilityImplementation,\\n hatsProtocol.getNextId(adminHatId),\\n abi.encode(topHatId, uint256(0)), // [BALLOT_BOX_ID, ADMIN_HAT_ID]\\n abi.encode(termEndDateTs),\\n uint256(SALT)\\n );\\n }\\n\\n // Otherwise, return the Top Hat account\\n return topHatAccount;\\n }\\n\\n function _createAndMintHat(\\n IHats hatsProtocol,\\n uint256 adminHatId,\\n HatParams memory hat,\\n address eligibilityAddress,\\n address topHatAccount\\n ) private returns (uint256) {\\n // Grab the next Hat ID (before creating it)\\n uint256 hatId = hatsProtocol.getNextId(adminHatId);\\n\\n // Create the new Hat\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"createHat(uint256,string,uint32,address,address,bool,string)\\\",\\n adminHatId,\\n hat.details,\\n hat.maxSupply,\\n eligibilityAddress,\\n topHatAccount,\\n hat.isMutable,\\n hat.imageURI\\n ),\\n Enum.Operation.Call\\n );\\n\\n // If the Hat is termed, nominate the wearer as the eligible member\\n if (hat.termEndDateTs != 0) {\\n address[] memory nominatedWearers = new address[](1);\\n nominatedWearers[0] = hat.wearer;\\n\\n IAvatar(msg.sender).execTransactionFromModule(\\n eligibilityAddress,\\n 0,\\n abi.encodeWithSignature(\\n \\\"elect(uint128,address[])\\\",\\n hat.termEndDateTs,\\n nominatedWearers\\n ),\\n Enum.Operation.Call\\n );\\n }\\n\\n // Mint the Hat\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"mintHat(uint256,address)\\\",\\n hatId,\\n hat.wearer\\n ),\\n Enum.Operation.Call\\n );\\n return hatId;\\n }\\n\\n // Exists to avoid stack too deep errors\\n function _setupStreamRecipient(\\n IERC6551Registry erc6551Registry,\\n address hatsAccountImplementation,\\n address hatsProtocol,\\n uint128 termEndDateTs,\\n address wearer,\\n uint256 hatId\\n ) private returns (address) {\\n // If the hat is termed, the wearer is the stream recipient\\n if (termEndDateTs != 0) {\\n return wearer;\\n }\\n\\n // Otherwise, the Hat's smart account is the stream recipient\\n return\\n erc6551Registry.createAccount(\\n hatsAccountImplementation,\\n SALT,\\n block.chainid,\\n hatsProtocol,\\n hatId\\n );\\n }\\n\\n function _processSablierStreams(\\n SablierStreamParams[] memory streamParams,\\n address streamRecipient,\\n address keyValuePairs,\\n uint256 hatId\\n ) private {\\n for (uint256 i = 0; i < streamParams.length; ) {\\n SablierStreamParams memory sablierStreamParams = streamParams[i];\\n\\n // Approve tokens for Sablier\\n IAvatar(msg.sender).execTransactionFromModule(\\n sablierStreamParams.asset,\\n 0,\\n abi.encodeWithSignature(\\n \\\"approve(address,uint256)\\\",\\n sablierStreamParams.sablier,\\n sablierStreamParams.totalAmount\\n ),\\n Enum.Operation.Call\\n );\\n uint256 streamId = ISablierV2LockupLinear(\\n sablierStreamParams.sablier\\n ).nextStreamId();\\n\\n // Proxy the Sablier call through IAvatar\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(sablierStreamParams.sablier),\\n 0,\\n abi.encodeWithSignature(\\n \\\"createWithTimestamps((address,address,uint128,address,bool,bool,(uint40,uint40,uint40),(address,uint256)))\\\",\\n LockupLinear.CreateWithTimestamps({\\n sender: sablierStreamParams.sender,\\n recipient: streamRecipient,\\n totalAmount: sablierStreamParams.totalAmount,\\n asset: IERC20(sablierStreamParams.asset),\\n cancelable: sablierStreamParams.cancelable,\\n transferable: sablierStreamParams.transferable,\\n timestamps: sablierStreamParams.timestamps,\\n broker: sablierStreamParams.broker\\n })\\n ),\\n Enum.Operation.Call\\n );\\n\\n // Update KeyValuePairs with the stream ID and Hat ID\\n string[] memory keys = new string[](1);\\n string[] memory values = new string[](1);\\n keys[0] = \\\"hatIdToStreamId\\\";\\n values[0] = string(\\n abi.encodePacked(\\n Strings.toString(hatId),\\n \\\":\\\",\\n Strings.toString(streamId)\\n )\\n );\\n\\n IAvatar(msg.sender).execTransactionFromModule(\\n keyValuePairs,\\n 0,\\n abi.encodeWithSignature(\\n \\\"updateValues(string[],string[])\\\",\\n keys,\\n values\\n ),\\n Enum.Operation.Call\\n );\\n\\n unchecked {\\n ++i;\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xcf91d6de2291dd71d2491292ee2d1120c444b8f4f11b8c31429ed4c630013e69\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052348015600f57600080fd5b506116d88061001f6000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80630ad5e4271461003b578063ba9a91a514610050575b600080fd5b61004e610049366004610c55565b610089565b005b6100777f5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b507281565b60405190815260200160405180910390f35b61009a6100958261118c565b61009d565b50565b60005b8161012001515181101561016857600082610120015182815181106100c7576100c7611260565b6020026020010151905060006100ff84600001518560c001518660e0015187606001518860800151896101000151886080015161016c565b9050600061011d8560000151866101000151858589608001516102e5565b905060006101438660200151876040015188600001518760800151886000015187610617565b90506101598460600151828860a00151856106e3565b846001019450505050506100a0565b5050565b60006001600160801b038216156102d757866001600160a01b0316632f7fb7b6878a6001600160a01b0316631183a8c0876040518263ffffffff1660e01b81526004016101bb91815260200190565b602060405180830381865afa1580156101d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101fc9190611276565b886000604051602001610219929190918252602082015260400190565b60408051601f198184030181528282526001600160801b0389166020840152910160408051601f19818403018152908290526001600160e01b031960e087901b16825261028d949392917f5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b5072906004016112df565b6020604051808303816000875af11580156102ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102d0919061132b565b90506102da565b50825b979650505050505050565b60405162460ea360e61b81526004810185905260009081906001600160a01b03881690631183a8c090602401602060405180830381865afa15801561032e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103529190611276565b9050336001600160a01b031663468721a78860008989602001518a60a001518a8a8d60c001518e604001516040516024016103939796959493929190611348565b60408051601f198184030181529181526020820180516001600160e01b0316635829492f60e11b1790525160e085901b6001600160e01b03191681526103e1939291906000906004016113ac565b6020604051808303816000875af1158015610400573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104249190611402565b5060808501516001600160801b03161561054f576040805160018082528183019092526000916020808301908036833701905050905085600001518160008151811061047257610472611260565b60200260200101906001600160a01b031690816001600160a01b031681525050336001600160a01b031663468721a78660008960800151856040516024016104bb92919061141f565b60408051601f198184030181529181526020820180516001600160e01b0316634a231cef60e01b1790525160e085901b6001600160e01b0319168152610509939291906000906004016113ac565b6020604051808303816000875af1158015610528573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061054c9190611402565b50505b8451604051602481018390526001600160a01b039091166044820152339063468721a790899060009060640160408051601f198184030181529181526020820180516001600160e01b031663320fbbb760e11b1790525160e085901b6001600160e01b03191681526105c9939291906000906004016113ac565b6020604051808303816000875af11580156105e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061060c9190611402565b509695505050505050565b60006001600160801b0384161561062f5750816106d9565b604051638a54c52f60e01b81526001600160a01b0387811660048301527f5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b50726024830152466044830152868116606483015260848201849052881690638a54c52f9060a4016020604051808303816000875af11580156106b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106d6919061132b565b90505b9695505050505050565b60005b8451811015610b4657600085828151811061070357610703611260565b60200260200101519050336001600160a01b031663468721a78260400151600084600001518560a0015160405160240161075b9291906001600160a01b039290921682526001600160801b0316602082015260400190565b60408051601f198184030181529181526020820180516001600160e01b031663095ea7b360e01b1790525160e085901b6001600160e01b03191681526107a9939291906000906004016113ac565b6020604051808303816000875af11580156107c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ec9190611402565b50600081600001516001600160a01b0316631e99d5696040518163ffffffff1660e01b8152600401602060405180830381865afa158015610831573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108559190611276565b9050336001600160a01b031663468721a78360000151600060405180610100016040528087602001516001600160a01b031681526020018b6001600160a01b031681526020018760a001516001600160801b0316815260200187604001516001600160a01b031681526020018760c00151151581526020018760e00151151581526020018760600151815260200187608001518152506040516024016108fb9190611480565b60408051601f198184030181529181526020820180516001600160e01b03166353b1572760e01b1790525160e085901b6001600160e01b0319168152610949939291906000906004016113ac565b6020604051808303816000875af1158015610968573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061098c9190611402565b50604080516001808252818301909252600091816020015b60608152602001906001900390816109a457505060408051600180825281830190925291925060009190602082015b60608152602001906001900390816109d35790505090506040518060400160405280600f81526020016e1a185d1259151bd4dd1c99585b5259608a1b81525082600081518110610a2557610a25611260565b6020026020010181905250610a3986610b4d565b610a4284610b4d565b604051602001610a5392919061154f565b60405160208183030381529060405281600081518110610a7557610a75611260565b6020026020010181905250336001600160a01b031663468721a78860008585604051602401610aa59291906115db565b60408051601f198184030181529181526020820180516001600160e01b031663579374b960e11b1790525160e085901b6001600160e01b0319168152610af3939291906000906004016113ac565b6020604051808303816000875af1158015610b12573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b369190611402565b50846001019450505050506106e6565b5050505050565b606081600003610b745750506040805180820190915260018152600360fc1b602082015290565b8160005b8115610b9e5780610b888161161f565b9150610b979050600a8361164e565b9150610b78565b6000816001600160401b03811115610bb857610bb8610c97565b6040519080825280601f01601f191660200182016040528015610be2576020820181803683370190505b5090505b8415610c4d57610bf7600183611662565b9150610c04600a8661167b565b610c0f90603061168f565b60f81b818381518110610c2457610c24611260565b60200101906001600160f81b031916908160001a905350610c46600a8661164e565b9450610be6565b949350505050565b600060208284031215610c6757600080fd5b81356001600160401b03811115610c7d57600080fd5b82016101408185031215610c9057600080fd5b9392505050565b634e487b7160e01b600052604160045260246000fd5b60405161010081016001600160401b0381118282101715610cd057610cd0610c97565b60405290565b60405160e081016001600160401b0381118282101715610cd057610cd0610c97565b60405161014081016001600160401b0381118282101715610cd057610cd0610c97565b604051601f8201601f191681016001600160401b0381118282101715610d4357610d43610c97565b604052919050565b6001600160a01b038116811461009a57600080fd5b8035610d6b81610d4b565b919050565b60006001600160401b03821115610d8957610d89610c97565b5060051b60200190565b600082601f830112610da457600080fd5b81356001600160401b03811115610dbd57610dbd610c97565b610dd0601f8201601f1916602001610d1b565b818152846020838601011115610de557600080fd5b816020850160208301376000918101602001919091529392505050565b803564ffffffffff81168114610d6b57600080fd5b600060608284031215610e2957600080fd5b604051606081016001600160401b0381118282101715610e4b57610e4b610c97565b604052905080610e5a83610e02565b8152610e6860208401610e02565b6020820152610e7960408401610e02565b60408201525092915050565b600060408284031215610e9757600080fd5b604080519081016001600160401b0381118282101715610eb957610eb9610c97565b6040529050808235610eca81610d4b565b8152602092830135920191909152919050565b80356001600160801b0381168114610d6b57600080fd5b801515811461009a57600080fd5b8035610d6b81610ef4565b600082601f830112610f1e57600080fd5b8135610f31610f2c82610d70565b610d1b565b8082825260208201915060206101608402860101925085831115610f5457600080fd5b602085015b83811015611012576101608188031215610f7257600080fd5b610f7a610cad565b610f8382610d60565b8152610f9160208301610d60565b6020820152610fa260408301610d60565b6040820152610fb48860608401610e17565b6060820152610fc68860c08401610e85565b6080820152610fd86101008301610edd565b60a0820152610fea6101208301610f02565b60c0820152610ffc6101408301610f02565b60e0820152835260209092019161016001610f59565b5095945050505050565b803563ffffffff81168114610d6b57600080fd5b600082601f83011261104157600080fd5b813561104f610f2c82610d70565b8082825260208201915060208360051b86010192508583111561107157600080fd5b602085015b838110156110125780356001600160401b0381111561109457600080fd5b860160e0818903601f190112156110aa57600080fd5b6110b2610cd6565b6110be60208301610d60565b815260408201356001600160401b038111156110d957600080fd5b6110e88a602083860101610d93565b60208301525060608201356001600160401b0381111561110757600080fd5b6111168a602083860101610d93565b60408301525060808201356001600160401b0381111561113557600080fd5b6111448a602083860101610f0d565b60608301525061115660a08301610edd565b608082015261116760c0830161101c565b60a082015261117860e08301610f02565b60c082015284525060209283019201611076565b6000610140823603121561119f57600080fd5b6111a7610cf8565b6111b083610d60565b81526111be60208401610d60565b60208201526111cf60408401610d60565b6040820152606083810135908201526111ea60808401610d60565b60808201526111fb60a08401610d60565b60a082015261120c60c08401610d60565b60c082015261121d60e08401610d60565b60e082015261010083810135908201526101208301356001600160401b0381111561124757600080fd5b61125336828601611030565b6101208301525092915050565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561128857600080fd5b5051919050565b60005b838110156112aa578181015183820152602001611292565b50506000910152565b600081518084526112cb81602086016020860161128f565b601f01601f19169290920160200192915050565b60018060a01b038616815284602082015260a06040820152600061130660a08301866112b3565b828103606084015261131881866112b3565b9150508260808301529695505050505050565b60006020828403121561133d57600080fd5b8151610c9081610d4b565b87815260e06020820152600061136160e08301896112b3565b63ffffffff881660408401526001600160a01b0387811660608501528616608084015284151560a084015282810360c084015261139e81856112b3565b9a9950505050505050505050565b60018060a01b03851681528360208201526080604082015260006113d360808301856112b3565b9050600283106113f357634e487b7160e01b600052602160045260246000fd5b82606083015295945050505050565b60006020828403121561141457600080fd5b8151610c9081610ef4565b6000604082016001600160801b03851683526040602084015280845180835260608501915060208601925060005b818110156114745783516001600160a01b031683526020938401939092019160010161144d565b50909695505050505050565b81516001600160a01b0390811682526020808401518216908301526040808401516001600160801b031690830152606080840151918216908301526101608201905060808301516114d5608084018215159052565b5060a08301516114e960a084018215159052565b5060c083015161152860c084018264ffffffffff815116825264ffffffffff602082015116602083015264ffffffffff60408201511660408301525050565b5060e0929092015180516001600160a01b0316610120830152602001516101409091015290565b6000835161156181846020880161128f565b601d60f91b908301908152835161157f81600184016020880161128f565b01600101949350505050565b600082825180855260208501945060208160051b8301016020850160005b8381101561147457601f198584030188526115c58383516112b3565b60209889019890935091909101906001016115a9565b6040815260006115ee604083018561158b565b8281036020840152611600818561158b565b95945050505050565b634e487b7160e01b600052601160045260246000fd5b60006001820161163157611631611609565b5060010190565b634e487b7160e01b600052601260045260246000fd5b60008261165d5761165d611638565b500490565b8181038181111561167557611675611609565b92915050565b60008261168a5761168a611638565b500690565b808201808211156116755761167561160956fea2646970667358221220cbb4b307eab1d5ffde2b7ecaf86a40052d6217b110fff2ecda840a0a4b601bdc64736f6c634300081c0033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100365760003560e01c80630ad5e4271461003b578063ba9a91a514610050575b600080fd5b61004e610049366004610c55565b610089565b005b6100777f5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b507281565b60405190815260200160405180910390f35b61009a6100958261118c565b61009d565b50565b60005b8161012001515181101561016857600082610120015182815181106100c7576100c7611260565b6020026020010151905060006100ff84600001518560c001518660e0015187606001518860800151896101000151886080015161016c565b9050600061011d8560000151866101000151858589608001516102e5565b905060006101438660200151876040015188600001518760800151886000015187610617565b90506101598460600151828860a00151856106e3565b846001019450505050506100a0565b5050565b60006001600160801b038216156102d757866001600160a01b0316632f7fb7b6878a6001600160a01b0316631183a8c0876040518263ffffffff1660e01b81526004016101bb91815260200190565b602060405180830381865afa1580156101d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101fc9190611276565b886000604051602001610219929190918252602082015260400190565b60408051601f198184030181528282526001600160801b0389166020840152910160408051601f19818403018152908290526001600160e01b031960e087901b16825261028d949392917f5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b5072906004016112df565b6020604051808303816000875af11580156102ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102d0919061132b565b90506102da565b50825b979650505050505050565b60405162460ea360e61b81526004810185905260009081906001600160a01b03881690631183a8c090602401602060405180830381865afa15801561032e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103529190611276565b9050336001600160a01b031663468721a78860008989602001518a60a001518a8a8d60c001518e604001516040516024016103939796959493929190611348565b60408051601f198184030181529181526020820180516001600160e01b0316635829492f60e11b1790525160e085901b6001600160e01b03191681526103e1939291906000906004016113ac565b6020604051808303816000875af1158015610400573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104249190611402565b5060808501516001600160801b03161561054f576040805160018082528183019092526000916020808301908036833701905050905085600001518160008151811061047257610472611260565b60200260200101906001600160a01b031690816001600160a01b031681525050336001600160a01b031663468721a78660008960800151856040516024016104bb92919061141f565b60408051601f198184030181529181526020820180516001600160e01b0316634a231cef60e01b1790525160e085901b6001600160e01b0319168152610509939291906000906004016113ac565b6020604051808303816000875af1158015610528573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061054c9190611402565b50505b8451604051602481018390526001600160a01b039091166044820152339063468721a790899060009060640160408051601f198184030181529181526020820180516001600160e01b031663320fbbb760e11b1790525160e085901b6001600160e01b03191681526105c9939291906000906004016113ac565b6020604051808303816000875af11580156105e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061060c9190611402565b509695505050505050565b60006001600160801b0384161561062f5750816106d9565b604051638a54c52f60e01b81526001600160a01b0387811660048301527f5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b50726024830152466044830152868116606483015260848201849052881690638a54c52f9060a4016020604051808303816000875af11580156106b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106d6919061132b565b90505b9695505050505050565b60005b8451811015610b4657600085828151811061070357610703611260565b60200260200101519050336001600160a01b031663468721a78260400151600084600001518560a0015160405160240161075b9291906001600160a01b039290921682526001600160801b0316602082015260400190565b60408051601f198184030181529181526020820180516001600160e01b031663095ea7b360e01b1790525160e085901b6001600160e01b03191681526107a9939291906000906004016113ac565b6020604051808303816000875af11580156107c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ec9190611402565b50600081600001516001600160a01b0316631e99d5696040518163ffffffff1660e01b8152600401602060405180830381865afa158015610831573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108559190611276565b9050336001600160a01b031663468721a78360000151600060405180610100016040528087602001516001600160a01b031681526020018b6001600160a01b031681526020018760a001516001600160801b0316815260200187604001516001600160a01b031681526020018760c00151151581526020018760e00151151581526020018760600151815260200187608001518152506040516024016108fb9190611480565b60408051601f198184030181529181526020820180516001600160e01b03166353b1572760e01b1790525160e085901b6001600160e01b0319168152610949939291906000906004016113ac565b6020604051808303816000875af1158015610968573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061098c9190611402565b50604080516001808252818301909252600091816020015b60608152602001906001900390816109a457505060408051600180825281830190925291925060009190602082015b60608152602001906001900390816109d35790505090506040518060400160405280600f81526020016e1a185d1259151bd4dd1c99585b5259608a1b81525082600081518110610a2557610a25611260565b6020026020010181905250610a3986610b4d565b610a4284610b4d565b604051602001610a5392919061154f565b60405160208183030381529060405281600081518110610a7557610a75611260565b6020026020010181905250336001600160a01b031663468721a78860008585604051602401610aa59291906115db565b60408051601f198184030181529181526020820180516001600160e01b031663579374b960e11b1790525160e085901b6001600160e01b0319168152610af3939291906000906004016113ac565b6020604051808303816000875af1158015610b12573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b369190611402565b50846001019450505050506106e6565b5050505050565b606081600003610b745750506040805180820190915260018152600360fc1b602082015290565b8160005b8115610b9e5780610b888161161f565b9150610b979050600a8361164e565b9150610b78565b6000816001600160401b03811115610bb857610bb8610c97565b6040519080825280601f01601f191660200182016040528015610be2576020820181803683370190505b5090505b8415610c4d57610bf7600183611662565b9150610c04600a8661167b565b610c0f90603061168f565b60f81b818381518110610c2457610c24611260565b60200101906001600160f81b031916908160001a905350610c46600a8661164e565b9450610be6565b949350505050565b600060208284031215610c6757600080fd5b81356001600160401b03811115610c7d57600080fd5b82016101408185031215610c9057600080fd5b9392505050565b634e487b7160e01b600052604160045260246000fd5b60405161010081016001600160401b0381118282101715610cd057610cd0610c97565b60405290565b60405160e081016001600160401b0381118282101715610cd057610cd0610c97565b60405161014081016001600160401b0381118282101715610cd057610cd0610c97565b604051601f8201601f191681016001600160401b0381118282101715610d4357610d43610c97565b604052919050565b6001600160a01b038116811461009a57600080fd5b8035610d6b81610d4b565b919050565b60006001600160401b03821115610d8957610d89610c97565b5060051b60200190565b600082601f830112610da457600080fd5b81356001600160401b03811115610dbd57610dbd610c97565b610dd0601f8201601f1916602001610d1b565b818152846020838601011115610de557600080fd5b816020850160208301376000918101602001919091529392505050565b803564ffffffffff81168114610d6b57600080fd5b600060608284031215610e2957600080fd5b604051606081016001600160401b0381118282101715610e4b57610e4b610c97565b604052905080610e5a83610e02565b8152610e6860208401610e02565b6020820152610e7960408401610e02565b60408201525092915050565b600060408284031215610e9757600080fd5b604080519081016001600160401b0381118282101715610eb957610eb9610c97565b6040529050808235610eca81610d4b565b8152602092830135920191909152919050565b80356001600160801b0381168114610d6b57600080fd5b801515811461009a57600080fd5b8035610d6b81610ef4565b600082601f830112610f1e57600080fd5b8135610f31610f2c82610d70565b610d1b565b8082825260208201915060206101608402860101925085831115610f5457600080fd5b602085015b83811015611012576101608188031215610f7257600080fd5b610f7a610cad565b610f8382610d60565b8152610f9160208301610d60565b6020820152610fa260408301610d60565b6040820152610fb48860608401610e17565b6060820152610fc68860c08401610e85565b6080820152610fd86101008301610edd565b60a0820152610fea6101208301610f02565b60c0820152610ffc6101408301610f02565b60e0820152835260209092019161016001610f59565b5095945050505050565b803563ffffffff81168114610d6b57600080fd5b600082601f83011261104157600080fd5b813561104f610f2c82610d70565b8082825260208201915060208360051b86010192508583111561107157600080fd5b602085015b838110156110125780356001600160401b0381111561109457600080fd5b860160e0818903601f190112156110aa57600080fd5b6110b2610cd6565b6110be60208301610d60565b815260408201356001600160401b038111156110d957600080fd5b6110e88a602083860101610d93565b60208301525060608201356001600160401b0381111561110757600080fd5b6111168a602083860101610d93565b60408301525060808201356001600160401b0381111561113557600080fd5b6111448a602083860101610f0d565b60608301525061115660a08301610edd565b608082015261116760c0830161101c565b60a082015261117860e08301610f02565b60c082015284525060209283019201611076565b6000610140823603121561119f57600080fd5b6111a7610cf8565b6111b083610d60565b81526111be60208401610d60565b60208201526111cf60408401610d60565b6040820152606083810135908201526111ea60808401610d60565b60808201526111fb60a08401610d60565b60a082015261120c60c08401610d60565b60c082015261121d60e08401610d60565b60e082015261010083810135908201526101208301356001600160401b0381111561124757600080fd5b61125336828601611030565b6101208301525092915050565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561128857600080fd5b5051919050565b60005b838110156112aa578181015183820152602001611292565b50506000910152565b600081518084526112cb81602086016020860161128f565b601f01601f19169290920160200192915050565b60018060a01b038616815284602082015260a06040820152600061130660a08301866112b3565b828103606084015261131881866112b3565b9150508260808301529695505050505050565b60006020828403121561133d57600080fd5b8151610c9081610d4b565b87815260e06020820152600061136160e08301896112b3565b63ffffffff881660408401526001600160a01b0387811660608501528616608084015284151560a084015282810360c084015261139e81856112b3565b9a9950505050505050505050565b60018060a01b03851681528360208201526080604082015260006113d360808301856112b3565b9050600283106113f357634e487b7160e01b600052602160045260246000fd5b82606083015295945050505050565b60006020828403121561141457600080fd5b8151610c9081610ef4565b6000604082016001600160801b03851683526040602084015280845180835260608501915060208601925060005b818110156114745783516001600160a01b031683526020938401939092019160010161144d565b50909695505050505050565b81516001600160a01b0390811682526020808401518216908301526040808401516001600160801b031690830152606080840151918216908301526101608201905060808301516114d5608084018215159052565b5060a08301516114e960a084018215159052565b5060c083015161152860c084018264ffffffffff815116825264ffffffffff602082015116602083015264ffffffffff60408201511660408301525050565b5060e0929092015180516001600160a01b0316610120830152602001516101409091015290565b6000835161156181846020880161128f565b601d60f91b908301908152835161157f81600184016020880161128f565b01600101949350505050565b600082825180855260208501945060208160051b8301016020850160005b8381101561147457601f198584030188526115c58383516112b3565b60209889019890935091909101906001016115a9565b6040815260006115ee604083018561158b565b8281036020840152611600818561158b565b95945050505050565b634e487b7160e01b600052601160045260246000fd5b60006001820161163157611631611609565b5060010190565b634e487b7160e01b600052601260045260246000fd5b60008261165d5761165d611638565b500490565b8181038181111561167557611675611609565b92915050565b60008261168a5761168a611638565b500690565b808201808211156116755761167561160956fea2646970667358221220cbb4b307eab1d5ffde2b7ecaf86a40052d6217b110fff2ecda840a0a4b601bdc64736f6c634300081c0033", "devdoc": { "kind": "dev", "methods": { - "createRoleHats((address,address,address,uint256,address,address,address,uint256,(address,string,string,(address,address,address,(uint40,uint40,uint40),(address,uint256),uint128,bool,bool)[],uint128,uint32,bool)[]))": { + "createRoleHats((address,address,address,uint256,address,address,address,address,uint256,(address,string,string,(address,address,address,(uint40,uint40,uint40),(address,uint256),uint128,bool,bool)[],uint128,uint32,bool)[]))": { "details": "Stream funds on untermed Roles are targeted at the hat's smart account. In order to withdraw funds from the stream, the hat's smart account must be the one call to `withdraw-` on the Sablier contract, setting the recipient arg to its wearer.Stream funds on termed Roles are targeted directly at the nominated wearer. The wearer should directly call `withdraw-` on the Sablier contract.Role hat creation, minting, smart account creation and stream creation are handled here in order to avoid a race condition where not more than one active proposal to create a new role can exist at a time. See: https://github.com/decentdao/decent-interface/issues/2402", "params": { "roleHatsParams": "An array of params for each role hat to be created." @@ -220,7 +225,7 @@ "userdoc": { "kind": "user", "methods": { - "createRoleHats((address,address,address,uint256,address,address,address,uint256,(address,string,string,(address,address,address,(uint40,uint40,uint40),(address,uint256),uint128,bool,bool)[],uint128,uint32,bool)[]))": { + "createRoleHats((address,address,address,uint256,address,address,address,address,uint256,(address,string,string,(address,address,address,(uint40,uint40,uint40),(address,uint256),uint128,bool,bool)[],uint128,uint32,bool)[]))": { "notice": "Creates a new termed or untermed role hat and any streams on it.This contract should be enabled a module on the Safe for which the role is to be created, and disabled after." } }, diff --git a/deployments/mainnet/solcInputs/f1fca9a70591742a2aedd10e2fd7e744.json b/deployments/mainnet/solcInputs/f1fca9a70591742a2aedd10e2fd7e744.json new file mode 100644 index 0000000..14e45d1 --- /dev/null +++ b/deployments/mainnet/solcInputs/f1fca9a70591742a2aedd10e2fd7e744.json @@ -0,0 +1,387 @@ +{ + "language": "Solidity", + "sources": { + "@gnosis.pm/safe-contracts/contracts/base/Executor.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\nimport \"../common/Enum.sol\";\n\n/// @title Executor - A contract that can execute transactions\n/// @author Richard Meissner - \ncontract Executor {\n function execute(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation,\n uint256 txGas\n ) internal returns (bool success) {\n if (operation == Enum.Operation.DelegateCall) {\n // solhint-disable-next-line no-inline-assembly\n assembly {\n success := delegatecall(txGas, to, add(data, 0x20), mload(data), 0, 0)\n }\n } else {\n // solhint-disable-next-line no-inline-assembly\n assembly {\n success := call(txGas, to, value, add(data, 0x20), mload(data), 0, 0)\n }\n }\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/base/FallbackManager.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"../common/SelfAuthorized.sol\";\n\n/// @title Fallback Manager - A contract that manages fallback calls made to this contract\n/// @author Richard Meissner - \ncontract FallbackManager is SelfAuthorized {\n event ChangedFallbackHandler(address handler);\n\n // keccak256(\"fallback_manager.handler.address\")\n bytes32 internal constant FALLBACK_HANDLER_STORAGE_SLOT = 0x6c9a6c4a39284e37ed1cf53d337577d14212a4870fb976a4366c693b939918d5;\n\n function internalSetFallbackHandler(address handler) internal {\n bytes32 slot = FALLBACK_HANDLER_STORAGE_SLOT;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n sstore(slot, handler)\n }\n }\n\n /// @dev Allows to add a contract to handle fallback calls.\n /// Only fallback calls without value and with data will be forwarded.\n /// This can only be done via a Safe transaction.\n /// @param handler contract to handle fallbacks calls.\n function setFallbackHandler(address handler) public authorized {\n internalSetFallbackHandler(handler);\n emit ChangedFallbackHandler(handler);\n }\n\n // solhint-disable-next-line payable-fallback,no-complex-fallback\n fallback() external {\n bytes32 slot = FALLBACK_HANDLER_STORAGE_SLOT;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let handler := sload(slot)\n if iszero(handler) {\n return(0, 0)\n }\n calldatacopy(0, 0, calldatasize())\n // The msg.sender address is shifted to the left by 12 bytes to remove the padding\n // Then the address without padding is stored right after the calldata\n mstore(calldatasize(), shl(96, caller()))\n // Add 20 bytes for the address appended add the end\n let success := call(gas(), handler, 0, 0, add(calldatasize(), 20), 0, 0)\n returndatacopy(0, 0, returndatasize())\n if iszero(success) {\n revert(0, returndatasize())\n }\n return(0, returndatasize())\n }\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/base/GuardManager.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"../common/Enum.sol\";\nimport \"../common/SelfAuthorized.sol\";\n\ninterface Guard {\n function checkTransaction(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation,\n uint256 safeTxGas,\n uint256 baseGas,\n uint256 gasPrice,\n address gasToken,\n address payable refundReceiver,\n bytes memory signatures,\n address msgSender\n ) external;\n\n function checkAfterExecution(bytes32 txHash, bool success) external;\n}\n\n/// @title Fallback Manager - A contract that manages fallback calls made to this contract\n/// @author Richard Meissner - \ncontract GuardManager is SelfAuthorized {\n event ChangedGuard(address guard);\n // keccak256(\"guard_manager.guard.address\")\n bytes32 internal constant GUARD_STORAGE_SLOT = 0x4a204f620c8c5ccdca3fd54d003badd85ba500436a431f0cbda4f558c93c34c8;\n\n /// @dev Set a guard that checks transactions before execution\n /// @param guard The address of the guard to be used or the 0 address to disable the guard\n function setGuard(address guard) external authorized {\n bytes32 slot = GUARD_STORAGE_SLOT;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n sstore(slot, guard)\n }\n emit ChangedGuard(guard);\n }\n\n function getGuard() internal view returns (address guard) {\n bytes32 slot = GUARD_STORAGE_SLOT;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n guard := sload(slot)\n }\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/base/ModuleManager.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\nimport \"../common/Enum.sol\";\nimport \"../common/SelfAuthorized.sol\";\nimport \"./Executor.sol\";\n\n/// @title Module Manager - A contract that manages modules that can execute transactions via this contract\n/// @author Stefan George - \n/// @author Richard Meissner - \ncontract ModuleManager is SelfAuthorized, Executor {\n event EnabledModule(address module);\n event DisabledModule(address module);\n event ExecutionFromModuleSuccess(address indexed module);\n event ExecutionFromModuleFailure(address indexed module);\n\n address internal constant SENTINEL_MODULES = address(0x1);\n\n mapping(address => address) internal modules;\n\n function setupModules(address to, bytes memory data) internal {\n require(modules[SENTINEL_MODULES] == address(0), \"GS100\");\n modules[SENTINEL_MODULES] = SENTINEL_MODULES;\n if (to != address(0))\n // Setup has to complete successfully or transaction fails.\n require(execute(to, 0, data, Enum.Operation.DelegateCall, gasleft()), \"GS000\");\n }\n\n /// @dev Allows to add a module to the whitelist.\n /// This can only be done via a Safe transaction.\n /// @notice Enables the module `module` for the Safe.\n /// @param module Module to be whitelisted.\n function enableModule(address module) public authorized {\n // Module address cannot be null or sentinel.\n require(module != address(0) && module != SENTINEL_MODULES, \"GS101\");\n // Module cannot be added twice.\n require(modules[module] == address(0), \"GS102\");\n modules[module] = modules[SENTINEL_MODULES];\n modules[SENTINEL_MODULES] = module;\n emit EnabledModule(module);\n }\n\n /// @dev Allows to remove a module from the whitelist.\n /// This can only be done via a Safe transaction.\n /// @notice Disables the module `module` for the Safe.\n /// @param prevModule Module that pointed to the module to be removed in the linked list\n /// @param module Module to be removed.\n function disableModule(address prevModule, address module) public authorized {\n // Validate module address and check that it corresponds to module index.\n require(module != address(0) && module != SENTINEL_MODULES, \"GS101\");\n require(modules[prevModule] == module, \"GS103\");\n modules[prevModule] = modules[module];\n modules[module] = address(0);\n emit DisabledModule(module);\n }\n\n /// @dev Allows a Module to execute a Safe transaction without any further confirmations.\n /// @param to Destination address of module transaction.\n /// @param value Ether value of module transaction.\n /// @param data Data payload of module transaction.\n /// @param operation Operation type of module transaction.\n function execTransactionFromModule(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation\n ) public virtual returns (bool success) {\n // Only whitelisted modules are allowed.\n require(msg.sender != SENTINEL_MODULES && modules[msg.sender] != address(0), \"GS104\");\n // Execute transaction without further confirmations.\n success = execute(to, value, data, operation, gasleft());\n if (success) emit ExecutionFromModuleSuccess(msg.sender);\n else emit ExecutionFromModuleFailure(msg.sender);\n }\n\n /// @dev Allows a Module to execute a Safe transaction without any further confirmations and return data\n /// @param to Destination address of module transaction.\n /// @param value Ether value of module transaction.\n /// @param data Data payload of module transaction.\n /// @param operation Operation type of module transaction.\n function execTransactionFromModuleReturnData(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation\n ) public returns (bool success, bytes memory returnData) {\n success = execTransactionFromModule(to, value, data, operation);\n // solhint-disable-next-line no-inline-assembly\n assembly {\n // Load free memory location\n let ptr := mload(0x40)\n // We allocate memory for the return data by setting the free memory location to\n // current free memory location + data size + 32 bytes for data size value\n mstore(0x40, add(ptr, add(returndatasize(), 0x20)))\n // Store the size\n mstore(ptr, returndatasize())\n // Store the data\n returndatacopy(add(ptr, 0x20), 0, returndatasize())\n // Point the return data to the correct memory location\n returnData := ptr\n }\n }\n\n /// @dev Returns if an module is enabled\n /// @return True if the module is enabled\n function isModuleEnabled(address module) public view returns (bool) {\n return SENTINEL_MODULES != module && modules[module] != address(0);\n }\n\n /// @dev Returns array of modules.\n /// @param start Start of the page.\n /// @param pageSize Maximum number of modules that should be returned.\n /// @return array Array of modules.\n /// @return next Start of the next page.\n function getModulesPaginated(address start, uint256 pageSize) external view returns (address[] memory array, address next) {\n // Init array with max page size\n array = new address[](pageSize);\n\n // Populate return array\n uint256 moduleCount = 0;\n address currentModule = modules[start];\n while (currentModule != address(0x0) && currentModule != SENTINEL_MODULES && moduleCount < pageSize) {\n array[moduleCount] = currentModule;\n currentModule = modules[currentModule];\n moduleCount++;\n }\n next = currentModule;\n // Set correct size of returned array\n // solhint-disable-next-line no-inline-assembly\n assembly {\n mstore(array, moduleCount)\n }\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/base/OwnerManager.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\nimport \"../common/SelfAuthorized.sol\";\n\n/// @title OwnerManager - Manages a set of owners and a threshold to perform actions.\n/// @author Stefan George - \n/// @author Richard Meissner - \ncontract OwnerManager is SelfAuthorized {\n event AddedOwner(address owner);\n event RemovedOwner(address owner);\n event ChangedThreshold(uint256 threshold);\n\n address internal constant SENTINEL_OWNERS = address(0x1);\n\n mapping(address => address) internal owners;\n uint256 internal ownerCount;\n uint256 internal threshold;\n\n /// @dev Setup function sets initial storage of contract.\n /// @param _owners List of Safe owners.\n /// @param _threshold Number of required confirmations for a Safe transaction.\n function setupOwners(address[] memory _owners, uint256 _threshold) internal {\n // Threshold can only be 0 at initialization.\n // Check ensures that setup function can only be called once.\n require(threshold == 0, \"GS200\");\n // Validate that threshold is smaller than number of added owners.\n require(_threshold <= _owners.length, \"GS201\");\n // There has to be at least one Safe owner.\n require(_threshold >= 1, \"GS202\");\n // Initializing Safe owners.\n address currentOwner = SENTINEL_OWNERS;\n for (uint256 i = 0; i < _owners.length; i++) {\n // Owner address cannot be null.\n address owner = _owners[i];\n require(owner != address(0) && owner != SENTINEL_OWNERS && owner != address(this) && currentOwner != owner, \"GS203\");\n // No duplicate owners allowed.\n require(owners[owner] == address(0), \"GS204\");\n owners[currentOwner] = owner;\n currentOwner = owner;\n }\n owners[currentOwner] = SENTINEL_OWNERS;\n ownerCount = _owners.length;\n threshold = _threshold;\n }\n\n /// @dev Allows to add a new owner to the Safe and update the threshold at the same time.\n /// This can only be done via a Safe transaction.\n /// @notice Adds the owner `owner` to the Safe and updates the threshold to `_threshold`.\n /// @param owner New owner address.\n /// @param _threshold New threshold.\n function addOwnerWithThreshold(address owner, uint256 _threshold) public authorized {\n // Owner address cannot be null, the sentinel or the Safe itself.\n require(owner != address(0) && owner != SENTINEL_OWNERS && owner != address(this), \"GS203\");\n // No duplicate owners allowed.\n require(owners[owner] == address(0), \"GS204\");\n owners[owner] = owners[SENTINEL_OWNERS];\n owners[SENTINEL_OWNERS] = owner;\n ownerCount++;\n emit AddedOwner(owner);\n // Change threshold if threshold was changed.\n if (threshold != _threshold) changeThreshold(_threshold);\n }\n\n /// @dev Allows to remove an owner from the Safe and update the threshold at the same time.\n /// This can only be done via a Safe transaction.\n /// @notice Removes the owner `owner` from the Safe and updates the threshold to `_threshold`.\n /// @param prevOwner Owner that pointed to the owner to be removed in the linked list\n /// @param owner Owner address to be removed.\n /// @param _threshold New threshold.\n function removeOwner(\n address prevOwner,\n address owner,\n uint256 _threshold\n ) public authorized {\n // Only allow to remove an owner, if threshold can still be reached.\n require(ownerCount - 1 >= _threshold, \"GS201\");\n // Validate owner address and check that it corresponds to owner index.\n require(owner != address(0) && owner != SENTINEL_OWNERS, \"GS203\");\n require(owners[prevOwner] == owner, \"GS205\");\n owners[prevOwner] = owners[owner];\n owners[owner] = address(0);\n ownerCount--;\n emit RemovedOwner(owner);\n // Change threshold if threshold was changed.\n if (threshold != _threshold) changeThreshold(_threshold);\n }\n\n /// @dev Allows to swap/replace an owner from the Safe with another address.\n /// This can only be done via a Safe transaction.\n /// @notice Replaces the owner `oldOwner` in the Safe with `newOwner`.\n /// @param prevOwner Owner that pointed to the owner to be replaced in the linked list\n /// @param oldOwner Owner address to be replaced.\n /// @param newOwner New owner address.\n function swapOwner(\n address prevOwner,\n address oldOwner,\n address newOwner\n ) public authorized {\n // Owner address cannot be null, the sentinel or the Safe itself.\n require(newOwner != address(0) && newOwner != SENTINEL_OWNERS && newOwner != address(this), \"GS203\");\n // No duplicate owners allowed.\n require(owners[newOwner] == address(0), \"GS204\");\n // Validate oldOwner address and check that it corresponds to owner index.\n require(oldOwner != address(0) && oldOwner != SENTINEL_OWNERS, \"GS203\");\n require(owners[prevOwner] == oldOwner, \"GS205\");\n owners[newOwner] = owners[oldOwner];\n owners[prevOwner] = newOwner;\n owners[oldOwner] = address(0);\n emit RemovedOwner(oldOwner);\n emit AddedOwner(newOwner);\n }\n\n /// @dev Allows to update the number of required confirmations by Safe owners.\n /// This can only be done via a Safe transaction.\n /// @notice Changes the threshold of the Safe to `_threshold`.\n /// @param _threshold New threshold.\n function changeThreshold(uint256 _threshold) public authorized {\n // Validate that threshold is smaller than number of owners.\n require(_threshold <= ownerCount, \"GS201\");\n // There has to be at least one Safe owner.\n require(_threshold >= 1, \"GS202\");\n threshold = _threshold;\n emit ChangedThreshold(threshold);\n }\n\n function getThreshold() public view returns (uint256) {\n return threshold;\n }\n\n function isOwner(address owner) public view returns (bool) {\n return owner != SENTINEL_OWNERS && owners[owner] != address(0);\n }\n\n /// @dev Returns array of owners.\n /// @return Array of Safe owners.\n function getOwners() public view returns (address[] memory) {\n address[] memory array = new address[](ownerCount);\n\n // populate return array\n uint256 index = 0;\n address currentOwner = owners[SENTINEL_OWNERS];\n while (currentOwner != SENTINEL_OWNERS) {\n array[index] = currentOwner;\n currentOwner = owners[currentOwner];\n index++;\n }\n return array;\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/common/Enum.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\n/// @title Enum - Collection of enums\n/// @author Richard Meissner - \ncontract Enum {\n enum Operation {Call, DelegateCall}\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/common/EtherPaymentFallback.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\n/// @title EtherPaymentFallback - A contract that has a fallback to accept ether payments\n/// @author Richard Meissner - \ncontract EtherPaymentFallback {\n event SafeReceived(address indexed sender, uint256 value);\n\n /// @dev Fallback function accepts Ether transactions.\n receive() external payable {\n emit SafeReceived(msg.sender, msg.value);\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/common/SecuredTokenTransfer.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\n/// @title SecuredTokenTransfer - Secure token transfer\n/// @author Richard Meissner - \ncontract SecuredTokenTransfer {\n /// @dev Transfers a token and returns if it was a success\n /// @param token Token that should be transferred\n /// @param receiver Receiver to whom the token should be transferred\n /// @param amount The amount of tokens that should be transferred\n function transferToken(\n address token,\n address receiver,\n uint256 amount\n ) internal returns (bool transferred) {\n // 0xa9059cbb - keccack(\"transfer(address,uint256)\")\n bytes memory data = abi.encodeWithSelector(0xa9059cbb, receiver, amount);\n // solhint-disable-next-line no-inline-assembly\n assembly {\n // We write the return value to scratch space.\n // See https://docs.soliditylang.org/en/v0.7.6/internals/layout_in_memory.html#layout-in-memory\n let success := call(sub(gas(), 10000), token, 0, add(data, 0x20), mload(data), 0, 0x20)\n switch returndatasize()\n case 0 {\n transferred := success\n }\n case 0x20 {\n transferred := iszero(or(iszero(success), iszero(mload(0))))\n }\n default {\n transferred := 0\n }\n }\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/common/SelfAuthorized.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\n/// @title SelfAuthorized - authorizes current contract to perform actions\n/// @author Richard Meissner - \ncontract SelfAuthorized {\n function requireSelfCall() private view {\n require(msg.sender == address(this), \"GS031\");\n }\n\n modifier authorized() {\n // This is a function call as it minimized the bytecode size\n requireSelfCall();\n _;\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/common/SignatureDecoder.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\n/// @title SignatureDecoder - Decodes signatures that a encoded as bytes\n/// @author Richard Meissner - \ncontract SignatureDecoder {\n /// @dev divides bytes signature into `uint8 v, bytes32 r, bytes32 s`.\n /// @notice Make sure to peform a bounds check for @param pos, to avoid out of bounds access on @param signatures\n /// @param pos which signature to read. A prior bounds check of this parameter should be performed, to avoid out of bounds access\n /// @param signatures concatenated rsv signatures\n function signatureSplit(bytes memory signatures, uint256 pos)\n internal\n pure\n returns (\n uint8 v,\n bytes32 r,\n bytes32 s\n )\n {\n // The signature format is a compact form of:\n // {bytes32 r}{bytes32 s}{uint8 v}\n // Compact means, uint8 is not padded to 32 bytes.\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let signaturePos := mul(0x41, pos)\n r := mload(add(signatures, add(signaturePos, 0x20)))\n s := mload(add(signatures, add(signaturePos, 0x40)))\n // Here we are loading the last 32 bytes, including 31 bytes\n // of 's'. There is no 'mload8' to do this.\n //\n // 'byte' is not working due to the Solidity parser, so lets\n // use the second best option, 'and'\n v := and(mload(add(signatures, add(signaturePos, 0x41))), 0xff)\n }\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/common/Singleton.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\n/// @title Singleton - Base for singleton contracts (should always be first super contract)\n/// This contract is tightly coupled to our proxy contract (see `proxies/GnosisSafeProxy.sol`)\n/// @author Richard Meissner - \ncontract Singleton {\n // singleton always needs to be first declared variable, to ensure that it is at the same location as in the Proxy contract.\n // It should also always be ensured that the address is stored alone (uses a full word)\n address private singleton;\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/common/StorageAccessible.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\n/// @title StorageAccessible - generic base contract that allows callers to access all internal storage.\n/// @notice See https://github.com/gnosis/util-contracts/blob/bb5fe5fb5df6d8400998094fb1b32a178a47c3a1/contracts/StorageAccessible.sol\ncontract StorageAccessible {\n /**\n * @dev Reads `length` bytes of storage in the currents contract\n * @param offset - the offset in the current contract's storage in words to start reading from\n * @param length - the number of words (32 bytes) of data to read\n * @return the bytes that were read.\n */\n function getStorageAt(uint256 offset, uint256 length) public view returns (bytes memory) {\n bytes memory result = new bytes(length * 32);\n for (uint256 index = 0; index < length; index++) {\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let word := sload(add(offset, index))\n mstore(add(add(result, 0x20), mul(index, 0x20)), word)\n }\n }\n return result;\n }\n\n /**\n * @dev Performs a delegetecall on a targetContract in the context of self.\n * Internally reverts execution to avoid side effects (making it static).\n *\n * This method reverts with data equal to `abi.encode(bool(success), bytes(response))`.\n * Specifically, the `returndata` after a call to this method will be:\n * `success:bool || response.length:uint256 || response:bytes`.\n *\n * @param targetContract Address of the contract containing the code to execute.\n * @param calldataPayload Calldata that should be sent to the target contract (encoded method name and arguments).\n */\n function simulateAndRevert(address targetContract, bytes memory calldataPayload) external {\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let success := delegatecall(gas(), targetContract, add(calldataPayload, 0x20), mload(calldataPayload), 0, 0)\n\n mstore(0x00, success)\n mstore(0x20, returndatasize())\n returndatacopy(0x40, 0, returndatasize())\n revert(0, add(returndatasize(), 0x40))\n }\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/external/GnosisSafeMath.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\n/**\n * @title GnosisSafeMath\n * @dev Math operations with safety checks that revert on error\n * Renamed from SafeMath to GnosisSafeMath to avoid conflicts\n * TODO: remove once open zeppelin update to solc 0.5.0\n */\nlibrary GnosisSafeMath {\n /**\n * @dev Multiplies two numbers, reverts on overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\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-solidity/pull/522\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n require(c / a == b);\n\n return c;\n }\n\n /**\n * @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b <= a);\n uint256 c = a - b;\n\n return c;\n }\n\n /**\n * @dev Adds two numbers, reverts on overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a);\n\n return c;\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" + }, + "@gnosis.pm/safe-contracts/contracts/GnosisSafe.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"./base/ModuleManager.sol\";\nimport \"./base/OwnerManager.sol\";\nimport \"./base/FallbackManager.sol\";\nimport \"./base/GuardManager.sol\";\nimport \"./common/EtherPaymentFallback.sol\";\nimport \"./common/Singleton.sol\";\nimport \"./common/SignatureDecoder.sol\";\nimport \"./common/SecuredTokenTransfer.sol\";\nimport \"./common/StorageAccessible.sol\";\nimport \"./interfaces/ISignatureValidator.sol\";\nimport \"./external/GnosisSafeMath.sol\";\n\n/// @title Gnosis Safe - A multisignature wallet with support for confirmations using signed messages based on ERC191.\n/// @author Stefan George - \n/// @author Richard Meissner - \ncontract GnosisSafe is\n EtherPaymentFallback,\n Singleton,\n ModuleManager,\n OwnerManager,\n SignatureDecoder,\n SecuredTokenTransfer,\n ISignatureValidatorConstants,\n FallbackManager,\n StorageAccessible,\n GuardManager\n{\n using GnosisSafeMath for uint256;\n\n string public constant VERSION = \"1.3.0\";\n\n // keccak256(\n // \"EIP712Domain(uint256 chainId,address verifyingContract)\"\n // );\n bytes32 private constant DOMAIN_SEPARATOR_TYPEHASH = 0x47e79534a245952e8b16893a336b85a3d9ea9fa8c573f3d803afb92a79469218;\n\n // keccak256(\n // \"SafeTx(address to,uint256 value,bytes data,uint8 operation,uint256 safeTxGas,uint256 baseGas,uint256 gasPrice,address gasToken,address refundReceiver,uint256 nonce)\"\n // );\n bytes32 private constant SAFE_TX_TYPEHASH = 0xbb8310d486368db6bd6f849402fdd73ad53d316b5a4b2644ad6efe0f941286d8;\n\n event SafeSetup(address indexed initiator, address[] owners, uint256 threshold, address initializer, address fallbackHandler);\n event ApproveHash(bytes32 indexed approvedHash, address indexed owner);\n event SignMsg(bytes32 indexed msgHash);\n event ExecutionFailure(bytes32 txHash, uint256 payment);\n event ExecutionSuccess(bytes32 txHash, uint256 payment);\n\n uint256 public nonce;\n bytes32 private _deprecatedDomainSeparator;\n // Mapping to keep track of all message hashes that have been approve by ALL REQUIRED owners\n mapping(bytes32 => uint256) public signedMessages;\n // Mapping to keep track of all hashes (message or transaction) that have been approve by ANY owners\n mapping(address => mapping(bytes32 => uint256)) public approvedHashes;\n\n // This constructor ensures that this contract can only be used as a master copy for Proxy contracts\n constructor() {\n // By setting the threshold it is not possible to call setup anymore,\n // so we create a Safe with 0 owners and threshold 1.\n // This is an unusable Safe, perfect for the singleton\n threshold = 1;\n }\n\n /// @dev Setup function sets initial storage of contract.\n /// @param _owners List of Safe owners.\n /// @param _threshold Number of required confirmations for a Safe transaction.\n /// @param to Contract address for optional delegate call.\n /// @param data Data payload for optional delegate call.\n /// @param fallbackHandler Handler for fallback calls to this contract\n /// @param paymentToken Token that should be used for the payment (0 is ETH)\n /// @param payment Value that should be paid\n /// @param paymentReceiver Adddress that should receive the payment (or 0 if tx.origin)\n function setup(\n address[] calldata _owners,\n uint256 _threshold,\n address to,\n bytes calldata data,\n address fallbackHandler,\n address paymentToken,\n uint256 payment,\n address payable paymentReceiver\n ) external {\n // setupOwners checks if the Threshold is already set, therefore preventing that this method is called twice\n setupOwners(_owners, _threshold);\n if (fallbackHandler != address(0)) internalSetFallbackHandler(fallbackHandler);\n // As setupOwners can only be called if the contract has not been initialized we don't need a check for setupModules\n setupModules(to, data);\n\n if (payment > 0) {\n // To avoid running into issues with EIP-170 we reuse the handlePayment function (to avoid adjusting code of that has been verified we do not adjust the method itself)\n // baseGas = 0, gasPrice = 1 and gas = payment => amount = (payment + 0) * 1 = payment\n handlePayment(payment, 0, 1, paymentToken, paymentReceiver);\n }\n emit SafeSetup(msg.sender, _owners, _threshold, to, fallbackHandler);\n }\n\n /// @dev Allows to execute a Safe transaction confirmed by required number of owners and then pays the account that submitted the transaction.\n /// Note: The fees are always transferred, even if the user transaction fails.\n /// @param to Destination address of Safe transaction.\n /// @param value Ether value of Safe transaction.\n /// @param data Data payload of Safe transaction.\n /// @param operation Operation type of Safe transaction.\n /// @param safeTxGas Gas that should be used for the Safe transaction.\n /// @param baseGas Gas costs that are independent of the transaction execution(e.g. base transaction fee, signature check, payment of the refund)\n /// @param gasPrice Gas price that should be used for the payment calculation.\n /// @param gasToken Token address (or 0 if ETH) that is used for the payment.\n /// @param refundReceiver Address of receiver of gas payment (or 0 if tx.origin).\n /// @param signatures Packed signature data ({bytes32 r}{bytes32 s}{uint8 v})\n function execTransaction(\n address to,\n uint256 value,\n bytes calldata data,\n Enum.Operation operation,\n uint256 safeTxGas,\n uint256 baseGas,\n uint256 gasPrice,\n address gasToken,\n address payable refundReceiver,\n bytes memory signatures\n ) public payable virtual returns (bool success) {\n bytes32 txHash;\n // Use scope here to limit variable lifetime and prevent `stack too deep` errors\n {\n bytes memory txHashData =\n encodeTransactionData(\n // Transaction info\n to,\n value,\n data,\n operation,\n safeTxGas,\n // Payment info\n baseGas,\n gasPrice,\n gasToken,\n refundReceiver,\n // Signature info\n nonce\n );\n // Increase nonce and execute transaction.\n nonce++;\n txHash = keccak256(txHashData);\n checkSignatures(txHash, txHashData, signatures);\n }\n address guard = getGuard();\n {\n if (guard != address(0)) {\n Guard(guard).checkTransaction(\n // Transaction info\n to,\n value,\n data,\n operation,\n safeTxGas,\n // Payment info\n baseGas,\n gasPrice,\n gasToken,\n refundReceiver,\n // Signature info\n signatures,\n msg.sender\n );\n }\n }\n // We require some gas to emit the events (at least 2500) after the execution and some to perform code until the execution (500)\n // We also include the 1/64 in the check that is not send along with a call to counteract potential shortings because of EIP-150\n require(gasleft() >= ((safeTxGas * 64) / 63).max(safeTxGas + 2500) + 500, \"GS010\");\n // Use scope here to limit variable lifetime and prevent `stack too deep` errors\n {\n uint256 gasUsed = gasleft();\n // If the gasPrice is 0 we assume that nearly all available gas can be used (it is always more than safeTxGas)\n // We only substract 2500 (compared to the 3000 before) to ensure that the amount passed is still higher than safeTxGas\n success = execute(to, value, data, operation, gasPrice == 0 ? (gasleft() - 2500) : safeTxGas);\n gasUsed = gasUsed.sub(gasleft());\n // If no safeTxGas and no gasPrice was set (e.g. both are 0), then the internal tx is required to be successful\n // This makes it possible to use `estimateGas` without issues, as it searches for the minimum gas where the tx doesn't revert\n require(success || safeTxGas != 0 || gasPrice != 0, \"GS013\");\n // We transfer the calculated tx costs to the tx.origin to avoid sending it to intermediate contracts that have made calls\n uint256 payment = 0;\n if (gasPrice > 0) {\n payment = handlePayment(gasUsed, baseGas, gasPrice, gasToken, refundReceiver);\n }\n if (success) emit ExecutionSuccess(txHash, payment);\n else emit ExecutionFailure(txHash, payment);\n }\n {\n if (guard != address(0)) {\n Guard(guard).checkAfterExecution(txHash, success);\n }\n }\n }\n\n function handlePayment(\n uint256 gasUsed,\n uint256 baseGas,\n uint256 gasPrice,\n address gasToken,\n address payable refundReceiver\n ) private returns (uint256 payment) {\n // solhint-disable-next-line avoid-tx-origin\n address payable receiver = refundReceiver == address(0) ? payable(tx.origin) : refundReceiver;\n if (gasToken == address(0)) {\n // For ETH we will only adjust the gas price to not be higher than the actual used gas price\n payment = gasUsed.add(baseGas).mul(gasPrice < tx.gasprice ? gasPrice : tx.gasprice);\n require(receiver.send(payment), \"GS011\");\n } else {\n payment = gasUsed.add(baseGas).mul(gasPrice);\n require(transferToken(gasToken, receiver, payment), \"GS012\");\n }\n }\n\n /**\n * @dev Checks whether the signature provided is valid for the provided data, hash. Will revert otherwise.\n * @param dataHash Hash of the data (could be either a message hash or transaction hash)\n * @param data That should be signed (this is passed to an external validator contract)\n * @param signatures Signature data that should be verified. Can be ECDSA signature, contract signature (EIP-1271) or approved hash.\n */\n function checkSignatures(\n bytes32 dataHash,\n bytes memory data,\n bytes memory signatures\n ) public view {\n // Load threshold to avoid multiple storage loads\n uint256 _threshold = threshold;\n // Check that a threshold is set\n require(_threshold > 0, \"GS001\");\n checkNSignatures(dataHash, data, signatures, _threshold);\n }\n\n /**\n * @dev Checks whether the signature provided is valid for the provided data, hash. Will revert otherwise.\n * @param dataHash Hash of the data (could be either a message hash or transaction hash)\n * @param data That should be signed (this is passed to an external validator contract)\n * @param signatures Signature data that should be verified. Can be ECDSA signature, contract signature (EIP-1271) or approved hash.\n * @param requiredSignatures Amount of required valid signatures.\n */\n function checkNSignatures(\n bytes32 dataHash,\n bytes memory data,\n bytes memory signatures,\n uint256 requiredSignatures\n ) public view {\n // Check that the provided signature data is not too short\n require(signatures.length >= requiredSignatures.mul(65), \"GS020\");\n // There cannot be an owner with address 0.\n address lastOwner = address(0);\n address currentOwner;\n uint8 v;\n bytes32 r;\n bytes32 s;\n uint256 i;\n for (i = 0; i < requiredSignatures; i++) {\n (v, r, s) = signatureSplit(signatures, i);\n if (v == 0) {\n // If v is 0 then it is a contract signature\n // When handling contract signatures the address of the contract is encoded into r\n currentOwner = address(uint160(uint256(r)));\n\n // Check that signature data pointer (s) is not pointing inside the static part of the signatures bytes\n // This check is not completely accurate, since it is possible that more signatures than the threshold are send.\n // Here we only check that the pointer is not pointing inside the part that is being processed\n require(uint256(s) >= requiredSignatures.mul(65), \"GS021\");\n\n // Check that signature data pointer (s) is in bounds (points to the length of data -> 32 bytes)\n require(uint256(s).add(32) <= signatures.length, \"GS022\");\n\n // Check if the contract signature is in bounds: start of data is s + 32 and end is start + signature length\n uint256 contractSignatureLen;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n contractSignatureLen := mload(add(add(signatures, s), 0x20))\n }\n require(uint256(s).add(32).add(contractSignatureLen) <= signatures.length, \"GS023\");\n\n // Check signature\n bytes memory contractSignature;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n // The signature data for contract signatures is appended to the concatenated signatures and the offset is stored in s\n contractSignature := add(add(signatures, s), 0x20)\n }\n require(ISignatureValidator(currentOwner).isValidSignature(data, contractSignature) == EIP1271_MAGIC_VALUE, \"GS024\");\n } else if (v == 1) {\n // If v is 1 then it is an approved hash\n // When handling approved hashes the address of the approver is encoded into r\n currentOwner = address(uint160(uint256(r)));\n // Hashes are automatically approved by the sender of the message or when they have been pre-approved via a separate transaction\n require(msg.sender == currentOwner || approvedHashes[currentOwner][dataHash] != 0, \"GS025\");\n } else if (v > 30) {\n // If v > 30 then default va (27,28) has been adjusted for eth_sign flow\n // To support eth_sign and similar we adjust v and hash the messageHash with the Ethereum message prefix before applying ecrecover\n currentOwner = ecrecover(keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", dataHash)), v - 4, r, s);\n } else {\n // Default is the ecrecover flow with the provided data hash\n // Use ecrecover with the messageHash for EOA signatures\n currentOwner = ecrecover(dataHash, v, r, s);\n }\n require(currentOwner > lastOwner && owners[currentOwner] != address(0) && currentOwner != SENTINEL_OWNERS, \"GS026\");\n lastOwner = currentOwner;\n }\n }\n\n /// @dev Allows to estimate a Safe transaction.\n /// This method is only meant for estimation purpose, therefore the call will always revert and encode the result in the revert data.\n /// Since the `estimateGas` function includes refunds, call this method to get an estimated of the costs that are deducted from the safe with `execTransaction`\n /// @param to Destination address of Safe transaction.\n /// @param value Ether value of Safe transaction.\n /// @param data Data payload of Safe transaction.\n /// @param operation Operation type of Safe transaction.\n /// @return Estimate without refunds and overhead fees (base transaction and payload data gas costs).\n /// @notice Deprecated in favor of common/StorageAccessible.sol and will be removed in next version.\n function requiredTxGas(\n address to,\n uint256 value,\n bytes calldata data,\n Enum.Operation operation\n ) external returns (uint256) {\n uint256 startGas = gasleft();\n // We don't provide an error message here, as we use it to return the estimate\n require(execute(to, value, data, operation, gasleft()));\n uint256 requiredGas = startGas - gasleft();\n // Convert response to string and return via error message\n revert(string(abi.encodePacked(requiredGas)));\n }\n\n /**\n * @dev Marks a hash as approved. This can be used to validate a hash that is used by a signature.\n * @param hashToApprove The hash that should be marked as approved for signatures that are verified by this contract.\n */\n function approveHash(bytes32 hashToApprove) external {\n require(owners[msg.sender] != address(0), \"GS030\");\n approvedHashes[msg.sender][hashToApprove] = 1;\n emit ApproveHash(hashToApprove, msg.sender);\n }\n\n /// @dev Returns the chain id used by this contract.\n function getChainId() public view returns (uint256) {\n uint256 id;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n id := chainid()\n }\n return id;\n }\n\n function domainSeparator() public view returns (bytes32) {\n return keccak256(abi.encode(DOMAIN_SEPARATOR_TYPEHASH, getChainId(), this));\n }\n\n /// @dev Returns the bytes that are hashed to be signed by owners.\n /// @param to Destination address.\n /// @param value Ether value.\n /// @param data Data payload.\n /// @param operation Operation type.\n /// @param safeTxGas Gas that should be used for the safe transaction.\n /// @param baseGas Gas costs for that are independent of the transaction execution(e.g. base transaction fee, signature check, payment of the refund)\n /// @param gasPrice Maximum gas price that should be used for this transaction.\n /// @param gasToken Token address (or 0 if ETH) that is used for the payment.\n /// @param refundReceiver Address of receiver of gas payment (or 0 if tx.origin).\n /// @param _nonce Transaction nonce.\n /// @return Transaction hash bytes.\n function encodeTransactionData(\n address to,\n uint256 value,\n bytes calldata data,\n Enum.Operation operation,\n uint256 safeTxGas,\n uint256 baseGas,\n uint256 gasPrice,\n address gasToken,\n address refundReceiver,\n uint256 _nonce\n ) public view returns (bytes memory) {\n bytes32 safeTxHash =\n keccak256(\n abi.encode(\n SAFE_TX_TYPEHASH,\n to,\n value,\n keccak256(data),\n operation,\n safeTxGas,\n baseGas,\n gasPrice,\n gasToken,\n refundReceiver,\n _nonce\n )\n );\n return abi.encodePacked(bytes1(0x19), bytes1(0x01), domainSeparator(), safeTxHash);\n }\n\n /// @dev Returns hash to be signed by owners.\n /// @param to Destination address.\n /// @param value Ether value.\n /// @param data Data payload.\n /// @param operation Operation type.\n /// @param safeTxGas Fas that should be used for the safe transaction.\n /// @param baseGas Gas costs for data used to trigger the safe transaction.\n /// @param gasPrice Maximum gas price that should be used for this transaction.\n /// @param gasToken Token address (or 0 if ETH) that is used for the payment.\n /// @param refundReceiver Address of receiver of gas payment (or 0 if tx.origin).\n /// @param _nonce Transaction nonce.\n /// @return Transaction hash.\n function getTransactionHash(\n address to,\n uint256 value,\n bytes calldata data,\n Enum.Operation operation,\n uint256 safeTxGas,\n uint256 baseGas,\n uint256 gasPrice,\n address gasToken,\n address refundReceiver,\n uint256 _nonce\n ) public view returns (bytes32) {\n return keccak256(encodeTransactionData(to, value, data, operation, safeTxGas, baseGas, gasPrice, gasToken, refundReceiver, _nonce));\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/GnosisSafeL2.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"./GnosisSafe.sol\";\n\n/// @title Gnosis Safe - A multisignature wallet with support for confirmations using signed messages based on ERC191.\n/// @author Stefan George - \n/// @author Richard Meissner - \ncontract GnosisSafeL2 is GnosisSafe {\n event SafeMultiSigTransaction(\n address to,\n uint256 value,\n bytes data,\n Enum.Operation operation,\n uint256 safeTxGas,\n uint256 baseGas,\n uint256 gasPrice,\n address gasToken,\n address payable refundReceiver,\n bytes signatures,\n // We combine nonce, sender and threshold into one to avoid stack too deep\n // Dev note: additionalInfo should not contain `bytes`, as this complicates decoding\n bytes additionalInfo\n );\n\n event SafeModuleTransaction(address module, address to, uint256 value, bytes data, Enum.Operation operation);\n\n /// @dev Allows to execute a Safe transaction confirmed by required number of owners and then pays the account that submitted the transaction.\n /// Note: The fees are always transferred, even if the user transaction fails.\n /// @param to Destination address of Safe transaction.\n /// @param value Ether value of Safe transaction.\n /// @param data Data payload of Safe transaction.\n /// @param operation Operation type of Safe transaction.\n /// @param safeTxGas Gas that should be used for the Safe transaction.\n /// @param baseGas Gas costs that are independent of the transaction execution(e.g. base transaction fee, signature check, payment of the refund)\n /// @param gasPrice Gas price that should be used for the payment calculation.\n /// @param gasToken Token address (or 0 if ETH) that is used for the payment.\n /// @param refundReceiver Address of receiver of gas payment (or 0 if tx.origin).\n /// @param signatures Packed signature data ({bytes32 r}{bytes32 s}{uint8 v})\n function execTransaction(\n address to,\n uint256 value,\n bytes calldata data,\n Enum.Operation operation,\n uint256 safeTxGas,\n uint256 baseGas,\n uint256 gasPrice,\n address gasToken,\n address payable refundReceiver,\n bytes memory signatures\n ) public payable override returns (bool) {\n bytes memory additionalInfo;\n {\n additionalInfo = abi.encode(nonce, msg.sender, threshold);\n }\n emit SafeMultiSigTransaction(\n to,\n value,\n data,\n operation,\n safeTxGas,\n baseGas,\n gasPrice,\n gasToken,\n refundReceiver,\n signatures,\n additionalInfo\n );\n return super.execTransaction(to, value, data, operation, safeTxGas, baseGas, gasPrice, gasToken, refundReceiver, signatures);\n }\n\n /// @dev Allows a Module to execute a Safe transaction without any further confirmations.\n /// @param to Destination address of module transaction.\n /// @param value Ether value of module transaction.\n /// @param data Data payload of module transaction.\n /// @param operation Operation type of module transaction.\n function execTransactionFromModule(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation\n ) public override returns (bool success) {\n emit SafeModuleTransaction(msg.sender, to, value, data, operation);\n success = super.execTransactionFromModule(to, value, data, operation);\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/interfaces/ISignatureValidator.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\ncontract ISignatureValidatorConstants {\n // bytes4(keccak256(\"isValidSignature(bytes,bytes)\")\n bytes4 internal constant EIP1271_MAGIC_VALUE = 0x20c13b0b;\n}\n\nabstract contract ISignatureValidator is ISignatureValidatorConstants {\n /**\n * @dev Should return whether the signature provided is valid for the provided data\n * @param _data Arbitrary length data signed on the behalf of address(this)\n * @param _signature Signature byte array associated with _data\n *\n * MUST return the bytes4 magic value 0x20c13b0b when function passes.\n * MUST NOT modify state (using STATICCALL for solc < 0.5, view modifier for solc > 0.5)\n * MUST allow external calls\n */\n function isValidSignature(bytes memory _data, bytes memory _signature) public view virtual returns (bytes4);\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/libraries/MultiSendCallOnly.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\n/// @title Multi Send Call Only - Allows to batch multiple transactions into one, but only calls\n/// @author Stefan George - \n/// @author Richard Meissner - \n/// @notice The guard logic is not required here as this contract doesn't support nested delegate calls\ncontract MultiSendCallOnly {\n /// @dev Sends multiple transactions and reverts all if one fails.\n /// @param transactions Encoded transactions. Each transaction is encoded as a packed bytes of\n /// operation has to be uint8(0) in this version (=> 1 byte),\n /// to as a address (=> 20 bytes),\n /// value as a uint256 (=> 32 bytes),\n /// data length as a uint256 (=> 32 bytes),\n /// data as bytes.\n /// see abi.encodePacked for more information on packed encoding\n /// @notice The code is for most part the same as the normal MultiSend (to keep compatibility),\n /// but reverts if a transaction tries to use a delegatecall.\n /// @notice This method is payable as delegatecalls keep the msg.value from the previous call\n /// If the calling method (e.g. execTransaction) received ETH this would revert otherwise\n function multiSend(bytes memory transactions) public payable {\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let length := mload(transactions)\n let i := 0x20\n for {\n // Pre block is not used in \"while mode\"\n } lt(i, length) {\n // Post block is not used in \"while mode\"\n } {\n // First byte of the data is the operation.\n // We shift by 248 bits (256 - 8 [operation byte]) it right since mload will always load 32 bytes (a word).\n // This will also zero out unused data.\n let operation := shr(0xf8, mload(add(transactions, i)))\n // We offset the load address by 1 byte (operation byte)\n // We shift it right by 96 bits (256 - 160 [20 address bytes]) to right-align the data and zero out unused data.\n let to := shr(0x60, mload(add(transactions, add(i, 0x01))))\n // We offset the load address by 21 byte (operation byte + 20 address bytes)\n let value := mload(add(transactions, add(i, 0x15)))\n // We offset the load address by 53 byte (operation byte + 20 address bytes + 32 value bytes)\n let dataLength := mload(add(transactions, add(i, 0x35)))\n // We offset the load address by 85 byte (operation byte + 20 address bytes + 32 value bytes + 32 data length bytes)\n let data := add(transactions, add(i, 0x55))\n let success := 0\n switch operation\n case 0 {\n success := call(gas(), to, value, data, dataLength, 0, 0)\n }\n // This version does not allow delegatecalls\n case 1 {\n revert(0, 0)\n }\n if eq(success, 0) {\n revert(0, 0)\n }\n // Next entry starts at 85 byte + data length\n i := add(i, add(0x55, dataLength))\n }\n }\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/proxies/GnosisSafeProxy.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\n/// @title IProxy - Helper interface to access masterCopy of the Proxy on-chain\n/// @author Richard Meissner - \ninterface IProxy {\n function masterCopy() external view returns (address);\n}\n\n/// @title GnosisSafeProxy - Generic proxy contract allows to execute all transactions applying the code of a master contract.\n/// @author Stefan George - \n/// @author Richard Meissner - \ncontract GnosisSafeProxy {\n // 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.\n // To reduce deployment costs this variable is internal and needs to be retrieved via `getStorageAt`\n address internal singleton;\n\n /// @dev Constructor function sets address of singleton contract.\n /// @param _singleton Singleton address.\n constructor(address _singleton) {\n require(_singleton != address(0), \"Invalid singleton address provided\");\n singleton = _singleton;\n }\n\n /// @dev Fallback function forwards all transactions and returns all received return data.\n fallback() external payable {\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let _singleton := and(sload(0), 0xffffffffffffffffffffffffffffffffffffffff)\n // 0xa619486e == keccak(\"masterCopy()\"). The value is right padded to 32-bytes with 0s\n if eq(calldataload(0), 0xa619486e00000000000000000000000000000000000000000000000000000000) {\n mstore(0, _singleton)\n return(0, 0x20)\n }\n calldatacopy(0, 0, calldatasize())\n let success := delegatecall(gas(), _singleton, 0, calldatasize(), 0, 0)\n returndatacopy(0, 0, returndatasize())\n if eq(success, 0) {\n revert(0, returndatasize())\n }\n return(0, returndatasize())\n }\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/proxies/GnosisSafeProxyFactory.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"./GnosisSafeProxy.sol\";\nimport \"./IProxyCreationCallback.sol\";\n\n/// @title Proxy Factory - Allows to create new proxy contact and execute a message call to the new proxy within one transaction.\n/// @author Stefan George - \ncontract GnosisSafeProxyFactory {\n event ProxyCreation(GnosisSafeProxy proxy, address singleton);\n\n /// @dev Allows to create new proxy contact and execute a message call to the new proxy within one transaction.\n /// @param singleton Address of singleton contract.\n /// @param data Payload for message call sent to new proxy contract.\n function createProxy(address singleton, bytes memory data) public returns (GnosisSafeProxy proxy) {\n proxy = new GnosisSafeProxy(singleton);\n if (data.length > 0)\n // solhint-disable-next-line no-inline-assembly\n assembly {\n if eq(call(gas(), proxy, 0, add(data, 0x20), mload(data), 0, 0), 0) {\n revert(0, 0)\n }\n }\n emit ProxyCreation(proxy, singleton);\n }\n\n /// @dev Allows to retrieve the runtime code of a deployed Proxy. This can be used to check that the expected Proxy was deployed.\n function proxyRuntimeCode() public pure returns (bytes memory) {\n return type(GnosisSafeProxy).runtimeCode;\n }\n\n /// @dev Allows to retrieve the creation code used for the Proxy deployment. With this it is easily possible to calculate predicted address.\n function proxyCreationCode() public pure returns (bytes memory) {\n return type(GnosisSafeProxy).creationCode;\n }\n\n /// @dev Allows to create new proxy contact using CREATE2 but it doesn't run the initializer.\n /// This method is only meant as an utility to be called from other methods\n /// @param _singleton Address of singleton contract.\n /// @param initializer Payload for message call sent to new proxy contract.\n /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract.\n function deployProxyWithNonce(\n address _singleton,\n bytes memory initializer,\n uint256 saltNonce\n ) internal returns (GnosisSafeProxy proxy) {\n // If the initializer changes the proxy address should change too. Hashing the initializer data is cheaper than just concatinating it\n bytes32 salt = keccak256(abi.encodePacked(keccak256(initializer), saltNonce));\n bytes memory deploymentData = abi.encodePacked(type(GnosisSafeProxy).creationCode, uint256(uint160(_singleton)));\n // solhint-disable-next-line no-inline-assembly\n assembly {\n proxy := create2(0x0, add(0x20, deploymentData), mload(deploymentData), salt)\n }\n require(address(proxy) != address(0), \"Create2 call failed\");\n }\n\n /// @dev Allows to create new proxy contact and execute a message call to the new proxy within one transaction.\n /// @param _singleton Address of singleton contract.\n /// @param initializer Payload for message call sent to new proxy contract.\n /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract.\n function createProxyWithNonce(\n address _singleton,\n bytes memory initializer,\n uint256 saltNonce\n ) public returns (GnosisSafeProxy proxy) {\n proxy = deployProxyWithNonce(_singleton, initializer, saltNonce);\n if (initializer.length > 0)\n // solhint-disable-next-line no-inline-assembly\n assembly {\n if eq(call(gas(), proxy, 0, add(initializer, 0x20), mload(initializer), 0, 0), 0) {\n revert(0, 0)\n }\n }\n emit ProxyCreation(proxy, _singleton);\n }\n\n /// @dev Allows to create new proxy contact, execute a message call to the new proxy and call a specified callback within one transaction\n /// @param _singleton Address of singleton contract.\n /// @param initializer Payload for message call sent to new proxy contract.\n /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract.\n /// @param callback Callback that will be invoced after the new proxy contract has been successfully deployed and initialized.\n function createProxyWithCallback(\n address _singleton,\n bytes memory initializer,\n uint256 saltNonce,\n IProxyCreationCallback callback\n ) public returns (GnosisSafeProxy proxy) {\n uint256 saltNonceWithCallback = uint256(keccak256(abi.encodePacked(saltNonce, callback)));\n proxy = createProxyWithNonce(_singleton, initializer, saltNonceWithCallback);\n if (address(callback) != address(0)) callback.proxyCreated(proxy, _singleton, initializer, saltNonce);\n }\n\n /// @dev Allows to get the address for a new proxy contact created via `createProxyWithNonce`\n /// This method is only meant for address calculation purpose when you use an initializer that would revert,\n /// therefore the response is returned with a revert. When calling this method set `from` to the address of the proxy factory.\n /// @param _singleton Address of singleton contract.\n /// @param initializer Payload for message call sent to new proxy contract.\n /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract.\n function calculateCreateProxyWithNonceAddress(\n address _singleton,\n bytes calldata initializer,\n uint256 saltNonce\n ) external returns (GnosisSafeProxy proxy) {\n proxy = deployProxyWithNonce(_singleton, initializer, saltNonce);\n revert(string(abi.encodePacked(proxy)));\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/proxies/IProxyCreationCallback.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\nimport \"./GnosisSafeProxy.sol\";\n\ninterface IProxyCreationCallback {\n function proxyCreated(\n GnosisSafeProxy proxy,\n address _singleton,\n bytes calldata initializer,\n uint256 saltNonce\n ) external;\n}\n" + }, + "@gnosis.pm/zodiac/contracts/core/Module.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\n\n/// @title Module Interface - A contract that can pass messages to a Module Manager contract if enabled by that contract.\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"../interfaces/IAvatar.sol\";\nimport \"../factory/FactoryFriendly.sol\";\nimport \"../guard/Guardable.sol\";\n\nabstract contract Module is FactoryFriendly, Guardable {\n /// @dev Address that will ultimately execute function calls.\n address public avatar;\n /// @dev Address that this module will pass transactions to.\n address public target;\n\n /// @dev Emitted each time the avatar is set.\n event AvatarSet(address indexed previousAvatar, address indexed newAvatar);\n /// @dev Emitted each time the Target is set.\n event TargetSet(address indexed previousTarget, address indexed newTarget);\n\n /// @dev Sets the avatar to a new avatar (`newAvatar`).\n /// @notice Can only be called by the current owner.\n function setAvatar(address _avatar) public onlyOwner {\n address previousAvatar = avatar;\n avatar = _avatar;\n emit AvatarSet(previousAvatar, _avatar);\n }\n\n /// @dev Sets the target to a new target (`newTarget`).\n /// @notice Can only be called by the current owner.\n function setTarget(address _target) public onlyOwner {\n address previousTarget = target;\n target = _target;\n emit TargetSet(previousTarget, _target);\n }\n\n /// @dev Passes a transaction to be executed by the avatar.\n /// @notice Can only be called by this contract.\n /// @param to Destination address of module transaction.\n /// @param value Ether value of module transaction.\n /// @param data Data payload of module transaction.\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\n function exec(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation\n ) internal returns (bool success) {\n /// Check if a transactioon guard is enabled.\n if (guard != address(0)) {\n IGuard(guard).checkTransaction(\n /// Transaction info used by module transactions.\n to,\n value,\n data,\n operation,\n /// Zero out the redundant transaction information only used for Safe multisig transctions.\n 0,\n 0,\n 0,\n address(0),\n payable(0),\n bytes(\"0x\"),\n msg.sender\n );\n }\n success = IAvatar(target).execTransactionFromModule(\n to,\n value,\n data,\n operation\n );\n if (guard != address(0)) {\n IGuard(guard).checkAfterExecution(bytes32(\"0x\"), success);\n }\n return success;\n }\n\n /// @dev Passes a transaction to be executed by the target and returns data.\n /// @notice Can only be called by this contract.\n /// @param to Destination address of module transaction.\n /// @param value Ether value of module transaction.\n /// @param data Data payload of module transaction.\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\n function execAndReturnData(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation\n ) internal returns (bool success, bytes memory returnData) {\n /// Check if a transactioon guard is enabled.\n if (guard != address(0)) {\n IGuard(guard).checkTransaction(\n /// Transaction info used by module transactions.\n to,\n value,\n data,\n operation,\n /// Zero out the redundant transaction information only used for Safe multisig transctions.\n 0,\n 0,\n 0,\n address(0),\n payable(0),\n bytes(\"0x\"),\n msg.sender\n );\n }\n (success, returnData) = IAvatar(target)\n .execTransactionFromModuleReturnData(to, value, data, operation);\n if (guard != address(0)) {\n IGuard(guard).checkAfterExecution(bytes32(\"0x\"), success);\n }\n return (success, returnData);\n }\n}\n" + }, + "@gnosis.pm/zodiac/contracts/factory/FactoryFriendly.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\n\n/// @title Zodiac FactoryFriendly - A contract that allows other contracts to be initializable and pass bytes as arguments to define contract state\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\n\nabstract contract FactoryFriendly is OwnableUpgradeable {\n function setUp(bytes memory initializeParams) public virtual;\n}\n" + }, + "@gnosis.pm/zodiac/contracts/factory/ModuleProxyFactory.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.8.0;\n\ncontract ModuleProxyFactory {\n event ModuleProxyCreation(\n address indexed proxy,\n address indexed masterCopy\n );\n\n /// `target` can not be zero.\n error ZeroAddress(address target);\n\n /// `address_` is already taken.\n error TakenAddress(address address_);\n\n /// @notice Initialization failed.\n error FailedInitialization();\n\n function createProxy(address target, bytes32 salt)\n internal\n returns (address result)\n {\n if (address(target) == address(0)) revert ZeroAddress(target);\n bytes memory deployment = abi.encodePacked(\n hex\"602d8060093d393df3363d3d373d3d3d363d73\",\n target,\n hex\"5af43d82803e903d91602b57fd5bf3\"\n );\n // solhint-disable-next-line no-inline-assembly\n assembly {\n result := create2(0, add(deployment, 0x20), mload(deployment), salt)\n }\n if (result == address(0)) revert TakenAddress(result);\n }\n\n function deployModule(\n address masterCopy,\n bytes memory initializer,\n uint256 saltNonce\n ) public returns (address proxy) {\n proxy = createProxy(\n masterCopy,\n keccak256(abi.encodePacked(keccak256(initializer), saltNonce))\n );\n (bool success, ) = proxy.call(initializer);\n if (!success) revert FailedInitialization();\n\n emit ModuleProxyCreation(proxy, masterCopy);\n }\n}\n" + }, + "@gnosis.pm/zodiac/contracts/guard/BaseGuard.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"../interfaces/IGuard.sol\";\n\nabstract contract BaseGuard is IERC165 {\n function supportsInterface(bytes4 interfaceId)\n external\n pure\n override\n returns (bool)\n {\n return\n interfaceId == type(IGuard).interfaceId || // 0xe6d7a83a\n interfaceId == type(IERC165).interfaceId; // 0x01ffc9a7\n }\n\n /// @dev Module transactions only use the first four parameters: to, value, data, and operation.\n /// Module.sol hardcodes the remaining parameters as 0 since they are not used for module transactions.\n /// @notice This interface is used to maintain compatibilty with Gnosis Safe transaction guards.\n function checkTransaction(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation,\n uint256 safeTxGas,\n uint256 baseGas,\n uint256 gasPrice,\n address gasToken,\n address payable refundReceiver,\n bytes memory signatures,\n address msgSender\n ) external virtual;\n\n function checkAfterExecution(bytes32 txHash, bool success) external virtual;\n}\n" + }, + "@gnosis.pm/zodiac/contracts/guard/Guardable.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\";\nimport \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport \"./BaseGuard.sol\";\n\n/// @title Guardable - A contract that manages fallback calls made to this contract\ncontract Guardable is OwnableUpgradeable {\n address public guard;\n\n event ChangedGuard(address guard);\n\n /// `guard_` does not implement IERC165.\n error NotIERC165Compliant(address guard_);\n\n /// @dev Set a guard that checks transactions before execution.\n /// @param _guard The address of the guard to be used or the 0 address to disable the guard.\n function setGuard(address _guard) external onlyOwner {\n if (_guard != address(0)) {\n if (!BaseGuard(_guard).supportsInterface(type(IGuard).interfaceId))\n revert NotIERC165Compliant(_guard);\n }\n guard = _guard;\n emit ChangedGuard(guard);\n }\n\n function getGuard() external view returns (address _guard) {\n return guard;\n }\n}\n" + }, + "@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\n\n/// @title Zodiac Avatar - A contract that manages modules that can execute transactions via this contract.\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\";\n\ninterface IAvatar {\n event EnabledModule(address module);\n event DisabledModule(address module);\n event ExecutionFromModuleSuccess(address indexed module);\n event ExecutionFromModuleFailure(address indexed module);\n\n /// @dev Enables a module on the avatar.\n /// @notice Can only be called by the avatar.\n /// @notice Modules should be stored as a linked list.\n /// @notice Must emit EnabledModule(address module) if successful.\n /// @param module Module to be enabled.\n function enableModule(address module) external;\n\n /// @dev Disables a module on the avatar.\n /// @notice Can only be called by the avatar.\n /// @notice Must emit DisabledModule(address module) if successful.\n /// @param prevModule Address that pointed to the module to be removed in the linked list\n /// @param module Module to be removed.\n function disableModule(address prevModule, address module) external;\n\n /// @dev Allows a Module to execute a transaction.\n /// @notice Can only be called by an enabled module.\n /// @notice Must emit ExecutionFromModuleSuccess(address module) if successful.\n /// @notice Must emit ExecutionFromModuleFailure(address module) if unsuccessful.\n /// @param to Destination address of module transaction.\n /// @param value Ether value of module transaction.\n /// @param data Data payload of module transaction.\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\n function execTransactionFromModule(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation\n ) external returns (bool success);\n\n /// @dev Allows a Module to execute a transaction and return data\n /// @notice Can only be called by an enabled module.\n /// @notice Must emit ExecutionFromModuleSuccess(address module) if successful.\n /// @notice Must emit ExecutionFromModuleFailure(address module) if unsuccessful.\n /// @param to Destination address of module transaction.\n /// @param value Ether value of module transaction.\n /// @param data Data payload of module transaction.\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\n function execTransactionFromModuleReturnData(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation\n ) external returns (bool success, bytes memory returnData);\n\n /// @dev Returns if an module is enabled\n /// @return True if the module is enabled\n function isModuleEnabled(address module) external view returns (bool);\n\n /// @dev Returns array of modules.\n /// @param start Start of the page.\n /// @param pageSize Maximum number of modules that should be returned.\n /// @return array Array of modules.\n /// @return next Start of the next page.\n function getModulesPaginated(address start, uint256 pageSize)\n external\n view\n returns (address[] memory array, address next);\n}\n" + }, + "@gnosis.pm/zodiac/contracts/interfaces/IGuard.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\";\n\ninterface IGuard {\n function checkTransaction(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation,\n uint256 safeTxGas,\n uint256 baseGas,\n uint256 gasPrice,\n address gasToken,\n address payable refundReceiver,\n bytes memory signatures,\n address msgSender\n ) external;\n\n function checkAfterExecution(bytes32 txHash, bool success) external;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../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 * 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 OwnableUpgradeable is Initializable, ContextUpgradeable {\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 function __Ownable_init() internal onlyInitializing {\n __Ownable_init_unchained();\n }\n\n function __Ownable_init_unchained() internal onlyInitializing {\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 anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing 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 /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/governance/utils/IVotesUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (governance/utils/IVotes.sol)\npragma solidity ^0.8.0;\n\n/**\n * @dev Common interface for {ERC20Votes}, {ERC721Votes}, and other {Votes}-enabled contracts.\n *\n * _Available since v4.5._\n */\ninterface IVotesUpgradeable {\n /**\n * @dev Emitted when an account changes their delegate.\n */\n event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);\n\n /**\n * @dev Emitted when a token transfer or delegate change results in changes to a delegate's number of votes.\n */\n event DelegateVotesChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance);\n\n /**\n * @dev Returns the current amount of votes that `account` has.\n */\n function getVotes(address account) external view returns (uint256);\n\n /**\n * @dev Returns the amount of votes that `account` had at the end of a past block (`blockNumber`).\n */\n function getPastVotes(address account, uint256 blockNumber) external view returns (uint256);\n\n /**\n * @dev Returns the total supply of votes available at the end of a past block (`blockNumber`).\n *\n * NOTE: This value is the sum of all available votes, which is not necessarily the sum of all delegated votes.\n * Votes that have not been delegated are still part of total supply, even though they would not participate in a\n * vote.\n */\n function getPastTotalSupply(uint256 blockNumber) external view returns (uint256);\n\n /**\n * @dev Returns the delegate that `account` has chosen.\n */\n function delegates(address account) external view returns (address);\n\n /**\n * @dev Delegates votes from the sender to `delegatee`.\n */\n function delegate(address delegatee) external;\n\n /**\n * @dev Delegates votes from signer to `delegatee`.\n */\n function delegateBySig(\n address delegatee,\n uint256 nonce,\n uint256 expiry,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\n * initialization step. This is essential to configure modules that are added through upgrades and that require\n * initialization.\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 modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized < type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20Upgradeable.sol\";\nimport \"./extensions/IERC20MetadataUpgradeable.sol\";\nimport \"../../utils/ContextUpgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20Upgradeable, IERC20MetadataUpgradeable {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n function __ERC20_init(string memory name_, string memory symbol_) internal onlyInitializing {\n __ERC20_init_unchained(name_, symbol_);\n }\n\n function __ERC20_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n }\n _balances[to] += amount;\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n _balances[account] += amount;\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n }\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[45] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-ERC20PermitUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/extensions/draft-ERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./draft-IERC20PermitUpgradeable.sol\";\nimport \"../ERC20Upgradeable.sol\";\nimport \"../../../utils/cryptography/draft-EIP712Upgradeable.sol\";\nimport \"../../../utils/cryptography/ECDSAUpgradeable.sol\";\nimport \"../../../utils/CountersUpgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation 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 * _Available since v3.4._\n *\n * @custom:storage-size 51\n */\nabstract contract ERC20PermitUpgradeable is Initializable, ERC20Upgradeable, IERC20PermitUpgradeable, EIP712Upgradeable {\n using CountersUpgradeable for CountersUpgradeable.Counter;\n\n mapping(address => CountersUpgradeable.Counter) private _nonces;\n\n // solhint-disable-next-line var-name-mixedcase\n bytes32 private constant _PERMIT_TYPEHASH =\n keccak256(\"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\");\n /**\n * @dev In previous versions `_PERMIT_TYPEHASH` was declared as `immutable`.\n * However, to ensure consistency with the upgradeable transpiler, we will continue\n * to reserve a slot.\n * @custom:oz-renamed-from _PERMIT_TYPEHASH\n */\n // solhint-disable-next-line var-name-mixedcase\n bytes32 private _PERMIT_TYPEHASH_DEPRECATED_SLOT;\n\n /**\n * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `\"1\"`.\n *\n * It's a good idea to use the same `name` that is defined as the ERC20 token name.\n */\n function __ERC20Permit_init(string memory name) internal onlyInitializing {\n __EIP712_init_unchained(name, \"1\");\n }\n\n function __ERC20Permit_init_unchained(string memory) internal onlyInitializing {}\n\n /**\n * @dev See {IERC20Permit-permit}.\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 ) public virtual override {\n require(block.timestamp <= deadline, \"ERC20Permit: expired deadline\");\n\n bytes32 structHash = keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline));\n\n bytes32 hash = _hashTypedDataV4(structHash);\n\n address signer = ECDSAUpgradeable.recover(hash, v, r, s);\n require(signer == owner, \"ERC20Permit: invalid signature\");\n\n _approve(owner, spender, value);\n }\n\n /**\n * @dev See {IERC20Permit-nonces}.\n */\n function nonces(address owner) public view virtual override returns (uint256) {\n return _nonces[owner].current();\n }\n\n /**\n * @dev See {IERC20Permit-DOMAIN_SEPARATOR}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view override returns (bytes32) {\n return _domainSeparatorV4();\n }\n\n /**\n * @dev \"Consume a nonce\": return the current value and increment.\n *\n * _Available since v4.1._\n */\n function _useNonce(address owner) internal virtual returns (uint256 current) {\n CountersUpgradeable.Counter storage nonce = _nonces[owner];\n current = nonce.current();\n nonce.increment();\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\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 */\ninterface IERC20PermitUpgradeable {\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 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-upgradeable/token/ERC20/extensions/ERC20SnapshotUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/extensions/ERC20Snapshot.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC20Upgradeable.sol\";\nimport \"../../../utils/ArraysUpgradeable.sol\";\nimport \"../../../utils/CountersUpgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev This contract extends an ERC20 token with a snapshot mechanism. When a snapshot is created, the balances and\n * total supply at the time are recorded for later access.\n *\n * This can be used to safely create mechanisms based on token balances such as trustless dividends or weighted voting.\n * In naive implementations it's possible to perform a \"double spend\" attack by reusing the same balance from different\n * accounts. By using snapshots to calculate dividends or voting power, those attacks no longer apply. It can also be\n * used to create an efficient ERC20 forking mechanism.\n *\n * Snapshots are created by the internal {_snapshot} function, which will emit the {Snapshot} event and return a\n * snapshot id. To get the total supply at the time of a snapshot, call the function {totalSupplyAt} with the snapshot\n * id. To get the balance of an account at the time of a snapshot, call the {balanceOfAt} function with the snapshot id\n * and the account address.\n *\n * NOTE: Snapshot policy can be customized by overriding the {_getCurrentSnapshotId} method. For example, having it\n * return `block.number` will trigger the creation of snapshot at the beginning of each new block. When overriding this\n * function, be careful about the monotonicity of its result. Non-monotonic snapshot ids will break the contract.\n *\n * Implementing snapshots for every block using this method will incur significant gas costs. For a gas-efficient\n * alternative consider {ERC20Votes}.\n *\n * ==== Gas Costs\n *\n * Snapshots are efficient. Snapshot creation is _O(1)_. Retrieval of balances or total supply from a snapshot is _O(log\n * n)_ in the number of snapshots that have been created, although _n_ for a specific account will generally be much\n * smaller since identical balances in subsequent snapshots are stored as a single entry.\n *\n * There is a constant overhead for normal ERC20 transfers due to the additional snapshot bookkeeping. This overhead is\n * only significant for the first transfer that immediately follows a snapshot for a particular account. Subsequent\n * transfers will have normal cost until the next snapshot, and so on.\n */\n\nabstract contract ERC20SnapshotUpgradeable is Initializable, ERC20Upgradeable {\n function __ERC20Snapshot_init() internal onlyInitializing {\n }\n\n function __ERC20Snapshot_init_unchained() internal onlyInitializing {\n }\n // Inspired by Jordi Baylina's MiniMeToken to record historical balances:\n // https://github.com/Giveth/minime/blob/ea04d950eea153a04c51fa510b068b9dded390cb/contracts/MiniMeToken.sol\n\n using ArraysUpgradeable for uint256[];\n using CountersUpgradeable for CountersUpgradeable.Counter;\n\n // Snapshotted values have arrays of ids and the value corresponding to that id. These could be an array of a\n // Snapshot struct, but that would impede usage of functions that work on an array.\n struct Snapshots {\n uint256[] ids;\n uint256[] values;\n }\n\n mapping(address => Snapshots) private _accountBalanceSnapshots;\n Snapshots private _totalSupplySnapshots;\n\n // Snapshot ids increase monotonically, with the first value being 1. An id of 0 is invalid.\n CountersUpgradeable.Counter private _currentSnapshotId;\n\n /**\n * @dev Emitted by {_snapshot} when a snapshot identified by `id` is created.\n */\n event Snapshot(uint256 id);\n\n /**\n * @dev Creates a new snapshot and returns its snapshot id.\n *\n * Emits a {Snapshot} event that contains the same id.\n *\n * {_snapshot} is `internal` and you have to decide how to expose it externally. Its usage may be restricted to a\n * set of accounts, for example using {AccessControl}, or it may be open to the public.\n *\n * [WARNING]\n * ====\n * While an open way of calling {_snapshot} is required for certain trust minimization mechanisms such as forking,\n * you must consider that it can potentially be used by attackers in two ways.\n *\n * First, it can be used to increase the cost of retrieval of values from snapshots, although it will grow\n * logarithmically thus rendering this attack ineffective in the long term. Second, it can be used to target\n * specific accounts and increase the cost of ERC20 transfers for them, in the ways specified in the Gas Costs\n * section above.\n *\n * We haven't measured the actual numbers; if this is something you're interested in please reach out to us.\n * ====\n */\n function _snapshot() internal virtual returns (uint256) {\n _currentSnapshotId.increment();\n\n uint256 currentId = _getCurrentSnapshotId();\n emit Snapshot(currentId);\n return currentId;\n }\n\n /**\n * @dev Get the current snapshotId\n */\n function _getCurrentSnapshotId() internal view virtual returns (uint256) {\n return _currentSnapshotId.current();\n }\n\n /**\n * @dev Retrieves the balance of `account` at the time `snapshotId` was created.\n */\n function balanceOfAt(address account, uint256 snapshotId) public view virtual returns (uint256) {\n (bool snapshotted, uint256 value) = _valueAt(snapshotId, _accountBalanceSnapshots[account]);\n\n return snapshotted ? value : balanceOf(account);\n }\n\n /**\n * @dev Retrieves the total supply at the time `snapshotId` was created.\n */\n function totalSupplyAt(uint256 snapshotId) public view virtual returns (uint256) {\n (bool snapshotted, uint256 value) = _valueAt(snapshotId, _totalSupplySnapshots);\n\n return snapshotted ? value : totalSupply();\n }\n\n // Update balance and/or total supply snapshots before the values are modified. This is implemented\n // in the _beforeTokenTransfer hook, which is executed for _mint, _burn, and _transfer operations.\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual override {\n super._beforeTokenTransfer(from, to, amount);\n\n if (from == address(0)) {\n // mint\n _updateAccountSnapshot(to);\n _updateTotalSupplySnapshot();\n } else if (to == address(0)) {\n // burn\n _updateAccountSnapshot(from);\n _updateTotalSupplySnapshot();\n } else {\n // transfer\n _updateAccountSnapshot(from);\n _updateAccountSnapshot(to);\n }\n }\n\n function _valueAt(uint256 snapshotId, Snapshots storage snapshots) private view returns (bool, uint256) {\n require(snapshotId > 0, \"ERC20Snapshot: id is 0\");\n require(snapshotId <= _getCurrentSnapshotId(), \"ERC20Snapshot: nonexistent id\");\n\n // When a valid snapshot is queried, there are three possibilities:\n // a) The queried value was not modified after the snapshot was taken. Therefore, a snapshot entry was never\n // created for this id, and all stored snapshot ids are smaller than the requested one. The value that corresponds\n // to this id is the current one.\n // b) The queried value was modified after the snapshot was taken. Therefore, there will be an entry with the\n // requested id, and its value is the one to return.\n // c) More snapshots were created after the requested one, and the queried value was later modified. There will be\n // no entry for the requested id: the value that corresponds to it is that of the smallest snapshot id that is\n // larger than the requested one.\n //\n // In summary, we need to find an element in an array, returning the index of the smallest value that is larger if\n // it is not found, unless said value doesn't exist (e.g. when all values are smaller). Arrays.findUpperBound does\n // exactly this.\n\n uint256 index = snapshots.ids.findUpperBound(snapshotId);\n\n if (index == snapshots.ids.length) {\n return (false, 0);\n } else {\n return (true, snapshots.values[index]);\n }\n }\n\n function _updateAccountSnapshot(address account) private {\n _updateSnapshot(_accountBalanceSnapshots[account], balanceOf(account));\n }\n\n function _updateTotalSupplySnapshot() private {\n _updateSnapshot(_totalSupplySnapshots, totalSupply());\n }\n\n function _updateSnapshot(Snapshots storage snapshots, uint256 currentValue) private {\n uint256 currentId = _getCurrentSnapshotId();\n if (_lastSnapshotId(snapshots.ids) < currentId) {\n snapshots.ids.push(currentId);\n snapshots.values.push(currentValue);\n }\n }\n\n function _lastSnapshotId(uint256[] storage ids) private view returns (uint256) {\n if (ids.length == 0) {\n return 0;\n } else {\n return ids[ids.length - 1];\n }\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[46] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20VotesUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/extensions/ERC20Votes.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./draft-ERC20PermitUpgradeable.sol\";\nimport \"../../../utils/math/MathUpgradeable.sol\";\nimport \"../../../governance/utils/IVotesUpgradeable.sol\";\nimport \"../../../utils/math/SafeCastUpgradeable.sol\";\nimport \"../../../utils/cryptography/ECDSAUpgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Extension of ERC20 to support Compound-like voting and delegation. This version is more generic than Compound's,\n * and supports token supply up to 2^224^ - 1, while COMP is limited to 2^96^ - 1.\n *\n * NOTE: If exact COMP compatibility is required, use the {ERC20VotesComp} variant of this module.\n *\n * This extension keeps a history (checkpoints) of each account's vote power. Vote power can be delegated either\n * by calling the {delegate} function directly, or by providing a signature to be used with {delegateBySig}. Voting\n * power can be queried through the public accessors {getVotes} and {getPastVotes}.\n *\n * By default, token balance does not account for voting power. This makes transfers cheaper. The downside is that it\n * requires users to delegate to themselves in order to activate checkpoints and have their voting power tracked.\n *\n * _Available since v4.2._\n */\nabstract contract ERC20VotesUpgradeable is Initializable, IVotesUpgradeable, ERC20PermitUpgradeable {\n function __ERC20Votes_init() internal onlyInitializing {\n }\n\n function __ERC20Votes_init_unchained() internal onlyInitializing {\n }\n struct Checkpoint {\n uint32 fromBlock;\n uint224 votes;\n }\n\n bytes32 private constant _DELEGATION_TYPEHASH =\n keccak256(\"Delegation(address delegatee,uint256 nonce,uint256 expiry)\");\n\n mapping(address => address) private _delegates;\n mapping(address => Checkpoint[]) private _checkpoints;\n Checkpoint[] private _totalSupplyCheckpoints;\n\n /**\n * @dev Get the `pos`-th checkpoint for `account`.\n */\n function checkpoints(address account, uint32 pos) public view virtual returns (Checkpoint memory) {\n return _checkpoints[account][pos];\n }\n\n /**\n * @dev Get number of checkpoints for `account`.\n */\n function numCheckpoints(address account) public view virtual returns (uint32) {\n return SafeCastUpgradeable.toUint32(_checkpoints[account].length);\n }\n\n /**\n * @dev Get the address `account` is currently delegating to.\n */\n function delegates(address account) public view virtual override returns (address) {\n return _delegates[account];\n }\n\n /**\n * @dev Gets the current votes balance for `account`\n */\n function getVotes(address account) public view virtual override returns (uint256) {\n uint256 pos = _checkpoints[account].length;\n return pos == 0 ? 0 : _checkpoints[account][pos - 1].votes;\n }\n\n /**\n * @dev Retrieve the number of votes for `account` at the end of `blockNumber`.\n *\n * Requirements:\n *\n * - `blockNumber` must have been already mined\n */\n function getPastVotes(address account, uint256 blockNumber) public view virtual override returns (uint256) {\n require(blockNumber < block.number, \"ERC20Votes: block not yet mined\");\n return _checkpointsLookup(_checkpoints[account], blockNumber);\n }\n\n /**\n * @dev Retrieve the `totalSupply` at the end of `blockNumber`. Note, this value is the sum of all balances.\n * It is but NOT the sum of all the delegated votes!\n *\n * Requirements:\n *\n * - `blockNumber` must have been already mined\n */\n function getPastTotalSupply(uint256 blockNumber) public view virtual override returns (uint256) {\n require(blockNumber < block.number, \"ERC20Votes: block not yet mined\");\n return _checkpointsLookup(_totalSupplyCheckpoints, blockNumber);\n }\n\n /**\n * @dev Lookup a value in a list of (sorted) checkpoints.\n */\n function _checkpointsLookup(Checkpoint[] storage ckpts, uint256 blockNumber) private view returns (uint256) {\n // We run a binary search to look for the earliest checkpoint taken after `blockNumber`.\n //\n // During the loop, the index of the wanted checkpoint remains in the range [low-1, high).\n // With each iteration, either `low` or `high` is moved towards the middle of the range to maintain the invariant.\n // - If the middle checkpoint is after `blockNumber`, we look in [low, mid)\n // - If the middle checkpoint is before or equal to `blockNumber`, we look in [mid+1, high)\n // Once we reach a single value (when low == high), we've found the right checkpoint at the index high-1, if not\n // out of bounds (in which case we're looking too far in the past and the result is 0).\n // Note that if the latest checkpoint available is exactly for `blockNumber`, we end up with an index that is\n // past the end of the array, so we technically don't find a checkpoint after `blockNumber`, but it works out\n // the same.\n uint256 high = ckpts.length;\n uint256 low = 0;\n while (low < high) {\n uint256 mid = MathUpgradeable.average(low, high);\n if (ckpts[mid].fromBlock > blockNumber) {\n high = mid;\n } else {\n low = mid + 1;\n }\n }\n\n return high == 0 ? 0 : ckpts[high - 1].votes;\n }\n\n /**\n * @dev Delegate votes from the sender to `delegatee`.\n */\n function delegate(address delegatee) public virtual override {\n _delegate(_msgSender(), delegatee);\n }\n\n /**\n * @dev Delegates votes from signer to `delegatee`\n */\n function delegateBySig(\n address delegatee,\n uint256 nonce,\n uint256 expiry,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) public virtual override {\n require(block.timestamp <= expiry, \"ERC20Votes: signature expired\");\n address signer = ECDSAUpgradeable.recover(\n _hashTypedDataV4(keccak256(abi.encode(_DELEGATION_TYPEHASH, delegatee, nonce, expiry))),\n v,\n r,\n s\n );\n require(nonce == _useNonce(signer), \"ERC20Votes: invalid nonce\");\n _delegate(signer, delegatee);\n }\n\n /**\n * @dev Maximum token supply. Defaults to `type(uint224).max` (2^224^ - 1).\n */\n function _maxSupply() internal view virtual returns (uint224) {\n return type(uint224).max;\n }\n\n /**\n * @dev Snapshots the totalSupply after it has been increased.\n */\n function _mint(address account, uint256 amount) internal virtual override {\n super._mint(account, amount);\n require(totalSupply() <= _maxSupply(), \"ERC20Votes: total supply risks overflowing votes\");\n\n _writeCheckpoint(_totalSupplyCheckpoints, _add, amount);\n }\n\n /**\n * @dev Snapshots the totalSupply after it has been decreased.\n */\n function _burn(address account, uint256 amount) internal virtual override {\n super._burn(account, amount);\n\n _writeCheckpoint(_totalSupplyCheckpoints, _subtract, amount);\n }\n\n /**\n * @dev Move voting power when tokens are transferred.\n *\n * Emits a {DelegateVotesChanged} event.\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual override {\n super._afterTokenTransfer(from, to, amount);\n\n _moveVotingPower(delegates(from), delegates(to), amount);\n }\n\n /**\n * @dev Change delegation for `delegator` to `delegatee`.\n *\n * Emits events {DelegateChanged} and {DelegateVotesChanged}.\n */\n function _delegate(address delegator, address delegatee) internal virtual {\n address currentDelegate = delegates(delegator);\n uint256 delegatorBalance = balanceOf(delegator);\n _delegates[delegator] = delegatee;\n\n emit DelegateChanged(delegator, currentDelegate, delegatee);\n\n _moveVotingPower(currentDelegate, delegatee, delegatorBalance);\n }\n\n function _moveVotingPower(\n address src,\n address dst,\n uint256 amount\n ) private {\n if (src != dst && amount > 0) {\n if (src != address(0)) {\n (uint256 oldWeight, uint256 newWeight) = _writeCheckpoint(_checkpoints[src], _subtract, amount);\n emit DelegateVotesChanged(src, oldWeight, newWeight);\n }\n\n if (dst != address(0)) {\n (uint256 oldWeight, uint256 newWeight) = _writeCheckpoint(_checkpoints[dst], _add, amount);\n emit DelegateVotesChanged(dst, oldWeight, newWeight);\n }\n }\n }\n\n function _writeCheckpoint(\n Checkpoint[] storage ckpts,\n function(uint256, uint256) view returns (uint256) op,\n uint256 delta\n ) private returns (uint256 oldWeight, uint256 newWeight) {\n uint256 pos = ckpts.length;\n oldWeight = pos == 0 ? 0 : ckpts[pos - 1].votes;\n newWeight = op(oldWeight, delta);\n\n if (pos > 0 && ckpts[pos - 1].fromBlock == block.number) {\n ckpts[pos - 1].votes = SafeCastUpgradeable.toUint224(newWeight);\n } else {\n ckpts.push(Checkpoint({fromBlock: SafeCastUpgradeable.toUint32(block.number), votes: SafeCastUpgradeable.toUint224(newWeight)}));\n }\n }\n\n function _add(uint256 a, uint256 b) private pure returns (uint256) {\n return a + b;\n }\n\n function _subtract(uint256 a, uint256 b) private pure returns (uint256) {\n return a - b;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[47] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20WrapperUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/extensions/ERC20Wrapper.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC20Upgradeable.sol\";\nimport \"../utils/SafeERC20Upgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Extension of the ERC20 token contract to support token wrapping.\n *\n * Users can deposit and withdraw \"underlying tokens\" and receive a matching number of \"wrapped tokens\". This is useful\n * in conjunction with other modules. For example, combining this wrapping mechanism with {ERC20Votes} will allow the\n * wrapping of an existing \"basic\" ERC20 into a governance token.\n *\n * _Available since v4.2._\n *\n * @custom:storage-size 51\n */\nabstract contract ERC20WrapperUpgradeable is Initializable, ERC20Upgradeable {\n IERC20Upgradeable public underlying;\n\n function __ERC20Wrapper_init(IERC20Upgradeable underlyingToken) internal onlyInitializing {\n __ERC20Wrapper_init_unchained(underlyingToken);\n }\n\n function __ERC20Wrapper_init_unchained(IERC20Upgradeable underlyingToken) internal onlyInitializing {\n underlying = underlyingToken;\n }\n\n /**\n * @dev See {ERC20-decimals}.\n */\n function decimals() public view virtual override returns (uint8) {\n try IERC20MetadataUpgradeable(address(underlying)).decimals() returns (uint8 value) {\n return value;\n } catch {\n return super.decimals();\n }\n }\n\n /**\n * @dev Allow a user to deposit underlying tokens and mint the corresponding number of wrapped tokens.\n */\n function depositFor(address account, uint256 amount) public virtual returns (bool) {\n SafeERC20Upgradeable.safeTransferFrom(underlying, _msgSender(), address(this), amount);\n _mint(account, amount);\n return true;\n }\n\n /**\n * @dev Allow a user to burn a number of wrapped tokens and withdraw the corresponding number of underlying tokens.\n */\n function withdrawTo(address account, uint256 amount) public virtual returns (bool) {\n _burn(_msgSender(), amount);\n SafeERC20Upgradeable.safeTransfer(underlying, account, amount);\n return true;\n }\n\n /**\n * @dev Mint wrapped token to cover any underlyingTokens that would have been transferred by mistake. Internal\n * function that can be exposed with access control if desired.\n */\n function _recover(address account) internal virtual returns (uint256) {\n uint256 value = underlying.balanceOf(address(this)) - totalSupply();\n _mint(account, value);\n return value;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20Upgradeable.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20MetadataUpgradeable is IERC20Upgradeable {\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-upgradeable/token/ERC20/IERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\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 amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `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 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20Upgradeable.sol\";\nimport \"../extensions/draft-IERC20PermitUpgradeable.sol\";\nimport \"../../../utils/AddressUpgradeable.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 SafeERC20Upgradeable {\n using AddressUpgradeable for address;\n\n function safeTransfer(\n IERC20Upgradeable token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20Upgradeable token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20Upgradeable token,\n address spender,\n uint256 value\n ) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20Upgradeable token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20Upgradeable token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n function safePermit(\n IERC20PermitUpgradeable token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\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(IERC20Upgradeable token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.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 *\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://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @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}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/ArraysUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Arrays.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/MathUpgradeable.sol\";\n\n/**\n * @dev Collection of functions related to array types.\n */\nlibrary ArraysUpgradeable {\n /**\n * @dev Searches a sorted `array` and returns the first index that contains\n * a value greater or equal to `element`. If no such index exists (i.e. all\n * values in the array are strictly less than `element`), the array length is\n * returned. Time complexity O(log n).\n *\n * `array` is expected to be sorted in ascending order, and to contain no\n * repeated elements.\n */\n function findUpperBound(uint256[] storage array, uint256 element) internal view returns (uint256) {\n if (array.length == 0) {\n return 0;\n }\n\n uint256 low = 0;\n uint256 high = array.length;\n\n while (low < high) {\n uint256 mid = MathUpgradeable.average(low, high);\n\n // Note that mid will always be strictly less than high (i.e. it will be a valid array index)\n // because Math.average rounds down (it does integer division with truncation).\n if (array[mid] > element) {\n high = mid;\n } else {\n low = mid + 1;\n }\n }\n\n // At this point `low` is the exclusive upper bound. We will return the inclusive upper bound.\n if (low > 0 && array[low - 1] == element) {\n return low - 1;\n } else {\n return low;\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\nimport \"../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 /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title Counters\n * @author Matt Condon (@shrugs)\n * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number\n * of elements in a mapping, issuing ERC721 ids, or counting request ids.\n *\n * Include with `using Counters for Counters.Counter;`\n */\nlibrary CountersUpgradeable {\n struct Counter {\n // This variable should never be directly accessed by users of the library: interactions must be restricted to\n // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add\n // this feature: see https://github.com/ethereum/solidity/issues/4637\n uint256 _value; // default: 0\n }\n\n function current(Counter storage counter) internal view returns (uint256) {\n return counter._value;\n }\n\n function increment(Counter storage counter) internal {\n unchecked {\n counter._value += 1;\n }\n }\n\n function decrement(Counter storage counter) internal {\n uint256 value = counter._value;\n require(value > 0, \"Counter: decrement overflow\");\n unchecked {\n counter._value = value - 1;\n }\n }\n\n function reset(Counter storage counter) internal {\n counter._value = 0;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/cryptography/draft-EIP712Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/cryptography/draft-EIP712.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./ECDSAUpgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.\n *\n * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,\n * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding\n * they need in their contracts using a combination of `abi.encode` and `keccak256`.\n *\n * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding\n * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA\n * ({_hashTypedDataV4}).\n *\n * The implementation of the domain separator was designed to be as efficient as possible while still properly updating\n * the chain id to protect against replay attacks on an eventual fork of the chain.\n *\n * NOTE: This contract implements the version of the encoding known as \"v4\", as implemented by the JSON RPC method\n * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].\n *\n * _Available since v3.4._\n *\n * @custom:storage-size 52\n */\nabstract contract EIP712Upgradeable is Initializable {\n /* solhint-disable var-name-mixedcase */\n bytes32 private _HASHED_NAME;\n bytes32 private _HASHED_VERSION;\n bytes32 private constant _TYPE_HASH = keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\");\n\n /* solhint-enable var-name-mixedcase */\n\n /**\n * @dev Initializes the domain separator and parameter caches.\n *\n * The meaning of `name` and `version` is specified in\n * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:\n *\n * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.\n * - `version`: the current major version of the signing domain.\n *\n * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart\n * contract upgrade].\n */\n function __EIP712_init(string memory name, string memory version) internal onlyInitializing {\n __EIP712_init_unchained(name, version);\n }\n\n function __EIP712_init_unchained(string memory name, string memory version) internal onlyInitializing {\n bytes32 hashedName = keccak256(bytes(name));\n bytes32 hashedVersion = keccak256(bytes(version));\n _HASHED_NAME = hashedName;\n _HASHED_VERSION = hashedVersion;\n }\n\n /**\n * @dev Returns the domain separator for the current chain.\n */\n function _domainSeparatorV4() internal view returns (bytes32) {\n return _buildDomainSeparator(_TYPE_HASH, _EIP712NameHash(), _EIP712VersionHash());\n }\n\n function _buildDomainSeparator(\n bytes32 typeHash,\n bytes32 nameHash,\n bytes32 versionHash\n ) private view returns (bytes32) {\n return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this)));\n }\n\n /**\n * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this\n * function returns the hash of the fully encoded EIP712 message for this domain.\n *\n * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:\n *\n * ```solidity\n * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(\n * keccak256(\"Mail(address to,string contents)\"),\n * mailTo,\n * keccak256(bytes(mailContents))\n * )));\n * address signer = ECDSA.recover(digest, signature);\n * ```\n */\n function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {\n return ECDSAUpgradeable.toTypedDataHash(_domainSeparatorV4(), structHash);\n }\n\n /**\n * @dev The hash of the name parameter for the EIP712 domain.\n *\n * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs\n * are a concern.\n */\n function _EIP712NameHash() internal virtual view returns (bytes32) {\n return _HASHED_NAME;\n }\n\n /**\n * @dev The hash of the version parameter for the EIP712 domain.\n *\n * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs\n * are a concern.\n */\n function _EIP712VersionHash() internal virtual view returns (bytes32) {\n return _HASHED_VERSION;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.3) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../StringsUpgradeable.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSAUpgradeable {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS,\n InvalidSignatureV\n }\n\n function _throwError(RecoverError error) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert(\"ECDSA: invalid signature\");\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert(\"ECDSA: invalid signature length\");\n } else if (error == RecoverError.InvalidSignatureS) {\n revert(\"ECDSA: invalid signature 's' value\");\n } else if (error == RecoverError.InvalidSignatureV) {\n revert(\"ECDSA: invalid signature 'v' value\");\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature` or error string. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n /// @solidity memory-safe-assembly\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength);\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, signature);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n *\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address, RecoverError) {\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n uint8 v = uint8((uint256(vs) >> 255) + 27);\n return tryRecover(hash, v, r, s);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n *\n * _Available since v4.2._\n */\n function recover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n * `r` and `s` signature fields separately.\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address, RecoverError) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS);\n }\n if (v != 27 && v != 28) {\n return (address(0), RecoverError.InvalidSignatureV);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature);\n }\n\n return (signer, RecoverError.NoError);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", hash));\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from `s`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", StringsUpgradeable.toString(s.length), s));\n }\n\n /**\n * @dev Returns an Ethereum Signed Typed Data, created from a\n * `domainSeparator` and a `structHash`. This produces hash corresponding\n * to the one signed with the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n * JSON-RPC method as part of EIP-712.\n *\n * See {recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x01\", domainSeparator, structHash));\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary MathUpgradeable {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\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 up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 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 denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) 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; // 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 prod0 := mul(x, y)\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 return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n 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. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\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 works\n // 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(\n uint256 x,\n uint256 y,\n uint256 denominator,\n Rounding rounding\n ) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. It the number is not a perfect square, the value is rounded down.\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 // 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)`.\n // We also know that `k`, the position of the most significant bit, is such that `msb(a) = 2**k`.\n // This gives `2**k < a <= 2**(k+1)` → `2**(k/2) <= sqrt(a) < 2 ** (k/2+1)`.\n // Using an algorithm similar to the msb conmputation, we are able to compute `result = 2**(k/2)` which is a\n // good first aproximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1;\n uint256 x = a;\n if (x >> 128 > 0) {\n x >>= 128;\n result <<= 64;\n }\n if (x >> 64 > 0) {\n x >>= 64;\n result <<= 32;\n }\n if (x >> 32 > 0) {\n x >>= 32;\n result <<= 16;\n }\n if (x >> 16 > 0) {\n x >>= 16;\n result <<= 8;\n }\n if (x >> 8 > 0) {\n x >>= 8;\n result <<= 4;\n }\n if (x >> 4 > 0) {\n x >>= 4;\n result <<= 2;\n }\n if (x >> 2 > 0) {\n result <<= 1;\n }\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 uint256 result = sqrt(a);\n if (rounding == Rounding.Up && result * result < a) {\n result += 1;\n }\n return result;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/math/SafeCastUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/math/SafeCast.sol)\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 SafeCastUpgradeable {\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) {\n require(value >= type(int248).min && value <= type(int248).max, \"SafeCast: value doesn't fit in 248 bits\");\n return int248(value);\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) {\n require(value >= type(int240).min && value <= type(int240).max, \"SafeCast: value doesn't fit in 240 bits\");\n return int240(value);\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) {\n require(value >= type(int232).min && value <= type(int232).max, \"SafeCast: value doesn't fit in 232 bits\");\n return int232(value);\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) {\n require(value >= type(int224).min && value <= type(int224).max, \"SafeCast: value doesn't fit in 224 bits\");\n return int224(value);\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) {\n require(value >= type(int216).min && value <= type(int216).max, \"SafeCast: value doesn't fit in 216 bits\");\n return int216(value);\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) {\n require(value >= type(int208).min && value <= type(int208).max, \"SafeCast: value doesn't fit in 208 bits\");\n return int208(value);\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) {\n require(value >= type(int200).min && value <= type(int200).max, \"SafeCast: value doesn't fit in 200 bits\");\n return int200(value);\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) {\n require(value >= type(int192).min && value <= type(int192).max, \"SafeCast: value doesn't fit in 192 bits\");\n return int192(value);\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) {\n require(value >= type(int184).min && value <= type(int184).max, \"SafeCast: value doesn't fit in 184 bits\");\n return int184(value);\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) {\n require(value >= type(int176).min && value <= type(int176).max, \"SafeCast: value doesn't fit in 176 bits\");\n return int176(value);\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) {\n require(value >= type(int168).min && value <= type(int168).max, \"SafeCast: value doesn't fit in 168 bits\");\n return int168(value);\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) {\n require(value >= type(int160).min && value <= type(int160).max, \"SafeCast: value doesn't fit in 160 bits\");\n return int160(value);\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) {\n require(value >= type(int152).min && value <= type(int152).max, \"SafeCast: value doesn't fit in 152 bits\");\n return int152(value);\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) {\n require(value >= type(int144).min && value <= type(int144).max, \"SafeCast: value doesn't fit in 144 bits\");\n return int144(value);\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) {\n require(value >= type(int136).min && value <= type(int136).max, \"SafeCast: value doesn't fit in 136 bits\");\n return int136(value);\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) {\n require(value >= type(int128).min && value <= type(int128).max, \"SafeCast: value doesn't fit in 128 bits\");\n return int128(value);\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) {\n require(value >= type(int120).min && value <= type(int120).max, \"SafeCast: value doesn't fit in 120 bits\");\n return int120(value);\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) {\n require(value >= type(int112).min && value <= type(int112).max, \"SafeCast: value doesn't fit in 112 bits\");\n return int112(value);\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) {\n require(value >= type(int104).min && value <= type(int104).max, \"SafeCast: value doesn't fit in 104 bits\");\n return int104(value);\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) {\n require(value >= type(int96).min && value <= type(int96).max, \"SafeCast: value doesn't fit in 96 bits\");\n return int96(value);\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) {\n require(value >= type(int88).min && value <= type(int88).max, \"SafeCast: value doesn't fit in 88 bits\");\n return int88(value);\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) {\n require(value >= type(int80).min && value <= type(int80).max, \"SafeCast: value doesn't fit in 80 bits\");\n return int80(value);\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) {\n require(value >= type(int72).min && value <= type(int72).max, \"SafeCast: value doesn't fit in 72 bits\");\n return int72(value);\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) {\n require(value >= type(int64).min && value <= type(int64).max, \"SafeCast: value doesn't fit in 64 bits\");\n return int64(value);\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) {\n require(value >= type(int56).min && value <= type(int56).max, \"SafeCast: value doesn't fit in 56 bits\");\n return int56(value);\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) {\n require(value >= type(int48).min && value <= type(int48).max, \"SafeCast: value doesn't fit in 48 bits\");\n return int48(value);\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) {\n require(value >= type(int40).min && value <= type(int40).max, \"SafeCast: value doesn't fit in 40 bits\");\n return int40(value);\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) {\n require(value >= type(int32).min && value <= type(int32).max, \"SafeCast: value doesn't fit in 32 bits\");\n return int32(value);\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) {\n require(value >= type(int24).min && value <= type(int24).max, \"SafeCast: value doesn't fit in 24 bits\");\n return int24(value);\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) {\n require(value >= type(int16).min && value <= type(int16).max, \"SafeCast: value doesn't fit in 16 bits\");\n return int16(value);\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) {\n require(value >= type(int8).min && value <= type(int8).max, \"SafeCast: value doesn't fit in 8 bits\");\n return int8(value);\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" + }, + "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev String operations.\n */\nlibrary StringsUpgradeable {\n bytes16 private constant _HEX_SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\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 // Inspired by OraclizeAPI's implementation - MIT licence\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\n\n if (value == 0) {\n return \"0\";\n }\n uint256 temp = value;\n uint256 digits;\n while (temp != 0) {\n digits++;\n temp /= 10;\n }\n bytes memory buffer = new bytes(digits);\n while (value != 0) {\n digits -= 1;\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\n value /= 10;\n }\n return string(buffer);\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 if (value == 0) {\n return \"0x00\";\n }\n uint256 temp = value;\n uint256 length = 0;\n while (temp != 0) {\n length++;\n temp >>= 8;\n }\n return toHexString(value, length);\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 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_SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\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 representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "@openzeppelin/contracts/governance/utils/IVotes.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (governance/utils/IVotes.sol)\npragma solidity ^0.8.0;\n\n/**\n * @dev Common interface for {ERC20Votes}, {ERC721Votes}, and other {Votes}-enabled contracts.\n *\n * _Available since v4.5._\n */\ninterface IVotes {\n /**\n * @dev Emitted when an account changes their delegate.\n */\n event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);\n\n /**\n * @dev Emitted when a token transfer or delegate change results in changes to a delegate's number of votes.\n */\n event DelegateVotesChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance);\n\n /**\n * @dev Returns the current amount of votes that `account` has.\n */\n function getVotes(address account) external view returns (uint256);\n\n /**\n * @dev Returns the amount of votes that `account` had at the end of a past block (`blockNumber`).\n */\n function getPastVotes(address account, uint256 blockNumber) external view returns (uint256);\n\n /**\n * @dev Returns the total supply of votes available at the end of a past block (`blockNumber`).\n *\n * NOTE: This value is the sum of all available votes, which is not necessarily the sum of all delegated votes.\n * Votes that have not been delegated are still part of total supply, even though they would not participate in a\n * vote.\n */\n function getPastTotalSupply(uint256 blockNumber) external view returns (uint256);\n\n /**\n * @dev Returns the delegate that `account` has chosen.\n */\n function delegates(address account) external view returns (address);\n\n /**\n * @dev Delegates votes from the sender to `delegatee`.\n */\n function delegate(address delegatee) external;\n\n /**\n * @dev Delegates votes from signer to `delegatee`.\n */\n function delegateBySig(\n address delegatee,\n uint256 nonce,\n uint256 expiry,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n}\n" + }, + "@openzeppelin/contracts/interfaces/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/introspection/IERC165.sol\";\n" + }, + "@openzeppelin/contracts/token/ERC20/ERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n }\n _balances[to] += amount;\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n _balances[account] += amount;\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n }\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\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 */\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 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/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\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 v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev 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 amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `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 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../extensions/draft-IERC20Permit.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n function safePermit(\n IERC20Permit token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/ERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721.sol\";\nimport \"./IERC721Receiver.sol\";\nimport \"./extensions/IERC721Metadata.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/Context.sol\";\nimport \"../../utils/Strings.sol\";\nimport \"../../utils/introspection/ERC165.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 */\ncontract ERC721 is Context, ERC165, IERC721, IERC721Metadata {\n using Address for address;\n using Strings for uint256;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to owner address\n mapping(uint256 => address) private _owners;\n\n // Mapping owner address to token count\n mapping(address => uint256) private _balances;\n\n // Mapping from token ID to approved address\n mapping(uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, 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 override returns (uint256) {\n require(owner != address(0), \"ERC721: address zero is not a valid owner\");\n return _balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n address owner = _owners[tokenId];\n require(owner != address(0), \"ERC721: invalid token ID\");\n return owner;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(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 override {\n address owner = ERC721.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not token owner nor approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n _requireMinted(tokenId);\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner nor approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner nor approved\");\n _safeTransfer(from, to, tokenId, data);\n }\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 * `data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\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 `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(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _transfer(from, to, tokenId);\n require(_checkOnERC721Received(from, to, tokenId, data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n * and stop existing when they are burned (`_burn`).\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _owners[tokenId] != address(0);\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n address owner = ERC721.ownerOf(tokenId);\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\n }\n\n /**\n * @dev Safely mints `tokenId` and transfers it to `to`.\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 virtual {\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(\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _mint(to, tokenId);\n require(\n _checkOnERC721Received(address(0), to, tokenId, data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\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 virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId);\n\n _balances[to] += 1;\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId);\n\n // Clear approvals\n _approve(address(0), tokenId);\n\n _balances[owner] -= 1;\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId);\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(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId);\n\n // Clear approvals from the previous owner\n _approve(address(0), tokenId);\n\n _balances[from] -= 1;\n _balances[to] += 1;\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ERC721.ownerOf(tokenId), to, tokenId);\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(\n address owner,\n address operator,\n bool approved\n ) internal virtual {\n require(owner != operator, \"ERC721: approve to caller\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Reverts if the `tokenId` has not been minted yet.\n */\n function _requireMinted(uint256 tokenId) internal view virtual {\n require(_exists(tokenId), \"ERC721: invalid token ID\");\n }\n\n /**\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n * 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 * @return bool whether the call correctly returned the expected magic value\n */\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) private returns (bool) {\n if (to.isContract()) {\n try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n return retval == IERC721Receiver.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\"ERC721: transfer to non ERC721Receiver implementer\");\n } else {\n /// @solidity memory-safe-assembly\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting\n * and burning.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be\n * transferred to `to`.\n * - When `from` is zero, `tokenId` will be minted for `to`.\n * - When `to` is zero, ``from``'s `tokenId` will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../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 v4.7.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n\n /**\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 {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns 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 v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `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/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.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 *\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://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @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}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165Storage.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165Storage.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./ERC165.sol\";\n\n/**\n * @dev Storage based implementation of the {IERC165} interface.\n *\n * Contracts may inherit from this and call {_registerInterface} to declare\n * their support of an interface.\n */\nabstract contract ERC165Storage is ERC165 {\n /**\n * @dev Mapping of interface ids to whether or not it's supported.\n */\n mapping(bytes4 => bool) private _supportedInterfaces;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return super.supportsInterface(interfaceId) || _supportedInterfaces[interfaceId];\n }\n\n /**\n * @dev Registers the contract as an implementer of the interface defined by\n * `interfaceId`. Support of the actual ERC165 interface is automatic and\n * registering its interface id is not required.\n *\n * See {IERC165-supportsInterface}.\n *\n * Requirements:\n *\n * - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`).\n */\n function _registerInterface(bytes4 interfaceId) internal virtual {\n require(interfaceId != 0xffffffff, \"ERC165: invalid interface id\");\n _supportedInterfaces[interfaceId] = true;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _HEX_SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\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 // Inspired by OraclizeAPI's implementation - MIT licence\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\n\n if (value == 0) {\n return \"0\";\n }\n uint256 temp = value;\n uint256 digits;\n while (temp != 0) {\n digits++;\n temp /= 10;\n }\n bytes memory buffer = new bytes(digits);\n while (value != 0) {\n digits -= 1;\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\n value /= 10;\n }\n return string(buffer);\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 if (value == 0) {\n return \"0x00\";\n }\n uint256 temp = value;\n uint256 length = 0;\n while (temp != 0) {\n length++;\n temp >>= 8;\n }\n return toHexString(value, length);\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 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_SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\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 representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "@prb/math/src/Common.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\n// Common.sol\n//\n// Common mathematical functions used in both SD59x18 and UD60x18. Note that these global functions do not\n// always operate with SD59x18 and UD60x18 numbers.\n\n/*//////////////////////////////////////////////////////////////////////////\n CUSTOM ERRORS\n//////////////////////////////////////////////////////////////////////////*/\n\n/// @notice Thrown when the resultant value in {mulDiv} overflows uint256.\nerror PRBMath_MulDiv_Overflow(uint256 x, uint256 y, uint256 denominator);\n\n/// @notice Thrown when the resultant value in {mulDiv18} overflows uint256.\nerror PRBMath_MulDiv18_Overflow(uint256 x, uint256 y);\n\n/// @notice Thrown when one of the inputs passed to {mulDivSigned} is `type(int256).min`.\nerror PRBMath_MulDivSigned_InputTooSmall();\n\n/// @notice Thrown when the resultant value in {mulDivSigned} overflows int256.\nerror PRBMath_MulDivSigned_Overflow(int256 x, int256 y);\n\n/*//////////////////////////////////////////////////////////////////////////\n CONSTANTS\n//////////////////////////////////////////////////////////////////////////*/\n\n/// @dev The maximum value a uint128 number can have.\nuint128 constant MAX_UINT128 = type(uint128).max;\n\n/// @dev The maximum value a uint40 number can have.\nuint40 constant MAX_UINT40 = type(uint40).max;\n\n/// @dev The unit number, which the decimal precision of the fixed-point types.\nuint256 constant UNIT = 1e18;\n\n/// @dev The unit number inverted mod 2^256.\nuint256 constant UNIT_INVERSE = 78156646155174841979727994598816262306175212592076161876661_508869554232690281;\n\n/// @dev The the largest power of two that divides the decimal value of `UNIT`. The logarithm of this value is the least significant\n/// bit in the binary representation of `UNIT`.\nuint256 constant UNIT_LPOTD = 262144;\n\n/*//////////////////////////////////////////////////////////////////////////\n FUNCTIONS\n//////////////////////////////////////////////////////////////////////////*/\n\n/// @notice Calculates the binary exponent of x using the binary fraction method.\n/// @dev Has to use 192.64-bit fixed-point numbers. See https://ethereum.stackexchange.com/a/96594/24693.\n/// @param x The exponent as an unsigned 192.64-bit fixed-point number.\n/// @return result The result as an unsigned 60.18-decimal fixed-point number.\n/// @custom:smtchecker abstract-function-nondet\nfunction exp2(uint256 x) pure returns (uint256 result) {\n unchecked {\n // Start from 0.5 in the 192.64-bit fixed-point format.\n result = 0x800000000000000000000000000000000000000000000000;\n\n // The following logic multiplies the result by $\\sqrt{2^{-i}}$ when the bit at position i is 1. Key points:\n //\n // 1. Intermediate results will not overflow, as the starting point is 2^191 and all magic factors are under 2^65.\n // 2. The rationale for organizing the if statements into groups of 8 is gas savings. If the result of performing\n // a bitwise AND operation between x and any value in the array [0x80; 0x40; 0x20; 0x10; 0x08; 0x04; 0x02; 0x01] is 1,\n // we know that `x & 0xFF` is also 1.\n if (x & 0xFF00000000000000 > 0) {\n if (x & 0x8000000000000000 > 0) {\n result = (result * 0x16A09E667F3BCC909) >> 64;\n }\n if (x & 0x4000000000000000 > 0) {\n result = (result * 0x1306FE0A31B7152DF) >> 64;\n }\n if (x & 0x2000000000000000 > 0) {\n result = (result * 0x1172B83C7D517ADCE) >> 64;\n }\n if (x & 0x1000000000000000 > 0) {\n result = (result * 0x10B5586CF9890F62A) >> 64;\n }\n if (x & 0x800000000000000 > 0) {\n result = (result * 0x1059B0D31585743AE) >> 64;\n }\n if (x & 0x400000000000000 > 0) {\n result = (result * 0x102C9A3E778060EE7) >> 64;\n }\n if (x & 0x200000000000000 > 0) {\n result = (result * 0x10163DA9FB33356D8) >> 64;\n }\n if (x & 0x100000000000000 > 0) {\n result = (result * 0x100B1AFA5ABCBED61) >> 64;\n }\n }\n\n if (x & 0xFF000000000000 > 0) {\n if (x & 0x80000000000000 > 0) {\n result = (result * 0x10058C86DA1C09EA2) >> 64;\n }\n if (x & 0x40000000000000 > 0) {\n result = (result * 0x1002C605E2E8CEC50) >> 64;\n }\n if (x & 0x20000000000000 > 0) {\n result = (result * 0x100162F3904051FA1) >> 64;\n }\n if (x & 0x10000000000000 > 0) {\n result = (result * 0x1000B175EFFDC76BA) >> 64;\n }\n if (x & 0x8000000000000 > 0) {\n result = (result * 0x100058BA01FB9F96D) >> 64;\n }\n if (x & 0x4000000000000 > 0) {\n result = (result * 0x10002C5CC37DA9492) >> 64;\n }\n if (x & 0x2000000000000 > 0) {\n result = (result * 0x1000162E525EE0547) >> 64;\n }\n if (x & 0x1000000000000 > 0) {\n result = (result * 0x10000B17255775C04) >> 64;\n }\n }\n\n if (x & 0xFF0000000000 > 0) {\n if (x & 0x800000000000 > 0) {\n result = (result * 0x1000058B91B5BC9AE) >> 64;\n }\n if (x & 0x400000000000 > 0) {\n result = (result * 0x100002C5C89D5EC6D) >> 64;\n }\n if (x & 0x200000000000 > 0) {\n result = (result * 0x10000162E43F4F831) >> 64;\n }\n if (x & 0x100000000000 > 0) {\n result = (result * 0x100000B1721BCFC9A) >> 64;\n }\n if (x & 0x80000000000 > 0) {\n result = (result * 0x10000058B90CF1E6E) >> 64;\n }\n if (x & 0x40000000000 > 0) {\n result = (result * 0x1000002C5C863B73F) >> 64;\n }\n if (x & 0x20000000000 > 0) {\n result = (result * 0x100000162E430E5A2) >> 64;\n }\n if (x & 0x10000000000 > 0) {\n result = (result * 0x1000000B172183551) >> 64;\n }\n }\n\n if (x & 0xFF00000000 > 0) {\n if (x & 0x8000000000 > 0) {\n result = (result * 0x100000058B90C0B49) >> 64;\n }\n if (x & 0x4000000000 > 0) {\n result = (result * 0x10000002C5C8601CC) >> 64;\n }\n if (x & 0x2000000000 > 0) {\n result = (result * 0x1000000162E42FFF0) >> 64;\n }\n if (x & 0x1000000000 > 0) {\n result = (result * 0x10000000B17217FBB) >> 64;\n }\n if (x & 0x800000000 > 0) {\n result = (result * 0x1000000058B90BFCE) >> 64;\n }\n if (x & 0x400000000 > 0) {\n result = (result * 0x100000002C5C85FE3) >> 64;\n }\n if (x & 0x200000000 > 0) {\n result = (result * 0x10000000162E42FF1) >> 64;\n }\n if (x & 0x100000000 > 0) {\n result = (result * 0x100000000B17217F8) >> 64;\n }\n }\n\n if (x & 0xFF000000 > 0) {\n if (x & 0x80000000 > 0) {\n result = (result * 0x10000000058B90BFC) >> 64;\n }\n if (x & 0x40000000 > 0) {\n result = (result * 0x1000000002C5C85FE) >> 64;\n }\n if (x & 0x20000000 > 0) {\n result = (result * 0x100000000162E42FF) >> 64;\n }\n if (x & 0x10000000 > 0) {\n result = (result * 0x1000000000B17217F) >> 64;\n }\n if (x & 0x8000000 > 0) {\n result = (result * 0x100000000058B90C0) >> 64;\n }\n if (x & 0x4000000 > 0) {\n result = (result * 0x10000000002C5C860) >> 64;\n }\n if (x & 0x2000000 > 0) {\n result = (result * 0x1000000000162E430) >> 64;\n }\n if (x & 0x1000000 > 0) {\n result = (result * 0x10000000000B17218) >> 64;\n }\n }\n\n if (x & 0xFF0000 > 0) {\n if (x & 0x800000 > 0) {\n result = (result * 0x1000000000058B90C) >> 64;\n }\n if (x & 0x400000 > 0) {\n result = (result * 0x100000000002C5C86) >> 64;\n }\n if (x & 0x200000 > 0) {\n result = (result * 0x10000000000162E43) >> 64;\n }\n if (x & 0x100000 > 0) {\n result = (result * 0x100000000000B1721) >> 64;\n }\n if (x & 0x80000 > 0) {\n result = (result * 0x10000000000058B91) >> 64;\n }\n if (x & 0x40000 > 0) {\n result = (result * 0x1000000000002C5C8) >> 64;\n }\n if (x & 0x20000 > 0) {\n result = (result * 0x100000000000162E4) >> 64;\n }\n if (x & 0x10000 > 0) {\n result = (result * 0x1000000000000B172) >> 64;\n }\n }\n\n if (x & 0xFF00 > 0) {\n if (x & 0x8000 > 0) {\n result = (result * 0x100000000000058B9) >> 64;\n }\n if (x & 0x4000 > 0) {\n result = (result * 0x10000000000002C5D) >> 64;\n }\n if (x & 0x2000 > 0) {\n result = (result * 0x1000000000000162E) >> 64;\n }\n if (x & 0x1000 > 0) {\n result = (result * 0x10000000000000B17) >> 64;\n }\n if (x & 0x800 > 0) {\n result = (result * 0x1000000000000058C) >> 64;\n }\n if (x & 0x400 > 0) {\n result = (result * 0x100000000000002C6) >> 64;\n }\n if (x & 0x200 > 0) {\n result = (result * 0x10000000000000163) >> 64;\n }\n if (x & 0x100 > 0) {\n result = (result * 0x100000000000000B1) >> 64;\n }\n }\n\n if (x & 0xFF > 0) {\n if (x & 0x80 > 0) {\n result = (result * 0x10000000000000059) >> 64;\n }\n if (x & 0x40 > 0) {\n result = (result * 0x1000000000000002C) >> 64;\n }\n if (x & 0x20 > 0) {\n result = (result * 0x10000000000000016) >> 64;\n }\n if (x & 0x10 > 0) {\n result = (result * 0x1000000000000000B) >> 64;\n }\n if (x & 0x8 > 0) {\n result = (result * 0x10000000000000006) >> 64;\n }\n if (x & 0x4 > 0) {\n result = (result * 0x10000000000000003) >> 64;\n }\n if (x & 0x2 > 0) {\n result = (result * 0x10000000000000001) >> 64;\n }\n if (x & 0x1 > 0) {\n result = (result * 0x10000000000000001) >> 64;\n }\n }\n\n // In the code snippet below, two operations are executed simultaneously:\n //\n // 1. The result is multiplied by $(2^n + 1)$, where $2^n$ represents the integer part, and the additional 1\n // accounts for the initial guess of 0.5. This is achieved by subtracting from 191 instead of 192.\n // 2. The result is then converted to an unsigned 60.18-decimal fixed-point format.\n //\n // The underlying logic is based on the relationship $2^{191-ip} = 2^{ip} / 2^{191}$, where $ip$ denotes the,\n // integer part, $2^n$.\n result *= UNIT;\n result >>= (191 - (x >> 64));\n }\n}\n\n/// @notice Finds the zero-based index of the first 1 in the binary representation of x.\n///\n/// @dev See the note on \"msb\" in this Wikipedia article: https://en.wikipedia.org/wiki/Find_first_set\n///\n/// Each step in this implementation is equivalent to this high-level code:\n///\n/// ```solidity\n/// if (x >= 2 ** 128) {\n/// x >>= 128;\n/// result += 128;\n/// }\n/// ```\n///\n/// Where 128 is replaced with each respective power of two factor. See the full high-level implementation here:\n/// https://gist.github.com/PaulRBerg/f932f8693f2733e30c4d479e8e980948\n///\n/// The Yul instructions used below are:\n///\n/// - \"gt\" is \"greater than\"\n/// - \"or\" is the OR bitwise operator\n/// - \"shl\" is \"shift left\"\n/// - \"shr\" is \"shift right\"\n///\n/// @param x The uint256 number for which to find the index of the most significant bit.\n/// @return result The index of the most significant bit as a uint256.\n/// @custom:smtchecker abstract-function-nondet\nfunction msb(uint256 x) pure returns (uint256 result) {\n // 2^128\n assembly (\"memory-safe\") {\n let factor := shl(7, gt(x, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))\n x := shr(factor, x)\n result := or(result, factor)\n }\n // 2^64\n assembly (\"memory-safe\") {\n let factor := shl(6, gt(x, 0xFFFFFFFFFFFFFFFF))\n x := shr(factor, x)\n result := or(result, factor)\n }\n // 2^32\n assembly (\"memory-safe\") {\n let factor := shl(5, gt(x, 0xFFFFFFFF))\n x := shr(factor, x)\n result := or(result, factor)\n }\n // 2^16\n assembly (\"memory-safe\") {\n let factor := shl(4, gt(x, 0xFFFF))\n x := shr(factor, x)\n result := or(result, factor)\n }\n // 2^8\n assembly (\"memory-safe\") {\n let factor := shl(3, gt(x, 0xFF))\n x := shr(factor, x)\n result := or(result, factor)\n }\n // 2^4\n assembly (\"memory-safe\") {\n let factor := shl(2, gt(x, 0xF))\n x := shr(factor, x)\n result := or(result, factor)\n }\n // 2^2\n assembly (\"memory-safe\") {\n let factor := shl(1, gt(x, 0x3))\n x := shr(factor, x)\n result := or(result, factor)\n }\n // 2^1\n // No need to shift x any more.\n assembly (\"memory-safe\") {\n let factor := gt(x, 0x1)\n result := or(result, factor)\n }\n}\n\n/// @notice Calculates x*y÷denominator with 512-bit precision.\n///\n/// @dev Credits to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv.\n///\n/// Notes:\n/// - The result is rounded toward zero.\n///\n/// Requirements:\n/// - The denominator must not be zero.\n/// - The result must fit in uint256.\n///\n/// @param x The multiplicand as a uint256.\n/// @param y The multiplier as a uint256.\n/// @param denominator The divisor as a uint256.\n/// @return result The result as a uint256.\n/// @custom:smtchecker abstract-function-nondet\nfunction mulDiv(uint256 x, uint256 y, uint256 denominator) pure returns (uint256 result) {\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; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly (\"memory-safe\") {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\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 unchecked {\n return prod0 / denominator;\n }\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n if (prod1 >= denominator) {\n revert PRBMath_MulDiv_Overflow(x, y, denominator);\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 (\"memory-safe\") {\n // Compute remainder using the mulmod Yul instruction.\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 unchecked {\n // Calculate the largest power of two divisor of the denominator using the unary operator ~. This operation cannot overflow\n // because the denominator cannot be zero at this point in the function execution. The result is always >= 1.\n // For more detail, see https://cs.stackexchange.com/q/138556/92363.\n uint256 lpotdod = denominator & (~denominator + 1);\n uint256 flippedLpotdod;\n\n assembly (\"memory-safe\") {\n // Factor powers of two out of denominator.\n denominator := div(denominator, lpotdod)\n\n // Divide [prod1 prod0] by lpotdod.\n prod0 := div(prod0, lpotdod)\n\n // Get the flipped value `2^256 / lpotdod`. If the `lpotdod` is zero, the flipped value is one.\n // `sub(0, lpotdod)` produces the two's complement version of `lpotdod`, which is equivalent to flipping all the bits.\n // However, `div` interprets this value as an unsigned value: https://ethereum.stackexchange.com/q/147168/24693\n flippedLpotdod := add(div(sub(0, lpotdod), lpotdod), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * flippedLpotdod;\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 works\n // 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 }\n}\n\n/// @notice Calculates x*y÷1e18 with 512-bit precision.\n///\n/// @dev A variant of {mulDiv} with constant folding, i.e. in which the denominator is hard coded to 1e18.\n///\n/// Notes:\n/// - The body is purposely left uncommented; to understand how this works, see the documentation in {mulDiv}.\n/// - The result is rounded toward zero.\n/// - We take as an axiom that the result cannot be `MAX_UINT256` when x and y solve the following system of equations:\n///\n/// $$\n/// \\begin{cases}\n/// x * y = MAX\\_UINT256 * UNIT \\\\\n/// (x * y) \\% UNIT \\geq \\frac{UNIT}{2}\n/// \\end{cases}\n/// $$\n///\n/// Requirements:\n/// - Refer to the requirements in {mulDiv}.\n/// - The result must fit in uint256.\n///\n/// @param x The multiplicand as an unsigned 60.18-decimal fixed-point number.\n/// @param y The multiplier as an unsigned 60.18-decimal fixed-point number.\n/// @return result The result as an unsigned 60.18-decimal fixed-point number.\n/// @custom:smtchecker abstract-function-nondet\nfunction mulDiv18(uint256 x, uint256 y) pure returns (uint256 result) {\n uint256 prod0;\n uint256 prod1;\n assembly (\"memory-safe\") {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n if (prod1 == 0) {\n unchecked {\n return prod0 / UNIT;\n }\n }\n\n if (prod1 >= UNIT) {\n revert PRBMath_MulDiv18_Overflow(x, y);\n }\n\n uint256 remainder;\n assembly (\"memory-safe\") {\n remainder := mulmod(x, y, UNIT)\n result :=\n mul(\n or(\n div(sub(prod0, remainder), UNIT_LPOTD),\n mul(sub(prod1, gt(remainder, prod0)), add(div(sub(0, UNIT_LPOTD), UNIT_LPOTD), 1))\n ),\n UNIT_INVERSE\n )\n }\n}\n\n/// @notice Calculates x*y÷denominator with 512-bit precision.\n///\n/// @dev This is an extension of {mulDiv} for signed numbers, which works by computing the signs and the absolute values separately.\n///\n/// Notes:\n/// - The result is rounded toward zero.\n///\n/// Requirements:\n/// - Refer to the requirements in {mulDiv}.\n/// - None of the inputs can be `type(int256).min`.\n/// - The result must fit in int256.\n///\n/// @param x The multiplicand as an int256.\n/// @param y The multiplier as an int256.\n/// @param denominator The divisor as an int256.\n/// @return result The result as an int256.\n/// @custom:smtchecker abstract-function-nondet\nfunction mulDivSigned(int256 x, int256 y, int256 denominator) pure returns (int256 result) {\n if (x == type(int256).min || y == type(int256).min || denominator == type(int256).min) {\n revert PRBMath_MulDivSigned_InputTooSmall();\n }\n\n // Get hold of the absolute values of x, y and the denominator.\n uint256 xAbs;\n uint256 yAbs;\n uint256 dAbs;\n unchecked {\n xAbs = x < 0 ? uint256(-x) : uint256(x);\n yAbs = y < 0 ? uint256(-y) : uint256(y);\n dAbs = denominator < 0 ? uint256(-denominator) : uint256(denominator);\n }\n\n // Compute the absolute value of x*y÷denominator. The result must fit in int256.\n uint256 resultAbs = mulDiv(xAbs, yAbs, dAbs);\n if (resultAbs > uint256(type(int256).max)) {\n revert PRBMath_MulDivSigned_Overflow(x, y);\n }\n\n // Get the signs of x, y and the denominator.\n uint256 sx;\n uint256 sy;\n uint256 sd;\n assembly (\"memory-safe\") {\n // \"sgt\" is the \"signed greater than\" assembly instruction and \"sub(0,1)\" is -1 in two's complement.\n sx := sgt(x, sub(0, 1))\n sy := sgt(y, sub(0, 1))\n sd := sgt(denominator, sub(0, 1))\n }\n\n // XOR over sx, sy and sd. What this does is to check whether there are 1 or 3 negative signs in the inputs.\n // If there are, the result should be negative. Otherwise, it should be positive.\n unchecked {\n result = sx ^ sy ^ sd == 0 ? -int256(resultAbs) : int256(resultAbs);\n }\n}\n\n/// @notice Calculates the square root of x using the Babylonian method.\n///\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\n///\n/// Notes:\n/// - If x is not a perfect square, the result is rounded down.\n/// - Credits to OpenZeppelin for the explanations in comments below.\n///\n/// @param x The uint256 number for which to calculate the square root.\n/// @return result The result as a uint256.\n/// @custom:smtchecker abstract-function-nondet\nfunction sqrt(uint256 x) pure returns (uint256 result) {\n if (x == 0) {\n return 0;\n }\n\n // For our first guess, we calculate the biggest power of 2 which is smaller than the square root of x.\n //\n // We know that the \"msb\" (most significant bit) of x is a power of 2 such that we have:\n //\n // $$\n // msb(x) <= x <= 2*msb(x)$\n // $$\n //\n // We write $msb(x)$ as $2^k$, and we get:\n //\n // $$\n // k = log_2(x)\n // $$\n //\n // Thus, we can write the initial inequality as:\n //\n // $$\n // 2^{log_2(x)} <= x <= 2*2^{log_2(x)+1} \\\\\n // sqrt(2^k) <= sqrt(x) < sqrt(2^{k+1}) \\\\\n // 2^{k/2} <= sqrt(x) < 2^{(k+1)/2} <= 2^{(k/2)+1}\n // $$\n //\n // Consequently, $2^{log_2(x) /2} is a good first approximation of sqrt(x) with at least one correct bit.\n uint256 xAux = uint256(x);\n result = 1;\n if (xAux >= 2 ** 128) {\n xAux >>= 128;\n result <<= 64;\n }\n if (xAux >= 2 ** 64) {\n xAux >>= 64;\n result <<= 32;\n }\n if (xAux >= 2 ** 32) {\n xAux >>= 32;\n result <<= 16;\n }\n if (xAux >= 2 ** 16) {\n xAux >>= 16;\n result <<= 8;\n }\n if (xAux >= 2 ** 8) {\n xAux >>= 8;\n result <<= 4;\n }\n if (xAux >= 2 ** 4) {\n xAux >>= 4;\n result <<= 2;\n }\n if (xAux >= 2 ** 2) {\n result <<= 1;\n }\n\n // At this point, `result` is an estimation with at least one bit of precision. We know the true value has at\n // most 128 bits, since it is the square root of a uint256. Newton's method converges quadratically (precision\n // doubles at every iteration). We thus need at most 7 iteration to turn our partial result with one bit of\n // precision into the expected uint128 result.\n unchecked {\n result = (result + x / result) >> 1;\n result = (result + x / result) >> 1;\n result = (result + x / result) >> 1;\n result = (result + x / result) >> 1;\n result = (result + x / result) >> 1;\n result = (result + x / result) >> 1;\n result = (result + x / result) >> 1;\n\n // If x is not a perfect square, round the result toward zero.\n uint256 roundedResult = x / result;\n if (result >= roundedResult) {\n result = roundedResult;\n }\n }\n}\n" + }, + "@prb/math/src/sd1x18/Casting.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport \"../Common.sol\" as Common;\nimport \"./Errors.sol\" as CastingErrors;\nimport { SD59x18 } from \"../sd59x18/ValueType.sol\";\nimport { UD2x18 } from \"../ud2x18/ValueType.sol\";\nimport { UD60x18 } from \"../ud60x18/ValueType.sol\";\nimport { SD1x18 } from \"./ValueType.sol\";\n\n/// @notice Casts an SD1x18 number into SD59x18.\n/// @dev There is no overflow check because the domain of SD1x18 is a subset of SD59x18.\nfunction intoSD59x18(SD1x18 x) pure returns (SD59x18 result) {\n result = SD59x18.wrap(int256(SD1x18.unwrap(x)));\n}\n\n/// @notice Casts an SD1x18 number into UD2x18.\n/// - x must be positive.\nfunction intoUD2x18(SD1x18 x) pure returns (UD2x18 result) {\n int64 xInt = SD1x18.unwrap(x);\n if (xInt < 0) {\n revert CastingErrors.PRBMath_SD1x18_ToUD2x18_Underflow(x);\n }\n result = UD2x18.wrap(uint64(xInt));\n}\n\n/// @notice Casts an SD1x18 number into UD60x18.\n/// @dev Requirements:\n/// - x must be positive.\nfunction intoUD60x18(SD1x18 x) pure returns (UD60x18 result) {\n int64 xInt = SD1x18.unwrap(x);\n if (xInt < 0) {\n revert CastingErrors.PRBMath_SD1x18_ToUD60x18_Underflow(x);\n }\n result = UD60x18.wrap(uint64(xInt));\n}\n\n/// @notice Casts an SD1x18 number into uint256.\n/// @dev Requirements:\n/// - x must be positive.\nfunction intoUint256(SD1x18 x) pure returns (uint256 result) {\n int64 xInt = SD1x18.unwrap(x);\n if (xInt < 0) {\n revert CastingErrors.PRBMath_SD1x18_ToUint256_Underflow(x);\n }\n result = uint256(uint64(xInt));\n}\n\n/// @notice Casts an SD1x18 number into uint128.\n/// @dev Requirements:\n/// - x must be positive.\nfunction intoUint128(SD1x18 x) pure returns (uint128 result) {\n int64 xInt = SD1x18.unwrap(x);\n if (xInt < 0) {\n revert CastingErrors.PRBMath_SD1x18_ToUint128_Underflow(x);\n }\n result = uint128(uint64(xInt));\n}\n\n/// @notice Casts an SD1x18 number into uint40.\n/// @dev Requirements:\n/// - x must be positive.\n/// - x must be less than or equal to `MAX_UINT40`.\nfunction intoUint40(SD1x18 x) pure returns (uint40 result) {\n int64 xInt = SD1x18.unwrap(x);\n if (xInt < 0) {\n revert CastingErrors.PRBMath_SD1x18_ToUint40_Underflow(x);\n }\n if (xInt > int64(uint64(Common.MAX_UINT40))) {\n revert CastingErrors.PRBMath_SD1x18_ToUint40_Overflow(x);\n }\n result = uint40(uint64(xInt));\n}\n\n/// @notice Alias for {wrap}.\nfunction sd1x18(int64 x) pure returns (SD1x18 result) {\n result = SD1x18.wrap(x);\n}\n\n/// @notice Unwraps an SD1x18 number into int64.\nfunction unwrap(SD1x18 x) pure returns (int64 result) {\n result = SD1x18.unwrap(x);\n}\n\n/// @notice Wraps an int64 number into SD1x18.\nfunction wrap(int64 x) pure returns (SD1x18 result) {\n result = SD1x18.wrap(x);\n}\n" + }, + "@prb/math/src/sd1x18/Constants.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport { SD1x18 } from \"./ValueType.sol\";\n\n/// @dev Euler's number as an SD1x18 number.\nSD1x18 constant E = SD1x18.wrap(2_718281828459045235);\n\n/// @dev The maximum value an SD1x18 number can have.\nint64 constant uMAX_SD1x18 = 9_223372036854775807;\nSD1x18 constant MAX_SD1x18 = SD1x18.wrap(uMAX_SD1x18);\n\n/// @dev The maximum value an SD1x18 number can have.\nint64 constant uMIN_SD1x18 = -9_223372036854775808;\nSD1x18 constant MIN_SD1x18 = SD1x18.wrap(uMIN_SD1x18);\n\n/// @dev PI as an SD1x18 number.\nSD1x18 constant PI = SD1x18.wrap(3_141592653589793238);\n\n/// @dev The unit number, which gives the decimal precision of SD1x18.\nSD1x18 constant UNIT = SD1x18.wrap(1e18);\nint64 constant uUNIT = 1e18;\n" + }, + "@prb/math/src/sd1x18/Errors.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport { SD1x18 } from \"./ValueType.sol\";\n\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in UD2x18.\nerror PRBMath_SD1x18_ToUD2x18_Underflow(SD1x18 x);\n\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in UD60x18.\nerror PRBMath_SD1x18_ToUD60x18_Underflow(SD1x18 x);\n\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint128.\nerror PRBMath_SD1x18_ToUint128_Underflow(SD1x18 x);\n\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint256.\nerror PRBMath_SD1x18_ToUint256_Underflow(SD1x18 x);\n\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint40.\nerror PRBMath_SD1x18_ToUint40_Overflow(SD1x18 x);\n\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint40.\nerror PRBMath_SD1x18_ToUint40_Underflow(SD1x18 x);\n" + }, + "@prb/math/src/sd1x18/ValueType.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport \"./Casting.sol\" as Casting;\n\n/// @notice The signed 1.18-decimal fixed-point number representation, which can have up to 1 digit and up to 18\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\n/// type int64. This is useful when end users want to use int64 to save gas, e.g. with tight variable packing in contract\n/// storage.\ntype SD1x18 is int64;\n\n/*//////////////////////////////////////////////////////////////////////////\n CASTING\n//////////////////////////////////////////////////////////////////////////*/\n\nusing {\n Casting.intoSD59x18,\n Casting.intoUD2x18,\n Casting.intoUD60x18,\n Casting.intoUint256,\n Casting.intoUint128,\n Casting.intoUint40,\n Casting.unwrap\n} for SD1x18 global;\n" + }, + "@prb/math/src/sd59x18/Casting.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport \"./Errors.sol\" as CastingErrors;\nimport { MAX_UINT128, MAX_UINT40 } from \"../Common.sol\";\nimport { uMAX_SD1x18, uMIN_SD1x18 } from \"../sd1x18/Constants.sol\";\nimport { SD1x18 } from \"../sd1x18/ValueType.sol\";\nimport { uMAX_UD2x18 } from \"../ud2x18/Constants.sol\";\nimport { UD2x18 } from \"../ud2x18/ValueType.sol\";\nimport { UD60x18 } from \"../ud60x18/ValueType.sol\";\nimport { SD59x18 } from \"./ValueType.sol\";\n\n/// @notice Casts an SD59x18 number into int256.\n/// @dev This is basically a functional alias for {unwrap}.\nfunction intoInt256(SD59x18 x) pure returns (int256 result) {\n result = SD59x18.unwrap(x);\n}\n\n/// @notice Casts an SD59x18 number into SD1x18.\n/// @dev Requirements:\n/// - x must be greater than or equal to `uMIN_SD1x18`.\n/// - x must be less than or equal to `uMAX_SD1x18`.\nfunction intoSD1x18(SD59x18 x) pure returns (SD1x18 result) {\n int256 xInt = SD59x18.unwrap(x);\n if (xInt < uMIN_SD1x18) {\n revert CastingErrors.PRBMath_SD59x18_IntoSD1x18_Underflow(x);\n }\n if (xInt > uMAX_SD1x18) {\n revert CastingErrors.PRBMath_SD59x18_IntoSD1x18_Overflow(x);\n }\n result = SD1x18.wrap(int64(xInt));\n}\n\n/// @notice Casts an SD59x18 number into UD2x18.\n/// @dev Requirements:\n/// - x must be positive.\n/// - x must be less than or equal to `uMAX_UD2x18`.\nfunction intoUD2x18(SD59x18 x) pure returns (UD2x18 result) {\n int256 xInt = SD59x18.unwrap(x);\n if (xInt < 0) {\n revert CastingErrors.PRBMath_SD59x18_IntoUD2x18_Underflow(x);\n }\n if (xInt > int256(uint256(uMAX_UD2x18))) {\n revert CastingErrors.PRBMath_SD59x18_IntoUD2x18_Overflow(x);\n }\n result = UD2x18.wrap(uint64(uint256(xInt)));\n}\n\n/// @notice Casts an SD59x18 number into UD60x18.\n/// @dev Requirements:\n/// - x must be positive.\nfunction intoUD60x18(SD59x18 x) pure returns (UD60x18 result) {\n int256 xInt = SD59x18.unwrap(x);\n if (xInt < 0) {\n revert CastingErrors.PRBMath_SD59x18_IntoUD60x18_Underflow(x);\n }\n result = UD60x18.wrap(uint256(xInt));\n}\n\n/// @notice Casts an SD59x18 number into uint256.\n/// @dev Requirements:\n/// - x must be positive.\nfunction intoUint256(SD59x18 x) pure returns (uint256 result) {\n int256 xInt = SD59x18.unwrap(x);\n if (xInt < 0) {\n revert CastingErrors.PRBMath_SD59x18_IntoUint256_Underflow(x);\n }\n result = uint256(xInt);\n}\n\n/// @notice Casts an SD59x18 number into uint128.\n/// @dev Requirements:\n/// - x must be positive.\n/// - x must be less than or equal to `uMAX_UINT128`.\nfunction intoUint128(SD59x18 x) pure returns (uint128 result) {\n int256 xInt = SD59x18.unwrap(x);\n if (xInt < 0) {\n revert CastingErrors.PRBMath_SD59x18_IntoUint128_Underflow(x);\n }\n if (xInt > int256(uint256(MAX_UINT128))) {\n revert CastingErrors.PRBMath_SD59x18_IntoUint128_Overflow(x);\n }\n result = uint128(uint256(xInt));\n}\n\n/// @notice Casts an SD59x18 number into uint40.\n/// @dev Requirements:\n/// - x must be positive.\n/// - x must be less than or equal to `MAX_UINT40`.\nfunction intoUint40(SD59x18 x) pure returns (uint40 result) {\n int256 xInt = SD59x18.unwrap(x);\n if (xInt < 0) {\n revert CastingErrors.PRBMath_SD59x18_IntoUint40_Underflow(x);\n }\n if (xInt > int256(uint256(MAX_UINT40))) {\n revert CastingErrors.PRBMath_SD59x18_IntoUint40_Overflow(x);\n }\n result = uint40(uint256(xInt));\n}\n\n/// @notice Alias for {wrap}.\nfunction sd(int256 x) pure returns (SD59x18 result) {\n result = SD59x18.wrap(x);\n}\n\n/// @notice Alias for {wrap}.\nfunction sd59x18(int256 x) pure returns (SD59x18 result) {\n result = SD59x18.wrap(x);\n}\n\n/// @notice Unwraps an SD59x18 number into int256.\nfunction unwrap(SD59x18 x) pure returns (int256 result) {\n result = SD59x18.unwrap(x);\n}\n\n/// @notice Wraps an int256 number into SD59x18.\nfunction wrap(int256 x) pure returns (SD59x18 result) {\n result = SD59x18.wrap(x);\n}\n" + }, + "@prb/math/src/sd59x18/Constants.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport { SD59x18 } from \"./ValueType.sol\";\n\n// NOTICE: the \"u\" prefix stands for \"unwrapped\".\n\n/// @dev Euler's number as an SD59x18 number.\nSD59x18 constant E = SD59x18.wrap(2_718281828459045235);\n\n/// @dev The maximum input permitted in {exp}.\nint256 constant uEXP_MAX_INPUT = 133_084258667509499440;\nSD59x18 constant EXP_MAX_INPUT = SD59x18.wrap(uEXP_MAX_INPUT);\n\n/// @dev Any value less than this returns 0 in {exp}.\nint256 constant uEXP_MIN_THRESHOLD = -41_446531673892822322;\nSD59x18 constant EXP_MIN_THRESHOLD = SD59x18.wrap(uEXP_MIN_THRESHOLD);\n\n/// @dev The maximum input permitted in {exp2}.\nint256 constant uEXP2_MAX_INPUT = 192e18 - 1;\nSD59x18 constant EXP2_MAX_INPUT = SD59x18.wrap(uEXP2_MAX_INPUT);\n\n/// @dev Any value less than this returns 0 in {exp2}.\nint256 constant uEXP2_MIN_THRESHOLD = -59_794705707972522261;\nSD59x18 constant EXP2_MIN_THRESHOLD = SD59x18.wrap(uEXP2_MIN_THRESHOLD);\n\n/// @dev Half the UNIT number.\nint256 constant uHALF_UNIT = 0.5e18;\nSD59x18 constant HALF_UNIT = SD59x18.wrap(uHALF_UNIT);\n\n/// @dev $log_2(10)$ as an SD59x18 number.\nint256 constant uLOG2_10 = 3_321928094887362347;\nSD59x18 constant LOG2_10 = SD59x18.wrap(uLOG2_10);\n\n/// @dev $log_2(e)$ as an SD59x18 number.\nint256 constant uLOG2_E = 1_442695040888963407;\nSD59x18 constant LOG2_E = SD59x18.wrap(uLOG2_E);\n\n/// @dev The maximum value an SD59x18 number can have.\nint256 constant uMAX_SD59x18 = 57896044618658097711785492504343953926634992332820282019728_792003956564819967;\nSD59x18 constant MAX_SD59x18 = SD59x18.wrap(uMAX_SD59x18);\n\n/// @dev The maximum whole value an SD59x18 number can have.\nint256 constant uMAX_WHOLE_SD59x18 = 57896044618658097711785492504343953926634992332820282019728_000000000000000000;\nSD59x18 constant MAX_WHOLE_SD59x18 = SD59x18.wrap(uMAX_WHOLE_SD59x18);\n\n/// @dev The minimum value an SD59x18 number can have.\nint256 constant uMIN_SD59x18 = -57896044618658097711785492504343953926634992332820282019728_792003956564819968;\nSD59x18 constant MIN_SD59x18 = SD59x18.wrap(uMIN_SD59x18);\n\n/// @dev The minimum whole value an SD59x18 number can have.\nint256 constant uMIN_WHOLE_SD59x18 = -57896044618658097711785492504343953926634992332820282019728_000000000000000000;\nSD59x18 constant MIN_WHOLE_SD59x18 = SD59x18.wrap(uMIN_WHOLE_SD59x18);\n\n/// @dev PI as an SD59x18 number.\nSD59x18 constant PI = SD59x18.wrap(3_141592653589793238);\n\n/// @dev The unit number, which gives the decimal precision of SD59x18.\nint256 constant uUNIT = 1e18;\nSD59x18 constant UNIT = SD59x18.wrap(1e18);\n\n/// @dev The unit number squared.\nint256 constant uUNIT_SQUARED = 1e36;\nSD59x18 constant UNIT_SQUARED = SD59x18.wrap(uUNIT_SQUARED);\n\n/// @dev Zero as an SD59x18 number.\nSD59x18 constant ZERO = SD59x18.wrap(0);\n" + }, + "@prb/math/src/sd59x18/Errors.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport { SD59x18 } from \"./ValueType.sol\";\n\n/// @notice Thrown when taking the absolute value of `MIN_SD59x18`.\nerror PRBMath_SD59x18_Abs_MinSD59x18();\n\n/// @notice Thrown when ceiling a number overflows SD59x18.\nerror PRBMath_SD59x18_Ceil_Overflow(SD59x18 x);\n\n/// @notice Thrown when converting a basic integer to the fixed-point format overflows SD59x18.\nerror PRBMath_SD59x18_Convert_Overflow(int256 x);\n\n/// @notice Thrown when converting a basic integer to the fixed-point format underflows SD59x18.\nerror PRBMath_SD59x18_Convert_Underflow(int256 x);\n\n/// @notice Thrown when dividing two numbers and one of them is `MIN_SD59x18`.\nerror PRBMath_SD59x18_Div_InputTooSmall();\n\n/// @notice Thrown when dividing two numbers and one of the intermediary unsigned results overflows SD59x18.\nerror PRBMath_SD59x18_Div_Overflow(SD59x18 x, SD59x18 y);\n\n/// @notice Thrown when taking the natural exponent of a base greater than 133_084258667509499441.\nerror PRBMath_SD59x18_Exp_InputTooBig(SD59x18 x);\n\n/// @notice Thrown when taking the binary exponent of a base greater than 192e18.\nerror PRBMath_SD59x18_Exp2_InputTooBig(SD59x18 x);\n\n/// @notice Thrown when flooring a number underflows SD59x18.\nerror PRBMath_SD59x18_Floor_Underflow(SD59x18 x);\n\n/// @notice Thrown when taking the geometric mean of two numbers and their product is negative.\nerror PRBMath_SD59x18_Gm_NegativeProduct(SD59x18 x, SD59x18 y);\n\n/// @notice Thrown when taking the geometric mean of two numbers and multiplying them overflows SD59x18.\nerror PRBMath_SD59x18_Gm_Overflow(SD59x18 x, SD59x18 y);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\nerror PRBMath_SD59x18_IntoSD1x18_Overflow(SD59x18 x);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\nerror PRBMath_SD59x18_IntoSD1x18_Underflow(SD59x18 x);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\nerror PRBMath_SD59x18_IntoUD2x18_Overflow(SD59x18 x);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\nerror PRBMath_SD59x18_IntoUD2x18_Underflow(SD59x18 x);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD60x18.\nerror PRBMath_SD59x18_IntoUD60x18_Underflow(SD59x18 x);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\nerror PRBMath_SD59x18_IntoUint128_Overflow(SD59x18 x);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\nerror PRBMath_SD59x18_IntoUint128_Underflow(SD59x18 x);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint256.\nerror PRBMath_SD59x18_IntoUint256_Underflow(SD59x18 x);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\nerror PRBMath_SD59x18_IntoUint40_Overflow(SD59x18 x);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\nerror PRBMath_SD59x18_IntoUint40_Underflow(SD59x18 x);\n\n/// @notice Thrown when taking the logarithm of a number less than or equal to zero.\nerror PRBMath_SD59x18_Log_InputTooSmall(SD59x18 x);\n\n/// @notice Thrown when multiplying two numbers and one of the inputs is `MIN_SD59x18`.\nerror PRBMath_SD59x18_Mul_InputTooSmall();\n\n/// @notice Thrown when multiplying two numbers and the intermediary absolute result overflows SD59x18.\nerror PRBMath_SD59x18_Mul_Overflow(SD59x18 x, SD59x18 y);\n\n/// @notice Thrown when raising a number to a power and the intermediary absolute result overflows SD59x18.\nerror PRBMath_SD59x18_Powu_Overflow(SD59x18 x, uint256 y);\n\n/// @notice Thrown when taking the square root of a negative number.\nerror PRBMath_SD59x18_Sqrt_NegativeInput(SD59x18 x);\n\n/// @notice Thrown when the calculating the square root overflows SD59x18.\nerror PRBMath_SD59x18_Sqrt_Overflow(SD59x18 x);\n" + }, + "@prb/math/src/sd59x18/Helpers.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport { wrap } from \"./Casting.sol\";\nimport { SD59x18 } from \"./ValueType.sol\";\n\n/// @notice Implements the checked addition operation (+) in the SD59x18 type.\nfunction add(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\n return wrap(x.unwrap() + y.unwrap());\n}\n\n/// @notice Implements the AND (&) bitwise operation in the SD59x18 type.\nfunction and(SD59x18 x, int256 bits) pure returns (SD59x18 result) {\n return wrap(x.unwrap() & bits);\n}\n\n/// @notice Implements the AND (&) bitwise operation in the SD59x18 type.\nfunction and2(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\n return wrap(x.unwrap() & y.unwrap());\n}\n\n/// @notice Implements the equal (=) operation in the SD59x18 type.\nfunction eq(SD59x18 x, SD59x18 y) pure returns (bool result) {\n result = x.unwrap() == y.unwrap();\n}\n\n/// @notice Implements the greater than operation (>) in the SD59x18 type.\nfunction gt(SD59x18 x, SD59x18 y) pure returns (bool result) {\n result = x.unwrap() > y.unwrap();\n}\n\n/// @notice Implements the greater than or equal to operation (>=) in the SD59x18 type.\nfunction gte(SD59x18 x, SD59x18 y) pure returns (bool result) {\n result = x.unwrap() >= y.unwrap();\n}\n\n/// @notice Implements a zero comparison check function in the SD59x18 type.\nfunction isZero(SD59x18 x) pure returns (bool result) {\n result = x.unwrap() == 0;\n}\n\n/// @notice Implements the left shift operation (<<) in the SD59x18 type.\nfunction lshift(SD59x18 x, uint256 bits) pure returns (SD59x18 result) {\n result = wrap(x.unwrap() << bits);\n}\n\n/// @notice Implements the lower than operation (<) in the SD59x18 type.\nfunction lt(SD59x18 x, SD59x18 y) pure returns (bool result) {\n result = x.unwrap() < y.unwrap();\n}\n\n/// @notice Implements the lower than or equal to operation (<=) in the SD59x18 type.\nfunction lte(SD59x18 x, SD59x18 y) pure returns (bool result) {\n result = x.unwrap() <= y.unwrap();\n}\n\n/// @notice Implements the unchecked modulo operation (%) in the SD59x18 type.\nfunction mod(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\n result = wrap(x.unwrap() % y.unwrap());\n}\n\n/// @notice Implements the not equal operation (!=) in the SD59x18 type.\nfunction neq(SD59x18 x, SD59x18 y) pure returns (bool result) {\n result = x.unwrap() != y.unwrap();\n}\n\n/// @notice Implements the NOT (~) bitwise operation in the SD59x18 type.\nfunction not(SD59x18 x) pure returns (SD59x18 result) {\n result = wrap(~x.unwrap());\n}\n\n/// @notice Implements the OR (|) bitwise operation in the SD59x18 type.\nfunction or(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\n result = wrap(x.unwrap() | y.unwrap());\n}\n\n/// @notice Implements the right shift operation (>>) in the SD59x18 type.\nfunction rshift(SD59x18 x, uint256 bits) pure returns (SD59x18 result) {\n result = wrap(x.unwrap() >> bits);\n}\n\n/// @notice Implements the checked subtraction operation (-) in the SD59x18 type.\nfunction sub(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\n result = wrap(x.unwrap() - y.unwrap());\n}\n\n/// @notice Implements the checked unary minus operation (-) in the SD59x18 type.\nfunction unary(SD59x18 x) pure returns (SD59x18 result) {\n result = wrap(-x.unwrap());\n}\n\n/// @notice Implements the unchecked addition operation (+) in the SD59x18 type.\nfunction uncheckedAdd(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\n unchecked {\n result = wrap(x.unwrap() + y.unwrap());\n }\n}\n\n/// @notice Implements the unchecked subtraction operation (-) in the SD59x18 type.\nfunction uncheckedSub(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\n unchecked {\n result = wrap(x.unwrap() - y.unwrap());\n }\n}\n\n/// @notice Implements the unchecked unary minus operation (-) in the SD59x18 type.\nfunction uncheckedUnary(SD59x18 x) pure returns (SD59x18 result) {\n unchecked {\n result = wrap(-x.unwrap());\n }\n}\n\n/// @notice Implements the XOR (^) bitwise operation in the SD59x18 type.\nfunction xor(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\n result = wrap(x.unwrap() ^ y.unwrap());\n}\n" + }, + "@prb/math/src/sd59x18/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport \"../Common.sol\" as Common;\nimport \"./Errors.sol\" as Errors;\nimport {\n uEXP_MAX_INPUT,\n uEXP2_MAX_INPUT,\n uEXP_MIN_THRESHOLD,\n uEXP2_MIN_THRESHOLD,\n uHALF_UNIT,\n uLOG2_10,\n uLOG2_E,\n uMAX_SD59x18,\n uMAX_WHOLE_SD59x18,\n uMIN_SD59x18,\n uMIN_WHOLE_SD59x18,\n UNIT,\n uUNIT,\n uUNIT_SQUARED,\n ZERO\n} from \"./Constants.sol\";\nimport { wrap } from \"./Helpers.sol\";\nimport { SD59x18 } from \"./ValueType.sol\";\n\n/// @notice Calculates the absolute value of x.\n///\n/// @dev Requirements:\n/// - x must be greater than `MIN_SD59x18`.\n///\n/// @param x The SD59x18 number for which to calculate the absolute value.\n/// @param result The absolute value of x as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction abs(SD59x18 x) pure returns (SD59x18 result) {\n int256 xInt = x.unwrap();\n if (xInt == uMIN_SD59x18) {\n revert Errors.PRBMath_SD59x18_Abs_MinSD59x18();\n }\n result = xInt < 0 ? wrap(-xInt) : x;\n}\n\n/// @notice Calculates the arithmetic average of x and y.\n///\n/// @dev Notes:\n/// - The result is rounded toward zero.\n///\n/// @param x The first operand as an SD59x18 number.\n/// @param y The second operand as an SD59x18 number.\n/// @return result The arithmetic average as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction avg(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\n int256 xInt = x.unwrap();\n int256 yInt = y.unwrap();\n\n unchecked {\n // This operation is equivalent to `x / 2 + y / 2`, and it can never overflow.\n int256 sum = (xInt >> 1) + (yInt >> 1);\n\n if (sum < 0) {\n // If at least one of x and y is odd, add 1 to the result, because shifting negative numbers to the right\n // rounds toward negative infinity. The right part is equivalent to `sum + (x % 2 == 1 || y % 2 == 1)`.\n assembly (\"memory-safe\") {\n result := add(sum, and(or(xInt, yInt), 1))\n }\n } else {\n // Add 1 if both x and y are odd to account for the double 0.5 remainder truncated after shifting.\n result = wrap(sum + (xInt & yInt & 1));\n }\n }\n}\n\n/// @notice Yields the smallest whole number greater than or equal to x.\n///\n/// @dev Optimized for fractional value inputs, because every whole value has (1e18 - 1) fractional counterparts.\n/// See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\n///\n/// Requirements:\n/// - x must be less than or equal to `MAX_WHOLE_SD59x18`.\n///\n/// @param x The SD59x18 number to ceil.\n/// @param result The smallest whole number greater than or equal to x, as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction ceil(SD59x18 x) pure returns (SD59x18 result) {\n int256 xInt = x.unwrap();\n if (xInt > uMAX_WHOLE_SD59x18) {\n revert Errors.PRBMath_SD59x18_Ceil_Overflow(x);\n }\n\n int256 remainder = xInt % uUNIT;\n if (remainder == 0) {\n result = x;\n } else {\n unchecked {\n // Solidity uses C fmod style, which returns a modulus with the same sign as x.\n int256 resultInt = xInt - remainder;\n if (xInt > 0) {\n resultInt += uUNIT;\n }\n result = wrap(resultInt);\n }\n }\n}\n\n/// @notice Divides two SD59x18 numbers, returning a new SD59x18 number.\n///\n/// @dev This is an extension of {Common.mulDiv} for signed numbers, which works by computing the signs and the absolute\n/// values separately.\n///\n/// Notes:\n/// - Refer to the notes in {Common.mulDiv}.\n/// - The result is rounded toward zero.\n///\n/// Requirements:\n/// - Refer to the requirements in {Common.mulDiv}.\n/// - None of the inputs can be `MIN_SD59x18`.\n/// - The denominator must not be zero.\n/// - The result must fit in SD59x18.\n///\n/// @param x The numerator as an SD59x18 number.\n/// @param y The denominator as an SD59x18 number.\n/// @param result The quotient as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction div(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\n int256 xInt = x.unwrap();\n int256 yInt = y.unwrap();\n if (xInt == uMIN_SD59x18 || yInt == uMIN_SD59x18) {\n revert Errors.PRBMath_SD59x18_Div_InputTooSmall();\n }\n\n // Get hold of the absolute values of x and y.\n uint256 xAbs;\n uint256 yAbs;\n unchecked {\n xAbs = xInt < 0 ? uint256(-xInt) : uint256(xInt);\n yAbs = yInt < 0 ? uint256(-yInt) : uint256(yInt);\n }\n\n // Compute the absolute value (x*UNIT÷y). The resulting value must fit in SD59x18.\n uint256 resultAbs = Common.mulDiv(xAbs, uint256(uUNIT), yAbs);\n if (resultAbs > uint256(uMAX_SD59x18)) {\n revert Errors.PRBMath_SD59x18_Div_Overflow(x, y);\n }\n\n // Check if x and y have the same sign using two's complement representation. The left-most bit represents the sign (1 for\n // negative, 0 for positive or zero).\n bool sameSign = (xInt ^ yInt) > -1;\n\n // If the inputs have the same sign, the result should be positive. Otherwise, it should be negative.\n unchecked {\n result = wrap(sameSign ? int256(resultAbs) : -int256(resultAbs));\n }\n}\n\n/// @notice Calculates the natural exponent of x using the following formula:\n///\n/// $$\n/// e^x = 2^{x * log_2{e}}\n/// $$\n///\n/// @dev Notes:\n/// - Refer to the notes in {exp2}.\n///\n/// Requirements:\n/// - Refer to the requirements in {exp2}.\n/// - x must be less than 133_084258667509499441.\n///\n/// @param x The exponent as an SD59x18 number.\n/// @return result The result as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction exp(SD59x18 x) pure returns (SD59x18 result) {\n int256 xInt = x.unwrap();\n\n // Any input less than the threshold returns zero.\n // This check also prevents an overflow for very small numbers.\n if (xInt < uEXP_MIN_THRESHOLD) {\n return ZERO;\n }\n\n // This check prevents values greater than 192e18 from being passed to {exp2}.\n if (xInt > uEXP_MAX_INPUT) {\n revert Errors.PRBMath_SD59x18_Exp_InputTooBig(x);\n }\n\n unchecked {\n // Inline the fixed-point multiplication to save gas.\n int256 doubleUnitProduct = xInt * uLOG2_E;\n result = exp2(wrap(doubleUnitProduct / uUNIT));\n }\n}\n\n/// @notice Calculates the binary exponent of x using the binary fraction method using the following formula:\n///\n/// $$\n/// 2^{-x} = \\frac{1}{2^x}\n/// $$\n///\n/// @dev See https://ethereum.stackexchange.com/q/79903/24693.\n///\n/// Notes:\n/// - If x is less than -59_794705707972522261, the result is zero.\n///\n/// Requirements:\n/// - x must be less than 192e18.\n/// - The result must fit in SD59x18.\n///\n/// @param x The exponent as an SD59x18 number.\n/// @return result The result as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction exp2(SD59x18 x) pure returns (SD59x18 result) {\n int256 xInt = x.unwrap();\n if (xInt < 0) {\n // The inverse of any number less than the threshold is truncated to zero.\n if (xInt < uEXP2_MIN_THRESHOLD) {\n return ZERO;\n }\n\n unchecked {\n // Inline the fixed-point inversion to save gas.\n result = wrap(uUNIT_SQUARED / exp2(wrap(-xInt)).unwrap());\n }\n } else {\n // Numbers greater than or equal to 192e18 don't fit in the 192.64-bit format.\n if (xInt > uEXP2_MAX_INPUT) {\n revert Errors.PRBMath_SD59x18_Exp2_InputTooBig(x);\n }\n\n unchecked {\n // Convert x to the 192.64-bit fixed-point format.\n uint256 x_192x64 = uint256((xInt << 64) / uUNIT);\n\n // It is safe to cast the result to int256 due to the checks above.\n result = wrap(int256(Common.exp2(x_192x64)));\n }\n }\n}\n\n/// @notice Yields the greatest whole number less than or equal to x.\n///\n/// @dev Optimized for fractional value inputs, because for every whole value there are (1e18 - 1) fractional\n/// counterparts. See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\n///\n/// Requirements:\n/// - x must be greater than or equal to `MIN_WHOLE_SD59x18`.\n///\n/// @param x The SD59x18 number to floor.\n/// @param result The greatest whole number less than or equal to x, as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction floor(SD59x18 x) pure returns (SD59x18 result) {\n int256 xInt = x.unwrap();\n if (xInt < uMIN_WHOLE_SD59x18) {\n revert Errors.PRBMath_SD59x18_Floor_Underflow(x);\n }\n\n int256 remainder = xInt % uUNIT;\n if (remainder == 0) {\n result = x;\n } else {\n unchecked {\n // Solidity uses C fmod style, which returns a modulus with the same sign as x.\n int256 resultInt = xInt - remainder;\n if (xInt < 0) {\n resultInt -= uUNIT;\n }\n result = wrap(resultInt);\n }\n }\n}\n\n/// @notice Yields the excess beyond the floor of x for positive numbers and the part of the number to the right.\n/// of the radix point for negative numbers.\n/// @dev Based on the odd function definition. https://en.wikipedia.org/wiki/Fractional_part\n/// @param x The SD59x18 number to get the fractional part of.\n/// @param result The fractional part of x as an SD59x18 number.\nfunction frac(SD59x18 x) pure returns (SD59x18 result) {\n result = wrap(x.unwrap() % uUNIT);\n}\n\n/// @notice Calculates the geometric mean of x and y, i.e. $\\sqrt{x * y}$.\n///\n/// @dev Notes:\n/// - The result is rounded toward zero.\n///\n/// Requirements:\n/// - x * y must fit in SD59x18.\n/// - x * y must not be negative, since complex numbers are not supported.\n///\n/// @param x The first operand as an SD59x18 number.\n/// @param y The second operand as an SD59x18 number.\n/// @return result The result as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction gm(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\n int256 xInt = x.unwrap();\n int256 yInt = y.unwrap();\n if (xInt == 0 || yInt == 0) {\n return ZERO;\n }\n\n unchecked {\n // Equivalent to `xy / x != y`. Checking for overflow this way is faster than letting Solidity do it.\n int256 xyInt = xInt * yInt;\n if (xyInt / xInt != yInt) {\n revert Errors.PRBMath_SD59x18_Gm_Overflow(x, y);\n }\n\n // The product must not be negative, since complex numbers are not supported.\n if (xyInt < 0) {\n revert Errors.PRBMath_SD59x18_Gm_NegativeProduct(x, y);\n }\n\n // We don't need to multiply the result by `UNIT` here because the x*y product picked up a factor of `UNIT`\n // during multiplication. See the comments in {Common.sqrt}.\n uint256 resultUint = Common.sqrt(uint256(xyInt));\n result = wrap(int256(resultUint));\n }\n}\n\n/// @notice Calculates the inverse of x.\n///\n/// @dev Notes:\n/// - The result is rounded toward zero.\n///\n/// Requirements:\n/// - x must not be zero.\n///\n/// @param x The SD59x18 number for which to calculate the inverse.\n/// @return result The inverse as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction inv(SD59x18 x) pure returns (SD59x18 result) {\n result = wrap(uUNIT_SQUARED / x.unwrap());\n}\n\n/// @notice Calculates the natural logarithm of x using the following formula:\n///\n/// $$\n/// ln{x} = log_2{x} / log_2{e}\n/// $$\n///\n/// @dev Notes:\n/// - Refer to the notes in {log2}.\n/// - The precision isn't sufficiently fine-grained to return exactly `UNIT` when the input is `E`.\n///\n/// Requirements:\n/// - Refer to the requirements in {log2}.\n///\n/// @param x The SD59x18 number for which to calculate the natural logarithm.\n/// @return result The natural logarithm as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction ln(SD59x18 x) pure returns (SD59x18 result) {\n // Inline the fixed-point multiplication to save gas. This is overflow-safe because the maximum value that\n // {log2} can return is ~195_205294292027477728.\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_E);\n}\n\n/// @notice Calculates the common logarithm of x using the following formula:\n///\n/// $$\n/// log_{10}{x} = log_2{x} / log_2{10}\n/// $$\n///\n/// However, if x is an exact power of ten, a hard coded value is returned.\n///\n/// @dev Notes:\n/// - Refer to the notes in {log2}.\n///\n/// Requirements:\n/// - Refer to the requirements in {log2}.\n///\n/// @param x The SD59x18 number for which to calculate the common logarithm.\n/// @return result The common logarithm as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction log10(SD59x18 x) pure returns (SD59x18 result) {\n int256 xInt = x.unwrap();\n if (xInt < 0) {\n revert Errors.PRBMath_SD59x18_Log_InputTooSmall(x);\n }\n\n // Note that the `mul` in this block is the standard multiplication operation, not {SD59x18.mul}.\n // prettier-ignore\n assembly (\"memory-safe\") {\n switch x\n case 1 { result := mul(uUNIT, sub(0, 18)) }\n case 10 { result := mul(uUNIT, sub(1, 18)) }\n case 100 { result := mul(uUNIT, sub(2, 18)) }\n case 1000 { result := mul(uUNIT, sub(3, 18)) }\n case 10000 { result := mul(uUNIT, sub(4, 18)) }\n case 100000 { result := mul(uUNIT, sub(5, 18)) }\n case 1000000 { result := mul(uUNIT, sub(6, 18)) }\n case 10000000 { result := mul(uUNIT, sub(7, 18)) }\n case 100000000 { result := mul(uUNIT, sub(8, 18)) }\n case 1000000000 { result := mul(uUNIT, sub(9, 18)) }\n case 10000000000 { result := mul(uUNIT, sub(10, 18)) }\n case 100000000000 { result := mul(uUNIT, sub(11, 18)) }\n case 1000000000000 { result := mul(uUNIT, sub(12, 18)) }\n case 10000000000000 { result := mul(uUNIT, sub(13, 18)) }\n case 100000000000000 { result := mul(uUNIT, sub(14, 18)) }\n case 1000000000000000 { result := mul(uUNIT, sub(15, 18)) }\n case 10000000000000000 { result := mul(uUNIT, sub(16, 18)) }\n case 100000000000000000 { result := mul(uUNIT, sub(17, 18)) }\n case 1000000000000000000 { result := 0 }\n case 10000000000000000000 { result := uUNIT }\n case 100000000000000000000 { result := mul(uUNIT, 2) }\n case 1000000000000000000000 { result := mul(uUNIT, 3) }\n case 10000000000000000000000 { result := mul(uUNIT, 4) }\n case 100000000000000000000000 { result := mul(uUNIT, 5) }\n case 1000000000000000000000000 { result := mul(uUNIT, 6) }\n case 10000000000000000000000000 { result := mul(uUNIT, 7) }\n case 100000000000000000000000000 { result := mul(uUNIT, 8) }\n case 1000000000000000000000000000 { result := mul(uUNIT, 9) }\n case 10000000000000000000000000000 { result := mul(uUNIT, 10) }\n case 100000000000000000000000000000 { result := mul(uUNIT, 11) }\n case 1000000000000000000000000000000 { result := mul(uUNIT, 12) }\n case 10000000000000000000000000000000 { result := mul(uUNIT, 13) }\n case 100000000000000000000000000000000 { result := mul(uUNIT, 14) }\n case 1000000000000000000000000000000000 { result := mul(uUNIT, 15) }\n case 10000000000000000000000000000000000 { result := mul(uUNIT, 16) }\n case 100000000000000000000000000000000000 { result := mul(uUNIT, 17) }\n case 1000000000000000000000000000000000000 { result := mul(uUNIT, 18) }\n case 10000000000000000000000000000000000000 { result := mul(uUNIT, 19) }\n case 100000000000000000000000000000000000000 { result := mul(uUNIT, 20) }\n case 1000000000000000000000000000000000000000 { result := mul(uUNIT, 21) }\n case 10000000000000000000000000000000000000000 { result := mul(uUNIT, 22) }\n case 100000000000000000000000000000000000000000 { result := mul(uUNIT, 23) }\n case 1000000000000000000000000000000000000000000 { result := mul(uUNIT, 24) }\n case 10000000000000000000000000000000000000000000 { result := mul(uUNIT, 25) }\n case 100000000000000000000000000000000000000000000 { result := mul(uUNIT, 26) }\n case 1000000000000000000000000000000000000000000000 { result := mul(uUNIT, 27) }\n case 10000000000000000000000000000000000000000000000 { result := mul(uUNIT, 28) }\n case 100000000000000000000000000000000000000000000000 { result := mul(uUNIT, 29) }\n case 1000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 30) }\n case 10000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 31) }\n case 100000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 32) }\n case 1000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 33) }\n case 10000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 34) }\n case 100000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 35) }\n case 1000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 36) }\n case 10000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 37) }\n case 100000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 38) }\n case 1000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 39) }\n case 10000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 40) }\n case 100000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 41) }\n case 1000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 42) }\n case 10000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 43) }\n case 100000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 44) }\n case 1000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 45) }\n case 10000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 46) }\n case 100000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 47) }\n case 1000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 48) }\n case 10000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 49) }\n case 100000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 50) }\n case 1000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 51) }\n case 10000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 52) }\n case 100000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 53) }\n case 1000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 54) }\n case 10000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 55) }\n case 100000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 56) }\n case 1000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 57) }\n case 10000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 58) }\n default { result := uMAX_SD59x18 }\n }\n\n if (result.unwrap() == uMAX_SD59x18) {\n unchecked {\n // Inline the fixed-point division to save gas.\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_10);\n }\n }\n}\n\n/// @notice Calculates the binary logarithm of x using the iterative approximation algorithm:\n///\n/// $$\n/// log_2{x} = n + log_2{y}, \\text{ where } y = x*2^{-n}, \\ y \\in [1, 2)\n/// $$\n///\n/// For $0 \\leq x \\lt 1$, the input is inverted:\n///\n/// $$\n/// log_2{x} = -log_2{\\frac{1}{x}}\n/// $$\n///\n/// @dev See https://en.wikipedia.org/wiki/Binary_logarithm#Iterative_approximation.\n///\n/// Notes:\n/// - Due to the lossy precision of the iterative approximation, the results are not perfectly accurate to the last decimal.\n///\n/// Requirements:\n/// - x must be greater than zero.\n///\n/// @param x The SD59x18 number for which to calculate the binary logarithm.\n/// @return result The binary logarithm as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction log2(SD59x18 x) pure returns (SD59x18 result) {\n int256 xInt = x.unwrap();\n if (xInt <= 0) {\n revert Errors.PRBMath_SD59x18_Log_InputTooSmall(x);\n }\n\n unchecked {\n int256 sign;\n if (xInt >= uUNIT) {\n sign = 1;\n } else {\n sign = -1;\n // Inline the fixed-point inversion to save gas.\n xInt = uUNIT_SQUARED / xInt;\n }\n\n // Calculate the integer part of the logarithm.\n uint256 n = Common.msb(uint256(xInt / uUNIT));\n\n // This is the integer part of the logarithm as an SD59x18 number. The operation can't overflow\n // because n is at most 255, `UNIT` is 1e18, and the sign is either 1 or -1.\n int256 resultInt = int256(n) * uUNIT;\n\n // Calculate $y = x * 2^{-n}$.\n int256 y = xInt >> n;\n\n // If y is the unit number, the fractional part is zero.\n if (y == uUNIT) {\n return wrap(resultInt * sign);\n }\n\n // Calculate the fractional part via the iterative approximation.\n // The `delta >>= 1` part is equivalent to `delta /= 2`, but shifting bits is more gas efficient.\n int256 DOUBLE_UNIT = 2e18;\n for (int256 delta = uHALF_UNIT; delta > 0; delta >>= 1) {\n y = (y * y) / uUNIT;\n\n // Is y^2 >= 2e18 and so in the range [2e18, 4e18)?\n if (y >= DOUBLE_UNIT) {\n // Add the 2^{-m} factor to the logarithm.\n resultInt = resultInt + delta;\n\n // Halve y, which corresponds to z/2 in the Wikipedia article.\n y >>= 1;\n }\n }\n resultInt *= sign;\n result = wrap(resultInt);\n }\n}\n\n/// @notice Multiplies two SD59x18 numbers together, returning a new SD59x18 number.\n///\n/// @dev Notes:\n/// - Refer to the notes in {Common.mulDiv18}.\n///\n/// Requirements:\n/// - Refer to the requirements in {Common.mulDiv18}.\n/// - None of the inputs can be `MIN_SD59x18`.\n/// - The result must fit in SD59x18.\n///\n/// @param x The multiplicand as an SD59x18 number.\n/// @param y The multiplier as an SD59x18 number.\n/// @return result The product as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction mul(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\n int256 xInt = x.unwrap();\n int256 yInt = y.unwrap();\n if (xInt == uMIN_SD59x18 || yInt == uMIN_SD59x18) {\n revert Errors.PRBMath_SD59x18_Mul_InputTooSmall();\n }\n\n // Get hold of the absolute values of x and y.\n uint256 xAbs;\n uint256 yAbs;\n unchecked {\n xAbs = xInt < 0 ? uint256(-xInt) : uint256(xInt);\n yAbs = yInt < 0 ? uint256(-yInt) : uint256(yInt);\n }\n\n // Compute the absolute value (x*y÷UNIT). The resulting value must fit in SD59x18.\n uint256 resultAbs = Common.mulDiv18(xAbs, yAbs);\n if (resultAbs > uint256(uMAX_SD59x18)) {\n revert Errors.PRBMath_SD59x18_Mul_Overflow(x, y);\n }\n\n // Check if x and y have the same sign using two's complement representation. The left-most bit represents the sign (1 for\n // negative, 0 for positive or zero).\n bool sameSign = (xInt ^ yInt) > -1;\n\n // If the inputs have the same sign, the result should be positive. Otherwise, it should be negative.\n unchecked {\n result = wrap(sameSign ? int256(resultAbs) : -int256(resultAbs));\n }\n}\n\n/// @notice Raises x to the power of y using the following formula:\n///\n/// $$\n/// x^y = 2^{log_2{x} * y}\n/// $$\n///\n/// @dev Notes:\n/// - Refer to the notes in {exp2}, {log2}, and {mul}.\n/// - Returns `UNIT` for 0^0.\n///\n/// Requirements:\n/// - Refer to the requirements in {exp2}, {log2}, and {mul}.\n///\n/// @param x The base as an SD59x18 number.\n/// @param y Exponent to raise x to, as an SD59x18 number\n/// @return result x raised to power y, as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction pow(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\n int256 xInt = x.unwrap();\n int256 yInt = y.unwrap();\n\n // If both x and y are zero, the result is `UNIT`. If just x is zero, the result is always zero.\n if (xInt == 0) {\n return yInt == 0 ? UNIT : ZERO;\n }\n // If x is `UNIT`, the result is always `UNIT`.\n else if (xInt == uUNIT) {\n return UNIT;\n }\n\n // If y is zero, the result is always `UNIT`.\n if (yInt == 0) {\n return UNIT;\n }\n // If y is `UNIT`, the result is always x.\n else if (yInt == uUNIT) {\n return x;\n }\n\n // Calculate the result using the formula.\n result = exp2(mul(log2(x), y));\n}\n\n/// @notice Raises x (an SD59x18 number) to the power y (an unsigned basic integer) using the well-known\n/// algorithm \"exponentiation by squaring\".\n///\n/// @dev See https://en.wikipedia.org/wiki/Exponentiation_by_squaring.\n///\n/// Notes:\n/// - Refer to the notes in {Common.mulDiv18}.\n/// - Returns `UNIT` for 0^0.\n///\n/// Requirements:\n/// - Refer to the requirements in {abs} and {Common.mulDiv18}.\n/// - The result must fit in SD59x18.\n///\n/// @param x The base as an SD59x18 number.\n/// @param y The exponent as a uint256.\n/// @return result The result as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction powu(SD59x18 x, uint256 y) pure returns (SD59x18 result) {\n uint256 xAbs = uint256(abs(x).unwrap());\n\n // Calculate the first iteration of the loop in advance.\n uint256 resultAbs = y & 1 > 0 ? xAbs : uint256(uUNIT);\n\n // Equivalent to `for(y /= 2; y > 0; y /= 2)`.\n uint256 yAux = y;\n for (yAux >>= 1; yAux > 0; yAux >>= 1) {\n xAbs = Common.mulDiv18(xAbs, xAbs);\n\n // Equivalent to `y % 2 == 1`.\n if (yAux & 1 > 0) {\n resultAbs = Common.mulDiv18(resultAbs, xAbs);\n }\n }\n\n // The result must fit in SD59x18.\n if (resultAbs > uint256(uMAX_SD59x18)) {\n revert Errors.PRBMath_SD59x18_Powu_Overflow(x, y);\n }\n\n unchecked {\n // Is the base negative and the exponent odd? If yes, the result should be negative.\n int256 resultInt = int256(resultAbs);\n bool isNegative = x.unwrap() < 0 && y & 1 == 1;\n if (isNegative) {\n resultInt = -resultInt;\n }\n result = wrap(resultInt);\n }\n}\n\n/// @notice Calculates the square root of x using the Babylonian method.\n///\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\n///\n/// Notes:\n/// - Only the positive root is returned.\n/// - The result is rounded toward zero.\n///\n/// Requirements:\n/// - x cannot be negative, since complex numbers are not supported.\n/// - x must be less than `MAX_SD59x18 / UNIT`.\n///\n/// @param x The SD59x18 number for which to calculate the square root.\n/// @return result The result as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction sqrt(SD59x18 x) pure returns (SD59x18 result) {\n int256 xInt = x.unwrap();\n if (xInt < 0) {\n revert Errors.PRBMath_SD59x18_Sqrt_NegativeInput(x);\n }\n if (xInt > uMAX_SD59x18 / uUNIT) {\n revert Errors.PRBMath_SD59x18_Sqrt_Overflow(x);\n }\n\n unchecked {\n // Multiply x by `UNIT` to account for the factor of `UNIT` picked up when multiplying two SD59x18 numbers.\n // In this case, the two numbers are both the square root.\n uint256 resultUint = Common.sqrt(uint256(xInt * uUNIT));\n result = wrap(int256(resultUint));\n }\n}\n" + }, + "@prb/math/src/sd59x18/ValueType.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport \"./Casting.sol\" as Casting;\nimport \"./Helpers.sol\" as Helpers;\nimport \"./Math.sol\" as Math;\n\n/// @notice The signed 59.18-decimal fixed-point number representation, which can have up to 59 digits and up to 18\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\n/// type int256.\ntype SD59x18 is int256;\n\n/*//////////////////////////////////////////////////////////////////////////\n CASTING\n//////////////////////////////////////////////////////////////////////////*/\n\nusing {\n Casting.intoInt256,\n Casting.intoSD1x18,\n Casting.intoUD2x18,\n Casting.intoUD60x18,\n Casting.intoUint256,\n Casting.intoUint128,\n Casting.intoUint40,\n Casting.unwrap\n} for SD59x18 global;\n\n/*//////////////////////////////////////////////////////////////////////////\n MATHEMATICAL FUNCTIONS\n//////////////////////////////////////////////////////////////////////////*/\n\nusing {\n Math.abs,\n Math.avg,\n Math.ceil,\n Math.div,\n Math.exp,\n Math.exp2,\n Math.floor,\n Math.frac,\n Math.gm,\n Math.inv,\n Math.log10,\n Math.log2,\n Math.ln,\n Math.mul,\n Math.pow,\n Math.powu,\n Math.sqrt\n} for SD59x18 global;\n\n/*//////////////////////////////////////////////////////////////////////////\n HELPER FUNCTIONS\n//////////////////////////////////////////////////////////////////////////*/\n\nusing {\n Helpers.add,\n Helpers.and,\n Helpers.eq,\n Helpers.gt,\n Helpers.gte,\n Helpers.isZero,\n Helpers.lshift,\n Helpers.lt,\n Helpers.lte,\n Helpers.mod,\n Helpers.neq,\n Helpers.not,\n Helpers.or,\n Helpers.rshift,\n Helpers.sub,\n Helpers.uncheckedAdd,\n Helpers.uncheckedSub,\n Helpers.uncheckedUnary,\n Helpers.xor\n} for SD59x18 global;\n\n/*//////////////////////////////////////////////////////////////////////////\n OPERATORS\n//////////////////////////////////////////////////////////////////////////*/\n\n// The global \"using for\" directive makes it possible to use these operators on the SD59x18 type.\nusing {\n Helpers.add as +,\n Helpers.and2 as &,\n Math.div as /,\n Helpers.eq as ==,\n Helpers.gt as >,\n Helpers.gte as >=,\n Helpers.lt as <,\n Helpers.lte as <=,\n Helpers.mod as %,\n Math.mul as *,\n Helpers.neq as !=,\n Helpers.not as ~,\n Helpers.or as |,\n Helpers.sub as -,\n Helpers.unary as -,\n Helpers.xor as ^\n} for SD59x18 global;\n" + }, + "@prb/math/src/UD2x18.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\n/*\n\n██████╗ ██████╗ ██████╗ ███╗ ███╗ █████╗ ████████╗██╗ ██╗\n██╔══██╗██╔══██╗██╔══██╗████╗ ████║██╔══██╗╚══██╔══╝██║ ██║\n██████╔╝██████╔╝██████╔╝██╔████╔██║███████║ ██║ ███████║\n██╔═══╝ ██╔══██╗██╔══██╗██║╚██╔╝██║██╔══██║ ██║ ██╔══██║\n██║ ██║ ██║██████╔╝██║ ╚═╝ ██║██║ ██║ ██║ ██║ ██║\n╚═╝ ╚═╝ ╚═╝╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝\n\n██╗ ██╗██████╗ ██████╗ ██╗ ██╗ ██╗ █████╗\n██║ ██║██╔══██╗╚════██╗╚██╗██╔╝███║██╔══██╗\n██║ ██║██║ ██║ █████╔╝ ╚███╔╝ ╚██║╚█████╔╝\n██║ ██║██║ ██║██╔═══╝ ██╔██╗ ██║██╔══██╗\n╚██████╔╝██████╔╝███████╗██╔╝ ██╗ ██║╚█████╔╝\n ╚═════╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝ ╚═╝ ╚════╝\n\n*/\n\nimport \"./ud2x18/Casting.sol\";\nimport \"./ud2x18/Constants.sol\";\nimport \"./ud2x18/Errors.sol\";\nimport \"./ud2x18/ValueType.sol\";\n" + }, + "@prb/math/src/ud2x18/Casting.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport \"../Common.sol\" as Common;\nimport \"./Errors.sol\" as Errors;\nimport { uMAX_SD1x18 } from \"../sd1x18/Constants.sol\";\nimport { SD1x18 } from \"../sd1x18/ValueType.sol\";\nimport { SD59x18 } from \"../sd59x18/ValueType.sol\";\nimport { UD60x18 } from \"../ud60x18/ValueType.sol\";\nimport { UD2x18 } from \"./ValueType.sol\";\n\n/// @notice Casts a UD2x18 number into SD1x18.\n/// - x must be less than or equal to `uMAX_SD1x18`.\nfunction intoSD1x18(UD2x18 x) pure returns (SD1x18 result) {\n uint64 xUint = UD2x18.unwrap(x);\n if (xUint > uint64(uMAX_SD1x18)) {\n revert Errors.PRBMath_UD2x18_IntoSD1x18_Overflow(x);\n }\n result = SD1x18.wrap(int64(xUint));\n}\n\n/// @notice Casts a UD2x18 number into SD59x18.\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of SD59x18.\nfunction intoSD59x18(UD2x18 x) pure returns (SD59x18 result) {\n result = SD59x18.wrap(int256(uint256(UD2x18.unwrap(x))));\n}\n\n/// @notice Casts a UD2x18 number into UD60x18.\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of UD60x18.\nfunction intoUD60x18(UD2x18 x) pure returns (UD60x18 result) {\n result = UD60x18.wrap(UD2x18.unwrap(x));\n}\n\n/// @notice Casts a UD2x18 number into uint128.\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of uint128.\nfunction intoUint128(UD2x18 x) pure returns (uint128 result) {\n result = uint128(UD2x18.unwrap(x));\n}\n\n/// @notice Casts a UD2x18 number into uint256.\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of uint256.\nfunction intoUint256(UD2x18 x) pure returns (uint256 result) {\n result = uint256(UD2x18.unwrap(x));\n}\n\n/// @notice Casts a UD2x18 number into uint40.\n/// @dev Requirements:\n/// - x must be less than or equal to `MAX_UINT40`.\nfunction intoUint40(UD2x18 x) pure returns (uint40 result) {\n uint64 xUint = UD2x18.unwrap(x);\n if (xUint > uint64(Common.MAX_UINT40)) {\n revert Errors.PRBMath_UD2x18_IntoUint40_Overflow(x);\n }\n result = uint40(xUint);\n}\n\n/// @notice Alias for {wrap}.\nfunction ud2x18(uint64 x) pure returns (UD2x18 result) {\n result = UD2x18.wrap(x);\n}\n\n/// @notice Unwrap a UD2x18 number into uint64.\nfunction unwrap(UD2x18 x) pure returns (uint64 result) {\n result = UD2x18.unwrap(x);\n}\n\n/// @notice Wraps a uint64 number into UD2x18.\nfunction wrap(uint64 x) pure returns (UD2x18 result) {\n result = UD2x18.wrap(x);\n}\n" + }, + "@prb/math/src/ud2x18/Constants.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport { UD2x18 } from \"./ValueType.sol\";\n\n/// @dev Euler's number as a UD2x18 number.\nUD2x18 constant E = UD2x18.wrap(2_718281828459045235);\n\n/// @dev The maximum value a UD2x18 number can have.\nuint64 constant uMAX_UD2x18 = 18_446744073709551615;\nUD2x18 constant MAX_UD2x18 = UD2x18.wrap(uMAX_UD2x18);\n\n/// @dev PI as a UD2x18 number.\nUD2x18 constant PI = UD2x18.wrap(3_141592653589793238);\n\n/// @dev The unit number, which gives the decimal precision of UD2x18.\nUD2x18 constant UNIT = UD2x18.wrap(1e18);\nuint64 constant uUNIT = 1e18;\n" + }, + "@prb/math/src/ud2x18/Errors.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport { UD2x18 } from \"./ValueType.sol\";\n\n/// @notice Thrown when trying to cast a UD2x18 number that doesn't fit in SD1x18.\nerror PRBMath_UD2x18_IntoSD1x18_Overflow(UD2x18 x);\n\n/// @notice Thrown when trying to cast a UD2x18 number that doesn't fit in uint40.\nerror PRBMath_UD2x18_IntoUint40_Overflow(UD2x18 x);\n" + }, + "@prb/math/src/ud2x18/ValueType.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport \"./Casting.sol\" as Casting;\n\n/// @notice The unsigned 2.18-decimal fixed-point number representation, which can have up to 2 digits and up to 18\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\n/// type uint64. This is useful when end users want to use uint64 to save gas, e.g. with tight variable packing in contract\n/// storage.\ntype UD2x18 is uint64;\n\n/*//////////////////////////////////////////////////////////////////////////\n CASTING\n//////////////////////////////////////////////////////////////////////////*/\n\nusing {\n Casting.intoSD1x18,\n Casting.intoSD59x18,\n Casting.intoUD60x18,\n Casting.intoUint256,\n Casting.intoUint128,\n Casting.intoUint40,\n Casting.unwrap\n} for UD2x18 global;\n" + }, + "@prb/math/src/UD60x18.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\n/*\n\n██████╗ ██████╗ ██████╗ ███╗ ███╗ █████╗ ████████╗██╗ ██╗\n██╔══██╗██╔══██╗██╔══██╗████╗ ████║██╔══██╗╚══██╔══╝██║ ██║\n██████╔╝██████╔╝██████╔╝██╔████╔██║███████║ ██║ ███████║\n██╔═══╝ ██╔══██╗██╔══██╗██║╚██╔╝██║██╔══██║ ██║ ██╔══██║\n██║ ██║ ██║██████╔╝██║ ╚═╝ ██║██║ ██║ ██║ ██║ ██║\n╚═╝ ╚═╝ ╚═╝╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝\n\n██╗ ██╗██████╗ ██████╗ ██████╗ ██╗ ██╗ ██╗ █████╗\n██║ ██║██╔══██╗██╔════╝ ██╔═████╗╚██╗██╔╝███║██╔══██╗\n██║ ██║██║ ██║███████╗ ██║██╔██║ ╚███╔╝ ╚██║╚█████╔╝\n██║ ██║██║ ██║██╔═══██╗████╔╝██║ ██╔██╗ ██║██╔══██╗\n╚██████╔╝██████╔╝╚██████╔╝╚██████╔╝██╔╝ ██╗ ██║╚█████╔╝\n ╚═════╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚════╝\n\n*/\n\nimport \"./ud60x18/Casting.sol\";\nimport \"./ud60x18/Constants.sol\";\nimport \"./ud60x18/Conversions.sol\";\nimport \"./ud60x18/Errors.sol\";\nimport \"./ud60x18/Helpers.sol\";\nimport \"./ud60x18/Math.sol\";\nimport \"./ud60x18/ValueType.sol\";\n" + }, + "@prb/math/src/ud60x18/Casting.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport \"./Errors.sol\" as CastingErrors;\nimport { MAX_UINT128, MAX_UINT40 } from \"../Common.sol\";\nimport { uMAX_SD1x18 } from \"../sd1x18/Constants.sol\";\nimport { SD1x18 } from \"../sd1x18/ValueType.sol\";\nimport { uMAX_SD59x18 } from \"../sd59x18/Constants.sol\";\nimport { SD59x18 } from \"../sd59x18/ValueType.sol\";\nimport { uMAX_UD2x18 } from \"../ud2x18/Constants.sol\";\nimport { UD2x18 } from \"../ud2x18/ValueType.sol\";\nimport { UD60x18 } from \"./ValueType.sol\";\n\n/// @notice Casts a UD60x18 number into SD1x18.\n/// @dev Requirements:\n/// - x must be less than or equal to `uMAX_SD1x18`.\nfunction intoSD1x18(UD60x18 x) pure returns (SD1x18 result) {\n uint256 xUint = UD60x18.unwrap(x);\n if (xUint > uint256(int256(uMAX_SD1x18))) {\n revert CastingErrors.PRBMath_UD60x18_IntoSD1x18_Overflow(x);\n }\n result = SD1x18.wrap(int64(uint64(xUint)));\n}\n\n/// @notice Casts a UD60x18 number into UD2x18.\n/// @dev Requirements:\n/// - x must be less than or equal to `uMAX_UD2x18`.\nfunction intoUD2x18(UD60x18 x) pure returns (UD2x18 result) {\n uint256 xUint = UD60x18.unwrap(x);\n if (xUint > uMAX_UD2x18) {\n revert CastingErrors.PRBMath_UD60x18_IntoUD2x18_Overflow(x);\n }\n result = UD2x18.wrap(uint64(xUint));\n}\n\n/// @notice Casts a UD60x18 number into SD59x18.\n/// @dev Requirements:\n/// - x must be less than or equal to `uMAX_SD59x18`.\nfunction intoSD59x18(UD60x18 x) pure returns (SD59x18 result) {\n uint256 xUint = UD60x18.unwrap(x);\n if (xUint > uint256(uMAX_SD59x18)) {\n revert CastingErrors.PRBMath_UD60x18_IntoSD59x18_Overflow(x);\n }\n result = SD59x18.wrap(int256(xUint));\n}\n\n/// @notice Casts a UD60x18 number into uint128.\n/// @dev This is basically an alias for {unwrap}.\nfunction intoUint256(UD60x18 x) pure returns (uint256 result) {\n result = UD60x18.unwrap(x);\n}\n\n/// @notice Casts a UD60x18 number into uint128.\n/// @dev Requirements:\n/// - x must be less than or equal to `MAX_UINT128`.\nfunction intoUint128(UD60x18 x) pure returns (uint128 result) {\n uint256 xUint = UD60x18.unwrap(x);\n if (xUint > MAX_UINT128) {\n revert CastingErrors.PRBMath_UD60x18_IntoUint128_Overflow(x);\n }\n result = uint128(xUint);\n}\n\n/// @notice Casts a UD60x18 number into uint40.\n/// @dev Requirements:\n/// - x must be less than or equal to `MAX_UINT40`.\nfunction intoUint40(UD60x18 x) pure returns (uint40 result) {\n uint256 xUint = UD60x18.unwrap(x);\n if (xUint > MAX_UINT40) {\n revert CastingErrors.PRBMath_UD60x18_IntoUint40_Overflow(x);\n }\n result = uint40(xUint);\n}\n\n/// @notice Alias for {wrap}.\nfunction ud(uint256 x) pure returns (UD60x18 result) {\n result = UD60x18.wrap(x);\n}\n\n/// @notice Alias for {wrap}.\nfunction ud60x18(uint256 x) pure returns (UD60x18 result) {\n result = UD60x18.wrap(x);\n}\n\n/// @notice Unwraps a UD60x18 number into uint256.\nfunction unwrap(UD60x18 x) pure returns (uint256 result) {\n result = UD60x18.unwrap(x);\n}\n\n/// @notice Wraps a uint256 number into the UD60x18 value type.\nfunction wrap(uint256 x) pure returns (UD60x18 result) {\n result = UD60x18.wrap(x);\n}\n" + }, + "@prb/math/src/ud60x18/Constants.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport { UD60x18 } from \"./ValueType.sol\";\n\n// NOTICE: the \"u\" prefix stands for \"unwrapped\".\n\n/// @dev Euler's number as a UD60x18 number.\nUD60x18 constant E = UD60x18.wrap(2_718281828459045235);\n\n/// @dev The maximum input permitted in {exp}.\nuint256 constant uEXP_MAX_INPUT = 133_084258667509499440;\nUD60x18 constant EXP_MAX_INPUT = UD60x18.wrap(uEXP_MAX_INPUT);\n\n/// @dev The maximum input permitted in {exp2}.\nuint256 constant uEXP2_MAX_INPUT = 192e18 - 1;\nUD60x18 constant EXP2_MAX_INPUT = UD60x18.wrap(uEXP2_MAX_INPUT);\n\n/// @dev Half the UNIT number.\nuint256 constant uHALF_UNIT = 0.5e18;\nUD60x18 constant HALF_UNIT = UD60x18.wrap(uHALF_UNIT);\n\n/// @dev $log_2(10)$ as a UD60x18 number.\nuint256 constant uLOG2_10 = 3_321928094887362347;\nUD60x18 constant LOG2_10 = UD60x18.wrap(uLOG2_10);\n\n/// @dev $log_2(e)$ as a UD60x18 number.\nuint256 constant uLOG2_E = 1_442695040888963407;\nUD60x18 constant LOG2_E = UD60x18.wrap(uLOG2_E);\n\n/// @dev The maximum value a UD60x18 number can have.\nuint256 constant uMAX_UD60x18 = 115792089237316195423570985008687907853269984665640564039457_584007913129639935;\nUD60x18 constant MAX_UD60x18 = UD60x18.wrap(uMAX_UD60x18);\n\n/// @dev The maximum whole value a UD60x18 number can have.\nuint256 constant uMAX_WHOLE_UD60x18 = 115792089237316195423570985008687907853269984665640564039457_000000000000000000;\nUD60x18 constant MAX_WHOLE_UD60x18 = UD60x18.wrap(uMAX_WHOLE_UD60x18);\n\n/// @dev PI as a UD60x18 number.\nUD60x18 constant PI = UD60x18.wrap(3_141592653589793238);\n\n/// @dev The unit number, which gives the decimal precision of UD60x18.\nuint256 constant uUNIT = 1e18;\nUD60x18 constant UNIT = UD60x18.wrap(uUNIT);\n\n/// @dev The unit number squared.\nuint256 constant uUNIT_SQUARED = 1e36;\nUD60x18 constant UNIT_SQUARED = UD60x18.wrap(uUNIT_SQUARED);\n\n/// @dev Zero as a UD60x18 number.\nUD60x18 constant ZERO = UD60x18.wrap(0);\n" + }, + "@prb/math/src/ud60x18/Conversions.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport { uMAX_UD60x18, uUNIT } from \"./Constants.sol\";\nimport { PRBMath_UD60x18_Convert_Overflow } from \"./Errors.sol\";\nimport { UD60x18 } from \"./ValueType.sol\";\n\n/// @notice Converts a UD60x18 number to a simple integer by dividing it by `UNIT`.\n/// @dev The result is rounded toward zero.\n/// @param x The UD60x18 number to convert.\n/// @return result The same number in basic integer form.\nfunction convert(UD60x18 x) pure returns (uint256 result) {\n result = UD60x18.unwrap(x) / uUNIT;\n}\n\n/// @notice Converts a simple integer to UD60x18 by multiplying it by `UNIT`.\n///\n/// @dev Requirements:\n/// - x must be less than or equal to `MAX_UD60x18 / UNIT`.\n///\n/// @param x The basic integer to convert.\n/// @param result The same number converted to UD60x18.\nfunction convert(uint256 x) pure returns (UD60x18 result) {\n if (x > uMAX_UD60x18 / uUNIT) {\n revert PRBMath_UD60x18_Convert_Overflow(x);\n }\n unchecked {\n result = UD60x18.wrap(x * uUNIT);\n }\n}\n" + }, + "@prb/math/src/ud60x18/Errors.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport { UD60x18 } from \"./ValueType.sol\";\n\n/// @notice Thrown when ceiling a number overflows UD60x18.\nerror PRBMath_UD60x18_Ceil_Overflow(UD60x18 x);\n\n/// @notice Thrown when converting a basic integer to the fixed-point format overflows UD60x18.\nerror PRBMath_UD60x18_Convert_Overflow(uint256 x);\n\n/// @notice Thrown when taking the natural exponent of a base greater than 133_084258667509499441.\nerror PRBMath_UD60x18_Exp_InputTooBig(UD60x18 x);\n\n/// @notice Thrown when taking the binary exponent of a base greater than 192e18.\nerror PRBMath_UD60x18_Exp2_InputTooBig(UD60x18 x);\n\n/// @notice Thrown when taking the geometric mean of two numbers and multiplying them overflows UD60x18.\nerror PRBMath_UD60x18_Gm_Overflow(UD60x18 x, UD60x18 y);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\nerror PRBMath_UD60x18_IntoSD1x18_Overflow(UD60x18 x);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD59x18.\nerror PRBMath_UD60x18_IntoSD59x18_Overflow(UD60x18 x);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\nerror PRBMath_UD60x18_IntoUD2x18_Overflow(UD60x18 x);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\nerror PRBMath_UD60x18_IntoUint128_Overflow(UD60x18 x);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\nerror PRBMath_UD60x18_IntoUint40_Overflow(UD60x18 x);\n\n/// @notice Thrown when taking the logarithm of a number less than 1.\nerror PRBMath_UD60x18_Log_InputTooSmall(UD60x18 x);\n\n/// @notice Thrown when calculating the square root overflows UD60x18.\nerror PRBMath_UD60x18_Sqrt_Overflow(UD60x18 x);\n" + }, + "@prb/math/src/ud60x18/Helpers.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport { wrap } from \"./Casting.sol\";\nimport { UD60x18 } from \"./ValueType.sol\";\n\n/// @notice Implements the checked addition operation (+) in the UD60x18 type.\nfunction add(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\n result = wrap(x.unwrap() + y.unwrap());\n}\n\n/// @notice Implements the AND (&) bitwise operation in the UD60x18 type.\nfunction and(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\n result = wrap(x.unwrap() & bits);\n}\n\n/// @notice Implements the AND (&) bitwise operation in the UD60x18 type.\nfunction and2(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\n result = wrap(x.unwrap() & y.unwrap());\n}\n\n/// @notice Implements the equal operation (==) in the UD60x18 type.\nfunction eq(UD60x18 x, UD60x18 y) pure returns (bool result) {\n result = x.unwrap() == y.unwrap();\n}\n\n/// @notice Implements the greater than operation (>) in the UD60x18 type.\nfunction gt(UD60x18 x, UD60x18 y) pure returns (bool result) {\n result = x.unwrap() > y.unwrap();\n}\n\n/// @notice Implements the greater than or equal to operation (>=) in the UD60x18 type.\nfunction gte(UD60x18 x, UD60x18 y) pure returns (bool result) {\n result = x.unwrap() >= y.unwrap();\n}\n\n/// @notice Implements a zero comparison check function in the UD60x18 type.\nfunction isZero(UD60x18 x) pure returns (bool result) {\n // This wouldn't work if x could be negative.\n result = x.unwrap() == 0;\n}\n\n/// @notice Implements the left shift operation (<<) in the UD60x18 type.\nfunction lshift(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\n result = wrap(x.unwrap() << bits);\n}\n\n/// @notice Implements the lower than operation (<) in the UD60x18 type.\nfunction lt(UD60x18 x, UD60x18 y) pure returns (bool result) {\n result = x.unwrap() < y.unwrap();\n}\n\n/// @notice Implements the lower than or equal to operation (<=) in the UD60x18 type.\nfunction lte(UD60x18 x, UD60x18 y) pure returns (bool result) {\n result = x.unwrap() <= y.unwrap();\n}\n\n/// @notice Implements the checked modulo operation (%) in the UD60x18 type.\nfunction mod(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\n result = wrap(x.unwrap() % y.unwrap());\n}\n\n/// @notice Implements the not equal operation (!=) in the UD60x18 type.\nfunction neq(UD60x18 x, UD60x18 y) pure returns (bool result) {\n result = x.unwrap() != y.unwrap();\n}\n\n/// @notice Implements the NOT (~) bitwise operation in the UD60x18 type.\nfunction not(UD60x18 x) pure returns (UD60x18 result) {\n result = wrap(~x.unwrap());\n}\n\n/// @notice Implements the OR (|) bitwise operation in the UD60x18 type.\nfunction or(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\n result = wrap(x.unwrap() | y.unwrap());\n}\n\n/// @notice Implements the right shift operation (>>) in the UD60x18 type.\nfunction rshift(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\n result = wrap(x.unwrap() >> bits);\n}\n\n/// @notice Implements the checked subtraction operation (-) in the UD60x18 type.\nfunction sub(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\n result = wrap(x.unwrap() - y.unwrap());\n}\n\n/// @notice Implements the unchecked addition operation (+) in the UD60x18 type.\nfunction uncheckedAdd(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\n unchecked {\n result = wrap(x.unwrap() + y.unwrap());\n }\n}\n\n/// @notice Implements the unchecked subtraction operation (-) in the UD60x18 type.\nfunction uncheckedSub(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\n unchecked {\n result = wrap(x.unwrap() - y.unwrap());\n }\n}\n\n/// @notice Implements the XOR (^) bitwise operation in the UD60x18 type.\nfunction xor(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\n result = wrap(x.unwrap() ^ y.unwrap());\n}\n" + }, + "@prb/math/src/ud60x18/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport \"../Common.sol\" as Common;\nimport \"./Errors.sol\" as Errors;\nimport { wrap } from \"./Casting.sol\";\nimport {\n uEXP_MAX_INPUT,\n uEXP2_MAX_INPUT,\n uHALF_UNIT,\n uLOG2_10,\n uLOG2_E,\n uMAX_UD60x18,\n uMAX_WHOLE_UD60x18,\n UNIT,\n uUNIT,\n uUNIT_SQUARED,\n ZERO\n} from \"./Constants.sol\";\nimport { UD60x18 } from \"./ValueType.sol\";\n\n/*//////////////////////////////////////////////////////////////////////////\n MATHEMATICAL FUNCTIONS\n//////////////////////////////////////////////////////////////////////////*/\n\n/// @notice Calculates the arithmetic average of x and y using the following formula:\n///\n/// $$\n/// avg(x, y) = (x & y) + ((xUint ^ yUint) / 2)\n/// $$\n///\n/// In English, this is what this formula does:\n///\n/// 1. AND x and y.\n/// 2. Calculate half of XOR x and y.\n/// 3. Add the two results together.\n///\n/// This technique is known as SWAR, which stands for \"SIMD within a register\". You can read more about it here:\n/// https://devblogs.microsoft.com/oldnewthing/20220207-00/?p=106223\n///\n/// @dev Notes:\n/// - The result is rounded toward zero.\n///\n/// @param x The first operand as a UD60x18 number.\n/// @param y The second operand as a UD60x18 number.\n/// @return result The arithmetic average as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction avg(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\n uint256 xUint = x.unwrap();\n uint256 yUint = y.unwrap();\n unchecked {\n result = wrap((xUint & yUint) + ((xUint ^ yUint) >> 1));\n }\n}\n\n/// @notice Yields the smallest whole number greater than or equal to x.\n///\n/// @dev This is optimized for fractional value inputs, because for every whole value there are (1e18 - 1) fractional\n/// counterparts. See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\n///\n/// Requirements:\n/// - x must be less than or equal to `MAX_WHOLE_UD60x18`.\n///\n/// @param x The UD60x18 number to ceil.\n/// @param result The smallest whole number greater than or equal to x, as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction ceil(UD60x18 x) pure returns (UD60x18 result) {\n uint256 xUint = x.unwrap();\n if (xUint > uMAX_WHOLE_UD60x18) {\n revert Errors.PRBMath_UD60x18_Ceil_Overflow(x);\n }\n\n assembly (\"memory-safe\") {\n // Equivalent to `x % UNIT`.\n let remainder := mod(x, uUNIT)\n\n // Equivalent to `UNIT - remainder`.\n let delta := sub(uUNIT, remainder)\n\n // Equivalent to `x + remainder > 0 ? delta : 0`.\n result := add(x, mul(delta, gt(remainder, 0)))\n }\n}\n\n/// @notice Divides two UD60x18 numbers, returning a new UD60x18 number.\n///\n/// @dev Uses {Common.mulDiv} to enable overflow-safe multiplication and division.\n///\n/// Notes:\n/// - Refer to the notes in {Common.mulDiv}.\n///\n/// Requirements:\n/// - Refer to the requirements in {Common.mulDiv}.\n///\n/// @param x The numerator as a UD60x18 number.\n/// @param y The denominator as a UD60x18 number.\n/// @param result The quotient as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction div(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\n result = wrap(Common.mulDiv(x.unwrap(), uUNIT, y.unwrap()));\n}\n\n/// @notice Calculates the natural exponent of x using the following formula:\n///\n/// $$\n/// e^x = 2^{x * log_2{e}}\n/// $$\n///\n/// @dev Requirements:\n/// - x must be less than 133_084258667509499441.\n///\n/// @param x The exponent as a UD60x18 number.\n/// @return result The result as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction exp(UD60x18 x) pure returns (UD60x18 result) {\n uint256 xUint = x.unwrap();\n\n // This check prevents values greater than 192e18 from being passed to {exp2}.\n if (xUint > uEXP_MAX_INPUT) {\n revert Errors.PRBMath_UD60x18_Exp_InputTooBig(x);\n }\n\n unchecked {\n // Inline the fixed-point multiplication to save gas.\n uint256 doubleUnitProduct = xUint * uLOG2_E;\n result = exp2(wrap(doubleUnitProduct / uUNIT));\n }\n}\n\n/// @notice Calculates the binary exponent of x using the binary fraction method.\n///\n/// @dev See https://ethereum.stackexchange.com/q/79903/24693\n///\n/// Requirements:\n/// - x must be less than 192e18.\n/// - The result must fit in UD60x18.\n///\n/// @param x The exponent as a UD60x18 number.\n/// @return result The result as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction exp2(UD60x18 x) pure returns (UD60x18 result) {\n uint256 xUint = x.unwrap();\n\n // Numbers greater than or equal to 192e18 don't fit in the 192.64-bit format.\n if (xUint > uEXP2_MAX_INPUT) {\n revert Errors.PRBMath_UD60x18_Exp2_InputTooBig(x);\n }\n\n // Convert x to the 192.64-bit fixed-point format.\n uint256 x_192x64 = (xUint << 64) / uUNIT;\n\n // Pass x to the {Common.exp2} function, which uses the 192.64-bit fixed-point number representation.\n result = wrap(Common.exp2(x_192x64));\n}\n\n/// @notice Yields the greatest whole number less than or equal to x.\n/// @dev Optimized for fractional value inputs, because every whole value has (1e18 - 1) fractional counterparts.\n/// See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\n/// @param x The UD60x18 number to floor.\n/// @param result The greatest whole number less than or equal to x, as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction floor(UD60x18 x) pure returns (UD60x18 result) {\n assembly (\"memory-safe\") {\n // Equivalent to `x % UNIT`.\n let remainder := mod(x, uUNIT)\n\n // Equivalent to `x - remainder > 0 ? remainder : 0)`.\n result := sub(x, mul(remainder, gt(remainder, 0)))\n }\n}\n\n/// @notice Yields the excess beyond the floor of x using the odd function definition.\n/// @dev See https://en.wikipedia.org/wiki/Fractional_part.\n/// @param x The UD60x18 number to get the fractional part of.\n/// @param result The fractional part of x as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction frac(UD60x18 x) pure returns (UD60x18 result) {\n assembly (\"memory-safe\") {\n result := mod(x, uUNIT)\n }\n}\n\n/// @notice Calculates the geometric mean of x and y, i.e. $\\sqrt{x * y}$, rounding down.\n///\n/// @dev Requirements:\n/// - x * y must fit in UD60x18.\n///\n/// @param x The first operand as a UD60x18 number.\n/// @param y The second operand as a UD60x18 number.\n/// @return result The result as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction gm(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\n uint256 xUint = x.unwrap();\n uint256 yUint = y.unwrap();\n if (xUint == 0 || yUint == 0) {\n return ZERO;\n }\n\n unchecked {\n // Checking for overflow this way is faster than letting Solidity do it.\n uint256 xyUint = xUint * yUint;\n if (xyUint / xUint != yUint) {\n revert Errors.PRBMath_UD60x18_Gm_Overflow(x, y);\n }\n\n // We don't need to multiply the result by `UNIT` here because the x*y product picked up a factor of `UNIT`\n // during multiplication. See the comments in {Common.sqrt}.\n result = wrap(Common.sqrt(xyUint));\n }\n}\n\n/// @notice Calculates the inverse of x.\n///\n/// @dev Notes:\n/// - The result is rounded toward zero.\n///\n/// Requirements:\n/// - x must not be zero.\n///\n/// @param x The UD60x18 number for which to calculate the inverse.\n/// @return result The inverse as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction inv(UD60x18 x) pure returns (UD60x18 result) {\n unchecked {\n result = wrap(uUNIT_SQUARED / x.unwrap());\n }\n}\n\n/// @notice Calculates the natural logarithm of x using the following formula:\n///\n/// $$\n/// ln{x} = log_2{x} / log_2{e}\n/// $$\n///\n/// @dev Notes:\n/// - Refer to the notes in {log2}.\n/// - The precision isn't sufficiently fine-grained to return exactly `UNIT` when the input is `E`.\n///\n/// Requirements:\n/// - Refer to the requirements in {log2}.\n///\n/// @param x The UD60x18 number for which to calculate the natural logarithm.\n/// @return result The natural logarithm as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction ln(UD60x18 x) pure returns (UD60x18 result) {\n unchecked {\n // Inline the fixed-point multiplication to save gas. This is overflow-safe because the maximum value that\n // {log2} can return is ~196_205294292027477728.\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_E);\n }\n}\n\n/// @notice Calculates the common logarithm of x using the following formula:\n///\n/// $$\n/// log_{10}{x} = log_2{x} / log_2{10}\n/// $$\n///\n/// However, if x is an exact power of ten, a hard coded value is returned.\n///\n/// @dev Notes:\n/// - Refer to the notes in {log2}.\n///\n/// Requirements:\n/// - Refer to the requirements in {log2}.\n///\n/// @param x The UD60x18 number for which to calculate the common logarithm.\n/// @return result The common logarithm as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction log10(UD60x18 x) pure returns (UD60x18 result) {\n uint256 xUint = x.unwrap();\n if (xUint < uUNIT) {\n revert Errors.PRBMath_UD60x18_Log_InputTooSmall(x);\n }\n\n // Note that the `mul` in this assembly block is the standard multiplication operation, not {UD60x18.mul}.\n // prettier-ignore\n assembly (\"memory-safe\") {\n switch x\n case 1 { result := mul(uUNIT, sub(0, 18)) }\n case 10 { result := mul(uUNIT, sub(1, 18)) }\n case 100 { result := mul(uUNIT, sub(2, 18)) }\n case 1000 { result := mul(uUNIT, sub(3, 18)) }\n case 10000 { result := mul(uUNIT, sub(4, 18)) }\n case 100000 { result := mul(uUNIT, sub(5, 18)) }\n case 1000000 { result := mul(uUNIT, sub(6, 18)) }\n case 10000000 { result := mul(uUNIT, sub(7, 18)) }\n case 100000000 { result := mul(uUNIT, sub(8, 18)) }\n case 1000000000 { result := mul(uUNIT, sub(9, 18)) }\n case 10000000000 { result := mul(uUNIT, sub(10, 18)) }\n case 100000000000 { result := mul(uUNIT, sub(11, 18)) }\n case 1000000000000 { result := mul(uUNIT, sub(12, 18)) }\n case 10000000000000 { result := mul(uUNIT, sub(13, 18)) }\n case 100000000000000 { result := mul(uUNIT, sub(14, 18)) }\n case 1000000000000000 { result := mul(uUNIT, sub(15, 18)) }\n case 10000000000000000 { result := mul(uUNIT, sub(16, 18)) }\n case 100000000000000000 { result := mul(uUNIT, sub(17, 18)) }\n case 1000000000000000000 { result := 0 }\n case 10000000000000000000 { result := uUNIT }\n case 100000000000000000000 { result := mul(uUNIT, 2) }\n case 1000000000000000000000 { result := mul(uUNIT, 3) }\n case 10000000000000000000000 { result := mul(uUNIT, 4) }\n case 100000000000000000000000 { result := mul(uUNIT, 5) }\n case 1000000000000000000000000 { result := mul(uUNIT, 6) }\n case 10000000000000000000000000 { result := mul(uUNIT, 7) }\n case 100000000000000000000000000 { result := mul(uUNIT, 8) }\n case 1000000000000000000000000000 { result := mul(uUNIT, 9) }\n case 10000000000000000000000000000 { result := mul(uUNIT, 10) }\n case 100000000000000000000000000000 { result := mul(uUNIT, 11) }\n case 1000000000000000000000000000000 { result := mul(uUNIT, 12) }\n case 10000000000000000000000000000000 { result := mul(uUNIT, 13) }\n case 100000000000000000000000000000000 { result := mul(uUNIT, 14) }\n case 1000000000000000000000000000000000 { result := mul(uUNIT, 15) }\n case 10000000000000000000000000000000000 { result := mul(uUNIT, 16) }\n case 100000000000000000000000000000000000 { result := mul(uUNIT, 17) }\n case 1000000000000000000000000000000000000 { result := mul(uUNIT, 18) }\n case 10000000000000000000000000000000000000 { result := mul(uUNIT, 19) }\n case 100000000000000000000000000000000000000 { result := mul(uUNIT, 20) }\n case 1000000000000000000000000000000000000000 { result := mul(uUNIT, 21) }\n case 10000000000000000000000000000000000000000 { result := mul(uUNIT, 22) }\n case 100000000000000000000000000000000000000000 { result := mul(uUNIT, 23) }\n case 1000000000000000000000000000000000000000000 { result := mul(uUNIT, 24) }\n case 10000000000000000000000000000000000000000000 { result := mul(uUNIT, 25) }\n case 100000000000000000000000000000000000000000000 { result := mul(uUNIT, 26) }\n case 1000000000000000000000000000000000000000000000 { result := mul(uUNIT, 27) }\n case 10000000000000000000000000000000000000000000000 { result := mul(uUNIT, 28) }\n case 100000000000000000000000000000000000000000000000 { result := mul(uUNIT, 29) }\n case 1000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 30) }\n case 10000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 31) }\n case 100000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 32) }\n case 1000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 33) }\n case 10000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 34) }\n case 100000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 35) }\n case 1000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 36) }\n case 10000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 37) }\n case 100000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 38) }\n case 1000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 39) }\n case 10000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 40) }\n case 100000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 41) }\n case 1000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 42) }\n case 10000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 43) }\n case 100000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 44) }\n case 1000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 45) }\n case 10000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 46) }\n case 100000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 47) }\n case 1000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 48) }\n case 10000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 49) }\n case 100000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 50) }\n case 1000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 51) }\n case 10000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 52) }\n case 100000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 53) }\n case 1000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 54) }\n case 10000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 55) }\n case 100000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 56) }\n case 1000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 57) }\n case 10000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 58) }\n case 100000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 59) }\n default { result := uMAX_UD60x18 }\n }\n\n if (result.unwrap() == uMAX_UD60x18) {\n unchecked {\n // Inline the fixed-point division to save gas.\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_10);\n }\n }\n}\n\n/// @notice Calculates the binary logarithm of x using the iterative approximation algorithm:\n///\n/// $$\n/// log_2{x} = n + log_2{y}, \\text{ where } y = x*2^{-n}, \\ y \\in [1, 2)\n/// $$\n///\n/// For $0 \\leq x \\lt 1$, the input is inverted:\n///\n/// $$\n/// log_2{x} = -log_2{\\frac{1}{x}}\n/// $$\n///\n/// @dev See https://en.wikipedia.org/wiki/Binary_logarithm#Iterative_approximation\n///\n/// Notes:\n/// - Due to the lossy precision of the iterative approximation, the results are not perfectly accurate to the last decimal.\n///\n/// Requirements:\n/// - x must be greater than zero.\n///\n/// @param x The UD60x18 number for which to calculate the binary logarithm.\n/// @return result The binary logarithm as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction log2(UD60x18 x) pure returns (UD60x18 result) {\n uint256 xUint = x.unwrap();\n\n if (xUint < uUNIT) {\n revert Errors.PRBMath_UD60x18_Log_InputTooSmall(x);\n }\n\n unchecked {\n // Calculate the integer part of the logarithm.\n uint256 n = Common.msb(xUint / uUNIT);\n\n // This is the integer part of the logarithm as a UD60x18 number. The operation can't overflow because n\n // n is at most 255 and UNIT is 1e18.\n uint256 resultUint = n * uUNIT;\n\n // Calculate $y = x * 2^{-n}$.\n uint256 y = xUint >> n;\n\n // If y is the unit number, the fractional part is zero.\n if (y == uUNIT) {\n return wrap(resultUint);\n }\n\n // Calculate the fractional part via the iterative approximation.\n // The `delta >>= 1` part is equivalent to `delta /= 2`, but shifting bits is more gas efficient.\n uint256 DOUBLE_UNIT = 2e18;\n for (uint256 delta = uHALF_UNIT; delta > 0; delta >>= 1) {\n y = (y * y) / uUNIT;\n\n // Is y^2 >= 2e18 and so in the range [2e18, 4e18)?\n if (y >= DOUBLE_UNIT) {\n // Add the 2^{-m} factor to the logarithm.\n resultUint += delta;\n\n // Halve y, which corresponds to z/2 in the Wikipedia article.\n y >>= 1;\n }\n }\n result = wrap(resultUint);\n }\n}\n\n/// @notice Multiplies two UD60x18 numbers together, returning a new UD60x18 number.\n///\n/// @dev Uses {Common.mulDiv} to enable overflow-safe multiplication and division.\n///\n/// Notes:\n/// - Refer to the notes in {Common.mulDiv}.\n///\n/// Requirements:\n/// - Refer to the requirements in {Common.mulDiv}.\n///\n/// @dev See the documentation in {Common.mulDiv18}.\n/// @param x The multiplicand as a UD60x18 number.\n/// @param y The multiplier as a UD60x18 number.\n/// @return result The product as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction mul(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\n result = wrap(Common.mulDiv18(x.unwrap(), y.unwrap()));\n}\n\n/// @notice Raises x to the power of y.\n///\n/// For $1 \\leq x \\leq \\infty$, the following standard formula is used:\n///\n/// $$\n/// x^y = 2^{log_2{x} * y}\n/// $$\n///\n/// For $0 \\leq x \\lt 1$, since the unsigned {log2} is undefined, an equivalent formula is used:\n///\n/// $$\n/// i = \\frac{1}{x}\n/// w = 2^{log_2{i} * y}\n/// x^y = \\frac{1}{w}\n/// $$\n///\n/// @dev Notes:\n/// - Refer to the notes in {log2} and {mul}.\n/// - Returns `UNIT` for 0^0.\n/// - It may not perform well with very small values of x. Consider using SD59x18 as an alternative.\n///\n/// Requirements:\n/// - Refer to the requirements in {exp2}, {log2}, and {mul}.\n///\n/// @param x The base as a UD60x18 number.\n/// @param y The exponent as a UD60x18 number.\n/// @return result The result as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction pow(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\n uint256 xUint = x.unwrap();\n uint256 yUint = y.unwrap();\n\n // If both x and y are zero, the result is `UNIT`. If just x is zero, the result is always zero.\n if (xUint == 0) {\n return yUint == 0 ? UNIT : ZERO;\n }\n // If x is `UNIT`, the result is always `UNIT`.\n else if (xUint == uUNIT) {\n return UNIT;\n }\n\n // If y is zero, the result is always `UNIT`.\n if (yUint == 0) {\n return UNIT;\n }\n // If y is `UNIT`, the result is always x.\n else if (yUint == uUNIT) {\n return x;\n }\n\n // If x is greater than `UNIT`, use the standard formula.\n if (xUint > uUNIT) {\n result = exp2(mul(log2(x), y));\n }\n // Conversely, if x is less than `UNIT`, use the equivalent formula.\n else {\n UD60x18 i = wrap(uUNIT_SQUARED / xUint);\n UD60x18 w = exp2(mul(log2(i), y));\n result = wrap(uUNIT_SQUARED / w.unwrap());\n }\n}\n\n/// @notice Raises x (a UD60x18 number) to the power y (an unsigned basic integer) using the well-known\n/// algorithm \"exponentiation by squaring\".\n///\n/// @dev See https://en.wikipedia.org/wiki/Exponentiation_by_squaring.\n///\n/// Notes:\n/// - Refer to the notes in {Common.mulDiv18}.\n/// - Returns `UNIT` for 0^0.\n///\n/// Requirements:\n/// - The result must fit in UD60x18.\n///\n/// @param x The base as a UD60x18 number.\n/// @param y The exponent as a uint256.\n/// @return result The result as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction powu(UD60x18 x, uint256 y) pure returns (UD60x18 result) {\n // Calculate the first iteration of the loop in advance.\n uint256 xUint = x.unwrap();\n uint256 resultUint = y & 1 > 0 ? xUint : uUNIT;\n\n // Equivalent to `for(y /= 2; y > 0; y /= 2)`.\n for (y >>= 1; y > 0; y >>= 1) {\n xUint = Common.mulDiv18(xUint, xUint);\n\n // Equivalent to `y % 2 == 1`.\n if (y & 1 > 0) {\n resultUint = Common.mulDiv18(resultUint, xUint);\n }\n }\n result = wrap(resultUint);\n}\n\n/// @notice Calculates the square root of x using the Babylonian method.\n///\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\n///\n/// Notes:\n/// - The result is rounded toward zero.\n///\n/// Requirements:\n/// - x must be less than `MAX_UD60x18 / UNIT`.\n///\n/// @param x The UD60x18 number for which to calculate the square root.\n/// @return result The result as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction sqrt(UD60x18 x) pure returns (UD60x18 result) {\n uint256 xUint = x.unwrap();\n\n unchecked {\n if (xUint > uMAX_UD60x18 / uUNIT) {\n revert Errors.PRBMath_UD60x18_Sqrt_Overflow(x);\n }\n // Multiply x by `UNIT` to account for the factor of `UNIT` picked up when multiplying two UD60x18 numbers.\n // In this case, the two numbers are both the square root.\n result = wrap(Common.sqrt(xUint * uUNIT));\n }\n}\n" + }, + "@prb/math/src/ud60x18/ValueType.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport \"./Casting.sol\" as Casting;\nimport \"./Helpers.sol\" as Helpers;\nimport \"./Math.sol\" as Math;\n\n/// @notice The unsigned 60.18-decimal fixed-point number representation, which can have up to 60 digits and up to 18\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the Solidity type uint256.\n/// @dev The value type is defined here so it can be imported in all other files.\ntype UD60x18 is uint256;\n\n/*//////////////////////////////////////////////////////////////////////////\n CASTING\n//////////////////////////////////////////////////////////////////////////*/\n\nusing {\n Casting.intoSD1x18,\n Casting.intoUD2x18,\n Casting.intoSD59x18,\n Casting.intoUint128,\n Casting.intoUint256,\n Casting.intoUint40,\n Casting.unwrap\n} for UD60x18 global;\n\n/*//////////////////////////////////////////////////////////////////////////\n MATHEMATICAL FUNCTIONS\n//////////////////////////////////////////////////////////////////////////*/\n\n// The global \"using for\" directive makes the functions in this library callable on the UD60x18 type.\nusing {\n Math.avg,\n Math.ceil,\n Math.div,\n Math.exp,\n Math.exp2,\n Math.floor,\n Math.frac,\n Math.gm,\n Math.inv,\n Math.ln,\n Math.log10,\n Math.log2,\n Math.mul,\n Math.pow,\n Math.powu,\n Math.sqrt\n} for UD60x18 global;\n\n/*//////////////////////////////////////////////////////////////////////////\n HELPER FUNCTIONS\n//////////////////////////////////////////////////////////////////////////*/\n\n// The global \"using for\" directive makes the functions in this library callable on the UD60x18 type.\nusing {\n Helpers.add,\n Helpers.and,\n Helpers.eq,\n Helpers.gt,\n Helpers.gte,\n Helpers.isZero,\n Helpers.lshift,\n Helpers.lt,\n Helpers.lte,\n Helpers.mod,\n Helpers.neq,\n Helpers.not,\n Helpers.or,\n Helpers.rshift,\n Helpers.sub,\n Helpers.uncheckedAdd,\n Helpers.uncheckedSub,\n Helpers.xor\n} for UD60x18 global;\n\n/*//////////////////////////////////////////////////////////////////////////\n OPERATORS\n//////////////////////////////////////////////////////////////////////////*/\n\n// The global \"using for\" directive makes it possible to use these operators on the UD60x18 type.\nusing {\n Helpers.add as +,\n Helpers.and2 as &,\n Math.div as /,\n Helpers.eq as ==,\n Helpers.gt as >,\n Helpers.gte as >=,\n Helpers.lt as <,\n Helpers.lte as <=,\n Helpers.or as |,\n Helpers.mod as %,\n Math.mul as *,\n Helpers.neq as !=,\n Helpers.not as ~,\n Helpers.sub as -,\n Helpers.xor as ^\n} for UD60x18 global;\n" + }, + "contracts/autonomous-admin/DecentAutonomousAdminV1.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.28;\n\nimport {IHats} from \"../interfaces/hats/IHats.sol\";\nimport {IHatsElectionsEligibility} from \"../interfaces/hats/modules/IHatsElectionsEligibility.sol\";\nimport {FactoryFriendly} from \"@gnosis.pm/zodiac/contracts/factory/FactoryFriendly.sol\";\nimport {ERC165} from \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport {IDecentAutonomousAdminV1} from \"../interfaces/autonomous-admin/IDecentAutonomousAdminV1.sol\";\n\ncontract DecentAutonomousAdminV1 is\n IDecentAutonomousAdminV1,\n ERC165,\n FactoryFriendly\n{\n // //////////////////////////////////////////////////////////////\n // initializer\n // //////////////////////////////////////////////////////////////\n function setUp(bytes memory initializeParams) public override initializer {}\n\n // //////////////////////////////////////////////////////////////\n // Public Functions\n // //////////////////////////////////////////////////////////////\n function triggerStartNextTerm(TriggerStartArgs calldata args) public {\n IHatsElectionsEligibility hatsElectionModule = IHatsElectionsEligibility(\n args.hatsProtocol.getHatEligibilityModule(args.hatId)\n );\n\n hatsElectionModule.startNextTerm();\n\n // This will burn the hat if wearer is no longer eligible\n args.hatsProtocol.checkHatWearerStatus(args.hatId, args.currentWearer);\n\n // This will mint the hat to the nominated wearer, if necessary\n if (args.nominatedWearer != args.currentWearer) {\n args.hatsProtocol.mintHat(args.hatId, args.nominatedWearer);\n }\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view override returns (bool) {\n return\n interfaceId == type(IDecentAutonomousAdminV1).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n}\n" + }, + "contracts/hardhat-dependency-compiler/@gnosis.pm/safe-contracts/contracts/GnosisSafeL2.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >0.0.0;\nimport '@gnosis.pm/safe-contracts/contracts/GnosisSafeL2.sol';\n" + }, + "contracts/hardhat-dependency-compiler/@gnosis.pm/safe-contracts/contracts/libraries/MultiSendCallOnly.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >0.0.0;\nimport '@gnosis.pm/safe-contracts/contracts/libraries/MultiSendCallOnly.sol';\n" + }, + "contracts/hardhat-dependency-compiler/@gnosis.pm/safe-contracts/contracts/proxies/GnosisSafeProxyFactory.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >0.0.0;\nimport '@gnosis.pm/safe-contracts/contracts/proxies/GnosisSafeProxyFactory.sol';\n" + }, + "contracts/interfaces/autonomous-admin/IDecentAutonomousAdminV1.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.28;\n\nimport {IHats} from \"../hats/IHats.sol\";\n\ninterface IDecentAutonomousAdminV1 {\n error NotCurrentWearer();\n\n struct TriggerStartArgs {\n address currentWearer;\n IHats hatsProtocol;\n uint256 hatId;\n address nominatedWearer;\n }\n\n function triggerStartNextTerm(TriggerStartArgs calldata args) external;\n}\n" + }, + "contracts/interfaces/hats/HatsErrors.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\n// Copyright (C) 2023 Haberdasher Labs\n//\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU Affero General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU Affero General Public License for more details.\n//\n// You should have received a copy of the GNU Affero General Public License\n// along with this program. If not, see .\n\npragma solidity >=0.8.13;\n\ninterface HatsErrors {\n /// @notice Emitted when `user` is attempting to perform an action on `hatId` but is not wearing one of `hatId`'s admin hats\n /// @dev Can be equivalent to `NotHatWearer(buildHatId(hatId))`, such as when emitted by `approveLinkTopHatToTree` or `relinkTopHatToTree`\n error NotAdmin(address user, uint256 hatId);\n\n /// @notice Emitted when attempting to perform an action as or for an account that is not a wearer of a given hat\n error NotHatWearer();\n\n /// @notice Emitted when attempting to perform an action that requires being either an admin or wearer of a given hat\n error NotAdminOrWearer();\n\n /// @notice Emitted when attempting to mint `hatId` but `hatId`'s maxSupply has been reached\n error AllHatsWorn(uint256 hatId);\n\n /// @notice Emitted when attempting to create a hat with a level 14 hat as its admin\n error MaxLevelsReached();\n\n /// @notice Emitted when an attempted hat id has empty intermediate level(s)\n error InvalidHatId();\n\n /// @notice Emitted when attempting to mint `hatId` to a `wearer` who is already wearing the hat\n error AlreadyWearingHat(address wearer, uint256 hatId);\n\n /// @notice Emitted when attempting to mint a non-existant hat\n error HatDoesNotExist(uint256 hatId);\n\n /// @notice Emmitted when attempting to mint or transfer a hat that is not active\n error HatNotActive();\n\n /// @notice Emitted when attempting to mint or transfer a hat to an ineligible wearer\n error NotEligible();\n\n /// @notice Emitted when attempting to check or set a hat's status from an account that is not that hat's toggle module\n error NotHatsToggle();\n\n /// @notice Emitted when attempting to check or set a hat wearer's status from an account that is not that hat's eligibility module\n error NotHatsEligibility();\n\n /// @notice Emitted when array arguments to a batch function have mismatching lengths\n error BatchArrayLengthMismatch();\n\n /// @notice Emitted when attempting to mutate or transfer an immutable hat\n error Immutable();\n\n /// @notice Emitted when attempting to change a hat's maxSupply to a value lower than its current supply\n error NewMaxSupplyTooLow();\n\n /// @notice Emitted when attempting to link a tophat to a new admin for which the tophat serves as an admin\n error CircularLinkage();\n\n /// @notice Emitted when attempting to link or relink a tophat to a separate tree\n error CrossTreeLinkage();\n\n /// @notice Emitted when attempting to link a tophat without a request\n error LinkageNotRequested();\n\n /// @notice Emitted when attempting to unlink a tophat that does not have a wearer\n /// @dev This ensures that unlinking never results in a bricked tophat\n error InvalidUnlink();\n\n /// @notice Emmited when attempting to change a hat's eligibility or toggle module to the zero address\n error ZeroAddress();\n\n /// @notice Emmitted when attempting to change a hat's details or imageURI to a string with over 7000 bytes (~characters)\n /// @dev This protects against a DOS attack where an admin iteratively extend's a hat's details or imageURI\n /// to be so long that reading it exceeds the block gas limit, breaking `uri()` and `viewHat()`\n error StringTooLong();\n}\n" + }, + "contracts/interfaces/hats/HatsEvents.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\n// Copyright (C) 2023 Haberdasher Labs\n//\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU Affero General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU Affero General Public License for more details.\n//\n// You should have received a copy of the GNU Affero General Public License\n// along with this program. If not, see .\n\npragma solidity >=0.8.13;\n\ninterface HatsEvents {\n /// @notice Emitted when a new hat is created\n /// @param id The id for the new hat\n /// @param details A description of the Hat\n /// @param maxSupply The total instances of the Hat that can be worn at once\n /// @param eligibility The address that can report on the Hat wearer's status\n /// @param toggle The address that can deactivate the Hat\n /// @param mutable_ Whether the hat's properties are changeable after creation\n /// @param imageURI The image uri for this hat and the fallback for its\n event HatCreated(\n uint256 id,\n string details,\n uint32 maxSupply,\n address eligibility,\n address toggle,\n bool mutable_,\n string imageURI\n );\n\n /// @notice Emitted when a hat wearer's standing is updated\n /// @dev Eligibility is excluded since the source of truth for eligibility is the eligibility module and may change without a transaction\n /// @param hatId The id of the wearer's hat\n /// @param wearer The wearer's address\n /// @param wearerStanding Whether the wearer is in good standing for the hat\n event WearerStandingChanged(\n uint256 hatId,\n address wearer,\n bool wearerStanding\n );\n\n /// @notice Emitted when a hat's status is updated\n /// @param hatId The id of the hat\n /// @param newStatus Whether the hat is active\n event HatStatusChanged(uint256 hatId, bool newStatus);\n\n /// @notice Emitted when a hat's details are updated\n /// @param hatId The id of the hat\n /// @param newDetails The updated details\n event HatDetailsChanged(uint256 hatId, string newDetails);\n\n /// @notice Emitted when a hat's eligibility module is updated\n /// @param hatId The id of the hat\n /// @param newEligibility The updated eligibiliy module\n event HatEligibilityChanged(uint256 hatId, address newEligibility);\n\n /// @notice Emitted when a hat's toggle module is updated\n /// @param hatId The id of the hat\n /// @param newToggle The updated toggle module\n event HatToggleChanged(uint256 hatId, address newToggle);\n\n /// @notice Emitted when a hat's mutability is updated\n /// @param hatId The id of the hat\n event HatMutabilityChanged(uint256 hatId);\n\n /// @notice Emitted when a hat's maximum supply is updated\n /// @param hatId The id of the hat\n /// @param newMaxSupply The updated max supply\n event HatMaxSupplyChanged(uint256 hatId, uint32 newMaxSupply);\n\n /// @notice Emitted when a hat's image URI is updated\n /// @param hatId The id of the hat\n /// @param newImageURI The updated image URI\n event HatImageURIChanged(uint256 hatId, string newImageURI);\n\n /// @notice Emitted when a tophat linkage is requested by its admin\n /// @param domain The domain of the tree tophat to link\n /// @param newAdmin The tophat's would-be admin in the parent tree\n event TopHatLinkRequested(uint32 domain, uint256 newAdmin);\n\n /// @notice Emitted when a tophat is linked to a another tree\n /// @param domain The domain of the newly-linked tophat\n /// @param newAdmin The tophat's new admin in the parent tree\n event TopHatLinked(uint32 domain, uint256 newAdmin);\n}\n" + }, + "contracts/interfaces/hats/IHats.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\n// Copyright (C) 2023 Haberdasher Labs\n//\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU Affero General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU Affero General Public License for more details.\n//\n// You should have received a copy of the GNU Affero General Public License\n// along with this program. If not, see .\n\npragma solidity >=0.8.13;\n\nimport \"./IHatsIdUtilities.sol\";\nimport \"./HatsErrors.sol\";\nimport \"./HatsEvents.sol\";\n\ninterface IHats is IHatsIdUtilities, HatsErrors, HatsEvents {\n function mintTopHat(\n address _target,\n string memory _details,\n string memory _imageURI\n ) external returns (uint256 topHatId);\n\n function createHat(\n uint256 _admin,\n string calldata _details,\n uint32 _maxSupply,\n address _eligibility,\n address _toggle,\n bool _mutable,\n string calldata _imageURI\n ) external returns (uint256 newHatId);\n\n function batchCreateHats(\n uint256[] calldata _admins,\n string[] calldata _details,\n uint32[] calldata _maxSupplies,\n address[] memory _eligibilityModules,\n address[] memory _toggleModules,\n bool[] calldata _mutables,\n string[] calldata _imageURIs\n ) external returns (bool success);\n\n function getNextId(uint256 _admin) external view returns (uint256 nextId);\n\n function mintHat(\n uint256 _hatId,\n address _wearer\n ) external returns (bool success);\n\n function batchMintHats(\n uint256[] calldata _hatIds,\n address[] calldata _wearers\n ) external returns (bool success);\n\n function setHatStatus(\n uint256 _hatId,\n bool _newStatus\n ) external returns (bool toggled);\n\n function checkHatStatus(uint256 _hatId) external returns (bool toggled);\n\n function setHatWearerStatus(\n uint256 _hatId,\n address _wearer,\n bool _eligible,\n bool _standing\n ) external returns (bool updated);\n\n function checkHatWearerStatus(\n uint256 _hatId,\n address _wearer\n ) external returns (bool updated);\n\n function renounceHat(uint256 _hatId) external;\n\n function transferHat(uint256 _hatId, address _from, address _to) external;\n\n /*//////////////////////////////////////////////////////////////\n HATS ADMIN FUNCTIONS\n //////////////////////////////////////////////////////////////*/\n\n function makeHatImmutable(uint256 _hatId) external;\n\n function changeHatDetails(\n uint256 _hatId,\n string memory _newDetails\n ) external;\n\n function changeHatEligibility(\n uint256 _hatId,\n address _newEligibility\n ) external;\n\n function changeHatToggle(uint256 _hatId, address _newToggle) external;\n\n function changeHatImageURI(\n uint256 _hatId,\n string memory _newImageURI\n ) external;\n\n function changeHatMaxSupply(uint256 _hatId, uint32 _newMaxSupply) external;\n\n function requestLinkTopHatToTree(\n uint32 _topHatId,\n uint256 _newAdminHat\n ) external;\n\n function approveLinkTopHatToTree(\n uint32 _topHatId,\n uint256 _newAdminHat,\n address _eligibility,\n address _toggle,\n string calldata _details,\n string calldata _imageURI\n ) external;\n\n function unlinkTopHatFromTree(uint32 _topHatId, address _wearer) external;\n\n function relinkTopHatWithinTree(\n uint32 _topHatDomain,\n uint256 _newAdminHat,\n address _eligibility,\n address _toggle,\n string calldata _details,\n string calldata _imageURI\n ) external;\n\n /*//////////////////////////////////////////////////////////////\n VIEW FUNCTIONS\n //////////////////////////////////////////////////////////////*/\n\n function viewHat(\n uint256 _hatId\n )\n external\n view\n returns (\n string memory details,\n uint32 maxSupply,\n uint32 supply,\n address eligibility,\n address toggle,\n string memory imageURI,\n uint16 lastHatId,\n bool mutable_,\n bool active\n );\n\n function isWearerOfHat(\n address _user,\n uint256 _hatId\n ) external view returns (bool isWearer);\n\n function isAdminOfHat(\n address _user,\n uint256 _hatId\n ) external view returns (bool isAdmin);\n\n function isInGoodStanding(\n address _wearer,\n uint256 _hatId\n ) external view returns (bool standing);\n\n function isEligible(\n address _wearer,\n uint256 _hatId\n ) external view returns (bool eligible);\n\n function getHatEligibilityModule(\n uint256 _hatId\n ) external view returns (address eligibility);\n\n function getHatToggleModule(\n uint256 _hatId\n ) external view returns (address toggle);\n\n function getHatMaxSupply(\n uint256 _hatId\n ) external view returns (uint32 maxSupply);\n\n function hatSupply(uint256 _hatId) external view returns (uint32 supply);\n\n function getImageURIForHat(\n uint256 _hatId\n ) external view returns (string memory _uri);\n\n function balanceOf(\n address wearer,\n uint256 hatId\n ) external view returns (uint256 balance);\n\n function balanceOfBatch(\n address[] calldata _wearers,\n uint256[] calldata _hatIds\n ) external view returns (uint256[] memory);\n\n function uri(uint256 id) external view returns (string memory _uri);\n}\n" + }, + "contracts/interfaces/hats/IHatsIdUtilities.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\n// Copyright (C) 2023 Haberdasher Labs\n//\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU Affero General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU Affero General Public License for more details.\n//\n// You should have received a copy of the GNU Affero General Public License\n// along with this program. If not, see .\n\npragma solidity >=0.8.13;\n\ninterface IHatsIdUtilities {\n function buildHatId(\n uint256 _admin,\n uint16 _newHat\n ) external pure returns (uint256 id);\n\n function getHatLevel(uint256 _hatId) external view returns (uint32 level);\n\n function getLocalHatLevel(\n uint256 _hatId\n ) external pure returns (uint32 level);\n\n function isTopHat(uint256 _hatId) external view returns (bool _topHat);\n\n function isLocalTopHat(\n uint256 _hatId\n ) external pure returns (bool _localTopHat);\n\n function isValidHatId(\n uint256 _hatId\n ) external view returns (bool validHatId);\n\n function getAdminAtLevel(\n uint256 _hatId,\n uint32 _level\n ) external view returns (uint256 admin);\n\n function getAdminAtLocalLevel(\n uint256 _hatId,\n uint32 _level\n ) external pure returns (uint256 admin);\n\n function getTopHatDomain(\n uint256 _hatId\n ) external view returns (uint32 domain);\n\n function getTippyTopHatDomain(\n uint32 _topHatDomain\n ) external view returns (uint32 domain);\n\n function noCircularLinkage(\n uint32 _topHatDomain,\n uint256 _linkedAdmin\n ) external view returns (bool notCircular);\n\n function sameTippyTopHatDomain(\n uint32 _topHatDomain,\n uint256 _newAdminHat\n ) external view returns (bool sameDomain);\n}\n" + }, + "contracts/interfaces/hats/IHatsModuleFactory.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\ninterface IHatsModuleFactory {\n error HatsModuleFactory_ModuleAlreadyDeployed(\n address implementation,\n uint256 hatId,\n bytes otherImmutableArgs,\n uint256 saltNonce\n );\n\n error BatchArrayLengthMismatch();\n\n event HatsModuleFactory_ModuleDeployed(\n address implementation,\n address instance,\n uint256 hatId,\n bytes otherImmutableArgs,\n bytes initData,\n uint256 saltNonce\n );\n\n function HATS() external view returns (address);\n\n function version() external view returns (string memory);\n\n function createHatsModule(\n address _implementation,\n uint256 _hatId,\n bytes calldata _otherImmutableArgs,\n bytes calldata _initData,\n uint256 _saltNonce\n ) external returns (address _instance);\n\n function batchCreateHatsModule(\n address[] calldata _implementations,\n uint256[] calldata _hatIds,\n bytes[] calldata _otherImmutableArgsArray,\n bytes[] calldata _initDataArray,\n uint256[] calldata _saltNonces\n ) external returns (bool success);\n\n function getHatsModuleAddress(\n address _implementation,\n uint256 _hatId,\n bytes calldata _otherImmutableArgs,\n uint256 _saltNonce\n ) external view returns (address);\n\n function deployed(\n address _implementation,\n uint256 _hatId,\n bytes calldata _otherImmutableArgs,\n uint256 _saltNonce\n ) external view returns (bool);\n}\n" + }, + "contracts/interfaces/hats/modules/IHatsElectionsEligibility.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.13;\n\ninterface IHatsElectionsEligibility {\n event ElectionOpened(uint128 nextTermEnd);\n event ElectionCompleted(uint128 termEnd, address[] winners);\n event NewTermStarted(uint128 termEnd);\n event Recalled(uint128 termEnd, address[] accounts);\n\n /// @notice Returns the first second after the current term ends.\n /// @dev Also serves as the id for the current term.\n function currentTermEnd() external view returns (uint128);\n\n /// @notice Returns the first second after the next term ends.\n /// @dev Also serves as the id for the next term.\n function nextTermEnd() external view returns (uint128);\n\n /// @notice Returns the election status (open or closed) for a given term end.\n /// @param termEnd The term end timestamp to query.\n function electionStatus(\n uint128 termEnd\n ) external view returns (bool isElectionOpen);\n\n /// @notice Returns whether a candidate was elected in a given term.\n /// @param termEnd The term end timestamp to query.\n /// @param candidate The address of the candidate.\n function electionResults(\n uint128 termEnd,\n address candidate\n ) external view returns (bool elected);\n\n /// @notice Returns the BALLOT_BOX_HAT constant.\n function BALLOT_BOX_HAT() external pure returns (uint256);\n\n /// @notice Returns the ADMIN_HAT constant.\n function ADMIN_HAT() external pure returns (uint256);\n\n /**\n * @notice Submit the results of an election for a specified term.\n * @dev Only callable by the wearer(s) of the BALLOT_BOX_HAT.\n * @param _termEnd The id of the term for which the election results are being submitted.\n * @param _winners The addresses of the winners of the election.\n */\n function elect(uint128 _termEnd, address[] calldata _winners) external;\n\n /**\n * @notice Submit the results of a recall election for a specified term.\n * @dev Only callable by the wearer(s) of the BALLOT_BOX_HAT.\n * @param _termEnd The id of the term for which the recall results are being submitted.\n * @param _recallees The addresses to be recalled.\n */\n function recall(uint128 _termEnd, address[] calldata _recallees) external;\n\n /**\n * @notice Set the next term and open the election for it.\n * @dev Only callable by the wearer(s) of the ADMIN_HAT.\n * @param _newTermEnd The id of the term that will be opened.\n */\n function setNextTerm(uint128 _newTermEnd) external;\n\n /**\n * @notice Start the next term, updating the current term.\n * @dev Can be called by anyone, but will revert if conditions are not met.\n */\n function startNextTerm() external;\n\n /**\n * @notice Determine the eligibility and standing of a wearer for a hat.\n * @param _wearer The address of the hat wearer.\n * @param _hatId The ID of the hat.\n * @return eligible True if the wearer is eligible for the hat.\n * @return standing True if the wearer is in good standing.\n */\n function getWearerStatus(\n address _wearer,\n uint256 _hatId\n ) external view returns (bool eligible, bool standing);\n}\n" + }, + "contracts/interfaces/IERC6551Registry.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IERC6551Registry {\n /**\n * @dev Creates a token bound account for a non-fungible token.\n *\n * If account has already been created, returns the account address without calling create2.\n *\n * Emits ERC6551AccountCreated event.\n *\n * @return account The address of the token bound account\n */\n function createAccount(\n address implementation,\n bytes32 salt,\n uint256 chainId,\n address tokenContract,\n uint256 tokenId\n ) external returns (address account);\n}\n" + }, + "contracts/interfaces/sablier/IAdminable.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\npragma solidity >=0.8.22;\n\n/// @title IAdminable\n/// @notice Contract module that provides a basic access control mechanism, with an admin that can be\n/// granted exclusive access to specific functions. The inheriting contract must set the initial admin\n/// in the constructor.\ninterface IAdminable {\n /*//////////////////////////////////////////////////////////////////////////\n EVENTS\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @notice Emitted when the admin is transferred.\n /// @param oldAdmin The address of the old admin.\n /// @param newAdmin The address of the new admin.\n event TransferAdmin(address indexed oldAdmin, address indexed newAdmin);\n\n /*//////////////////////////////////////////////////////////////////////////\n CONSTANT FUNCTIONS\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @notice The address of the admin account or contract.\n function admin() external view returns (address);\n\n /*//////////////////////////////////////////////////////////////////////////\n NON-CONSTANT FUNCTIONS\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @notice Transfers the contract admin to a new address.\n ///\n /// @dev Notes:\n /// - Does not revert if the admin is the same.\n /// - This function can potentially leave the contract without an admin, thereby removing any\n /// functionality that is only available to the admin.\n ///\n /// Requirements:\n /// - `msg.sender` must be the contract admin.\n ///\n /// @param newAdmin The address of the new admin.\n function transferAdmin(address newAdmin) external;\n}\n" + }, + "contracts/interfaces/sablier/IERC4096.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 \"@openzeppelin/contracts/interfaces/IERC165.sol\";\nimport {IERC721} from \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\n\n/// @title ERC-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" + }, + "contracts/interfaces/sablier/ISablierV2Lockup.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\npragma solidity >=0.8.22;\n\nimport {IERC4906} from \"./IERC4096.sol\";\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {IERC721Metadata} from \"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\";\nimport {UD60x18} from \"@prb/math/src/UD60x18.sol\";\n\nimport {Lockup} from \"./types/DataTypes.sol\";\nimport {IAdminable} from \"./IAdminable.sol\";\nimport {ISablierV2NFTDescriptor} from \"./ISablierV2NFTDescriptor.sol\";\n\n/// @title ISablierV2Lockup\n/// @notice Common logic between all Sablier V2 Lockup contracts.\ninterface ISablierV2Lockup is\n IAdminable, // 0 inherited components\n IERC4906, // 2 inherited components\n IERC721Metadata // 2 inherited components\n{\n /*//////////////////////////////////////////////////////////////////////////\n EVENTS\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @notice Emitted when the admin allows a new recipient contract to hook to Sablier.\n /// @param admin The address of the current contract admin.\n /// @param recipient The address of the recipient contract put on the allowlist.\n event AllowToHook(address indexed admin, address recipient);\n\n /// @notice Emitted when a stream is canceled.\n /// @param streamId The ID of the stream.\n /// @param sender The address of the stream's sender.\n /// @param recipient The address of the stream's recipient.\n /// @param asset The contract address of the ERC-20 asset to be distributed.\n /// @param senderAmount The amount of assets refunded to the stream's sender, denoted in units of the asset's\n /// decimals.\n /// @param recipientAmount The amount of assets left for the stream's recipient to withdraw, denoted in units of the\n /// asset's decimals.\n event CancelLockupStream(\n uint256 streamId,\n address indexed sender,\n address indexed recipient,\n IERC20 indexed asset,\n uint128 senderAmount,\n uint128 recipientAmount\n );\n\n /// @notice Emitted when a sender gives up the right to cancel a stream.\n /// @param streamId The ID of the stream.\n event RenounceLockupStream(uint256 indexed streamId);\n\n /// @notice Emitted when the admin sets a new NFT descriptor contract.\n /// @param admin The address of the current contract admin.\n /// @param oldNFTDescriptor The address of the old NFT descriptor contract.\n /// @param newNFTDescriptor The address of the new NFT descriptor contract.\n event SetNFTDescriptor(\n address indexed admin,\n ISablierV2NFTDescriptor oldNFTDescriptor,\n ISablierV2NFTDescriptor newNFTDescriptor\n );\n\n /// @notice Emitted when assets are withdrawn from a stream.\n /// @param streamId The ID of the stream.\n /// @param to The address that has received the withdrawn assets.\n /// @param asset The contract address of the ERC-20 asset to be distributed.\n /// @param amount The amount of assets withdrawn, denoted in units of the asset's decimals.\n event WithdrawFromLockupStream(\n uint256 indexed streamId,\n address indexed to,\n IERC20 indexed asset,\n uint128 amount\n );\n\n /*//////////////////////////////////////////////////////////////////////////\n CONSTANT FUNCTIONS\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @notice Retrieves the address of the ERC-20 asset to be distributed.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function getAsset(uint256 streamId) external view returns (IERC20 asset);\n\n /// @notice Retrieves the amount deposited in the stream, denoted in units of the asset's decimals.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function getDepositedAmount(\n uint256 streamId\n ) external view returns (uint128 depositedAmount);\n\n /// @notice Retrieves the stream's end time, which is a Unix timestamp.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function getEndTime(\n uint256 streamId\n ) external view returns (uint40 endTime);\n\n /// @notice Retrieves the stream's recipient.\n /// @dev Reverts if the NFT has been burned.\n /// @param streamId The stream ID for the query.\n function getRecipient(\n uint256 streamId\n ) external view returns (address recipient);\n\n /// @notice Retrieves the amount refunded to the sender after a cancellation, denoted in units of the asset's\n /// decimals. This amount is always zero unless the stream was canceled.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function getRefundedAmount(\n uint256 streamId\n ) external view returns (uint128 refundedAmount);\n\n /// @notice Retrieves the stream's sender.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function getSender(uint256 streamId) external view returns (address sender);\n\n /// @notice Retrieves the stream's start time, which is a Unix timestamp.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function getStartTime(\n uint256 streamId\n ) external view returns (uint40 startTime);\n\n /// @notice Retrieves the amount withdrawn from the stream, denoted in units of the asset's decimals.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function getWithdrawnAmount(\n uint256 streamId\n ) external view returns (uint128 withdrawnAmount);\n\n /// @notice Retrieves a flag indicating whether the provided address is a contract allowed to hook to Sablier\n /// when a stream is canceled or when assets are withdrawn.\n /// @dev See {ISablierLockupRecipient} for more information.\n function isAllowedToHook(\n address recipient\n ) external view returns (bool result);\n\n /// @notice Retrieves a flag indicating whether the stream can be canceled. When the stream is cold, this\n /// flag is always `false`.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function isCancelable(uint256 streamId) external view returns (bool result);\n\n /// @notice Retrieves a flag indicating whether the stream is cold, i.e. settled, canceled, or depleted.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function isCold(uint256 streamId) external view returns (bool result);\n\n /// @notice Retrieves a flag indicating whether the stream is depleted.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function isDepleted(uint256 streamId) external view returns (bool result);\n\n /// @notice Retrieves a flag indicating whether the stream exists.\n /// @dev Does not revert if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function isStream(uint256 streamId) external view returns (bool result);\n\n /// @notice Retrieves a flag indicating whether the stream NFT can be transferred.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function isTransferable(\n uint256 streamId\n ) external view returns (bool result);\n\n /// @notice Retrieves a flag indicating whether the stream is warm, i.e. either pending or streaming.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function isWarm(uint256 streamId) external view returns (bool result);\n\n /// @notice Retrieves the maximum broker fee that can be charged by the broker, denoted as a fixed-point\n /// number where 1e18 is 100%.\n /// @dev This value is hard coded as a constant.\n function MAX_BROKER_FEE() external view returns (UD60x18);\n\n /// @notice Counter for stream IDs, used in the create functions.\n function nextStreamId() external view returns (uint256);\n\n /// @notice Contract that generates the non-fungible token URI.\n function nftDescriptor() external view returns (ISablierV2NFTDescriptor);\n\n /// @notice Calculates the amount that the sender would be refunded if the stream were canceled, denoted in units\n /// of the asset's decimals.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function refundableAmountOf(\n uint256 streamId\n ) external view returns (uint128 refundableAmount);\n\n /// @notice Retrieves the stream's status.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function statusOf(\n uint256 streamId\n ) external view returns (Lockup.Status status);\n\n /// @notice Calculates the amount streamed to the recipient, denoted in units of the asset's decimals.\n /// @dev Reverts if `streamId` references a null stream.\n ///\n /// Notes:\n /// - Upon cancellation of the stream, the amount streamed is calculated as the difference between the deposited\n /// amount and the refunded amount. Ultimately, when the stream becomes depleted, the streamed amount is equivalent\n /// to the total amount withdrawn.\n ///\n /// @param streamId The stream ID for the query.\n function streamedAmountOf(\n uint256 streamId\n ) external view returns (uint128 streamedAmount);\n\n /// @notice Retrieves a flag indicating whether the stream was canceled.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function wasCanceled(uint256 streamId) external view returns (bool result);\n\n /// @notice Calculates the amount that the recipient can withdraw from the stream, denoted in units of the asset's\n /// decimals.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function withdrawableAmountOf(\n uint256 streamId\n ) external view returns (uint128 withdrawableAmount);\n\n /*//////////////////////////////////////////////////////////////////////////\n NON-CONSTANT FUNCTIONS\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @notice Allows a recipient contract to hook to Sablier when a stream is canceled or when assets are withdrawn.\n /// Useful for implementing contracts that hold streams on behalf of users, such as vaults or staking contracts.\n ///\n /// @dev Emits an {AllowToHook} event.\n ///\n /// Notes:\n /// - Does not revert if the contract is already on the allowlist.\n /// - This is an irreversible operation. The contract cannot be removed from the allowlist.\n ///\n /// Requirements:\n /// - `msg.sender` must be the contract admin.\n /// - `recipient` must have a non-zero code size.\n /// - `recipient` must implement {ISablierLockupRecipient}.\n ///\n /// @param recipient The address of the contract to allow for hooks.\n function allowToHook(address recipient) external;\n\n /// @notice Burns the NFT associated with the stream.\n ///\n /// @dev Emits a {Transfer} event.\n ///\n /// Requirements:\n /// - Must not be delegate called.\n /// - `streamId` must reference a depleted stream.\n /// - The NFT must exist.\n /// - `msg.sender` must be either the NFT owner or an approved third party.\n ///\n /// @param streamId The ID of the stream NFT to burn.\n function burn(uint256 streamId) external;\n\n /// @notice Cancels the stream and refunds any remaining assets to the sender.\n ///\n /// @dev Emits a {Transfer}, {CancelLockupStream}, and {MetadataUpdate} event.\n ///\n /// Notes:\n /// - If there any assets left for the recipient to withdraw, the stream is marked as canceled. Otherwise, the\n /// stream is marked as depleted.\n /// - This function attempts to invoke a hook on the recipient, if the resolved address is a contract.\n ///\n /// Requirements:\n /// - Must not be delegate called.\n /// - The stream must be warm and cancelable.\n /// - `msg.sender` must be the stream's sender.\n ///\n /// @param streamId The ID of the stream to cancel.\n function cancel(uint256 streamId) external;\n\n /// @notice Cancels multiple streams and refunds any remaining assets to the sender.\n ///\n /// @dev Emits multiple {Transfer}, {CancelLockupStream}, and {MetadataUpdate} events.\n ///\n /// Notes:\n /// - Refer to the notes in {cancel}.\n ///\n /// Requirements:\n /// - All requirements from {cancel} must be met for each stream.\n ///\n /// @param streamIds The IDs of the streams to cancel.\n function cancelMultiple(uint256[] calldata streamIds) external;\n\n /// @notice Removes the right of the stream's sender to cancel the stream.\n ///\n /// @dev Emits a {RenounceLockupStream} and {MetadataUpdate} event.\n ///\n /// Notes:\n /// - This is an irreversible operation.\n ///\n /// Requirements:\n /// - Must not be delegate called.\n /// - `streamId` must reference a warm stream.\n /// - `msg.sender` must be the stream's sender.\n /// - The stream must be cancelable.\n ///\n /// @param streamId The ID of the stream to renounce.\n function renounce(uint256 streamId) external;\n\n /// @notice Sets a new NFT descriptor contract, which produces the URI describing the Sablier stream NFTs.\n ///\n /// @dev Emits a {SetNFTDescriptor} and {BatchMetadataUpdate} event.\n ///\n /// Notes:\n /// - Does not revert if the NFT descriptor is the same.\n ///\n /// Requirements:\n /// - `msg.sender` must be the contract admin.\n ///\n /// @param newNFTDescriptor The address of the new NFT descriptor contract.\n function setNFTDescriptor(\n ISablierV2NFTDescriptor newNFTDescriptor\n ) external;\n\n /// @notice Withdraws the provided amount of assets from the stream to the `to` address.\n ///\n /// @dev Emits a {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} event.\n ///\n /// Notes:\n /// - This function attempts to call a hook on the recipient of the stream, unless `msg.sender` is the recipient.\n ///\n /// Requirements:\n /// - Must not be delegate called.\n /// - `streamId` must not reference a null or depleted stream.\n /// - `to` must not be the zero address.\n /// - `amount` must be greater than zero and must not exceed the withdrawable amount.\n /// - `to` must be the recipient if `msg.sender` is not the stream's recipient or an approved third party.\n ///\n /// @param streamId The ID of the stream to withdraw from.\n /// @param to The address receiving the withdrawn assets.\n /// @param amount The amount to withdraw, denoted in units of the asset's decimals.\n function withdraw(uint256 streamId, address to, uint128 amount) external;\n\n /// @notice Withdraws the maximum withdrawable amount from the stream to the provided address `to`.\n ///\n /// @dev Emits a {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} event.\n ///\n /// Notes:\n /// - Refer to the notes in {withdraw}.\n ///\n /// Requirements:\n /// - Refer to the requirements in {withdraw}.\n ///\n /// @param streamId The ID of the stream to withdraw from.\n /// @param to The address receiving the withdrawn assets.\n /// @return withdrawnAmount The amount withdrawn, denoted in units of the asset's decimals.\n function withdrawMax(\n uint256 streamId,\n address to\n ) external returns (uint128 withdrawnAmount);\n\n /// @notice Withdraws the maximum withdrawable amount from the stream to the current recipient, and transfers the\n /// NFT to `newRecipient`.\n ///\n /// @dev Emits a {WithdrawFromLockupStream} and a {Transfer} event.\n ///\n /// Notes:\n /// - If the withdrawable amount is zero, the withdrawal is skipped.\n /// - Refer to the notes in {withdraw}.\n ///\n /// Requirements:\n /// - `msg.sender` must be the stream's recipient.\n /// - Refer to the requirements in {withdraw}.\n /// - Refer to the requirements in {IERC721.transferFrom}.\n ///\n /// @param streamId The ID of the stream NFT to transfer.\n /// @param newRecipient The address of the new owner of the stream NFT.\n /// @return withdrawnAmount The amount withdrawn, denoted in units of the asset's decimals.\n function withdrawMaxAndTransfer(\n uint256 streamId,\n address newRecipient\n ) external returns (uint128 withdrawnAmount);\n\n /// @notice Withdraws assets from streams to the recipient of each stream.\n ///\n /// @dev Emits multiple {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} events.\n ///\n /// Notes:\n /// - This function attempts to call a hook on the recipient of each stream, unless `msg.sender` is the recipient.\n ///\n /// Requirements:\n /// - Must not be delegate called.\n /// - There must be an equal number of `streamIds` and `amounts`.\n /// - Each stream ID in the array must not reference a null or depleted stream.\n /// - Each amount in the array must be greater than zero and must not exceed the withdrawable amount.\n ///\n /// @param streamIds The IDs of the streams to withdraw from.\n /// @param amounts The amounts to withdraw, denoted in units of the asset's decimals.\n function withdrawMultiple(\n uint256[] calldata streamIds,\n uint128[] calldata amounts\n ) external;\n}\n" + }, + "contracts/interfaces/sablier/ISablierV2LockupLinear.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\npragma solidity >=0.8.22;\n\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\nimport {Lockup, LockupLinear} from \"./types/DataTypes.sol\";\nimport {ISablierV2Lockup} from \"./ISablierV2Lockup.sol\";\n\n/// @title ISablierV2LockupLinear\n/// @notice Creates and manages Lockup streams with a linear distribution function.\ninterface ISablierV2LockupLinear is ISablierV2Lockup {\n /*//////////////////////////////////////////////////////////////////////////\n EVENTS\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @notice Emitted when a stream is created.\n /// @param streamId The ID of the newly created stream.\n /// @param funder The address which funded the stream.\n /// @param sender The address distributing the assets, which will have the ability to cancel the stream.\n /// @param recipient The address receiving the assets.\n /// @param amounts Struct encapsulating (i) the deposit amount, and (ii) the broker fee amount, both denoted\n /// in units of the asset's decimals.\n /// @param asset The contract address of the ERC-20 asset to be distributed.\n /// @param cancelable Boolean indicating whether the stream will be cancelable or not.\n /// @param transferable Boolean indicating whether the stream NFT is transferable or not.\n /// @param timestamps Struct encapsulating (i) the stream's start time, (ii) cliff time, and (iii) end time, all as\n /// Unix timestamps.\n /// @param broker The address of the broker who has helped create the stream, e.g. a front-end website.\n event CreateLockupLinearStream(\n uint256 streamId,\n address funder,\n address indexed sender,\n address indexed recipient,\n Lockup.CreateAmounts amounts,\n IERC20 indexed asset,\n bool cancelable,\n bool transferable,\n LockupLinear.Timestamps timestamps,\n address broker\n );\n\n /*//////////////////////////////////////////////////////////////////////////\n CONSTANT FUNCTIONS\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @notice Retrieves the stream's cliff time, which is a Unix timestamp. A value of zero means there\n /// is no cliff.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function getCliffTime(\n uint256 streamId\n ) external view returns (uint40 cliffTime);\n\n /// @notice Retrieves the full stream details.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n /// @return stream See the documentation in {DataTypes}.\n function getStream(\n uint256 streamId\n ) external view returns (LockupLinear.StreamLL memory stream);\n\n /// @notice Retrieves the stream's start, cliff and end timestamps.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n /// @return timestamps See the documentation in {DataTypes}.\n function getTimestamps(\n uint256 streamId\n ) external view returns (LockupLinear.Timestamps memory timestamps);\n\n /*//////////////////////////////////////////////////////////////////////////\n NON-CONSTANT FUNCTIONS\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @notice Creates a stream by setting the start time to `block.timestamp`, and the end time to\n /// the sum of `block.timestamp` and `params.durations.total`. The stream is funded by `msg.sender` and is wrapped\n /// in an ERC-721 NFT.\n ///\n /// @dev Emits a {Transfer} and {CreateLockupLinearStream} event.\n ///\n /// Requirements:\n /// - All requirements in {createWithTimestamps} must be met for the calculated parameters.\n ///\n /// @param params Struct encapsulating the function parameters, which are documented in {DataTypes}.\n /// @return streamId The ID of the newly created stream.\n function createWithDurations(\n LockupLinear.CreateWithDurations calldata params\n ) external returns (uint256 streamId);\n\n /// @notice Creates a stream with the provided start time and end time. The stream is funded by `msg.sender` and is\n /// wrapped in an ERC-721 NFT.\n ///\n /// @dev Emits a {Transfer} and {CreateLockupLinearStream} event.\n ///\n /// Notes:\n /// - A cliff time of zero means there is no cliff.\n /// - As long as the times are ordered, it is not an error for the start or the cliff time to be in the past.\n ///\n /// Requirements:\n /// - Must not be delegate called.\n /// - `params.totalAmount` must be greater than zero.\n /// - If set, `params.broker.fee` must not be greater than `MAX_BROKER_FEE`.\n /// - `params.timestamps.start` must be greater than zero and less than `params.timestamps.end`.\n /// - If set, `params.timestamps.cliff` must be greater than `params.timestamps.start` and less than\n /// `params.timestamps.end`.\n /// - `params.timestamps.end` must be in the future.\n /// - `params.recipient` must not be the zero address.\n /// - `msg.sender` must have allowed this contract to spend at least `params.totalAmount` assets.\n ///\n /// @param params Struct encapsulating the function parameters, which are documented in {DataTypes}.\n /// @return streamId The ID of the newly created stream.\n function createWithTimestamps(\n LockupLinear.CreateWithTimestamps calldata params\n ) external returns (uint256 streamId);\n}\n" + }, + "contracts/interfaces/sablier/ISablierV2NFTDescriptor.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\npragma solidity >=0.8.22;\n\nimport {IERC721Metadata} from \"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\";\n\n/// @title ISablierV2NFTDescriptor\n/// @notice This contract generates the URI describing the Sablier V2 stream NFTs.\n/// @dev Inspired by Uniswap V3 Positions NFTs.\ninterface ISablierV2NFTDescriptor {\n /// @notice Produces the URI describing a particular stream NFT.\n /// @dev This is a data URI with the JSON contents directly inlined.\n /// @param sablier The address of the Sablier contract the stream was created in.\n /// @param streamId The ID of the stream for which to produce a description.\n /// @return uri The URI of the ERC721-compliant metadata.\n function tokenURI(\n IERC721Metadata sablier,\n uint256 streamId\n ) external view returns (string memory uri);\n}\n" + }, + "contracts/interfaces/sablier/types/DataTypes.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\npragma solidity >=0.8.22;\n\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {UD2x18} from \"@prb/math/src/UD2x18.sol\";\nimport {UD60x18} from \"@prb/math/src/UD60x18.sol\";\n\n// DataTypes.sol\n//\n// This file defines all structs used in V2 Core, most of which are organized under three namespaces:\n//\n// - Lockup\n// - LockupDynamic\n// - LockupLinear\n// - LockupTranched\n//\n// You will notice that some structs contain \"slot\" annotations - they are used to indicate the\n// storage layout of the struct. It is more gas efficient to group small data types together so\n// that they fit in a single 32-byte slot.\n\n/// @notice Struct encapsulating the broker parameters passed to the create functions. Both can be set to zero.\n/// @param account The address receiving the broker's fee.\n/// @param fee The broker's percentage fee from the total amount, denoted as a fixed-point number where 1e18 is 100%.\nstruct Broker {\n address account;\n UD60x18 fee;\n}\n\n/// @notice Namespace for the structs used in both {SablierV2LockupLinear} and {SablierV2LockupDynamic}.\nlibrary Lockup {\n /// @notice Struct encapsulating the deposit, withdrawn, and refunded amounts, all denoted in units of the asset's\n /// decimals.\n /// @dev Because the deposited and the withdrawn amount are often read together, declaring them in the same slot\n /// saves gas.\n /// @param deposited The initial amount deposited in the stream, net of broker fee.\n /// @param withdrawn The cumulative amount withdrawn from the stream.\n /// @param refunded The amount refunded to the sender. Unless the stream was canceled, this is always zero.\n struct Amounts {\n // slot 0\n uint128 deposited;\n uint128 withdrawn;\n // slot 1\n uint128 refunded;\n }\n\n /// @notice Struct encapsulating (i) the deposit amount and (ii) the broker fee amount, both denoted in units of the\n /// asset's decimals.\n /// @param deposit The amount to deposit in the stream.\n /// @param brokerFee The broker fee amount.\n struct CreateAmounts {\n uint128 deposit;\n uint128 brokerFee;\n }\n\n /// @notice Enum representing the different statuses of a stream.\n /// @custom:value0 PENDING Stream created but not started; assets are in a pending state.\n /// @custom:value1 STREAMING Active stream where assets are currently being streamed.\n /// @custom:value2 SETTLED All assets have been streamed; recipient is due to withdraw them.\n /// @custom:value3 CANCELED Canceled stream; remaining assets await recipient's withdrawal.\n /// @custom:value4 DEPLETED Depleted stream; all assets have been withdrawn and/or refunded.\n enum Status {\n PENDING,\n STREAMING,\n SETTLED,\n CANCELED,\n DEPLETED\n }\n\n /// @notice A common data structure to be stored in all {SablierV2Lockup} models.\n /// @dev The fields are arranged like this to save gas via tight variable packing.\n /// @param sender The address distributing the assets, with the ability to cancel the stream.\n /// @param startTime The Unix timestamp indicating the stream's start.\n /// @param endTime The Unix timestamp indicating the stream's end.\n /// @param isCancelable Boolean indicating if the stream is cancelable.\n /// @param wasCanceled Boolean indicating if the stream was canceled.\n /// @param asset The contract address of the ERC-20 asset to be distributed.\n /// @param isDepleted Boolean indicating if the stream is depleted.\n /// @param isStream Boolean indicating if the struct entity exists.\n /// @param isTransferable Boolean indicating if the stream NFT is transferable.\n /// @param amounts Struct encapsulating the deposit, withdrawn, and refunded amounts, all denoted in units of the\n /// asset's decimals.\n struct Stream {\n // slot 0\n address sender;\n uint40 startTime;\n uint40 endTime;\n bool isCancelable;\n bool wasCanceled;\n // slot 1\n IERC20 asset;\n bool isDepleted;\n bool isStream;\n bool isTransferable;\n // slot 2 and 3\n Lockup.Amounts amounts;\n }\n}\n\n/// @notice Namespace for the structs used in {SablierV2LockupDynamic}.\nlibrary LockupDynamic {\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupDynamic.createWithDurations} function.\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\n /// the same as `msg.sender`.\n /// @param recipient The address receiving the assets.\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\n /// broker fee, denoted in units of the asset's decimals.\n /// @param asset The contract address of the ERC-20 asset to be distributed.\n /// @param cancelable Indicates if the stream is cancelable.\n /// @param transferable Indicates if the stream NFT is transferable.\n /// @param segments Segments with durations used to compose the dynamic distribution function. Timestamps are\n /// calculated by starting from `block.timestamp` and adding each duration to the previous timestamp.\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\n struct CreateWithDurations {\n address sender;\n address recipient;\n uint128 totalAmount;\n IERC20 asset;\n bool cancelable;\n bool transferable;\n SegmentWithDuration[] segments;\n Broker broker;\n }\n\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupDynamic.createWithTimestamps} function.\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\n /// the same as `msg.sender`.\n /// @param recipient The address receiving the assets.\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\n /// broker fee, denoted in units of the asset's decimals.\n /// @param asset The contract address of the ERC-20 asset to be distributed.\n /// @param cancelable Indicates if the stream is cancelable.\n /// @param transferable Indicates if the stream NFT is transferable.\n /// @param startTime The Unix timestamp indicating the stream's start.\n /// @param segments Segments used to compose the dynamic distribution function.\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\n struct CreateWithTimestamps {\n address sender;\n address recipient;\n uint128 totalAmount;\n IERC20 asset;\n bool cancelable;\n bool transferable;\n uint40 startTime;\n Segment[] segments;\n Broker broker;\n }\n\n /// @notice Segment struct used in the Lockup Dynamic stream.\n /// @param amount The amount of assets to be streamed in the segment, denoted in units of the asset's decimals.\n /// @param exponent The exponent of the segment, denoted as a fixed-point number.\n /// @param timestamp The Unix timestamp indicating the segment's end.\n struct Segment {\n // slot 0\n uint128 amount;\n UD2x18 exponent;\n uint40 timestamp;\n }\n\n /// @notice Segment struct used at runtime in {SablierV2LockupDynamic.createWithDurations}.\n /// @param amount The amount of assets to be streamed in the segment, denoted in units of the asset's decimals.\n /// @param exponent The exponent of the segment, denoted as a fixed-point number.\n /// @param duration The time difference in seconds between the segment and the previous one.\n struct SegmentWithDuration {\n uint128 amount;\n UD2x18 exponent;\n uint40 duration;\n }\n\n /// @notice Struct encapsulating the full details of a stream.\n /// @dev Extends `Lockup.Stream` by including the recipient and the segments.\n struct StreamLD {\n address sender;\n address recipient;\n uint40 startTime;\n uint40 endTime;\n bool isCancelable;\n bool wasCanceled;\n IERC20 asset;\n bool isDepleted;\n bool isStream;\n bool isTransferable;\n Lockup.Amounts amounts;\n Segment[] segments;\n }\n\n /// @notice Struct encapsulating the LockupDynamic timestamps.\n /// @param start The Unix timestamp indicating the stream's start.\n /// @param end The Unix timestamp indicating the stream's end.\n struct Timestamps {\n uint40 start;\n uint40 end;\n }\n}\n\n/// @notice Namespace for the structs used in {SablierV2LockupLinear}.\nlibrary LockupLinear {\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupLinear.createWithDurations} function.\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\n /// the same as `msg.sender`.\n /// @param recipient The address receiving the assets.\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\n /// broker fee, denoted in units of the asset's decimals.\n /// @param asset The contract address of the ERC-20 asset to be distributed.\n /// @param cancelable Indicates if the stream is cancelable.\n /// @param transferable Indicates if the stream NFT is transferable.\n /// @param durations Struct encapsulating (i) cliff period duration and (ii) total stream duration, both in seconds.\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\n struct CreateWithDurations {\n address sender;\n address recipient;\n uint128 totalAmount;\n IERC20 asset;\n bool cancelable;\n bool transferable;\n Durations durations;\n Broker broker;\n }\n\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupLinear.createWithTimestamps} function.\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\n /// the same as `msg.sender`.\n /// @param recipient The address receiving the assets.\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\n /// broker fee, denoted in units of the asset's decimals.\n /// @param asset The contract address of the ERC-20 asset to be distributed.\n /// @param cancelable Indicates if the stream is cancelable.\n /// @param transferable Indicates if the stream NFT is transferable.\n /// @param timestamps Struct encapsulating (i) the stream's start time, (ii) cliff time, and (iii) end time, all as\n /// Unix timestamps.\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\n struct CreateWithTimestamps {\n address sender;\n address recipient;\n uint128 totalAmount;\n IERC20 asset;\n bool cancelable;\n bool transferable;\n Timestamps timestamps;\n Broker broker;\n }\n\n /// @notice Struct encapsulating the cliff duration and the total duration.\n /// @param cliff The cliff duration in seconds.\n /// @param total The total duration in seconds.\n struct Durations {\n uint40 cliff;\n uint40 total;\n }\n\n /// @notice Struct encapsulating the full details of a stream.\n /// @dev Extends `Lockup.Stream` by including the recipient and the cliff time.\n struct StreamLL {\n address sender;\n address recipient;\n uint40 startTime;\n bool isCancelable;\n bool wasCanceled;\n IERC20 asset;\n uint40 endTime;\n bool isDepleted;\n bool isStream;\n bool isTransferable;\n Lockup.Amounts amounts;\n uint40 cliffTime;\n }\n\n /// @notice Struct encapsulating the LockupLinear timestamps.\n /// @param start The Unix timestamp for the stream's start.\n /// @param cliff The Unix timestamp for the cliff period's end. A value of zero means there is no cliff.\n /// @param end The Unix timestamp for the stream's end.\n struct Timestamps {\n uint40 start;\n uint40 cliff;\n uint40 end;\n }\n}\n\n/// @notice Namespace for the structs used in {SablierV2LockupTranched}.\nlibrary LockupTranched {\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupTranched.createWithDurations} function.\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\n /// the same as `msg.sender`.\n /// @param recipient The address receiving the assets.\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\n /// broker fee, denoted in units of the asset's decimals.\n /// @param asset The contract address of the ERC-20 asset to be distributed.\n /// @param cancelable Indicates if the stream is cancelable.\n /// @param transferable Indicates if the stream NFT is transferable.\n /// @param tranches Tranches with durations used to compose the tranched distribution function. Timestamps are\n /// calculated by starting from `block.timestamp` and adding each duration to the previous timestamp.\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\n struct CreateWithDurations {\n address sender;\n address recipient;\n uint128 totalAmount;\n IERC20 asset;\n bool cancelable;\n bool transferable;\n TrancheWithDuration[] tranches;\n Broker broker;\n }\n\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupTranched.createWithTimestamps} function.\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\n /// the same as `msg.sender`.\n /// @param recipient The address receiving the assets.\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\n /// broker fee, denoted in units of the asset's decimals.\n /// @param asset The contract address of the ERC-20 asset to be distributed.\n /// @param cancelable Indicates if the stream is cancelable.\n /// @param transferable Indicates if the stream NFT is transferable.\n /// @param startTime The Unix timestamp indicating the stream's start.\n /// @param tranches Tranches used to compose the tranched distribution function.\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\n struct CreateWithTimestamps {\n address sender;\n address recipient;\n uint128 totalAmount;\n IERC20 asset;\n bool cancelable;\n bool transferable;\n uint40 startTime;\n Tranche[] tranches;\n Broker broker;\n }\n\n /// @notice Struct encapsulating the full details of a stream.\n /// @dev Extends `Lockup.Stream` by including the recipient and the tranches.\n struct StreamLT {\n address sender;\n address recipient;\n uint40 startTime;\n uint40 endTime;\n bool isCancelable;\n bool wasCanceled;\n IERC20 asset;\n bool isDepleted;\n bool isStream;\n bool isTransferable;\n Lockup.Amounts amounts;\n Tranche[] tranches;\n }\n\n /// @notice Struct encapsulating the LockupTranched timestamps.\n /// @param start The Unix timestamp indicating the stream's start.\n /// @param end The Unix timestamp indicating the stream's end.\n struct Timestamps {\n uint40 start;\n uint40 end;\n }\n\n /// @notice Tranche struct used in the Lockup Tranched stream.\n /// @param amount The amount of assets to be unlocked in the tranche, denoted in units of the asset's decimals.\n /// @param timestamp The Unix timestamp indicating the tranche's end.\n struct Tranche {\n // slot 0\n uint128 amount;\n uint40 timestamp;\n }\n\n /// @notice Tranche struct used at runtime in {SablierV2LockupTranched.createWithDurations}.\n /// @param amount The amount of assets to be unlocked in the tranche, denoted in units of the asset's decimals.\n /// @param duration The time difference in seconds between the tranche and the previous one.\n struct TrancheWithDuration {\n uint128 amount;\n uint40 duration;\n }\n}\n" + }, + "contracts/mocks/ERC6551Registry.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IERC6551Registry {\n /**\n * @dev The registry MUST emit the ERC6551AccountCreated event upon successful account creation.\n */\n event ERC6551AccountCreated(\n address account,\n address indexed implementation,\n bytes32 salt,\n uint256 chainId,\n address indexed tokenContract,\n uint256 indexed tokenId\n );\n\n /**\n * @dev The registry MUST revert with AccountCreationFailed error if the create2 operation fails.\n */\n error AccountCreationFailed();\n\n /**\n * @dev Creates a token bound account for a non-fungible token.\n *\n * If account has already been created, returns the account address without calling create2.\n *\n * Emits ERC6551AccountCreated event.\n *\n * @return account The address of the token bound account\n */\n function createAccount(\n address implementation,\n bytes32 salt,\n uint256 chainId,\n address tokenContract,\n uint256 tokenId\n ) external returns (address account);\n\n /**\n * @dev Returns the computed token bound account address for a non-fungible token.\n *\n * @return account The address of the token bound account\n */\n function account(\n address implementation,\n bytes32 salt,\n uint256 chainId,\n address tokenContract,\n uint256 tokenId\n ) external view returns (address account);\n}\n\ncontract ERC6551Registry is IERC6551Registry {\n function createAccount(\n address implementation,\n bytes32 salt,\n uint256 chainId,\n address tokenContract,\n uint256 tokenId\n ) external returns (address) {\n assembly {\n // Memory Layout:\n // ----\n // 0x00 0xff (1 byte)\n // 0x01 registry (address) (20 bytes)\n // 0x15 salt (bytes32) (32 bytes)\n // 0x35 Bytecode Hash (bytes32) (32 bytes)\n // ----\n // 0x55 ERC-1167 Constructor + Header (20 bytes)\n // 0x69 implementation (address) (20 bytes)\n // 0x5D ERC-1167 Footer (15 bytes)\n // 0x8C salt (uint256) (32 bytes)\n // 0xAC chainId (uint256) (32 bytes)\n // 0xCC tokenContract (address) (32 bytes)\n // 0xEC tokenId (uint256) (32 bytes)\n\n // Silence unused variable warnings\n pop(chainId)\n\n // Copy bytecode + constant data to memory\n calldatacopy(0x8c, 0x24, 0x80) // salt, chainId, tokenContract, tokenId\n mstore(0x6c, 0x5af43d82803e903d91602b57fd5bf3) // ERC-1167 footer\n mstore(0x5d, implementation) // implementation\n mstore(0x49, 0x3d60ad80600a3d3981f3363d3d373d3d3d363d73) // ERC-1167 constructor + header\n\n // Copy create2 computation data to memory\n mstore8(0x00, 0xff) // 0xFF\n mstore(0x35, keccak256(0x55, 0xb7)) // keccak256(bytecode)\n mstore(0x01, shl(96, address())) // registry address\n mstore(0x15, salt) // salt\n\n // Compute account address\n let computed := keccak256(0x00, 0x55)\n\n // If the account has not yet been deployed\n if iszero(extcodesize(computed)) {\n // Deploy account contract\n let deployed := create2(0, 0x55, 0xb7, salt)\n\n // Revert if the deployment fails\n if iszero(deployed) {\n mstore(0x00, 0x20188a59) // `AccountCreationFailed()`\n revert(0x1c, 0x04)\n }\n\n // Store account address in memory before salt and chainId\n mstore(0x6c, deployed)\n\n // Emit the ERC6551AccountCreated event\n log4(\n 0x6c,\n 0x60,\n // `ERC6551AccountCreated(address,address,bytes32,uint256,address,uint256)`\n 0x79f19b3655ee38b1ce526556b7731a20c8f218fbda4a3990b6cc4172fdf88722,\n implementation,\n tokenContract,\n tokenId\n )\n\n // Return the account address\n return(0x6c, 0x20)\n }\n\n // Otherwise, return the computed account address\n mstore(0x00, shr(96, shl(96, computed)))\n return(0x00, 0x20)\n }\n }\n\n function account(\n address implementation,\n bytes32 salt,\n uint256 chainId,\n address tokenContract,\n uint256 tokenId\n ) external view returns (address) {\n assembly {\n // Silence unused variable warnings\n pop(chainId)\n pop(tokenContract)\n pop(tokenId)\n\n // Copy bytecode + constant data to memory\n calldatacopy(0x8c, 0x24, 0x80) // salt, chainId, tokenContract, tokenId\n mstore(0x6c, 0x5af43d82803e903d91602b57fd5bf3) // ERC-1167 footer\n mstore(0x5d, implementation) // implementation\n mstore(0x49, 0x3d60ad80600a3d3981f3363d3d373d3d3d363d73) // ERC-1167 constructor + header\n\n // Copy create2 computation data to memory\n mstore8(0x00, 0xff) // 0xFF\n mstore(0x35, keccak256(0x55, 0xb7)) // keccak256(bytecode)\n mstore(0x01, shl(96, address())) // registry address\n mstore(0x15, salt) // salt\n\n // Store computed account address in memory\n mstore(0x00, shr(96, shl(96, keccak256(0x00, 0x55))))\n\n // Return computed account address\n return(0x00, 0x20)\n }\n }\n}\n" + }, + "contracts/mocks/MockContract.sol": { + "content": "//SPDX-License-Identifier: Unlicense\n\npragma solidity ^0.8.19;\n\n/**\n * Mock contract for testing\n */\ncontract MockContract {\n event DidSomething(string message);\n\n error Reverting();\n\n function doSomething() public {\n doSomethingWithParam(\"doSomething()\");\n }\n\n function doSomethingWithParam(string memory _message) public {\n emit DidSomething(_message);\n }\n\n function returnSomething(string memory _s)\n external\n pure\n returns (string memory)\n {\n return _s;\n }\n\n function revertSomething() external pure {\n revert Reverting();\n }\n}\n" + }, + "contracts/mocks/MockDecentHatsUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.28;\n\nimport {DecentHatsModuleUtils} from \"../modules/DecentHatsModuleUtils.sol\";\n\ncontract MockDecentHatsModuleUtils is DecentHatsModuleUtils {\n // Expose the internal _processHat function for testing\n function processRoleHats(CreateRoleHatsParams calldata params) external {\n _processRoleHats(params);\n }\n}\n" + }, + "contracts/mocks/MockHatsElectionsEligibility.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\nimport {IHatsElectionsEligibility} from \"../interfaces/hats/modules/IHatsElectionsEligibility.sol\";\n\ncontract MockHatsElectionsEligibility is IHatsElectionsEligibility {\n // Storage\n mapping(uint128 termEnd => mapping(address candidates => bool elected))\n public electionResults;\n mapping(uint128 termEnd => bool isElectionOpen) public electionStatus;\n uint128 public currentTermEnd;\n uint128 public nextTermEnd;\n\n // Errors\n error AlreadySetup();\n error ElectionNotOpen();\n error InvalidTermEnd();\n error NoActiveElection();\n error ElectionClosed(uint128 termEnd);\n error TermNotEnded();\n error NextTermNotReady();\n error TooManyWinners();\n\n modifier onlyOnce() {\n if (currentTermEnd != 0) revert AlreadySetup();\n _;\n }\n\n function _setUp(bytes calldata _initData) external onlyOnce {\n // decode init data\n uint128 _firstTermEnd = abi.decode(_initData, (uint128));\n require(\n _firstTermEnd > block.timestamp,\n \"First term must end in the future\"\n );\n\n currentTermEnd = _firstTermEnd;\n\n // open the first election\n electionStatus[_firstTermEnd] = true;\n\n // log the first term\n emit ElectionOpened(_firstTermEnd);\n }\n\n function elect(uint128 _termEnd, address[] calldata _winners) external {\n // results can only be submitted for open elections\n if (!electionStatus[_termEnd]) revert ElectionClosed(_termEnd);\n\n // close the election\n electionStatus[_termEnd] = false;\n\n // set the election results\n for (uint256 i; i < _winners.length; ) {\n electionResults[_termEnd][_winners[i]] = true;\n\n unchecked {\n ++i;\n }\n }\n\n // log the election results\n emit ElectionCompleted(_termEnd, _winners);\n }\n\n function recall(uint128 _termEnd, address[] calldata _recallees) external {\n // loop through the accounts and set their election status to false\n for (uint256 i; i < _recallees.length; ) {\n electionResults[_termEnd][_recallees[i]] = false;\n\n unchecked {\n ++i;\n }\n }\n\n emit Recalled(_termEnd, _recallees);\n }\n\n function setNextTerm(uint128 _newTermEnd) external {\n // new term must end after current term\n if (_newTermEnd <= currentTermEnd) revert InvalidTermEnd();\n\n // if next term is already set, its election must still be open\n uint128 next = nextTermEnd;\n if (next > 0 && !electionStatus[next]) revert ElectionClosed(next);\n\n // set the next term\n nextTermEnd = _newTermEnd;\n\n // open the next election\n electionStatus[_newTermEnd] = true;\n\n // log the new term\n emit ElectionOpened(_newTermEnd);\n }\n\n function startNextTerm() external {\n // current term must be over\n if (block.timestamp < currentTermEnd) revert TermNotEnded();\n\n uint128 next = nextTermEnd; // save SLOADs\n\n // next term must be set and its election must be closed\n if (next == 0 || electionStatus[next]) revert NextTermNotReady();\n\n // set the current term to the next term\n currentTermEnd = next;\n\n // clear the next term\n nextTermEnd = 0;\n\n // log the change\n emit NewTermStarted(next);\n }\n\n function getWearerStatus(\n address _wearer,\n uint256 /* _hatId */\n ) public view override returns (bool eligible, bool standing) {\n /// @dev This eligibility module is not concerned with standing, so we default it to good standing\n standing = true;\n\n uint128 current = currentTermEnd; // save SLOAD\n\n if (block.timestamp < current) {\n // if the current term is still open, the wearer is eligible if they have been elected for the current term\n eligible = electionResults[current][_wearer];\n }\n // if the current term is closed, the wearer is not eligible\n }\n\n // // Test helper functions\n // function setWearerStatus(address wearer, bool eligible) external {\n // electionResults[currentTermEnd][wearer] = eligible;\n // }\n\n function BALLOT_BOX_HAT() external pure override returns (uint256) {}\n\n function ADMIN_HAT() external pure override returns (uint256) {}\n}\n" + }, + "contracts/mocks/MockHatsModuleFactory.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport {IHatsModuleFactory} from \"../interfaces/hats/IHatsModuleFactory.sol\";\nimport {MockHatsElectionsEligibility} from \"./MockHatsElectionsEligibility.sol\";\n\ncontract MockHatsModuleFactory is IHatsModuleFactory {\n function createHatsModule(\n address,\n uint256,\n bytes calldata,\n bytes calldata _initData,\n uint256\n ) external override returns (address _instance) {\n // Deploy a new instance of MockHatsElectionsEligibility\n MockHatsElectionsEligibility newModule = new MockHatsElectionsEligibility();\n newModule._setUp(_initData);\n _instance = address(newModule);\n }\n\n function getHatsModuleAddress(\n address _implementation,\n uint256 _hatId,\n bytes calldata _otherImmutableArgs,\n uint256 _saltNonce\n ) external view returns (address) {}\n\n function HATS() external view override returns (address) {}\n\n function version() external view override returns (string memory) {}\n\n function batchCreateHatsModule(\n address[] calldata _implementations,\n uint256[] calldata _hatIds,\n bytes[] calldata _otherImmutableArgsArray,\n bytes[] calldata _initDataArray,\n uint256[] calldata _saltNonces\n ) external override returns (bool success) {}\n\n function deployed(\n address _implementation,\n uint256 _hatId,\n bytes calldata _otherImmutableArgs,\n uint256 _saltNonce\n ) external view override returns (bool) {}\n}\n" + }, + "contracts/mocks/MockLockupLinear.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\nlibrary MockLockupLinear {\n struct CreateWithTimestamps {\n address sender;\n address recipient;\n uint128 totalAmount;\n IERC20 asset;\n bool cancelable;\n bool transferable;\n Timestamps timestamps;\n Broker broker;\n }\n\n struct Timestamps {\n uint40 start;\n uint40 cliff;\n uint40 end;\n }\n\n struct Broker {\n address account;\n uint256 fee;\n }\n\n struct Stream {\n address sender;\n uint40 startTime;\n uint40 endTime;\n uint40 cliffTime;\n bool cancelable;\n bool wasCanceled;\n address asset;\n bool transferable;\n uint128 totalAmount;\n address recipient;\n }\n\n /// @notice Enum representing the different statuses of a stream.\n /// @custom:value0 PENDING Stream created but not started; assets are in a pending state.\n /// @custom:value1 STREAMING Active stream where assets are currently being streamed.\n /// @custom:value2 SETTLED All assets have been streamed; recipient is due to withdraw them.\n /// @custom:value3 CANCELED Canceled stream; remaining assets await recipient's withdrawal.\n /// @custom:value4 DEPLETED Depleted stream; all assets have been withdrawn and/or refunded.\n enum Status {\n PENDING,\n STREAMING,\n SETTLED,\n CANCELED,\n DEPLETED\n }\n}\n" + }, + "contracts/mocks/MockSablierV2LockupLinear.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.22;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {ISablierV2LockupLinear} from \"../interfaces/sablier/ISablierV2LockupLinear.sol\";\nimport {MockLockupLinear} from \"./MockLockupLinear.sol\";\n\ncontract MockSablierV2LockupLinear {\n mapping(uint256 => MockLockupLinear.Stream) public streams;\n uint256 public nextStreamId = 1;\n\n // Add this event declaration at the contract level\n event StreamCreated(\n uint256 streamId,\n address indexed sender,\n address indexed recipient,\n uint128 totalAmount,\n address indexed asset,\n bool cancelable,\n bool transferable,\n uint40 startTime,\n uint40 cliffTime,\n uint40 endTime\n );\n\n function createWithTimestamps(\n MockLockupLinear.CreateWithTimestamps calldata params\n ) external returns (uint256 streamId) {\n require(\n params.asset.transferFrom(\n msg.sender,\n address(this),\n params.totalAmount\n ),\n \"Token transfer failed\"\n );\n\n streamId = nextStreamId++;\n streams[streamId] = MockLockupLinear.Stream({\n sender: params.sender,\n recipient: params.recipient,\n totalAmount: params.totalAmount,\n asset: address(params.asset),\n cancelable: params.cancelable,\n wasCanceled: false,\n transferable: params.transferable,\n startTime: params.timestamps.start,\n cliffTime: params.timestamps.cliff,\n endTime: params.timestamps.end\n });\n\n // Emit the StreamCreated event\n emit StreamCreated(\n streamId,\n params.sender,\n params.recipient,\n params.totalAmount,\n address(params.asset),\n params.cancelable,\n params.transferable,\n params.timestamps.start,\n params.timestamps.cliff,\n params.timestamps.end\n );\n\n return streamId;\n }\n\n function getStream(\n uint256 streamId\n ) external view returns (MockLockupLinear.Stream memory) {\n return streams[streamId];\n }\n\n function withdrawableAmountOf(\n uint256 streamId\n ) public view returns (uint128) {\n MockLockupLinear.Stream memory stream = streams[streamId];\n if (block.timestamp <= stream.startTime) {\n return 0;\n }\n if (block.timestamp >= stream.endTime) {\n return stream.totalAmount;\n }\n return\n uint128(\n (stream.totalAmount * (block.timestamp - stream.startTime)) /\n (stream.endTime - stream.startTime)\n );\n }\n\n function withdrawMax(\n uint256 streamId,\n address to\n ) external returns (uint128 withdrawnAmount) {\n withdrawnAmount = withdrawableAmountOf(streamId);\n MockLockupLinear.Stream storage stream = streams[streamId];\n\n require(\n msg.sender == stream.recipient,\n \"Only recipient can call withdraw\"\n );\n require(\n withdrawnAmount <= withdrawableAmountOf(streamId),\n \"Insufficient withdrawable amount\"\n );\n\n stream.totalAmount -= withdrawnAmount;\n IERC20(stream.asset).transfer(to, withdrawnAmount);\n }\n\n function cancel(uint256 streamId) external {\n MockLockupLinear.Stream memory stream = streams[streamId];\n require(stream.cancelable, \"Stream is not cancelable\");\n require(msg.sender == stream.sender, \"Only sender can cancel\");\n\n uint128 withdrawableAmount = withdrawableAmountOf(streamId);\n uint128 refundAmount = stream.totalAmount - withdrawableAmount;\n\n streams[streamId].wasCanceled = true;\n\n if (withdrawableAmount > 0) {\n IERC20(stream.asset).transfer(stream.recipient, withdrawableAmount);\n }\n if (refundAmount > 0) {\n IERC20(stream.asset).transfer(stream.sender, refundAmount);\n }\n }\n\n function isCancelable(uint256 streamId) external view returns (bool) {\n return streams[streamId].cancelable;\n }\n\n /// @dev Retrieves the stream's status without performing a null check.\n function statusOf(\n uint256 streamId\n ) public view returns (MockLockupLinear.Status) {\n uint256 withdrawableAmount = withdrawableAmountOf(streamId);\n if (withdrawableAmount == 0) {\n return MockLockupLinear.Status.DEPLETED;\n } else if (streams[streamId].wasCanceled) {\n return MockLockupLinear.Status.CANCELED;\n }\n\n if (block.timestamp < streams[streamId].startTime) {\n return MockLockupLinear.Status.PENDING;\n }\n\n if (block.timestamp < streams[streamId].endTime) {\n return MockLockupLinear.Status.STREAMING;\n } else {\n return MockLockupLinear.Status.SETTLED;\n }\n }\n}\n" + }, + "contracts/modules/DecentHatsCreationModule.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.28;\n\nimport {Enum} from \"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\";\nimport {IAvatar} from \"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol\";\nimport {Strings} from \"@openzeppelin/contracts/utils/Strings.sol\";\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {IERC6551Registry} from \"../interfaces/IERC6551Registry.sol\";\nimport {IHats} from \"../interfaces/hats/IHats.sol\";\nimport {LockupLinear, Broker} from \"../interfaces/sablier/types/DataTypes.sol\";\nimport {IHatsModuleFactory} from \"../interfaces/hats/IHatsModuleFactory.sol\";\nimport {IHatsElectionsEligibility} from \"../interfaces/hats/modules/IHatsElectionsEligibility.sol\";\nimport {ModuleProxyFactory} from \"@gnosis.pm/zodiac/contracts/factory/ModuleProxyFactory.sol\";\nimport {ISablierV2LockupLinear} from \"../interfaces/sablier/ISablierV2LockupLinear.sol\";\nimport {DecentHatsModuleUtils} from \"./DecentHatsModuleUtils.sol\";\n\ncontract DecentHatsCreationModule is DecentHatsModuleUtils {\n struct TopHatParams {\n string details;\n string imageURI;\n }\n\n struct AdminHatParams {\n string details;\n string imageURI;\n bool isMutable;\n }\n\n struct CreateTreeParams {\n IHats hatsProtocol;\n IERC6551Registry erc6551Registry;\n IHatsModuleFactory hatsModuleFactory;\n ModuleProxyFactory moduleProxyFactory;\n address keyValuePairs;\n address decentAutonomousAdminImplementation;\n address hatsAccountImplementation;\n address hatsElectionsEligibilityImplementation;\n TopHatParams topHat;\n AdminHatParams adminHat;\n HatParams[] hats;\n }\n\n /* /////////////////////////////////////////////////////////////////////////////\n EXTERNAL FUNCTIONS\n ///////////////////////////////////////////////////////////////////////////// */\n /**\n * @notice For a safe without any roles previously created on it, this function should be called. It sets up the\n * top hat and admin hat, as well as any other hats and their streams that are provided, then transfers the top hat\n * to the calling safe.\n *\n * @notice This contract should be enabled a module on the Safe for which the role(s) are to be created, and disabled after.\n *\n * @dev For each hat that is included, if the hat is:\n * - termed, its stream funds on are targeted directly at the nominated wearer. The wearer should directly call `withdraw-`\n * on the Sablier contract.\n * - untermed, its stream funds are targeted at the hat's smart account. In order to withdraw funds from the stream, the\n * hat's smart account must be the one call to `withdraw-` on the Sablier contract, setting the recipient arg to its wearer.\n *\n * @dev In order for a Safe to seamlessly create roles even if it has never previously created a role and thus has\n * no hat tree, we defer the creation of the hat tree and its setup to this contract. This way, in a single tx block,\n * the resulting topHatId of the newly created hat can be used to create an admin hat and any other hats needed.\n * We also make use of `KeyValuePairs` to associate the topHatId with the Safe.\n *\n * @param treeParams The parameters for creating the Hat Tree with Roles\n */\n function createAndDeclareTree(\n CreateTreeParams calldata treeParams\n ) external {\n // Create Top Hat\n (uint256 topHatId, address topHatAccount) = _processTopHat(\n treeParams.hatsProtocol,\n treeParams.erc6551Registry,\n treeParams.hatsAccountImplementation,\n treeParams.keyValuePairs,\n treeParams.topHat\n );\n\n // Create Admin Hat\n uint256 adminHatId = _processAdminHat(\n treeParams.hatsProtocol,\n treeParams.erc6551Registry,\n treeParams.hatsAccountImplementation,\n topHatId,\n topHatAccount,\n treeParams.moduleProxyFactory,\n treeParams.decentAutonomousAdminImplementation,\n treeParams.adminHat\n );\n\n // Create Role Hats\n _processRoleHats(\n CreateRoleHatsParams({\n hatsProtocol: treeParams.hatsProtocol,\n erc6551Registry: treeParams.erc6551Registry,\n hatsAccountImplementation: treeParams.hatsAccountImplementation,\n topHatId: topHatId,\n topHatAccount: topHatAccount,\n hatsModuleFactory: treeParams.hatsModuleFactory,\n hatsElectionsEligibilityImplementation: treeParams\n .hatsElectionsEligibilityImplementation,\n adminHatId: adminHatId,\n hats: treeParams.hats,\n keyValuePairs: treeParams.keyValuePairs\n })\n );\n }\n\n /* /////////////////////////////////////////////////////////////////////////////\n INTERNAL FUNCTIONS\n ///////////////////////////////////////////////////////////////////////////// */\n\n function _processTopHat(\n IHats hatsProtocol,\n IERC6551Registry erc6551Registry,\n address hatsAccountImplementation,\n address keyValuePairs,\n TopHatParams calldata topHat\n ) internal returns (uint256 topHatId, address topHatAccount) {\n // Call lastTopHatId() and properly decode the response\n (bool success, bytes memory data) = address(hatsProtocol).call(\n abi.encodeWithSignature(\"lastTopHatId()\")\n );\n require(success, \"Failed to get lastTopHatId\");\n topHatId = (abi.decode(data, (uint256)) + 1) << 224;\n\n // Mint Top Hat to the Safe\n IAvatar(msg.sender).execTransactionFromModule(\n address(hatsProtocol),\n 0,\n abi.encodeWithSignature(\n \"mintTopHat(address,string,string)\",\n msg.sender,\n topHat.details,\n topHat.imageURI\n ),\n Enum.Operation.Call\n );\n\n // Create Top Hat's ERC6551 Account\n topHatAccount = erc6551Registry.createAccount(\n hatsAccountImplementation,\n SALT,\n block.chainid,\n address(hatsProtocol),\n topHatId\n );\n\n // Declare Top Hat ID to Safe via KeyValuePairs\n string[] memory keys = new string[](1);\n string[] memory values = new string[](1);\n keys[0] = \"topHatId\";\n values[0] = Strings.toString(topHatId);\n IAvatar(msg.sender).execTransactionFromModule(\n keyValuePairs,\n 0,\n abi.encodeWithSignature(\n \"updateValues(string[],string[])\",\n keys,\n values\n ),\n Enum.Operation.Call\n );\n }\n\n function _processAdminHat(\n IHats hatsProtocol,\n IERC6551Registry erc6551Registry,\n address hatsAccountImplementation,\n uint256 topHatId,\n address topHatAccount,\n ModuleProxyFactory moduleProxyFactory,\n address decentAutonomousAdminImplementation,\n AdminHatParams calldata adminHat\n ) internal returns (uint256 adminHatId) {\n // Create Admin Hat\n adminHatId = hatsProtocol.getNextId(topHatId);\n IAvatar(msg.sender).execTransactionFromModule(\n address(hatsProtocol),\n 0,\n abi.encodeWithSignature(\n \"createHat(uint256,string,uint32,address,address,bool,string)\",\n topHatId,\n adminHat.details,\n 1, // only one Admin Hat\n topHatAccount,\n topHatAccount,\n adminHat.isMutable,\n adminHat.imageURI\n ),\n Enum.Operation.Call\n );\n\n // Create Admin Hat's ERC6551 Account\n erc6551Registry.createAccount(\n hatsAccountImplementation,\n SALT,\n block.chainid,\n address(hatsProtocol),\n adminHatId\n );\n\n // Deploy Decent Autonomous Admin Module, which will wear the Admin Hat\n address autonomousAdmin = moduleProxyFactory.deployModule(\n decentAutonomousAdminImplementation,\n abi.encodeWithSignature(\"setUp(bytes)\", bytes(\"\")),\n uint256(\n keccak256(\n abi.encodePacked(\n // for the salt, we'll concatenate our static salt\n // with the Admin Hat ID\n SALT,\n adminHatId\n )\n )\n )\n );\n\n // Mint Hat to the Decent Autonomous Admin Module\n IAvatar(msg.sender).execTransactionFromModule(\n address(hatsProtocol),\n 0,\n abi.encodeWithSignature(\n \"mintHat(uint256,address)\",\n adminHatId,\n autonomousAdmin\n ),\n Enum.Operation.Call\n );\n }\n}\n" + }, + "contracts/modules/DecentHatsModificationModule.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.28;\n\nimport {DecentHatsModuleUtils} from \"./DecentHatsModuleUtils.sol\";\n\ncontract DecentHatsModificationModule is DecentHatsModuleUtils {\n /**\n * @notice Creates a new termed or untermed role hat and any streams on it.\n *\n * @notice This contract should be enabled a module on the Safe for which the role is to be created, and disabled after.\n *\n * @dev Stream funds on untermed Roles are targeted at the hat's smart account. In order to withdraw funds from the stream, the\n * hat's smart account must be the one call to `withdraw-` on the Sablier contract, setting the recipient arg to its wearer.\n *\n * @dev Stream funds on termed Roles are targeted directly at the nominated wearer.\n * The wearer should directly call `withdraw-` on the Sablier contract.\n *\n * @dev Role hat creation, minting, smart account creation and stream creation are handled here in order\n * to avoid a race condition where not more than one active proposal to create a new role can exist at a time.\n * See: https://github.com/decentdao/decent-interface/issues/2402\n *\n * @param roleHatsParams An array of params for each role hat to be created.\n */\n function createRoleHats(\n CreateRoleHatsParams calldata roleHatsParams\n ) external {\n _processRoleHats(roleHatsParams);\n }\n}\n" + }, + "contracts/modules/DecentHatsModuleUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.28;\n\nimport {Enum} from \"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\";\nimport {IAvatar} from \"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol\";\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {IERC6551Registry} from \"../interfaces/IERC6551Registry.sol\";\nimport {IHats} from \"../interfaces/hats/IHats.sol\";\nimport {LockupLinear, Broker} from \"../interfaces/sablier/types/DataTypes.sol\";\nimport {IHatsModuleFactory} from \"../interfaces/hats/IHatsModuleFactory.sol\";\nimport {ISablierV2LockupLinear} from \"../interfaces/sablier/ISablierV2LockupLinear.sol\";\nimport {Strings} from \"@openzeppelin/contracts/utils/Strings.sol\";\n\nabstract contract DecentHatsModuleUtils {\n bytes32 public constant SALT =\n 0x5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b5072;\n\n struct SablierStreamParams {\n ISablierV2LockupLinear sablier;\n address sender;\n address asset;\n LockupLinear.Timestamps timestamps;\n Broker broker;\n uint128 totalAmount;\n bool cancelable;\n bool transferable;\n }\n\n struct HatParams {\n address wearer;\n string details;\n string imageURI;\n SablierStreamParams[] sablierStreamsParams;\n uint128 termEndDateTs; // If 0, this is an untermed Hat\n uint32 maxSupply;\n bool isMutable;\n }\n\n struct CreateRoleHatsParams {\n IHats hatsProtocol;\n IERC6551Registry erc6551Registry;\n address hatsAccountImplementation;\n uint256 topHatId;\n address topHatAccount;\n address keyValuePairs;\n IHatsModuleFactory hatsModuleFactory;\n address hatsElectionsEligibilityImplementation;\n uint256 adminHatId;\n HatParams[] hats;\n }\n\n function _processRoleHats(\n CreateRoleHatsParams memory roleHatsParams\n ) internal {\n for (uint256 i = 0; i < roleHatsParams.hats.length; ) {\n HatParams memory hatParams = roleHatsParams.hats[i];\n\n // Create eligibility module if needed\n address eligibilityAddress = _createEligibilityModule(\n roleHatsParams.hatsProtocol,\n roleHatsParams.hatsModuleFactory,\n roleHatsParams.hatsElectionsEligibilityImplementation,\n roleHatsParams.topHatId,\n roleHatsParams.topHatAccount,\n roleHatsParams.adminHatId,\n hatParams.termEndDateTs\n );\n\n // Create and Mint the Role Hat\n uint256 hatId = _createAndMintHat(\n roleHatsParams.hatsProtocol,\n roleHatsParams.adminHatId,\n hatParams,\n eligibilityAddress,\n roleHatsParams.topHatAccount\n );\n\n // Get the stream recipient (based on termed or not)\n address streamRecipient = _setupStreamRecipient(\n roleHatsParams.erc6551Registry,\n roleHatsParams.hatsAccountImplementation,\n address(roleHatsParams.hatsProtocol),\n hatParams.termEndDateTs,\n hatParams.wearer,\n hatId\n );\n\n // Create streams\n _processSablierStreams(\n hatParams.sablierStreamsParams,\n streamRecipient,\n roleHatsParams.keyValuePairs,\n hatId\n );\n\n unchecked {\n ++i;\n }\n }\n }\n\n function _createEligibilityModule(\n IHats hatsProtocol,\n IHatsModuleFactory hatsModuleFactory,\n address hatsElectionsEligibilityImplementation,\n uint256 topHatId,\n address topHatAccount,\n uint256 adminHatId,\n uint128 termEndDateTs\n ) private returns (address) {\n // If the Hat is termed, create the eligibility module\n if (termEndDateTs != 0) {\n return\n hatsModuleFactory.createHatsModule(\n hatsElectionsEligibilityImplementation,\n hatsProtocol.getNextId(adminHatId),\n abi.encode(topHatId, uint256(0)), // [BALLOT_BOX_ID, ADMIN_HAT_ID]\n abi.encode(termEndDateTs),\n uint256(SALT)\n );\n }\n\n // Otherwise, return the Top Hat account\n return topHatAccount;\n }\n\n function _createAndMintHat(\n IHats hatsProtocol,\n uint256 adminHatId,\n HatParams memory hat,\n address eligibilityAddress,\n address topHatAccount\n ) private returns (uint256) {\n // Grab the next Hat ID (before creating it)\n uint256 hatId = hatsProtocol.getNextId(adminHatId);\n\n // Create the new Hat\n IAvatar(msg.sender).execTransactionFromModule(\n address(hatsProtocol),\n 0,\n abi.encodeWithSignature(\n \"createHat(uint256,string,uint32,address,address,bool,string)\",\n adminHatId,\n hat.details,\n hat.maxSupply,\n eligibilityAddress,\n topHatAccount,\n hat.isMutable,\n hat.imageURI\n ),\n Enum.Operation.Call\n );\n\n // If the Hat is termed, nominate the wearer as the eligible member\n if (hat.termEndDateTs != 0) {\n address[] memory nominatedWearers = new address[](1);\n nominatedWearers[0] = hat.wearer;\n\n IAvatar(msg.sender).execTransactionFromModule(\n eligibilityAddress,\n 0,\n abi.encodeWithSignature(\n \"elect(uint128,address[])\",\n hat.termEndDateTs,\n nominatedWearers\n ),\n Enum.Operation.Call\n );\n }\n\n // Mint the Hat\n IAvatar(msg.sender).execTransactionFromModule(\n address(hatsProtocol),\n 0,\n abi.encodeWithSignature(\n \"mintHat(uint256,address)\",\n hatId,\n hat.wearer\n ),\n Enum.Operation.Call\n );\n return hatId;\n }\n\n // Exists to avoid stack too deep errors\n function _setupStreamRecipient(\n IERC6551Registry erc6551Registry,\n address hatsAccountImplementation,\n address hatsProtocol,\n uint128 termEndDateTs,\n address wearer,\n uint256 hatId\n ) private returns (address) {\n // If the hat is termed, the wearer is the stream recipient\n if (termEndDateTs != 0) {\n return wearer;\n }\n\n // Otherwise, the Hat's smart account is the stream recipient\n return\n erc6551Registry.createAccount(\n hatsAccountImplementation,\n SALT,\n block.chainid,\n hatsProtocol,\n hatId\n );\n }\n\n function _processSablierStreams(\n SablierStreamParams[] memory streamParams,\n address streamRecipient,\n address keyValuePairs,\n uint256 hatId\n ) private {\n for (uint256 i = 0; i < streamParams.length; ) {\n SablierStreamParams memory sablierStreamParams = streamParams[i];\n\n // Approve tokens for Sablier\n IAvatar(msg.sender).execTransactionFromModule(\n sablierStreamParams.asset,\n 0,\n abi.encodeWithSignature(\n \"approve(address,uint256)\",\n sablierStreamParams.sablier,\n sablierStreamParams.totalAmount\n ),\n Enum.Operation.Call\n );\n uint256 streamId = ISablierV2LockupLinear(\n sablierStreamParams.sablier\n ).nextStreamId();\n\n // Proxy the Sablier call through IAvatar\n IAvatar(msg.sender).execTransactionFromModule(\n address(sablierStreamParams.sablier),\n 0,\n abi.encodeWithSignature(\n \"createWithTimestamps((address,address,uint128,address,bool,bool,(uint40,uint40,uint40),(address,uint256)))\",\n LockupLinear.CreateWithTimestamps({\n sender: sablierStreamParams.sender,\n recipient: streamRecipient,\n totalAmount: sablierStreamParams.totalAmount,\n asset: IERC20(sablierStreamParams.asset),\n cancelable: sablierStreamParams.cancelable,\n transferable: sablierStreamParams.transferable,\n timestamps: sablierStreamParams.timestamps,\n broker: sablierStreamParams.broker\n })\n ),\n Enum.Operation.Call\n );\n\n // Update KeyValuePairs with the stream ID and Hat ID\n string[] memory keys = new string[](1);\n string[] memory values = new string[](1);\n keys[0] = \"hatIdToStreamId\";\n values[0] = string(\n abi.encodePacked(\n Strings.toString(hatId),\n \":\",\n Strings.toString(streamId)\n )\n );\n\n IAvatar(msg.sender).execTransactionFromModule(\n keyValuePairs,\n 0,\n abi.encodeWithSignature(\n \"updateValues(string[],string[])\",\n keys,\n values\n ),\n Enum.Operation.Call\n );\n\n unchecked {\n ++i;\n }\n }\n }\n}\n" + }, + "contracts/modules/DecentSablierStreamManagementModule.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.28;\n\nimport {Enum} from \"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\";\nimport {IAvatar} from \"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol\";\nimport {ISablierV2Lockup} from \"../interfaces/sablier/ISablierV2Lockup.sol\";\nimport {Lockup} from \"../interfaces/sablier/types/DataTypes.sol\";\n\ncontract DecentSablierStreamManagementModule {\n function withdrawMaxFromStream(\n ISablierV2Lockup sablier,\n address recipientHatAccount,\n uint256 streamId,\n address to\n ) public {\n // Check if there are funds to withdraw\n if (sablier.withdrawableAmountOf(streamId) == 0) {\n return;\n }\n\n // Proxy the Sablier withdrawMax call through IAvatar (Safe)\n IAvatar(msg.sender).execTransactionFromModule(\n recipientHatAccount,\n 0,\n abi.encodeWithSignature(\n \"execute(address,uint256,bytes,uint8)\",\n address(sablier),\n 0,\n abi.encodeWithSignature(\n \"withdrawMax(uint256,address)\",\n streamId,\n to\n ),\n 0\n ),\n Enum.Operation.Call\n );\n }\n\n function cancelStream(ISablierV2Lockup sablier, uint256 streamId) public {\n // Check if the stream can be cancelled\n Lockup.Status streamStatus = sablier.statusOf(streamId);\n if (\n streamStatus != Lockup.Status.PENDING &&\n streamStatus != Lockup.Status.STREAMING\n ) {\n return;\n }\n\n IAvatar(msg.sender).execTransactionFromModule(\n address(sablier),\n 0,\n abi.encodeWithSignature(\"cancel(uint256)\", streamId),\n Enum.Operation.Call\n );\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 200 + }, + "evmVersion": "paris", + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/deployments/optimism/DecentHatsCreationModule.json b/deployments/optimism/DecentHatsCreationModule.json index 6e76b11..1cc796a 100644 --- a/deployments/optimism/DecentHatsCreationModule.json +++ b/deployments/optimism/DecentHatsCreationModule.json @@ -1,5 +1,5 @@ { - "address": "0x3F852ac21185E62F322F8d0Ca680b06c077280D5", + "address": "0x3D3E9F0d3576a520b12A54e6e79BA2314Fe9ce71", "abi": [ { "inputs": [], @@ -222,28 +222,28 @@ "type": "function" } ], - "transactionHash": "0x339f8dd927312f8a3339d26808069a560c241cc159851de5af3d333579a8e665", + "transactionHash": "0x3bb6bfe58fd898d80c88bbd49e21dd4cf78fd87fbb66309d25fc5d9573a41496", "receipt": { "to": null, "from": "0xb5Ca125166C1987A35EDD550E16846Fa1e1D9bB3", - "contractAddress": "0x3F852ac21185E62F322F8d0Ca680b06c077280D5", - "transactionIndex": 15, - "gasUsed": "1751463", + "contractAddress": "0x3D3E9F0d3576a520b12A54e6e79BA2314Fe9ce71", + "transactionIndex": 12, + "gasUsed": "1887591", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x5c4647916f3cedfd1a08e322937f76cf155ba2639f27988fd8d1a0e071bb15e7", - "transactionHash": "0x339f8dd927312f8a3339d26808069a560c241cc159851de5af3d333579a8e665", + "blockHash": "0x50bc945d70d133c3700bc47d416f252f3a7c95176214a6e48bb08019dacd48af", + "transactionHash": "0x3bb6bfe58fd898d80c88bbd49e21dd4cf78fd87fbb66309d25fc5d9573a41496", "logs": [], - "blockNumber": 127617811, - "cumulativeGasUsed": "3434790", + "blockNumber": 128342611, + "cumulativeGasUsed": "5004257", "status": 1, "byzantium": true }, "args": [], - "numDeployments": 1, - "solcInputHash": "e3ec7808efccf5e6b24e16a29ead3983", - "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"SALT\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"contract IHats\",\"name\":\"hatsProtocol\",\"type\":\"address\"},{\"internalType\":\"contract IERC6551Registry\",\"name\":\"erc6551Registry\",\"type\":\"address\"},{\"internalType\":\"contract IHatsModuleFactory\",\"name\":\"hatsModuleFactory\",\"type\":\"address\"},{\"internalType\":\"contract ModuleProxyFactory\",\"name\":\"moduleProxyFactory\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"keyValuePairs\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"decentAutonomousAdminImplementation\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"hatsAccountImplementation\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"hatsElectionsEligibilityImplementation\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"string\",\"name\":\"details\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"imageURI\",\"type\":\"string\"}],\"internalType\":\"struct DecentHatsCreationModule.TopHatParams\",\"name\":\"topHat\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"string\",\"name\":\"details\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"imageURI\",\"type\":\"string\"},{\"internalType\":\"bool\",\"name\":\"isMutable\",\"type\":\"bool\"}],\"internalType\":\"struct DecentHatsCreationModule.AdminHatParams\",\"name\":\"adminHat\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"wearer\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"details\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"imageURI\",\"type\":\"string\"},{\"components\":[{\"internalType\":\"contract ISablierV2LockupLinear\",\"name\":\"sablier\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint40\",\"name\":\"start\",\"type\":\"uint40\"},{\"internalType\":\"uint40\",\"name\":\"cliff\",\"type\":\"uint40\"},{\"internalType\":\"uint40\",\"name\":\"end\",\"type\":\"uint40\"}],\"internalType\":\"struct LockupLinear.Timestamps\",\"name\":\"timestamps\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"UD60x18\",\"name\":\"fee\",\"type\":\"uint256\"}],\"internalType\":\"struct Broker\",\"name\":\"broker\",\"type\":\"tuple\"},{\"internalType\":\"uint128\",\"name\":\"totalAmount\",\"type\":\"uint128\"},{\"internalType\":\"bool\",\"name\":\"cancelable\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"transferable\",\"type\":\"bool\"}],\"internalType\":\"struct DecentHatsModuleUtils.SablierStreamParams[]\",\"name\":\"sablierStreamsParams\",\"type\":\"tuple[]\"},{\"internalType\":\"uint128\",\"name\":\"termEndDateTs\",\"type\":\"uint128\"},{\"internalType\":\"uint32\",\"name\":\"maxSupply\",\"type\":\"uint32\"},{\"internalType\":\"bool\",\"name\":\"isMutable\",\"type\":\"bool\"}],\"internalType\":\"struct DecentHatsModuleUtils.HatParams[]\",\"name\":\"hats\",\"type\":\"tuple[]\"}],\"internalType\":\"struct DecentHatsCreationModule.CreateTreeParams\",\"name\":\"treeParams\",\"type\":\"tuple\"}],\"name\":\"createAndDeclareTree\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"createAndDeclareTree((address,address,address,address,address,address,address,address,(string,string),(string,string,bool),(address,string,string,(address,address,address,(uint40,uint40,uint40),(address,uint256),uint128,bool,bool)[],uint128,uint32,bool)[]))\":{\"details\":\"For each hat that is included, if the hat is: - termed, its stream funds on are targeted directly at the nominated wearer. The wearer should directly call `withdraw-` on the Sablier contract. - untermed, its stream funds are targeted at the hat's smart account. In order to withdraw funds from the stream, the hat's smart account must be the one call to `withdraw-` on the Sablier contract, setting the recipient arg to its wearer.In order for a Safe to seamlessly create roles even if it has never previously created a role and thus has no hat tree, we defer the creation of the hat tree and its setup to this contract. This way, in a single tx block, the resulting topHatId of the newly created hat can be used to create an admin hat and any other hats needed. We also make use of `KeyValuePairs` to associate the topHatId with the Safe.\",\"params\":{\"treeParams\":\"The parameters for creating the Hat Tree with Roles\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"createAndDeclareTree((address,address,address,address,address,address,address,address,(string,string),(string,string,bool),(address,string,string,(address,address,address,(uint40,uint40,uint40),(address,uint256),uint128,bool,bool)[],uint128,uint32,bool)[]))\":{\"notice\":\"For a safe without any roles previously created on it, this function should be called. It sets up the top hat and admin hat, as well as any other hats and their streams that are provided, then transfers the top hat to the calling safe.This contract should be enabled a module on the Safe for which the role(s) are to be created, and disabled after.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/modules/DecentHatsCreationModule.sol\":\"DecentHatsCreationModule\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\npragma solidity >=0.7.0 <0.9.0;\\n\\n/// @title Enum - Collection of enums\\n/// @author Richard Meissner - \\ncontract Enum {\\n enum Operation {Call, DelegateCall}\\n}\\n\",\"keccak256\":\"0x473e45b1a5cc47be494b0e123c9127f0c11c1e0992a321ae5a644c0bfdb2c14f\",\"license\":\"LGPL-3.0-only\"},\"@gnosis.pm/zodiac/contracts/factory/ModuleProxyFactory.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\npragma solidity >=0.8.0;\\n\\ncontract ModuleProxyFactory {\\n event ModuleProxyCreation(\\n address indexed proxy,\\n address indexed masterCopy\\n );\\n\\n /// `target` can not be zero.\\n error ZeroAddress(address target);\\n\\n /// `address_` is already taken.\\n error TakenAddress(address address_);\\n\\n /// @notice Initialization failed.\\n error FailedInitialization();\\n\\n function createProxy(address target, bytes32 salt)\\n internal\\n returns (address result)\\n {\\n if (address(target) == address(0)) revert ZeroAddress(target);\\n bytes memory deployment = abi.encodePacked(\\n hex\\\"602d8060093d393df3363d3d373d3d3d363d73\\\",\\n target,\\n hex\\\"5af43d82803e903d91602b57fd5bf3\\\"\\n );\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n result := create2(0, add(deployment, 0x20), mload(deployment), salt)\\n }\\n if (result == address(0)) revert TakenAddress(result);\\n }\\n\\n function deployModule(\\n address masterCopy,\\n bytes memory initializer,\\n uint256 saltNonce\\n ) public returns (address proxy) {\\n proxy = createProxy(\\n masterCopy,\\n keccak256(abi.encodePacked(keccak256(initializer), saltNonce))\\n );\\n (bool success, ) = proxy.call(initializer);\\n if (!success) revert FailedInitialization();\\n\\n emit ModuleProxyCreation(proxy, masterCopy);\\n }\\n}\\n\",\"keccak256\":\"0x70f6f1d88cf3382748e58f85ba87279f5bb8761863c293dd8c197a71ff558761\",\"license\":\"LGPL-3.0-only\"},\"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\n\\n/// @title Zodiac Avatar - A contract that manages modules that can execute transactions via this contract.\\npragma solidity >=0.7.0 <0.9.0;\\n\\nimport \\\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\\\";\\n\\ninterface IAvatar {\\n event EnabledModule(address module);\\n event DisabledModule(address module);\\n event ExecutionFromModuleSuccess(address indexed module);\\n event ExecutionFromModuleFailure(address indexed module);\\n\\n /// @dev Enables a module on the avatar.\\n /// @notice Can only be called by the avatar.\\n /// @notice Modules should be stored as a linked list.\\n /// @notice Must emit EnabledModule(address module) if successful.\\n /// @param module Module to be enabled.\\n function enableModule(address module) external;\\n\\n /// @dev Disables a module on the avatar.\\n /// @notice Can only be called by the avatar.\\n /// @notice Must emit DisabledModule(address module) if successful.\\n /// @param prevModule Address that pointed to the module to be removed in the linked list\\n /// @param module Module to be removed.\\n function disableModule(address prevModule, address module) external;\\n\\n /// @dev Allows a Module to execute a transaction.\\n /// @notice Can only be called by an enabled module.\\n /// @notice Must emit ExecutionFromModuleSuccess(address module) if successful.\\n /// @notice Must emit ExecutionFromModuleFailure(address module) if unsuccessful.\\n /// @param to Destination address of module transaction.\\n /// @param value Ether value of module transaction.\\n /// @param data Data payload of module transaction.\\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\\n function execTransactionFromModule(\\n address to,\\n uint256 value,\\n bytes memory data,\\n Enum.Operation operation\\n ) external returns (bool success);\\n\\n /// @dev Allows a Module to execute a transaction and return data\\n /// @notice Can only be called by an enabled module.\\n /// @notice Must emit ExecutionFromModuleSuccess(address module) if successful.\\n /// @notice Must emit ExecutionFromModuleFailure(address module) if unsuccessful.\\n /// @param to Destination address of module transaction.\\n /// @param value Ether value of module transaction.\\n /// @param data Data payload of module transaction.\\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\\n function execTransactionFromModuleReturnData(\\n address to,\\n uint256 value,\\n bytes memory data,\\n Enum.Operation operation\\n ) external returns (bool success, bytes memory returnData);\\n\\n /// @dev Returns if an module is enabled\\n /// @return True if the module is enabled\\n function isModuleEnabled(address module) external view returns (bool);\\n\\n /// @dev Returns array of modules.\\n /// @param start Start of the page.\\n /// @param pageSize Maximum number of modules that should be returned.\\n /// @return array Array of modules.\\n /// @return next Start of the next page.\\n function getModulesPaginated(address start, uint256 pageSize)\\n external\\n view\\n returns (address[] memory array, address next);\\n}\\n\",\"keccak256\":\"0xcd5508ffe596eef8fbccfd5fc4f10a34397773547ce64e212d48b5212865ec1f\",\"license\":\"LGPL-3.0-only\"},\"@openzeppelin/contracts/interfaces/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/introspection/IERC165.sol\\\";\\n\",\"keccak256\":\"0xd04b0f06e0666f29cf7cccc82894de541e19bb30a765b107b1e40bb7fe5f7d7a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev 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 amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `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 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes calldata data\\n ) external;\\n\\n /**\\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 {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the caller.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool _approved) external;\\n\\n /**\\n * @dev Returns 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\",\"keccak256\":\"0xed6a749c5373af398105ce6ee3ac4763aa450ea7285d268c85d9eeca809cdb1f\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../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\",\"keccak256\":\"0x75b829ff2f26c14355d1cba20e16fe7b29ca58eb5fef665ede48bc0f9c6c74b9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _HEX_SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\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 // Inspired by OraclizeAPI's implementation - MIT licence\\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\\n\\n if (value == 0) {\\n return \\\"0\\\";\\n }\\n uint256 temp = value;\\n uint256 digits;\\n while (temp != 0) {\\n digits++;\\n temp /= 10;\\n }\\n bytes memory buffer = new bytes(digits);\\n while (value != 0) {\\n digits -= 1;\\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\\n value /= 10;\\n }\\n return string(buffer);\\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 if (value == 0) {\\n return \\\"0x00\\\";\\n }\\n uint256 temp = value;\\n uint256 length = 0;\\n while (temp != 0) {\\n length++;\\n temp >>= 8;\\n }\\n return toHexString(value, length);\\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 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_SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\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 representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n}\\n\",\"keccak256\":\"0xaf159a8b1923ad2a26d516089bceca9bdeaeacd04be50983ea00ba63070f08a3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"@prb/math/src/Common.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\n// Common.sol\\n//\\n// Common mathematical functions used in both SD59x18 and UD60x18. Note that these global functions do not\\n// always operate with SD59x18 and UD60x18 numbers.\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CUSTOM ERRORS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @notice Thrown when the resultant value in {mulDiv} overflows uint256.\\nerror PRBMath_MulDiv_Overflow(uint256 x, uint256 y, uint256 denominator);\\n\\n/// @notice Thrown when the resultant value in {mulDiv18} overflows uint256.\\nerror PRBMath_MulDiv18_Overflow(uint256 x, uint256 y);\\n\\n/// @notice Thrown when one of the inputs passed to {mulDivSigned} is `type(int256).min`.\\nerror PRBMath_MulDivSigned_InputTooSmall();\\n\\n/// @notice Thrown when the resultant value in {mulDivSigned} overflows int256.\\nerror PRBMath_MulDivSigned_Overflow(int256 x, int256 y);\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CONSTANTS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @dev The maximum value a uint128 number can have.\\nuint128 constant MAX_UINT128 = type(uint128).max;\\n\\n/// @dev The maximum value a uint40 number can have.\\nuint40 constant MAX_UINT40 = type(uint40).max;\\n\\n/// @dev The unit number, which the decimal precision of the fixed-point types.\\nuint256 constant UNIT = 1e18;\\n\\n/// @dev The unit number inverted mod 2^256.\\nuint256 constant UNIT_INVERSE = 78156646155174841979727994598816262306175212592076161876661_508869554232690281;\\n\\n/// @dev The the largest power of two that divides the decimal value of `UNIT`. The logarithm of this value is the least significant\\n/// bit in the binary representation of `UNIT`.\\nuint256 constant UNIT_LPOTD = 262144;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @notice Calculates the binary exponent of x using the binary fraction method.\\n/// @dev Has to use 192.64-bit fixed-point numbers. See https://ethereum.stackexchange.com/a/96594/24693.\\n/// @param x The exponent as an unsigned 192.64-bit fixed-point number.\\n/// @return result The result as an unsigned 60.18-decimal fixed-point number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp2(uint256 x) pure returns (uint256 result) {\\n unchecked {\\n // Start from 0.5 in the 192.64-bit fixed-point format.\\n result = 0x800000000000000000000000000000000000000000000000;\\n\\n // The following logic multiplies the result by $\\\\sqrt{2^{-i}}$ when the bit at position i is 1. Key points:\\n //\\n // 1. Intermediate results will not overflow, as the starting point is 2^191 and all magic factors are under 2^65.\\n // 2. The rationale for organizing the if statements into groups of 8 is gas savings. If the result of performing\\n // a bitwise AND operation between x and any value in the array [0x80; 0x40; 0x20; 0x10; 0x08; 0x04; 0x02; 0x01] is 1,\\n // we know that `x & 0xFF` is also 1.\\n if (x & 0xFF00000000000000 > 0) {\\n if (x & 0x8000000000000000 > 0) {\\n result = (result * 0x16A09E667F3BCC909) >> 64;\\n }\\n if (x & 0x4000000000000000 > 0) {\\n result = (result * 0x1306FE0A31B7152DF) >> 64;\\n }\\n if (x & 0x2000000000000000 > 0) {\\n result = (result * 0x1172B83C7D517ADCE) >> 64;\\n }\\n if (x & 0x1000000000000000 > 0) {\\n result = (result * 0x10B5586CF9890F62A) >> 64;\\n }\\n if (x & 0x800000000000000 > 0) {\\n result = (result * 0x1059B0D31585743AE) >> 64;\\n }\\n if (x & 0x400000000000000 > 0) {\\n result = (result * 0x102C9A3E778060EE7) >> 64;\\n }\\n if (x & 0x200000000000000 > 0) {\\n result = (result * 0x10163DA9FB33356D8) >> 64;\\n }\\n if (x & 0x100000000000000 > 0) {\\n result = (result * 0x100B1AFA5ABCBED61) >> 64;\\n }\\n }\\n\\n if (x & 0xFF000000000000 > 0) {\\n if (x & 0x80000000000000 > 0) {\\n result = (result * 0x10058C86DA1C09EA2) >> 64;\\n }\\n if (x & 0x40000000000000 > 0) {\\n result = (result * 0x1002C605E2E8CEC50) >> 64;\\n }\\n if (x & 0x20000000000000 > 0) {\\n result = (result * 0x100162F3904051FA1) >> 64;\\n }\\n if (x & 0x10000000000000 > 0) {\\n result = (result * 0x1000B175EFFDC76BA) >> 64;\\n }\\n if (x & 0x8000000000000 > 0) {\\n result = (result * 0x100058BA01FB9F96D) >> 64;\\n }\\n if (x & 0x4000000000000 > 0) {\\n result = (result * 0x10002C5CC37DA9492) >> 64;\\n }\\n if (x & 0x2000000000000 > 0) {\\n result = (result * 0x1000162E525EE0547) >> 64;\\n }\\n if (x & 0x1000000000000 > 0) {\\n result = (result * 0x10000B17255775C04) >> 64;\\n }\\n }\\n\\n if (x & 0xFF0000000000 > 0) {\\n if (x & 0x800000000000 > 0) {\\n result = (result * 0x1000058B91B5BC9AE) >> 64;\\n }\\n if (x & 0x400000000000 > 0) {\\n result = (result * 0x100002C5C89D5EC6D) >> 64;\\n }\\n if (x & 0x200000000000 > 0) {\\n result = (result * 0x10000162E43F4F831) >> 64;\\n }\\n if (x & 0x100000000000 > 0) {\\n result = (result * 0x100000B1721BCFC9A) >> 64;\\n }\\n if (x & 0x80000000000 > 0) {\\n result = (result * 0x10000058B90CF1E6E) >> 64;\\n }\\n if (x & 0x40000000000 > 0) {\\n result = (result * 0x1000002C5C863B73F) >> 64;\\n }\\n if (x & 0x20000000000 > 0) {\\n result = (result * 0x100000162E430E5A2) >> 64;\\n }\\n if (x & 0x10000000000 > 0) {\\n result = (result * 0x1000000B172183551) >> 64;\\n }\\n }\\n\\n if (x & 0xFF00000000 > 0) {\\n if (x & 0x8000000000 > 0) {\\n result = (result * 0x100000058B90C0B49) >> 64;\\n }\\n if (x & 0x4000000000 > 0) {\\n result = (result * 0x10000002C5C8601CC) >> 64;\\n }\\n if (x & 0x2000000000 > 0) {\\n result = (result * 0x1000000162E42FFF0) >> 64;\\n }\\n if (x & 0x1000000000 > 0) {\\n result = (result * 0x10000000B17217FBB) >> 64;\\n }\\n if (x & 0x800000000 > 0) {\\n result = (result * 0x1000000058B90BFCE) >> 64;\\n }\\n if (x & 0x400000000 > 0) {\\n result = (result * 0x100000002C5C85FE3) >> 64;\\n }\\n if (x & 0x200000000 > 0) {\\n result = (result * 0x10000000162E42FF1) >> 64;\\n }\\n if (x & 0x100000000 > 0) {\\n result = (result * 0x100000000B17217F8) >> 64;\\n }\\n }\\n\\n if (x & 0xFF000000 > 0) {\\n if (x & 0x80000000 > 0) {\\n result = (result * 0x10000000058B90BFC) >> 64;\\n }\\n if (x & 0x40000000 > 0) {\\n result = (result * 0x1000000002C5C85FE) >> 64;\\n }\\n if (x & 0x20000000 > 0) {\\n result = (result * 0x100000000162E42FF) >> 64;\\n }\\n if (x & 0x10000000 > 0) {\\n result = (result * 0x1000000000B17217F) >> 64;\\n }\\n if (x & 0x8000000 > 0) {\\n result = (result * 0x100000000058B90C0) >> 64;\\n }\\n if (x & 0x4000000 > 0) {\\n result = (result * 0x10000000002C5C860) >> 64;\\n }\\n if (x & 0x2000000 > 0) {\\n result = (result * 0x1000000000162E430) >> 64;\\n }\\n if (x & 0x1000000 > 0) {\\n result = (result * 0x10000000000B17218) >> 64;\\n }\\n }\\n\\n if (x & 0xFF0000 > 0) {\\n if (x & 0x800000 > 0) {\\n result = (result * 0x1000000000058B90C) >> 64;\\n }\\n if (x & 0x400000 > 0) {\\n result = (result * 0x100000000002C5C86) >> 64;\\n }\\n if (x & 0x200000 > 0) {\\n result = (result * 0x10000000000162E43) >> 64;\\n }\\n if (x & 0x100000 > 0) {\\n result = (result * 0x100000000000B1721) >> 64;\\n }\\n if (x & 0x80000 > 0) {\\n result = (result * 0x10000000000058B91) >> 64;\\n }\\n if (x & 0x40000 > 0) {\\n result = (result * 0x1000000000002C5C8) >> 64;\\n }\\n if (x & 0x20000 > 0) {\\n result = (result * 0x100000000000162E4) >> 64;\\n }\\n if (x & 0x10000 > 0) {\\n result = (result * 0x1000000000000B172) >> 64;\\n }\\n }\\n\\n if (x & 0xFF00 > 0) {\\n if (x & 0x8000 > 0) {\\n result = (result * 0x100000000000058B9) >> 64;\\n }\\n if (x & 0x4000 > 0) {\\n result = (result * 0x10000000000002C5D) >> 64;\\n }\\n if (x & 0x2000 > 0) {\\n result = (result * 0x1000000000000162E) >> 64;\\n }\\n if (x & 0x1000 > 0) {\\n result = (result * 0x10000000000000B17) >> 64;\\n }\\n if (x & 0x800 > 0) {\\n result = (result * 0x1000000000000058C) >> 64;\\n }\\n if (x & 0x400 > 0) {\\n result = (result * 0x100000000000002C6) >> 64;\\n }\\n if (x & 0x200 > 0) {\\n result = (result * 0x10000000000000163) >> 64;\\n }\\n if (x & 0x100 > 0) {\\n result = (result * 0x100000000000000B1) >> 64;\\n }\\n }\\n\\n if (x & 0xFF > 0) {\\n if (x & 0x80 > 0) {\\n result = (result * 0x10000000000000059) >> 64;\\n }\\n if (x & 0x40 > 0) {\\n result = (result * 0x1000000000000002C) >> 64;\\n }\\n if (x & 0x20 > 0) {\\n result = (result * 0x10000000000000016) >> 64;\\n }\\n if (x & 0x10 > 0) {\\n result = (result * 0x1000000000000000B) >> 64;\\n }\\n if (x & 0x8 > 0) {\\n result = (result * 0x10000000000000006) >> 64;\\n }\\n if (x & 0x4 > 0) {\\n result = (result * 0x10000000000000003) >> 64;\\n }\\n if (x & 0x2 > 0) {\\n result = (result * 0x10000000000000001) >> 64;\\n }\\n if (x & 0x1 > 0) {\\n result = (result * 0x10000000000000001) >> 64;\\n }\\n }\\n\\n // In the code snippet below, two operations are executed simultaneously:\\n //\\n // 1. The result is multiplied by $(2^n + 1)$, where $2^n$ represents the integer part, and the additional 1\\n // accounts for the initial guess of 0.5. This is achieved by subtracting from 191 instead of 192.\\n // 2. The result is then converted to an unsigned 60.18-decimal fixed-point format.\\n //\\n // The underlying logic is based on the relationship $2^{191-ip} = 2^{ip} / 2^{191}$, where $ip$ denotes the,\\n // integer part, $2^n$.\\n result *= UNIT;\\n result >>= (191 - (x >> 64));\\n }\\n}\\n\\n/// @notice Finds the zero-based index of the first 1 in the binary representation of x.\\n///\\n/// @dev See the note on \\\"msb\\\" in this Wikipedia article: https://en.wikipedia.org/wiki/Find_first_set\\n///\\n/// Each step in this implementation is equivalent to this high-level code:\\n///\\n/// ```solidity\\n/// if (x >= 2 ** 128) {\\n/// x >>= 128;\\n/// result += 128;\\n/// }\\n/// ```\\n///\\n/// Where 128 is replaced with each respective power of two factor. See the full high-level implementation here:\\n/// https://gist.github.com/PaulRBerg/f932f8693f2733e30c4d479e8e980948\\n///\\n/// The Yul instructions used below are:\\n///\\n/// - \\\"gt\\\" is \\\"greater than\\\"\\n/// - \\\"or\\\" is the OR bitwise operator\\n/// - \\\"shl\\\" is \\\"shift left\\\"\\n/// - \\\"shr\\\" is \\\"shift right\\\"\\n///\\n/// @param x The uint256 number for which to find the index of the most significant bit.\\n/// @return result The index of the most significant bit as a uint256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction msb(uint256 x) pure returns (uint256 result) {\\n // 2^128\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(7, gt(x, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^64\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(6, gt(x, 0xFFFFFFFFFFFFFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^32\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(5, gt(x, 0xFFFFFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^16\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(4, gt(x, 0xFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^8\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(3, gt(x, 0xFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^4\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(2, gt(x, 0xF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^2\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(1, gt(x, 0x3))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^1\\n // No need to shift x any more.\\n assembly (\\\"memory-safe\\\") {\\n let factor := gt(x, 0x1)\\n result := or(result, factor)\\n }\\n}\\n\\n/// @notice Calculates x*y\\u00f7denominator with 512-bit precision.\\n///\\n/// @dev Credits to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv.\\n///\\n/// Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - The denominator must not be zero.\\n/// - The result must fit in uint256.\\n///\\n/// @param x The multiplicand as a uint256.\\n/// @param y The multiplier as a uint256.\\n/// @param denominator The divisor as a uint256.\\n/// @return result The result as a uint256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mulDiv(uint256 x, uint256 y, uint256 denominator) pure returns (uint256 result) {\\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; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly (\\\"memory-safe\\\") {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\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 unchecked {\\n return prod0 / denominator;\\n }\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n if (prod1 >= denominator) {\\n revert PRBMath_MulDiv_Overflow(x, y, denominator);\\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 (\\\"memory-safe\\\") {\\n // Compute remainder using the mulmod Yul instruction.\\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 unchecked {\\n // Calculate the largest power of two divisor of the denominator using the unary operator ~. This operation cannot overflow\\n // because the denominator cannot be zero at this point in the function execution. The result is always >= 1.\\n // For more detail, see https://cs.stackexchange.com/q/138556/92363.\\n uint256 lpotdod = denominator & (~denominator + 1);\\n uint256 flippedLpotdod;\\n\\n assembly (\\\"memory-safe\\\") {\\n // Factor powers of two out of denominator.\\n denominator := div(denominator, lpotdod)\\n\\n // Divide [prod1 prod0] by lpotdod.\\n prod0 := div(prod0, lpotdod)\\n\\n // Get the flipped value `2^256 / lpotdod`. If the `lpotdod` is zero, the flipped value is one.\\n // `sub(0, lpotdod)` produces the two's complement version of `lpotdod`, which is equivalent to flipping all the bits.\\n // However, `div` interprets this value as an unsigned value: https://ethereum.stackexchange.com/q/147168/24693\\n flippedLpotdod := add(div(sub(0, lpotdod), lpotdod), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * flippedLpotdod;\\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 works\\n // 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 }\\n}\\n\\n/// @notice Calculates x*y\\u00f71e18 with 512-bit precision.\\n///\\n/// @dev A variant of {mulDiv} with constant folding, i.e. in which the denominator is hard coded to 1e18.\\n///\\n/// Notes:\\n/// - The body is purposely left uncommented; to understand how this works, see the documentation in {mulDiv}.\\n/// - The result is rounded toward zero.\\n/// - We take as an axiom that the result cannot be `MAX_UINT256` when x and y solve the following system of equations:\\n///\\n/// $$\\n/// \\\\begin{cases}\\n/// x * y = MAX\\\\_UINT256 * UNIT \\\\\\\\\\n/// (x * y) \\\\% UNIT \\\\geq \\\\frac{UNIT}{2}\\n/// \\\\end{cases}\\n/// $$\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {mulDiv}.\\n/// - The result must fit in uint256.\\n///\\n/// @param x The multiplicand as an unsigned 60.18-decimal fixed-point number.\\n/// @param y The multiplier as an unsigned 60.18-decimal fixed-point number.\\n/// @return result The result as an unsigned 60.18-decimal fixed-point number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mulDiv18(uint256 x, uint256 y) pure returns (uint256 result) {\\n uint256 prod0;\\n uint256 prod1;\\n assembly (\\\"memory-safe\\\") {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n if (prod1 == 0) {\\n unchecked {\\n return prod0 / UNIT;\\n }\\n }\\n\\n if (prod1 >= UNIT) {\\n revert PRBMath_MulDiv18_Overflow(x, y);\\n }\\n\\n uint256 remainder;\\n assembly (\\\"memory-safe\\\") {\\n remainder := mulmod(x, y, UNIT)\\n result :=\\n mul(\\n or(\\n div(sub(prod0, remainder), UNIT_LPOTD),\\n mul(sub(prod1, gt(remainder, prod0)), add(div(sub(0, UNIT_LPOTD), UNIT_LPOTD), 1))\\n ),\\n UNIT_INVERSE\\n )\\n }\\n}\\n\\n/// @notice Calculates x*y\\u00f7denominator with 512-bit precision.\\n///\\n/// @dev This is an extension of {mulDiv} for signed numbers, which works by computing the signs and the absolute values separately.\\n///\\n/// Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {mulDiv}.\\n/// - None of the inputs can be `type(int256).min`.\\n/// - The result must fit in int256.\\n///\\n/// @param x The multiplicand as an int256.\\n/// @param y The multiplier as an int256.\\n/// @param denominator The divisor as an int256.\\n/// @return result The result as an int256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mulDivSigned(int256 x, int256 y, int256 denominator) pure returns (int256 result) {\\n if (x == type(int256).min || y == type(int256).min || denominator == type(int256).min) {\\n revert PRBMath_MulDivSigned_InputTooSmall();\\n }\\n\\n // Get hold of the absolute values of x, y and the denominator.\\n uint256 xAbs;\\n uint256 yAbs;\\n uint256 dAbs;\\n unchecked {\\n xAbs = x < 0 ? uint256(-x) : uint256(x);\\n yAbs = y < 0 ? uint256(-y) : uint256(y);\\n dAbs = denominator < 0 ? uint256(-denominator) : uint256(denominator);\\n }\\n\\n // Compute the absolute value of x*y\\u00f7denominator. The result must fit in int256.\\n uint256 resultAbs = mulDiv(xAbs, yAbs, dAbs);\\n if (resultAbs > uint256(type(int256).max)) {\\n revert PRBMath_MulDivSigned_Overflow(x, y);\\n }\\n\\n // Get the signs of x, y and the denominator.\\n uint256 sx;\\n uint256 sy;\\n uint256 sd;\\n assembly (\\\"memory-safe\\\") {\\n // \\\"sgt\\\" is the \\\"signed greater than\\\" assembly instruction and \\\"sub(0,1)\\\" is -1 in two's complement.\\n sx := sgt(x, sub(0, 1))\\n sy := sgt(y, sub(0, 1))\\n sd := sgt(denominator, sub(0, 1))\\n }\\n\\n // XOR over sx, sy and sd. What this does is to check whether there are 1 or 3 negative signs in the inputs.\\n // If there are, the result should be negative. Otherwise, it should be positive.\\n unchecked {\\n result = sx ^ sy ^ sd == 0 ? -int256(resultAbs) : int256(resultAbs);\\n }\\n}\\n\\n/// @notice Calculates the square root of x using the Babylonian method.\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\\n///\\n/// Notes:\\n/// - If x is not a perfect square, the result is rounded down.\\n/// - Credits to OpenZeppelin for the explanations in comments below.\\n///\\n/// @param x The uint256 number for which to calculate the square root.\\n/// @return result The result as a uint256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction sqrt(uint256 x) pure returns (uint256 result) {\\n if (x == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we calculate the biggest power of 2 which is smaller than the square root of x.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of x is a power of 2 such that we have:\\n //\\n // $$\\n // msb(x) <= x <= 2*msb(x)$\\n // $$\\n //\\n // We write $msb(x)$ as $2^k$, and we get:\\n //\\n // $$\\n // k = log_2(x)\\n // $$\\n //\\n // Thus, we can write the initial inequality as:\\n //\\n // $$\\n // 2^{log_2(x)} <= x <= 2*2^{log_2(x)+1} \\\\\\\\\\n // sqrt(2^k) <= sqrt(x) < sqrt(2^{k+1}) \\\\\\\\\\n // 2^{k/2} <= sqrt(x) < 2^{(k+1)/2} <= 2^{(k/2)+1}\\n // $$\\n //\\n // Consequently, $2^{log_2(x) /2} is a good first approximation of sqrt(x) with at least one correct bit.\\n uint256 xAux = uint256(x);\\n result = 1;\\n if (xAux >= 2 ** 128) {\\n xAux >>= 128;\\n result <<= 64;\\n }\\n if (xAux >= 2 ** 64) {\\n xAux >>= 64;\\n result <<= 32;\\n }\\n if (xAux >= 2 ** 32) {\\n xAux >>= 32;\\n result <<= 16;\\n }\\n if (xAux >= 2 ** 16) {\\n xAux >>= 16;\\n result <<= 8;\\n }\\n if (xAux >= 2 ** 8) {\\n xAux >>= 8;\\n result <<= 4;\\n }\\n if (xAux >= 2 ** 4) {\\n xAux >>= 4;\\n result <<= 2;\\n }\\n if (xAux >= 2 ** 2) {\\n result <<= 1;\\n }\\n\\n // At this point, `result` is an estimation with at least one bit of precision. We know the true value has at\\n // most 128 bits, since it is the square root of a uint256. Newton's method converges quadratically (precision\\n // doubles at every iteration). We thus need at most 7 iteration to turn our partial result with one bit of\\n // precision into the expected uint128 result.\\n unchecked {\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n\\n // If x is not a perfect square, round the result toward zero.\\n uint256 roundedResult = x / result;\\n if (result >= roundedResult) {\\n result = roundedResult;\\n }\\n }\\n}\\n\",\"keccak256\":\"0xaa374e2c26cc93e8c22a6953804ee05f811597ef5fa82f76824378b22944778b\",\"license\":\"MIT\"},\"@prb/math/src/UD2x18.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\n/*\\n\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2550\\u2550\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2554\\u2588\\u2588\\u2588\\u2588\\u2554\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551 \\u255a\\u2550\\u255d \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\n\\n\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2550\\u2550\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d \\u255a\\u2588\\u2588\\u2588\\u2554\\u255d \\u255a\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u255d\\n\\n*/\\n\\nimport \\\"./ud2x18/Casting.sol\\\";\\nimport \\\"./ud2x18/Constants.sol\\\";\\nimport \\\"./ud2x18/Errors.sol\\\";\\nimport \\\"./ud2x18/ValueType.sol\\\";\\n\",\"keccak256\":\"0xfb624e24cd8bb790fa08e7827819de85504a86e20e961fa4ad126c65b6d90641\",\"license\":\"MIT\"},\"@prb/math/src/UD60x18.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\n/*\\n\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2550\\u2550\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2554\\u2588\\u2588\\u2588\\u2588\\u2554\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551 \\u255a\\u2550\\u255d \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\n\\n\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2550\\u2588\\u2588\\u2588\\u2588\\u2557\\u255a\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2588\\u2588\\u2551 \\u255a\\u2588\\u2588\\u2588\\u2554\\u255d \\u255a\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2554\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2554\\u255d \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u255d\\n\\n*/\\n\\nimport \\\"./ud60x18/Casting.sol\\\";\\nimport \\\"./ud60x18/Constants.sol\\\";\\nimport \\\"./ud60x18/Conversions.sol\\\";\\nimport \\\"./ud60x18/Errors.sol\\\";\\nimport \\\"./ud60x18/Helpers.sol\\\";\\nimport \\\"./ud60x18/Math.sol\\\";\\nimport \\\"./ud60x18/ValueType.sol\\\";\\n\",\"keccak256\":\"0xb98c6f74275914d279e8af6c502c2b1f50d5f6e1ed418d3b0153f5a193206c48\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as CastingErrors;\\nimport { SD59x18 } from \\\"../sd59x18/ValueType.sol\\\";\\nimport { UD2x18 } from \\\"../ud2x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"../ud60x18/ValueType.sol\\\";\\nimport { SD1x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts an SD1x18 number into SD59x18.\\n/// @dev There is no overflow check because the domain of SD1x18 is a subset of SD59x18.\\nfunction intoSD59x18(SD1x18 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(int256(SD1x18.unwrap(x)));\\n}\\n\\n/// @notice Casts an SD1x18 number into UD2x18.\\n/// - x must be positive.\\nfunction intoUD2x18(SD1x18 x) pure returns (UD2x18 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUD2x18_Underflow(x);\\n }\\n result = UD2x18.wrap(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into UD60x18.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUD60x18(SD1x18 x) pure returns (UD60x18 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUD60x18_Underflow(x);\\n }\\n result = UD60x18.wrap(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into uint256.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUint256(SD1x18 x) pure returns (uint256 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint256_Underflow(x);\\n }\\n result = uint256(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into uint128.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUint128(SD1x18 x) pure returns (uint128 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint128_Underflow(x);\\n }\\n result = uint128(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(SD1x18 x) pure returns (uint40 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint40_Underflow(x);\\n }\\n if (xInt > int64(uint64(Common.MAX_UINT40))) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint40_Overflow(x);\\n }\\n result = uint40(uint64(xInt));\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction sd1x18(int64 x) pure returns (SD1x18 result) {\\n result = SD1x18.wrap(x);\\n}\\n\\n/// @notice Unwraps an SD1x18 number into int64.\\nfunction unwrap(SD1x18 x) pure returns (int64 result) {\\n result = SD1x18.unwrap(x);\\n}\\n\\n/// @notice Wraps an int64 number into SD1x18.\\nfunction wrap(int64 x) pure returns (SD1x18 result) {\\n result = SD1x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x9e49e2b37c1bb845861740805edaaef3fe951a7b96eef16ce84fbf76e8278670\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD1x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @dev Euler's number as an SD1x18 number.\\nSD1x18 constant E = SD1x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum value an SD1x18 number can have.\\nint64 constant uMAX_SD1x18 = 9_223372036854775807;\\nSD1x18 constant MAX_SD1x18 = SD1x18.wrap(uMAX_SD1x18);\\n\\n/// @dev The maximum value an SD1x18 number can have.\\nint64 constant uMIN_SD1x18 = -9_223372036854775808;\\nSD1x18 constant MIN_SD1x18 = SD1x18.wrap(uMIN_SD1x18);\\n\\n/// @dev PI as an SD1x18 number.\\nSD1x18 constant PI = SD1x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of SD1x18.\\nSD1x18 constant UNIT = SD1x18.wrap(1e18);\\nint64 constant uUNIT = 1e18;\\n\",\"keccak256\":\"0x6496165b80552785a4b65a239b96e2a5fedf62fe54f002eeed72d75e566d7585\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD1x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in UD2x18.\\nerror PRBMath_SD1x18_ToUD2x18_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in UD60x18.\\nerror PRBMath_SD1x18_ToUD60x18_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint128.\\nerror PRBMath_SD1x18_ToUint128_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint256.\\nerror PRBMath_SD1x18_ToUint256_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint40.\\nerror PRBMath_SD1x18_ToUint40_Overflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint40.\\nerror PRBMath_SD1x18_ToUint40_Underflow(SD1x18 x);\\n\",\"keccak256\":\"0x836cb42ba619ca369fd4765bc47fefc3c3621369c5861882af14660aca5057ee\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\n\\n/// @notice The signed 1.18-decimal fixed-point number representation, which can have up to 1 digit and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\\n/// type int64. This is useful when end users want to use int64 to save gas, e.g. with tight variable packing in contract\\n/// storage.\\ntype SD1x18 is int64;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoSD59x18,\\n Casting.intoUD2x18,\\n Casting.intoUD60x18,\\n Casting.intoUint256,\\n Casting.intoUint128,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for SD1x18 global;\\n\",\"keccak256\":\"0x2f86f1aa9fca42f40808b51a879b406ac51817647bdb9642f8a79dd8fdb754a7\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Errors.sol\\\" as CastingErrors;\\nimport { MAX_UINT128, MAX_UINT40 } from \\\"../Common.sol\\\";\\nimport { uMAX_SD1x18, uMIN_SD1x18 } from \\\"../sd1x18/Constants.sol\\\";\\nimport { SD1x18 } from \\\"../sd1x18/ValueType.sol\\\";\\nimport { uMAX_UD2x18 } from \\\"../ud2x18/Constants.sol\\\";\\nimport { UD2x18 } from \\\"../ud2x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"../ud60x18/ValueType.sol\\\";\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts an SD59x18 number into int256.\\n/// @dev This is basically a functional alias for {unwrap}.\\nfunction intoInt256(SD59x18 x) pure returns (int256 result) {\\n result = SD59x18.unwrap(x);\\n}\\n\\n/// @notice Casts an SD59x18 number into SD1x18.\\n/// @dev Requirements:\\n/// - x must be greater than or equal to `uMIN_SD1x18`.\\n/// - x must be less than or equal to `uMAX_SD1x18`.\\nfunction intoSD1x18(SD59x18 x) pure returns (SD1x18 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < uMIN_SD1x18) {\\n revert CastingErrors.PRBMath_SD59x18_IntoSD1x18_Underflow(x);\\n }\\n if (xInt > uMAX_SD1x18) {\\n revert CastingErrors.PRBMath_SD59x18_IntoSD1x18_Overflow(x);\\n }\\n result = SD1x18.wrap(int64(xInt));\\n}\\n\\n/// @notice Casts an SD59x18 number into UD2x18.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `uMAX_UD2x18`.\\nfunction intoUD2x18(SD59x18 x) pure returns (UD2x18 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUD2x18_Underflow(x);\\n }\\n if (xInt > int256(uint256(uMAX_UD2x18))) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUD2x18_Overflow(x);\\n }\\n result = UD2x18.wrap(uint64(uint256(xInt)));\\n}\\n\\n/// @notice Casts an SD59x18 number into UD60x18.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUD60x18(SD59x18 x) pure returns (UD60x18 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUD60x18_Underflow(x);\\n }\\n result = UD60x18.wrap(uint256(xInt));\\n}\\n\\n/// @notice Casts an SD59x18 number into uint256.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUint256(SD59x18 x) pure returns (uint256 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint256_Underflow(x);\\n }\\n result = uint256(xInt);\\n}\\n\\n/// @notice Casts an SD59x18 number into uint128.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `uMAX_UINT128`.\\nfunction intoUint128(SD59x18 x) pure returns (uint128 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint128_Underflow(x);\\n }\\n if (xInt > int256(uint256(MAX_UINT128))) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint128_Overflow(x);\\n }\\n result = uint128(uint256(xInt));\\n}\\n\\n/// @notice Casts an SD59x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(SD59x18 x) pure returns (uint40 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint40_Underflow(x);\\n }\\n if (xInt > int256(uint256(MAX_UINT40))) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint40_Overflow(x);\\n }\\n result = uint40(uint256(xInt));\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction sd(int256 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(x);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction sd59x18(int256 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(x);\\n}\\n\\n/// @notice Unwraps an SD59x18 number into int256.\\nfunction unwrap(SD59x18 x) pure returns (int256 result) {\\n result = SD59x18.unwrap(x);\\n}\\n\\n/// @notice Wraps an int256 number into SD59x18.\\nfunction wrap(int256 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x3b21b60ec2998c3ae32f647412da51d3683b3f183a807198cc8d157499484f99\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n// NOTICE: the \\\"u\\\" prefix stands for \\\"unwrapped\\\".\\n\\n/// @dev Euler's number as an SD59x18 number.\\nSD59x18 constant E = SD59x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum input permitted in {exp}.\\nint256 constant uEXP_MAX_INPUT = 133_084258667509499440;\\nSD59x18 constant EXP_MAX_INPUT = SD59x18.wrap(uEXP_MAX_INPUT);\\n\\n/// @dev Any value less than this returns 0 in {exp}.\\nint256 constant uEXP_MIN_THRESHOLD = -41_446531673892822322;\\nSD59x18 constant EXP_MIN_THRESHOLD = SD59x18.wrap(uEXP_MIN_THRESHOLD);\\n\\n/// @dev The maximum input permitted in {exp2}.\\nint256 constant uEXP2_MAX_INPUT = 192e18 - 1;\\nSD59x18 constant EXP2_MAX_INPUT = SD59x18.wrap(uEXP2_MAX_INPUT);\\n\\n/// @dev Any value less than this returns 0 in {exp2}.\\nint256 constant uEXP2_MIN_THRESHOLD = -59_794705707972522261;\\nSD59x18 constant EXP2_MIN_THRESHOLD = SD59x18.wrap(uEXP2_MIN_THRESHOLD);\\n\\n/// @dev Half the UNIT number.\\nint256 constant uHALF_UNIT = 0.5e18;\\nSD59x18 constant HALF_UNIT = SD59x18.wrap(uHALF_UNIT);\\n\\n/// @dev $log_2(10)$ as an SD59x18 number.\\nint256 constant uLOG2_10 = 3_321928094887362347;\\nSD59x18 constant LOG2_10 = SD59x18.wrap(uLOG2_10);\\n\\n/// @dev $log_2(e)$ as an SD59x18 number.\\nint256 constant uLOG2_E = 1_442695040888963407;\\nSD59x18 constant LOG2_E = SD59x18.wrap(uLOG2_E);\\n\\n/// @dev The maximum value an SD59x18 number can have.\\nint256 constant uMAX_SD59x18 = 57896044618658097711785492504343953926634992332820282019728_792003956564819967;\\nSD59x18 constant MAX_SD59x18 = SD59x18.wrap(uMAX_SD59x18);\\n\\n/// @dev The maximum whole value an SD59x18 number can have.\\nint256 constant uMAX_WHOLE_SD59x18 = 57896044618658097711785492504343953926634992332820282019728_000000000000000000;\\nSD59x18 constant MAX_WHOLE_SD59x18 = SD59x18.wrap(uMAX_WHOLE_SD59x18);\\n\\n/// @dev The minimum value an SD59x18 number can have.\\nint256 constant uMIN_SD59x18 = -57896044618658097711785492504343953926634992332820282019728_792003956564819968;\\nSD59x18 constant MIN_SD59x18 = SD59x18.wrap(uMIN_SD59x18);\\n\\n/// @dev The minimum whole value an SD59x18 number can have.\\nint256 constant uMIN_WHOLE_SD59x18 = -57896044618658097711785492504343953926634992332820282019728_000000000000000000;\\nSD59x18 constant MIN_WHOLE_SD59x18 = SD59x18.wrap(uMIN_WHOLE_SD59x18);\\n\\n/// @dev PI as an SD59x18 number.\\nSD59x18 constant PI = SD59x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of SD59x18.\\nint256 constant uUNIT = 1e18;\\nSD59x18 constant UNIT = SD59x18.wrap(1e18);\\n\\n/// @dev The unit number squared.\\nint256 constant uUNIT_SQUARED = 1e36;\\nSD59x18 constant UNIT_SQUARED = SD59x18.wrap(uUNIT_SQUARED);\\n\\n/// @dev Zero as an SD59x18 number.\\nSD59x18 constant ZERO = SD59x18.wrap(0);\\n\",\"keccak256\":\"0x9bcb8dd6b3e886d140ad1c32747a4f6d29a492529ceb835be878ae837aa6cc3a\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when taking the absolute value of `MIN_SD59x18`.\\nerror PRBMath_SD59x18_Abs_MinSD59x18();\\n\\n/// @notice Thrown when ceiling a number overflows SD59x18.\\nerror PRBMath_SD59x18_Ceil_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when converting a basic integer to the fixed-point format overflows SD59x18.\\nerror PRBMath_SD59x18_Convert_Overflow(int256 x);\\n\\n/// @notice Thrown when converting a basic integer to the fixed-point format underflows SD59x18.\\nerror PRBMath_SD59x18_Convert_Underflow(int256 x);\\n\\n/// @notice Thrown when dividing two numbers and one of them is `MIN_SD59x18`.\\nerror PRBMath_SD59x18_Div_InputTooSmall();\\n\\n/// @notice Thrown when dividing two numbers and one of the intermediary unsigned results overflows SD59x18.\\nerror PRBMath_SD59x18_Div_Overflow(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when taking the natural exponent of a base greater than 133_084258667509499441.\\nerror PRBMath_SD59x18_Exp_InputTooBig(SD59x18 x);\\n\\n/// @notice Thrown when taking the binary exponent of a base greater than 192e18.\\nerror PRBMath_SD59x18_Exp2_InputTooBig(SD59x18 x);\\n\\n/// @notice Thrown when flooring a number underflows SD59x18.\\nerror PRBMath_SD59x18_Floor_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when taking the geometric mean of two numbers and their product is negative.\\nerror PRBMath_SD59x18_Gm_NegativeProduct(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when taking the geometric mean of two numbers and multiplying them overflows SD59x18.\\nerror PRBMath_SD59x18_Gm_Overflow(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\\nerror PRBMath_SD59x18_IntoSD1x18_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\\nerror PRBMath_SD59x18_IntoSD1x18_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\\nerror PRBMath_SD59x18_IntoUD2x18_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\\nerror PRBMath_SD59x18_IntoUD2x18_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD60x18.\\nerror PRBMath_SD59x18_IntoUD60x18_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\\nerror PRBMath_SD59x18_IntoUint128_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\\nerror PRBMath_SD59x18_IntoUint128_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint256.\\nerror PRBMath_SD59x18_IntoUint256_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\\nerror PRBMath_SD59x18_IntoUint40_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\\nerror PRBMath_SD59x18_IntoUint40_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when taking the logarithm of a number less than or equal to zero.\\nerror PRBMath_SD59x18_Log_InputTooSmall(SD59x18 x);\\n\\n/// @notice Thrown when multiplying two numbers and one of the inputs is `MIN_SD59x18`.\\nerror PRBMath_SD59x18_Mul_InputTooSmall();\\n\\n/// @notice Thrown when multiplying two numbers and the intermediary absolute result overflows SD59x18.\\nerror PRBMath_SD59x18_Mul_Overflow(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when raising a number to a power and the intermediary absolute result overflows SD59x18.\\nerror PRBMath_SD59x18_Powu_Overflow(SD59x18 x, uint256 y);\\n\\n/// @notice Thrown when taking the square root of a negative number.\\nerror PRBMath_SD59x18_Sqrt_NegativeInput(SD59x18 x);\\n\\n/// @notice Thrown when the calculating the square root overflows SD59x18.\\nerror PRBMath_SD59x18_Sqrt_Overflow(SD59x18 x);\\n\",\"keccak256\":\"0xa6d00fe5efa215ac0df25c896e3da99a12fb61e799644b2ec32da947313d3db4\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Helpers.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { wrap } from \\\"./Casting.sol\\\";\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Implements the checked addition operation (+) in the SD59x18 type.\\nfunction add(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n return wrap(x.unwrap() + y.unwrap());\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the SD59x18 type.\\nfunction and(SD59x18 x, int256 bits) pure returns (SD59x18 result) {\\n return wrap(x.unwrap() & bits);\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the SD59x18 type.\\nfunction and2(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n return wrap(x.unwrap() & y.unwrap());\\n}\\n\\n/// @notice Implements the equal (=) operation in the SD59x18 type.\\nfunction eq(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() == y.unwrap();\\n}\\n\\n/// @notice Implements the greater than operation (>) in the SD59x18 type.\\nfunction gt(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() > y.unwrap();\\n}\\n\\n/// @notice Implements the greater than or equal to operation (>=) in the SD59x18 type.\\nfunction gte(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() >= y.unwrap();\\n}\\n\\n/// @notice Implements a zero comparison check function in the SD59x18 type.\\nfunction isZero(SD59x18 x) pure returns (bool result) {\\n result = x.unwrap() == 0;\\n}\\n\\n/// @notice Implements the left shift operation (<<) in the SD59x18 type.\\nfunction lshift(SD59x18 x, uint256 bits) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() << bits);\\n}\\n\\n/// @notice Implements the lower than operation (<) in the SD59x18 type.\\nfunction lt(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() < y.unwrap();\\n}\\n\\n/// @notice Implements the lower than or equal to operation (<=) in the SD59x18 type.\\nfunction lte(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() <= y.unwrap();\\n}\\n\\n/// @notice Implements the unchecked modulo operation (%) in the SD59x18 type.\\nfunction mod(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() % y.unwrap());\\n}\\n\\n/// @notice Implements the not equal operation (!=) in the SD59x18 type.\\nfunction neq(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() != y.unwrap();\\n}\\n\\n/// @notice Implements the NOT (~) bitwise operation in the SD59x18 type.\\nfunction not(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(~x.unwrap());\\n}\\n\\n/// @notice Implements the OR (|) bitwise operation in the SD59x18 type.\\nfunction or(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() | y.unwrap());\\n}\\n\\n/// @notice Implements the right shift operation (>>) in the SD59x18 type.\\nfunction rshift(SD59x18 x, uint256 bits) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() >> bits);\\n}\\n\\n/// @notice Implements the checked subtraction operation (-) in the SD59x18 type.\\nfunction sub(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() - y.unwrap());\\n}\\n\\n/// @notice Implements the checked unary minus operation (-) in the SD59x18 type.\\nfunction unary(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(-x.unwrap());\\n}\\n\\n/// @notice Implements the unchecked addition operation (+) in the SD59x18 type.\\nfunction uncheckedAdd(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() + y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the unchecked subtraction operation (-) in the SD59x18 type.\\nfunction uncheckedSub(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() - y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the unchecked unary minus operation (-) in the SD59x18 type.\\nfunction uncheckedUnary(SD59x18 x) pure returns (SD59x18 result) {\\n unchecked {\\n result = wrap(-x.unwrap());\\n }\\n}\\n\\n/// @notice Implements the XOR (^) bitwise operation in the SD59x18 type.\\nfunction xor(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() ^ y.unwrap());\\n}\\n\",\"keccak256\":\"0x208570f1657cf730cb6c3d81aa14030e0d45cf906cdedea5059369d7df4bb716\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as Errors;\\nimport {\\n uEXP_MAX_INPUT,\\n uEXP2_MAX_INPUT,\\n uEXP_MIN_THRESHOLD,\\n uEXP2_MIN_THRESHOLD,\\n uHALF_UNIT,\\n uLOG2_10,\\n uLOG2_E,\\n uMAX_SD59x18,\\n uMAX_WHOLE_SD59x18,\\n uMIN_SD59x18,\\n uMIN_WHOLE_SD59x18,\\n UNIT,\\n uUNIT,\\n uUNIT_SQUARED,\\n ZERO\\n} from \\\"./Constants.sol\\\";\\nimport { wrap } from \\\"./Helpers.sol\\\";\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Calculates the absolute value of x.\\n///\\n/// @dev Requirements:\\n/// - x must be greater than `MIN_SD59x18`.\\n///\\n/// @param x The SD59x18 number for which to calculate the absolute value.\\n/// @param result The absolute value of x as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction abs(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt == uMIN_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Abs_MinSD59x18();\\n }\\n result = xInt < 0 ? wrap(-xInt) : x;\\n}\\n\\n/// @notice Calculates the arithmetic average of x and y.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// @param x The first operand as an SD59x18 number.\\n/// @param y The second operand as an SD59x18 number.\\n/// @return result The arithmetic average as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction avg(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n\\n unchecked {\\n // This operation is equivalent to `x / 2 + y / 2`, and it can never overflow.\\n int256 sum = (xInt >> 1) + (yInt >> 1);\\n\\n if (sum < 0) {\\n // If at least one of x and y is odd, add 1 to the result, because shifting negative numbers to the right\\n // rounds toward negative infinity. The right part is equivalent to `sum + (x % 2 == 1 || y % 2 == 1)`.\\n assembly (\\\"memory-safe\\\") {\\n result := add(sum, and(or(xInt, yInt), 1))\\n }\\n } else {\\n // Add 1 if both x and y are odd to account for the double 0.5 remainder truncated after shifting.\\n result = wrap(sum + (xInt & yInt & 1));\\n }\\n }\\n}\\n\\n/// @notice Yields the smallest whole number greater than or equal to x.\\n///\\n/// @dev Optimized for fractional value inputs, because every whole value has (1e18 - 1) fractional counterparts.\\n/// See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n///\\n/// Requirements:\\n/// - x must be less than or equal to `MAX_WHOLE_SD59x18`.\\n///\\n/// @param x The SD59x18 number to ceil.\\n/// @param result The smallest whole number greater than or equal to x, as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ceil(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt > uMAX_WHOLE_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Ceil_Overflow(x);\\n }\\n\\n int256 remainder = xInt % uUNIT;\\n if (remainder == 0) {\\n result = x;\\n } else {\\n unchecked {\\n // Solidity uses C fmod style, which returns a modulus with the same sign as x.\\n int256 resultInt = xInt - remainder;\\n if (xInt > 0) {\\n resultInt += uUNIT;\\n }\\n result = wrap(resultInt);\\n }\\n }\\n}\\n\\n/// @notice Divides two SD59x18 numbers, returning a new SD59x18 number.\\n///\\n/// @dev This is an extension of {Common.mulDiv} for signed numbers, which works by computing the signs and the absolute\\n/// values separately.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv}.\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv}.\\n/// - None of the inputs can be `MIN_SD59x18`.\\n/// - The denominator must not be zero.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The numerator as an SD59x18 number.\\n/// @param y The denominator as an SD59x18 number.\\n/// @param result The quotient as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction div(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n if (xInt == uMIN_SD59x18 || yInt == uMIN_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Div_InputTooSmall();\\n }\\n\\n // Get hold of the absolute values of x and y.\\n uint256 xAbs;\\n uint256 yAbs;\\n unchecked {\\n xAbs = xInt < 0 ? uint256(-xInt) : uint256(xInt);\\n yAbs = yInt < 0 ? uint256(-yInt) : uint256(yInt);\\n }\\n\\n // Compute the absolute value (x*UNIT\\u00f7y). The resulting value must fit in SD59x18.\\n uint256 resultAbs = Common.mulDiv(xAbs, uint256(uUNIT), yAbs);\\n if (resultAbs > uint256(uMAX_SD59x18)) {\\n revert Errors.PRBMath_SD59x18_Div_Overflow(x, y);\\n }\\n\\n // Check if x and y have the same sign using two's complement representation. The left-most bit represents the sign (1 for\\n // negative, 0 for positive or zero).\\n bool sameSign = (xInt ^ yInt) > -1;\\n\\n // If the inputs have the same sign, the result should be positive. Otherwise, it should be negative.\\n unchecked {\\n result = wrap(sameSign ? int256(resultAbs) : -int256(resultAbs));\\n }\\n}\\n\\n/// @notice Calculates the natural exponent of x using the following formula:\\n///\\n/// $$\\n/// e^x = 2^{x * log_2{e}}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {exp2}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {exp2}.\\n/// - x must be less than 133_084258667509499441.\\n///\\n/// @param x The exponent as an SD59x18 number.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n\\n // Any input less than the threshold returns zero.\\n // This check also prevents an overflow for very small numbers.\\n if (xInt < uEXP_MIN_THRESHOLD) {\\n return ZERO;\\n }\\n\\n // This check prevents values greater than 192e18 from being passed to {exp2}.\\n if (xInt > uEXP_MAX_INPUT) {\\n revert Errors.PRBMath_SD59x18_Exp_InputTooBig(x);\\n }\\n\\n unchecked {\\n // Inline the fixed-point multiplication to save gas.\\n int256 doubleUnitProduct = xInt * uLOG2_E;\\n result = exp2(wrap(doubleUnitProduct / uUNIT));\\n }\\n}\\n\\n/// @notice Calculates the binary exponent of x using the binary fraction method using the following formula:\\n///\\n/// $$\\n/// 2^{-x} = \\\\frac{1}{2^x}\\n/// $$\\n///\\n/// @dev See https://ethereum.stackexchange.com/q/79903/24693.\\n///\\n/// Notes:\\n/// - If x is less than -59_794705707972522261, the result is zero.\\n///\\n/// Requirements:\\n/// - x must be less than 192e18.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The exponent as an SD59x18 number.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp2(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < 0) {\\n // The inverse of any number less than the threshold is truncated to zero.\\n if (xInt < uEXP2_MIN_THRESHOLD) {\\n return ZERO;\\n }\\n\\n unchecked {\\n // Inline the fixed-point inversion to save gas.\\n result = wrap(uUNIT_SQUARED / exp2(wrap(-xInt)).unwrap());\\n }\\n } else {\\n // Numbers greater than or equal to 192e18 don't fit in the 192.64-bit format.\\n if (xInt > uEXP2_MAX_INPUT) {\\n revert Errors.PRBMath_SD59x18_Exp2_InputTooBig(x);\\n }\\n\\n unchecked {\\n // Convert x to the 192.64-bit fixed-point format.\\n uint256 x_192x64 = uint256((xInt << 64) / uUNIT);\\n\\n // It is safe to cast the result to int256 due to the checks above.\\n result = wrap(int256(Common.exp2(x_192x64)));\\n }\\n }\\n}\\n\\n/// @notice Yields the greatest whole number less than or equal to x.\\n///\\n/// @dev Optimized for fractional value inputs, because for every whole value there are (1e18 - 1) fractional\\n/// counterparts. See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n///\\n/// Requirements:\\n/// - x must be greater than or equal to `MIN_WHOLE_SD59x18`.\\n///\\n/// @param x The SD59x18 number to floor.\\n/// @param result The greatest whole number less than or equal to x, as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction floor(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < uMIN_WHOLE_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Floor_Underflow(x);\\n }\\n\\n int256 remainder = xInt % uUNIT;\\n if (remainder == 0) {\\n result = x;\\n } else {\\n unchecked {\\n // Solidity uses C fmod style, which returns a modulus with the same sign as x.\\n int256 resultInt = xInt - remainder;\\n if (xInt < 0) {\\n resultInt -= uUNIT;\\n }\\n result = wrap(resultInt);\\n }\\n }\\n}\\n\\n/// @notice Yields the excess beyond the floor of x for positive numbers and the part of the number to the right.\\n/// of the radix point for negative numbers.\\n/// @dev Based on the odd function definition. https://en.wikipedia.org/wiki/Fractional_part\\n/// @param x The SD59x18 number to get the fractional part of.\\n/// @param result The fractional part of x as an SD59x18 number.\\nfunction frac(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() % uUNIT);\\n}\\n\\n/// @notice Calculates the geometric mean of x and y, i.e. $\\\\sqrt{x * y}$.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x * y must fit in SD59x18.\\n/// - x * y must not be negative, since complex numbers are not supported.\\n///\\n/// @param x The first operand as an SD59x18 number.\\n/// @param y The second operand as an SD59x18 number.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction gm(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n if (xInt == 0 || yInt == 0) {\\n return ZERO;\\n }\\n\\n unchecked {\\n // Equivalent to `xy / x != y`. Checking for overflow this way is faster than letting Solidity do it.\\n int256 xyInt = xInt * yInt;\\n if (xyInt / xInt != yInt) {\\n revert Errors.PRBMath_SD59x18_Gm_Overflow(x, y);\\n }\\n\\n // The product must not be negative, since complex numbers are not supported.\\n if (xyInt < 0) {\\n revert Errors.PRBMath_SD59x18_Gm_NegativeProduct(x, y);\\n }\\n\\n // We don't need to multiply the result by `UNIT` here because the x*y product picked up a factor of `UNIT`\\n // during multiplication. See the comments in {Common.sqrt}.\\n uint256 resultUint = Common.sqrt(uint256(xyInt));\\n result = wrap(int256(resultUint));\\n }\\n}\\n\\n/// @notice Calculates the inverse of x.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x must not be zero.\\n///\\n/// @param x The SD59x18 number for which to calculate the inverse.\\n/// @return result The inverse as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction inv(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(uUNIT_SQUARED / x.unwrap());\\n}\\n\\n/// @notice Calculates the natural logarithm of x using the following formula:\\n///\\n/// $$\\n/// ln{x} = log_2{x} / log_2{e}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n/// - The precision isn't sufficiently fine-grained to return exactly `UNIT` when the input is `E`.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The SD59x18 number for which to calculate the natural logarithm.\\n/// @return result The natural logarithm as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ln(SD59x18 x) pure returns (SD59x18 result) {\\n // Inline the fixed-point multiplication to save gas. This is overflow-safe because the maximum value that\\n // {log2} can return is ~195_205294292027477728.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_E);\\n}\\n\\n/// @notice Calculates the common logarithm of x using the following formula:\\n///\\n/// $$\\n/// log_{10}{x} = log_2{x} / log_2{10}\\n/// $$\\n///\\n/// However, if x is an exact power of ten, a hard coded value is returned.\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The SD59x18 number for which to calculate the common logarithm.\\n/// @return result The common logarithm as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log10(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < 0) {\\n revert Errors.PRBMath_SD59x18_Log_InputTooSmall(x);\\n }\\n\\n // Note that the `mul` in this block is the standard multiplication operation, not {SD59x18.mul}.\\n // prettier-ignore\\n assembly (\\\"memory-safe\\\") {\\n switch x\\n case 1 { result := mul(uUNIT, sub(0, 18)) }\\n case 10 { result := mul(uUNIT, sub(1, 18)) }\\n case 100 { result := mul(uUNIT, sub(2, 18)) }\\n case 1000 { result := mul(uUNIT, sub(3, 18)) }\\n case 10000 { result := mul(uUNIT, sub(4, 18)) }\\n case 100000 { result := mul(uUNIT, sub(5, 18)) }\\n case 1000000 { result := mul(uUNIT, sub(6, 18)) }\\n case 10000000 { result := mul(uUNIT, sub(7, 18)) }\\n case 100000000 { result := mul(uUNIT, sub(8, 18)) }\\n case 1000000000 { result := mul(uUNIT, sub(9, 18)) }\\n case 10000000000 { result := mul(uUNIT, sub(10, 18)) }\\n case 100000000000 { result := mul(uUNIT, sub(11, 18)) }\\n case 1000000000000 { result := mul(uUNIT, sub(12, 18)) }\\n case 10000000000000 { result := mul(uUNIT, sub(13, 18)) }\\n case 100000000000000 { result := mul(uUNIT, sub(14, 18)) }\\n case 1000000000000000 { result := mul(uUNIT, sub(15, 18)) }\\n case 10000000000000000 { result := mul(uUNIT, sub(16, 18)) }\\n case 100000000000000000 { result := mul(uUNIT, sub(17, 18)) }\\n case 1000000000000000000 { result := 0 }\\n case 10000000000000000000 { result := uUNIT }\\n case 100000000000000000000 { result := mul(uUNIT, 2) }\\n case 1000000000000000000000 { result := mul(uUNIT, 3) }\\n case 10000000000000000000000 { result := mul(uUNIT, 4) }\\n case 100000000000000000000000 { result := mul(uUNIT, 5) }\\n case 1000000000000000000000000 { result := mul(uUNIT, 6) }\\n case 10000000000000000000000000 { result := mul(uUNIT, 7) }\\n case 100000000000000000000000000 { result := mul(uUNIT, 8) }\\n case 1000000000000000000000000000 { result := mul(uUNIT, 9) }\\n case 10000000000000000000000000000 { result := mul(uUNIT, 10) }\\n case 100000000000000000000000000000 { result := mul(uUNIT, 11) }\\n case 1000000000000000000000000000000 { result := mul(uUNIT, 12) }\\n case 10000000000000000000000000000000 { result := mul(uUNIT, 13) }\\n case 100000000000000000000000000000000 { result := mul(uUNIT, 14) }\\n case 1000000000000000000000000000000000 { result := mul(uUNIT, 15) }\\n case 10000000000000000000000000000000000 { result := mul(uUNIT, 16) }\\n case 100000000000000000000000000000000000 { result := mul(uUNIT, 17) }\\n case 1000000000000000000000000000000000000 { result := mul(uUNIT, 18) }\\n case 10000000000000000000000000000000000000 { result := mul(uUNIT, 19) }\\n case 100000000000000000000000000000000000000 { result := mul(uUNIT, 20) }\\n case 1000000000000000000000000000000000000000 { result := mul(uUNIT, 21) }\\n case 10000000000000000000000000000000000000000 { result := mul(uUNIT, 22) }\\n case 100000000000000000000000000000000000000000 { result := mul(uUNIT, 23) }\\n case 1000000000000000000000000000000000000000000 { result := mul(uUNIT, 24) }\\n case 10000000000000000000000000000000000000000000 { result := mul(uUNIT, 25) }\\n case 100000000000000000000000000000000000000000000 { result := mul(uUNIT, 26) }\\n case 1000000000000000000000000000000000000000000000 { result := mul(uUNIT, 27) }\\n case 10000000000000000000000000000000000000000000000 { result := mul(uUNIT, 28) }\\n case 100000000000000000000000000000000000000000000000 { result := mul(uUNIT, 29) }\\n case 1000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 30) }\\n case 10000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 31) }\\n case 100000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 32) }\\n case 1000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 33) }\\n case 10000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 34) }\\n case 100000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 35) }\\n case 1000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 36) }\\n case 10000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 37) }\\n case 100000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 38) }\\n case 1000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 39) }\\n case 10000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 40) }\\n case 100000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 41) }\\n case 1000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 42) }\\n case 10000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 43) }\\n case 100000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 44) }\\n case 1000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 45) }\\n case 10000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 46) }\\n case 100000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 47) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 48) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 49) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 50) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 51) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 52) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 53) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 54) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 55) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 56) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 57) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 58) }\\n default { result := uMAX_SD59x18 }\\n }\\n\\n if (result.unwrap() == uMAX_SD59x18) {\\n unchecked {\\n // Inline the fixed-point division to save gas.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_10);\\n }\\n }\\n}\\n\\n/// @notice Calculates the binary logarithm of x using the iterative approximation algorithm:\\n///\\n/// $$\\n/// log_2{x} = n + log_2{y}, \\\\text{ where } y = x*2^{-n}, \\\\ y \\\\in [1, 2)\\n/// $$\\n///\\n/// For $0 \\\\leq x \\\\lt 1$, the input is inverted:\\n///\\n/// $$\\n/// log_2{x} = -log_2{\\\\frac{1}{x}}\\n/// $$\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Binary_logarithm#Iterative_approximation.\\n///\\n/// Notes:\\n/// - Due to the lossy precision of the iterative approximation, the results are not perfectly accurate to the last decimal.\\n///\\n/// Requirements:\\n/// - x must be greater than zero.\\n///\\n/// @param x The SD59x18 number for which to calculate the binary logarithm.\\n/// @return result The binary logarithm as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log2(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt <= 0) {\\n revert Errors.PRBMath_SD59x18_Log_InputTooSmall(x);\\n }\\n\\n unchecked {\\n int256 sign;\\n if (xInt >= uUNIT) {\\n sign = 1;\\n } else {\\n sign = -1;\\n // Inline the fixed-point inversion to save gas.\\n xInt = uUNIT_SQUARED / xInt;\\n }\\n\\n // Calculate the integer part of the logarithm.\\n uint256 n = Common.msb(uint256(xInt / uUNIT));\\n\\n // This is the integer part of the logarithm as an SD59x18 number. The operation can't overflow\\n // because n is at most 255, `UNIT` is 1e18, and the sign is either 1 or -1.\\n int256 resultInt = int256(n) * uUNIT;\\n\\n // Calculate $y = x * 2^{-n}$.\\n int256 y = xInt >> n;\\n\\n // If y is the unit number, the fractional part is zero.\\n if (y == uUNIT) {\\n return wrap(resultInt * sign);\\n }\\n\\n // Calculate the fractional part via the iterative approximation.\\n // The `delta >>= 1` part is equivalent to `delta /= 2`, but shifting bits is more gas efficient.\\n int256 DOUBLE_UNIT = 2e18;\\n for (int256 delta = uHALF_UNIT; delta > 0; delta >>= 1) {\\n y = (y * y) / uUNIT;\\n\\n // Is y^2 >= 2e18 and so in the range [2e18, 4e18)?\\n if (y >= DOUBLE_UNIT) {\\n // Add the 2^{-m} factor to the logarithm.\\n resultInt = resultInt + delta;\\n\\n // Halve y, which corresponds to z/2 in the Wikipedia article.\\n y >>= 1;\\n }\\n }\\n resultInt *= sign;\\n result = wrap(resultInt);\\n }\\n}\\n\\n/// @notice Multiplies two SD59x18 numbers together, returning a new SD59x18 number.\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {Common.mulDiv18}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv18}.\\n/// - None of the inputs can be `MIN_SD59x18`.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The multiplicand as an SD59x18 number.\\n/// @param y The multiplier as an SD59x18 number.\\n/// @return result The product as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mul(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n if (xInt == uMIN_SD59x18 || yInt == uMIN_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Mul_InputTooSmall();\\n }\\n\\n // Get hold of the absolute values of x and y.\\n uint256 xAbs;\\n uint256 yAbs;\\n unchecked {\\n xAbs = xInt < 0 ? uint256(-xInt) : uint256(xInt);\\n yAbs = yInt < 0 ? uint256(-yInt) : uint256(yInt);\\n }\\n\\n // Compute the absolute value (x*y\\u00f7UNIT). The resulting value must fit in SD59x18.\\n uint256 resultAbs = Common.mulDiv18(xAbs, yAbs);\\n if (resultAbs > uint256(uMAX_SD59x18)) {\\n revert Errors.PRBMath_SD59x18_Mul_Overflow(x, y);\\n }\\n\\n // Check if x and y have the same sign using two's complement representation. The left-most bit represents the sign (1 for\\n // negative, 0 for positive or zero).\\n bool sameSign = (xInt ^ yInt) > -1;\\n\\n // If the inputs have the same sign, the result should be positive. Otherwise, it should be negative.\\n unchecked {\\n result = wrap(sameSign ? int256(resultAbs) : -int256(resultAbs));\\n }\\n}\\n\\n/// @notice Raises x to the power of y using the following formula:\\n///\\n/// $$\\n/// x^y = 2^{log_2{x} * y}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {exp2}, {log2}, and {mul}.\\n/// - Returns `UNIT` for 0^0.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {exp2}, {log2}, and {mul}.\\n///\\n/// @param x The base as an SD59x18 number.\\n/// @param y Exponent to raise x to, as an SD59x18 number\\n/// @return result x raised to power y, as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction pow(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n\\n // If both x and y are zero, the result is `UNIT`. If just x is zero, the result is always zero.\\n if (xInt == 0) {\\n return yInt == 0 ? UNIT : ZERO;\\n }\\n // If x is `UNIT`, the result is always `UNIT`.\\n else if (xInt == uUNIT) {\\n return UNIT;\\n }\\n\\n // If y is zero, the result is always `UNIT`.\\n if (yInt == 0) {\\n return UNIT;\\n }\\n // If y is `UNIT`, the result is always x.\\n else if (yInt == uUNIT) {\\n return x;\\n }\\n\\n // Calculate the result using the formula.\\n result = exp2(mul(log2(x), y));\\n}\\n\\n/// @notice Raises x (an SD59x18 number) to the power y (an unsigned basic integer) using the well-known\\n/// algorithm \\\"exponentiation by squaring\\\".\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Exponentiation_by_squaring.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv18}.\\n/// - Returns `UNIT` for 0^0.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {abs} and {Common.mulDiv18}.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The base as an SD59x18 number.\\n/// @param y The exponent as a uint256.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction powu(SD59x18 x, uint256 y) pure returns (SD59x18 result) {\\n uint256 xAbs = uint256(abs(x).unwrap());\\n\\n // Calculate the first iteration of the loop in advance.\\n uint256 resultAbs = y & 1 > 0 ? xAbs : uint256(uUNIT);\\n\\n // Equivalent to `for(y /= 2; y > 0; y /= 2)`.\\n uint256 yAux = y;\\n for (yAux >>= 1; yAux > 0; yAux >>= 1) {\\n xAbs = Common.mulDiv18(xAbs, xAbs);\\n\\n // Equivalent to `y % 2 == 1`.\\n if (yAux & 1 > 0) {\\n resultAbs = Common.mulDiv18(resultAbs, xAbs);\\n }\\n }\\n\\n // The result must fit in SD59x18.\\n if (resultAbs > uint256(uMAX_SD59x18)) {\\n revert Errors.PRBMath_SD59x18_Powu_Overflow(x, y);\\n }\\n\\n unchecked {\\n // Is the base negative and the exponent odd? If yes, the result should be negative.\\n int256 resultInt = int256(resultAbs);\\n bool isNegative = x.unwrap() < 0 && y & 1 == 1;\\n if (isNegative) {\\n resultInt = -resultInt;\\n }\\n result = wrap(resultInt);\\n }\\n}\\n\\n/// @notice Calculates the square root of x using the Babylonian method.\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\\n///\\n/// Notes:\\n/// - Only the positive root is returned.\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x cannot be negative, since complex numbers are not supported.\\n/// - x must be less than `MAX_SD59x18 / UNIT`.\\n///\\n/// @param x The SD59x18 number for which to calculate the square root.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction sqrt(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < 0) {\\n revert Errors.PRBMath_SD59x18_Sqrt_NegativeInput(x);\\n }\\n if (xInt > uMAX_SD59x18 / uUNIT) {\\n revert Errors.PRBMath_SD59x18_Sqrt_Overflow(x);\\n }\\n\\n unchecked {\\n // Multiply x by `UNIT` to account for the factor of `UNIT` picked up when multiplying two SD59x18 numbers.\\n // In this case, the two numbers are both the square root.\\n uint256 resultUint = Common.sqrt(uint256(xInt * uUNIT));\\n result = wrap(int256(resultUint));\\n }\\n}\\n\",\"keccak256\":\"0xa074831139fc89ca0e5a36086b30eb50896bb6770cd5823461b1f2769017d2f0\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\nimport \\\"./Helpers.sol\\\" as Helpers;\\nimport \\\"./Math.sol\\\" as Math;\\n\\n/// @notice The signed 59.18-decimal fixed-point number representation, which can have up to 59 digits and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\\n/// type int256.\\ntype SD59x18 is int256;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoInt256,\\n Casting.intoSD1x18,\\n Casting.intoUD2x18,\\n Casting.intoUD60x18,\\n Casting.intoUint256,\\n Casting.intoUint128,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for SD59x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n MATHEMATICAL FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Math.abs,\\n Math.avg,\\n Math.ceil,\\n Math.div,\\n Math.exp,\\n Math.exp2,\\n Math.floor,\\n Math.frac,\\n Math.gm,\\n Math.inv,\\n Math.log10,\\n Math.log2,\\n Math.ln,\\n Math.mul,\\n Math.pow,\\n Math.powu,\\n Math.sqrt\\n} for SD59x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n HELPER FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Helpers.add,\\n Helpers.and,\\n Helpers.eq,\\n Helpers.gt,\\n Helpers.gte,\\n Helpers.isZero,\\n Helpers.lshift,\\n Helpers.lt,\\n Helpers.lte,\\n Helpers.mod,\\n Helpers.neq,\\n Helpers.not,\\n Helpers.or,\\n Helpers.rshift,\\n Helpers.sub,\\n Helpers.uncheckedAdd,\\n Helpers.uncheckedSub,\\n Helpers.uncheckedUnary,\\n Helpers.xor\\n} for SD59x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n OPERATORS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes it possible to use these operators on the SD59x18 type.\\nusing {\\n Helpers.add as +,\\n Helpers.and2 as &,\\n Math.div as /,\\n Helpers.eq as ==,\\n Helpers.gt as >,\\n Helpers.gte as >=,\\n Helpers.lt as <,\\n Helpers.lte as <=,\\n Helpers.mod as %,\\n Math.mul as *,\\n Helpers.neq as !=,\\n Helpers.not as ~,\\n Helpers.or as |,\\n Helpers.sub as -,\\n Helpers.unary as -,\\n Helpers.xor as ^\\n} for SD59x18 global;\\n\",\"keccak256\":\"0xe03112d145dcd5863aff24e5f381debaae29d446acd5666f3d640e3d9af738d7\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as Errors;\\nimport { uMAX_SD1x18 } from \\\"../sd1x18/Constants.sol\\\";\\nimport { SD1x18 } from \\\"../sd1x18/ValueType.sol\\\";\\nimport { SD59x18 } from \\\"../sd59x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"../ud60x18/ValueType.sol\\\";\\nimport { UD2x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts a UD2x18 number into SD1x18.\\n/// - x must be less than or equal to `uMAX_SD1x18`.\\nfunction intoSD1x18(UD2x18 x) pure returns (SD1x18 result) {\\n uint64 xUint = UD2x18.unwrap(x);\\n if (xUint > uint64(uMAX_SD1x18)) {\\n revert Errors.PRBMath_UD2x18_IntoSD1x18_Overflow(x);\\n }\\n result = SD1x18.wrap(int64(xUint));\\n}\\n\\n/// @notice Casts a UD2x18 number into SD59x18.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of SD59x18.\\nfunction intoSD59x18(UD2x18 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(int256(uint256(UD2x18.unwrap(x))));\\n}\\n\\n/// @notice Casts a UD2x18 number into UD60x18.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of UD60x18.\\nfunction intoUD60x18(UD2x18 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(UD2x18.unwrap(x));\\n}\\n\\n/// @notice Casts a UD2x18 number into uint128.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of uint128.\\nfunction intoUint128(UD2x18 x) pure returns (uint128 result) {\\n result = uint128(UD2x18.unwrap(x));\\n}\\n\\n/// @notice Casts a UD2x18 number into uint256.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of uint256.\\nfunction intoUint256(UD2x18 x) pure returns (uint256 result) {\\n result = uint256(UD2x18.unwrap(x));\\n}\\n\\n/// @notice Casts a UD2x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(UD2x18 x) pure returns (uint40 result) {\\n uint64 xUint = UD2x18.unwrap(x);\\n if (xUint > uint64(Common.MAX_UINT40)) {\\n revert Errors.PRBMath_UD2x18_IntoUint40_Overflow(x);\\n }\\n result = uint40(xUint);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction ud2x18(uint64 x) pure returns (UD2x18 result) {\\n result = UD2x18.wrap(x);\\n}\\n\\n/// @notice Unwrap a UD2x18 number into uint64.\\nfunction unwrap(UD2x18 x) pure returns (uint64 result) {\\n result = UD2x18.unwrap(x);\\n}\\n\\n/// @notice Wraps a uint64 number into UD2x18.\\nfunction wrap(uint64 x) pure returns (UD2x18 result) {\\n result = UD2x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x9b1a35d432ef951a415fae8098b3c609a99b630a3d5464b3c8e1efa8893eea07\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD2x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @dev Euler's number as a UD2x18 number.\\nUD2x18 constant E = UD2x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum value a UD2x18 number can have.\\nuint64 constant uMAX_UD2x18 = 18_446744073709551615;\\nUD2x18 constant MAX_UD2x18 = UD2x18.wrap(uMAX_UD2x18);\\n\\n/// @dev PI as a UD2x18 number.\\nUD2x18 constant PI = UD2x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of UD2x18.\\nUD2x18 constant UNIT = UD2x18.wrap(1e18);\\nuint64 constant uUNIT = 1e18;\\n\",\"keccak256\":\"0x29b0e050c865899e1fb9022b460a7829cdee248c44c4299f068ba80695eec3fc\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD2x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when trying to cast a UD2x18 number that doesn't fit in SD1x18.\\nerror PRBMath_UD2x18_IntoSD1x18_Overflow(UD2x18 x);\\n\\n/// @notice Thrown when trying to cast a UD2x18 number that doesn't fit in uint40.\\nerror PRBMath_UD2x18_IntoUint40_Overflow(UD2x18 x);\\n\",\"keccak256\":\"0xdf1e22f0b4c8032bcc8b7f63fe3984e1387f3dc7b2e9ab381822249f75376d33\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\n\\n/// @notice The unsigned 2.18-decimal fixed-point number representation, which can have up to 2 digits and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\\n/// type uint64. This is useful when end users want to use uint64 to save gas, e.g. with tight variable packing in contract\\n/// storage.\\ntype UD2x18 is uint64;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoSD1x18,\\n Casting.intoSD59x18,\\n Casting.intoUD60x18,\\n Casting.intoUint256,\\n Casting.intoUint128,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for UD2x18 global;\\n\",\"keccak256\":\"0x2802edc9869db116a0b5c490cc5f8554742f747183fa30ac5e9c80bb967e61a1\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Errors.sol\\\" as CastingErrors;\\nimport { MAX_UINT128, MAX_UINT40 } from \\\"../Common.sol\\\";\\nimport { uMAX_SD1x18 } from \\\"../sd1x18/Constants.sol\\\";\\nimport { SD1x18 } from \\\"../sd1x18/ValueType.sol\\\";\\nimport { uMAX_SD59x18 } from \\\"../sd59x18/Constants.sol\\\";\\nimport { SD59x18 } from \\\"../sd59x18/ValueType.sol\\\";\\nimport { uMAX_UD2x18 } from \\\"../ud2x18/Constants.sol\\\";\\nimport { UD2x18 } from \\\"../ud2x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts a UD60x18 number into SD1x18.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `uMAX_SD1x18`.\\nfunction intoSD1x18(UD60x18 x) pure returns (SD1x18 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > uint256(int256(uMAX_SD1x18))) {\\n revert CastingErrors.PRBMath_UD60x18_IntoSD1x18_Overflow(x);\\n }\\n result = SD1x18.wrap(int64(uint64(xUint)));\\n}\\n\\n/// @notice Casts a UD60x18 number into UD2x18.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `uMAX_UD2x18`.\\nfunction intoUD2x18(UD60x18 x) pure returns (UD2x18 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > uMAX_UD2x18) {\\n revert CastingErrors.PRBMath_UD60x18_IntoUD2x18_Overflow(x);\\n }\\n result = UD2x18.wrap(uint64(xUint));\\n}\\n\\n/// @notice Casts a UD60x18 number into SD59x18.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `uMAX_SD59x18`.\\nfunction intoSD59x18(UD60x18 x) pure returns (SD59x18 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > uint256(uMAX_SD59x18)) {\\n revert CastingErrors.PRBMath_UD60x18_IntoSD59x18_Overflow(x);\\n }\\n result = SD59x18.wrap(int256(xUint));\\n}\\n\\n/// @notice Casts a UD60x18 number into uint128.\\n/// @dev This is basically an alias for {unwrap}.\\nfunction intoUint256(UD60x18 x) pure returns (uint256 result) {\\n result = UD60x18.unwrap(x);\\n}\\n\\n/// @notice Casts a UD60x18 number into uint128.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UINT128`.\\nfunction intoUint128(UD60x18 x) pure returns (uint128 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > MAX_UINT128) {\\n revert CastingErrors.PRBMath_UD60x18_IntoUint128_Overflow(x);\\n }\\n result = uint128(xUint);\\n}\\n\\n/// @notice Casts a UD60x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(UD60x18 x) pure returns (uint40 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > MAX_UINT40) {\\n revert CastingErrors.PRBMath_UD60x18_IntoUint40_Overflow(x);\\n }\\n result = uint40(xUint);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction ud(uint256 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(x);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction ud60x18(uint256 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(x);\\n}\\n\\n/// @notice Unwraps a UD60x18 number into uint256.\\nfunction unwrap(UD60x18 x) pure returns (uint256 result) {\\n result = UD60x18.unwrap(x);\\n}\\n\\n/// @notice Wraps a uint256 number into the UD60x18 value type.\\nfunction wrap(uint256 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x5bb532da36921cbdac64d1f16de5d366ef1f664502e3b7c07d0ad06917551f85\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n// NOTICE: the \\\"u\\\" prefix stands for \\\"unwrapped\\\".\\n\\n/// @dev Euler's number as a UD60x18 number.\\nUD60x18 constant E = UD60x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum input permitted in {exp}.\\nuint256 constant uEXP_MAX_INPUT = 133_084258667509499440;\\nUD60x18 constant EXP_MAX_INPUT = UD60x18.wrap(uEXP_MAX_INPUT);\\n\\n/// @dev The maximum input permitted in {exp2}.\\nuint256 constant uEXP2_MAX_INPUT = 192e18 - 1;\\nUD60x18 constant EXP2_MAX_INPUT = UD60x18.wrap(uEXP2_MAX_INPUT);\\n\\n/// @dev Half the UNIT number.\\nuint256 constant uHALF_UNIT = 0.5e18;\\nUD60x18 constant HALF_UNIT = UD60x18.wrap(uHALF_UNIT);\\n\\n/// @dev $log_2(10)$ as a UD60x18 number.\\nuint256 constant uLOG2_10 = 3_321928094887362347;\\nUD60x18 constant LOG2_10 = UD60x18.wrap(uLOG2_10);\\n\\n/// @dev $log_2(e)$ as a UD60x18 number.\\nuint256 constant uLOG2_E = 1_442695040888963407;\\nUD60x18 constant LOG2_E = UD60x18.wrap(uLOG2_E);\\n\\n/// @dev The maximum value a UD60x18 number can have.\\nuint256 constant uMAX_UD60x18 = 115792089237316195423570985008687907853269984665640564039457_584007913129639935;\\nUD60x18 constant MAX_UD60x18 = UD60x18.wrap(uMAX_UD60x18);\\n\\n/// @dev The maximum whole value a UD60x18 number can have.\\nuint256 constant uMAX_WHOLE_UD60x18 = 115792089237316195423570985008687907853269984665640564039457_000000000000000000;\\nUD60x18 constant MAX_WHOLE_UD60x18 = UD60x18.wrap(uMAX_WHOLE_UD60x18);\\n\\n/// @dev PI as a UD60x18 number.\\nUD60x18 constant PI = UD60x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of UD60x18.\\nuint256 constant uUNIT = 1e18;\\nUD60x18 constant UNIT = UD60x18.wrap(uUNIT);\\n\\n/// @dev The unit number squared.\\nuint256 constant uUNIT_SQUARED = 1e36;\\nUD60x18 constant UNIT_SQUARED = UD60x18.wrap(uUNIT_SQUARED);\\n\\n/// @dev Zero as a UD60x18 number.\\nUD60x18 constant ZERO = UD60x18.wrap(0);\\n\",\"keccak256\":\"0x2b80d26153d3fdcfb3a9ca772d9309d31ed1275f5b8b54c3ffb54d3652b37d90\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Conversions.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { uMAX_UD60x18, uUNIT } from \\\"./Constants.sol\\\";\\nimport { PRBMath_UD60x18_Convert_Overflow } from \\\"./Errors.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Converts a UD60x18 number to a simple integer by dividing it by `UNIT`.\\n/// @dev The result is rounded toward zero.\\n/// @param x The UD60x18 number to convert.\\n/// @return result The same number in basic integer form.\\nfunction convert(UD60x18 x) pure returns (uint256 result) {\\n result = UD60x18.unwrap(x) / uUNIT;\\n}\\n\\n/// @notice Converts a simple integer to UD60x18 by multiplying it by `UNIT`.\\n///\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UD60x18 / UNIT`.\\n///\\n/// @param x The basic integer to convert.\\n/// @param result The same number converted to UD60x18.\\nfunction convert(uint256 x) pure returns (UD60x18 result) {\\n if (x > uMAX_UD60x18 / uUNIT) {\\n revert PRBMath_UD60x18_Convert_Overflow(x);\\n }\\n unchecked {\\n result = UD60x18.wrap(x * uUNIT);\\n }\\n}\\n\",\"keccak256\":\"0xaf7fc2523413822de3b66ba339fe2884fb3b8c6f6cf38ec90a2c3e3aae71df6b\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when ceiling a number overflows UD60x18.\\nerror PRBMath_UD60x18_Ceil_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when converting a basic integer to the fixed-point format overflows UD60x18.\\nerror PRBMath_UD60x18_Convert_Overflow(uint256 x);\\n\\n/// @notice Thrown when taking the natural exponent of a base greater than 133_084258667509499441.\\nerror PRBMath_UD60x18_Exp_InputTooBig(UD60x18 x);\\n\\n/// @notice Thrown when taking the binary exponent of a base greater than 192e18.\\nerror PRBMath_UD60x18_Exp2_InputTooBig(UD60x18 x);\\n\\n/// @notice Thrown when taking the geometric mean of two numbers and multiplying them overflows UD60x18.\\nerror PRBMath_UD60x18_Gm_Overflow(UD60x18 x, UD60x18 y);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\\nerror PRBMath_UD60x18_IntoSD1x18_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD59x18.\\nerror PRBMath_UD60x18_IntoSD59x18_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\\nerror PRBMath_UD60x18_IntoUD2x18_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\\nerror PRBMath_UD60x18_IntoUint128_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\\nerror PRBMath_UD60x18_IntoUint40_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when taking the logarithm of a number less than 1.\\nerror PRBMath_UD60x18_Log_InputTooSmall(UD60x18 x);\\n\\n/// @notice Thrown when calculating the square root overflows UD60x18.\\nerror PRBMath_UD60x18_Sqrt_Overflow(UD60x18 x);\\n\",\"keccak256\":\"0xa8c60d4066248df22c49c882873efbc017344107edabc48c52209abbc39cb1e3\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Helpers.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { wrap } from \\\"./Casting.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Implements the checked addition operation (+) in the UD60x18 type.\\nfunction add(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() + y.unwrap());\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the UD60x18 type.\\nfunction and(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() & bits);\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the UD60x18 type.\\nfunction and2(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() & y.unwrap());\\n}\\n\\n/// @notice Implements the equal operation (==) in the UD60x18 type.\\nfunction eq(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() == y.unwrap();\\n}\\n\\n/// @notice Implements the greater than operation (>) in the UD60x18 type.\\nfunction gt(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() > y.unwrap();\\n}\\n\\n/// @notice Implements the greater than or equal to operation (>=) in the UD60x18 type.\\nfunction gte(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() >= y.unwrap();\\n}\\n\\n/// @notice Implements a zero comparison check function in the UD60x18 type.\\nfunction isZero(UD60x18 x) pure returns (bool result) {\\n // This wouldn't work if x could be negative.\\n result = x.unwrap() == 0;\\n}\\n\\n/// @notice Implements the left shift operation (<<) in the UD60x18 type.\\nfunction lshift(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() << bits);\\n}\\n\\n/// @notice Implements the lower than operation (<) in the UD60x18 type.\\nfunction lt(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() < y.unwrap();\\n}\\n\\n/// @notice Implements the lower than or equal to operation (<=) in the UD60x18 type.\\nfunction lte(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() <= y.unwrap();\\n}\\n\\n/// @notice Implements the checked modulo operation (%) in the UD60x18 type.\\nfunction mod(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() % y.unwrap());\\n}\\n\\n/// @notice Implements the not equal operation (!=) in the UD60x18 type.\\nfunction neq(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() != y.unwrap();\\n}\\n\\n/// @notice Implements the NOT (~) bitwise operation in the UD60x18 type.\\nfunction not(UD60x18 x) pure returns (UD60x18 result) {\\n result = wrap(~x.unwrap());\\n}\\n\\n/// @notice Implements the OR (|) bitwise operation in the UD60x18 type.\\nfunction or(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() | y.unwrap());\\n}\\n\\n/// @notice Implements the right shift operation (>>) in the UD60x18 type.\\nfunction rshift(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() >> bits);\\n}\\n\\n/// @notice Implements the checked subtraction operation (-) in the UD60x18 type.\\nfunction sub(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() - y.unwrap());\\n}\\n\\n/// @notice Implements the unchecked addition operation (+) in the UD60x18 type.\\nfunction uncheckedAdd(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() + y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the unchecked subtraction operation (-) in the UD60x18 type.\\nfunction uncheckedSub(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() - y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the XOR (^) bitwise operation in the UD60x18 type.\\nfunction xor(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() ^ y.unwrap());\\n}\\n\",\"keccak256\":\"0xf5faff881391d2c060029499a666cc5f0bea90a213150bb476fae8f02a5df268\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as Errors;\\nimport { wrap } from \\\"./Casting.sol\\\";\\nimport {\\n uEXP_MAX_INPUT,\\n uEXP2_MAX_INPUT,\\n uHALF_UNIT,\\n uLOG2_10,\\n uLOG2_E,\\n uMAX_UD60x18,\\n uMAX_WHOLE_UD60x18,\\n UNIT,\\n uUNIT,\\n uUNIT_SQUARED,\\n ZERO\\n} from \\\"./Constants.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n MATHEMATICAL FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @notice Calculates the arithmetic average of x and y using the following formula:\\n///\\n/// $$\\n/// avg(x, y) = (x & y) + ((xUint ^ yUint) / 2)\\n/// $$\\n///\\n/// In English, this is what this formula does:\\n///\\n/// 1. AND x and y.\\n/// 2. Calculate half of XOR x and y.\\n/// 3. Add the two results together.\\n///\\n/// This technique is known as SWAR, which stands for \\\"SIMD within a register\\\". You can read more about it here:\\n/// https://devblogs.microsoft.com/oldnewthing/20220207-00/?p=106223\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// @param x The first operand as a UD60x18 number.\\n/// @param y The second operand as a UD60x18 number.\\n/// @return result The arithmetic average as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction avg(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n uint256 yUint = y.unwrap();\\n unchecked {\\n result = wrap((xUint & yUint) + ((xUint ^ yUint) >> 1));\\n }\\n}\\n\\n/// @notice Yields the smallest whole number greater than or equal to x.\\n///\\n/// @dev This is optimized for fractional value inputs, because for every whole value there are (1e18 - 1) fractional\\n/// counterparts. See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n///\\n/// Requirements:\\n/// - x must be less than or equal to `MAX_WHOLE_UD60x18`.\\n///\\n/// @param x The UD60x18 number to ceil.\\n/// @param result The smallest whole number greater than or equal to x, as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ceil(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n if (xUint > uMAX_WHOLE_UD60x18) {\\n revert Errors.PRBMath_UD60x18_Ceil_Overflow(x);\\n }\\n\\n assembly (\\\"memory-safe\\\") {\\n // Equivalent to `x % UNIT`.\\n let remainder := mod(x, uUNIT)\\n\\n // Equivalent to `UNIT - remainder`.\\n let delta := sub(uUNIT, remainder)\\n\\n // Equivalent to `x + remainder > 0 ? delta : 0`.\\n result := add(x, mul(delta, gt(remainder, 0)))\\n }\\n}\\n\\n/// @notice Divides two UD60x18 numbers, returning a new UD60x18 number.\\n///\\n/// @dev Uses {Common.mulDiv} to enable overflow-safe multiplication and division.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv}.\\n///\\n/// @param x The numerator as a UD60x18 number.\\n/// @param y The denominator as a UD60x18 number.\\n/// @param result The quotient as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction div(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(Common.mulDiv(x.unwrap(), uUNIT, y.unwrap()));\\n}\\n\\n/// @notice Calculates the natural exponent of x using the following formula:\\n///\\n/// $$\\n/// e^x = 2^{x * log_2{e}}\\n/// $$\\n///\\n/// @dev Requirements:\\n/// - x must be less than 133_084258667509499441.\\n///\\n/// @param x The exponent as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n // This check prevents values greater than 192e18 from being passed to {exp2}.\\n if (xUint > uEXP_MAX_INPUT) {\\n revert Errors.PRBMath_UD60x18_Exp_InputTooBig(x);\\n }\\n\\n unchecked {\\n // Inline the fixed-point multiplication to save gas.\\n uint256 doubleUnitProduct = xUint * uLOG2_E;\\n result = exp2(wrap(doubleUnitProduct / uUNIT));\\n }\\n}\\n\\n/// @notice Calculates the binary exponent of x using the binary fraction method.\\n///\\n/// @dev See https://ethereum.stackexchange.com/q/79903/24693\\n///\\n/// Requirements:\\n/// - x must be less than 192e18.\\n/// - The result must fit in UD60x18.\\n///\\n/// @param x The exponent as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp2(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n // Numbers greater than or equal to 192e18 don't fit in the 192.64-bit format.\\n if (xUint > uEXP2_MAX_INPUT) {\\n revert Errors.PRBMath_UD60x18_Exp2_InputTooBig(x);\\n }\\n\\n // Convert x to the 192.64-bit fixed-point format.\\n uint256 x_192x64 = (xUint << 64) / uUNIT;\\n\\n // Pass x to the {Common.exp2} function, which uses the 192.64-bit fixed-point number representation.\\n result = wrap(Common.exp2(x_192x64));\\n}\\n\\n/// @notice Yields the greatest whole number less than or equal to x.\\n/// @dev Optimized for fractional value inputs, because every whole value has (1e18 - 1) fractional counterparts.\\n/// See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n/// @param x The UD60x18 number to floor.\\n/// @param result The greatest whole number less than or equal to x, as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction floor(UD60x18 x) pure returns (UD60x18 result) {\\n assembly (\\\"memory-safe\\\") {\\n // Equivalent to `x % UNIT`.\\n let remainder := mod(x, uUNIT)\\n\\n // Equivalent to `x - remainder > 0 ? remainder : 0)`.\\n result := sub(x, mul(remainder, gt(remainder, 0)))\\n }\\n}\\n\\n/// @notice Yields the excess beyond the floor of x using the odd function definition.\\n/// @dev See https://en.wikipedia.org/wiki/Fractional_part.\\n/// @param x The UD60x18 number to get the fractional part of.\\n/// @param result The fractional part of x as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction frac(UD60x18 x) pure returns (UD60x18 result) {\\n assembly (\\\"memory-safe\\\") {\\n result := mod(x, uUNIT)\\n }\\n}\\n\\n/// @notice Calculates the geometric mean of x and y, i.e. $\\\\sqrt{x * y}$, rounding down.\\n///\\n/// @dev Requirements:\\n/// - x * y must fit in UD60x18.\\n///\\n/// @param x The first operand as a UD60x18 number.\\n/// @param y The second operand as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction gm(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n uint256 yUint = y.unwrap();\\n if (xUint == 0 || yUint == 0) {\\n return ZERO;\\n }\\n\\n unchecked {\\n // Checking for overflow this way is faster than letting Solidity do it.\\n uint256 xyUint = xUint * yUint;\\n if (xyUint / xUint != yUint) {\\n revert Errors.PRBMath_UD60x18_Gm_Overflow(x, y);\\n }\\n\\n // We don't need to multiply the result by `UNIT` here because the x*y product picked up a factor of `UNIT`\\n // during multiplication. See the comments in {Common.sqrt}.\\n result = wrap(Common.sqrt(xyUint));\\n }\\n}\\n\\n/// @notice Calculates the inverse of x.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x must not be zero.\\n///\\n/// @param x The UD60x18 number for which to calculate the inverse.\\n/// @return result The inverse as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction inv(UD60x18 x) pure returns (UD60x18 result) {\\n unchecked {\\n result = wrap(uUNIT_SQUARED / x.unwrap());\\n }\\n}\\n\\n/// @notice Calculates the natural logarithm of x using the following formula:\\n///\\n/// $$\\n/// ln{x} = log_2{x} / log_2{e}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n/// - The precision isn't sufficiently fine-grained to return exactly `UNIT` when the input is `E`.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The UD60x18 number for which to calculate the natural logarithm.\\n/// @return result The natural logarithm as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ln(UD60x18 x) pure returns (UD60x18 result) {\\n unchecked {\\n // Inline the fixed-point multiplication to save gas. This is overflow-safe because the maximum value that\\n // {log2} can return is ~196_205294292027477728.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_E);\\n }\\n}\\n\\n/// @notice Calculates the common logarithm of x using the following formula:\\n///\\n/// $$\\n/// log_{10}{x} = log_2{x} / log_2{10}\\n/// $$\\n///\\n/// However, if x is an exact power of ten, a hard coded value is returned.\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The UD60x18 number for which to calculate the common logarithm.\\n/// @return result The common logarithm as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log10(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n if (xUint < uUNIT) {\\n revert Errors.PRBMath_UD60x18_Log_InputTooSmall(x);\\n }\\n\\n // Note that the `mul` in this assembly block is the standard multiplication operation, not {UD60x18.mul}.\\n // prettier-ignore\\n assembly (\\\"memory-safe\\\") {\\n switch x\\n case 1 { result := mul(uUNIT, sub(0, 18)) }\\n case 10 { result := mul(uUNIT, sub(1, 18)) }\\n case 100 { result := mul(uUNIT, sub(2, 18)) }\\n case 1000 { result := mul(uUNIT, sub(3, 18)) }\\n case 10000 { result := mul(uUNIT, sub(4, 18)) }\\n case 100000 { result := mul(uUNIT, sub(5, 18)) }\\n case 1000000 { result := mul(uUNIT, sub(6, 18)) }\\n case 10000000 { result := mul(uUNIT, sub(7, 18)) }\\n case 100000000 { result := mul(uUNIT, sub(8, 18)) }\\n case 1000000000 { result := mul(uUNIT, sub(9, 18)) }\\n case 10000000000 { result := mul(uUNIT, sub(10, 18)) }\\n case 100000000000 { result := mul(uUNIT, sub(11, 18)) }\\n case 1000000000000 { result := mul(uUNIT, sub(12, 18)) }\\n case 10000000000000 { result := mul(uUNIT, sub(13, 18)) }\\n case 100000000000000 { result := mul(uUNIT, sub(14, 18)) }\\n case 1000000000000000 { result := mul(uUNIT, sub(15, 18)) }\\n case 10000000000000000 { result := mul(uUNIT, sub(16, 18)) }\\n case 100000000000000000 { result := mul(uUNIT, sub(17, 18)) }\\n case 1000000000000000000 { result := 0 }\\n case 10000000000000000000 { result := uUNIT }\\n case 100000000000000000000 { result := mul(uUNIT, 2) }\\n case 1000000000000000000000 { result := mul(uUNIT, 3) }\\n case 10000000000000000000000 { result := mul(uUNIT, 4) }\\n case 100000000000000000000000 { result := mul(uUNIT, 5) }\\n case 1000000000000000000000000 { result := mul(uUNIT, 6) }\\n case 10000000000000000000000000 { result := mul(uUNIT, 7) }\\n case 100000000000000000000000000 { result := mul(uUNIT, 8) }\\n case 1000000000000000000000000000 { result := mul(uUNIT, 9) }\\n case 10000000000000000000000000000 { result := mul(uUNIT, 10) }\\n case 100000000000000000000000000000 { result := mul(uUNIT, 11) }\\n case 1000000000000000000000000000000 { result := mul(uUNIT, 12) }\\n case 10000000000000000000000000000000 { result := mul(uUNIT, 13) }\\n case 100000000000000000000000000000000 { result := mul(uUNIT, 14) }\\n case 1000000000000000000000000000000000 { result := mul(uUNIT, 15) }\\n case 10000000000000000000000000000000000 { result := mul(uUNIT, 16) }\\n case 100000000000000000000000000000000000 { result := mul(uUNIT, 17) }\\n case 1000000000000000000000000000000000000 { result := mul(uUNIT, 18) }\\n case 10000000000000000000000000000000000000 { result := mul(uUNIT, 19) }\\n case 100000000000000000000000000000000000000 { result := mul(uUNIT, 20) }\\n case 1000000000000000000000000000000000000000 { result := mul(uUNIT, 21) }\\n case 10000000000000000000000000000000000000000 { result := mul(uUNIT, 22) }\\n case 100000000000000000000000000000000000000000 { result := mul(uUNIT, 23) }\\n case 1000000000000000000000000000000000000000000 { result := mul(uUNIT, 24) }\\n case 10000000000000000000000000000000000000000000 { result := mul(uUNIT, 25) }\\n case 100000000000000000000000000000000000000000000 { result := mul(uUNIT, 26) }\\n case 1000000000000000000000000000000000000000000000 { result := mul(uUNIT, 27) }\\n case 10000000000000000000000000000000000000000000000 { result := mul(uUNIT, 28) }\\n case 100000000000000000000000000000000000000000000000 { result := mul(uUNIT, 29) }\\n case 1000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 30) }\\n case 10000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 31) }\\n case 100000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 32) }\\n case 1000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 33) }\\n case 10000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 34) }\\n case 100000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 35) }\\n case 1000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 36) }\\n case 10000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 37) }\\n case 100000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 38) }\\n case 1000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 39) }\\n case 10000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 40) }\\n case 100000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 41) }\\n case 1000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 42) }\\n case 10000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 43) }\\n case 100000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 44) }\\n case 1000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 45) }\\n case 10000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 46) }\\n case 100000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 47) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 48) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 49) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 50) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 51) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 52) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 53) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 54) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 55) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 56) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 57) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 58) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 59) }\\n default { result := uMAX_UD60x18 }\\n }\\n\\n if (result.unwrap() == uMAX_UD60x18) {\\n unchecked {\\n // Inline the fixed-point division to save gas.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_10);\\n }\\n }\\n}\\n\\n/// @notice Calculates the binary logarithm of x using the iterative approximation algorithm:\\n///\\n/// $$\\n/// log_2{x} = n + log_2{y}, \\\\text{ where } y = x*2^{-n}, \\\\ y \\\\in [1, 2)\\n/// $$\\n///\\n/// For $0 \\\\leq x \\\\lt 1$, the input is inverted:\\n///\\n/// $$\\n/// log_2{x} = -log_2{\\\\frac{1}{x}}\\n/// $$\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Binary_logarithm#Iterative_approximation\\n///\\n/// Notes:\\n/// - Due to the lossy precision of the iterative approximation, the results are not perfectly accurate to the last decimal.\\n///\\n/// Requirements:\\n/// - x must be greater than zero.\\n///\\n/// @param x The UD60x18 number for which to calculate the binary logarithm.\\n/// @return result The binary logarithm as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log2(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n if (xUint < uUNIT) {\\n revert Errors.PRBMath_UD60x18_Log_InputTooSmall(x);\\n }\\n\\n unchecked {\\n // Calculate the integer part of the logarithm.\\n uint256 n = Common.msb(xUint / uUNIT);\\n\\n // This is the integer part of the logarithm as a UD60x18 number. The operation can't overflow because n\\n // n is at most 255 and UNIT is 1e18.\\n uint256 resultUint = n * uUNIT;\\n\\n // Calculate $y = x * 2^{-n}$.\\n uint256 y = xUint >> n;\\n\\n // If y is the unit number, the fractional part is zero.\\n if (y == uUNIT) {\\n return wrap(resultUint);\\n }\\n\\n // Calculate the fractional part via the iterative approximation.\\n // The `delta >>= 1` part is equivalent to `delta /= 2`, but shifting bits is more gas efficient.\\n uint256 DOUBLE_UNIT = 2e18;\\n for (uint256 delta = uHALF_UNIT; delta > 0; delta >>= 1) {\\n y = (y * y) / uUNIT;\\n\\n // Is y^2 >= 2e18 and so in the range [2e18, 4e18)?\\n if (y >= DOUBLE_UNIT) {\\n // Add the 2^{-m} factor to the logarithm.\\n resultUint += delta;\\n\\n // Halve y, which corresponds to z/2 in the Wikipedia article.\\n y >>= 1;\\n }\\n }\\n result = wrap(resultUint);\\n }\\n}\\n\\n/// @notice Multiplies two UD60x18 numbers together, returning a new UD60x18 number.\\n///\\n/// @dev Uses {Common.mulDiv} to enable overflow-safe multiplication and division.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv}.\\n///\\n/// @dev See the documentation in {Common.mulDiv18}.\\n/// @param x The multiplicand as a UD60x18 number.\\n/// @param y The multiplier as a UD60x18 number.\\n/// @return result The product as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mul(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(Common.mulDiv18(x.unwrap(), y.unwrap()));\\n}\\n\\n/// @notice Raises x to the power of y.\\n///\\n/// For $1 \\\\leq x \\\\leq \\\\infty$, the following standard formula is used:\\n///\\n/// $$\\n/// x^y = 2^{log_2{x} * y}\\n/// $$\\n///\\n/// For $0 \\\\leq x \\\\lt 1$, since the unsigned {log2} is undefined, an equivalent formula is used:\\n///\\n/// $$\\n/// i = \\\\frac{1}{x}\\n/// w = 2^{log_2{i} * y}\\n/// x^y = \\\\frac{1}{w}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2} and {mul}.\\n/// - Returns `UNIT` for 0^0.\\n/// - It may not perform well with very small values of x. Consider using SD59x18 as an alternative.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {exp2}, {log2}, and {mul}.\\n///\\n/// @param x The base as a UD60x18 number.\\n/// @param y The exponent as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction pow(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n uint256 yUint = y.unwrap();\\n\\n // If both x and y are zero, the result is `UNIT`. If just x is zero, the result is always zero.\\n if (xUint == 0) {\\n return yUint == 0 ? UNIT : ZERO;\\n }\\n // If x is `UNIT`, the result is always `UNIT`.\\n else if (xUint == uUNIT) {\\n return UNIT;\\n }\\n\\n // If y is zero, the result is always `UNIT`.\\n if (yUint == 0) {\\n return UNIT;\\n }\\n // If y is `UNIT`, the result is always x.\\n else if (yUint == uUNIT) {\\n return x;\\n }\\n\\n // If x is greater than `UNIT`, use the standard formula.\\n if (xUint > uUNIT) {\\n result = exp2(mul(log2(x), y));\\n }\\n // Conversely, if x is less than `UNIT`, use the equivalent formula.\\n else {\\n UD60x18 i = wrap(uUNIT_SQUARED / xUint);\\n UD60x18 w = exp2(mul(log2(i), y));\\n result = wrap(uUNIT_SQUARED / w.unwrap());\\n }\\n}\\n\\n/// @notice Raises x (a UD60x18 number) to the power y (an unsigned basic integer) using the well-known\\n/// algorithm \\\"exponentiation by squaring\\\".\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Exponentiation_by_squaring.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv18}.\\n/// - Returns `UNIT` for 0^0.\\n///\\n/// Requirements:\\n/// - The result must fit in UD60x18.\\n///\\n/// @param x The base as a UD60x18 number.\\n/// @param y The exponent as a uint256.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction powu(UD60x18 x, uint256 y) pure returns (UD60x18 result) {\\n // Calculate the first iteration of the loop in advance.\\n uint256 xUint = x.unwrap();\\n uint256 resultUint = y & 1 > 0 ? xUint : uUNIT;\\n\\n // Equivalent to `for(y /= 2; y > 0; y /= 2)`.\\n for (y >>= 1; y > 0; y >>= 1) {\\n xUint = Common.mulDiv18(xUint, xUint);\\n\\n // Equivalent to `y % 2 == 1`.\\n if (y & 1 > 0) {\\n resultUint = Common.mulDiv18(resultUint, xUint);\\n }\\n }\\n result = wrap(resultUint);\\n}\\n\\n/// @notice Calculates the square root of x using the Babylonian method.\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\\n///\\n/// Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x must be less than `MAX_UD60x18 / UNIT`.\\n///\\n/// @param x The UD60x18 number for which to calculate the square root.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction sqrt(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n unchecked {\\n if (xUint > uMAX_UD60x18 / uUNIT) {\\n revert Errors.PRBMath_UD60x18_Sqrt_Overflow(x);\\n }\\n // Multiply x by `UNIT` to account for the factor of `UNIT` picked up when multiplying two UD60x18 numbers.\\n // In this case, the two numbers are both the square root.\\n result = wrap(Common.sqrt(xUint * uUNIT));\\n }\\n}\\n\",\"keccak256\":\"0x462144667aac3f96d5f8dba7aa68fe4c5a3f61e1d7bbbc81bee21168817f9c09\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\nimport \\\"./Helpers.sol\\\" as Helpers;\\nimport \\\"./Math.sol\\\" as Math;\\n\\n/// @notice The unsigned 60.18-decimal fixed-point number representation, which can have up to 60 digits and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the Solidity type uint256.\\n/// @dev The value type is defined here so it can be imported in all other files.\\ntype UD60x18 is uint256;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoSD1x18,\\n Casting.intoUD2x18,\\n Casting.intoSD59x18,\\n Casting.intoUint128,\\n Casting.intoUint256,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for UD60x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n MATHEMATICAL FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes the functions in this library callable on the UD60x18 type.\\nusing {\\n Math.avg,\\n Math.ceil,\\n Math.div,\\n Math.exp,\\n Math.exp2,\\n Math.floor,\\n Math.frac,\\n Math.gm,\\n Math.inv,\\n Math.ln,\\n Math.log10,\\n Math.log2,\\n Math.mul,\\n Math.pow,\\n Math.powu,\\n Math.sqrt\\n} for UD60x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n HELPER FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes the functions in this library callable on the UD60x18 type.\\nusing {\\n Helpers.add,\\n Helpers.and,\\n Helpers.eq,\\n Helpers.gt,\\n Helpers.gte,\\n Helpers.isZero,\\n Helpers.lshift,\\n Helpers.lt,\\n Helpers.lte,\\n Helpers.mod,\\n Helpers.neq,\\n Helpers.not,\\n Helpers.or,\\n Helpers.rshift,\\n Helpers.sub,\\n Helpers.uncheckedAdd,\\n Helpers.uncheckedSub,\\n Helpers.xor\\n} for UD60x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n OPERATORS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes it possible to use these operators on the UD60x18 type.\\nusing {\\n Helpers.add as +,\\n Helpers.and2 as &,\\n Math.div as /,\\n Helpers.eq as ==,\\n Helpers.gt as >,\\n Helpers.gte as >=,\\n Helpers.lt as <,\\n Helpers.lte as <=,\\n Helpers.or as |,\\n Helpers.mod as %,\\n Math.mul as *,\\n Helpers.neq as !=,\\n Helpers.not as ~,\\n Helpers.sub as -,\\n Helpers.xor as ^\\n} for UD60x18 global;\\n\",\"keccak256\":\"0xdd873b5124180d9b71498b3a7fe93b1c08c368bec741f7d5f8e17f78a0b70f31\",\"license\":\"MIT\"},\"contracts/interfaces/IERC6551Registry.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\ninterface IERC6551Registry {\\n /**\\n * @dev Creates a token bound account for a non-fungible token.\\n *\\n * If account has already been created, returns the account address without calling create2.\\n *\\n * Emits ERC6551AccountCreated event.\\n *\\n * @return account The address of the token bound account\\n */\\n function createAccount(\\n address implementation,\\n bytes32 salt,\\n uint256 chainId,\\n address tokenContract,\\n uint256 tokenId\\n ) external returns (address account);\\n}\\n\",\"keccak256\":\"0x64c52de8a8e68398e61dd8b42dda8e9af8cf6abf93bb85629c322440991ea568\",\"license\":\"MIT\"},\"contracts/interfaces/hats/HatsErrors.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface HatsErrors {\\n /// @notice Emitted when `user` is attempting to perform an action on `hatId` but is not wearing one of `hatId`'s admin hats\\n /// @dev Can be equivalent to `NotHatWearer(buildHatId(hatId))`, such as when emitted by `approveLinkTopHatToTree` or `relinkTopHatToTree`\\n error NotAdmin(address user, uint256 hatId);\\n\\n /// @notice Emitted when attempting to perform an action as or for an account that is not a wearer of a given hat\\n error NotHatWearer();\\n\\n /// @notice Emitted when attempting to perform an action that requires being either an admin or wearer of a given hat\\n error NotAdminOrWearer();\\n\\n /// @notice Emitted when attempting to mint `hatId` but `hatId`'s maxSupply has been reached\\n error AllHatsWorn(uint256 hatId);\\n\\n /// @notice Emitted when attempting to create a hat with a level 14 hat as its admin\\n error MaxLevelsReached();\\n\\n /// @notice Emitted when an attempted hat id has empty intermediate level(s)\\n error InvalidHatId();\\n\\n /// @notice Emitted when attempting to mint `hatId` to a `wearer` who is already wearing the hat\\n error AlreadyWearingHat(address wearer, uint256 hatId);\\n\\n /// @notice Emitted when attempting to mint a non-existant hat\\n error HatDoesNotExist(uint256 hatId);\\n\\n /// @notice Emmitted when attempting to mint or transfer a hat that is not active\\n error HatNotActive();\\n\\n /// @notice Emitted when attempting to mint or transfer a hat to an ineligible wearer\\n error NotEligible();\\n\\n /// @notice Emitted when attempting to check or set a hat's status from an account that is not that hat's toggle module\\n error NotHatsToggle();\\n\\n /// @notice Emitted when attempting to check or set a hat wearer's status from an account that is not that hat's eligibility module\\n error NotHatsEligibility();\\n\\n /// @notice Emitted when array arguments to a batch function have mismatching lengths\\n error BatchArrayLengthMismatch();\\n\\n /// @notice Emitted when attempting to mutate or transfer an immutable hat\\n error Immutable();\\n\\n /// @notice Emitted when attempting to change a hat's maxSupply to a value lower than its current supply\\n error NewMaxSupplyTooLow();\\n\\n /// @notice Emitted when attempting to link a tophat to a new admin for which the tophat serves as an admin\\n error CircularLinkage();\\n\\n /// @notice Emitted when attempting to link or relink a tophat to a separate tree\\n error CrossTreeLinkage();\\n\\n /// @notice Emitted when attempting to link a tophat without a request\\n error LinkageNotRequested();\\n\\n /// @notice Emitted when attempting to unlink a tophat that does not have a wearer\\n /// @dev This ensures that unlinking never results in a bricked tophat\\n error InvalidUnlink();\\n\\n /// @notice Emmited when attempting to change a hat's eligibility or toggle module to the zero address\\n error ZeroAddress();\\n\\n /// @notice Emmitted when attempting to change a hat's details or imageURI to a string with over 7000 bytes (~characters)\\n /// @dev This protects against a DOS attack where an admin iteratively extend's a hat's details or imageURI\\n /// to be so long that reading it exceeds the block gas limit, breaking `uri()` and `viewHat()`\\n error StringTooLong();\\n}\\n\",\"keccak256\":\"0x81b0056b7bed86eabc07c0e4a9655c586ddb8e6c128320593669b76efd5a08de\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/HatsEvents.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface HatsEvents {\\n /// @notice Emitted when a new hat is created\\n /// @param id The id for the new hat\\n /// @param details A description of the Hat\\n /// @param maxSupply The total instances of the Hat that can be worn at once\\n /// @param eligibility The address that can report on the Hat wearer's status\\n /// @param toggle The address that can deactivate the Hat\\n /// @param mutable_ Whether the hat's properties are changeable after creation\\n /// @param imageURI The image uri for this hat and the fallback for its\\n event HatCreated(\\n uint256 id,\\n string details,\\n uint32 maxSupply,\\n address eligibility,\\n address toggle,\\n bool mutable_,\\n string imageURI\\n );\\n\\n /// @notice Emitted when a hat wearer's standing is updated\\n /// @dev Eligibility is excluded since the source of truth for eligibility is the eligibility module and may change without a transaction\\n /// @param hatId The id of the wearer's hat\\n /// @param wearer The wearer's address\\n /// @param wearerStanding Whether the wearer is in good standing for the hat\\n event WearerStandingChanged(\\n uint256 hatId,\\n address wearer,\\n bool wearerStanding\\n );\\n\\n /// @notice Emitted when a hat's status is updated\\n /// @param hatId The id of the hat\\n /// @param newStatus Whether the hat is active\\n event HatStatusChanged(uint256 hatId, bool newStatus);\\n\\n /// @notice Emitted when a hat's details are updated\\n /// @param hatId The id of the hat\\n /// @param newDetails The updated details\\n event HatDetailsChanged(uint256 hatId, string newDetails);\\n\\n /// @notice Emitted when a hat's eligibility module is updated\\n /// @param hatId The id of the hat\\n /// @param newEligibility The updated eligibiliy module\\n event HatEligibilityChanged(uint256 hatId, address newEligibility);\\n\\n /// @notice Emitted when a hat's toggle module is updated\\n /// @param hatId The id of the hat\\n /// @param newToggle The updated toggle module\\n event HatToggleChanged(uint256 hatId, address newToggle);\\n\\n /// @notice Emitted when a hat's mutability is updated\\n /// @param hatId The id of the hat\\n event HatMutabilityChanged(uint256 hatId);\\n\\n /// @notice Emitted when a hat's maximum supply is updated\\n /// @param hatId The id of the hat\\n /// @param newMaxSupply The updated max supply\\n event HatMaxSupplyChanged(uint256 hatId, uint32 newMaxSupply);\\n\\n /// @notice Emitted when a hat's image URI is updated\\n /// @param hatId The id of the hat\\n /// @param newImageURI The updated image URI\\n event HatImageURIChanged(uint256 hatId, string newImageURI);\\n\\n /// @notice Emitted when a tophat linkage is requested by its admin\\n /// @param domain The domain of the tree tophat to link\\n /// @param newAdmin The tophat's would-be admin in the parent tree\\n event TopHatLinkRequested(uint32 domain, uint256 newAdmin);\\n\\n /// @notice Emitted when a tophat is linked to a another tree\\n /// @param domain The domain of the newly-linked tophat\\n /// @param newAdmin The tophat's new admin in the parent tree\\n event TopHatLinked(uint32 domain, uint256 newAdmin);\\n}\\n\",\"keccak256\":\"0x53413397d15e1636c3cd7bd667656b79bc2886785403b824bcd4ed122667f2c6\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/IHats.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\nimport \\\"./IHatsIdUtilities.sol\\\";\\nimport \\\"./HatsErrors.sol\\\";\\nimport \\\"./HatsEvents.sol\\\";\\n\\ninterface IHats is IHatsIdUtilities, HatsErrors, HatsEvents {\\n function mintTopHat(\\n address _target,\\n string memory _details,\\n string memory _imageURI\\n ) external returns (uint256 topHatId);\\n\\n function createHat(\\n uint256 _admin,\\n string calldata _details,\\n uint32 _maxSupply,\\n address _eligibility,\\n address _toggle,\\n bool _mutable,\\n string calldata _imageURI\\n ) external returns (uint256 newHatId);\\n\\n function batchCreateHats(\\n uint256[] calldata _admins,\\n string[] calldata _details,\\n uint32[] calldata _maxSupplies,\\n address[] memory _eligibilityModules,\\n address[] memory _toggleModules,\\n bool[] calldata _mutables,\\n string[] calldata _imageURIs\\n ) external returns (bool success);\\n\\n function getNextId(uint256 _admin) external view returns (uint256 nextId);\\n\\n function mintHat(\\n uint256 _hatId,\\n address _wearer\\n ) external returns (bool success);\\n\\n function batchMintHats(\\n uint256[] calldata _hatIds,\\n address[] calldata _wearers\\n ) external returns (bool success);\\n\\n function setHatStatus(\\n uint256 _hatId,\\n bool _newStatus\\n ) external returns (bool toggled);\\n\\n function checkHatStatus(uint256 _hatId) external returns (bool toggled);\\n\\n function setHatWearerStatus(\\n uint256 _hatId,\\n address _wearer,\\n bool _eligible,\\n bool _standing\\n ) external returns (bool updated);\\n\\n function checkHatWearerStatus(\\n uint256 _hatId,\\n address _wearer\\n ) external returns (bool updated);\\n\\n function renounceHat(uint256 _hatId) external;\\n\\n function transferHat(uint256 _hatId, address _from, address _to) external;\\n\\n /*//////////////////////////////////////////////////////////////\\n HATS ADMIN FUNCTIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n function makeHatImmutable(uint256 _hatId) external;\\n\\n function changeHatDetails(\\n uint256 _hatId,\\n string memory _newDetails\\n ) external;\\n\\n function changeHatEligibility(\\n uint256 _hatId,\\n address _newEligibility\\n ) external;\\n\\n function changeHatToggle(uint256 _hatId, address _newToggle) external;\\n\\n function changeHatImageURI(\\n uint256 _hatId,\\n string memory _newImageURI\\n ) external;\\n\\n function changeHatMaxSupply(uint256 _hatId, uint32 _newMaxSupply) external;\\n\\n function requestLinkTopHatToTree(\\n uint32 _topHatId,\\n uint256 _newAdminHat\\n ) external;\\n\\n function approveLinkTopHatToTree(\\n uint32 _topHatId,\\n uint256 _newAdminHat,\\n address _eligibility,\\n address _toggle,\\n string calldata _details,\\n string calldata _imageURI\\n ) external;\\n\\n function unlinkTopHatFromTree(uint32 _topHatId, address _wearer) external;\\n\\n function relinkTopHatWithinTree(\\n uint32 _topHatDomain,\\n uint256 _newAdminHat,\\n address _eligibility,\\n address _toggle,\\n string calldata _details,\\n string calldata _imageURI\\n ) external;\\n\\n /*//////////////////////////////////////////////////////////////\\n VIEW FUNCTIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n function viewHat(\\n uint256 _hatId\\n )\\n external\\n view\\n returns (\\n string memory details,\\n uint32 maxSupply,\\n uint32 supply,\\n address eligibility,\\n address toggle,\\n string memory imageURI,\\n uint16 lastHatId,\\n bool mutable_,\\n bool active\\n );\\n\\n function isWearerOfHat(\\n address _user,\\n uint256 _hatId\\n ) external view returns (bool isWearer);\\n\\n function isAdminOfHat(\\n address _user,\\n uint256 _hatId\\n ) external view returns (bool isAdmin);\\n\\n function isInGoodStanding(\\n address _wearer,\\n uint256 _hatId\\n ) external view returns (bool standing);\\n\\n function isEligible(\\n address _wearer,\\n uint256 _hatId\\n ) external view returns (bool eligible);\\n\\n function getHatEligibilityModule(\\n uint256 _hatId\\n ) external view returns (address eligibility);\\n\\n function getHatToggleModule(\\n uint256 _hatId\\n ) external view returns (address toggle);\\n\\n function getHatMaxSupply(\\n uint256 _hatId\\n ) external view returns (uint32 maxSupply);\\n\\n function hatSupply(uint256 _hatId) external view returns (uint32 supply);\\n\\n function getImageURIForHat(\\n uint256 _hatId\\n ) external view returns (string memory _uri);\\n\\n function balanceOf(\\n address wearer,\\n uint256 hatId\\n ) external view returns (uint256 balance);\\n\\n function balanceOfBatch(\\n address[] calldata _wearers,\\n uint256[] calldata _hatIds\\n ) external view returns (uint256[] memory);\\n\\n function uri(uint256 id) external view returns (string memory _uri);\\n}\\n\",\"keccak256\":\"0x2867004bddc5148fa1937f25c0403e5d9977583aaf50fdbdb74bd463f64f21c8\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/IHatsIdUtilities.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface IHatsIdUtilities {\\n function buildHatId(\\n uint256 _admin,\\n uint16 _newHat\\n ) external pure returns (uint256 id);\\n\\n function getHatLevel(uint256 _hatId) external view returns (uint32 level);\\n\\n function getLocalHatLevel(\\n uint256 _hatId\\n ) external pure returns (uint32 level);\\n\\n function isTopHat(uint256 _hatId) external view returns (bool _topHat);\\n\\n function isLocalTopHat(\\n uint256 _hatId\\n ) external pure returns (bool _localTopHat);\\n\\n function isValidHatId(\\n uint256 _hatId\\n ) external view returns (bool validHatId);\\n\\n function getAdminAtLevel(\\n uint256 _hatId,\\n uint32 _level\\n ) external view returns (uint256 admin);\\n\\n function getAdminAtLocalLevel(\\n uint256 _hatId,\\n uint32 _level\\n ) external pure returns (uint256 admin);\\n\\n function getTopHatDomain(\\n uint256 _hatId\\n ) external view returns (uint32 domain);\\n\\n function getTippyTopHatDomain(\\n uint32 _topHatDomain\\n ) external view returns (uint32 domain);\\n\\n function noCircularLinkage(\\n uint32 _topHatDomain,\\n uint256 _linkedAdmin\\n ) external view returns (bool notCircular);\\n\\n function sameTippyTopHatDomain(\\n uint32 _topHatDomain,\\n uint256 _newAdminHat\\n ) external view returns (bool sameDomain);\\n}\\n\",\"keccak256\":\"0x007fcc07b20bf84bacad1f9a2ddf4e30e1a8be961e144b7bef8e98a51781aee9\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/IHatsModuleFactory.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.19;\\n\\ninterface IHatsModuleFactory {\\n error HatsModuleFactory_ModuleAlreadyDeployed(\\n address implementation,\\n uint256 hatId,\\n bytes otherImmutableArgs,\\n uint256 saltNonce\\n );\\n\\n error BatchArrayLengthMismatch();\\n\\n event HatsModuleFactory_ModuleDeployed(\\n address implementation,\\n address instance,\\n uint256 hatId,\\n bytes otherImmutableArgs,\\n bytes initData,\\n uint256 saltNonce\\n );\\n\\n function HATS() external view returns (address);\\n\\n function version() external view returns (string memory);\\n\\n function createHatsModule(\\n address _implementation,\\n uint256 _hatId,\\n bytes calldata _otherImmutableArgs,\\n bytes calldata _initData,\\n uint256 _saltNonce\\n ) external returns (address _instance);\\n\\n function batchCreateHatsModule(\\n address[] calldata _implementations,\\n uint256[] calldata _hatIds,\\n bytes[] calldata _otherImmutableArgsArray,\\n bytes[] calldata _initDataArray,\\n uint256[] calldata _saltNonces\\n ) external returns (bool success);\\n\\n function getHatsModuleAddress(\\n address _implementation,\\n uint256 _hatId,\\n bytes calldata _otherImmutableArgs,\\n uint256 _saltNonce\\n ) external view returns (address);\\n\\n function deployed(\\n address _implementation,\\n uint256 _hatId,\\n bytes calldata _otherImmutableArgs,\\n uint256 _saltNonce\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x861faf40785cedb829243116d492653414a367853408a5c27d201522f6c3bfdd\",\"license\":\"MIT\"},\"contracts/interfaces/hats/modules/IHatsElectionsEligibility.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.13;\\n\\ninterface IHatsElectionsEligibility {\\n event ElectionOpened(uint128 nextTermEnd);\\n event ElectionCompleted(uint128 termEnd, address[] winners);\\n event NewTermStarted(uint128 termEnd);\\n event Recalled(uint128 termEnd, address[] accounts);\\n\\n /// @notice Returns the first second after the current term ends.\\n /// @dev Also serves as the id for the current term.\\n function currentTermEnd() external view returns (uint128);\\n\\n /// @notice Returns the first second after the next term ends.\\n /// @dev Also serves as the id for the next term.\\n function nextTermEnd() external view returns (uint128);\\n\\n /// @notice Returns the election status (open or closed) for a given term end.\\n /// @param termEnd The term end timestamp to query.\\n function electionStatus(\\n uint128 termEnd\\n ) external view returns (bool isElectionOpen);\\n\\n /// @notice Returns whether a candidate was elected in a given term.\\n /// @param termEnd The term end timestamp to query.\\n /// @param candidate The address of the candidate.\\n function electionResults(\\n uint128 termEnd,\\n address candidate\\n ) external view returns (bool elected);\\n\\n /// @notice Returns the BALLOT_BOX_HAT constant.\\n function BALLOT_BOX_HAT() external pure returns (uint256);\\n\\n /// @notice Returns the ADMIN_HAT constant.\\n function ADMIN_HAT() external pure returns (uint256);\\n\\n /**\\n * @notice Submit the results of an election for a specified term.\\n * @dev Only callable by the wearer(s) of the BALLOT_BOX_HAT.\\n * @param _termEnd The id of the term for which the election results are being submitted.\\n * @param _winners The addresses of the winners of the election.\\n */\\n function elect(uint128 _termEnd, address[] calldata _winners) external;\\n\\n /**\\n * @notice Submit the results of a recall election for a specified term.\\n * @dev Only callable by the wearer(s) of the BALLOT_BOX_HAT.\\n * @param _termEnd The id of the term for which the recall results are being submitted.\\n * @param _recallees The addresses to be recalled.\\n */\\n function recall(uint128 _termEnd, address[] calldata _recallees) external;\\n\\n /**\\n * @notice Set the next term and open the election for it.\\n * @dev Only callable by the wearer(s) of the ADMIN_HAT.\\n * @param _newTermEnd The id of the term that will be opened.\\n */\\n function setNextTerm(uint128 _newTermEnd) external;\\n\\n /**\\n * @notice Start the next term, updating the current term.\\n * @dev Can be called by anyone, but will revert if conditions are not met.\\n */\\n function startNextTerm() external;\\n\\n /**\\n * @notice Determine the eligibility and standing of a wearer for a hat.\\n * @param _wearer The address of the hat wearer.\\n * @param _hatId The ID of the hat.\\n * @return eligible True if the wearer is eligible for the hat.\\n * @return standing True if the wearer is in good standing.\\n */\\n function getWearerStatus(\\n address _wearer,\\n uint256 _hatId\\n ) external view returns (bool eligible, bool standing);\\n}\\n\",\"keccak256\":\"0x74dfc5d538d866ddb8ee2ca1b569abf62e02d848c59f308adf6075ecff175c7d\",\"license\":\"MIT\"},\"contracts/interfaces/sablier/IAdminable.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\n/// @title IAdminable\\n/// @notice Contract module that provides a basic access control mechanism, with an admin that can be\\n/// granted exclusive access to specific functions. The inheriting contract must set the initial admin\\n/// in the constructor.\\ninterface IAdminable {\\n /*//////////////////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Emitted when the admin is transferred.\\n /// @param oldAdmin The address of the old admin.\\n /// @param newAdmin The address of the new admin.\\n event TransferAdmin(address indexed oldAdmin, address indexed newAdmin);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice The address of the admin account or contract.\\n function admin() external view returns (address);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n NON-CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Transfers the contract admin to a new address.\\n ///\\n /// @dev Notes:\\n /// - Does not revert if the admin is the same.\\n /// - This function can potentially leave the contract without an admin, thereby removing any\\n /// functionality that is only available to the admin.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the contract admin.\\n ///\\n /// @param newAdmin The address of the new admin.\\n function transferAdmin(address newAdmin) external;\\n}\\n\",\"keccak256\":\"0xa279c49e51228b571329164e36250e82b2c1378e8b549194ab7dd90fca9c3b2b\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/IERC4096.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 \\\"@openzeppelin/contracts/interfaces/IERC165.sol\\\";\\nimport {IERC721} from \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\n\\n/// @title ERC-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\",\"keccak256\":\"0xa34b9c52cbe36be860244f52256f1b05badf0cb797d208664b87337610d0e82d\",\"license\":\"MIT\"},\"contracts/interfaces/sablier/ISablierV2Lockup.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC4906} from \\\"./IERC4096.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IERC721Metadata} from \\\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\\\";\\nimport {UD60x18} from \\\"@prb/math/src/UD60x18.sol\\\";\\n\\nimport {Lockup} from \\\"./types/DataTypes.sol\\\";\\nimport {IAdminable} from \\\"./IAdminable.sol\\\";\\nimport {ISablierV2NFTDescriptor} from \\\"./ISablierV2NFTDescriptor.sol\\\";\\n\\n/// @title ISablierV2Lockup\\n/// @notice Common logic between all Sablier V2 Lockup contracts.\\ninterface ISablierV2Lockup is\\n IAdminable, // 0 inherited components\\n IERC4906, // 2 inherited components\\n IERC721Metadata // 2 inherited components\\n{\\n /*//////////////////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Emitted when the admin allows a new recipient contract to hook to Sablier.\\n /// @param admin The address of the current contract admin.\\n /// @param recipient The address of the recipient contract put on the allowlist.\\n event AllowToHook(address indexed admin, address recipient);\\n\\n /// @notice Emitted when a stream is canceled.\\n /// @param streamId The ID of the stream.\\n /// @param sender The address of the stream's sender.\\n /// @param recipient The address of the stream's recipient.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param senderAmount The amount of assets refunded to the stream's sender, denoted in units of the asset's\\n /// decimals.\\n /// @param recipientAmount The amount of assets left for the stream's recipient to withdraw, denoted in units of the\\n /// asset's decimals.\\n event CancelLockupStream(\\n uint256 streamId,\\n address indexed sender,\\n address indexed recipient,\\n IERC20 indexed asset,\\n uint128 senderAmount,\\n uint128 recipientAmount\\n );\\n\\n /// @notice Emitted when a sender gives up the right to cancel a stream.\\n /// @param streamId The ID of the stream.\\n event RenounceLockupStream(uint256 indexed streamId);\\n\\n /// @notice Emitted when the admin sets a new NFT descriptor contract.\\n /// @param admin The address of the current contract admin.\\n /// @param oldNFTDescriptor The address of the old NFT descriptor contract.\\n /// @param newNFTDescriptor The address of the new NFT descriptor contract.\\n event SetNFTDescriptor(\\n address indexed admin,\\n ISablierV2NFTDescriptor oldNFTDescriptor,\\n ISablierV2NFTDescriptor newNFTDescriptor\\n );\\n\\n /// @notice Emitted when assets are withdrawn from a stream.\\n /// @param streamId The ID of the stream.\\n /// @param to The address that has received the withdrawn assets.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param amount The amount of assets withdrawn, denoted in units of the asset's decimals.\\n event WithdrawFromLockupStream(\\n uint256 indexed streamId,\\n address indexed to,\\n IERC20 indexed asset,\\n uint128 amount\\n );\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Retrieves the address of the ERC-20 asset to be distributed.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getAsset(uint256 streamId) external view returns (IERC20 asset);\\n\\n /// @notice Retrieves the amount deposited in the stream, denoted in units of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getDepositedAmount(\\n uint256 streamId\\n ) external view returns (uint128 depositedAmount);\\n\\n /// @notice Retrieves the stream's end time, which is a Unix timestamp.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getEndTime(\\n uint256 streamId\\n ) external view returns (uint40 endTime);\\n\\n /// @notice Retrieves the stream's recipient.\\n /// @dev Reverts if the NFT has been burned.\\n /// @param streamId The stream ID for the query.\\n function getRecipient(\\n uint256 streamId\\n ) external view returns (address recipient);\\n\\n /// @notice Retrieves the amount refunded to the sender after a cancellation, denoted in units of the asset's\\n /// decimals. This amount is always zero unless the stream was canceled.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getRefundedAmount(\\n uint256 streamId\\n ) external view returns (uint128 refundedAmount);\\n\\n /// @notice Retrieves the stream's sender.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getSender(uint256 streamId) external view returns (address sender);\\n\\n /// @notice Retrieves the stream's start time, which is a Unix timestamp.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getStartTime(\\n uint256 streamId\\n ) external view returns (uint40 startTime);\\n\\n /// @notice Retrieves the amount withdrawn from the stream, denoted in units of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getWithdrawnAmount(\\n uint256 streamId\\n ) external view returns (uint128 withdrawnAmount);\\n\\n /// @notice Retrieves a flag indicating whether the provided address is a contract allowed to hook to Sablier\\n /// when a stream is canceled or when assets are withdrawn.\\n /// @dev See {ISablierLockupRecipient} for more information.\\n function isAllowedToHook(\\n address recipient\\n ) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream can be canceled. When the stream is cold, this\\n /// flag is always `false`.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isCancelable(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream is cold, i.e. settled, canceled, or depleted.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isCold(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream is depleted.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isDepleted(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream exists.\\n /// @dev Does not revert if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isStream(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream NFT can be transferred.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isTransferable(\\n uint256 streamId\\n ) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream is warm, i.e. either pending or streaming.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isWarm(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves the maximum broker fee that can be charged by the broker, denoted as a fixed-point\\n /// number where 1e18 is 100%.\\n /// @dev This value is hard coded as a constant.\\n function MAX_BROKER_FEE() external view returns (UD60x18);\\n\\n /// @notice Counter for stream IDs, used in the create functions.\\n function nextStreamId() external view returns (uint256);\\n\\n /// @notice Contract that generates the non-fungible token URI.\\n function nftDescriptor() external view returns (ISablierV2NFTDescriptor);\\n\\n /// @notice Calculates the amount that the sender would be refunded if the stream were canceled, denoted in units\\n /// of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function refundableAmountOf(\\n uint256 streamId\\n ) external view returns (uint128 refundableAmount);\\n\\n /// @notice Retrieves the stream's status.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function statusOf(\\n uint256 streamId\\n ) external view returns (Lockup.Status status);\\n\\n /// @notice Calculates the amount streamed to the recipient, denoted in units of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n ///\\n /// Notes:\\n /// - Upon cancellation of the stream, the amount streamed is calculated as the difference between the deposited\\n /// amount and the refunded amount. Ultimately, when the stream becomes depleted, the streamed amount is equivalent\\n /// to the total amount withdrawn.\\n ///\\n /// @param streamId The stream ID for the query.\\n function streamedAmountOf(\\n uint256 streamId\\n ) external view returns (uint128 streamedAmount);\\n\\n /// @notice Retrieves a flag indicating whether the stream was canceled.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function wasCanceled(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Calculates the amount that the recipient can withdraw from the stream, denoted in units of the asset's\\n /// decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function withdrawableAmountOf(\\n uint256 streamId\\n ) external view returns (uint128 withdrawableAmount);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n NON-CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Allows a recipient contract to hook to Sablier when a stream is canceled or when assets are withdrawn.\\n /// Useful for implementing contracts that hold streams on behalf of users, such as vaults or staking contracts.\\n ///\\n /// @dev Emits an {AllowToHook} event.\\n ///\\n /// Notes:\\n /// - Does not revert if the contract is already on the allowlist.\\n /// - This is an irreversible operation. The contract cannot be removed from the allowlist.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the contract admin.\\n /// - `recipient` must have a non-zero code size.\\n /// - `recipient` must implement {ISablierLockupRecipient}.\\n ///\\n /// @param recipient The address of the contract to allow for hooks.\\n function allowToHook(address recipient) external;\\n\\n /// @notice Burns the NFT associated with the stream.\\n ///\\n /// @dev Emits a {Transfer} event.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `streamId` must reference a depleted stream.\\n /// - The NFT must exist.\\n /// - `msg.sender` must be either the NFT owner or an approved third party.\\n ///\\n /// @param streamId The ID of the stream NFT to burn.\\n function burn(uint256 streamId) external;\\n\\n /// @notice Cancels the stream and refunds any remaining assets to the sender.\\n ///\\n /// @dev Emits a {Transfer}, {CancelLockupStream}, and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - If there any assets left for the recipient to withdraw, the stream is marked as canceled. Otherwise, the\\n /// stream is marked as depleted.\\n /// - This function attempts to invoke a hook on the recipient, if the resolved address is a contract.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - The stream must be warm and cancelable.\\n /// - `msg.sender` must be the stream's sender.\\n ///\\n /// @param streamId The ID of the stream to cancel.\\n function cancel(uint256 streamId) external;\\n\\n /// @notice Cancels multiple streams and refunds any remaining assets to the sender.\\n ///\\n /// @dev Emits multiple {Transfer}, {CancelLockupStream}, and {MetadataUpdate} events.\\n ///\\n /// Notes:\\n /// - Refer to the notes in {cancel}.\\n ///\\n /// Requirements:\\n /// - All requirements from {cancel} must be met for each stream.\\n ///\\n /// @param streamIds The IDs of the streams to cancel.\\n function cancelMultiple(uint256[] calldata streamIds) external;\\n\\n /// @notice Removes the right of the stream's sender to cancel the stream.\\n ///\\n /// @dev Emits a {RenounceLockupStream} and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - This is an irreversible operation.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `streamId` must reference a warm stream.\\n /// - `msg.sender` must be the stream's sender.\\n /// - The stream must be cancelable.\\n ///\\n /// @param streamId The ID of the stream to renounce.\\n function renounce(uint256 streamId) external;\\n\\n /// @notice Sets a new NFT descriptor contract, which produces the URI describing the Sablier stream NFTs.\\n ///\\n /// @dev Emits a {SetNFTDescriptor} and {BatchMetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - Does not revert if the NFT descriptor is the same.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the contract admin.\\n ///\\n /// @param newNFTDescriptor The address of the new NFT descriptor contract.\\n function setNFTDescriptor(\\n ISablierV2NFTDescriptor newNFTDescriptor\\n ) external;\\n\\n /// @notice Withdraws the provided amount of assets from the stream to the `to` address.\\n ///\\n /// @dev Emits a {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - This function attempts to call a hook on the recipient of the stream, unless `msg.sender` is the recipient.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `streamId` must not reference a null or depleted stream.\\n /// - `to` must not be the zero address.\\n /// - `amount` must be greater than zero and must not exceed the withdrawable amount.\\n /// - `to` must be the recipient if `msg.sender` is not the stream's recipient or an approved third party.\\n ///\\n /// @param streamId The ID of the stream to withdraw from.\\n /// @param to The address receiving the withdrawn assets.\\n /// @param amount The amount to withdraw, denoted in units of the asset's decimals.\\n function withdraw(uint256 streamId, address to, uint128 amount) external;\\n\\n /// @notice Withdraws the maximum withdrawable amount from the stream to the provided address `to`.\\n ///\\n /// @dev Emits a {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - Refer to the notes in {withdraw}.\\n ///\\n /// Requirements:\\n /// - Refer to the requirements in {withdraw}.\\n ///\\n /// @param streamId The ID of the stream to withdraw from.\\n /// @param to The address receiving the withdrawn assets.\\n /// @return withdrawnAmount The amount withdrawn, denoted in units of the asset's decimals.\\n function withdrawMax(\\n uint256 streamId,\\n address to\\n ) external returns (uint128 withdrawnAmount);\\n\\n /// @notice Withdraws the maximum withdrawable amount from the stream to the current recipient, and transfers the\\n /// NFT to `newRecipient`.\\n ///\\n /// @dev Emits a {WithdrawFromLockupStream} and a {Transfer} event.\\n ///\\n /// Notes:\\n /// - If the withdrawable amount is zero, the withdrawal is skipped.\\n /// - Refer to the notes in {withdraw}.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the stream's recipient.\\n /// - Refer to the requirements in {withdraw}.\\n /// - Refer to the requirements in {IERC721.transferFrom}.\\n ///\\n /// @param streamId The ID of the stream NFT to transfer.\\n /// @param newRecipient The address of the new owner of the stream NFT.\\n /// @return withdrawnAmount The amount withdrawn, denoted in units of the asset's decimals.\\n function withdrawMaxAndTransfer(\\n uint256 streamId,\\n address newRecipient\\n ) external returns (uint128 withdrawnAmount);\\n\\n /// @notice Withdraws assets from streams to the recipient of each stream.\\n ///\\n /// @dev Emits multiple {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} events.\\n ///\\n /// Notes:\\n /// - This function attempts to call a hook on the recipient of each stream, unless `msg.sender` is the recipient.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - There must be an equal number of `streamIds` and `amounts`.\\n /// - Each stream ID in the array must not reference a null or depleted stream.\\n /// - Each amount in the array must be greater than zero and must not exceed the withdrawable amount.\\n ///\\n /// @param streamIds The IDs of the streams to withdraw from.\\n /// @param amounts The amounts to withdraw, denoted in units of the asset's decimals.\\n function withdrawMultiple(\\n uint256[] calldata streamIds,\\n uint128[] calldata amounts\\n ) external;\\n}\\n\",\"keccak256\":\"0x3e5541c38a901637bd310965deb5bbde73ef07fe4ee3c752cbec330c6b9d62a3\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/ISablierV2LockupLinear.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\nimport {Lockup, LockupLinear} from \\\"./types/DataTypes.sol\\\";\\nimport {ISablierV2Lockup} from \\\"./ISablierV2Lockup.sol\\\";\\n\\n/// @title ISablierV2LockupLinear\\n/// @notice Creates and manages Lockup streams with a linear distribution function.\\ninterface ISablierV2LockupLinear is ISablierV2Lockup {\\n /*//////////////////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Emitted when a stream is created.\\n /// @param streamId The ID of the newly created stream.\\n /// @param funder The address which funded the stream.\\n /// @param sender The address distributing the assets, which will have the ability to cancel the stream.\\n /// @param recipient The address receiving the assets.\\n /// @param amounts Struct encapsulating (i) the deposit amount, and (ii) the broker fee amount, both denoted\\n /// in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Boolean indicating whether the stream will be cancelable or not.\\n /// @param transferable Boolean indicating whether the stream NFT is transferable or not.\\n /// @param timestamps Struct encapsulating (i) the stream's start time, (ii) cliff time, and (iii) end time, all as\\n /// Unix timestamps.\\n /// @param broker The address of the broker who has helped create the stream, e.g. a front-end website.\\n event CreateLockupLinearStream(\\n uint256 streamId,\\n address funder,\\n address indexed sender,\\n address indexed recipient,\\n Lockup.CreateAmounts amounts,\\n IERC20 indexed asset,\\n bool cancelable,\\n bool transferable,\\n LockupLinear.Timestamps timestamps,\\n address broker\\n );\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Retrieves the stream's cliff time, which is a Unix timestamp. A value of zero means there\\n /// is no cliff.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getCliffTime(\\n uint256 streamId\\n ) external view returns (uint40 cliffTime);\\n\\n /// @notice Retrieves the full stream details.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n /// @return stream See the documentation in {DataTypes}.\\n function getStream(\\n uint256 streamId\\n ) external view returns (LockupLinear.StreamLL memory stream);\\n\\n /// @notice Retrieves the stream's start, cliff and end timestamps.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n /// @return timestamps See the documentation in {DataTypes}.\\n function getTimestamps(\\n uint256 streamId\\n ) external view returns (LockupLinear.Timestamps memory timestamps);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n NON-CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Creates a stream by setting the start time to `block.timestamp`, and the end time to\\n /// the sum of `block.timestamp` and `params.durations.total`. The stream is funded by `msg.sender` and is wrapped\\n /// in an ERC-721 NFT.\\n ///\\n /// @dev Emits a {Transfer} and {CreateLockupLinearStream} event.\\n ///\\n /// Requirements:\\n /// - All requirements in {createWithTimestamps} must be met for the calculated parameters.\\n ///\\n /// @param params Struct encapsulating the function parameters, which are documented in {DataTypes}.\\n /// @return streamId The ID of the newly created stream.\\n function createWithDurations(\\n LockupLinear.CreateWithDurations calldata params\\n ) external returns (uint256 streamId);\\n\\n /// @notice Creates a stream with the provided start time and end time. The stream is funded by `msg.sender` and is\\n /// wrapped in an ERC-721 NFT.\\n ///\\n /// @dev Emits a {Transfer} and {CreateLockupLinearStream} event.\\n ///\\n /// Notes:\\n /// - A cliff time of zero means there is no cliff.\\n /// - As long as the times are ordered, it is not an error for the start or the cliff time to be in the past.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `params.totalAmount` must be greater than zero.\\n /// - If set, `params.broker.fee` must not be greater than `MAX_BROKER_FEE`.\\n /// - `params.timestamps.start` must be greater than zero and less than `params.timestamps.end`.\\n /// - If set, `params.timestamps.cliff` must be greater than `params.timestamps.start` and less than\\n /// `params.timestamps.end`.\\n /// - `params.timestamps.end` must be in the future.\\n /// - `params.recipient` must not be the zero address.\\n /// - `msg.sender` must have allowed this contract to spend at least `params.totalAmount` assets.\\n ///\\n /// @param params Struct encapsulating the function parameters, which are documented in {DataTypes}.\\n /// @return streamId The ID of the newly created stream.\\n function createWithTimestamps(\\n LockupLinear.CreateWithTimestamps calldata params\\n ) external returns (uint256 streamId);\\n}\\n\",\"keccak256\":\"0x064264723114b1f1cf3953fd79874dfcbb42cf313857aee6d5e6b09a23e0010b\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/ISablierV2NFTDescriptor.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC721Metadata} from \\\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\\\";\\n\\n/// @title ISablierV2NFTDescriptor\\n/// @notice This contract generates the URI describing the Sablier V2 stream NFTs.\\n/// @dev Inspired by Uniswap V3 Positions NFTs.\\ninterface ISablierV2NFTDescriptor {\\n /// @notice Produces the URI describing a particular stream NFT.\\n /// @dev This is a data URI with the JSON contents directly inlined.\\n /// @param sablier The address of the Sablier contract the stream was created in.\\n /// @param streamId The ID of the stream for which to produce a description.\\n /// @return uri The URI of the ERC721-compliant metadata.\\n function tokenURI(\\n IERC721Metadata sablier,\\n uint256 streamId\\n ) external view returns (string memory uri);\\n}\\n\",\"keccak256\":\"0x4ed430e553d14161e93efdaaacd1a502f49b38969c9d714b45d2e682a74fa0bc\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/types/DataTypes.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {UD2x18} from \\\"@prb/math/src/UD2x18.sol\\\";\\nimport {UD60x18} from \\\"@prb/math/src/UD60x18.sol\\\";\\n\\n// DataTypes.sol\\n//\\n// This file defines all structs used in V2 Core, most of which are organized under three namespaces:\\n//\\n// - Lockup\\n// - LockupDynamic\\n// - LockupLinear\\n// - LockupTranched\\n//\\n// You will notice that some structs contain \\\"slot\\\" annotations - they are used to indicate the\\n// storage layout of the struct. It is more gas efficient to group small data types together so\\n// that they fit in a single 32-byte slot.\\n\\n/// @notice Struct encapsulating the broker parameters passed to the create functions. Both can be set to zero.\\n/// @param account The address receiving the broker's fee.\\n/// @param fee The broker's percentage fee from the total amount, denoted as a fixed-point number where 1e18 is 100%.\\nstruct Broker {\\n address account;\\n UD60x18 fee;\\n}\\n\\n/// @notice Namespace for the structs used in both {SablierV2LockupLinear} and {SablierV2LockupDynamic}.\\nlibrary Lockup {\\n /// @notice Struct encapsulating the deposit, withdrawn, and refunded amounts, all denoted in units of the asset's\\n /// decimals.\\n /// @dev Because the deposited and the withdrawn amount are often read together, declaring them in the same slot\\n /// saves gas.\\n /// @param deposited The initial amount deposited in the stream, net of broker fee.\\n /// @param withdrawn The cumulative amount withdrawn from the stream.\\n /// @param refunded The amount refunded to the sender. Unless the stream was canceled, this is always zero.\\n struct Amounts {\\n // slot 0\\n uint128 deposited;\\n uint128 withdrawn;\\n // slot 1\\n uint128 refunded;\\n }\\n\\n /// @notice Struct encapsulating (i) the deposit amount and (ii) the broker fee amount, both denoted in units of the\\n /// asset's decimals.\\n /// @param deposit The amount to deposit in the stream.\\n /// @param brokerFee The broker fee amount.\\n struct CreateAmounts {\\n uint128 deposit;\\n uint128 brokerFee;\\n }\\n\\n /// @notice Enum representing the different statuses of a stream.\\n /// @custom:value0 PENDING Stream created but not started; assets are in a pending state.\\n /// @custom:value1 STREAMING Active stream where assets are currently being streamed.\\n /// @custom:value2 SETTLED All assets have been streamed; recipient is due to withdraw them.\\n /// @custom:value3 CANCELED Canceled stream; remaining assets await recipient's withdrawal.\\n /// @custom:value4 DEPLETED Depleted stream; all assets have been withdrawn and/or refunded.\\n enum Status {\\n PENDING,\\n STREAMING,\\n SETTLED,\\n CANCELED,\\n DEPLETED\\n }\\n\\n /// @notice A common data structure to be stored in all {SablierV2Lockup} models.\\n /// @dev The fields are arranged like this to save gas via tight variable packing.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream.\\n /// @param startTime The Unix timestamp indicating the stream's start.\\n /// @param endTime The Unix timestamp indicating the stream's end.\\n /// @param isCancelable Boolean indicating if the stream is cancelable.\\n /// @param wasCanceled Boolean indicating if the stream was canceled.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param isDepleted Boolean indicating if the stream is depleted.\\n /// @param isStream Boolean indicating if the struct entity exists.\\n /// @param isTransferable Boolean indicating if the stream NFT is transferable.\\n /// @param amounts Struct encapsulating the deposit, withdrawn, and refunded amounts, all denoted in units of the\\n /// asset's decimals.\\n struct Stream {\\n // slot 0\\n address sender;\\n uint40 startTime;\\n uint40 endTime;\\n bool isCancelable;\\n bool wasCanceled;\\n // slot 1\\n IERC20 asset;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n // slot 2 and 3\\n Lockup.Amounts amounts;\\n }\\n}\\n\\n/// @notice Namespace for the structs used in {SablierV2LockupDynamic}.\\nlibrary LockupDynamic {\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupDynamic.createWithDurations} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param segments Segments with durations used to compose the dynamic distribution function. Timestamps are\\n /// calculated by starting from `block.timestamp` and adding each duration to the previous timestamp.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithDurations {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n SegmentWithDuration[] segments;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupDynamic.createWithTimestamps} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param startTime The Unix timestamp indicating the stream's start.\\n /// @param segments Segments used to compose the dynamic distribution function.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithTimestamps {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n uint40 startTime;\\n Segment[] segments;\\n Broker broker;\\n }\\n\\n /// @notice Segment struct used in the Lockup Dynamic stream.\\n /// @param amount The amount of assets to be streamed in the segment, denoted in units of the asset's decimals.\\n /// @param exponent The exponent of the segment, denoted as a fixed-point number.\\n /// @param timestamp The Unix timestamp indicating the segment's end.\\n struct Segment {\\n // slot 0\\n uint128 amount;\\n UD2x18 exponent;\\n uint40 timestamp;\\n }\\n\\n /// @notice Segment struct used at runtime in {SablierV2LockupDynamic.createWithDurations}.\\n /// @param amount The amount of assets to be streamed in the segment, denoted in units of the asset's decimals.\\n /// @param exponent The exponent of the segment, denoted as a fixed-point number.\\n /// @param duration The time difference in seconds between the segment and the previous one.\\n struct SegmentWithDuration {\\n uint128 amount;\\n UD2x18 exponent;\\n uint40 duration;\\n }\\n\\n /// @notice Struct encapsulating the full details of a stream.\\n /// @dev Extends `Lockup.Stream` by including the recipient and the segments.\\n struct StreamLD {\\n address sender;\\n address recipient;\\n uint40 startTime;\\n uint40 endTime;\\n bool isCancelable;\\n bool wasCanceled;\\n IERC20 asset;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n Lockup.Amounts amounts;\\n Segment[] segments;\\n }\\n\\n /// @notice Struct encapsulating the LockupDynamic timestamps.\\n /// @param start The Unix timestamp indicating the stream's start.\\n /// @param end The Unix timestamp indicating the stream's end.\\n struct Timestamps {\\n uint40 start;\\n uint40 end;\\n }\\n}\\n\\n/// @notice Namespace for the structs used in {SablierV2LockupLinear}.\\nlibrary LockupLinear {\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupLinear.createWithDurations} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param durations Struct encapsulating (i) cliff period duration and (ii) total stream duration, both in seconds.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithDurations {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n Durations durations;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupLinear.createWithTimestamps} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param timestamps Struct encapsulating (i) the stream's start time, (ii) cliff time, and (iii) end time, all as\\n /// Unix timestamps.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithTimestamps {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n Timestamps timestamps;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the cliff duration and the total duration.\\n /// @param cliff The cliff duration in seconds.\\n /// @param total The total duration in seconds.\\n struct Durations {\\n uint40 cliff;\\n uint40 total;\\n }\\n\\n /// @notice Struct encapsulating the full details of a stream.\\n /// @dev Extends `Lockup.Stream` by including the recipient and the cliff time.\\n struct StreamLL {\\n address sender;\\n address recipient;\\n uint40 startTime;\\n bool isCancelable;\\n bool wasCanceled;\\n IERC20 asset;\\n uint40 endTime;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n Lockup.Amounts amounts;\\n uint40 cliffTime;\\n }\\n\\n /// @notice Struct encapsulating the LockupLinear timestamps.\\n /// @param start The Unix timestamp for the stream's start.\\n /// @param cliff The Unix timestamp for the cliff period's end. A value of zero means there is no cliff.\\n /// @param end The Unix timestamp for the stream's end.\\n struct Timestamps {\\n uint40 start;\\n uint40 cliff;\\n uint40 end;\\n }\\n}\\n\\n/// @notice Namespace for the structs used in {SablierV2LockupTranched}.\\nlibrary LockupTranched {\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupTranched.createWithDurations} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param tranches Tranches with durations used to compose the tranched distribution function. Timestamps are\\n /// calculated by starting from `block.timestamp` and adding each duration to the previous timestamp.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithDurations {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n TrancheWithDuration[] tranches;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupTranched.createWithTimestamps} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param startTime The Unix timestamp indicating the stream's start.\\n /// @param tranches Tranches used to compose the tranched distribution function.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithTimestamps {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n uint40 startTime;\\n Tranche[] tranches;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the full details of a stream.\\n /// @dev Extends `Lockup.Stream` by including the recipient and the tranches.\\n struct StreamLT {\\n address sender;\\n address recipient;\\n uint40 startTime;\\n uint40 endTime;\\n bool isCancelable;\\n bool wasCanceled;\\n IERC20 asset;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n Lockup.Amounts amounts;\\n Tranche[] tranches;\\n }\\n\\n /// @notice Struct encapsulating the LockupTranched timestamps.\\n /// @param start The Unix timestamp indicating the stream's start.\\n /// @param end The Unix timestamp indicating the stream's end.\\n struct Timestamps {\\n uint40 start;\\n uint40 end;\\n }\\n\\n /// @notice Tranche struct used in the Lockup Tranched stream.\\n /// @param amount The amount of assets to be unlocked in the tranche, denoted in units of the asset's decimals.\\n /// @param timestamp The Unix timestamp indicating the tranche's end.\\n struct Tranche {\\n // slot 0\\n uint128 amount;\\n uint40 timestamp;\\n }\\n\\n /// @notice Tranche struct used at runtime in {SablierV2LockupTranched.createWithDurations}.\\n /// @param amount The amount of assets to be unlocked in the tranche, denoted in units of the asset's decimals.\\n /// @param duration The time difference in seconds between the tranche and the previous one.\\n struct TrancheWithDuration {\\n uint128 amount;\\n uint40 duration;\\n }\\n}\\n\",\"keccak256\":\"0x727722c0ec71a76a947b935c9dfcac8fd846d6c3547dfbc8739c7109f3b95068\",\"license\":\"GPL-3.0-or-later\"},\"contracts/modules/DecentHatsCreationModule.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.28;\\n\\nimport {Enum} from \\\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\\\";\\nimport {IAvatar} from \\\"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol\\\";\\nimport {Strings} from \\\"@openzeppelin/contracts/utils/Strings.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IERC6551Registry} from \\\"../interfaces/IERC6551Registry.sol\\\";\\nimport {IHats} from \\\"../interfaces/hats/IHats.sol\\\";\\nimport {LockupLinear, Broker} from \\\"../interfaces/sablier/types/DataTypes.sol\\\";\\nimport {IHatsModuleFactory} from \\\"../interfaces/hats/IHatsModuleFactory.sol\\\";\\nimport {IHatsElectionsEligibility} from \\\"../interfaces/hats/modules/IHatsElectionsEligibility.sol\\\";\\nimport {ModuleProxyFactory} from \\\"@gnosis.pm/zodiac/contracts/factory/ModuleProxyFactory.sol\\\";\\nimport {ISablierV2LockupLinear} from \\\"../interfaces/sablier/ISablierV2LockupLinear.sol\\\";\\nimport {DecentHatsModuleUtils} from \\\"./DecentHatsModuleUtils.sol\\\";\\n\\ncontract DecentHatsCreationModule is DecentHatsModuleUtils {\\n struct TopHatParams {\\n string details;\\n string imageURI;\\n }\\n\\n struct AdminHatParams {\\n string details;\\n string imageURI;\\n bool isMutable;\\n }\\n\\n struct CreateTreeParams {\\n IHats hatsProtocol;\\n IERC6551Registry erc6551Registry;\\n IHatsModuleFactory hatsModuleFactory;\\n ModuleProxyFactory moduleProxyFactory;\\n address keyValuePairs;\\n address decentAutonomousAdminImplementation;\\n address hatsAccountImplementation;\\n address hatsElectionsEligibilityImplementation;\\n TopHatParams topHat;\\n AdminHatParams adminHat;\\n HatParams[] hats;\\n }\\n\\n /* /////////////////////////////////////////////////////////////////////////////\\n EXTERNAL FUNCTIONS\\n ///////////////////////////////////////////////////////////////////////////// */\\n /**\\n * @notice For a safe without any roles previously created on it, this function should be called. It sets up the\\n * top hat and admin hat, as well as any other hats and their streams that are provided, then transfers the top hat\\n * to the calling safe.\\n *\\n * @notice This contract should be enabled a module on the Safe for which the role(s) are to be created, and disabled after.\\n *\\n * @dev For each hat that is included, if the hat is:\\n * - termed, its stream funds on are targeted directly at the nominated wearer. The wearer should directly call `withdraw-`\\n * on the Sablier contract.\\n * - untermed, its stream funds are targeted at the hat's smart account. In order to withdraw funds from the stream, the\\n * hat's smart account must be the one call to `withdraw-` on the Sablier contract, setting the recipient arg to its wearer.\\n *\\n * @dev In order for a Safe to seamlessly create roles even if it has never previously created a role and thus has\\n * no hat tree, we defer the creation of the hat tree and its setup to this contract. This way, in a single tx block,\\n * the resulting topHatId of the newly created hat can be used to create an admin hat and any other hats needed.\\n * We also make use of `KeyValuePairs` to associate the topHatId with the Safe.\\n *\\n * @param treeParams The parameters for creating the Hat Tree with Roles\\n */\\n function createAndDeclareTree(\\n CreateTreeParams calldata treeParams\\n ) external {\\n // Create Top Hat\\n (uint256 topHatId, address topHatAccount) = _processTopHat(\\n treeParams.hatsProtocol,\\n treeParams.erc6551Registry,\\n treeParams.hatsAccountImplementation,\\n treeParams.keyValuePairs,\\n treeParams.topHat\\n );\\n\\n // Create Admin Hat\\n uint256 adminHatId = _processAdminHat(\\n treeParams.hatsProtocol,\\n treeParams.erc6551Registry,\\n treeParams.hatsAccountImplementation,\\n topHatId,\\n topHatAccount,\\n treeParams.moduleProxyFactory,\\n treeParams.decentAutonomousAdminImplementation,\\n treeParams.adminHat\\n );\\n\\n // Create Role Hats\\n _processRoleHats(\\n CreateRoleHatsParams({\\n hatsProtocol: treeParams.hatsProtocol,\\n erc6551Registry: treeParams.erc6551Registry,\\n hatsAccountImplementation: treeParams.hatsAccountImplementation,\\n topHatId: topHatId,\\n topHatAccount: topHatAccount,\\n hatsModuleFactory: treeParams.hatsModuleFactory,\\n hatsElectionsEligibilityImplementation: treeParams\\n .hatsElectionsEligibilityImplementation,\\n adminHatId: adminHatId,\\n hats: treeParams.hats\\n })\\n );\\n }\\n\\n /* /////////////////////////////////////////////////////////////////////////////\\n INTERNAL FUNCTIONS\\n ///////////////////////////////////////////////////////////////////////////// */\\n\\n function _processTopHat(\\n IHats hatsProtocol,\\n IERC6551Registry erc6551Registry,\\n address hatsAccountImplementation,\\n address keyValuePairs,\\n TopHatParams calldata topHat\\n ) internal returns (uint256 topHatId, address topHatAccount) {\\n // Call lastTopHatId() and properly decode the response\\n (bool success, bytes memory data) = address(hatsProtocol).call(\\n abi.encodeWithSignature(\\\"lastTopHatId()\\\")\\n );\\n require(success, \\\"Failed to get lastTopHatId\\\");\\n topHatId = (abi.decode(data, (uint256)) + 1) << 224;\\n\\n // Mint Top Hat to the Safe\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"mintTopHat(address,string,string)\\\",\\n msg.sender,\\n topHat.details,\\n topHat.imageURI\\n ),\\n Enum.Operation.Call\\n );\\n\\n // Create Top Hat's ERC6551 Account\\n topHatAccount = erc6551Registry.createAccount(\\n hatsAccountImplementation,\\n SALT,\\n block.chainid,\\n address(hatsProtocol),\\n topHatId\\n );\\n\\n // Declare Top Hat ID to Safe via KeyValuePairs\\n string[] memory keys = new string[](1);\\n string[] memory values = new string[](1);\\n keys[0] = \\\"topHatId\\\";\\n values[0] = Strings.toString(topHatId);\\n IAvatar(msg.sender).execTransactionFromModule(\\n keyValuePairs,\\n 0,\\n abi.encodeWithSignature(\\n \\\"updateValues(string[],string[])\\\",\\n keys,\\n values\\n ),\\n Enum.Operation.Call\\n );\\n }\\n\\n function _processAdminHat(\\n IHats hatsProtocol,\\n IERC6551Registry erc6551Registry,\\n address hatsAccountImplementation,\\n uint256 topHatId,\\n address topHatAccount,\\n ModuleProxyFactory moduleProxyFactory,\\n address decentAutonomousAdminImplementation,\\n AdminHatParams calldata adminHat\\n ) internal returns (uint256 adminHatId) {\\n // Create Admin Hat\\n adminHatId = hatsProtocol.getNextId(topHatId);\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"createHat(uint256,string,uint32,address,address,bool,string)\\\",\\n topHatId,\\n adminHat.details,\\n 1, // only one Admin Hat\\n topHatAccount,\\n topHatAccount,\\n adminHat.isMutable,\\n adminHat.imageURI\\n ),\\n Enum.Operation.Call\\n );\\n\\n // Create Admin Hat's ERC6551 Account\\n erc6551Registry.createAccount(\\n hatsAccountImplementation,\\n SALT,\\n block.chainid,\\n address(hatsProtocol),\\n adminHatId\\n );\\n\\n // Deploy Decent Autonomous Admin Module, which will wear the Admin Hat\\n address autonomousAdmin = moduleProxyFactory.deployModule(\\n decentAutonomousAdminImplementation,\\n abi.encodeWithSignature(\\\"setUp(bytes)\\\", bytes(\\\"\\\")),\\n uint256(\\n keccak256(\\n abi.encodePacked(\\n // for the salt, we'll concatenate our static salt\\n // with the Admin Hat ID\\n SALT,\\n adminHatId\\n )\\n )\\n )\\n );\\n\\n // Mint Hat to the Decent Autonomous Admin Module\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"mintHat(uint256,address)\\\",\\n adminHatId,\\n autonomousAdmin\\n ),\\n Enum.Operation.Call\\n );\\n }\\n}\\n\",\"keccak256\":\"0x0d952c31bdbe70343c618cdab6930200c3064eee26ccfb6913a94a2be635dd41\",\"license\":\"MIT\"},\"contracts/modules/DecentHatsModuleUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.28;\\n\\nimport {Enum} from \\\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\\\";\\nimport {IAvatar} from \\\"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IERC6551Registry} from \\\"../interfaces/IERC6551Registry.sol\\\";\\nimport {IHats} from \\\"../interfaces/hats/IHats.sol\\\";\\nimport {LockupLinear, Broker} from \\\"../interfaces/sablier/types/DataTypes.sol\\\";\\nimport {IHatsModuleFactory} from \\\"../interfaces/hats/IHatsModuleFactory.sol\\\";\\nimport {ISablierV2LockupLinear} from \\\"../interfaces/sablier/ISablierV2LockupLinear.sol\\\";\\n\\nabstract contract DecentHatsModuleUtils {\\n bytes32 public constant SALT =\\n 0x5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b5072;\\n\\n struct SablierStreamParams {\\n ISablierV2LockupLinear sablier;\\n address sender;\\n address asset;\\n LockupLinear.Timestamps timestamps;\\n Broker broker;\\n uint128 totalAmount;\\n bool cancelable;\\n bool transferable;\\n }\\n\\n struct HatParams {\\n address wearer;\\n string details;\\n string imageURI;\\n SablierStreamParams[] sablierStreamsParams;\\n uint128 termEndDateTs; // If 0, this is an untermed Hat\\n uint32 maxSupply;\\n bool isMutable;\\n }\\n\\n struct CreateRoleHatsParams {\\n IHats hatsProtocol;\\n IERC6551Registry erc6551Registry;\\n address hatsAccountImplementation;\\n uint256 topHatId;\\n address topHatAccount;\\n IHatsModuleFactory hatsModuleFactory;\\n address hatsElectionsEligibilityImplementation;\\n uint256 adminHatId;\\n HatParams[] hats;\\n }\\n\\n function _processRoleHats(\\n CreateRoleHatsParams memory roleHatsParams\\n ) internal {\\n for (uint256 i = 0; i < roleHatsParams.hats.length; ) {\\n HatParams memory hatParams = roleHatsParams.hats[i];\\n\\n // Create eligibility module if needed\\n address eligibilityAddress = _createEligibilityModule(\\n roleHatsParams.hatsProtocol,\\n roleHatsParams.hatsModuleFactory,\\n roleHatsParams.hatsElectionsEligibilityImplementation,\\n roleHatsParams.topHatId,\\n roleHatsParams.topHatAccount,\\n roleHatsParams.adminHatId,\\n hatParams.termEndDateTs\\n );\\n\\n // Create and Mint the Role Hat\\n uint256 hatId = _createAndMintHat(\\n roleHatsParams.hatsProtocol,\\n roleHatsParams.adminHatId,\\n hatParams,\\n eligibilityAddress,\\n roleHatsParams.topHatAccount\\n );\\n\\n // Get the stream recipient (based on termed or not)\\n address streamRecipient = _setupStreamRecipient(\\n roleHatsParams.erc6551Registry,\\n roleHatsParams.hatsAccountImplementation,\\n address(roleHatsParams.hatsProtocol),\\n hatParams.termEndDateTs,\\n hatParams.wearer,\\n hatId\\n );\\n\\n // Create streams\\n _processSablierStreams(\\n hatParams.sablierStreamsParams,\\n streamRecipient\\n );\\n\\n unchecked {\\n ++i;\\n }\\n }\\n }\\n\\n function _createEligibilityModule(\\n IHats hatsProtocol,\\n IHatsModuleFactory hatsModuleFactory,\\n address hatsElectionsEligibilityImplementation,\\n uint256 topHatId,\\n address topHatAccount,\\n uint256 adminHatId,\\n uint128 termEndDateTs\\n ) private returns (address) {\\n // If the Hat is termed, create the eligibility module\\n if (termEndDateTs != 0) {\\n return\\n hatsModuleFactory.createHatsModule(\\n hatsElectionsEligibilityImplementation,\\n hatsProtocol.getNextId(adminHatId),\\n abi.encode(topHatId, uint256(0)), // [BALLOT_BOX_ID, ADMIN_HAT_ID]\\n abi.encode(termEndDateTs),\\n uint256(SALT)\\n );\\n }\\n\\n // Otherwise, return the Top Hat account\\n return topHatAccount;\\n }\\n\\n function _createAndMintHat(\\n IHats hatsProtocol,\\n uint256 adminHatId,\\n HatParams memory hat,\\n address eligibilityAddress,\\n address topHatAccount\\n ) private returns (uint256) {\\n // Grab the next Hat ID (before creating it)\\n uint256 hatId = hatsProtocol.getNextId(adminHatId);\\n\\n // Create the new Hat\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"createHat(uint256,string,uint32,address,address,bool,string)\\\",\\n adminHatId,\\n hat.details,\\n hat.maxSupply,\\n eligibilityAddress,\\n topHatAccount,\\n hat.isMutable,\\n hat.imageURI\\n ),\\n Enum.Operation.Call\\n );\\n\\n // If the Hat is termed, nominate the wearer as the eligible member\\n if (hat.termEndDateTs != 0) {\\n address[] memory nominatedWearers = new address[](1);\\n nominatedWearers[0] = hat.wearer;\\n\\n IAvatar(msg.sender).execTransactionFromModule(\\n eligibilityAddress,\\n 0,\\n abi.encodeWithSignature(\\n \\\"elect(uint128,address[])\\\",\\n hat.termEndDateTs,\\n nominatedWearers\\n ),\\n Enum.Operation.Call\\n );\\n }\\n\\n // Mint the Hat\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"mintHat(uint256,address)\\\",\\n hatId,\\n hat.wearer\\n ),\\n Enum.Operation.Call\\n );\\n return hatId;\\n }\\n\\n // Exists to avoid stack too deep errors\\n function _setupStreamRecipient(\\n IERC6551Registry erc6551Registry,\\n address hatsAccountImplementation,\\n address hatsProtocol,\\n uint128 termEndDateTs,\\n address wearer,\\n uint256 hatId\\n ) private returns (address) {\\n // If the hat is termed, the wearer is the stream recipient\\n if (termEndDateTs != 0) {\\n return wearer;\\n }\\n\\n // Otherwise, the Hat's smart account is the stream recipient\\n return\\n erc6551Registry.createAccount(\\n hatsAccountImplementation,\\n SALT,\\n block.chainid,\\n hatsProtocol,\\n hatId\\n );\\n }\\n\\n function _processSablierStreams(\\n SablierStreamParams[] memory streamParams,\\n address streamRecipient\\n ) private {\\n for (uint256 i = 0; i < streamParams.length; ) {\\n SablierStreamParams memory sablierStreamParams = streamParams[i];\\n\\n // Approve tokens for Sablier\\n IAvatar(msg.sender).execTransactionFromModule(\\n sablierStreamParams.asset,\\n 0,\\n abi.encodeWithSignature(\\n \\\"approve(address,uint256)\\\",\\n sablierStreamParams.sablier,\\n sablierStreamParams.totalAmount\\n ),\\n Enum.Operation.Call\\n );\\n\\n // Proxy the Sablier call through IAvatar\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(sablierStreamParams.sablier),\\n 0,\\n abi.encodeWithSignature(\\n \\\"createWithTimestamps((address,address,uint128,address,bool,bool,(uint40,uint40,uint40),(address,uint256)))\\\",\\n LockupLinear.CreateWithTimestamps({\\n sender: sablierStreamParams.sender,\\n recipient: streamRecipient,\\n totalAmount: sablierStreamParams.totalAmount,\\n asset: IERC20(sablierStreamParams.asset),\\n cancelable: sablierStreamParams.cancelable,\\n transferable: sablierStreamParams.transferable,\\n timestamps: sablierStreamParams.timestamps,\\n broker: sablierStreamParams.broker\\n })\\n ),\\n Enum.Operation.Call\\n );\\n\\n unchecked {\\n ++i;\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x357c5264ecb63f8f15f67ffb7498c7fb55d9efe8d46358790933b4892bd38cde\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x6080604052348015600f57600080fd5b50611eb88061001f6000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c8063ba9a91a51461003b578063d58041b714610062575b600080fd5b610050600080516020611e6383398151915281565b60405190815260200160405180910390f35b6100756100703660046112ff565b610077565b005b6000806100cd61008a6020850185611359565b61009a6040860160208701611359565b6100aa60e0870160c08801611359565b6100ba60a0880160808901611359565b6100c8610100890189611386565b610227565b909250905060006101396100e46020860186611359565b6100f46040870160208801611359565b61010460e0880160c08901611359565b868661011660808b0160608c01611359565b61012660c08c0160a08d01611359565b6101346101208d018d6113a6565b610603565b604080516101208101909152909150610221908061015a6020880188611359565b6001600160a01b0316815260200186602001602081019061017b9190611359565b6001600160a01b0316815260200161019960e0880160c08901611359565b6001600160a01b03168152602001858152602001846001600160a01b031681526020018660400160208101906101cf9190611359565b6001600160a01b031681526020016101ee610100880160e08901611359565b6001600160a01b03168152602081018490526040016102116101408801886113bc565b61021a9161175d565b905261099f565b50505050565b60408051600481526024810182526020810180516001600160e01b0316633f0f816960e21b17905290516000918291829182916001600160a01b038b169161026e916118bf565b6000604051808303816000865af19150503d80600081146102ab576040519150601f19603f3d011682016040523d82523d6000602084013e6102b0565b606091505b5091509150816103065760405162461bcd60e51b815260206004820152601a60248201527f4661696c656420746f20676574206c617374546f704861744964000000000000604482015260640160405180910390fd5b60e08180602001905181019061031c91906118d1565b610327906001611900565b901b93503363468721a78a60008361033f8a80611919565b61034c60208d018d611919565b604051602401610360959493929190611988565b60408051601f198184030181529181526020820180516001600160e01b0316631a64dfad60e01b1790525160e085901b6001600160e01b03191681526103ae939291906000906004016119f8565b6020604051808303816000875af11580156103cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103f19190611a4e565b50604051638a54c52f60e01b81526001600160a01b03891690638a54c52f90610434908a90600080516020611e638339815191529046908f908b90600401611a6b565b6020604051808303816000875af1158015610453573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104779190611a9e565b60408051600180825281830190925291945060009190816020015b606081526020019060019003908161049257505060408051600180825281830190925291925060009190602082015b60608152602001906001900390816104c1579050509050604051806040016040528060088152602001671d1bdc12185d125960c21b8152508260008151811061050c5761050c611abb565b602002602001018190525061052086610a66565b8160008151811061053357610533611abb565b6020026020010181905250336001600160a01b031663468721a78960008585604051602401610563929190611b2d565b60408051601f198184030181529181526020820180516001600160e01b031663579374b960e11b1790525160e085901b6001600160e01b03191681526105b1939291906000906004016119f8565b6020604051808303816000875af11580156105d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105f49190611a4e565b50505050509550959350505050565b60405162460ea360e61b8152600481018690526000906001600160a01b038a1690631183a8c090602401602060405180830381865afa15801561064a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061066e91906118d1565b90503363468721a78a6000896106848780611919565b60018c8061069860608d0160408e01611b5b565b6106a560208e018e611919565b6040516024016106bd99989796959493929190611b78565b60408051601f198184030181529181526020820180516001600160e01b0316635829492f60e11b1790525160e085901b6001600160e01b031916815261070b939291906000906004016119f8565b6020604051808303816000875af115801561072a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061074e9190611a4e565b50604051638a54c52f60e01b81526001600160a01b03891690638a54c52f90610791908a90600080516020611e638339815191529046908f908890600401611a6b565b6020604051808303816000875af11580156107b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107d49190611a9e565b506000846001600160a01b031663f1ab873c85604051806020016040528060008152506040516024016108079190611bdd565b60408051601f19818403018152918152602080830180516001600160e01b031663a4f9edbf60e01b179052905161085991600080516020611e6383398151915291899101918252602082015260400190565b60408051601f198184030181529082905280516020909101206001600160e01b031960e086901b168252610891939291600401611bf0565b6020604051808303816000875af11580156108b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108d49190611a9e565b604051602481018490526001600160a01b0382166044820152909150339063468721a7908c9060009060640160408051601f198184030181529181526020820180516001600160e01b031663320fbbb760e11b1790525160e085901b6001600160e01b031916815261094e939291906000906004016119f8565b6020604051808303816000875af115801561096d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109919190611a4e565b505098975050505050505050565b60005b81610100015151811015610a6257600082610100015182815181106109c9576109c9611abb565b602002602001015190506000610a0084600001518560a001518660c00151876060015188608001518960e001518860800151610b6e565b90506000610a1d85600001518660e0015185858960800151610cd5565b90506000610a438660200151876040015188600001518760800151886000015187611007565b9050610a538460600151826110b1565b846001019450505050506109a2565b5050565b606081600003610a8d5750506040805180820190915260018152600360fc1b602082015290565b8160005b8115610ab75780610aa181611c24565b9150610ab09050600a83611c53565b9150610a91565b6000816001600160401b03811115610ad157610ad161140c565b6040519080825280601f01601f191660200182016040528015610afb576020820181803683370190505b5090505b8415610b6657610b10600183611c67565b9150610b1d600a86611c7a565b610b28906030611900565b60f81b818381518110610b3d57610b3d611abb565b60200101906001600160f81b031916908160001a905350610b5f600a86611c53565b9450610aff565b949350505050565b60006001600160801b03821615610cc757866001600160a01b0316632f7fb7b6878a6001600160a01b0316631183a8c0876040518263ffffffff1660e01b8152600401610bbd91815260200190565b602060405180830381865afa158015610bda573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bfe91906118d1565b886000604051602001610c1b929190918252602082015260400190565b60408051601f198184030181528282526001600160801b0389166020840152910160408051601f19818403018152908290526001600160e01b031960e087901b168252610c7d94939291600080516020611e6383398151915290600401611c8e565b6020604051808303816000875af1158015610c9c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cc09190611a9e565b9050610cca565b50825b979650505050505050565b60405162460ea360e61b81526004810185905260009081906001600160a01b03881690631183a8c090602401602060405180830381865afa158015610d1e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d4291906118d1565b9050336001600160a01b031663468721a78860008989602001518a60a001518a8a8d60c001518e60400151604051602401610d839796959493929190611cda565b60408051601f198184030181529181526020820180516001600160e01b0316635829492f60e11b1790525160e085901b6001600160e01b0319168152610dd1939291906000906004016119f8565b6020604051808303816000875af1158015610df0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e149190611a4e565b5060808501516001600160801b031615610f3f5760408051600180825281830190925260009160208083019080368337019050509050856000015181600081518110610e6257610e62611abb565b60200260200101906001600160a01b031690816001600160a01b031681525050336001600160a01b031663468721a7866000896080015185604051602401610eab929190611d3e565b60408051601f198184030181529181526020820180516001600160e01b0316634a231cef60e01b1790525160e085901b6001600160e01b0319168152610ef9939291906000906004016119f8565b6020604051808303816000875af1158015610f18573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f3c9190611a4e565b50505b8451604051602481018390526001600160a01b039091166044820152339063468721a790899060009060640160408051601f198184030181529181526020820180516001600160e01b031663320fbbb760e11b1790525160e085901b6001600160e01b0319168152610fb9939291906000906004016119f8565b6020604051808303816000875af1158015610fd8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ffc9190611a4e565b509695505050505050565b60006001600160801b0384161561101f5750816110a7565b604051638a54c52f60e01b81526001600160a01b03881690638a54c52f90611061908990600080516020611e638339815191529046908b908990600401611a6b565b6020604051808303816000875af1158015611080573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110a49190611a9e565b90505b9695505050505050565b60005b82518110156112fa5760008382815181106110d1576110d1611abb565b60200260200101519050336001600160a01b031663468721a78260400151600084600001518560a001516040516024016111299291906001600160a01b039290921682526001600160801b0316602082015260400190565b60408051601f198184030181529181526020820180516001600160e01b031663095ea7b360e01b1790525160e085901b6001600160e01b0319168152611177939291906000906004016119f8565b6020604051808303816000875af1158015611196573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111ba9190611a4e565b50336001600160a01b031663468721a78260000151600060405180610100016040528086602001516001600160a01b03168152602001886001600160a01b031681526020018660a001516001600160801b0316815260200186604001516001600160a01b031681526020018660c00151151581526020018660e001511515815260200186606001518152602001866080015181525060405160240161125f9190611d93565b60408051601f198184030181529181526020820180516001600160e01b03166353b1572760e01b1790525160e085901b6001600160e01b03191681526112ad939291906000906004016119f8565b6020604051808303816000875af11580156112cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112f09190611a4e565b50506001016110b4565b505050565b60006020828403121561131157600080fd5b81356001600160401b0381111561132757600080fd5b8201610160818503121561133a57600080fd5b9392505050565b6001600160a01b038116811461135657600080fd5b50565b60006020828403121561136b57600080fd5b813561133a81611341565b803561138181611341565b919050565b60008235603e1983360301811261139c57600080fd5b9190910192915050565b60008235605e1983360301811261139c57600080fd5b6000808335601e198436030181126113d357600080fd5b8301803591506001600160401b038211156113ed57600080fd5b6020019150600581901b360382131561140557600080fd5b9250929050565b634e487b7160e01b600052604160045260246000fd5b60405161010081016001600160401b03811182821017156114455761144561140c565b60405290565b60405160e081016001600160401b03811182821017156114455761144561140c565b604051601f8201601f191681016001600160401b03811182821017156114955761149561140c565b604052919050565b60006001600160401b038211156114b6576114b661140c565b5060051b60200190565b600082601f8301126114d157600080fd5b81356001600160401b038111156114ea576114ea61140c565b6114fd601f8201601f191660200161146d565b81815284602083860101111561151257600080fd5b816020850160208301376000918101602001919091529392505050565b803564ffffffffff8116811461138157600080fd5b60006060828403121561155657600080fd5b604051606081016001600160401b03811182821017156115785761157861140c565b6040529050806115878361152f565b81526115956020840161152f565b60208201526115a66040840161152f565b60408201525092915050565b6000604082840312156115c457600080fd5b604080519081016001600160401b03811182821017156115e6576115e661140c565b60405290508082356115f781611341565b8152602092830135920191909152919050565b80356001600160801b038116811461138157600080fd5b801515811461135657600080fd5b803561138181611621565b600082601f83011261164b57600080fd5b813561165e6116598261149d565b61146d565b808282526020820191506020610160840286010192508583111561168157600080fd5b602085015b8381101561173f57610160818803121561169f57600080fd5b6116a7611422565b6116b082611376565b81526116be60208301611376565b60208201526116cf60408301611376565b60408201526116e18860608401611544565b60608201526116f38860c084016115b2565b6080820152611705610100830161160a565b60a0820152611717610120830161162f565b60c0820152611729610140830161162f565b60e0820152835260209092019161016001611686565b5095945050505050565b803563ffffffff8116811461138157600080fd5b600061176b6116598461149d565b8381526020810190600585901b84013681111561178757600080fd5b845b818110156118905780356001600160401b038111156117a757600080fd5b860160e03682900312156117ba57600080fd5b6117c261144b565b6117cb82611376565b815260208201356001600160401b038111156117e657600080fd5b6117f2368285016114c0565b60208301525060408201356001600160401b0381111561181157600080fd5b61181d368285016114c0565b60408301525060608201356001600160401b0381111561183c57600080fd5b6118483682850161163a565b60608301525061185a6080830161160a565b608082015261186b60a08301611749565b60a082015261187c60c0830161162f565b60c082015285525060209384019301611789565b509095945050505050565b60005b838110156118b657818101518382015260200161189e565b50506000910152565b6000825161139c81846020870161189b565b6000602082840312156118e357600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b80820180821115611913576119136118ea565b92915050565b6000808335601e1984360301811261193057600080fd5b8301803591506001600160401b0382111561194a57600080fd5b60200191503681900382131561140557600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b03861681526060602082018190526000906119ad908301868861195f565b82810360408401526119c081858761195f565b98975050505050505050565b600081518084526119e481602086016020860161189b565b601f01601f19169290920160200192915050565b60018060a01b0385168152836020820152608060408201526000611a1f60808301856119cc565b905060028310611a3f57634e487b7160e01b600052602160045260246000fd5b82606083015295945050505050565b600060208284031215611a6057600080fd5b815161133a81611621565b6001600160a01b039586168152602081019490945260408401929092529092166060820152608081019190915260a00190565b600060208284031215611ab057600080fd5b815161133a81611341565b634e487b7160e01b600052603260045260246000fd5b600082825180855260208501945060208160051b8301016020850160005b83811015611b2157601f19858403018852611b0b8383516119cc565b6020988901989093509190910190600101611aef565b50909695505050505050565b604081526000611b406040830185611ad1565b8281036020840152611b528185611ad1565b95945050505050565b600060208284031215611b6d57600080fd5b813561133a81611621565b89815260e060208201526000611b9260e083018a8c61195f565b60ff891660408401526001600160a01b0388811660608501528716608084015285151560a084015282810360c0840152611bcd81858761195f565b9c9b505050505050505050505050565b60208152600061133a60208301846119cc565b6001600160a01b0384168152606060208201819052600090611c14908301856119cc565b9050826040830152949350505050565b600060018201611c3657611c366118ea565b5060010190565b634e487b7160e01b600052601260045260246000fd5b600082611c6257611c62611c3d565b500490565b81810381811115611913576119136118ea565b600082611c8957611c89611c3d565b500690565b60018060a01b038616815284602082015260a060408201526000611cb560a08301866119cc565b8281036060840152611cc781866119cc565b9150508260808301529695505050505050565b87815260e060208201526000611cf360e08301896119cc565b63ffffffff881660408401526001600160a01b0387811660608501528616608084015284151560a084015282810360c0840152611d3081856119cc565b9a9950505050505050505050565b6000604082016001600160801b03851683526040602084015280845180835260608501915060208601925060005b81811015611b215783516001600160a01b0316835260209384019390920191600101611d6c565b81516001600160a01b0390811682526020808401518216908301526040808401516001600160801b03169083015260608084015191821690830152610160820190506080830151611de8608084018215159052565b5060a0830151611dfc60a084018215159052565b5060c0830151611e3b60c084018264ffffffffff815116825264ffffffffff602082015116602083015264ffffffffff60408201511660408301525050565b5060e0929092015180516001600160a01b031661012083015260200151610140909101529056fe5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b5072a26469706673582212201f5f415bcb47b5bcc3f3fe15fa8e4612de722a3ea1aaa69d546320c040c561ba64736f6c634300081c0033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100365760003560e01c8063ba9a91a51461003b578063d58041b714610062575b600080fd5b610050600080516020611e6383398151915281565b60405190815260200160405180910390f35b6100756100703660046112ff565b610077565b005b6000806100cd61008a6020850185611359565b61009a6040860160208701611359565b6100aa60e0870160c08801611359565b6100ba60a0880160808901611359565b6100c8610100890189611386565b610227565b909250905060006101396100e46020860186611359565b6100f46040870160208801611359565b61010460e0880160c08901611359565b868661011660808b0160608c01611359565b61012660c08c0160a08d01611359565b6101346101208d018d6113a6565b610603565b604080516101208101909152909150610221908061015a6020880188611359565b6001600160a01b0316815260200186602001602081019061017b9190611359565b6001600160a01b0316815260200161019960e0880160c08901611359565b6001600160a01b03168152602001858152602001846001600160a01b031681526020018660400160208101906101cf9190611359565b6001600160a01b031681526020016101ee610100880160e08901611359565b6001600160a01b03168152602081018490526040016102116101408801886113bc565b61021a9161175d565b905261099f565b50505050565b60408051600481526024810182526020810180516001600160e01b0316633f0f816960e21b17905290516000918291829182916001600160a01b038b169161026e916118bf565b6000604051808303816000865af19150503d80600081146102ab576040519150601f19603f3d011682016040523d82523d6000602084013e6102b0565b606091505b5091509150816103065760405162461bcd60e51b815260206004820152601a60248201527f4661696c656420746f20676574206c617374546f704861744964000000000000604482015260640160405180910390fd5b60e08180602001905181019061031c91906118d1565b610327906001611900565b901b93503363468721a78a60008361033f8a80611919565b61034c60208d018d611919565b604051602401610360959493929190611988565b60408051601f198184030181529181526020820180516001600160e01b0316631a64dfad60e01b1790525160e085901b6001600160e01b03191681526103ae939291906000906004016119f8565b6020604051808303816000875af11580156103cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103f19190611a4e565b50604051638a54c52f60e01b81526001600160a01b03891690638a54c52f90610434908a90600080516020611e638339815191529046908f908b90600401611a6b565b6020604051808303816000875af1158015610453573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104779190611a9e565b60408051600180825281830190925291945060009190816020015b606081526020019060019003908161049257505060408051600180825281830190925291925060009190602082015b60608152602001906001900390816104c1579050509050604051806040016040528060088152602001671d1bdc12185d125960c21b8152508260008151811061050c5761050c611abb565b602002602001018190525061052086610a66565b8160008151811061053357610533611abb565b6020026020010181905250336001600160a01b031663468721a78960008585604051602401610563929190611b2d565b60408051601f198184030181529181526020820180516001600160e01b031663579374b960e11b1790525160e085901b6001600160e01b03191681526105b1939291906000906004016119f8565b6020604051808303816000875af11580156105d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105f49190611a4e565b50505050509550959350505050565b60405162460ea360e61b8152600481018690526000906001600160a01b038a1690631183a8c090602401602060405180830381865afa15801561064a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061066e91906118d1565b90503363468721a78a6000896106848780611919565b60018c8061069860608d0160408e01611b5b565b6106a560208e018e611919565b6040516024016106bd99989796959493929190611b78565b60408051601f198184030181529181526020820180516001600160e01b0316635829492f60e11b1790525160e085901b6001600160e01b031916815261070b939291906000906004016119f8565b6020604051808303816000875af115801561072a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061074e9190611a4e565b50604051638a54c52f60e01b81526001600160a01b03891690638a54c52f90610791908a90600080516020611e638339815191529046908f908890600401611a6b565b6020604051808303816000875af11580156107b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107d49190611a9e565b506000846001600160a01b031663f1ab873c85604051806020016040528060008152506040516024016108079190611bdd565b60408051601f19818403018152918152602080830180516001600160e01b031663a4f9edbf60e01b179052905161085991600080516020611e6383398151915291899101918252602082015260400190565b60408051601f198184030181529082905280516020909101206001600160e01b031960e086901b168252610891939291600401611bf0565b6020604051808303816000875af11580156108b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108d49190611a9e565b604051602481018490526001600160a01b0382166044820152909150339063468721a7908c9060009060640160408051601f198184030181529181526020820180516001600160e01b031663320fbbb760e11b1790525160e085901b6001600160e01b031916815261094e939291906000906004016119f8565b6020604051808303816000875af115801561096d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109919190611a4e565b505098975050505050505050565b60005b81610100015151811015610a6257600082610100015182815181106109c9576109c9611abb565b602002602001015190506000610a0084600001518560a001518660c00151876060015188608001518960e001518860800151610b6e565b90506000610a1d85600001518660e0015185858960800151610cd5565b90506000610a438660200151876040015188600001518760800151886000015187611007565b9050610a538460600151826110b1565b846001019450505050506109a2565b5050565b606081600003610a8d5750506040805180820190915260018152600360fc1b602082015290565b8160005b8115610ab75780610aa181611c24565b9150610ab09050600a83611c53565b9150610a91565b6000816001600160401b03811115610ad157610ad161140c565b6040519080825280601f01601f191660200182016040528015610afb576020820181803683370190505b5090505b8415610b6657610b10600183611c67565b9150610b1d600a86611c7a565b610b28906030611900565b60f81b818381518110610b3d57610b3d611abb565b60200101906001600160f81b031916908160001a905350610b5f600a86611c53565b9450610aff565b949350505050565b60006001600160801b03821615610cc757866001600160a01b0316632f7fb7b6878a6001600160a01b0316631183a8c0876040518263ffffffff1660e01b8152600401610bbd91815260200190565b602060405180830381865afa158015610bda573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bfe91906118d1565b886000604051602001610c1b929190918252602082015260400190565b60408051601f198184030181528282526001600160801b0389166020840152910160408051601f19818403018152908290526001600160e01b031960e087901b168252610c7d94939291600080516020611e6383398151915290600401611c8e565b6020604051808303816000875af1158015610c9c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cc09190611a9e565b9050610cca565b50825b979650505050505050565b60405162460ea360e61b81526004810185905260009081906001600160a01b03881690631183a8c090602401602060405180830381865afa158015610d1e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d4291906118d1565b9050336001600160a01b031663468721a78860008989602001518a60a001518a8a8d60c001518e60400151604051602401610d839796959493929190611cda565b60408051601f198184030181529181526020820180516001600160e01b0316635829492f60e11b1790525160e085901b6001600160e01b0319168152610dd1939291906000906004016119f8565b6020604051808303816000875af1158015610df0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e149190611a4e565b5060808501516001600160801b031615610f3f5760408051600180825281830190925260009160208083019080368337019050509050856000015181600081518110610e6257610e62611abb565b60200260200101906001600160a01b031690816001600160a01b031681525050336001600160a01b031663468721a7866000896080015185604051602401610eab929190611d3e565b60408051601f198184030181529181526020820180516001600160e01b0316634a231cef60e01b1790525160e085901b6001600160e01b0319168152610ef9939291906000906004016119f8565b6020604051808303816000875af1158015610f18573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f3c9190611a4e565b50505b8451604051602481018390526001600160a01b039091166044820152339063468721a790899060009060640160408051601f198184030181529181526020820180516001600160e01b031663320fbbb760e11b1790525160e085901b6001600160e01b0319168152610fb9939291906000906004016119f8565b6020604051808303816000875af1158015610fd8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ffc9190611a4e565b509695505050505050565b60006001600160801b0384161561101f5750816110a7565b604051638a54c52f60e01b81526001600160a01b03881690638a54c52f90611061908990600080516020611e638339815191529046908b908990600401611a6b565b6020604051808303816000875af1158015611080573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110a49190611a9e565b90505b9695505050505050565b60005b82518110156112fa5760008382815181106110d1576110d1611abb565b60200260200101519050336001600160a01b031663468721a78260400151600084600001518560a001516040516024016111299291906001600160a01b039290921682526001600160801b0316602082015260400190565b60408051601f198184030181529181526020820180516001600160e01b031663095ea7b360e01b1790525160e085901b6001600160e01b0319168152611177939291906000906004016119f8565b6020604051808303816000875af1158015611196573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111ba9190611a4e565b50336001600160a01b031663468721a78260000151600060405180610100016040528086602001516001600160a01b03168152602001886001600160a01b031681526020018660a001516001600160801b0316815260200186604001516001600160a01b031681526020018660c00151151581526020018660e001511515815260200186606001518152602001866080015181525060405160240161125f9190611d93565b60408051601f198184030181529181526020820180516001600160e01b03166353b1572760e01b1790525160e085901b6001600160e01b03191681526112ad939291906000906004016119f8565b6020604051808303816000875af11580156112cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112f09190611a4e565b50506001016110b4565b505050565b60006020828403121561131157600080fd5b81356001600160401b0381111561132757600080fd5b8201610160818503121561133a57600080fd5b9392505050565b6001600160a01b038116811461135657600080fd5b50565b60006020828403121561136b57600080fd5b813561133a81611341565b803561138181611341565b919050565b60008235603e1983360301811261139c57600080fd5b9190910192915050565b60008235605e1983360301811261139c57600080fd5b6000808335601e198436030181126113d357600080fd5b8301803591506001600160401b038211156113ed57600080fd5b6020019150600581901b360382131561140557600080fd5b9250929050565b634e487b7160e01b600052604160045260246000fd5b60405161010081016001600160401b03811182821017156114455761144561140c565b60405290565b60405160e081016001600160401b03811182821017156114455761144561140c565b604051601f8201601f191681016001600160401b03811182821017156114955761149561140c565b604052919050565b60006001600160401b038211156114b6576114b661140c565b5060051b60200190565b600082601f8301126114d157600080fd5b81356001600160401b038111156114ea576114ea61140c565b6114fd601f8201601f191660200161146d565b81815284602083860101111561151257600080fd5b816020850160208301376000918101602001919091529392505050565b803564ffffffffff8116811461138157600080fd5b60006060828403121561155657600080fd5b604051606081016001600160401b03811182821017156115785761157861140c565b6040529050806115878361152f565b81526115956020840161152f565b60208201526115a66040840161152f565b60408201525092915050565b6000604082840312156115c457600080fd5b604080519081016001600160401b03811182821017156115e6576115e661140c565b60405290508082356115f781611341565b8152602092830135920191909152919050565b80356001600160801b038116811461138157600080fd5b801515811461135657600080fd5b803561138181611621565b600082601f83011261164b57600080fd5b813561165e6116598261149d565b61146d565b808282526020820191506020610160840286010192508583111561168157600080fd5b602085015b8381101561173f57610160818803121561169f57600080fd5b6116a7611422565b6116b082611376565b81526116be60208301611376565b60208201526116cf60408301611376565b60408201526116e18860608401611544565b60608201526116f38860c084016115b2565b6080820152611705610100830161160a565b60a0820152611717610120830161162f565b60c0820152611729610140830161162f565b60e0820152835260209092019161016001611686565b5095945050505050565b803563ffffffff8116811461138157600080fd5b600061176b6116598461149d565b8381526020810190600585901b84013681111561178757600080fd5b845b818110156118905780356001600160401b038111156117a757600080fd5b860160e03682900312156117ba57600080fd5b6117c261144b565b6117cb82611376565b815260208201356001600160401b038111156117e657600080fd5b6117f2368285016114c0565b60208301525060408201356001600160401b0381111561181157600080fd5b61181d368285016114c0565b60408301525060608201356001600160401b0381111561183c57600080fd5b6118483682850161163a565b60608301525061185a6080830161160a565b608082015261186b60a08301611749565b60a082015261187c60c0830161162f565b60c082015285525060209384019301611789565b509095945050505050565b60005b838110156118b657818101518382015260200161189e565b50506000910152565b6000825161139c81846020870161189b565b6000602082840312156118e357600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b80820180821115611913576119136118ea565b92915050565b6000808335601e1984360301811261193057600080fd5b8301803591506001600160401b0382111561194a57600080fd5b60200191503681900382131561140557600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b03861681526060602082018190526000906119ad908301868861195f565b82810360408401526119c081858761195f565b98975050505050505050565b600081518084526119e481602086016020860161189b565b601f01601f19169290920160200192915050565b60018060a01b0385168152836020820152608060408201526000611a1f60808301856119cc565b905060028310611a3f57634e487b7160e01b600052602160045260246000fd5b82606083015295945050505050565b600060208284031215611a6057600080fd5b815161133a81611621565b6001600160a01b039586168152602081019490945260408401929092529092166060820152608081019190915260a00190565b600060208284031215611ab057600080fd5b815161133a81611341565b634e487b7160e01b600052603260045260246000fd5b600082825180855260208501945060208160051b8301016020850160005b83811015611b2157601f19858403018852611b0b8383516119cc565b6020988901989093509190910190600101611aef565b50909695505050505050565b604081526000611b406040830185611ad1565b8281036020840152611b528185611ad1565b95945050505050565b600060208284031215611b6d57600080fd5b813561133a81611621565b89815260e060208201526000611b9260e083018a8c61195f565b60ff891660408401526001600160a01b0388811660608501528716608084015285151560a084015282810360c0840152611bcd81858761195f565b9c9b505050505050505050505050565b60208152600061133a60208301846119cc565b6001600160a01b0384168152606060208201819052600090611c14908301856119cc565b9050826040830152949350505050565b600060018201611c3657611c366118ea565b5060010190565b634e487b7160e01b600052601260045260246000fd5b600082611c6257611c62611c3d565b500490565b81810381811115611913576119136118ea565b600082611c8957611c89611c3d565b500690565b60018060a01b038616815284602082015260a060408201526000611cb560a08301866119cc565b8281036060840152611cc781866119cc565b9150508260808301529695505050505050565b87815260e060208201526000611cf360e08301896119cc565b63ffffffff881660408401526001600160a01b0387811660608501528616608084015284151560a084015282810360c0840152611d3081856119cc565b9a9950505050505050505050565b6000604082016001600160801b03851683526040602084015280845180835260608501915060208601925060005b81811015611b215783516001600160a01b0316835260209384019390920191600101611d6c565b81516001600160a01b0390811682526020808401518216908301526040808401516001600160801b03169083015260608084015191821690830152610160820190506080830151611de8608084018215159052565b5060a0830151611dfc60a084018215159052565b5060c0830151611e3b60c084018264ffffffffff815116825264ffffffffff602082015116602083015264ffffffffff60408201511660408301525050565b5060e0929092015180516001600160a01b031661012083015260200151610140909101529056fe5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b5072a26469706673582212201f5f415bcb47b5bcc3f3fe15fa8e4612de722a3ea1aaa69d546320c040c561ba64736f6c634300081c0033", + "numDeployments": 2, + "solcInputHash": "f1fca9a70591742a2aedd10e2fd7e744", + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"SALT\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"contract IHats\",\"name\":\"hatsProtocol\",\"type\":\"address\"},{\"internalType\":\"contract IERC6551Registry\",\"name\":\"erc6551Registry\",\"type\":\"address\"},{\"internalType\":\"contract IHatsModuleFactory\",\"name\":\"hatsModuleFactory\",\"type\":\"address\"},{\"internalType\":\"contract ModuleProxyFactory\",\"name\":\"moduleProxyFactory\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"keyValuePairs\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"decentAutonomousAdminImplementation\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"hatsAccountImplementation\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"hatsElectionsEligibilityImplementation\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"string\",\"name\":\"details\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"imageURI\",\"type\":\"string\"}],\"internalType\":\"struct DecentHatsCreationModule.TopHatParams\",\"name\":\"topHat\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"string\",\"name\":\"details\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"imageURI\",\"type\":\"string\"},{\"internalType\":\"bool\",\"name\":\"isMutable\",\"type\":\"bool\"}],\"internalType\":\"struct DecentHatsCreationModule.AdminHatParams\",\"name\":\"adminHat\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"wearer\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"details\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"imageURI\",\"type\":\"string\"},{\"components\":[{\"internalType\":\"contract ISablierV2LockupLinear\",\"name\":\"sablier\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint40\",\"name\":\"start\",\"type\":\"uint40\"},{\"internalType\":\"uint40\",\"name\":\"cliff\",\"type\":\"uint40\"},{\"internalType\":\"uint40\",\"name\":\"end\",\"type\":\"uint40\"}],\"internalType\":\"struct LockupLinear.Timestamps\",\"name\":\"timestamps\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"UD60x18\",\"name\":\"fee\",\"type\":\"uint256\"}],\"internalType\":\"struct Broker\",\"name\":\"broker\",\"type\":\"tuple\"},{\"internalType\":\"uint128\",\"name\":\"totalAmount\",\"type\":\"uint128\"},{\"internalType\":\"bool\",\"name\":\"cancelable\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"transferable\",\"type\":\"bool\"}],\"internalType\":\"struct DecentHatsModuleUtils.SablierStreamParams[]\",\"name\":\"sablierStreamsParams\",\"type\":\"tuple[]\"},{\"internalType\":\"uint128\",\"name\":\"termEndDateTs\",\"type\":\"uint128\"},{\"internalType\":\"uint32\",\"name\":\"maxSupply\",\"type\":\"uint32\"},{\"internalType\":\"bool\",\"name\":\"isMutable\",\"type\":\"bool\"}],\"internalType\":\"struct DecentHatsModuleUtils.HatParams[]\",\"name\":\"hats\",\"type\":\"tuple[]\"}],\"internalType\":\"struct DecentHatsCreationModule.CreateTreeParams\",\"name\":\"treeParams\",\"type\":\"tuple\"}],\"name\":\"createAndDeclareTree\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"createAndDeclareTree((address,address,address,address,address,address,address,address,(string,string),(string,string,bool),(address,string,string,(address,address,address,(uint40,uint40,uint40),(address,uint256),uint128,bool,bool)[],uint128,uint32,bool)[]))\":{\"details\":\"For each hat that is included, if the hat is: - termed, its stream funds on are targeted directly at the nominated wearer. The wearer should directly call `withdraw-` on the Sablier contract. - untermed, its stream funds are targeted at the hat's smart account. In order to withdraw funds from the stream, the hat's smart account must be the one call to `withdraw-` on the Sablier contract, setting the recipient arg to its wearer.In order for a Safe to seamlessly create roles even if it has never previously created a role and thus has no hat tree, we defer the creation of the hat tree and its setup to this contract. This way, in a single tx block, the resulting topHatId of the newly created hat can be used to create an admin hat and any other hats needed. We also make use of `KeyValuePairs` to associate the topHatId with the Safe.\",\"params\":{\"treeParams\":\"The parameters for creating the Hat Tree with Roles\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"createAndDeclareTree((address,address,address,address,address,address,address,address,(string,string),(string,string,bool),(address,string,string,(address,address,address,(uint40,uint40,uint40),(address,uint256),uint128,bool,bool)[],uint128,uint32,bool)[]))\":{\"notice\":\"For a safe without any roles previously created on it, this function should be called. It sets up the top hat and admin hat, as well as any other hats and their streams that are provided, then transfers the top hat to the calling safe.This contract should be enabled a module on the Safe for which the role(s) are to be created, and disabled after.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/modules/DecentHatsCreationModule.sol\":\"DecentHatsCreationModule\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\npragma solidity >=0.7.0 <0.9.0;\\n\\n/// @title Enum - Collection of enums\\n/// @author Richard Meissner - \\ncontract Enum {\\n enum Operation {Call, DelegateCall}\\n}\\n\",\"keccak256\":\"0x473e45b1a5cc47be494b0e123c9127f0c11c1e0992a321ae5a644c0bfdb2c14f\",\"license\":\"LGPL-3.0-only\"},\"@gnosis.pm/zodiac/contracts/factory/ModuleProxyFactory.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\npragma solidity >=0.8.0;\\n\\ncontract ModuleProxyFactory {\\n event ModuleProxyCreation(\\n address indexed proxy,\\n address indexed masterCopy\\n );\\n\\n /// `target` can not be zero.\\n error ZeroAddress(address target);\\n\\n /// `address_` is already taken.\\n error TakenAddress(address address_);\\n\\n /// @notice Initialization failed.\\n error FailedInitialization();\\n\\n function createProxy(address target, bytes32 salt)\\n internal\\n returns (address result)\\n {\\n if (address(target) == address(0)) revert ZeroAddress(target);\\n bytes memory deployment = abi.encodePacked(\\n hex\\\"602d8060093d393df3363d3d373d3d3d363d73\\\",\\n target,\\n hex\\\"5af43d82803e903d91602b57fd5bf3\\\"\\n );\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n result := create2(0, add(deployment, 0x20), mload(deployment), salt)\\n }\\n if (result == address(0)) revert TakenAddress(result);\\n }\\n\\n function deployModule(\\n address masterCopy,\\n bytes memory initializer,\\n uint256 saltNonce\\n ) public returns (address proxy) {\\n proxy = createProxy(\\n masterCopy,\\n keccak256(abi.encodePacked(keccak256(initializer), saltNonce))\\n );\\n (bool success, ) = proxy.call(initializer);\\n if (!success) revert FailedInitialization();\\n\\n emit ModuleProxyCreation(proxy, masterCopy);\\n }\\n}\\n\",\"keccak256\":\"0x70f6f1d88cf3382748e58f85ba87279f5bb8761863c293dd8c197a71ff558761\",\"license\":\"LGPL-3.0-only\"},\"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\n\\n/// @title Zodiac Avatar - A contract that manages modules that can execute transactions via this contract.\\npragma solidity >=0.7.0 <0.9.0;\\n\\nimport \\\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\\\";\\n\\ninterface IAvatar {\\n event EnabledModule(address module);\\n event DisabledModule(address module);\\n event ExecutionFromModuleSuccess(address indexed module);\\n event ExecutionFromModuleFailure(address indexed module);\\n\\n /// @dev Enables a module on the avatar.\\n /// @notice Can only be called by the avatar.\\n /// @notice Modules should be stored as a linked list.\\n /// @notice Must emit EnabledModule(address module) if successful.\\n /// @param module Module to be enabled.\\n function enableModule(address module) external;\\n\\n /// @dev Disables a module on the avatar.\\n /// @notice Can only be called by the avatar.\\n /// @notice Must emit DisabledModule(address module) if successful.\\n /// @param prevModule Address that pointed to the module to be removed in the linked list\\n /// @param module Module to be removed.\\n function disableModule(address prevModule, address module) external;\\n\\n /// @dev Allows a Module to execute a transaction.\\n /// @notice Can only be called by an enabled module.\\n /// @notice Must emit ExecutionFromModuleSuccess(address module) if successful.\\n /// @notice Must emit ExecutionFromModuleFailure(address module) if unsuccessful.\\n /// @param to Destination address of module transaction.\\n /// @param value Ether value of module transaction.\\n /// @param data Data payload of module transaction.\\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\\n function execTransactionFromModule(\\n address to,\\n uint256 value,\\n bytes memory data,\\n Enum.Operation operation\\n ) external returns (bool success);\\n\\n /// @dev Allows a Module to execute a transaction and return data\\n /// @notice Can only be called by an enabled module.\\n /// @notice Must emit ExecutionFromModuleSuccess(address module) if successful.\\n /// @notice Must emit ExecutionFromModuleFailure(address module) if unsuccessful.\\n /// @param to Destination address of module transaction.\\n /// @param value Ether value of module transaction.\\n /// @param data Data payload of module transaction.\\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\\n function execTransactionFromModuleReturnData(\\n address to,\\n uint256 value,\\n bytes memory data,\\n Enum.Operation operation\\n ) external returns (bool success, bytes memory returnData);\\n\\n /// @dev Returns if an module is enabled\\n /// @return True if the module is enabled\\n function isModuleEnabled(address module) external view returns (bool);\\n\\n /// @dev Returns array of modules.\\n /// @param start Start of the page.\\n /// @param pageSize Maximum number of modules that should be returned.\\n /// @return array Array of modules.\\n /// @return next Start of the next page.\\n function getModulesPaginated(address start, uint256 pageSize)\\n external\\n view\\n returns (address[] memory array, address next);\\n}\\n\",\"keccak256\":\"0xcd5508ffe596eef8fbccfd5fc4f10a34397773547ce64e212d48b5212865ec1f\",\"license\":\"LGPL-3.0-only\"},\"@openzeppelin/contracts/interfaces/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/introspection/IERC165.sol\\\";\\n\",\"keccak256\":\"0xd04b0f06e0666f29cf7cccc82894de541e19bb30a765b107b1e40bb7fe5f7d7a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev 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 amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `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 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes calldata data\\n ) external;\\n\\n /**\\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 {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the caller.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool _approved) external;\\n\\n /**\\n * @dev Returns 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\",\"keccak256\":\"0xed6a749c5373af398105ce6ee3ac4763aa450ea7285d268c85d9eeca809cdb1f\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../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\",\"keccak256\":\"0x75b829ff2f26c14355d1cba20e16fe7b29ca58eb5fef665ede48bc0f9c6c74b9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _HEX_SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\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 // Inspired by OraclizeAPI's implementation - MIT licence\\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\\n\\n if (value == 0) {\\n return \\\"0\\\";\\n }\\n uint256 temp = value;\\n uint256 digits;\\n while (temp != 0) {\\n digits++;\\n temp /= 10;\\n }\\n bytes memory buffer = new bytes(digits);\\n while (value != 0) {\\n digits -= 1;\\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\\n value /= 10;\\n }\\n return string(buffer);\\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 if (value == 0) {\\n return \\\"0x00\\\";\\n }\\n uint256 temp = value;\\n uint256 length = 0;\\n while (temp != 0) {\\n length++;\\n temp >>= 8;\\n }\\n return toHexString(value, length);\\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 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_SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\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 representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n}\\n\",\"keccak256\":\"0xaf159a8b1923ad2a26d516089bceca9bdeaeacd04be50983ea00ba63070f08a3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"@prb/math/src/Common.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\n// Common.sol\\n//\\n// Common mathematical functions used in both SD59x18 and UD60x18. Note that these global functions do not\\n// always operate with SD59x18 and UD60x18 numbers.\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CUSTOM ERRORS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @notice Thrown when the resultant value in {mulDiv} overflows uint256.\\nerror PRBMath_MulDiv_Overflow(uint256 x, uint256 y, uint256 denominator);\\n\\n/// @notice Thrown when the resultant value in {mulDiv18} overflows uint256.\\nerror PRBMath_MulDiv18_Overflow(uint256 x, uint256 y);\\n\\n/// @notice Thrown when one of the inputs passed to {mulDivSigned} is `type(int256).min`.\\nerror PRBMath_MulDivSigned_InputTooSmall();\\n\\n/// @notice Thrown when the resultant value in {mulDivSigned} overflows int256.\\nerror PRBMath_MulDivSigned_Overflow(int256 x, int256 y);\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CONSTANTS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @dev The maximum value a uint128 number can have.\\nuint128 constant MAX_UINT128 = type(uint128).max;\\n\\n/// @dev The maximum value a uint40 number can have.\\nuint40 constant MAX_UINT40 = type(uint40).max;\\n\\n/// @dev The unit number, which the decimal precision of the fixed-point types.\\nuint256 constant UNIT = 1e18;\\n\\n/// @dev The unit number inverted mod 2^256.\\nuint256 constant UNIT_INVERSE = 78156646155174841979727994598816262306175212592076161876661_508869554232690281;\\n\\n/// @dev The the largest power of two that divides the decimal value of `UNIT`. The logarithm of this value is the least significant\\n/// bit in the binary representation of `UNIT`.\\nuint256 constant UNIT_LPOTD = 262144;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @notice Calculates the binary exponent of x using the binary fraction method.\\n/// @dev Has to use 192.64-bit fixed-point numbers. See https://ethereum.stackexchange.com/a/96594/24693.\\n/// @param x The exponent as an unsigned 192.64-bit fixed-point number.\\n/// @return result The result as an unsigned 60.18-decimal fixed-point number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp2(uint256 x) pure returns (uint256 result) {\\n unchecked {\\n // Start from 0.5 in the 192.64-bit fixed-point format.\\n result = 0x800000000000000000000000000000000000000000000000;\\n\\n // The following logic multiplies the result by $\\\\sqrt{2^{-i}}$ when the bit at position i is 1. Key points:\\n //\\n // 1. Intermediate results will not overflow, as the starting point is 2^191 and all magic factors are under 2^65.\\n // 2. The rationale for organizing the if statements into groups of 8 is gas savings. If the result of performing\\n // a bitwise AND operation between x and any value in the array [0x80; 0x40; 0x20; 0x10; 0x08; 0x04; 0x02; 0x01] is 1,\\n // we know that `x & 0xFF` is also 1.\\n if (x & 0xFF00000000000000 > 0) {\\n if (x & 0x8000000000000000 > 0) {\\n result = (result * 0x16A09E667F3BCC909) >> 64;\\n }\\n if (x & 0x4000000000000000 > 0) {\\n result = (result * 0x1306FE0A31B7152DF) >> 64;\\n }\\n if (x & 0x2000000000000000 > 0) {\\n result = (result * 0x1172B83C7D517ADCE) >> 64;\\n }\\n if (x & 0x1000000000000000 > 0) {\\n result = (result * 0x10B5586CF9890F62A) >> 64;\\n }\\n if (x & 0x800000000000000 > 0) {\\n result = (result * 0x1059B0D31585743AE) >> 64;\\n }\\n if (x & 0x400000000000000 > 0) {\\n result = (result * 0x102C9A3E778060EE7) >> 64;\\n }\\n if (x & 0x200000000000000 > 0) {\\n result = (result * 0x10163DA9FB33356D8) >> 64;\\n }\\n if (x & 0x100000000000000 > 0) {\\n result = (result * 0x100B1AFA5ABCBED61) >> 64;\\n }\\n }\\n\\n if (x & 0xFF000000000000 > 0) {\\n if (x & 0x80000000000000 > 0) {\\n result = (result * 0x10058C86DA1C09EA2) >> 64;\\n }\\n if (x & 0x40000000000000 > 0) {\\n result = (result * 0x1002C605E2E8CEC50) >> 64;\\n }\\n if (x & 0x20000000000000 > 0) {\\n result = (result * 0x100162F3904051FA1) >> 64;\\n }\\n if (x & 0x10000000000000 > 0) {\\n result = (result * 0x1000B175EFFDC76BA) >> 64;\\n }\\n if (x & 0x8000000000000 > 0) {\\n result = (result * 0x100058BA01FB9F96D) >> 64;\\n }\\n if (x & 0x4000000000000 > 0) {\\n result = (result * 0x10002C5CC37DA9492) >> 64;\\n }\\n if (x & 0x2000000000000 > 0) {\\n result = (result * 0x1000162E525EE0547) >> 64;\\n }\\n if (x & 0x1000000000000 > 0) {\\n result = (result * 0x10000B17255775C04) >> 64;\\n }\\n }\\n\\n if (x & 0xFF0000000000 > 0) {\\n if (x & 0x800000000000 > 0) {\\n result = (result * 0x1000058B91B5BC9AE) >> 64;\\n }\\n if (x & 0x400000000000 > 0) {\\n result = (result * 0x100002C5C89D5EC6D) >> 64;\\n }\\n if (x & 0x200000000000 > 0) {\\n result = (result * 0x10000162E43F4F831) >> 64;\\n }\\n if (x & 0x100000000000 > 0) {\\n result = (result * 0x100000B1721BCFC9A) >> 64;\\n }\\n if (x & 0x80000000000 > 0) {\\n result = (result * 0x10000058B90CF1E6E) >> 64;\\n }\\n if (x & 0x40000000000 > 0) {\\n result = (result * 0x1000002C5C863B73F) >> 64;\\n }\\n if (x & 0x20000000000 > 0) {\\n result = (result * 0x100000162E430E5A2) >> 64;\\n }\\n if (x & 0x10000000000 > 0) {\\n result = (result * 0x1000000B172183551) >> 64;\\n }\\n }\\n\\n if (x & 0xFF00000000 > 0) {\\n if (x & 0x8000000000 > 0) {\\n result = (result * 0x100000058B90C0B49) >> 64;\\n }\\n if (x & 0x4000000000 > 0) {\\n result = (result * 0x10000002C5C8601CC) >> 64;\\n }\\n if (x & 0x2000000000 > 0) {\\n result = (result * 0x1000000162E42FFF0) >> 64;\\n }\\n if (x & 0x1000000000 > 0) {\\n result = (result * 0x10000000B17217FBB) >> 64;\\n }\\n if (x & 0x800000000 > 0) {\\n result = (result * 0x1000000058B90BFCE) >> 64;\\n }\\n if (x & 0x400000000 > 0) {\\n result = (result * 0x100000002C5C85FE3) >> 64;\\n }\\n if (x & 0x200000000 > 0) {\\n result = (result * 0x10000000162E42FF1) >> 64;\\n }\\n if (x & 0x100000000 > 0) {\\n result = (result * 0x100000000B17217F8) >> 64;\\n }\\n }\\n\\n if (x & 0xFF000000 > 0) {\\n if (x & 0x80000000 > 0) {\\n result = (result * 0x10000000058B90BFC) >> 64;\\n }\\n if (x & 0x40000000 > 0) {\\n result = (result * 0x1000000002C5C85FE) >> 64;\\n }\\n if (x & 0x20000000 > 0) {\\n result = (result * 0x100000000162E42FF) >> 64;\\n }\\n if (x & 0x10000000 > 0) {\\n result = (result * 0x1000000000B17217F) >> 64;\\n }\\n if (x & 0x8000000 > 0) {\\n result = (result * 0x100000000058B90C0) >> 64;\\n }\\n if (x & 0x4000000 > 0) {\\n result = (result * 0x10000000002C5C860) >> 64;\\n }\\n if (x & 0x2000000 > 0) {\\n result = (result * 0x1000000000162E430) >> 64;\\n }\\n if (x & 0x1000000 > 0) {\\n result = (result * 0x10000000000B17218) >> 64;\\n }\\n }\\n\\n if (x & 0xFF0000 > 0) {\\n if (x & 0x800000 > 0) {\\n result = (result * 0x1000000000058B90C) >> 64;\\n }\\n if (x & 0x400000 > 0) {\\n result = (result * 0x100000000002C5C86) >> 64;\\n }\\n if (x & 0x200000 > 0) {\\n result = (result * 0x10000000000162E43) >> 64;\\n }\\n if (x & 0x100000 > 0) {\\n result = (result * 0x100000000000B1721) >> 64;\\n }\\n if (x & 0x80000 > 0) {\\n result = (result * 0x10000000000058B91) >> 64;\\n }\\n if (x & 0x40000 > 0) {\\n result = (result * 0x1000000000002C5C8) >> 64;\\n }\\n if (x & 0x20000 > 0) {\\n result = (result * 0x100000000000162E4) >> 64;\\n }\\n if (x & 0x10000 > 0) {\\n result = (result * 0x1000000000000B172) >> 64;\\n }\\n }\\n\\n if (x & 0xFF00 > 0) {\\n if (x & 0x8000 > 0) {\\n result = (result * 0x100000000000058B9) >> 64;\\n }\\n if (x & 0x4000 > 0) {\\n result = (result * 0x10000000000002C5D) >> 64;\\n }\\n if (x & 0x2000 > 0) {\\n result = (result * 0x1000000000000162E) >> 64;\\n }\\n if (x & 0x1000 > 0) {\\n result = (result * 0x10000000000000B17) >> 64;\\n }\\n if (x & 0x800 > 0) {\\n result = (result * 0x1000000000000058C) >> 64;\\n }\\n if (x & 0x400 > 0) {\\n result = (result * 0x100000000000002C6) >> 64;\\n }\\n if (x & 0x200 > 0) {\\n result = (result * 0x10000000000000163) >> 64;\\n }\\n if (x & 0x100 > 0) {\\n result = (result * 0x100000000000000B1) >> 64;\\n }\\n }\\n\\n if (x & 0xFF > 0) {\\n if (x & 0x80 > 0) {\\n result = (result * 0x10000000000000059) >> 64;\\n }\\n if (x & 0x40 > 0) {\\n result = (result * 0x1000000000000002C) >> 64;\\n }\\n if (x & 0x20 > 0) {\\n result = (result * 0x10000000000000016) >> 64;\\n }\\n if (x & 0x10 > 0) {\\n result = (result * 0x1000000000000000B) >> 64;\\n }\\n if (x & 0x8 > 0) {\\n result = (result * 0x10000000000000006) >> 64;\\n }\\n if (x & 0x4 > 0) {\\n result = (result * 0x10000000000000003) >> 64;\\n }\\n if (x & 0x2 > 0) {\\n result = (result * 0x10000000000000001) >> 64;\\n }\\n if (x & 0x1 > 0) {\\n result = (result * 0x10000000000000001) >> 64;\\n }\\n }\\n\\n // In the code snippet below, two operations are executed simultaneously:\\n //\\n // 1. The result is multiplied by $(2^n + 1)$, where $2^n$ represents the integer part, and the additional 1\\n // accounts for the initial guess of 0.5. This is achieved by subtracting from 191 instead of 192.\\n // 2. The result is then converted to an unsigned 60.18-decimal fixed-point format.\\n //\\n // The underlying logic is based on the relationship $2^{191-ip} = 2^{ip} / 2^{191}$, where $ip$ denotes the,\\n // integer part, $2^n$.\\n result *= UNIT;\\n result >>= (191 - (x >> 64));\\n }\\n}\\n\\n/// @notice Finds the zero-based index of the first 1 in the binary representation of x.\\n///\\n/// @dev See the note on \\\"msb\\\" in this Wikipedia article: https://en.wikipedia.org/wiki/Find_first_set\\n///\\n/// Each step in this implementation is equivalent to this high-level code:\\n///\\n/// ```solidity\\n/// if (x >= 2 ** 128) {\\n/// x >>= 128;\\n/// result += 128;\\n/// }\\n/// ```\\n///\\n/// Where 128 is replaced with each respective power of two factor. See the full high-level implementation here:\\n/// https://gist.github.com/PaulRBerg/f932f8693f2733e30c4d479e8e980948\\n///\\n/// The Yul instructions used below are:\\n///\\n/// - \\\"gt\\\" is \\\"greater than\\\"\\n/// - \\\"or\\\" is the OR bitwise operator\\n/// - \\\"shl\\\" is \\\"shift left\\\"\\n/// - \\\"shr\\\" is \\\"shift right\\\"\\n///\\n/// @param x The uint256 number for which to find the index of the most significant bit.\\n/// @return result The index of the most significant bit as a uint256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction msb(uint256 x) pure returns (uint256 result) {\\n // 2^128\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(7, gt(x, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^64\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(6, gt(x, 0xFFFFFFFFFFFFFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^32\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(5, gt(x, 0xFFFFFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^16\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(4, gt(x, 0xFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^8\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(3, gt(x, 0xFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^4\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(2, gt(x, 0xF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^2\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(1, gt(x, 0x3))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^1\\n // No need to shift x any more.\\n assembly (\\\"memory-safe\\\") {\\n let factor := gt(x, 0x1)\\n result := or(result, factor)\\n }\\n}\\n\\n/// @notice Calculates x*y\\u00f7denominator with 512-bit precision.\\n///\\n/// @dev Credits to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv.\\n///\\n/// Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - The denominator must not be zero.\\n/// - The result must fit in uint256.\\n///\\n/// @param x The multiplicand as a uint256.\\n/// @param y The multiplier as a uint256.\\n/// @param denominator The divisor as a uint256.\\n/// @return result The result as a uint256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mulDiv(uint256 x, uint256 y, uint256 denominator) pure returns (uint256 result) {\\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; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly (\\\"memory-safe\\\") {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\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 unchecked {\\n return prod0 / denominator;\\n }\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n if (prod1 >= denominator) {\\n revert PRBMath_MulDiv_Overflow(x, y, denominator);\\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 (\\\"memory-safe\\\") {\\n // Compute remainder using the mulmod Yul instruction.\\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 unchecked {\\n // Calculate the largest power of two divisor of the denominator using the unary operator ~. This operation cannot overflow\\n // because the denominator cannot be zero at this point in the function execution. The result is always >= 1.\\n // For more detail, see https://cs.stackexchange.com/q/138556/92363.\\n uint256 lpotdod = denominator & (~denominator + 1);\\n uint256 flippedLpotdod;\\n\\n assembly (\\\"memory-safe\\\") {\\n // Factor powers of two out of denominator.\\n denominator := div(denominator, lpotdod)\\n\\n // Divide [prod1 prod0] by lpotdod.\\n prod0 := div(prod0, lpotdod)\\n\\n // Get the flipped value `2^256 / lpotdod`. If the `lpotdod` is zero, the flipped value is one.\\n // `sub(0, lpotdod)` produces the two's complement version of `lpotdod`, which is equivalent to flipping all the bits.\\n // However, `div` interprets this value as an unsigned value: https://ethereum.stackexchange.com/q/147168/24693\\n flippedLpotdod := add(div(sub(0, lpotdod), lpotdod), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * flippedLpotdod;\\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 works\\n // 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 }\\n}\\n\\n/// @notice Calculates x*y\\u00f71e18 with 512-bit precision.\\n///\\n/// @dev A variant of {mulDiv} with constant folding, i.e. in which the denominator is hard coded to 1e18.\\n///\\n/// Notes:\\n/// - The body is purposely left uncommented; to understand how this works, see the documentation in {mulDiv}.\\n/// - The result is rounded toward zero.\\n/// - We take as an axiom that the result cannot be `MAX_UINT256` when x and y solve the following system of equations:\\n///\\n/// $$\\n/// \\\\begin{cases}\\n/// x * y = MAX\\\\_UINT256 * UNIT \\\\\\\\\\n/// (x * y) \\\\% UNIT \\\\geq \\\\frac{UNIT}{2}\\n/// \\\\end{cases}\\n/// $$\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {mulDiv}.\\n/// - The result must fit in uint256.\\n///\\n/// @param x The multiplicand as an unsigned 60.18-decimal fixed-point number.\\n/// @param y The multiplier as an unsigned 60.18-decimal fixed-point number.\\n/// @return result The result as an unsigned 60.18-decimal fixed-point number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mulDiv18(uint256 x, uint256 y) pure returns (uint256 result) {\\n uint256 prod0;\\n uint256 prod1;\\n assembly (\\\"memory-safe\\\") {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n if (prod1 == 0) {\\n unchecked {\\n return prod0 / UNIT;\\n }\\n }\\n\\n if (prod1 >= UNIT) {\\n revert PRBMath_MulDiv18_Overflow(x, y);\\n }\\n\\n uint256 remainder;\\n assembly (\\\"memory-safe\\\") {\\n remainder := mulmod(x, y, UNIT)\\n result :=\\n mul(\\n or(\\n div(sub(prod0, remainder), UNIT_LPOTD),\\n mul(sub(prod1, gt(remainder, prod0)), add(div(sub(0, UNIT_LPOTD), UNIT_LPOTD), 1))\\n ),\\n UNIT_INVERSE\\n )\\n }\\n}\\n\\n/// @notice Calculates x*y\\u00f7denominator with 512-bit precision.\\n///\\n/// @dev This is an extension of {mulDiv} for signed numbers, which works by computing the signs and the absolute values separately.\\n///\\n/// Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {mulDiv}.\\n/// - None of the inputs can be `type(int256).min`.\\n/// - The result must fit in int256.\\n///\\n/// @param x The multiplicand as an int256.\\n/// @param y The multiplier as an int256.\\n/// @param denominator The divisor as an int256.\\n/// @return result The result as an int256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mulDivSigned(int256 x, int256 y, int256 denominator) pure returns (int256 result) {\\n if (x == type(int256).min || y == type(int256).min || denominator == type(int256).min) {\\n revert PRBMath_MulDivSigned_InputTooSmall();\\n }\\n\\n // Get hold of the absolute values of x, y and the denominator.\\n uint256 xAbs;\\n uint256 yAbs;\\n uint256 dAbs;\\n unchecked {\\n xAbs = x < 0 ? uint256(-x) : uint256(x);\\n yAbs = y < 0 ? uint256(-y) : uint256(y);\\n dAbs = denominator < 0 ? uint256(-denominator) : uint256(denominator);\\n }\\n\\n // Compute the absolute value of x*y\\u00f7denominator. The result must fit in int256.\\n uint256 resultAbs = mulDiv(xAbs, yAbs, dAbs);\\n if (resultAbs > uint256(type(int256).max)) {\\n revert PRBMath_MulDivSigned_Overflow(x, y);\\n }\\n\\n // Get the signs of x, y and the denominator.\\n uint256 sx;\\n uint256 sy;\\n uint256 sd;\\n assembly (\\\"memory-safe\\\") {\\n // \\\"sgt\\\" is the \\\"signed greater than\\\" assembly instruction and \\\"sub(0,1)\\\" is -1 in two's complement.\\n sx := sgt(x, sub(0, 1))\\n sy := sgt(y, sub(0, 1))\\n sd := sgt(denominator, sub(0, 1))\\n }\\n\\n // XOR over sx, sy and sd. What this does is to check whether there are 1 or 3 negative signs in the inputs.\\n // If there are, the result should be negative. Otherwise, it should be positive.\\n unchecked {\\n result = sx ^ sy ^ sd == 0 ? -int256(resultAbs) : int256(resultAbs);\\n }\\n}\\n\\n/// @notice Calculates the square root of x using the Babylonian method.\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\\n///\\n/// Notes:\\n/// - If x is not a perfect square, the result is rounded down.\\n/// - Credits to OpenZeppelin for the explanations in comments below.\\n///\\n/// @param x The uint256 number for which to calculate the square root.\\n/// @return result The result as a uint256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction sqrt(uint256 x) pure returns (uint256 result) {\\n if (x == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we calculate the biggest power of 2 which is smaller than the square root of x.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of x is a power of 2 such that we have:\\n //\\n // $$\\n // msb(x) <= x <= 2*msb(x)$\\n // $$\\n //\\n // We write $msb(x)$ as $2^k$, and we get:\\n //\\n // $$\\n // k = log_2(x)\\n // $$\\n //\\n // Thus, we can write the initial inequality as:\\n //\\n // $$\\n // 2^{log_2(x)} <= x <= 2*2^{log_2(x)+1} \\\\\\\\\\n // sqrt(2^k) <= sqrt(x) < sqrt(2^{k+1}) \\\\\\\\\\n // 2^{k/2} <= sqrt(x) < 2^{(k+1)/2} <= 2^{(k/2)+1}\\n // $$\\n //\\n // Consequently, $2^{log_2(x) /2} is a good first approximation of sqrt(x) with at least one correct bit.\\n uint256 xAux = uint256(x);\\n result = 1;\\n if (xAux >= 2 ** 128) {\\n xAux >>= 128;\\n result <<= 64;\\n }\\n if (xAux >= 2 ** 64) {\\n xAux >>= 64;\\n result <<= 32;\\n }\\n if (xAux >= 2 ** 32) {\\n xAux >>= 32;\\n result <<= 16;\\n }\\n if (xAux >= 2 ** 16) {\\n xAux >>= 16;\\n result <<= 8;\\n }\\n if (xAux >= 2 ** 8) {\\n xAux >>= 8;\\n result <<= 4;\\n }\\n if (xAux >= 2 ** 4) {\\n xAux >>= 4;\\n result <<= 2;\\n }\\n if (xAux >= 2 ** 2) {\\n result <<= 1;\\n }\\n\\n // At this point, `result` is an estimation with at least one bit of precision. We know the true value has at\\n // most 128 bits, since it is the square root of a uint256. Newton's method converges quadratically (precision\\n // doubles at every iteration). We thus need at most 7 iteration to turn our partial result with one bit of\\n // precision into the expected uint128 result.\\n unchecked {\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n\\n // If x is not a perfect square, round the result toward zero.\\n uint256 roundedResult = x / result;\\n if (result >= roundedResult) {\\n result = roundedResult;\\n }\\n }\\n}\\n\",\"keccak256\":\"0xaa374e2c26cc93e8c22a6953804ee05f811597ef5fa82f76824378b22944778b\",\"license\":\"MIT\"},\"@prb/math/src/UD2x18.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\n/*\\n\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2550\\u2550\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2554\\u2588\\u2588\\u2588\\u2588\\u2554\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551 \\u255a\\u2550\\u255d \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\n\\n\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2550\\u2550\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d \\u255a\\u2588\\u2588\\u2588\\u2554\\u255d \\u255a\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u255d\\n\\n*/\\n\\nimport \\\"./ud2x18/Casting.sol\\\";\\nimport \\\"./ud2x18/Constants.sol\\\";\\nimport \\\"./ud2x18/Errors.sol\\\";\\nimport \\\"./ud2x18/ValueType.sol\\\";\\n\",\"keccak256\":\"0xfb624e24cd8bb790fa08e7827819de85504a86e20e961fa4ad126c65b6d90641\",\"license\":\"MIT\"},\"@prb/math/src/UD60x18.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\n/*\\n\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2550\\u2550\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2554\\u2588\\u2588\\u2588\\u2588\\u2554\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551 \\u255a\\u2550\\u255d \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\n\\n\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2550\\u2588\\u2588\\u2588\\u2588\\u2557\\u255a\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2588\\u2588\\u2551 \\u255a\\u2588\\u2588\\u2588\\u2554\\u255d \\u255a\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2554\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2554\\u255d \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u255d\\n\\n*/\\n\\nimport \\\"./ud60x18/Casting.sol\\\";\\nimport \\\"./ud60x18/Constants.sol\\\";\\nimport \\\"./ud60x18/Conversions.sol\\\";\\nimport \\\"./ud60x18/Errors.sol\\\";\\nimport \\\"./ud60x18/Helpers.sol\\\";\\nimport \\\"./ud60x18/Math.sol\\\";\\nimport \\\"./ud60x18/ValueType.sol\\\";\\n\",\"keccak256\":\"0xb98c6f74275914d279e8af6c502c2b1f50d5f6e1ed418d3b0153f5a193206c48\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as CastingErrors;\\nimport { SD59x18 } from \\\"../sd59x18/ValueType.sol\\\";\\nimport { UD2x18 } from \\\"../ud2x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"../ud60x18/ValueType.sol\\\";\\nimport { SD1x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts an SD1x18 number into SD59x18.\\n/// @dev There is no overflow check because the domain of SD1x18 is a subset of SD59x18.\\nfunction intoSD59x18(SD1x18 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(int256(SD1x18.unwrap(x)));\\n}\\n\\n/// @notice Casts an SD1x18 number into UD2x18.\\n/// - x must be positive.\\nfunction intoUD2x18(SD1x18 x) pure returns (UD2x18 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUD2x18_Underflow(x);\\n }\\n result = UD2x18.wrap(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into UD60x18.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUD60x18(SD1x18 x) pure returns (UD60x18 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUD60x18_Underflow(x);\\n }\\n result = UD60x18.wrap(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into uint256.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUint256(SD1x18 x) pure returns (uint256 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint256_Underflow(x);\\n }\\n result = uint256(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into uint128.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUint128(SD1x18 x) pure returns (uint128 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint128_Underflow(x);\\n }\\n result = uint128(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(SD1x18 x) pure returns (uint40 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint40_Underflow(x);\\n }\\n if (xInt > int64(uint64(Common.MAX_UINT40))) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint40_Overflow(x);\\n }\\n result = uint40(uint64(xInt));\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction sd1x18(int64 x) pure returns (SD1x18 result) {\\n result = SD1x18.wrap(x);\\n}\\n\\n/// @notice Unwraps an SD1x18 number into int64.\\nfunction unwrap(SD1x18 x) pure returns (int64 result) {\\n result = SD1x18.unwrap(x);\\n}\\n\\n/// @notice Wraps an int64 number into SD1x18.\\nfunction wrap(int64 x) pure returns (SD1x18 result) {\\n result = SD1x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x9e49e2b37c1bb845861740805edaaef3fe951a7b96eef16ce84fbf76e8278670\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD1x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @dev Euler's number as an SD1x18 number.\\nSD1x18 constant E = SD1x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum value an SD1x18 number can have.\\nint64 constant uMAX_SD1x18 = 9_223372036854775807;\\nSD1x18 constant MAX_SD1x18 = SD1x18.wrap(uMAX_SD1x18);\\n\\n/// @dev The maximum value an SD1x18 number can have.\\nint64 constant uMIN_SD1x18 = -9_223372036854775808;\\nSD1x18 constant MIN_SD1x18 = SD1x18.wrap(uMIN_SD1x18);\\n\\n/// @dev PI as an SD1x18 number.\\nSD1x18 constant PI = SD1x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of SD1x18.\\nSD1x18 constant UNIT = SD1x18.wrap(1e18);\\nint64 constant uUNIT = 1e18;\\n\",\"keccak256\":\"0x6496165b80552785a4b65a239b96e2a5fedf62fe54f002eeed72d75e566d7585\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD1x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in UD2x18.\\nerror PRBMath_SD1x18_ToUD2x18_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in UD60x18.\\nerror PRBMath_SD1x18_ToUD60x18_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint128.\\nerror PRBMath_SD1x18_ToUint128_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint256.\\nerror PRBMath_SD1x18_ToUint256_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint40.\\nerror PRBMath_SD1x18_ToUint40_Overflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint40.\\nerror PRBMath_SD1x18_ToUint40_Underflow(SD1x18 x);\\n\",\"keccak256\":\"0x836cb42ba619ca369fd4765bc47fefc3c3621369c5861882af14660aca5057ee\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\n\\n/// @notice The signed 1.18-decimal fixed-point number representation, which can have up to 1 digit and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\\n/// type int64. This is useful when end users want to use int64 to save gas, e.g. with tight variable packing in contract\\n/// storage.\\ntype SD1x18 is int64;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoSD59x18,\\n Casting.intoUD2x18,\\n Casting.intoUD60x18,\\n Casting.intoUint256,\\n Casting.intoUint128,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for SD1x18 global;\\n\",\"keccak256\":\"0x2f86f1aa9fca42f40808b51a879b406ac51817647bdb9642f8a79dd8fdb754a7\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Errors.sol\\\" as CastingErrors;\\nimport { MAX_UINT128, MAX_UINT40 } from \\\"../Common.sol\\\";\\nimport { uMAX_SD1x18, uMIN_SD1x18 } from \\\"../sd1x18/Constants.sol\\\";\\nimport { SD1x18 } from \\\"../sd1x18/ValueType.sol\\\";\\nimport { uMAX_UD2x18 } from \\\"../ud2x18/Constants.sol\\\";\\nimport { UD2x18 } from \\\"../ud2x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"../ud60x18/ValueType.sol\\\";\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts an SD59x18 number into int256.\\n/// @dev This is basically a functional alias for {unwrap}.\\nfunction intoInt256(SD59x18 x) pure returns (int256 result) {\\n result = SD59x18.unwrap(x);\\n}\\n\\n/// @notice Casts an SD59x18 number into SD1x18.\\n/// @dev Requirements:\\n/// - x must be greater than or equal to `uMIN_SD1x18`.\\n/// - x must be less than or equal to `uMAX_SD1x18`.\\nfunction intoSD1x18(SD59x18 x) pure returns (SD1x18 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < uMIN_SD1x18) {\\n revert CastingErrors.PRBMath_SD59x18_IntoSD1x18_Underflow(x);\\n }\\n if (xInt > uMAX_SD1x18) {\\n revert CastingErrors.PRBMath_SD59x18_IntoSD1x18_Overflow(x);\\n }\\n result = SD1x18.wrap(int64(xInt));\\n}\\n\\n/// @notice Casts an SD59x18 number into UD2x18.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `uMAX_UD2x18`.\\nfunction intoUD2x18(SD59x18 x) pure returns (UD2x18 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUD2x18_Underflow(x);\\n }\\n if (xInt > int256(uint256(uMAX_UD2x18))) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUD2x18_Overflow(x);\\n }\\n result = UD2x18.wrap(uint64(uint256(xInt)));\\n}\\n\\n/// @notice Casts an SD59x18 number into UD60x18.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUD60x18(SD59x18 x) pure returns (UD60x18 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUD60x18_Underflow(x);\\n }\\n result = UD60x18.wrap(uint256(xInt));\\n}\\n\\n/// @notice Casts an SD59x18 number into uint256.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUint256(SD59x18 x) pure returns (uint256 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint256_Underflow(x);\\n }\\n result = uint256(xInt);\\n}\\n\\n/// @notice Casts an SD59x18 number into uint128.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `uMAX_UINT128`.\\nfunction intoUint128(SD59x18 x) pure returns (uint128 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint128_Underflow(x);\\n }\\n if (xInt > int256(uint256(MAX_UINT128))) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint128_Overflow(x);\\n }\\n result = uint128(uint256(xInt));\\n}\\n\\n/// @notice Casts an SD59x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(SD59x18 x) pure returns (uint40 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint40_Underflow(x);\\n }\\n if (xInt > int256(uint256(MAX_UINT40))) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint40_Overflow(x);\\n }\\n result = uint40(uint256(xInt));\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction sd(int256 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(x);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction sd59x18(int256 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(x);\\n}\\n\\n/// @notice Unwraps an SD59x18 number into int256.\\nfunction unwrap(SD59x18 x) pure returns (int256 result) {\\n result = SD59x18.unwrap(x);\\n}\\n\\n/// @notice Wraps an int256 number into SD59x18.\\nfunction wrap(int256 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x3b21b60ec2998c3ae32f647412da51d3683b3f183a807198cc8d157499484f99\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n// NOTICE: the \\\"u\\\" prefix stands for \\\"unwrapped\\\".\\n\\n/// @dev Euler's number as an SD59x18 number.\\nSD59x18 constant E = SD59x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum input permitted in {exp}.\\nint256 constant uEXP_MAX_INPUT = 133_084258667509499440;\\nSD59x18 constant EXP_MAX_INPUT = SD59x18.wrap(uEXP_MAX_INPUT);\\n\\n/// @dev Any value less than this returns 0 in {exp}.\\nint256 constant uEXP_MIN_THRESHOLD = -41_446531673892822322;\\nSD59x18 constant EXP_MIN_THRESHOLD = SD59x18.wrap(uEXP_MIN_THRESHOLD);\\n\\n/// @dev The maximum input permitted in {exp2}.\\nint256 constant uEXP2_MAX_INPUT = 192e18 - 1;\\nSD59x18 constant EXP2_MAX_INPUT = SD59x18.wrap(uEXP2_MAX_INPUT);\\n\\n/// @dev Any value less than this returns 0 in {exp2}.\\nint256 constant uEXP2_MIN_THRESHOLD = -59_794705707972522261;\\nSD59x18 constant EXP2_MIN_THRESHOLD = SD59x18.wrap(uEXP2_MIN_THRESHOLD);\\n\\n/// @dev Half the UNIT number.\\nint256 constant uHALF_UNIT = 0.5e18;\\nSD59x18 constant HALF_UNIT = SD59x18.wrap(uHALF_UNIT);\\n\\n/// @dev $log_2(10)$ as an SD59x18 number.\\nint256 constant uLOG2_10 = 3_321928094887362347;\\nSD59x18 constant LOG2_10 = SD59x18.wrap(uLOG2_10);\\n\\n/// @dev $log_2(e)$ as an SD59x18 number.\\nint256 constant uLOG2_E = 1_442695040888963407;\\nSD59x18 constant LOG2_E = SD59x18.wrap(uLOG2_E);\\n\\n/// @dev The maximum value an SD59x18 number can have.\\nint256 constant uMAX_SD59x18 = 57896044618658097711785492504343953926634992332820282019728_792003956564819967;\\nSD59x18 constant MAX_SD59x18 = SD59x18.wrap(uMAX_SD59x18);\\n\\n/// @dev The maximum whole value an SD59x18 number can have.\\nint256 constant uMAX_WHOLE_SD59x18 = 57896044618658097711785492504343953926634992332820282019728_000000000000000000;\\nSD59x18 constant MAX_WHOLE_SD59x18 = SD59x18.wrap(uMAX_WHOLE_SD59x18);\\n\\n/// @dev The minimum value an SD59x18 number can have.\\nint256 constant uMIN_SD59x18 = -57896044618658097711785492504343953926634992332820282019728_792003956564819968;\\nSD59x18 constant MIN_SD59x18 = SD59x18.wrap(uMIN_SD59x18);\\n\\n/// @dev The minimum whole value an SD59x18 number can have.\\nint256 constant uMIN_WHOLE_SD59x18 = -57896044618658097711785492504343953926634992332820282019728_000000000000000000;\\nSD59x18 constant MIN_WHOLE_SD59x18 = SD59x18.wrap(uMIN_WHOLE_SD59x18);\\n\\n/// @dev PI as an SD59x18 number.\\nSD59x18 constant PI = SD59x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of SD59x18.\\nint256 constant uUNIT = 1e18;\\nSD59x18 constant UNIT = SD59x18.wrap(1e18);\\n\\n/// @dev The unit number squared.\\nint256 constant uUNIT_SQUARED = 1e36;\\nSD59x18 constant UNIT_SQUARED = SD59x18.wrap(uUNIT_SQUARED);\\n\\n/// @dev Zero as an SD59x18 number.\\nSD59x18 constant ZERO = SD59x18.wrap(0);\\n\",\"keccak256\":\"0x9bcb8dd6b3e886d140ad1c32747a4f6d29a492529ceb835be878ae837aa6cc3a\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when taking the absolute value of `MIN_SD59x18`.\\nerror PRBMath_SD59x18_Abs_MinSD59x18();\\n\\n/// @notice Thrown when ceiling a number overflows SD59x18.\\nerror PRBMath_SD59x18_Ceil_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when converting a basic integer to the fixed-point format overflows SD59x18.\\nerror PRBMath_SD59x18_Convert_Overflow(int256 x);\\n\\n/// @notice Thrown when converting a basic integer to the fixed-point format underflows SD59x18.\\nerror PRBMath_SD59x18_Convert_Underflow(int256 x);\\n\\n/// @notice Thrown when dividing two numbers and one of them is `MIN_SD59x18`.\\nerror PRBMath_SD59x18_Div_InputTooSmall();\\n\\n/// @notice Thrown when dividing two numbers and one of the intermediary unsigned results overflows SD59x18.\\nerror PRBMath_SD59x18_Div_Overflow(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when taking the natural exponent of a base greater than 133_084258667509499441.\\nerror PRBMath_SD59x18_Exp_InputTooBig(SD59x18 x);\\n\\n/// @notice Thrown when taking the binary exponent of a base greater than 192e18.\\nerror PRBMath_SD59x18_Exp2_InputTooBig(SD59x18 x);\\n\\n/// @notice Thrown when flooring a number underflows SD59x18.\\nerror PRBMath_SD59x18_Floor_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when taking the geometric mean of two numbers and their product is negative.\\nerror PRBMath_SD59x18_Gm_NegativeProduct(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when taking the geometric mean of two numbers and multiplying them overflows SD59x18.\\nerror PRBMath_SD59x18_Gm_Overflow(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\\nerror PRBMath_SD59x18_IntoSD1x18_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\\nerror PRBMath_SD59x18_IntoSD1x18_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\\nerror PRBMath_SD59x18_IntoUD2x18_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\\nerror PRBMath_SD59x18_IntoUD2x18_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD60x18.\\nerror PRBMath_SD59x18_IntoUD60x18_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\\nerror PRBMath_SD59x18_IntoUint128_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\\nerror PRBMath_SD59x18_IntoUint128_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint256.\\nerror PRBMath_SD59x18_IntoUint256_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\\nerror PRBMath_SD59x18_IntoUint40_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\\nerror PRBMath_SD59x18_IntoUint40_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when taking the logarithm of a number less than or equal to zero.\\nerror PRBMath_SD59x18_Log_InputTooSmall(SD59x18 x);\\n\\n/// @notice Thrown when multiplying two numbers and one of the inputs is `MIN_SD59x18`.\\nerror PRBMath_SD59x18_Mul_InputTooSmall();\\n\\n/// @notice Thrown when multiplying two numbers and the intermediary absolute result overflows SD59x18.\\nerror PRBMath_SD59x18_Mul_Overflow(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when raising a number to a power and the intermediary absolute result overflows SD59x18.\\nerror PRBMath_SD59x18_Powu_Overflow(SD59x18 x, uint256 y);\\n\\n/// @notice Thrown when taking the square root of a negative number.\\nerror PRBMath_SD59x18_Sqrt_NegativeInput(SD59x18 x);\\n\\n/// @notice Thrown when the calculating the square root overflows SD59x18.\\nerror PRBMath_SD59x18_Sqrt_Overflow(SD59x18 x);\\n\",\"keccak256\":\"0xa6d00fe5efa215ac0df25c896e3da99a12fb61e799644b2ec32da947313d3db4\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Helpers.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { wrap } from \\\"./Casting.sol\\\";\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Implements the checked addition operation (+) in the SD59x18 type.\\nfunction add(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n return wrap(x.unwrap() + y.unwrap());\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the SD59x18 type.\\nfunction and(SD59x18 x, int256 bits) pure returns (SD59x18 result) {\\n return wrap(x.unwrap() & bits);\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the SD59x18 type.\\nfunction and2(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n return wrap(x.unwrap() & y.unwrap());\\n}\\n\\n/// @notice Implements the equal (=) operation in the SD59x18 type.\\nfunction eq(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() == y.unwrap();\\n}\\n\\n/// @notice Implements the greater than operation (>) in the SD59x18 type.\\nfunction gt(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() > y.unwrap();\\n}\\n\\n/// @notice Implements the greater than or equal to operation (>=) in the SD59x18 type.\\nfunction gte(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() >= y.unwrap();\\n}\\n\\n/// @notice Implements a zero comparison check function in the SD59x18 type.\\nfunction isZero(SD59x18 x) pure returns (bool result) {\\n result = x.unwrap() == 0;\\n}\\n\\n/// @notice Implements the left shift operation (<<) in the SD59x18 type.\\nfunction lshift(SD59x18 x, uint256 bits) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() << bits);\\n}\\n\\n/// @notice Implements the lower than operation (<) in the SD59x18 type.\\nfunction lt(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() < y.unwrap();\\n}\\n\\n/// @notice Implements the lower than or equal to operation (<=) in the SD59x18 type.\\nfunction lte(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() <= y.unwrap();\\n}\\n\\n/// @notice Implements the unchecked modulo operation (%) in the SD59x18 type.\\nfunction mod(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() % y.unwrap());\\n}\\n\\n/// @notice Implements the not equal operation (!=) in the SD59x18 type.\\nfunction neq(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() != y.unwrap();\\n}\\n\\n/// @notice Implements the NOT (~) bitwise operation in the SD59x18 type.\\nfunction not(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(~x.unwrap());\\n}\\n\\n/// @notice Implements the OR (|) bitwise operation in the SD59x18 type.\\nfunction or(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() | y.unwrap());\\n}\\n\\n/// @notice Implements the right shift operation (>>) in the SD59x18 type.\\nfunction rshift(SD59x18 x, uint256 bits) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() >> bits);\\n}\\n\\n/// @notice Implements the checked subtraction operation (-) in the SD59x18 type.\\nfunction sub(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() - y.unwrap());\\n}\\n\\n/// @notice Implements the checked unary minus operation (-) in the SD59x18 type.\\nfunction unary(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(-x.unwrap());\\n}\\n\\n/// @notice Implements the unchecked addition operation (+) in the SD59x18 type.\\nfunction uncheckedAdd(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() + y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the unchecked subtraction operation (-) in the SD59x18 type.\\nfunction uncheckedSub(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() - y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the unchecked unary minus operation (-) in the SD59x18 type.\\nfunction uncheckedUnary(SD59x18 x) pure returns (SD59x18 result) {\\n unchecked {\\n result = wrap(-x.unwrap());\\n }\\n}\\n\\n/// @notice Implements the XOR (^) bitwise operation in the SD59x18 type.\\nfunction xor(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() ^ y.unwrap());\\n}\\n\",\"keccak256\":\"0x208570f1657cf730cb6c3d81aa14030e0d45cf906cdedea5059369d7df4bb716\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as Errors;\\nimport {\\n uEXP_MAX_INPUT,\\n uEXP2_MAX_INPUT,\\n uEXP_MIN_THRESHOLD,\\n uEXP2_MIN_THRESHOLD,\\n uHALF_UNIT,\\n uLOG2_10,\\n uLOG2_E,\\n uMAX_SD59x18,\\n uMAX_WHOLE_SD59x18,\\n uMIN_SD59x18,\\n uMIN_WHOLE_SD59x18,\\n UNIT,\\n uUNIT,\\n uUNIT_SQUARED,\\n ZERO\\n} from \\\"./Constants.sol\\\";\\nimport { wrap } from \\\"./Helpers.sol\\\";\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Calculates the absolute value of x.\\n///\\n/// @dev Requirements:\\n/// - x must be greater than `MIN_SD59x18`.\\n///\\n/// @param x The SD59x18 number for which to calculate the absolute value.\\n/// @param result The absolute value of x as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction abs(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt == uMIN_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Abs_MinSD59x18();\\n }\\n result = xInt < 0 ? wrap(-xInt) : x;\\n}\\n\\n/// @notice Calculates the arithmetic average of x and y.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// @param x The first operand as an SD59x18 number.\\n/// @param y The second operand as an SD59x18 number.\\n/// @return result The arithmetic average as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction avg(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n\\n unchecked {\\n // This operation is equivalent to `x / 2 + y / 2`, and it can never overflow.\\n int256 sum = (xInt >> 1) + (yInt >> 1);\\n\\n if (sum < 0) {\\n // If at least one of x and y is odd, add 1 to the result, because shifting negative numbers to the right\\n // rounds toward negative infinity. The right part is equivalent to `sum + (x % 2 == 1 || y % 2 == 1)`.\\n assembly (\\\"memory-safe\\\") {\\n result := add(sum, and(or(xInt, yInt), 1))\\n }\\n } else {\\n // Add 1 if both x and y are odd to account for the double 0.5 remainder truncated after shifting.\\n result = wrap(sum + (xInt & yInt & 1));\\n }\\n }\\n}\\n\\n/// @notice Yields the smallest whole number greater than or equal to x.\\n///\\n/// @dev Optimized for fractional value inputs, because every whole value has (1e18 - 1) fractional counterparts.\\n/// See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n///\\n/// Requirements:\\n/// - x must be less than or equal to `MAX_WHOLE_SD59x18`.\\n///\\n/// @param x The SD59x18 number to ceil.\\n/// @param result The smallest whole number greater than or equal to x, as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ceil(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt > uMAX_WHOLE_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Ceil_Overflow(x);\\n }\\n\\n int256 remainder = xInt % uUNIT;\\n if (remainder == 0) {\\n result = x;\\n } else {\\n unchecked {\\n // Solidity uses C fmod style, which returns a modulus with the same sign as x.\\n int256 resultInt = xInt - remainder;\\n if (xInt > 0) {\\n resultInt += uUNIT;\\n }\\n result = wrap(resultInt);\\n }\\n }\\n}\\n\\n/// @notice Divides two SD59x18 numbers, returning a new SD59x18 number.\\n///\\n/// @dev This is an extension of {Common.mulDiv} for signed numbers, which works by computing the signs and the absolute\\n/// values separately.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv}.\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv}.\\n/// - None of the inputs can be `MIN_SD59x18`.\\n/// - The denominator must not be zero.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The numerator as an SD59x18 number.\\n/// @param y The denominator as an SD59x18 number.\\n/// @param result The quotient as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction div(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n if (xInt == uMIN_SD59x18 || yInt == uMIN_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Div_InputTooSmall();\\n }\\n\\n // Get hold of the absolute values of x and y.\\n uint256 xAbs;\\n uint256 yAbs;\\n unchecked {\\n xAbs = xInt < 0 ? uint256(-xInt) : uint256(xInt);\\n yAbs = yInt < 0 ? uint256(-yInt) : uint256(yInt);\\n }\\n\\n // Compute the absolute value (x*UNIT\\u00f7y). The resulting value must fit in SD59x18.\\n uint256 resultAbs = Common.mulDiv(xAbs, uint256(uUNIT), yAbs);\\n if (resultAbs > uint256(uMAX_SD59x18)) {\\n revert Errors.PRBMath_SD59x18_Div_Overflow(x, y);\\n }\\n\\n // Check if x and y have the same sign using two's complement representation. The left-most bit represents the sign (1 for\\n // negative, 0 for positive or zero).\\n bool sameSign = (xInt ^ yInt) > -1;\\n\\n // If the inputs have the same sign, the result should be positive. Otherwise, it should be negative.\\n unchecked {\\n result = wrap(sameSign ? int256(resultAbs) : -int256(resultAbs));\\n }\\n}\\n\\n/// @notice Calculates the natural exponent of x using the following formula:\\n///\\n/// $$\\n/// e^x = 2^{x * log_2{e}}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {exp2}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {exp2}.\\n/// - x must be less than 133_084258667509499441.\\n///\\n/// @param x The exponent as an SD59x18 number.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n\\n // Any input less than the threshold returns zero.\\n // This check also prevents an overflow for very small numbers.\\n if (xInt < uEXP_MIN_THRESHOLD) {\\n return ZERO;\\n }\\n\\n // This check prevents values greater than 192e18 from being passed to {exp2}.\\n if (xInt > uEXP_MAX_INPUT) {\\n revert Errors.PRBMath_SD59x18_Exp_InputTooBig(x);\\n }\\n\\n unchecked {\\n // Inline the fixed-point multiplication to save gas.\\n int256 doubleUnitProduct = xInt * uLOG2_E;\\n result = exp2(wrap(doubleUnitProduct / uUNIT));\\n }\\n}\\n\\n/// @notice Calculates the binary exponent of x using the binary fraction method using the following formula:\\n///\\n/// $$\\n/// 2^{-x} = \\\\frac{1}{2^x}\\n/// $$\\n///\\n/// @dev See https://ethereum.stackexchange.com/q/79903/24693.\\n///\\n/// Notes:\\n/// - If x is less than -59_794705707972522261, the result is zero.\\n///\\n/// Requirements:\\n/// - x must be less than 192e18.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The exponent as an SD59x18 number.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp2(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < 0) {\\n // The inverse of any number less than the threshold is truncated to zero.\\n if (xInt < uEXP2_MIN_THRESHOLD) {\\n return ZERO;\\n }\\n\\n unchecked {\\n // Inline the fixed-point inversion to save gas.\\n result = wrap(uUNIT_SQUARED / exp2(wrap(-xInt)).unwrap());\\n }\\n } else {\\n // Numbers greater than or equal to 192e18 don't fit in the 192.64-bit format.\\n if (xInt > uEXP2_MAX_INPUT) {\\n revert Errors.PRBMath_SD59x18_Exp2_InputTooBig(x);\\n }\\n\\n unchecked {\\n // Convert x to the 192.64-bit fixed-point format.\\n uint256 x_192x64 = uint256((xInt << 64) / uUNIT);\\n\\n // It is safe to cast the result to int256 due to the checks above.\\n result = wrap(int256(Common.exp2(x_192x64)));\\n }\\n }\\n}\\n\\n/// @notice Yields the greatest whole number less than or equal to x.\\n///\\n/// @dev Optimized for fractional value inputs, because for every whole value there are (1e18 - 1) fractional\\n/// counterparts. See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n///\\n/// Requirements:\\n/// - x must be greater than or equal to `MIN_WHOLE_SD59x18`.\\n///\\n/// @param x The SD59x18 number to floor.\\n/// @param result The greatest whole number less than or equal to x, as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction floor(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < uMIN_WHOLE_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Floor_Underflow(x);\\n }\\n\\n int256 remainder = xInt % uUNIT;\\n if (remainder == 0) {\\n result = x;\\n } else {\\n unchecked {\\n // Solidity uses C fmod style, which returns a modulus with the same sign as x.\\n int256 resultInt = xInt - remainder;\\n if (xInt < 0) {\\n resultInt -= uUNIT;\\n }\\n result = wrap(resultInt);\\n }\\n }\\n}\\n\\n/// @notice Yields the excess beyond the floor of x for positive numbers and the part of the number to the right.\\n/// of the radix point for negative numbers.\\n/// @dev Based on the odd function definition. https://en.wikipedia.org/wiki/Fractional_part\\n/// @param x The SD59x18 number to get the fractional part of.\\n/// @param result The fractional part of x as an SD59x18 number.\\nfunction frac(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() % uUNIT);\\n}\\n\\n/// @notice Calculates the geometric mean of x and y, i.e. $\\\\sqrt{x * y}$.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x * y must fit in SD59x18.\\n/// - x * y must not be negative, since complex numbers are not supported.\\n///\\n/// @param x The first operand as an SD59x18 number.\\n/// @param y The second operand as an SD59x18 number.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction gm(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n if (xInt == 0 || yInt == 0) {\\n return ZERO;\\n }\\n\\n unchecked {\\n // Equivalent to `xy / x != y`. Checking for overflow this way is faster than letting Solidity do it.\\n int256 xyInt = xInt * yInt;\\n if (xyInt / xInt != yInt) {\\n revert Errors.PRBMath_SD59x18_Gm_Overflow(x, y);\\n }\\n\\n // The product must not be negative, since complex numbers are not supported.\\n if (xyInt < 0) {\\n revert Errors.PRBMath_SD59x18_Gm_NegativeProduct(x, y);\\n }\\n\\n // We don't need to multiply the result by `UNIT` here because the x*y product picked up a factor of `UNIT`\\n // during multiplication. See the comments in {Common.sqrt}.\\n uint256 resultUint = Common.sqrt(uint256(xyInt));\\n result = wrap(int256(resultUint));\\n }\\n}\\n\\n/// @notice Calculates the inverse of x.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x must not be zero.\\n///\\n/// @param x The SD59x18 number for which to calculate the inverse.\\n/// @return result The inverse as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction inv(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(uUNIT_SQUARED / x.unwrap());\\n}\\n\\n/// @notice Calculates the natural logarithm of x using the following formula:\\n///\\n/// $$\\n/// ln{x} = log_2{x} / log_2{e}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n/// - The precision isn't sufficiently fine-grained to return exactly `UNIT` when the input is `E`.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The SD59x18 number for which to calculate the natural logarithm.\\n/// @return result The natural logarithm as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ln(SD59x18 x) pure returns (SD59x18 result) {\\n // Inline the fixed-point multiplication to save gas. This is overflow-safe because the maximum value that\\n // {log2} can return is ~195_205294292027477728.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_E);\\n}\\n\\n/// @notice Calculates the common logarithm of x using the following formula:\\n///\\n/// $$\\n/// log_{10}{x} = log_2{x} / log_2{10}\\n/// $$\\n///\\n/// However, if x is an exact power of ten, a hard coded value is returned.\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The SD59x18 number for which to calculate the common logarithm.\\n/// @return result The common logarithm as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log10(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < 0) {\\n revert Errors.PRBMath_SD59x18_Log_InputTooSmall(x);\\n }\\n\\n // Note that the `mul` in this block is the standard multiplication operation, not {SD59x18.mul}.\\n // prettier-ignore\\n assembly (\\\"memory-safe\\\") {\\n switch x\\n case 1 { result := mul(uUNIT, sub(0, 18)) }\\n case 10 { result := mul(uUNIT, sub(1, 18)) }\\n case 100 { result := mul(uUNIT, sub(2, 18)) }\\n case 1000 { result := mul(uUNIT, sub(3, 18)) }\\n case 10000 { result := mul(uUNIT, sub(4, 18)) }\\n case 100000 { result := mul(uUNIT, sub(5, 18)) }\\n case 1000000 { result := mul(uUNIT, sub(6, 18)) }\\n case 10000000 { result := mul(uUNIT, sub(7, 18)) }\\n case 100000000 { result := mul(uUNIT, sub(8, 18)) }\\n case 1000000000 { result := mul(uUNIT, sub(9, 18)) }\\n case 10000000000 { result := mul(uUNIT, sub(10, 18)) }\\n case 100000000000 { result := mul(uUNIT, sub(11, 18)) }\\n case 1000000000000 { result := mul(uUNIT, sub(12, 18)) }\\n case 10000000000000 { result := mul(uUNIT, sub(13, 18)) }\\n case 100000000000000 { result := mul(uUNIT, sub(14, 18)) }\\n case 1000000000000000 { result := mul(uUNIT, sub(15, 18)) }\\n case 10000000000000000 { result := mul(uUNIT, sub(16, 18)) }\\n case 100000000000000000 { result := mul(uUNIT, sub(17, 18)) }\\n case 1000000000000000000 { result := 0 }\\n case 10000000000000000000 { result := uUNIT }\\n case 100000000000000000000 { result := mul(uUNIT, 2) }\\n case 1000000000000000000000 { result := mul(uUNIT, 3) }\\n case 10000000000000000000000 { result := mul(uUNIT, 4) }\\n case 100000000000000000000000 { result := mul(uUNIT, 5) }\\n case 1000000000000000000000000 { result := mul(uUNIT, 6) }\\n case 10000000000000000000000000 { result := mul(uUNIT, 7) }\\n case 100000000000000000000000000 { result := mul(uUNIT, 8) }\\n case 1000000000000000000000000000 { result := mul(uUNIT, 9) }\\n case 10000000000000000000000000000 { result := mul(uUNIT, 10) }\\n case 100000000000000000000000000000 { result := mul(uUNIT, 11) }\\n case 1000000000000000000000000000000 { result := mul(uUNIT, 12) }\\n case 10000000000000000000000000000000 { result := mul(uUNIT, 13) }\\n case 100000000000000000000000000000000 { result := mul(uUNIT, 14) }\\n case 1000000000000000000000000000000000 { result := mul(uUNIT, 15) }\\n case 10000000000000000000000000000000000 { result := mul(uUNIT, 16) }\\n case 100000000000000000000000000000000000 { result := mul(uUNIT, 17) }\\n case 1000000000000000000000000000000000000 { result := mul(uUNIT, 18) }\\n case 10000000000000000000000000000000000000 { result := mul(uUNIT, 19) }\\n case 100000000000000000000000000000000000000 { result := mul(uUNIT, 20) }\\n case 1000000000000000000000000000000000000000 { result := mul(uUNIT, 21) }\\n case 10000000000000000000000000000000000000000 { result := mul(uUNIT, 22) }\\n case 100000000000000000000000000000000000000000 { result := mul(uUNIT, 23) }\\n case 1000000000000000000000000000000000000000000 { result := mul(uUNIT, 24) }\\n case 10000000000000000000000000000000000000000000 { result := mul(uUNIT, 25) }\\n case 100000000000000000000000000000000000000000000 { result := mul(uUNIT, 26) }\\n case 1000000000000000000000000000000000000000000000 { result := mul(uUNIT, 27) }\\n case 10000000000000000000000000000000000000000000000 { result := mul(uUNIT, 28) }\\n case 100000000000000000000000000000000000000000000000 { result := mul(uUNIT, 29) }\\n case 1000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 30) }\\n case 10000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 31) }\\n case 100000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 32) }\\n case 1000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 33) }\\n case 10000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 34) }\\n case 100000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 35) }\\n case 1000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 36) }\\n case 10000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 37) }\\n case 100000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 38) }\\n case 1000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 39) }\\n case 10000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 40) }\\n case 100000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 41) }\\n case 1000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 42) }\\n case 10000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 43) }\\n case 100000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 44) }\\n case 1000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 45) }\\n case 10000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 46) }\\n case 100000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 47) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 48) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 49) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 50) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 51) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 52) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 53) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 54) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 55) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 56) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 57) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 58) }\\n default { result := uMAX_SD59x18 }\\n }\\n\\n if (result.unwrap() == uMAX_SD59x18) {\\n unchecked {\\n // Inline the fixed-point division to save gas.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_10);\\n }\\n }\\n}\\n\\n/// @notice Calculates the binary logarithm of x using the iterative approximation algorithm:\\n///\\n/// $$\\n/// log_2{x} = n + log_2{y}, \\\\text{ where } y = x*2^{-n}, \\\\ y \\\\in [1, 2)\\n/// $$\\n///\\n/// For $0 \\\\leq x \\\\lt 1$, the input is inverted:\\n///\\n/// $$\\n/// log_2{x} = -log_2{\\\\frac{1}{x}}\\n/// $$\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Binary_logarithm#Iterative_approximation.\\n///\\n/// Notes:\\n/// - Due to the lossy precision of the iterative approximation, the results are not perfectly accurate to the last decimal.\\n///\\n/// Requirements:\\n/// - x must be greater than zero.\\n///\\n/// @param x The SD59x18 number for which to calculate the binary logarithm.\\n/// @return result The binary logarithm as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log2(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt <= 0) {\\n revert Errors.PRBMath_SD59x18_Log_InputTooSmall(x);\\n }\\n\\n unchecked {\\n int256 sign;\\n if (xInt >= uUNIT) {\\n sign = 1;\\n } else {\\n sign = -1;\\n // Inline the fixed-point inversion to save gas.\\n xInt = uUNIT_SQUARED / xInt;\\n }\\n\\n // Calculate the integer part of the logarithm.\\n uint256 n = Common.msb(uint256(xInt / uUNIT));\\n\\n // This is the integer part of the logarithm as an SD59x18 number. The operation can't overflow\\n // because n is at most 255, `UNIT` is 1e18, and the sign is either 1 or -1.\\n int256 resultInt = int256(n) * uUNIT;\\n\\n // Calculate $y = x * 2^{-n}$.\\n int256 y = xInt >> n;\\n\\n // If y is the unit number, the fractional part is zero.\\n if (y == uUNIT) {\\n return wrap(resultInt * sign);\\n }\\n\\n // Calculate the fractional part via the iterative approximation.\\n // The `delta >>= 1` part is equivalent to `delta /= 2`, but shifting bits is more gas efficient.\\n int256 DOUBLE_UNIT = 2e18;\\n for (int256 delta = uHALF_UNIT; delta > 0; delta >>= 1) {\\n y = (y * y) / uUNIT;\\n\\n // Is y^2 >= 2e18 and so in the range [2e18, 4e18)?\\n if (y >= DOUBLE_UNIT) {\\n // Add the 2^{-m} factor to the logarithm.\\n resultInt = resultInt + delta;\\n\\n // Halve y, which corresponds to z/2 in the Wikipedia article.\\n y >>= 1;\\n }\\n }\\n resultInt *= sign;\\n result = wrap(resultInt);\\n }\\n}\\n\\n/// @notice Multiplies two SD59x18 numbers together, returning a new SD59x18 number.\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {Common.mulDiv18}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv18}.\\n/// - None of the inputs can be `MIN_SD59x18`.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The multiplicand as an SD59x18 number.\\n/// @param y The multiplier as an SD59x18 number.\\n/// @return result The product as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mul(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n if (xInt == uMIN_SD59x18 || yInt == uMIN_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Mul_InputTooSmall();\\n }\\n\\n // Get hold of the absolute values of x and y.\\n uint256 xAbs;\\n uint256 yAbs;\\n unchecked {\\n xAbs = xInt < 0 ? uint256(-xInt) : uint256(xInt);\\n yAbs = yInt < 0 ? uint256(-yInt) : uint256(yInt);\\n }\\n\\n // Compute the absolute value (x*y\\u00f7UNIT). The resulting value must fit in SD59x18.\\n uint256 resultAbs = Common.mulDiv18(xAbs, yAbs);\\n if (resultAbs > uint256(uMAX_SD59x18)) {\\n revert Errors.PRBMath_SD59x18_Mul_Overflow(x, y);\\n }\\n\\n // Check if x and y have the same sign using two's complement representation. The left-most bit represents the sign (1 for\\n // negative, 0 for positive or zero).\\n bool sameSign = (xInt ^ yInt) > -1;\\n\\n // If the inputs have the same sign, the result should be positive. Otherwise, it should be negative.\\n unchecked {\\n result = wrap(sameSign ? int256(resultAbs) : -int256(resultAbs));\\n }\\n}\\n\\n/// @notice Raises x to the power of y using the following formula:\\n///\\n/// $$\\n/// x^y = 2^{log_2{x} * y}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {exp2}, {log2}, and {mul}.\\n/// - Returns `UNIT` for 0^0.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {exp2}, {log2}, and {mul}.\\n///\\n/// @param x The base as an SD59x18 number.\\n/// @param y Exponent to raise x to, as an SD59x18 number\\n/// @return result x raised to power y, as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction pow(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n\\n // If both x and y are zero, the result is `UNIT`. If just x is zero, the result is always zero.\\n if (xInt == 0) {\\n return yInt == 0 ? UNIT : ZERO;\\n }\\n // If x is `UNIT`, the result is always `UNIT`.\\n else if (xInt == uUNIT) {\\n return UNIT;\\n }\\n\\n // If y is zero, the result is always `UNIT`.\\n if (yInt == 0) {\\n return UNIT;\\n }\\n // If y is `UNIT`, the result is always x.\\n else if (yInt == uUNIT) {\\n return x;\\n }\\n\\n // Calculate the result using the formula.\\n result = exp2(mul(log2(x), y));\\n}\\n\\n/// @notice Raises x (an SD59x18 number) to the power y (an unsigned basic integer) using the well-known\\n/// algorithm \\\"exponentiation by squaring\\\".\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Exponentiation_by_squaring.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv18}.\\n/// - Returns `UNIT` for 0^0.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {abs} and {Common.mulDiv18}.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The base as an SD59x18 number.\\n/// @param y The exponent as a uint256.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction powu(SD59x18 x, uint256 y) pure returns (SD59x18 result) {\\n uint256 xAbs = uint256(abs(x).unwrap());\\n\\n // Calculate the first iteration of the loop in advance.\\n uint256 resultAbs = y & 1 > 0 ? xAbs : uint256(uUNIT);\\n\\n // Equivalent to `for(y /= 2; y > 0; y /= 2)`.\\n uint256 yAux = y;\\n for (yAux >>= 1; yAux > 0; yAux >>= 1) {\\n xAbs = Common.mulDiv18(xAbs, xAbs);\\n\\n // Equivalent to `y % 2 == 1`.\\n if (yAux & 1 > 0) {\\n resultAbs = Common.mulDiv18(resultAbs, xAbs);\\n }\\n }\\n\\n // The result must fit in SD59x18.\\n if (resultAbs > uint256(uMAX_SD59x18)) {\\n revert Errors.PRBMath_SD59x18_Powu_Overflow(x, y);\\n }\\n\\n unchecked {\\n // Is the base negative and the exponent odd? If yes, the result should be negative.\\n int256 resultInt = int256(resultAbs);\\n bool isNegative = x.unwrap() < 0 && y & 1 == 1;\\n if (isNegative) {\\n resultInt = -resultInt;\\n }\\n result = wrap(resultInt);\\n }\\n}\\n\\n/// @notice Calculates the square root of x using the Babylonian method.\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\\n///\\n/// Notes:\\n/// - Only the positive root is returned.\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x cannot be negative, since complex numbers are not supported.\\n/// - x must be less than `MAX_SD59x18 / UNIT`.\\n///\\n/// @param x The SD59x18 number for which to calculate the square root.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction sqrt(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < 0) {\\n revert Errors.PRBMath_SD59x18_Sqrt_NegativeInput(x);\\n }\\n if (xInt > uMAX_SD59x18 / uUNIT) {\\n revert Errors.PRBMath_SD59x18_Sqrt_Overflow(x);\\n }\\n\\n unchecked {\\n // Multiply x by `UNIT` to account for the factor of `UNIT` picked up when multiplying two SD59x18 numbers.\\n // In this case, the two numbers are both the square root.\\n uint256 resultUint = Common.sqrt(uint256(xInt * uUNIT));\\n result = wrap(int256(resultUint));\\n }\\n}\\n\",\"keccak256\":\"0xa074831139fc89ca0e5a36086b30eb50896bb6770cd5823461b1f2769017d2f0\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\nimport \\\"./Helpers.sol\\\" as Helpers;\\nimport \\\"./Math.sol\\\" as Math;\\n\\n/// @notice The signed 59.18-decimal fixed-point number representation, which can have up to 59 digits and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\\n/// type int256.\\ntype SD59x18 is int256;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoInt256,\\n Casting.intoSD1x18,\\n Casting.intoUD2x18,\\n Casting.intoUD60x18,\\n Casting.intoUint256,\\n Casting.intoUint128,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for SD59x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n MATHEMATICAL FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Math.abs,\\n Math.avg,\\n Math.ceil,\\n Math.div,\\n Math.exp,\\n Math.exp2,\\n Math.floor,\\n Math.frac,\\n Math.gm,\\n Math.inv,\\n Math.log10,\\n Math.log2,\\n Math.ln,\\n Math.mul,\\n Math.pow,\\n Math.powu,\\n Math.sqrt\\n} for SD59x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n HELPER FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Helpers.add,\\n Helpers.and,\\n Helpers.eq,\\n Helpers.gt,\\n Helpers.gte,\\n Helpers.isZero,\\n Helpers.lshift,\\n Helpers.lt,\\n Helpers.lte,\\n Helpers.mod,\\n Helpers.neq,\\n Helpers.not,\\n Helpers.or,\\n Helpers.rshift,\\n Helpers.sub,\\n Helpers.uncheckedAdd,\\n Helpers.uncheckedSub,\\n Helpers.uncheckedUnary,\\n Helpers.xor\\n} for SD59x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n OPERATORS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes it possible to use these operators on the SD59x18 type.\\nusing {\\n Helpers.add as +,\\n Helpers.and2 as &,\\n Math.div as /,\\n Helpers.eq as ==,\\n Helpers.gt as >,\\n Helpers.gte as >=,\\n Helpers.lt as <,\\n Helpers.lte as <=,\\n Helpers.mod as %,\\n Math.mul as *,\\n Helpers.neq as !=,\\n Helpers.not as ~,\\n Helpers.or as |,\\n Helpers.sub as -,\\n Helpers.unary as -,\\n Helpers.xor as ^\\n} for SD59x18 global;\\n\",\"keccak256\":\"0xe03112d145dcd5863aff24e5f381debaae29d446acd5666f3d640e3d9af738d7\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as Errors;\\nimport { uMAX_SD1x18 } from \\\"../sd1x18/Constants.sol\\\";\\nimport { SD1x18 } from \\\"../sd1x18/ValueType.sol\\\";\\nimport { SD59x18 } from \\\"../sd59x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"../ud60x18/ValueType.sol\\\";\\nimport { UD2x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts a UD2x18 number into SD1x18.\\n/// - x must be less than or equal to `uMAX_SD1x18`.\\nfunction intoSD1x18(UD2x18 x) pure returns (SD1x18 result) {\\n uint64 xUint = UD2x18.unwrap(x);\\n if (xUint > uint64(uMAX_SD1x18)) {\\n revert Errors.PRBMath_UD2x18_IntoSD1x18_Overflow(x);\\n }\\n result = SD1x18.wrap(int64(xUint));\\n}\\n\\n/// @notice Casts a UD2x18 number into SD59x18.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of SD59x18.\\nfunction intoSD59x18(UD2x18 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(int256(uint256(UD2x18.unwrap(x))));\\n}\\n\\n/// @notice Casts a UD2x18 number into UD60x18.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of UD60x18.\\nfunction intoUD60x18(UD2x18 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(UD2x18.unwrap(x));\\n}\\n\\n/// @notice Casts a UD2x18 number into uint128.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of uint128.\\nfunction intoUint128(UD2x18 x) pure returns (uint128 result) {\\n result = uint128(UD2x18.unwrap(x));\\n}\\n\\n/// @notice Casts a UD2x18 number into uint256.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of uint256.\\nfunction intoUint256(UD2x18 x) pure returns (uint256 result) {\\n result = uint256(UD2x18.unwrap(x));\\n}\\n\\n/// @notice Casts a UD2x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(UD2x18 x) pure returns (uint40 result) {\\n uint64 xUint = UD2x18.unwrap(x);\\n if (xUint > uint64(Common.MAX_UINT40)) {\\n revert Errors.PRBMath_UD2x18_IntoUint40_Overflow(x);\\n }\\n result = uint40(xUint);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction ud2x18(uint64 x) pure returns (UD2x18 result) {\\n result = UD2x18.wrap(x);\\n}\\n\\n/// @notice Unwrap a UD2x18 number into uint64.\\nfunction unwrap(UD2x18 x) pure returns (uint64 result) {\\n result = UD2x18.unwrap(x);\\n}\\n\\n/// @notice Wraps a uint64 number into UD2x18.\\nfunction wrap(uint64 x) pure returns (UD2x18 result) {\\n result = UD2x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x9b1a35d432ef951a415fae8098b3c609a99b630a3d5464b3c8e1efa8893eea07\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD2x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @dev Euler's number as a UD2x18 number.\\nUD2x18 constant E = UD2x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum value a UD2x18 number can have.\\nuint64 constant uMAX_UD2x18 = 18_446744073709551615;\\nUD2x18 constant MAX_UD2x18 = UD2x18.wrap(uMAX_UD2x18);\\n\\n/// @dev PI as a UD2x18 number.\\nUD2x18 constant PI = UD2x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of UD2x18.\\nUD2x18 constant UNIT = UD2x18.wrap(1e18);\\nuint64 constant uUNIT = 1e18;\\n\",\"keccak256\":\"0x29b0e050c865899e1fb9022b460a7829cdee248c44c4299f068ba80695eec3fc\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD2x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when trying to cast a UD2x18 number that doesn't fit in SD1x18.\\nerror PRBMath_UD2x18_IntoSD1x18_Overflow(UD2x18 x);\\n\\n/// @notice Thrown when trying to cast a UD2x18 number that doesn't fit in uint40.\\nerror PRBMath_UD2x18_IntoUint40_Overflow(UD2x18 x);\\n\",\"keccak256\":\"0xdf1e22f0b4c8032bcc8b7f63fe3984e1387f3dc7b2e9ab381822249f75376d33\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\n\\n/// @notice The unsigned 2.18-decimal fixed-point number representation, which can have up to 2 digits and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\\n/// type uint64. This is useful when end users want to use uint64 to save gas, e.g. with tight variable packing in contract\\n/// storage.\\ntype UD2x18 is uint64;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoSD1x18,\\n Casting.intoSD59x18,\\n Casting.intoUD60x18,\\n Casting.intoUint256,\\n Casting.intoUint128,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for UD2x18 global;\\n\",\"keccak256\":\"0x2802edc9869db116a0b5c490cc5f8554742f747183fa30ac5e9c80bb967e61a1\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Errors.sol\\\" as CastingErrors;\\nimport { MAX_UINT128, MAX_UINT40 } from \\\"../Common.sol\\\";\\nimport { uMAX_SD1x18 } from \\\"../sd1x18/Constants.sol\\\";\\nimport { SD1x18 } from \\\"../sd1x18/ValueType.sol\\\";\\nimport { uMAX_SD59x18 } from \\\"../sd59x18/Constants.sol\\\";\\nimport { SD59x18 } from \\\"../sd59x18/ValueType.sol\\\";\\nimport { uMAX_UD2x18 } from \\\"../ud2x18/Constants.sol\\\";\\nimport { UD2x18 } from \\\"../ud2x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts a UD60x18 number into SD1x18.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `uMAX_SD1x18`.\\nfunction intoSD1x18(UD60x18 x) pure returns (SD1x18 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > uint256(int256(uMAX_SD1x18))) {\\n revert CastingErrors.PRBMath_UD60x18_IntoSD1x18_Overflow(x);\\n }\\n result = SD1x18.wrap(int64(uint64(xUint)));\\n}\\n\\n/// @notice Casts a UD60x18 number into UD2x18.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `uMAX_UD2x18`.\\nfunction intoUD2x18(UD60x18 x) pure returns (UD2x18 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > uMAX_UD2x18) {\\n revert CastingErrors.PRBMath_UD60x18_IntoUD2x18_Overflow(x);\\n }\\n result = UD2x18.wrap(uint64(xUint));\\n}\\n\\n/// @notice Casts a UD60x18 number into SD59x18.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `uMAX_SD59x18`.\\nfunction intoSD59x18(UD60x18 x) pure returns (SD59x18 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > uint256(uMAX_SD59x18)) {\\n revert CastingErrors.PRBMath_UD60x18_IntoSD59x18_Overflow(x);\\n }\\n result = SD59x18.wrap(int256(xUint));\\n}\\n\\n/// @notice Casts a UD60x18 number into uint128.\\n/// @dev This is basically an alias for {unwrap}.\\nfunction intoUint256(UD60x18 x) pure returns (uint256 result) {\\n result = UD60x18.unwrap(x);\\n}\\n\\n/// @notice Casts a UD60x18 number into uint128.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UINT128`.\\nfunction intoUint128(UD60x18 x) pure returns (uint128 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > MAX_UINT128) {\\n revert CastingErrors.PRBMath_UD60x18_IntoUint128_Overflow(x);\\n }\\n result = uint128(xUint);\\n}\\n\\n/// @notice Casts a UD60x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(UD60x18 x) pure returns (uint40 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > MAX_UINT40) {\\n revert CastingErrors.PRBMath_UD60x18_IntoUint40_Overflow(x);\\n }\\n result = uint40(xUint);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction ud(uint256 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(x);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction ud60x18(uint256 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(x);\\n}\\n\\n/// @notice Unwraps a UD60x18 number into uint256.\\nfunction unwrap(UD60x18 x) pure returns (uint256 result) {\\n result = UD60x18.unwrap(x);\\n}\\n\\n/// @notice Wraps a uint256 number into the UD60x18 value type.\\nfunction wrap(uint256 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x5bb532da36921cbdac64d1f16de5d366ef1f664502e3b7c07d0ad06917551f85\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n// NOTICE: the \\\"u\\\" prefix stands for \\\"unwrapped\\\".\\n\\n/// @dev Euler's number as a UD60x18 number.\\nUD60x18 constant E = UD60x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum input permitted in {exp}.\\nuint256 constant uEXP_MAX_INPUT = 133_084258667509499440;\\nUD60x18 constant EXP_MAX_INPUT = UD60x18.wrap(uEXP_MAX_INPUT);\\n\\n/// @dev The maximum input permitted in {exp2}.\\nuint256 constant uEXP2_MAX_INPUT = 192e18 - 1;\\nUD60x18 constant EXP2_MAX_INPUT = UD60x18.wrap(uEXP2_MAX_INPUT);\\n\\n/// @dev Half the UNIT number.\\nuint256 constant uHALF_UNIT = 0.5e18;\\nUD60x18 constant HALF_UNIT = UD60x18.wrap(uHALF_UNIT);\\n\\n/// @dev $log_2(10)$ as a UD60x18 number.\\nuint256 constant uLOG2_10 = 3_321928094887362347;\\nUD60x18 constant LOG2_10 = UD60x18.wrap(uLOG2_10);\\n\\n/// @dev $log_2(e)$ as a UD60x18 number.\\nuint256 constant uLOG2_E = 1_442695040888963407;\\nUD60x18 constant LOG2_E = UD60x18.wrap(uLOG2_E);\\n\\n/// @dev The maximum value a UD60x18 number can have.\\nuint256 constant uMAX_UD60x18 = 115792089237316195423570985008687907853269984665640564039457_584007913129639935;\\nUD60x18 constant MAX_UD60x18 = UD60x18.wrap(uMAX_UD60x18);\\n\\n/// @dev The maximum whole value a UD60x18 number can have.\\nuint256 constant uMAX_WHOLE_UD60x18 = 115792089237316195423570985008687907853269984665640564039457_000000000000000000;\\nUD60x18 constant MAX_WHOLE_UD60x18 = UD60x18.wrap(uMAX_WHOLE_UD60x18);\\n\\n/// @dev PI as a UD60x18 number.\\nUD60x18 constant PI = UD60x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of UD60x18.\\nuint256 constant uUNIT = 1e18;\\nUD60x18 constant UNIT = UD60x18.wrap(uUNIT);\\n\\n/// @dev The unit number squared.\\nuint256 constant uUNIT_SQUARED = 1e36;\\nUD60x18 constant UNIT_SQUARED = UD60x18.wrap(uUNIT_SQUARED);\\n\\n/// @dev Zero as a UD60x18 number.\\nUD60x18 constant ZERO = UD60x18.wrap(0);\\n\",\"keccak256\":\"0x2b80d26153d3fdcfb3a9ca772d9309d31ed1275f5b8b54c3ffb54d3652b37d90\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Conversions.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { uMAX_UD60x18, uUNIT } from \\\"./Constants.sol\\\";\\nimport { PRBMath_UD60x18_Convert_Overflow } from \\\"./Errors.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Converts a UD60x18 number to a simple integer by dividing it by `UNIT`.\\n/// @dev The result is rounded toward zero.\\n/// @param x The UD60x18 number to convert.\\n/// @return result The same number in basic integer form.\\nfunction convert(UD60x18 x) pure returns (uint256 result) {\\n result = UD60x18.unwrap(x) / uUNIT;\\n}\\n\\n/// @notice Converts a simple integer to UD60x18 by multiplying it by `UNIT`.\\n///\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UD60x18 / UNIT`.\\n///\\n/// @param x The basic integer to convert.\\n/// @param result The same number converted to UD60x18.\\nfunction convert(uint256 x) pure returns (UD60x18 result) {\\n if (x > uMAX_UD60x18 / uUNIT) {\\n revert PRBMath_UD60x18_Convert_Overflow(x);\\n }\\n unchecked {\\n result = UD60x18.wrap(x * uUNIT);\\n }\\n}\\n\",\"keccak256\":\"0xaf7fc2523413822de3b66ba339fe2884fb3b8c6f6cf38ec90a2c3e3aae71df6b\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when ceiling a number overflows UD60x18.\\nerror PRBMath_UD60x18_Ceil_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when converting a basic integer to the fixed-point format overflows UD60x18.\\nerror PRBMath_UD60x18_Convert_Overflow(uint256 x);\\n\\n/// @notice Thrown when taking the natural exponent of a base greater than 133_084258667509499441.\\nerror PRBMath_UD60x18_Exp_InputTooBig(UD60x18 x);\\n\\n/// @notice Thrown when taking the binary exponent of a base greater than 192e18.\\nerror PRBMath_UD60x18_Exp2_InputTooBig(UD60x18 x);\\n\\n/// @notice Thrown when taking the geometric mean of two numbers and multiplying them overflows UD60x18.\\nerror PRBMath_UD60x18_Gm_Overflow(UD60x18 x, UD60x18 y);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\\nerror PRBMath_UD60x18_IntoSD1x18_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD59x18.\\nerror PRBMath_UD60x18_IntoSD59x18_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\\nerror PRBMath_UD60x18_IntoUD2x18_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\\nerror PRBMath_UD60x18_IntoUint128_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\\nerror PRBMath_UD60x18_IntoUint40_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when taking the logarithm of a number less than 1.\\nerror PRBMath_UD60x18_Log_InputTooSmall(UD60x18 x);\\n\\n/// @notice Thrown when calculating the square root overflows UD60x18.\\nerror PRBMath_UD60x18_Sqrt_Overflow(UD60x18 x);\\n\",\"keccak256\":\"0xa8c60d4066248df22c49c882873efbc017344107edabc48c52209abbc39cb1e3\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Helpers.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { wrap } from \\\"./Casting.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Implements the checked addition operation (+) in the UD60x18 type.\\nfunction add(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() + y.unwrap());\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the UD60x18 type.\\nfunction and(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() & bits);\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the UD60x18 type.\\nfunction and2(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() & y.unwrap());\\n}\\n\\n/// @notice Implements the equal operation (==) in the UD60x18 type.\\nfunction eq(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() == y.unwrap();\\n}\\n\\n/// @notice Implements the greater than operation (>) in the UD60x18 type.\\nfunction gt(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() > y.unwrap();\\n}\\n\\n/// @notice Implements the greater than or equal to operation (>=) in the UD60x18 type.\\nfunction gte(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() >= y.unwrap();\\n}\\n\\n/// @notice Implements a zero comparison check function in the UD60x18 type.\\nfunction isZero(UD60x18 x) pure returns (bool result) {\\n // This wouldn't work if x could be negative.\\n result = x.unwrap() == 0;\\n}\\n\\n/// @notice Implements the left shift operation (<<) in the UD60x18 type.\\nfunction lshift(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() << bits);\\n}\\n\\n/// @notice Implements the lower than operation (<) in the UD60x18 type.\\nfunction lt(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() < y.unwrap();\\n}\\n\\n/// @notice Implements the lower than or equal to operation (<=) in the UD60x18 type.\\nfunction lte(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() <= y.unwrap();\\n}\\n\\n/// @notice Implements the checked modulo operation (%) in the UD60x18 type.\\nfunction mod(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() % y.unwrap());\\n}\\n\\n/// @notice Implements the not equal operation (!=) in the UD60x18 type.\\nfunction neq(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() != y.unwrap();\\n}\\n\\n/// @notice Implements the NOT (~) bitwise operation in the UD60x18 type.\\nfunction not(UD60x18 x) pure returns (UD60x18 result) {\\n result = wrap(~x.unwrap());\\n}\\n\\n/// @notice Implements the OR (|) bitwise operation in the UD60x18 type.\\nfunction or(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() | y.unwrap());\\n}\\n\\n/// @notice Implements the right shift operation (>>) in the UD60x18 type.\\nfunction rshift(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() >> bits);\\n}\\n\\n/// @notice Implements the checked subtraction operation (-) in the UD60x18 type.\\nfunction sub(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() - y.unwrap());\\n}\\n\\n/// @notice Implements the unchecked addition operation (+) in the UD60x18 type.\\nfunction uncheckedAdd(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() + y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the unchecked subtraction operation (-) in the UD60x18 type.\\nfunction uncheckedSub(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() - y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the XOR (^) bitwise operation in the UD60x18 type.\\nfunction xor(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() ^ y.unwrap());\\n}\\n\",\"keccak256\":\"0xf5faff881391d2c060029499a666cc5f0bea90a213150bb476fae8f02a5df268\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as Errors;\\nimport { wrap } from \\\"./Casting.sol\\\";\\nimport {\\n uEXP_MAX_INPUT,\\n uEXP2_MAX_INPUT,\\n uHALF_UNIT,\\n uLOG2_10,\\n uLOG2_E,\\n uMAX_UD60x18,\\n uMAX_WHOLE_UD60x18,\\n UNIT,\\n uUNIT,\\n uUNIT_SQUARED,\\n ZERO\\n} from \\\"./Constants.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n MATHEMATICAL FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @notice Calculates the arithmetic average of x and y using the following formula:\\n///\\n/// $$\\n/// avg(x, y) = (x & y) + ((xUint ^ yUint) / 2)\\n/// $$\\n///\\n/// In English, this is what this formula does:\\n///\\n/// 1. AND x and y.\\n/// 2. Calculate half of XOR x and y.\\n/// 3. Add the two results together.\\n///\\n/// This technique is known as SWAR, which stands for \\\"SIMD within a register\\\". You can read more about it here:\\n/// https://devblogs.microsoft.com/oldnewthing/20220207-00/?p=106223\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// @param x The first operand as a UD60x18 number.\\n/// @param y The second operand as a UD60x18 number.\\n/// @return result The arithmetic average as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction avg(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n uint256 yUint = y.unwrap();\\n unchecked {\\n result = wrap((xUint & yUint) + ((xUint ^ yUint) >> 1));\\n }\\n}\\n\\n/// @notice Yields the smallest whole number greater than or equal to x.\\n///\\n/// @dev This is optimized for fractional value inputs, because for every whole value there are (1e18 - 1) fractional\\n/// counterparts. See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n///\\n/// Requirements:\\n/// - x must be less than or equal to `MAX_WHOLE_UD60x18`.\\n///\\n/// @param x The UD60x18 number to ceil.\\n/// @param result The smallest whole number greater than or equal to x, as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ceil(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n if (xUint > uMAX_WHOLE_UD60x18) {\\n revert Errors.PRBMath_UD60x18_Ceil_Overflow(x);\\n }\\n\\n assembly (\\\"memory-safe\\\") {\\n // Equivalent to `x % UNIT`.\\n let remainder := mod(x, uUNIT)\\n\\n // Equivalent to `UNIT - remainder`.\\n let delta := sub(uUNIT, remainder)\\n\\n // Equivalent to `x + remainder > 0 ? delta : 0`.\\n result := add(x, mul(delta, gt(remainder, 0)))\\n }\\n}\\n\\n/// @notice Divides two UD60x18 numbers, returning a new UD60x18 number.\\n///\\n/// @dev Uses {Common.mulDiv} to enable overflow-safe multiplication and division.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv}.\\n///\\n/// @param x The numerator as a UD60x18 number.\\n/// @param y The denominator as a UD60x18 number.\\n/// @param result The quotient as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction div(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(Common.mulDiv(x.unwrap(), uUNIT, y.unwrap()));\\n}\\n\\n/// @notice Calculates the natural exponent of x using the following formula:\\n///\\n/// $$\\n/// e^x = 2^{x * log_2{e}}\\n/// $$\\n///\\n/// @dev Requirements:\\n/// - x must be less than 133_084258667509499441.\\n///\\n/// @param x The exponent as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n // This check prevents values greater than 192e18 from being passed to {exp2}.\\n if (xUint > uEXP_MAX_INPUT) {\\n revert Errors.PRBMath_UD60x18_Exp_InputTooBig(x);\\n }\\n\\n unchecked {\\n // Inline the fixed-point multiplication to save gas.\\n uint256 doubleUnitProduct = xUint * uLOG2_E;\\n result = exp2(wrap(doubleUnitProduct / uUNIT));\\n }\\n}\\n\\n/// @notice Calculates the binary exponent of x using the binary fraction method.\\n///\\n/// @dev See https://ethereum.stackexchange.com/q/79903/24693\\n///\\n/// Requirements:\\n/// - x must be less than 192e18.\\n/// - The result must fit in UD60x18.\\n///\\n/// @param x The exponent as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp2(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n // Numbers greater than or equal to 192e18 don't fit in the 192.64-bit format.\\n if (xUint > uEXP2_MAX_INPUT) {\\n revert Errors.PRBMath_UD60x18_Exp2_InputTooBig(x);\\n }\\n\\n // Convert x to the 192.64-bit fixed-point format.\\n uint256 x_192x64 = (xUint << 64) / uUNIT;\\n\\n // Pass x to the {Common.exp2} function, which uses the 192.64-bit fixed-point number representation.\\n result = wrap(Common.exp2(x_192x64));\\n}\\n\\n/// @notice Yields the greatest whole number less than or equal to x.\\n/// @dev Optimized for fractional value inputs, because every whole value has (1e18 - 1) fractional counterparts.\\n/// See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n/// @param x The UD60x18 number to floor.\\n/// @param result The greatest whole number less than or equal to x, as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction floor(UD60x18 x) pure returns (UD60x18 result) {\\n assembly (\\\"memory-safe\\\") {\\n // Equivalent to `x % UNIT`.\\n let remainder := mod(x, uUNIT)\\n\\n // Equivalent to `x - remainder > 0 ? remainder : 0)`.\\n result := sub(x, mul(remainder, gt(remainder, 0)))\\n }\\n}\\n\\n/// @notice Yields the excess beyond the floor of x using the odd function definition.\\n/// @dev See https://en.wikipedia.org/wiki/Fractional_part.\\n/// @param x The UD60x18 number to get the fractional part of.\\n/// @param result The fractional part of x as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction frac(UD60x18 x) pure returns (UD60x18 result) {\\n assembly (\\\"memory-safe\\\") {\\n result := mod(x, uUNIT)\\n }\\n}\\n\\n/// @notice Calculates the geometric mean of x and y, i.e. $\\\\sqrt{x * y}$, rounding down.\\n///\\n/// @dev Requirements:\\n/// - x * y must fit in UD60x18.\\n///\\n/// @param x The first operand as a UD60x18 number.\\n/// @param y The second operand as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction gm(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n uint256 yUint = y.unwrap();\\n if (xUint == 0 || yUint == 0) {\\n return ZERO;\\n }\\n\\n unchecked {\\n // Checking for overflow this way is faster than letting Solidity do it.\\n uint256 xyUint = xUint * yUint;\\n if (xyUint / xUint != yUint) {\\n revert Errors.PRBMath_UD60x18_Gm_Overflow(x, y);\\n }\\n\\n // We don't need to multiply the result by `UNIT` here because the x*y product picked up a factor of `UNIT`\\n // during multiplication. See the comments in {Common.sqrt}.\\n result = wrap(Common.sqrt(xyUint));\\n }\\n}\\n\\n/// @notice Calculates the inverse of x.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x must not be zero.\\n///\\n/// @param x The UD60x18 number for which to calculate the inverse.\\n/// @return result The inverse as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction inv(UD60x18 x) pure returns (UD60x18 result) {\\n unchecked {\\n result = wrap(uUNIT_SQUARED / x.unwrap());\\n }\\n}\\n\\n/// @notice Calculates the natural logarithm of x using the following formula:\\n///\\n/// $$\\n/// ln{x} = log_2{x} / log_2{e}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n/// - The precision isn't sufficiently fine-grained to return exactly `UNIT` when the input is `E`.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The UD60x18 number for which to calculate the natural logarithm.\\n/// @return result The natural logarithm as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ln(UD60x18 x) pure returns (UD60x18 result) {\\n unchecked {\\n // Inline the fixed-point multiplication to save gas. This is overflow-safe because the maximum value that\\n // {log2} can return is ~196_205294292027477728.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_E);\\n }\\n}\\n\\n/// @notice Calculates the common logarithm of x using the following formula:\\n///\\n/// $$\\n/// log_{10}{x} = log_2{x} / log_2{10}\\n/// $$\\n///\\n/// However, if x is an exact power of ten, a hard coded value is returned.\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The UD60x18 number for which to calculate the common logarithm.\\n/// @return result The common logarithm as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log10(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n if (xUint < uUNIT) {\\n revert Errors.PRBMath_UD60x18_Log_InputTooSmall(x);\\n }\\n\\n // Note that the `mul` in this assembly block is the standard multiplication operation, not {UD60x18.mul}.\\n // prettier-ignore\\n assembly (\\\"memory-safe\\\") {\\n switch x\\n case 1 { result := mul(uUNIT, sub(0, 18)) }\\n case 10 { result := mul(uUNIT, sub(1, 18)) }\\n case 100 { result := mul(uUNIT, sub(2, 18)) }\\n case 1000 { result := mul(uUNIT, sub(3, 18)) }\\n case 10000 { result := mul(uUNIT, sub(4, 18)) }\\n case 100000 { result := mul(uUNIT, sub(5, 18)) }\\n case 1000000 { result := mul(uUNIT, sub(6, 18)) }\\n case 10000000 { result := mul(uUNIT, sub(7, 18)) }\\n case 100000000 { result := mul(uUNIT, sub(8, 18)) }\\n case 1000000000 { result := mul(uUNIT, sub(9, 18)) }\\n case 10000000000 { result := mul(uUNIT, sub(10, 18)) }\\n case 100000000000 { result := mul(uUNIT, sub(11, 18)) }\\n case 1000000000000 { result := mul(uUNIT, sub(12, 18)) }\\n case 10000000000000 { result := mul(uUNIT, sub(13, 18)) }\\n case 100000000000000 { result := mul(uUNIT, sub(14, 18)) }\\n case 1000000000000000 { result := mul(uUNIT, sub(15, 18)) }\\n case 10000000000000000 { result := mul(uUNIT, sub(16, 18)) }\\n case 100000000000000000 { result := mul(uUNIT, sub(17, 18)) }\\n case 1000000000000000000 { result := 0 }\\n case 10000000000000000000 { result := uUNIT }\\n case 100000000000000000000 { result := mul(uUNIT, 2) }\\n case 1000000000000000000000 { result := mul(uUNIT, 3) }\\n case 10000000000000000000000 { result := mul(uUNIT, 4) }\\n case 100000000000000000000000 { result := mul(uUNIT, 5) }\\n case 1000000000000000000000000 { result := mul(uUNIT, 6) }\\n case 10000000000000000000000000 { result := mul(uUNIT, 7) }\\n case 100000000000000000000000000 { result := mul(uUNIT, 8) }\\n case 1000000000000000000000000000 { result := mul(uUNIT, 9) }\\n case 10000000000000000000000000000 { result := mul(uUNIT, 10) }\\n case 100000000000000000000000000000 { result := mul(uUNIT, 11) }\\n case 1000000000000000000000000000000 { result := mul(uUNIT, 12) }\\n case 10000000000000000000000000000000 { result := mul(uUNIT, 13) }\\n case 100000000000000000000000000000000 { result := mul(uUNIT, 14) }\\n case 1000000000000000000000000000000000 { result := mul(uUNIT, 15) }\\n case 10000000000000000000000000000000000 { result := mul(uUNIT, 16) }\\n case 100000000000000000000000000000000000 { result := mul(uUNIT, 17) }\\n case 1000000000000000000000000000000000000 { result := mul(uUNIT, 18) }\\n case 10000000000000000000000000000000000000 { result := mul(uUNIT, 19) }\\n case 100000000000000000000000000000000000000 { result := mul(uUNIT, 20) }\\n case 1000000000000000000000000000000000000000 { result := mul(uUNIT, 21) }\\n case 10000000000000000000000000000000000000000 { result := mul(uUNIT, 22) }\\n case 100000000000000000000000000000000000000000 { result := mul(uUNIT, 23) }\\n case 1000000000000000000000000000000000000000000 { result := mul(uUNIT, 24) }\\n case 10000000000000000000000000000000000000000000 { result := mul(uUNIT, 25) }\\n case 100000000000000000000000000000000000000000000 { result := mul(uUNIT, 26) }\\n case 1000000000000000000000000000000000000000000000 { result := mul(uUNIT, 27) }\\n case 10000000000000000000000000000000000000000000000 { result := mul(uUNIT, 28) }\\n case 100000000000000000000000000000000000000000000000 { result := mul(uUNIT, 29) }\\n case 1000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 30) }\\n case 10000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 31) }\\n case 100000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 32) }\\n case 1000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 33) }\\n case 10000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 34) }\\n case 100000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 35) }\\n case 1000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 36) }\\n case 10000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 37) }\\n case 100000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 38) }\\n case 1000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 39) }\\n case 10000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 40) }\\n case 100000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 41) }\\n case 1000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 42) }\\n case 10000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 43) }\\n case 100000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 44) }\\n case 1000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 45) }\\n case 10000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 46) }\\n case 100000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 47) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 48) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 49) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 50) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 51) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 52) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 53) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 54) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 55) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 56) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 57) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 58) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 59) }\\n default { result := uMAX_UD60x18 }\\n }\\n\\n if (result.unwrap() == uMAX_UD60x18) {\\n unchecked {\\n // Inline the fixed-point division to save gas.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_10);\\n }\\n }\\n}\\n\\n/// @notice Calculates the binary logarithm of x using the iterative approximation algorithm:\\n///\\n/// $$\\n/// log_2{x} = n + log_2{y}, \\\\text{ where } y = x*2^{-n}, \\\\ y \\\\in [1, 2)\\n/// $$\\n///\\n/// For $0 \\\\leq x \\\\lt 1$, the input is inverted:\\n///\\n/// $$\\n/// log_2{x} = -log_2{\\\\frac{1}{x}}\\n/// $$\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Binary_logarithm#Iterative_approximation\\n///\\n/// Notes:\\n/// - Due to the lossy precision of the iterative approximation, the results are not perfectly accurate to the last decimal.\\n///\\n/// Requirements:\\n/// - x must be greater than zero.\\n///\\n/// @param x The UD60x18 number for which to calculate the binary logarithm.\\n/// @return result The binary logarithm as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log2(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n if (xUint < uUNIT) {\\n revert Errors.PRBMath_UD60x18_Log_InputTooSmall(x);\\n }\\n\\n unchecked {\\n // Calculate the integer part of the logarithm.\\n uint256 n = Common.msb(xUint / uUNIT);\\n\\n // This is the integer part of the logarithm as a UD60x18 number. The operation can't overflow because n\\n // n is at most 255 and UNIT is 1e18.\\n uint256 resultUint = n * uUNIT;\\n\\n // Calculate $y = x * 2^{-n}$.\\n uint256 y = xUint >> n;\\n\\n // If y is the unit number, the fractional part is zero.\\n if (y == uUNIT) {\\n return wrap(resultUint);\\n }\\n\\n // Calculate the fractional part via the iterative approximation.\\n // The `delta >>= 1` part is equivalent to `delta /= 2`, but shifting bits is more gas efficient.\\n uint256 DOUBLE_UNIT = 2e18;\\n for (uint256 delta = uHALF_UNIT; delta > 0; delta >>= 1) {\\n y = (y * y) / uUNIT;\\n\\n // Is y^2 >= 2e18 and so in the range [2e18, 4e18)?\\n if (y >= DOUBLE_UNIT) {\\n // Add the 2^{-m} factor to the logarithm.\\n resultUint += delta;\\n\\n // Halve y, which corresponds to z/2 in the Wikipedia article.\\n y >>= 1;\\n }\\n }\\n result = wrap(resultUint);\\n }\\n}\\n\\n/// @notice Multiplies two UD60x18 numbers together, returning a new UD60x18 number.\\n///\\n/// @dev Uses {Common.mulDiv} to enable overflow-safe multiplication and division.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv}.\\n///\\n/// @dev See the documentation in {Common.mulDiv18}.\\n/// @param x The multiplicand as a UD60x18 number.\\n/// @param y The multiplier as a UD60x18 number.\\n/// @return result The product as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mul(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(Common.mulDiv18(x.unwrap(), y.unwrap()));\\n}\\n\\n/// @notice Raises x to the power of y.\\n///\\n/// For $1 \\\\leq x \\\\leq \\\\infty$, the following standard formula is used:\\n///\\n/// $$\\n/// x^y = 2^{log_2{x} * y}\\n/// $$\\n///\\n/// For $0 \\\\leq x \\\\lt 1$, since the unsigned {log2} is undefined, an equivalent formula is used:\\n///\\n/// $$\\n/// i = \\\\frac{1}{x}\\n/// w = 2^{log_2{i} * y}\\n/// x^y = \\\\frac{1}{w}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2} and {mul}.\\n/// - Returns `UNIT` for 0^0.\\n/// - It may not perform well with very small values of x. Consider using SD59x18 as an alternative.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {exp2}, {log2}, and {mul}.\\n///\\n/// @param x The base as a UD60x18 number.\\n/// @param y The exponent as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction pow(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n uint256 yUint = y.unwrap();\\n\\n // If both x and y are zero, the result is `UNIT`. If just x is zero, the result is always zero.\\n if (xUint == 0) {\\n return yUint == 0 ? UNIT : ZERO;\\n }\\n // If x is `UNIT`, the result is always `UNIT`.\\n else if (xUint == uUNIT) {\\n return UNIT;\\n }\\n\\n // If y is zero, the result is always `UNIT`.\\n if (yUint == 0) {\\n return UNIT;\\n }\\n // If y is `UNIT`, the result is always x.\\n else if (yUint == uUNIT) {\\n return x;\\n }\\n\\n // If x is greater than `UNIT`, use the standard formula.\\n if (xUint > uUNIT) {\\n result = exp2(mul(log2(x), y));\\n }\\n // Conversely, if x is less than `UNIT`, use the equivalent formula.\\n else {\\n UD60x18 i = wrap(uUNIT_SQUARED / xUint);\\n UD60x18 w = exp2(mul(log2(i), y));\\n result = wrap(uUNIT_SQUARED / w.unwrap());\\n }\\n}\\n\\n/// @notice Raises x (a UD60x18 number) to the power y (an unsigned basic integer) using the well-known\\n/// algorithm \\\"exponentiation by squaring\\\".\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Exponentiation_by_squaring.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv18}.\\n/// - Returns `UNIT` for 0^0.\\n///\\n/// Requirements:\\n/// - The result must fit in UD60x18.\\n///\\n/// @param x The base as a UD60x18 number.\\n/// @param y The exponent as a uint256.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction powu(UD60x18 x, uint256 y) pure returns (UD60x18 result) {\\n // Calculate the first iteration of the loop in advance.\\n uint256 xUint = x.unwrap();\\n uint256 resultUint = y & 1 > 0 ? xUint : uUNIT;\\n\\n // Equivalent to `for(y /= 2; y > 0; y /= 2)`.\\n for (y >>= 1; y > 0; y >>= 1) {\\n xUint = Common.mulDiv18(xUint, xUint);\\n\\n // Equivalent to `y % 2 == 1`.\\n if (y & 1 > 0) {\\n resultUint = Common.mulDiv18(resultUint, xUint);\\n }\\n }\\n result = wrap(resultUint);\\n}\\n\\n/// @notice Calculates the square root of x using the Babylonian method.\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\\n///\\n/// Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x must be less than `MAX_UD60x18 / UNIT`.\\n///\\n/// @param x The UD60x18 number for which to calculate the square root.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction sqrt(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n unchecked {\\n if (xUint > uMAX_UD60x18 / uUNIT) {\\n revert Errors.PRBMath_UD60x18_Sqrt_Overflow(x);\\n }\\n // Multiply x by `UNIT` to account for the factor of `UNIT` picked up when multiplying two UD60x18 numbers.\\n // In this case, the two numbers are both the square root.\\n result = wrap(Common.sqrt(xUint * uUNIT));\\n }\\n}\\n\",\"keccak256\":\"0x462144667aac3f96d5f8dba7aa68fe4c5a3f61e1d7bbbc81bee21168817f9c09\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\nimport \\\"./Helpers.sol\\\" as Helpers;\\nimport \\\"./Math.sol\\\" as Math;\\n\\n/// @notice The unsigned 60.18-decimal fixed-point number representation, which can have up to 60 digits and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the Solidity type uint256.\\n/// @dev The value type is defined here so it can be imported in all other files.\\ntype UD60x18 is uint256;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoSD1x18,\\n Casting.intoUD2x18,\\n Casting.intoSD59x18,\\n Casting.intoUint128,\\n Casting.intoUint256,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for UD60x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n MATHEMATICAL FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes the functions in this library callable on the UD60x18 type.\\nusing {\\n Math.avg,\\n Math.ceil,\\n Math.div,\\n Math.exp,\\n Math.exp2,\\n Math.floor,\\n Math.frac,\\n Math.gm,\\n Math.inv,\\n Math.ln,\\n Math.log10,\\n Math.log2,\\n Math.mul,\\n Math.pow,\\n Math.powu,\\n Math.sqrt\\n} for UD60x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n HELPER FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes the functions in this library callable on the UD60x18 type.\\nusing {\\n Helpers.add,\\n Helpers.and,\\n Helpers.eq,\\n Helpers.gt,\\n Helpers.gte,\\n Helpers.isZero,\\n Helpers.lshift,\\n Helpers.lt,\\n Helpers.lte,\\n Helpers.mod,\\n Helpers.neq,\\n Helpers.not,\\n Helpers.or,\\n Helpers.rshift,\\n Helpers.sub,\\n Helpers.uncheckedAdd,\\n Helpers.uncheckedSub,\\n Helpers.xor\\n} for UD60x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n OPERATORS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes it possible to use these operators on the UD60x18 type.\\nusing {\\n Helpers.add as +,\\n Helpers.and2 as &,\\n Math.div as /,\\n Helpers.eq as ==,\\n Helpers.gt as >,\\n Helpers.gte as >=,\\n Helpers.lt as <,\\n Helpers.lte as <=,\\n Helpers.or as |,\\n Helpers.mod as %,\\n Math.mul as *,\\n Helpers.neq as !=,\\n Helpers.not as ~,\\n Helpers.sub as -,\\n Helpers.xor as ^\\n} for UD60x18 global;\\n\",\"keccak256\":\"0xdd873b5124180d9b71498b3a7fe93b1c08c368bec741f7d5f8e17f78a0b70f31\",\"license\":\"MIT\"},\"contracts/interfaces/IERC6551Registry.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\ninterface IERC6551Registry {\\n /**\\n * @dev Creates a token bound account for a non-fungible token.\\n *\\n * If account has already been created, returns the account address without calling create2.\\n *\\n * Emits ERC6551AccountCreated event.\\n *\\n * @return account The address of the token bound account\\n */\\n function createAccount(\\n address implementation,\\n bytes32 salt,\\n uint256 chainId,\\n address tokenContract,\\n uint256 tokenId\\n ) external returns (address account);\\n}\\n\",\"keccak256\":\"0x64c52de8a8e68398e61dd8b42dda8e9af8cf6abf93bb85629c322440991ea568\",\"license\":\"MIT\"},\"contracts/interfaces/hats/HatsErrors.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface HatsErrors {\\n /// @notice Emitted when `user` is attempting to perform an action on `hatId` but is not wearing one of `hatId`'s admin hats\\n /// @dev Can be equivalent to `NotHatWearer(buildHatId(hatId))`, such as when emitted by `approveLinkTopHatToTree` or `relinkTopHatToTree`\\n error NotAdmin(address user, uint256 hatId);\\n\\n /// @notice Emitted when attempting to perform an action as or for an account that is not a wearer of a given hat\\n error NotHatWearer();\\n\\n /// @notice Emitted when attempting to perform an action that requires being either an admin or wearer of a given hat\\n error NotAdminOrWearer();\\n\\n /// @notice Emitted when attempting to mint `hatId` but `hatId`'s maxSupply has been reached\\n error AllHatsWorn(uint256 hatId);\\n\\n /// @notice Emitted when attempting to create a hat with a level 14 hat as its admin\\n error MaxLevelsReached();\\n\\n /// @notice Emitted when an attempted hat id has empty intermediate level(s)\\n error InvalidHatId();\\n\\n /// @notice Emitted when attempting to mint `hatId` to a `wearer` who is already wearing the hat\\n error AlreadyWearingHat(address wearer, uint256 hatId);\\n\\n /// @notice Emitted when attempting to mint a non-existant hat\\n error HatDoesNotExist(uint256 hatId);\\n\\n /// @notice Emmitted when attempting to mint or transfer a hat that is not active\\n error HatNotActive();\\n\\n /// @notice Emitted when attempting to mint or transfer a hat to an ineligible wearer\\n error NotEligible();\\n\\n /// @notice Emitted when attempting to check or set a hat's status from an account that is not that hat's toggle module\\n error NotHatsToggle();\\n\\n /// @notice Emitted when attempting to check or set a hat wearer's status from an account that is not that hat's eligibility module\\n error NotHatsEligibility();\\n\\n /// @notice Emitted when array arguments to a batch function have mismatching lengths\\n error BatchArrayLengthMismatch();\\n\\n /// @notice Emitted when attempting to mutate or transfer an immutable hat\\n error Immutable();\\n\\n /// @notice Emitted when attempting to change a hat's maxSupply to a value lower than its current supply\\n error NewMaxSupplyTooLow();\\n\\n /// @notice Emitted when attempting to link a tophat to a new admin for which the tophat serves as an admin\\n error CircularLinkage();\\n\\n /// @notice Emitted when attempting to link or relink a tophat to a separate tree\\n error CrossTreeLinkage();\\n\\n /// @notice Emitted when attempting to link a tophat without a request\\n error LinkageNotRequested();\\n\\n /// @notice Emitted when attempting to unlink a tophat that does not have a wearer\\n /// @dev This ensures that unlinking never results in a bricked tophat\\n error InvalidUnlink();\\n\\n /// @notice Emmited when attempting to change a hat's eligibility or toggle module to the zero address\\n error ZeroAddress();\\n\\n /// @notice Emmitted when attempting to change a hat's details or imageURI to a string with over 7000 bytes (~characters)\\n /// @dev This protects against a DOS attack where an admin iteratively extend's a hat's details or imageURI\\n /// to be so long that reading it exceeds the block gas limit, breaking `uri()` and `viewHat()`\\n error StringTooLong();\\n}\\n\",\"keccak256\":\"0x81b0056b7bed86eabc07c0e4a9655c586ddb8e6c128320593669b76efd5a08de\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/HatsEvents.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface HatsEvents {\\n /// @notice Emitted when a new hat is created\\n /// @param id The id for the new hat\\n /// @param details A description of the Hat\\n /// @param maxSupply The total instances of the Hat that can be worn at once\\n /// @param eligibility The address that can report on the Hat wearer's status\\n /// @param toggle The address that can deactivate the Hat\\n /// @param mutable_ Whether the hat's properties are changeable after creation\\n /// @param imageURI The image uri for this hat and the fallback for its\\n event HatCreated(\\n uint256 id,\\n string details,\\n uint32 maxSupply,\\n address eligibility,\\n address toggle,\\n bool mutable_,\\n string imageURI\\n );\\n\\n /// @notice Emitted when a hat wearer's standing is updated\\n /// @dev Eligibility is excluded since the source of truth for eligibility is the eligibility module and may change without a transaction\\n /// @param hatId The id of the wearer's hat\\n /// @param wearer The wearer's address\\n /// @param wearerStanding Whether the wearer is in good standing for the hat\\n event WearerStandingChanged(\\n uint256 hatId,\\n address wearer,\\n bool wearerStanding\\n );\\n\\n /// @notice Emitted when a hat's status is updated\\n /// @param hatId The id of the hat\\n /// @param newStatus Whether the hat is active\\n event HatStatusChanged(uint256 hatId, bool newStatus);\\n\\n /// @notice Emitted when a hat's details are updated\\n /// @param hatId The id of the hat\\n /// @param newDetails The updated details\\n event HatDetailsChanged(uint256 hatId, string newDetails);\\n\\n /// @notice Emitted when a hat's eligibility module is updated\\n /// @param hatId The id of the hat\\n /// @param newEligibility The updated eligibiliy module\\n event HatEligibilityChanged(uint256 hatId, address newEligibility);\\n\\n /// @notice Emitted when a hat's toggle module is updated\\n /// @param hatId The id of the hat\\n /// @param newToggle The updated toggle module\\n event HatToggleChanged(uint256 hatId, address newToggle);\\n\\n /// @notice Emitted when a hat's mutability is updated\\n /// @param hatId The id of the hat\\n event HatMutabilityChanged(uint256 hatId);\\n\\n /// @notice Emitted when a hat's maximum supply is updated\\n /// @param hatId The id of the hat\\n /// @param newMaxSupply The updated max supply\\n event HatMaxSupplyChanged(uint256 hatId, uint32 newMaxSupply);\\n\\n /// @notice Emitted when a hat's image URI is updated\\n /// @param hatId The id of the hat\\n /// @param newImageURI The updated image URI\\n event HatImageURIChanged(uint256 hatId, string newImageURI);\\n\\n /// @notice Emitted when a tophat linkage is requested by its admin\\n /// @param domain The domain of the tree tophat to link\\n /// @param newAdmin The tophat's would-be admin in the parent tree\\n event TopHatLinkRequested(uint32 domain, uint256 newAdmin);\\n\\n /// @notice Emitted when a tophat is linked to a another tree\\n /// @param domain The domain of the newly-linked tophat\\n /// @param newAdmin The tophat's new admin in the parent tree\\n event TopHatLinked(uint32 domain, uint256 newAdmin);\\n}\\n\",\"keccak256\":\"0x53413397d15e1636c3cd7bd667656b79bc2886785403b824bcd4ed122667f2c6\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/IHats.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\nimport \\\"./IHatsIdUtilities.sol\\\";\\nimport \\\"./HatsErrors.sol\\\";\\nimport \\\"./HatsEvents.sol\\\";\\n\\ninterface IHats is IHatsIdUtilities, HatsErrors, HatsEvents {\\n function mintTopHat(\\n address _target,\\n string memory _details,\\n string memory _imageURI\\n ) external returns (uint256 topHatId);\\n\\n function createHat(\\n uint256 _admin,\\n string calldata _details,\\n uint32 _maxSupply,\\n address _eligibility,\\n address _toggle,\\n bool _mutable,\\n string calldata _imageURI\\n ) external returns (uint256 newHatId);\\n\\n function batchCreateHats(\\n uint256[] calldata _admins,\\n string[] calldata _details,\\n uint32[] calldata _maxSupplies,\\n address[] memory _eligibilityModules,\\n address[] memory _toggleModules,\\n bool[] calldata _mutables,\\n string[] calldata _imageURIs\\n ) external returns (bool success);\\n\\n function getNextId(uint256 _admin) external view returns (uint256 nextId);\\n\\n function mintHat(\\n uint256 _hatId,\\n address _wearer\\n ) external returns (bool success);\\n\\n function batchMintHats(\\n uint256[] calldata _hatIds,\\n address[] calldata _wearers\\n ) external returns (bool success);\\n\\n function setHatStatus(\\n uint256 _hatId,\\n bool _newStatus\\n ) external returns (bool toggled);\\n\\n function checkHatStatus(uint256 _hatId) external returns (bool toggled);\\n\\n function setHatWearerStatus(\\n uint256 _hatId,\\n address _wearer,\\n bool _eligible,\\n bool _standing\\n ) external returns (bool updated);\\n\\n function checkHatWearerStatus(\\n uint256 _hatId,\\n address _wearer\\n ) external returns (bool updated);\\n\\n function renounceHat(uint256 _hatId) external;\\n\\n function transferHat(uint256 _hatId, address _from, address _to) external;\\n\\n /*//////////////////////////////////////////////////////////////\\n HATS ADMIN FUNCTIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n function makeHatImmutable(uint256 _hatId) external;\\n\\n function changeHatDetails(\\n uint256 _hatId,\\n string memory _newDetails\\n ) external;\\n\\n function changeHatEligibility(\\n uint256 _hatId,\\n address _newEligibility\\n ) external;\\n\\n function changeHatToggle(uint256 _hatId, address _newToggle) external;\\n\\n function changeHatImageURI(\\n uint256 _hatId,\\n string memory _newImageURI\\n ) external;\\n\\n function changeHatMaxSupply(uint256 _hatId, uint32 _newMaxSupply) external;\\n\\n function requestLinkTopHatToTree(\\n uint32 _topHatId,\\n uint256 _newAdminHat\\n ) external;\\n\\n function approveLinkTopHatToTree(\\n uint32 _topHatId,\\n uint256 _newAdminHat,\\n address _eligibility,\\n address _toggle,\\n string calldata _details,\\n string calldata _imageURI\\n ) external;\\n\\n function unlinkTopHatFromTree(uint32 _topHatId, address _wearer) external;\\n\\n function relinkTopHatWithinTree(\\n uint32 _topHatDomain,\\n uint256 _newAdminHat,\\n address _eligibility,\\n address _toggle,\\n string calldata _details,\\n string calldata _imageURI\\n ) external;\\n\\n /*//////////////////////////////////////////////////////////////\\n VIEW FUNCTIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n function viewHat(\\n uint256 _hatId\\n )\\n external\\n view\\n returns (\\n string memory details,\\n uint32 maxSupply,\\n uint32 supply,\\n address eligibility,\\n address toggle,\\n string memory imageURI,\\n uint16 lastHatId,\\n bool mutable_,\\n bool active\\n );\\n\\n function isWearerOfHat(\\n address _user,\\n uint256 _hatId\\n ) external view returns (bool isWearer);\\n\\n function isAdminOfHat(\\n address _user,\\n uint256 _hatId\\n ) external view returns (bool isAdmin);\\n\\n function isInGoodStanding(\\n address _wearer,\\n uint256 _hatId\\n ) external view returns (bool standing);\\n\\n function isEligible(\\n address _wearer,\\n uint256 _hatId\\n ) external view returns (bool eligible);\\n\\n function getHatEligibilityModule(\\n uint256 _hatId\\n ) external view returns (address eligibility);\\n\\n function getHatToggleModule(\\n uint256 _hatId\\n ) external view returns (address toggle);\\n\\n function getHatMaxSupply(\\n uint256 _hatId\\n ) external view returns (uint32 maxSupply);\\n\\n function hatSupply(uint256 _hatId) external view returns (uint32 supply);\\n\\n function getImageURIForHat(\\n uint256 _hatId\\n ) external view returns (string memory _uri);\\n\\n function balanceOf(\\n address wearer,\\n uint256 hatId\\n ) external view returns (uint256 balance);\\n\\n function balanceOfBatch(\\n address[] calldata _wearers,\\n uint256[] calldata _hatIds\\n ) external view returns (uint256[] memory);\\n\\n function uri(uint256 id) external view returns (string memory _uri);\\n}\\n\",\"keccak256\":\"0x2867004bddc5148fa1937f25c0403e5d9977583aaf50fdbdb74bd463f64f21c8\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/IHatsIdUtilities.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface IHatsIdUtilities {\\n function buildHatId(\\n uint256 _admin,\\n uint16 _newHat\\n ) external pure returns (uint256 id);\\n\\n function getHatLevel(uint256 _hatId) external view returns (uint32 level);\\n\\n function getLocalHatLevel(\\n uint256 _hatId\\n ) external pure returns (uint32 level);\\n\\n function isTopHat(uint256 _hatId) external view returns (bool _topHat);\\n\\n function isLocalTopHat(\\n uint256 _hatId\\n ) external pure returns (bool _localTopHat);\\n\\n function isValidHatId(\\n uint256 _hatId\\n ) external view returns (bool validHatId);\\n\\n function getAdminAtLevel(\\n uint256 _hatId,\\n uint32 _level\\n ) external view returns (uint256 admin);\\n\\n function getAdminAtLocalLevel(\\n uint256 _hatId,\\n uint32 _level\\n ) external pure returns (uint256 admin);\\n\\n function getTopHatDomain(\\n uint256 _hatId\\n ) external view returns (uint32 domain);\\n\\n function getTippyTopHatDomain(\\n uint32 _topHatDomain\\n ) external view returns (uint32 domain);\\n\\n function noCircularLinkage(\\n uint32 _topHatDomain,\\n uint256 _linkedAdmin\\n ) external view returns (bool notCircular);\\n\\n function sameTippyTopHatDomain(\\n uint32 _topHatDomain,\\n uint256 _newAdminHat\\n ) external view returns (bool sameDomain);\\n}\\n\",\"keccak256\":\"0x007fcc07b20bf84bacad1f9a2ddf4e30e1a8be961e144b7bef8e98a51781aee9\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/IHatsModuleFactory.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.19;\\n\\ninterface IHatsModuleFactory {\\n error HatsModuleFactory_ModuleAlreadyDeployed(\\n address implementation,\\n uint256 hatId,\\n bytes otherImmutableArgs,\\n uint256 saltNonce\\n );\\n\\n error BatchArrayLengthMismatch();\\n\\n event HatsModuleFactory_ModuleDeployed(\\n address implementation,\\n address instance,\\n uint256 hatId,\\n bytes otherImmutableArgs,\\n bytes initData,\\n uint256 saltNonce\\n );\\n\\n function HATS() external view returns (address);\\n\\n function version() external view returns (string memory);\\n\\n function createHatsModule(\\n address _implementation,\\n uint256 _hatId,\\n bytes calldata _otherImmutableArgs,\\n bytes calldata _initData,\\n uint256 _saltNonce\\n ) external returns (address _instance);\\n\\n function batchCreateHatsModule(\\n address[] calldata _implementations,\\n uint256[] calldata _hatIds,\\n bytes[] calldata _otherImmutableArgsArray,\\n bytes[] calldata _initDataArray,\\n uint256[] calldata _saltNonces\\n ) external returns (bool success);\\n\\n function getHatsModuleAddress(\\n address _implementation,\\n uint256 _hatId,\\n bytes calldata _otherImmutableArgs,\\n uint256 _saltNonce\\n ) external view returns (address);\\n\\n function deployed(\\n address _implementation,\\n uint256 _hatId,\\n bytes calldata _otherImmutableArgs,\\n uint256 _saltNonce\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x861faf40785cedb829243116d492653414a367853408a5c27d201522f6c3bfdd\",\"license\":\"MIT\"},\"contracts/interfaces/hats/modules/IHatsElectionsEligibility.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.13;\\n\\ninterface IHatsElectionsEligibility {\\n event ElectionOpened(uint128 nextTermEnd);\\n event ElectionCompleted(uint128 termEnd, address[] winners);\\n event NewTermStarted(uint128 termEnd);\\n event Recalled(uint128 termEnd, address[] accounts);\\n\\n /// @notice Returns the first second after the current term ends.\\n /// @dev Also serves as the id for the current term.\\n function currentTermEnd() external view returns (uint128);\\n\\n /// @notice Returns the first second after the next term ends.\\n /// @dev Also serves as the id for the next term.\\n function nextTermEnd() external view returns (uint128);\\n\\n /// @notice Returns the election status (open or closed) for a given term end.\\n /// @param termEnd The term end timestamp to query.\\n function electionStatus(\\n uint128 termEnd\\n ) external view returns (bool isElectionOpen);\\n\\n /// @notice Returns whether a candidate was elected in a given term.\\n /// @param termEnd The term end timestamp to query.\\n /// @param candidate The address of the candidate.\\n function electionResults(\\n uint128 termEnd,\\n address candidate\\n ) external view returns (bool elected);\\n\\n /// @notice Returns the BALLOT_BOX_HAT constant.\\n function BALLOT_BOX_HAT() external pure returns (uint256);\\n\\n /// @notice Returns the ADMIN_HAT constant.\\n function ADMIN_HAT() external pure returns (uint256);\\n\\n /**\\n * @notice Submit the results of an election for a specified term.\\n * @dev Only callable by the wearer(s) of the BALLOT_BOX_HAT.\\n * @param _termEnd The id of the term for which the election results are being submitted.\\n * @param _winners The addresses of the winners of the election.\\n */\\n function elect(uint128 _termEnd, address[] calldata _winners) external;\\n\\n /**\\n * @notice Submit the results of a recall election for a specified term.\\n * @dev Only callable by the wearer(s) of the BALLOT_BOX_HAT.\\n * @param _termEnd The id of the term for which the recall results are being submitted.\\n * @param _recallees The addresses to be recalled.\\n */\\n function recall(uint128 _termEnd, address[] calldata _recallees) external;\\n\\n /**\\n * @notice Set the next term and open the election for it.\\n * @dev Only callable by the wearer(s) of the ADMIN_HAT.\\n * @param _newTermEnd The id of the term that will be opened.\\n */\\n function setNextTerm(uint128 _newTermEnd) external;\\n\\n /**\\n * @notice Start the next term, updating the current term.\\n * @dev Can be called by anyone, but will revert if conditions are not met.\\n */\\n function startNextTerm() external;\\n\\n /**\\n * @notice Determine the eligibility and standing of a wearer for a hat.\\n * @param _wearer The address of the hat wearer.\\n * @param _hatId The ID of the hat.\\n * @return eligible True if the wearer is eligible for the hat.\\n * @return standing True if the wearer is in good standing.\\n */\\n function getWearerStatus(\\n address _wearer,\\n uint256 _hatId\\n ) external view returns (bool eligible, bool standing);\\n}\\n\",\"keccak256\":\"0x74dfc5d538d866ddb8ee2ca1b569abf62e02d848c59f308adf6075ecff175c7d\",\"license\":\"MIT\"},\"contracts/interfaces/sablier/IAdminable.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\n/// @title IAdminable\\n/// @notice Contract module that provides a basic access control mechanism, with an admin that can be\\n/// granted exclusive access to specific functions. The inheriting contract must set the initial admin\\n/// in the constructor.\\ninterface IAdminable {\\n /*//////////////////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Emitted when the admin is transferred.\\n /// @param oldAdmin The address of the old admin.\\n /// @param newAdmin The address of the new admin.\\n event TransferAdmin(address indexed oldAdmin, address indexed newAdmin);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice The address of the admin account or contract.\\n function admin() external view returns (address);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n NON-CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Transfers the contract admin to a new address.\\n ///\\n /// @dev Notes:\\n /// - Does not revert if the admin is the same.\\n /// - This function can potentially leave the contract without an admin, thereby removing any\\n /// functionality that is only available to the admin.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the contract admin.\\n ///\\n /// @param newAdmin The address of the new admin.\\n function transferAdmin(address newAdmin) external;\\n}\\n\",\"keccak256\":\"0xa279c49e51228b571329164e36250e82b2c1378e8b549194ab7dd90fca9c3b2b\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/IERC4096.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 \\\"@openzeppelin/contracts/interfaces/IERC165.sol\\\";\\nimport {IERC721} from \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\n\\n/// @title ERC-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\",\"keccak256\":\"0xa34b9c52cbe36be860244f52256f1b05badf0cb797d208664b87337610d0e82d\",\"license\":\"MIT\"},\"contracts/interfaces/sablier/ISablierV2Lockup.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC4906} from \\\"./IERC4096.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IERC721Metadata} from \\\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\\\";\\nimport {UD60x18} from \\\"@prb/math/src/UD60x18.sol\\\";\\n\\nimport {Lockup} from \\\"./types/DataTypes.sol\\\";\\nimport {IAdminable} from \\\"./IAdminable.sol\\\";\\nimport {ISablierV2NFTDescriptor} from \\\"./ISablierV2NFTDescriptor.sol\\\";\\n\\n/// @title ISablierV2Lockup\\n/// @notice Common logic between all Sablier V2 Lockup contracts.\\ninterface ISablierV2Lockup is\\n IAdminable, // 0 inherited components\\n IERC4906, // 2 inherited components\\n IERC721Metadata // 2 inherited components\\n{\\n /*//////////////////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Emitted when the admin allows a new recipient contract to hook to Sablier.\\n /// @param admin The address of the current contract admin.\\n /// @param recipient The address of the recipient contract put on the allowlist.\\n event AllowToHook(address indexed admin, address recipient);\\n\\n /// @notice Emitted when a stream is canceled.\\n /// @param streamId The ID of the stream.\\n /// @param sender The address of the stream's sender.\\n /// @param recipient The address of the stream's recipient.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param senderAmount The amount of assets refunded to the stream's sender, denoted in units of the asset's\\n /// decimals.\\n /// @param recipientAmount The amount of assets left for the stream's recipient to withdraw, denoted in units of the\\n /// asset's decimals.\\n event CancelLockupStream(\\n uint256 streamId,\\n address indexed sender,\\n address indexed recipient,\\n IERC20 indexed asset,\\n uint128 senderAmount,\\n uint128 recipientAmount\\n );\\n\\n /// @notice Emitted when a sender gives up the right to cancel a stream.\\n /// @param streamId The ID of the stream.\\n event RenounceLockupStream(uint256 indexed streamId);\\n\\n /// @notice Emitted when the admin sets a new NFT descriptor contract.\\n /// @param admin The address of the current contract admin.\\n /// @param oldNFTDescriptor The address of the old NFT descriptor contract.\\n /// @param newNFTDescriptor The address of the new NFT descriptor contract.\\n event SetNFTDescriptor(\\n address indexed admin,\\n ISablierV2NFTDescriptor oldNFTDescriptor,\\n ISablierV2NFTDescriptor newNFTDescriptor\\n );\\n\\n /// @notice Emitted when assets are withdrawn from a stream.\\n /// @param streamId The ID of the stream.\\n /// @param to The address that has received the withdrawn assets.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param amount The amount of assets withdrawn, denoted in units of the asset's decimals.\\n event WithdrawFromLockupStream(\\n uint256 indexed streamId,\\n address indexed to,\\n IERC20 indexed asset,\\n uint128 amount\\n );\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Retrieves the address of the ERC-20 asset to be distributed.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getAsset(uint256 streamId) external view returns (IERC20 asset);\\n\\n /// @notice Retrieves the amount deposited in the stream, denoted in units of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getDepositedAmount(\\n uint256 streamId\\n ) external view returns (uint128 depositedAmount);\\n\\n /// @notice Retrieves the stream's end time, which is a Unix timestamp.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getEndTime(\\n uint256 streamId\\n ) external view returns (uint40 endTime);\\n\\n /// @notice Retrieves the stream's recipient.\\n /// @dev Reverts if the NFT has been burned.\\n /// @param streamId The stream ID for the query.\\n function getRecipient(\\n uint256 streamId\\n ) external view returns (address recipient);\\n\\n /// @notice Retrieves the amount refunded to the sender after a cancellation, denoted in units of the asset's\\n /// decimals. This amount is always zero unless the stream was canceled.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getRefundedAmount(\\n uint256 streamId\\n ) external view returns (uint128 refundedAmount);\\n\\n /// @notice Retrieves the stream's sender.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getSender(uint256 streamId) external view returns (address sender);\\n\\n /// @notice Retrieves the stream's start time, which is a Unix timestamp.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getStartTime(\\n uint256 streamId\\n ) external view returns (uint40 startTime);\\n\\n /// @notice Retrieves the amount withdrawn from the stream, denoted in units of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getWithdrawnAmount(\\n uint256 streamId\\n ) external view returns (uint128 withdrawnAmount);\\n\\n /// @notice Retrieves a flag indicating whether the provided address is a contract allowed to hook to Sablier\\n /// when a stream is canceled or when assets are withdrawn.\\n /// @dev See {ISablierLockupRecipient} for more information.\\n function isAllowedToHook(\\n address recipient\\n ) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream can be canceled. When the stream is cold, this\\n /// flag is always `false`.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isCancelable(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream is cold, i.e. settled, canceled, or depleted.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isCold(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream is depleted.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isDepleted(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream exists.\\n /// @dev Does not revert if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isStream(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream NFT can be transferred.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isTransferable(\\n uint256 streamId\\n ) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream is warm, i.e. either pending or streaming.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isWarm(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves the maximum broker fee that can be charged by the broker, denoted as a fixed-point\\n /// number where 1e18 is 100%.\\n /// @dev This value is hard coded as a constant.\\n function MAX_BROKER_FEE() external view returns (UD60x18);\\n\\n /// @notice Counter for stream IDs, used in the create functions.\\n function nextStreamId() external view returns (uint256);\\n\\n /// @notice Contract that generates the non-fungible token URI.\\n function nftDescriptor() external view returns (ISablierV2NFTDescriptor);\\n\\n /// @notice Calculates the amount that the sender would be refunded if the stream were canceled, denoted in units\\n /// of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function refundableAmountOf(\\n uint256 streamId\\n ) external view returns (uint128 refundableAmount);\\n\\n /// @notice Retrieves the stream's status.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function statusOf(\\n uint256 streamId\\n ) external view returns (Lockup.Status status);\\n\\n /// @notice Calculates the amount streamed to the recipient, denoted in units of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n ///\\n /// Notes:\\n /// - Upon cancellation of the stream, the amount streamed is calculated as the difference between the deposited\\n /// amount and the refunded amount. Ultimately, when the stream becomes depleted, the streamed amount is equivalent\\n /// to the total amount withdrawn.\\n ///\\n /// @param streamId The stream ID for the query.\\n function streamedAmountOf(\\n uint256 streamId\\n ) external view returns (uint128 streamedAmount);\\n\\n /// @notice Retrieves a flag indicating whether the stream was canceled.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function wasCanceled(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Calculates the amount that the recipient can withdraw from the stream, denoted in units of the asset's\\n /// decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function withdrawableAmountOf(\\n uint256 streamId\\n ) external view returns (uint128 withdrawableAmount);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n NON-CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Allows a recipient contract to hook to Sablier when a stream is canceled or when assets are withdrawn.\\n /// Useful for implementing contracts that hold streams on behalf of users, such as vaults or staking contracts.\\n ///\\n /// @dev Emits an {AllowToHook} event.\\n ///\\n /// Notes:\\n /// - Does not revert if the contract is already on the allowlist.\\n /// - This is an irreversible operation. The contract cannot be removed from the allowlist.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the contract admin.\\n /// - `recipient` must have a non-zero code size.\\n /// - `recipient` must implement {ISablierLockupRecipient}.\\n ///\\n /// @param recipient The address of the contract to allow for hooks.\\n function allowToHook(address recipient) external;\\n\\n /// @notice Burns the NFT associated with the stream.\\n ///\\n /// @dev Emits a {Transfer} event.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `streamId` must reference a depleted stream.\\n /// - The NFT must exist.\\n /// - `msg.sender` must be either the NFT owner or an approved third party.\\n ///\\n /// @param streamId The ID of the stream NFT to burn.\\n function burn(uint256 streamId) external;\\n\\n /// @notice Cancels the stream and refunds any remaining assets to the sender.\\n ///\\n /// @dev Emits a {Transfer}, {CancelLockupStream}, and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - If there any assets left for the recipient to withdraw, the stream is marked as canceled. Otherwise, the\\n /// stream is marked as depleted.\\n /// - This function attempts to invoke a hook on the recipient, if the resolved address is a contract.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - The stream must be warm and cancelable.\\n /// - `msg.sender` must be the stream's sender.\\n ///\\n /// @param streamId The ID of the stream to cancel.\\n function cancel(uint256 streamId) external;\\n\\n /// @notice Cancels multiple streams and refunds any remaining assets to the sender.\\n ///\\n /// @dev Emits multiple {Transfer}, {CancelLockupStream}, and {MetadataUpdate} events.\\n ///\\n /// Notes:\\n /// - Refer to the notes in {cancel}.\\n ///\\n /// Requirements:\\n /// - All requirements from {cancel} must be met for each stream.\\n ///\\n /// @param streamIds The IDs of the streams to cancel.\\n function cancelMultiple(uint256[] calldata streamIds) external;\\n\\n /// @notice Removes the right of the stream's sender to cancel the stream.\\n ///\\n /// @dev Emits a {RenounceLockupStream} and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - This is an irreversible operation.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `streamId` must reference a warm stream.\\n /// - `msg.sender` must be the stream's sender.\\n /// - The stream must be cancelable.\\n ///\\n /// @param streamId The ID of the stream to renounce.\\n function renounce(uint256 streamId) external;\\n\\n /// @notice Sets a new NFT descriptor contract, which produces the URI describing the Sablier stream NFTs.\\n ///\\n /// @dev Emits a {SetNFTDescriptor} and {BatchMetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - Does not revert if the NFT descriptor is the same.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the contract admin.\\n ///\\n /// @param newNFTDescriptor The address of the new NFT descriptor contract.\\n function setNFTDescriptor(\\n ISablierV2NFTDescriptor newNFTDescriptor\\n ) external;\\n\\n /// @notice Withdraws the provided amount of assets from the stream to the `to` address.\\n ///\\n /// @dev Emits a {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - This function attempts to call a hook on the recipient of the stream, unless `msg.sender` is the recipient.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `streamId` must not reference a null or depleted stream.\\n /// - `to` must not be the zero address.\\n /// - `amount` must be greater than zero and must not exceed the withdrawable amount.\\n /// - `to` must be the recipient if `msg.sender` is not the stream's recipient or an approved third party.\\n ///\\n /// @param streamId The ID of the stream to withdraw from.\\n /// @param to The address receiving the withdrawn assets.\\n /// @param amount The amount to withdraw, denoted in units of the asset's decimals.\\n function withdraw(uint256 streamId, address to, uint128 amount) external;\\n\\n /// @notice Withdraws the maximum withdrawable amount from the stream to the provided address `to`.\\n ///\\n /// @dev Emits a {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - Refer to the notes in {withdraw}.\\n ///\\n /// Requirements:\\n /// - Refer to the requirements in {withdraw}.\\n ///\\n /// @param streamId The ID of the stream to withdraw from.\\n /// @param to The address receiving the withdrawn assets.\\n /// @return withdrawnAmount The amount withdrawn, denoted in units of the asset's decimals.\\n function withdrawMax(\\n uint256 streamId,\\n address to\\n ) external returns (uint128 withdrawnAmount);\\n\\n /// @notice Withdraws the maximum withdrawable amount from the stream to the current recipient, and transfers the\\n /// NFT to `newRecipient`.\\n ///\\n /// @dev Emits a {WithdrawFromLockupStream} and a {Transfer} event.\\n ///\\n /// Notes:\\n /// - If the withdrawable amount is zero, the withdrawal is skipped.\\n /// - Refer to the notes in {withdraw}.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the stream's recipient.\\n /// - Refer to the requirements in {withdraw}.\\n /// - Refer to the requirements in {IERC721.transferFrom}.\\n ///\\n /// @param streamId The ID of the stream NFT to transfer.\\n /// @param newRecipient The address of the new owner of the stream NFT.\\n /// @return withdrawnAmount The amount withdrawn, denoted in units of the asset's decimals.\\n function withdrawMaxAndTransfer(\\n uint256 streamId,\\n address newRecipient\\n ) external returns (uint128 withdrawnAmount);\\n\\n /// @notice Withdraws assets from streams to the recipient of each stream.\\n ///\\n /// @dev Emits multiple {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} events.\\n ///\\n /// Notes:\\n /// - This function attempts to call a hook on the recipient of each stream, unless `msg.sender` is the recipient.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - There must be an equal number of `streamIds` and `amounts`.\\n /// - Each stream ID in the array must not reference a null or depleted stream.\\n /// - Each amount in the array must be greater than zero and must not exceed the withdrawable amount.\\n ///\\n /// @param streamIds The IDs of the streams to withdraw from.\\n /// @param amounts The amounts to withdraw, denoted in units of the asset's decimals.\\n function withdrawMultiple(\\n uint256[] calldata streamIds,\\n uint128[] calldata amounts\\n ) external;\\n}\\n\",\"keccak256\":\"0x3e5541c38a901637bd310965deb5bbde73ef07fe4ee3c752cbec330c6b9d62a3\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/ISablierV2LockupLinear.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\nimport {Lockup, LockupLinear} from \\\"./types/DataTypes.sol\\\";\\nimport {ISablierV2Lockup} from \\\"./ISablierV2Lockup.sol\\\";\\n\\n/// @title ISablierV2LockupLinear\\n/// @notice Creates and manages Lockup streams with a linear distribution function.\\ninterface ISablierV2LockupLinear is ISablierV2Lockup {\\n /*//////////////////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Emitted when a stream is created.\\n /// @param streamId The ID of the newly created stream.\\n /// @param funder The address which funded the stream.\\n /// @param sender The address distributing the assets, which will have the ability to cancel the stream.\\n /// @param recipient The address receiving the assets.\\n /// @param amounts Struct encapsulating (i) the deposit amount, and (ii) the broker fee amount, both denoted\\n /// in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Boolean indicating whether the stream will be cancelable or not.\\n /// @param transferable Boolean indicating whether the stream NFT is transferable or not.\\n /// @param timestamps Struct encapsulating (i) the stream's start time, (ii) cliff time, and (iii) end time, all as\\n /// Unix timestamps.\\n /// @param broker The address of the broker who has helped create the stream, e.g. a front-end website.\\n event CreateLockupLinearStream(\\n uint256 streamId,\\n address funder,\\n address indexed sender,\\n address indexed recipient,\\n Lockup.CreateAmounts amounts,\\n IERC20 indexed asset,\\n bool cancelable,\\n bool transferable,\\n LockupLinear.Timestamps timestamps,\\n address broker\\n );\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Retrieves the stream's cliff time, which is a Unix timestamp. A value of zero means there\\n /// is no cliff.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getCliffTime(\\n uint256 streamId\\n ) external view returns (uint40 cliffTime);\\n\\n /// @notice Retrieves the full stream details.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n /// @return stream See the documentation in {DataTypes}.\\n function getStream(\\n uint256 streamId\\n ) external view returns (LockupLinear.StreamLL memory stream);\\n\\n /// @notice Retrieves the stream's start, cliff and end timestamps.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n /// @return timestamps See the documentation in {DataTypes}.\\n function getTimestamps(\\n uint256 streamId\\n ) external view returns (LockupLinear.Timestamps memory timestamps);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n NON-CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Creates a stream by setting the start time to `block.timestamp`, and the end time to\\n /// the sum of `block.timestamp` and `params.durations.total`. The stream is funded by `msg.sender` and is wrapped\\n /// in an ERC-721 NFT.\\n ///\\n /// @dev Emits a {Transfer} and {CreateLockupLinearStream} event.\\n ///\\n /// Requirements:\\n /// - All requirements in {createWithTimestamps} must be met for the calculated parameters.\\n ///\\n /// @param params Struct encapsulating the function parameters, which are documented in {DataTypes}.\\n /// @return streamId The ID of the newly created stream.\\n function createWithDurations(\\n LockupLinear.CreateWithDurations calldata params\\n ) external returns (uint256 streamId);\\n\\n /// @notice Creates a stream with the provided start time and end time. The stream is funded by `msg.sender` and is\\n /// wrapped in an ERC-721 NFT.\\n ///\\n /// @dev Emits a {Transfer} and {CreateLockupLinearStream} event.\\n ///\\n /// Notes:\\n /// - A cliff time of zero means there is no cliff.\\n /// - As long as the times are ordered, it is not an error for the start or the cliff time to be in the past.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `params.totalAmount` must be greater than zero.\\n /// - If set, `params.broker.fee` must not be greater than `MAX_BROKER_FEE`.\\n /// - `params.timestamps.start` must be greater than zero and less than `params.timestamps.end`.\\n /// - If set, `params.timestamps.cliff` must be greater than `params.timestamps.start` and less than\\n /// `params.timestamps.end`.\\n /// - `params.timestamps.end` must be in the future.\\n /// - `params.recipient` must not be the zero address.\\n /// - `msg.sender` must have allowed this contract to spend at least `params.totalAmount` assets.\\n ///\\n /// @param params Struct encapsulating the function parameters, which are documented in {DataTypes}.\\n /// @return streamId The ID of the newly created stream.\\n function createWithTimestamps(\\n LockupLinear.CreateWithTimestamps calldata params\\n ) external returns (uint256 streamId);\\n}\\n\",\"keccak256\":\"0x064264723114b1f1cf3953fd79874dfcbb42cf313857aee6d5e6b09a23e0010b\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/ISablierV2NFTDescriptor.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC721Metadata} from \\\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\\\";\\n\\n/// @title ISablierV2NFTDescriptor\\n/// @notice This contract generates the URI describing the Sablier V2 stream NFTs.\\n/// @dev Inspired by Uniswap V3 Positions NFTs.\\ninterface ISablierV2NFTDescriptor {\\n /// @notice Produces the URI describing a particular stream NFT.\\n /// @dev This is a data URI with the JSON contents directly inlined.\\n /// @param sablier The address of the Sablier contract the stream was created in.\\n /// @param streamId The ID of the stream for which to produce a description.\\n /// @return uri The URI of the ERC721-compliant metadata.\\n function tokenURI(\\n IERC721Metadata sablier,\\n uint256 streamId\\n ) external view returns (string memory uri);\\n}\\n\",\"keccak256\":\"0x4ed430e553d14161e93efdaaacd1a502f49b38969c9d714b45d2e682a74fa0bc\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/types/DataTypes.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {UD2x18} from \\\"@prb/math/src/UD2x18.sol\\\";\\nimport {UD60x18} from \\\"@prb/math/src/UD60x18.sol\\\";\\n\\n// DataTypes.sol\\n//\\n// This file defines all structs used in V2 Core, most of which are organized under three namespaces:\\n//\\n// - Lockup\\n// - LockupDynamic\\n// - LockupLinear\\n// - LockupTranched\\n//\\n// You will notice that some structs contain \\\"slot\\\" annotations - they are used to indicate the\\n// storage layout of the struct. It is more gas efficient to group small data types together so\\n// that they fit in a single 32-byte slot.\\n\\n/// @notice Struct encapsulating the broker parameters passed to the create functions. Both can be set to zero.\\n/// @param account The address receiving the broker's fee.\\n/// @param fee The broker's percentage fee from the total amount, denoted as a fixed-point number where 1e18 is 100%.\\nstruct Broker {\\n address account;\\n UD60x18 fee;\\n}\\n\\n/// @notice Namespace for the structs used in both {SablierV2LockupLinear} and {SablierV2LockupDynamic}.\\nlibrary Lockup {\\n /// @notice Struct encapsulating the deposit, withdrawn, and refunded amounts, all denoted in units of the asset's\\n /// decimals.\\n /// @dev Because the deposited and the withdrawn amount are often read together, declaring them in the same slot\\n /// saves gas.\\n /// @param deposited The initial amount deposited in the stream, net of broker fee.\\n /// @param withdrawn The cumulative amount withdrawn from the stream.\\n /// @param refunded The amount refunded to the sender. Unless the stream was canceled, this is always zero.\\n struct Amounts {\\n // slot 0\\n uint128 deposited;\\n uint128 withdrawn;\\n // slot 1\\n uint128 refunded;\\n }\\n\\n /// @notice Struct encapsulating (i) the deposit amount and (ii) the broker fee amount, both denoted in units of the\\n /// asset's decimals.\\n /// @param deposit The amount to deposit in the stream.\\n /// @param brokerFee The broker fee amount.\\n struct CreateAmounts {\\n uint128 deposit;\\n uint128 brokerFee;\\n }\\n\\n /// @notice Enum representing the different statuses of a stream.\\n /// @custom:value0 PENDING Stream created but not started; assets are in a pending state.\\n /// @custom:value1 STREAMING Active stream where assets are currently being streamed.\\n /// @custom:value2 SETTLED All assets have been streamed; recipient is due to withdraw them.\\n /// @custom:value3 CANCELED Canceled stream; remaining assets await recipient's withdrawal.\\n /// @custom:value4 DEPLETED Depleted stream; all assets have been withdrawn and/or refunded.\\n enum Status {\\n PENDING,\\n STREAMING,\\n SETTLED,\\n CANCELED,\\n DEPLETED\\n }\\n\\n /// @notice A common data structure to be stored in all {SablierV2Lockup} models.\\n /// @dev The fields are arranged like this to save gas via tight variable packing.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream.\\n /// @param startTime The Unix timestamp indicating the stream's start.\\n /// @param endTime The Unix timestamp indicating the stream's end.\\n /// @param isCancelable Boolean indicating if the stream is cancelable.\\n /// @param wasCanceled Boolean indicating if the stream was canceled.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param isDepleted Boolean indicating if the stream is depleted.\\n /// @param isStream Boolean indicating if the struct entity exists.\\n /// @param isTransferable Boolean indicating if the stream NFT is transferable.\\n /// @param amounts Struct encapsulating the deposit, withdrawn, and refunded amounts, all denoted in units of the\\n /// asset's decimals.\\n struct Stream {\\n // slot 0\\n address sender;\\n uint40 startTime;\\n uint40 endTime;\\n bool isCancelable;\\n bool wasCanceled;\\n // slot 1\\n IERC20 asset;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n // slot 2 and 3\\n Lockup.Amounts amounts;\\n }\\n}\\n\\n/// @notice Namespace for the structs used in {SablierV2LockupDynamic}.\\nlibrary LockupDynamic {\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupDynamic.createWithDurations} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param segments Segments with durations used to compose the dynamic distribution function. Timestamps are\\n /// calculated by starting from `block.timestamp` and adding each duration to the previous timestamp.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithDurations {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n SegmentWithDuration[] segments;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupDynamic.createWithTimestamps} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param startTime The Unix timestamp indicating the stream's start.\\n /// @param segments Segments used to compose the dynamic distribution function.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithTimestamps {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n uint40 startTime;\\n Segment[] segments;\\n Broker broker;\\n }\\n\\n /// @notice Segment struct used in the Lockup Dynamic stream.\\n /// @param amount The amount of assets to be streamed in the segment, denoted in units of the asset's decimals.\\n /// @param exponent The exponent of the segment, denoted as a fixed-point number.\\n /// @param timestamp The Unix timestamp indicating the segment's end.\\n struct Segment {\\n // slot 0\\n uint128 amount;\\n UD2x18 exponent;\\n uint40 timestamp;\\n }\\n\\n /// @notice Segment struct used at runtime in {SablierV2LockupDynamic.createWithDurations}.\\n /// @param amount The amount of assets to be streamed in the segment, denoted in units of the asset's decimals.\\n /// @param exponent The exponent of the segment, denoted as a fixed-point number.\\n /// @param duration The time difference in seconds between the segment and the previous one.\\n struct SegmentWithDuration {\\n uint128 amount;\\n UD2x18 exponent;\\n uint40 duration;\\n }\\n\\n /// @notice Struct encapsulating the full details of a stream.\\n /// @dev Extends `Lockup.Stream` by including the recipient and the segments.\\n struct StreamLD {\\n address sender;\\n address recipient;\\n uint40 startTime;\\n uint40 endTime;\\n bool isCancelable;\\n bool wasCanceled;\\n IERC20 asset;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n Lockup.Amounts amounts;\\n Segment[] segments;\\n }\\n\\n /// @notice Struct encapsulating the LockupDynamic timestamps.\\n /// @param start The Unix timestamp indicating the stream's start.\\n /// @param end The Unix timestamp indicating the stream's end.\\n struct Timestamps {\\n uint40 start;\\n uint40 end;\\n }\\n}\\n\\n/// @notice Namespace for the structs used in {SablierV2LockupLinear}.\\nlibrary LockupLinear {\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupLinear.createWithDurations} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param durations Struct encapsulating (i) cliff period duration and (ii) total stream duration, both in seconds.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithDurations {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n Durations durations;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupLinear.createWithTimestamps} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param timestamps Struct encapsulating (i) the stream's start time, (ii) cliff time, and (iii) end time, all as\\n /// Unix timestamps.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithTimestamps {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n Timestamps timestamps;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the cliff duration and the total duration.\\n /// @param cliff The cliff duration in seconds.\\n /// @param total The total duration in seconds.\\n struct Durations {\\n uint40 cliff;\\n uint40 total;\\n }\\n\\n /// @notice Struct encapsulating the full details of a stream.\\n /// @dev Extends `Lockup.Stream` by including the recipient and the cliff time.\\n struct StreamLL {\\n address sender;\\n address recipient;\\n uint40 startTime;\\n bool isCancelable;\\n bool wasCanceled;\\n IERC20 asset;\\n uint40 endTime;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n Lockup.Amounts amounts;\\n uint40 cliffTime;\\n }\\n\\n /// @notice Struct encapsulating the LockupLinear timestamps.\\n /// @param start The Unix timestamp for the stream's start.\\n /// @param cliff The Unix timestamp for the cliff period's end. A value of zero means there is no cliff.\\n /// @param end The Unix timestamp for the stream's end.\\n struct Timestamps {\\n uint40 start;\\n uint40 cliff;\\n uint40 end;\\n }\\n}\\n\\n/// @notice Namespace for the structs used in {SablierV2LockupTranched}.\\nlibrary LockupTranched {\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupTranched.createWithDurations} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param tranches Tranches with durations used to compose the tranched distribution function. Timestamps are\\n /// calculated by starting from `block.timestamp` and adding each duration to the previous timestamp.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithDurations {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n TrancheWithDuration[] tranches;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupTranched.createWithTimestamps} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param startTime The Unix timestamp indicating the stream's start.\\n /// @param tranches Tranches used to compose the tranched distribution function.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithTimestamps {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n uint40 startTime;\\n Tranche[] tranches;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the full details of a stream.\\n /// @dev Extends `Lockup.Stream` by including the recipient and the tranches.\\n struct StreamLT {\\n address sender;\\n address recipient;\\n uint40 startTime;\\n uint40 endTime;\\n bool isCancelable;\\n bool wasCanceled;\\n IERC20 asset;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n Lockup.Amounts amounts;\\n Tranche[] tranches;\\n }\\n\\n /// @notice Struct encapsulating the LockupTranched timestamps.\\n /// @param start The Unix timestamp indicating the stream's start.\\n /// @param end The Unix timestamp indicating the stream's end.\\n struct Timestamps {\\n uint40 start;\\n uint40 end;\\n }\\n\\n /// @notice Tranche struct used in the Lockup Tranched stream.\\n /// @param amount The amount of assets to be unlocked in the tranche, denoted in units of the asset's decimals.\\n /// @param timestamp The Unix timestamp indicating the tranche's end.\\n struct Tranche {\\n // slot 0\\n uint128 amount;\\n uint40 timestamp;\\n }\\n\\n /// @notice Tranche struct used at runtime in {SablierV2LockupTranched.createWithDurations}.\\n /// @param amount The amount of assets to be unlocked in the tranche, denoted in units of the asset's decimals.\\n /// @param duration The time difference in seconds between the tranche and the previous one.\\n struct TrancheWithDuration {\\n uint128 amount;\\n uint40 duration;\\n }\\n}\\n\",\"keccak256\":\"0x727722c0ec71a76a947b935c9dfcac8fd846d6c3547dfbc8739c7109f3b95068\",\"license\":\"GPL-3.0-or-later\"},\"contracts/modules/DecentHatsCreationModule.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.28;\\n\\nimport {Enum} from \\\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\\\";\\nimport {IAvatar} from \\\"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol\\\";\\nimport {Strings} from \\\"@openzeppelin/contracts/utils/Strings.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IERC6551Registry} from \\\"../interfaces/IERC6551Registry.sol\\\";\\nimport {IHats} from \\\"../interfaces/hats/IHats.sol\\\";\\nimport {LockupLinear, Broker} from \\\"../interfaces/sablier/types/DataTypes.sol\\\";\\nimport {IHatsModuleFactory} from \\\"../interfaces/hats/IHatsModuleFactory.sol\\\";\\nimport {IHatsElectionsEligibility} from \\\"../interfaces/hats/modules/IHatsElectionsEligibility.sol\\\";\\nimport {ModuleProxyFactory} from \\\"@gnosis.pm/zodiac/contracts/factory/ModuleProxyFactory.sol\\\";\\nimport {ISablierV2LockupLinear} from \\\"../interfaces/sablier/ISablierV2LockupLinear.sol\\\";\\nimport {DecentHatsModuleUtils} from \\\"./DecentHatsModuleUtils.sol\\\";\\n\\ncontract DecentHatsCreationModule is DecentHatsModuleUtils {\\n struct TopHatParams {\\n string details;\\n string imageURI;\\n }\\n\\n struct AdminHatParams {\\n string details;\\n string imageURI;\\n bool isMutable;\\n }\\n\\n struct CreateTreeParams {\\n IHats hatsProtocol;\\n IERC6551Registry erc6551Registry;\\n IHatsModuleFactory hatsModuleFactory;\\n ModuleProxyFactory moduleProxyFactory;\\n address keyValuePairs;\\n address decentAutonomousAdminImplementation;\\n address hatsAccountImplementation;\\n address hatsElectionsEligibilityImplementation;\\n TopHatParams topHat;\\n AdminHatParams adminHat;\\n HatParams[] hats;\\n }\\n\\n /* /////////////////////////////////////////////////////////////////////////////\\n EXTERNAL FUNCTIONS\\n ///////////////////////////////////////////////////////////////////////////// */\\n /**\\n * @notice For a safe without any roles previously created on it, this function should be called. It sets up the\\n * top hat and admin hat, as well as any other hats and their streams that are provided, then transfers the top hat\\n * to the calling safe.\\n *\\n * @notice This contract should be enabled a module on the Safe for which the role(s) are to be created, and disabled after.\\n *\\n * @dev For each hat that is included, if the hat is:\\n * - termed, its stream funds on are targeted directly at the nominated wearer. The wearer should directly call `withdraw-`\\n * on the Sablier contract.\\n * - untermed, its stream funds are targeted at the hat's smart account. In order to withdraw funds from the stream, the\\n * hat's smart account must be the one call to `withdraw-` on the Sablier contract, setting the recipient arg to its wearer.\\n *\\n * @dev In order for a Safe to seamlessly create roles even if it has never previously created a role and thus has\\n * no hat tree, we defer the creation of the hat tree and its setup to this contract. This way, in a single tx block,\\n * the resulting topHatId of the newly created hat can be used to create an admin hat and any other hats needed.\\n * We also make use of `KeyValuePairs` to associate the topHatId with the Safe.\\n *\\n * @param treeParams The parameters for creating the Hat Tree with Roles\\n */\\n function createAndDeclareTree(\\n CreateTreeParams calldata treeParams\\n ) external {\\n // Create Top Hat\\n (uint256 topHatId, address topHatAccount) = _processTopHat(\\n treeParams.hatsProtocol,\\n treeParams.erc6551Registry,\\n treeParams.hatsAccountImplementation,\\n treeParams.keyValuePairs,\\n treeParams.topHat\\n );\\n\\n // Create Admin Hat\\n uint256 adminHatId = _processAdminHat(\\n treeParams.hatsProtocol,\\n treeParams.erc6551Registry,\\n treeParams.hatsAccountImplementation,\\n topHatId,\\n topHatAccount,\\n treeParams.moduleProxyFactory,\\n treeParams.decentAutonomousAdminImplementation,\\n treeParams.adminHat\\n );\\n\\n // Create Role Hats\\n _processRoleHats(\\n CreateRoleHatsParams({\\n hatsProtocol: treeParams.hatsProtocol,\\n erc6551Registry: treeParams.erc6551Registry,\\n hatsAccountImplementation: treeParams.hatsAccountImplementation,\\n topHatId: topHatId,\\n topHatAccount: topHatAccount,\\n hatsModuleFactory: treeParams.hatsModuleFactory,\\n hatsElectionsEligibilityImplementation: treeParams\\n .hatsElectionsEligibilityImplementation,\\n adminHatId: adminHatId,\\n hats: treeParams.hats,\\n keyValuePairs: treeParams.keyValuePairs\\n })\\n );\\n }\\n\\n /* /////////////////////////////////////////////////////////////////////////////\\n INTERNAL FUNCTIONS\\n ///////////////////////////////////////////////////////////////////////////// */\\n\\n function _processTopHat(\\n IHats hatsProtocol,\\n IERC6551Registry erc6551Registry,\\n address hatsAccountImplementation,\\n address keyValuePairs,\\n TopHatParams calldata topHat\\n ) internal returns (uint256 topHatId, address topHatAccount) {\\n // Call lastTopHatId() and properly decode the response\\n (bool success, bytes memory data) = address(hatsProtocol).call(\\n abi.encodeWithSignature(\\\"lastTopHatId()\\\")\\n );\\n require(success, \\\"Failed to get lastTopHatId\\\");\\n topHatId = (abi.decode(data, (uint256)) + 1) << 224;\\n\\n // Mint Top Hat to the Safe\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"mintTopHat(address,string,string)\\\",\\n msg.sender,\\n topHat.details,\\n topHat.imageURI\\n ),\\n Enum.Operation.Call\\n );\\n\\n // Create Top Hat's ERC6551 Account\\n topHatAccount = erc6551Registry.createAccount(\\n hatsAccountImplementation,\\n SALT,\\n block.chainid,\\n address(hatsProtocol),\\n topHatId\\n );\\n\\n // Declare Top Hat ID to Safe via KeyValuePairs\\n string[] memory keys = new string[](1);\\n string[] memory values = new string[](1);\\n keys[0] = \\\"topHatId\\\";\\n values[0] = Strings.toString(topHatId);\\n IAvatar(msg.sender).execTransactionFromModule(\\n keyValuePairs,\\n 0,\\n abi.encodeWithSignature(\\n \\\"updateValues(string[],string[])\\\",\\n keys,\\n values\\n ),\\n Enum.Operation.Call\\n );\\n }\\n\\n function _processAdminHat(\\n IHats hatsProtocol,\\n IERC6551Registry erc6551Registry,\\n address hatsAccountImplementation,\\n uint256 topHatId,\\n address topHatAccount,\\n ModuleProxyFactory moduleProxyFactory,\\n address decentAutonomousAdminImplementation,\\n AdminHatParams calldata adminHat\\n ) internal returns (uint256 adminHatId) {\\n // Create Admin Hat\\n adminHatId = hatsProtocol.getNextId(topHatId);\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"createHat(uint256,string,uint32,address,address,bool,string)\\\",\\n topHatId,\\n adminHat.details,\\n 1, // only one Admin Hat\\n topHatAccount,\\n topHatAccount,\\n adminHat.isMutable,\\n adminHat.imageURI\\n ),\\n Enum.Operation.Call\\n );\\n\\n // Create Admin Hat's ERC6551 Account\\n erc6551Registry.createAccount(\\n hatsAccountImplementation,\\n SALT,\\n block.chainid,\\n address(hatsProtocol),\\n adminHatId\\n );\\n\\n // Deploy Decent Autonomous Admin Module, which will wear the Admin Hat\\n address autonomousAdmin = moduleProxyFactory.deployModule(\\n decentAutonomousAdminImplementation,\\n abi.encodeWithSignature(\\\"setUp(bytes)\\\", bytes(\\\"\\\")),\\n uint256(\\n keccak256(\\n abi.encodePacked(\\n // for the salt, we'll concatenate our static salt\\n // with the Admin Hat ID\\n SALT,\\n adminHatId\\n )\\n )\\n )\\n );\\n\\n // Mint Hat to the Decent Autonomous Admin Module\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"mintHat(uint256,address)\\\",\\n adminHatId,\\n autonomousAdmin\\n ),\\n Enum.Operation.Call\\n );\\n }\\n}\\n\",\"keccak256\":\"0x5c95f7e83ded3c184dddd6b769791c92a68794eeb49deaccec4422497935c7c2\",\"license\":\"MIT\"},\"contracts/modules/DecentHatsModuleUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.28;\\n\\nimport {Enum} from \\\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\\\";\\nimport {IAvatar} from \\\"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IERC6551Registry} from \\\"../interfaces/IERC6551Registry.sol\\\";\\nimport {IHats} from \\\"../interfaces/hats/IHats.sol\\\";\\nimport {LockupLinear, Broker} from \\\"../interfaces/sablier/types/DataTypes.sol\\\";\\nimport {IHatsModuleFactory} from \\\"../interfaces/hats/IHatsModuleFactory.sol\\\";\\nimport {ISablierV2LockupLinear} from \\\"../interfaces/sablier/ISablierV2LockupLinear.sol\\\";\\nimport {Strings} from \\\"@openzeppelin/contracts/utils/Strings.sol\\\";\\n\\nabstract contract DecentHatsModuleUtils {\\n bytes32 public constant SALT =\\n 0x5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b5072;\\n\\n struct SablierStreamParams {\\n ISablierV2LockupLinear sablier;\\n address sender;\\n address asset;\\n LockupLinear.Timestamps timestamps;\\n Broker broker;\\n uint128 totalAmount;\\n bool cancelable;\\n bool transferable;\\n }\\n\\n struct HatParams {\\n address wearer;\\n string details;\\n string imageURI;\\n SablierStreamParams[] sablierStreamsParams;\\n uint128 termEndDateTs; // If 0, this is an untermed Hat\\n uint32 maxSupply;\\n bool isMutable;\\n }\\n\\n struct CreateRoleHatsParams {\\n IHats hatsProtocol;\\n IERC6551Registry erc6551Registry;\\n address hatsAccountImplementation;\\n uint256 topHatId;\\n address topHatAccount;\\n address keyValuePairs;\\n IHatsModuleFactory hatsModuleFactory;\\n address hatsElectionsEligibilityImplementation;\\n uint256 adminHatId;\\n HatParams[] hats;\\n }\\n\\n function _processRoleHats(\\n CreateRoleHatsParams memory roleHatsParams\\n ) internal {\\n for (uint256 i = 0; i < roleHatsParams.hats.length; ) {\\n HatParams memory hatParams = roleHatsParams.hats[i];\\n\\n // Create eligibility module if needed\\n address eligibilityAddress = _createEligibilityModule(\\n roleHatsParams.hatsProtocol,\\n roleHatsParams.hatsModuleFactory,\\n roleHatsParams.hatsElectionsEligibilityImplementation,\\n roleHatsParams.topHatId,\\n roleHatsParams.topHatAccount,\\n roleHatsParams.adminHatId,\\n hatParams.termEndDateTs\\n );\\n\\n // Create and Mint the Role Hat\\n uint256 hatId = _createAndMintHat(\\n roleHatsParams.hatsProtocol,\\n roleHatsParams.adminHatId,\\n hatParams,\\n eligibilityAddress,\\n roleHatsParams.topHatAccount\\n );\\n\\n // Get the stream recipient (based on termed or not)\\n address streamRecipient = _setupStreamRecipient(\\n roleHatsParams.erc6551Registry,\\n roleHatsParams.hatsAccountImplementation,\\n address(roleHatsParams.hatsProtocol),\\n hatParams.termEndDateTs,\\n hatParams.wearer,\\n hatId\\n );\\n\\n // Create streams\\n _processSablierStreams(\\n hatParams.sablierStreamsParams,\\n streamRecipient,\\n roleHatsParams.keyValuePairs,\\n hatId\\n );\\n\\n unchecked {\\n ++i;\\n }\\n }\\n }\\n\\n function _createEligibilityModule(\\n IHats hatsProtocol,\\n IHatsModuleFactory hatsModuleFactory,\\n address hatsElectionsEligibilityImplementation,\\n uint256 topHatId,\\n address topHatAccount,\\n uint256 adminHatId,\\n uint128 termEndDateTs\\n ) private returns (address) {\\n // If the Hat is termed, create the eligibility module\\n if (termEndDateTs != 0) {\\n return\\n hatsModuleFactory.createHatsModule(\\n hatsElectionsEligibilityImplementation,\\n hatsProtocol.getNextId(adminHatId),\\n abi.encode(topHatId, uint256(0)), // [BALLOT_BOX_ID, ADMIN_HAT_ID]\\n abi.encode(termEndDateTs),\\n uint256(SALT)\\n );\\n }\\n\\n // Otherwise, return the Top Hat account\\n return topHatAccount;\\n }\\n\\n function _createAndMintHat(\\n IHats hatsProtocol,\\n uint256 adminHatId,\\n HatParams memory hat,\\n address eligibilityAddress,\\n address topHatAccount\\n ) private returns (uint256) {\\n // Grab the next Hat ID (before creating it)\\n uint256 hatId = hatsProtocol.getNextId(adminHatId);\\n\\n // Create the new Hat\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"createHat(uint256,string,uint32,address,address,bool,string)\\\",\\n adminHatId,\\n hat.details,\\n hat.maxSupply,\\n eligibilityAddress,\\n topHatAccount,\\n hat.isMutable,\\n hat.imageURI\\n ),\\n Enum.Operation.Call\\n );\\n\\n // If the Hat is termed, nominate the wearer as the eligible member\\n if (hat.termEndDateTs != 0) {\\n address[] memory nominatedWearers = new address[](1);\\n nominatedWearers[0] = hat.wearer;\\n\\n IAvatar(msg.sender).execTransactionFromModule(\\n eligibilityAddress,\\n 0,\\n abi.encodeWithSignature(\\n \\\"elect(uint128,address[])\\\",\\n hat.termEndDateTs,\\n nominatedWearers\\n ),\\n Enum.Operation.Call\\n );\\n }\\n\\n // Mint the Hat\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"mintHat(uint256,address)\\\",\\n hatId,\\n hat.wearer\\n ),\\n Enum.Operation.Call\\n );\\n return hatId;\\n }\\n\\n // Exists to avoid stack too deep errors\\n function _setupStreamRecipient(\\n IERC6551Registry erc6551Registry,\\n address hatsAccountImplementation,\\n address hatsProtocol,\\n uint128 termEndDateTs,\\n address wearer,\\n uint256 hatId\\n ) private returns (address) {\\n // If the hat is termed, the wearer is the stream recipient\\n if (termEndDateTs != 0) {\\n return wearer;\\n }\\n\\n // Otherwise, the Hat's smart account is the stream recipient\\n return\\n erc6551Registry.createAccount(\\n hatsAccountImplementation,\\n SALT,\\n block.chainid,\\n hatsProtocol,\\n hatId\\n );\\n }\\n\\n function _processSablierStreams(\\n SablierStreamParams[] memory streamParams,\\n address streamRecipient,\\n address keyValuePairs,\\n uint256 hatId\\n ) private {\\n for (uint256 i = 0; i < streamParams.length; ) {\\n SablierStreamParams memory sablierStreamParams = streamParams[i];\\n\\n // Approve tokens for Sablier\\n IAvatar(msg.sender).execTransactionFromModule(\\n sablierStreamParams.asset,\\n 0,\\n abi.encodeWithSignature(\\n \\\"approve(address,uint256)\\\",\\n sablierStreamParams.sablier,\\n sablierStreamParams.totalAmount\\n ),\\n Enum.Operation.Call\\n );\\n uint256 streamId = ISablierV2LockupLinear(\\n sablierStreamParams.sablier\\n ).nextStreamId();\\n\\n // Proxy the Sablier call through IAvatar\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(sablierStreamParams.sablier),\\n 0,\\n abi.encodeWithSignature(\\n \\\"createWithTimestamps((address,address,uint128,address,bool,bool,(uint40,uint40,uint40),(address,uint256)))\\\",\\n LockupLinear.CreateWithTimestamps({\\n sender: sablierStreamParams.sender,\\n recipient: streamRecipient,\\n totalAmount: sablierStreamParams.totalAmount,\\n asset: IERC20(sablierStreamParams.asset),\\n cancelable: sablierStreamParams.cancelable,\\n transferable: sablierStreamParams.transferable,\\n timestamps: sablierStreamParams.timestamps,\\n broker: sablierStreamParams.broker\\n })\\n ),\\n Enum.Operation.Call\\n );\\n\\n // Update KeyValuePairs with the stream ID and Hat ID\\n string[] memory keys = new string[](1);\\n string[] memory values = new string[](1);\\n keys[0] = \\\"hatIdToStreamId\\\";\\n values[0] = string(\\n abi.encodePacked(\\n Strings.toString(hatId),\\n \\\":\\\",\\n Strings.toString(streamId)\\n )\\n );\\n\\n IAvatar(msg.sender).execTransactionFromModule(\\n keyValuePairs,\\n 0,\\n abi.encodeWithSignature(\\n \\\"updateValues(string[],string[])\\\",\\n keys,\\n values\\n ),\\n Enum.Operation.Call\\n );\\n\\n unchecked {\\n ++i;\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xcf91d6de2291dd71d2491292ee2d1120c444b8f4f11b8c31429ed4c630013e69\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052348015600f57600080fd5b5061212e8061001f6000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c8063ba9a91a51461003b578063d58041b714610062575b600080fd5b6100506000805160206120d983398151915281565b60405190815260200160405180910390f35b610075610070366004611539565b610077565b005b6000806100cd61008a6020850185611593565b61009a6040860160208701611593565b6100aa60e0870160c08801611593565b6100ba60a0880160808901611593565b6100c86101008901896115c0565b61023d565b909250905060006101396100e46020860186611593565b6100f46040870160208801611593565b61010460e0880160c08901611593565b868661011660808b0160608c01611593565b61012660c08c0160a08d01611593565b6101346101208d018d6115e0565b610619565b604080516101408101909152909150610237908061015a6020880188611593565b6001600160a01b0316815260200186602001602081019061017b9190611593565b6001600160a01b0316815260200161019960e0880160c08901611593565b6001600160a01b03908116825260208201879052851660408201526060016101c760a0880160808901611593565b6001600160a01b031681526020016101e56060880160408901611593565b6001600160a01b03168152602001610204610100880160e08901611593565b6001600160a01b03168152602081018490526040016102276101408801886115f6565b61023091611997565b90526109b5565b50505050565b60408051600481526024810182526020810180516001600160e01b0316633f0f816960e21b17905290516000918291829182916001600160a01b038b169161028491611af9565b6000604051808303816000865af19150503d80600081146102c1576040519150601f19603f3d011682016040523d82523d6000602084013e6102c6565b606091505b50915091508161031c5760405162461bcd60e51b815260206004820152601a60248201527f4661696c656420746f20676574206c617374546f704861744964000000000000604482015260640160405180910390fd5b60e0818060200190518101906103329190611b0b565b61033d906001611b3a565b901b93503363468721a78a6000836103558a80611b53565b61036260208d018d611b53565b604051602401610376959493929190611bc2565b60408051601f198184030181529181526020820180516001600160e01b0316631a64dfad60e01b1790525160e085901b6001600160e01b03191681526103c493929190600090600401611c32565b6020604051808303816000875af11580156103e3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104079190611c88565b50604051638a54c52f60e01b81526001600160a01b03891690638a54c52f9061044a908a906000805160206120d98339815191529046908f908b90600401611ca5565b6020604051808303816000875af1158015610469573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061048d9190611cd8565b60408051600180825281830190925291945060009190816020015b60608152602001906001900390816104a857505060408051600180825281830190925291925060009190602082015b60608152602001906001900390816104d7579050509050604051806040016040528060088152602001671d1bdc12185d125960c21b8152508260008151811061052257610522611cf5565b602002602001018190525061053686610a84565b8160008151811061054957610549611cf5565b6020026020010181905250336001600160a01b031663468721a78960008585604051602401610579929190611d67565b60408051601f198184030181529181526020820180516001600160e01b031663579374b960e11b1790525160e085901b6001600160e01b03191681526105c793929190600090600401611c32565b6020604051808303816000875af11580156105e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061060a9190611c88565b50505050509550959350505050565b60405162460ea360e61b8152600481018690526000906001600160a01b038a1690631183a8c090602401602060405180830381865afa158015610660573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106849190611b0b565b90503363468721a78a60008961069a8780611b53565b60018c806106ae60608d0160408e01611d95565b6106bb60208e018e611b53565b6040516024016106d399989796959493929190611db2565b60408051601f198184030181529181526020820180516001600160e01b0316635829492f60e11b1790525160e085901b6001600160e01b031916815261072193929190600090600401611c32565b6020604051808303816000875af1158015610740573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107649190611c88565b50604051638a54c52f60e01b81526001600160a01b03891690638a54c52f906107a7908a906000805160206120d98339815191529046908f908890600401611ca5565b6020604051808303816000875af11580156107c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ea9190611cd8565b506000846001600160a01b031663f1ab873c856040518060200160405280600081525060405160240161081d9190611e17565b60408051601f19818403018152918152602080830180516001600160e01b031663a4f9edbf60e01b179052905161086f916000805160206120d983398151915291899101918252602082015260400190565b60408051601f198184030181529082905280516020909101206001600160e01b031960e086901b1682526108a7939291600401611e2a565b6020604051808303816000875af11580156108c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108ea9190611cd8565b604051602481018490526001600160a01b0382166044820152909150339063468721a7908c9060009060640160408051601f198184030181529181526020820180516001600160e01b031663320fbbb760e11b1790525160e085901b6001600160e01b031916815261096493929190600090600401611c32565b6020604051808303816000875af1158015610983573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109a79190611c88565b505098975050505050505050565b60005b81610120015151811015610a8057600082610120015182815181106109df576109df611cf5565b602002602001015190506000610a1784600001518560c001518660e00151876060015188608001518961010001518860800151610b8c565b90506000610a35856000015186610100015185858960800151610cf3565b90506000610a5b8660200151876040015188600001518760800151886000015187611025565b9050610a718460600151828860a00151856110cf565b846001019450505050506109b8565b5050565b606081600003610aab5750506040805180820190915260018152600360fc1b602082015290565b8160005b8115610ad55780610abf81611e5e565b9150610ace9050600a83611e8d565b9150610aaf565b6000816001600160401b03811115610aef57610aef611646565b6040519080825280601f01601f191660200182016040528015610b19576020820181803683370190505b5090505b8415610b8457610b2e600183611ea1565b9150610b3b600a86611eb4565b610b46906030611b3a565b60f81b818381518110610b5b57610b5b611cf5565b60200101906001600160f81b031916908160001a905350610b7d600a86611e8d565b9450610b1d565b949350505050565b60006001600160801b03821615610ce557866001600160a01b0316632f7fb7b6878a6001600160a01b0316631183a8c0876040518263ffffffff1660e01b8152600401610bdb91815260200190565b602060405180830381865afa158015610bf8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c1c9190611b0b565b886000604051602001610c39929190918252602082015260400190565b60408051601f198184030181528282526001600160801b0389166020840152910160408051601f19818403018152908290526001600160e01b031960e087901b168252610c9b949392916000805160206120d983398151915290600401611ec8565b6020604051808303816000875af1158015610cba573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cde9190611cd8565b9050610ce8565b50825b979650505050505050565b60405162460ea360e61b81526004810185905260009081906001600160a01b03881690631183a8c090602401602060405180830381865afa158015610d3c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d609190611b0b565b9050336001600160a01b031663468721a78860008989602001518a60a001518a8a8d60c001518e60400151604051602401610da19796959493929190611f14565b60408051601f198184030181529181526020820180516001600160e01b0316635829492f60e11b1790525160e085901b6001600160e01b0319168152610def93929190600090600401611c32565b6020604051808303816000875af1158015610e0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e329190611c88565b5060808501516001600160801b031615610f5d5760408051600180825281830190925260009160208083019080368337019050509050856000015181600081518110610e8057610e80611cf5565b60200260200101906001600160a01b031690816001600160a01b031681525050336001600160a01b031663468721a7866000896080015185604051602401610ec9929190611f78565b60408051601f198184030181529181526020820180516001600160e01b0316634a231cef60e01b1790525160e085901b6001600160e01b0319168152610f1793929190600090600401611c32565b6020604051808303816000875af1158015610f36573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f5a9190611c88565b50505b8451604051602481018390526001600160a01b039091166044820152339063468721a790899060009060640160408051601f198184030181529181526020820180516001600160e01b031663320fbbb760e11b1790525160e085901b6001600160e01b0319168152610fd793929190600090600401611c32565b6020604051808303816000875af1158015610ff6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061101a9190611c88565b509695505050505050565b60006001600160801b0384161561103d5750816110c5565b604051638a54c52f60e01b81526001600160a01b03881690638a54c52f9061107f9089906000805160206120d98339815191529046908b908990600401611ca5565b6020604051808303816000875af115801561109e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110c29190611cd8565b90505b9695505050505050565b60005b84518110156115325760008582815181106110ef576110ef611cf5565b60200260200101519050336001600160a01b031663468721a78260400151600084600001518560a001516040516024016111479291906001600160a01b039290921682526001600160801b0316602082015260400190565b60408051601f198184030181529181526020820180516001600160e01b031663095ea7b360e01b1790525160e085901b6001600160e01b031916815261119593929190600090600401611c32565b6020604051808303816000875af11580156111b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111d89190611c88565b50600081600001516001600160a01b0316631e99d5696040518163ffffffff1660e01b8152600401602060405180830381865afa15801561121d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112419190611b0b565b9050336001600160a01b031663468721a78360000151600060405180610100016040528087602001516001600160a01b031681526020018b6001600160a01b031681526020018760a001516001600160801b0316815260200187604001516001600160a01b031681526020018760c00151151581526020018760e00151151581526020018760600151815260200187608001518152506040516024016112e79190611fcd565b60408051601f198184030181529181526020820180516001600160e01b03166353b1572760e01b1790525160e085901b6001600160e01b031916815261133593929190600090600401611c32565b6020604051808303816000875af1158015611354573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113789190611c88565b50604080516001808252818301909252600091816020015b606081526020019060019003908161139057505060408051600180825281830190925291925060009190602082015b60608152602001906001900390816113bf5790505090506040518060400160405280600f81526020016e1a185d1259151bd4dd1c99585b5259608a1b8152508260008151811061141157611411611cf5565b602002602001018190525061142586610a84565b61142e84610a84565b60405160200161143f92919061209c565b6040516020818303038152906040528160008151811061146157611461611cf5565b6020026020010181905250336001600160a01b031663468721a78860008585604051602401611491929190611d67565b60408051601f198184030181529181526020820180516001600160e01b031663579374b960e11b1790525160e085901b6001600160e01b03191681526114df93929190600090600401611c32565b6020604051808303816000875af11580156114fe573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115229190611c88565b50846001019450505050506110d2565b5050505050565b60006020828403121561154b57600080fd5b81356001600160401b0381111561156157600080fd5b8201610160818503121561157457600080fd5b9392505050565b6001600160a01b038116811461159057600080fd5b50565b6000602082840312156115a557600080fd5b81356115748161157b565b80356115bb8161157b565b919050565b60008235603e198336030181126115d657600080fd5b9190910192915050565b60008235605e198336030181126115d657600080fd5b6000808335601e1984360301811261160d57600080fd5b8301803591506001600160401b0382111561162757600080fd5b6020019150600581901b360382131561163f57600080fd5b9250929050565b634e487b7160e01b600052604160045260246000fd5b60405161010081016001600160401b038111828210171561167f5761167f611646565b60405290565b60405160e081016001600160401b038111828210171561167f5761167f611646565b604051601f8201601f191681016001600160401b03811182821017156116cf576116cf611646565b604052919050565b60006001600160401b038211156116f0576116f0611646565b5060051b60200190565b600082601f83011261170b57600080fd5b81356001600160401b0381111561172457611724611646565b611737601f8201601f19166020016116a7565b81815284602083860101111561174c57600080fd5b816020850160208301376000918101602001919091529392505050565b803564ffffffffff811681146115bb57600080fd5b60006060828403121561179057600080fd5b604051606081016001600160401b03811182821017156117b2576117b2611646565b6040529050806117c183611769565b81526117cf60208401611769565b60208201526117e060408401611769565b60408201525092915050565b6000604082840312156117fe57600080fd5b604080519081016001600160401b038111828210171561182057611820611646565b60405290508082356118318161157b565b8152602092830135920191909152919050565b80356001600160801b03811681146115bb57600080fd5b801515811461159057600080fd5b80356115bb8161185b565b600082601f83011261188557600080fd5b8135611898611893826116d7565b6116a7565b80828252602082019150602061016084028601019250858311156118bb57600080fd5b602085015b838110156119795761016081880312156118d957600080fd5b6118e161165c565b6118ea826115b0565b81526118f8602083016115b0565b6020820152611909604083016115b0565b604082015261191b886060840161177e565b606082015261192d8860c084016117ec565b608082015261193f6101008301611844565b60a08201526119516101208301611869565b60c08201526119636101408301611869565b60e08201528352602090920191610160016118c0565b5095945050505050565b803563ffffffff811681146115bb57600080fd5b60006119a5611893846116d7565b8381526020810190600585901b8401368111156119c157600080fd5b845b81811015611aca5780356001600160401b038111156119e157600080fd5b860160e03682900312156119f457600080fd5b6119fc611685565b611a05826115b0565b815260208201356001600160401b03811115611a2057600080fd5b611a2c368285016116fa565b60208301525060408201356001600160401b03811115611a4b57600080fd5b611a57368285016116fa565b60408301525060608201356001600160401b03811115611a7657600080fd5b611a8236828501611874565b606083015250611a9460808301611844565b6080820152611aa560a08301611983565b60a0820152611ab660c08301611869565b60c0820152855250602093840193016119c3565b509095945050505050565b60005b83811015611af0578181015183820152602001611ad8565b50506000910152565b600082516115d6818460208701611ad5565b600060208284031215611b1d57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b80820180821115611b4d57611b4d611b24565b92915050565b6000808335601e19843603018112611b6a57600080fd5b8301803591506001600160401b03821115611b8457600080fd5b60200191503681900382131561163f57600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b0386168152606060208201819052600090611be79083018688611b99565b8281036040840152611bfa818587611b99565b98975050505050505050565b60008151808452611c1e816020860160208601611ad5565b601f01601f19169290920160200192915050565b60018060a01b0385168152836020820152608060408201526000611c596080830185611c06565b905060028310611c7957634e487b7160e01b600052602160045260246000fd5b82606083015295945050505050565b600060208284031215611c9a57600080fd5b81516115748161185b565b6001600160a01b039586168152602081019490945260408401929092529092166060820152608081019190915260a00190565b600060208284031215611cea57600080fd5b81516115748161157b565b634e487b7160e01b600052603260045260246000fd5b600082825180855260208501945060208160051b8301016020850160005b83811015611d5b57601f19858403018852611d45838351611c06565b6020988901989093509190910190600101611d29565b50909695505050505050565b604081526000611d7a6040830185611d0b565b8281036020840152611d8c8185611d0b565b95945050505050565b600060208284031215611da757600080fd5b81356115748161185b565b89815260e060208201526000611dcc60e083018a8c611b99565b60ff891660408401526001600160a01b0388811660608501528716608084015285151560a084015282810360c0840152611e07818587611b99565b9c9b505050505050505050505050565b6020815260006115746020830184611c06565b6001600160a01b0384168152606060208201819052600090611e4e90830185611c06565b9050826040830152949350505050565b600060018201611e7057611e70611b24565b5060010190565b634e487b7160e01b600052601260045260246000fd5b600082611e9c57611e9c611e77565b500490565b81810381811115611b4d57611b4d611b24565b600082611ec357611ec3611e77565b500690565b60018060a01b038616815284602082015260a060408201526000611eef60a0830186611c06565b8281036060840152611f018186611c06565b9150508260808301529695505050505050565b87815260e060208201526000611f2d60e0830189611c06565b63ffffffff881660408401526001600160a01b0387811660608501528616608084015284151560a084015282810360c0840152611f6a8185611c06565b9a9950505050505050505050565b6000604082016001600160801b03851683526040602084015280845180835260608501915060208601925060005b81811015611d5b5783516001600160a01b0316835260209384019390920191600101611fa6565b81516001600160a01b0390811682526020808401518216908301526040808401516001600160801b03169083015260608084015191821690830152610160820190506080830151612022608084018215159052565b5060a083015161203660a084018215159052565b5060c083015161207560c084018264ffffffffff815116825264ffffffffff602082015116602083015264ffffffffff60408201511660408301525050565b5060e0929092015180516001600160a01b0316610120830152602001516101409091015290565b600083516120ae818460208801611ad5565b601d60f91b90830190815283516120cc816001840160208801611ad5565b0160010194935050505056fe5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b5072a26469706673582212200934c93692d281e9d89ed2e17022e289297dd78e723d3ba32c6645f05d3b8df864736f6c634300081c0033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100365760003560e01c8063ba9a91a51461003b578063d58041b714610062575b600080fd5b6100506000805160206120d983398151915281565b60405190815260200160405180910390f35b610075610070366004611539565b610077565b005b6000806100cd61008a6020850185611593565b61009a6040860160208701611593565b6100aa60e0870160c08801611593565b6100ba60a0880160808901611593565b6100c86101008901896115c0565b61023d565b909250905060006101396100e46020860186611593565b6100f46040870160208801611593565b61010460e0880160c08901611593565b868661011660808b0160608c01611593565b61012660c08c0160a08d01611593565b6101346101208d018d6115e0565b610619565b604080516101408101909152909150610237908061015a6020880188611593565b6001600160a01b0316815260200186602001602081019061017b9190611593565b6001600160a01b0316815260200161019960e0880160c08901611593565b6001600160a01b03908116825260208201879052851660408201526060016101c760a0880160808901611593565b6001600160a01b031681526020016101e56060880160408901611593565b6001600160a01b03168152602001610204610100880160e08901611593565b6001600160a01b03168152602081018490526040016102276101408801886115f6565b61023091611997565b90526109b5565b50505050565b60408051600481526024810182526020810180516001600160e01b0316633f0f816960e21b17905290516000918291829182916001600160a01b038b169161028491611af9565b6000604051808303816000865af19150503d80600081146102c1576040519150601f19603f3d011682016040523d82523d6000602084013e6102c6565b606091505b50915091508161031c5760405162461bcd60e51b815260206004820152601a60248201527f4661696c656420746f20676574206c617374546f704861744964000000000000604482015260640160405180910390fd5b60e0818060200190518101906103329190611b0b565b61033d906001611b3a565b901b93503363468721a78a6000836103558a80611b53565b61036260208d018d611b53565b604051602401610376959493929190611bc2565b60408051601f198184030181529181526020820180516001600160e01b0316631a64dfad60e01b1790525160e085901b6001600160e01b03191681526103c493929190600090600401611c32565b6020604051808303816000875af11580156103e3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104079190611c88565b50604051638a54c52f60e01b81526001600160a01b03891690638a54c52f9061044a908a906000805160206120d98339815191529046908f908b90600401611ca5565b6020604051808303816000875af1158015610469573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061048d9190611cd8565b60408051600180825281830190925291945060009190816020015b60608152602001906001900390816104a857505060408051600180825281830190925291925060009190602082015b60608152602001906001900390816104d7579050509050604051806040016040528060088152602001671d1bdc12185d125960c21b8152508260008151811061052257610522611cf5565b602002602001018190525061053686610a84565b8160008151811061054957610549611cf5565b6020026020010181905250336001600160a01b031663468721a78960008585604051602401610579929190611d67565b60408051601f198184030181529181526020820180516001600160e01b031663579374b960e11b1790525160e085901b6001600160e01b03191681526105c793929190600090600401611c32565b6020604051808303816000875af11580156105e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061060a9190611c88565b50505050509550959350505050565b60405162460ea360e61b8152600481018690526000906001600160a01b038a1690631183a8c090602401602060405180830381865afa158015610660573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106849190611b0b565b90503363468721a78a60008961069a8780611b53565b60018c806106ae60608d0160408e01611d95565b6106bb60208e018e611b53565b6040516024016106d399989796959493929190611db2565b60408051601f198184030181529181526020820180516001600160e01b0316635829492f60e11b1790525160e085901b6001600160e01b031916815261072193929190600090600401611c32565b6020604051808303816000875af1158015610740573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107649190611c88565b50604051638a54c52f60e01b81526001600160a01b03891690638a54c52f906107a7908a906000805160206120d98339815191529046908f908890600401611ca5565b6020604051808303816000875af11580156107c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ea9190611cd8565b506000846001600160a01b031663f1ab873c856040518060200160405280600081525060405160240161081d9190611e17565b60408051601f19818403018152918152602080830180516001600160e01b031663a4f9edbf60e01b179052905161086f916000805160206120d983398151915291899101918252602082015260400190565b60408051601f198184030181529082905280516020909101206001600160e01b031960e086901b1682526108a7939291600401611e2a565b6020604051808303816000875af11580156108c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108ea9190611cd8565b604051602481018490526001600160a01b0382166044820152909150339063468721a7908c9060009060640160408051601f198184030181529181526020820180516001600160e01b031663320fbbb760e11b1790525160e085901b6001600160e01b031916815261096493929190600090600401611c32565b6020604051808303816000875af1158015610983573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109a79190611c88565b505098975050505050505050565b60005b81610120015151811015610a8057600082610120015182815181106109df576109df611cf5565b602002602001015190506000610a1784600001518560c001518660e00151876060015188608001518961010001518860800151610b8c565b90506000610a35856000015186610100015185858960800151610cf3565b90506000610a5b8660200151876040015188600001518760800151886000015187611025565b9050610a718460600151828860a00151856110cf565b846001019450505050506109b8565b5050565b606081600003610aab5750506040805180820190915260018152600360fc1b602082015290565b8160005b8115610ad55780610abf81611e5e565b9150610ace9050600a83611e8d565b9150610aaf565b6000816001600160401b03811115610aef57610aef611646565b6040519080825280601f01601f191660200182016040528015610b19576020820181803683370190505b5090505b8415610b8457610b2e600183611ea1565b9150610b3b600a86611eb4565b610b46906030611b3a565b60f81b818381518110610b5b57610b5b611cf5565b60200101906001600160f81b031916908160001a905350610b7d600a86611e8d565b9450610b1d565b949350505050565b60006001600160801b03821615610ce557866001600160a01b0316632f7fb7b6878a6001600160a01b0316631183a8c0876040518263ffffffff1660e01b8152600401610bdb91815260200190565b602060405180830381865afa158015610bf8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c1c9190611b0b565b886000604051602001610c39929190918252602082015260400190565b60408051601f198184030181528282526001600160801b0389166020840152910160408051601f19818403018152908290526001600160e01b031960e087901b168252610c9b949392916000805160206120d983398151915290600401611ec8565b6020604051808303816000875af1158015610cba573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cde9190611cd8565b9050610ce8565b50825b979650505050505050565b60405162460ea360e61b81526004810185905260009081906001600160a01b03881690631183a8c090602401602060405180830381865afa158015610d3c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d609190611b0b565b9050336001600160a01b031663468721a78860008989602001518a60a001518a8a8d60c001518e60400151604051602401610da19796959493929190611f14565b60408051601f198184030181529181526020820180516001600160e01b0316635829492f60e11b1790525160e085901b6001600160e01b0319168152610def93929190600090600401611c32565b6020604051808303816000875af1158015610e0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e329190611c88565b5060808501516001600160801b031615610f5d5760408051600180825281830190925260009160208083019080368337019050509050856000015181600081518110610e8057610e80611cf5565b60200260200101906001600160a01b031690816001600160a01b031681525050336001600160a01b031663468721a7866000896080015185604051602401610ec9929190611f78565b60408051601f198184030181529181526020820180516001600160e01b0316634a231cef60e01b1790525160e085901b6001600160e01b0319168152610f1793929190600090600401611c32565b6020604051808303816000875af1158015610f36573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f5a9190611c88565b50505b8451604051602481018390526001600160a01b039091166044820152339063468721a790899060009060640160408051601f198184030181529181526020820180516001600160e01b031663320fbbb760e11b1790525160e085901b6001600160e01b0319168152610fd793929190600090600401611c32565b6020604051808303816000875af1158015610ff6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061101a9190611c88565b509695505050505050565b60006001600160801b0384161561103d5750816110c5565b604051638a54c52f60e01b81526001600160a01b03881690638a54c52f9061107f9089906000805160206120d98339815191529046908b908990600401611ca5565b6020604051808303816000875af115801561109e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110c29190611cd8565b90505b9695505050505050565b60005b84518110156115325760008582815181106110ef576110ef611cf5565b60200260200101519050336001600160a01b031663468721a78260400151600084600001518560a001516040516024016111479291906001600160a01b039290921682526001600160801b0316602082015260400190565b60408051601f198184030181529181526020820180516001600160e01b031663095ea7b360e01b1790525160e085901b6001600160e01b031916815261119593929190600090600401611c32565b6020604051808303816000875af11580156111b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111d89190611c88565b50600081600001516001600160a01b0316631e99d5696040518163ffffffff1660e01b8152600401602060405180830381865afa15801561121d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112419190611b0b565b9050336001600160a01b031663468721a78360000151600060405180610100016040528087602001516001600160a01b031681526020018b6001600160a01b031681526020018760a001516001600160801b0316815260200187604001516001600160a01b031681526020018760c00151151581526020018760e00151151581526020018760600151815260200187608001518152506040516024016112e79190611fcd565b60408051601f198184030181529181526020820180516001600160e01b03166353b1572760e01b1790525160e085901b6001600160e01b031916815261133593929190600090600401611c32565b6020604051808303816000875af1158015611354573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113789190611c88565b50604080516001808252818301909252600091816020015b606081526020019060019003908161139057505060408051600180825281830190925291925060009190602082015b60608152602001906001900390816113bf5790505090506040518060400160405280600f81526020016e1a185d1259151bd4dd1c99585b5259608a1b8152508260008151811061141157611411611cf5565b602002602001018190525061142586610a84565b61142e84610a84565b60405160200161143f92919061209c565b6040516020818303038152906040528160008151811061146157611461611cf5565b6020026020010181905250336001600160a01b031663468721a78860008585604051602401611491929190611d67565b60408051601f198184030181529181526020820180516001600160e01b031663579374b960e11b1790525160e085901b6001600160e01b03191681526114df93929190600090600401611c32565b6020604051808303816000875af11580156114fe573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115229190611c88565b50846001019450505050506110d2565b5050505050565b60006020828403121561154b57600080fd5b81356001600160401b0381111561156157600080fd5b8201610160818503121561157457600080fd5b9392505050565b6001600160a01b038116811461159057600080fd5b50565b6000602082840312156115a557600080fd5b81356115748161157b565b80356115bb8161157b565b919050565b60008235603e198336030181126115d657600080fd5b9190910192915050565b60008235605e198336030181126115d657600080fd5b6000808335601e1984360301811261160d57600080fd5b8301803591506001600160401b0382111561162757600080fd5b6020019150600581901b360382131561163f57600080fd5b9250929050565b634e487b7160e01b600052604160045260246000fd5b60405161010081016001600160401b038111828210171561167f5761167f611646565b60405290565b60405160e081016001600160401b038111828210171561167f5761167f611646565b604051601f8201601f191681016001600160401b03811182821017156116cf576116cf611646565b604052919050565b60006001600160401b038211156116f0576116f0611646565b5060051b60200190565b600082601f83011261170b57600080fd5b81356001600160401b0381111561172457611724611646565b611737601f8201601f19166020016116a7565b81815284602083860101111561174c57600080fd5b816020850160208301376000918101602001919091529392505050565b803564ffffffffff811681146115bb57600080fd5b60006060828403121561179057600080fd5b604051606081016001600160401b03811182821017156117b2576117b2611646565b6040529050806117c183611769565b81526117cf60208401611769565b60208201526117e060408401611769565b60408201525092915050565b6000604082840312156117fe57600080fd5b604080519081016001600160401b038111828210171561182057611820611646565b60405290508082356118318161157b565b8152602092830135920191909152919050565b80356001600160801b03811681146115bb57600080fd5b801515811461159057600080fd5b80356115bb8161185b565b600082601f83011261188557600080fd5b8135611898611893826116d7565b6116a7565b80828252602082019150602061016084028601019250858311156118bb57600080fd5b602085015b838110156119795761016081880312156118d957600080fd5b6118e161165c565b6118ea826115b0565b81526118f8602083016115b0565b6020820152611909604083016115b0565b604082015261191b886060840161177e565b606082015261192d8860c084016117ec565b608082015261193f6101008301611844565b60a08201526119516101208301611869565b60c08201526119636101408301611869565b60e08201528352602090920191610160016118c0565b5095945050505050565b803563ffffffff811681146115bb57600080fd5b60006119a5611893846116d7565b8381526020810190600585901b8401368111156119c157600080fd5b845b81811015611aca5780356001600160401b038111156119e157600080fd5b860160e03682900312156119f457600080fd5b6119fc611685565b611a05826115b0565b815260208201356001600160401b03811115611a2057600080fd5b611a2c368285016116fa565b60208301525060408201356001600160401b03811115611a4b57600080fd5b611a57368285016116fa565b60408301525060608201356001600160401b03811115611a7657600080fd5b611a8236828501611874565b606083015250611a9460808301611844565b6080820152611aa560a08301611983565b60a0820152611ab660c08301611869565b60c0820152855250602093840193016119c3565b509095945050505050565b60005b83811015611af0578181015183820152602001611ad8565b50506000910152565b600082516115d6818460208701611ad5565b600060208284031215611b1d57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b80820180821115611b4d57611b4d611b24565b92915050565b6000808335601e19843603018112611b6a57600080fd5b8301803591506001600160401b03821115611b8457600080fd5b60200191503681900382131561163f57600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b0386168152606060208201819052600090611be79083018688611b99565b8281036040840152611bfa818587611b99565b98975050505050505050565b60008151808452611c1e816020860160208601611ad5565b601f01601f19169290920160200192915050565b60018060a01b0385168152836020820152608060408201526000611c596080830185611c06565b905060028310611c7957634e487b7160e01b600052602160045260246000fd5b82606083015295945050505050565b600060208284031215611c9a57600080fd5b81516115748161185b565b6001600160a01b039586168152602081019490945260408401929092529092166060820152608081019190915260a00190565b600060208284031215611cea57600080fd5b81516115748161157b565b634e487b7160e01b600052603260045260246000fd5b600082825180855260208501945060208160051b8301016020850160005b83811015611d5b57601f19858403018852611d45838351611c06565b6020988901989093509190910190600101611d29565b50909695505050505050565b604081526000611d7a6040830185611d0b565b8281036020840152611d8c8185611d0b565b95945050505050565b600060208284031215611da757600080fd5b81356115748161185b565b89815260e060208201526000611dcc60e083018a8c611b99565b60ff891660408401526001600160a01b0388811660608501528716608084015285151560a084015282810360c0840152611e07818587611b99565b9c9b505050505050505050505050565b6020815260006115746020830184611c06565b6001600160a01b0384168152606060208201819052600090611e4e90830185611c06565b9050826040830152949350505050565b600060018201611e7057611e70611b24565b5060010190565b634e487b7160e01b600052601260045260246000fd5b600082611e9c57611e9c611e77565b500490565b81810381811115611b4d57611b4d611b24565b600082611ec357611ec3611e77565b500690565b60018060a01b038616815284602082015260a060408201526000611eef60a0830186611c06565b8281036060840152611f018186611c06565b9150508260808301529695505050505050565b87815260e060208201526000611f2d60e0830189611c06565b63ffffffff881660408401526001600160a01b0387811660608501528616608084015284151560a084015282810360c0840152611f6a8185611c06565b9a9950505050505050505050565b6000604082016001600160801b03851683526040602084015280845180835260608501915060208601925060005b81811015611d5b5783516001600160a01b0316835260209384019390920191600101611fa6565b81516001600160a01b0390811682526020808401518216908301526040808401516001600160801b03169083015260608084015191821690830152610160820190506080830151612022608084018215159052565b5060a083015161203660a084018215159052565b5060c083015161207560c084018264ffffffffff815116825264ffffffffff602082015116602083015264ffffffffff60408201511660408301525050565b5060e0929092015180516001600160a01b0316610120830152602001516101409091015290565b600083516120ae818460208801611ad5565b601d60f91b90830190815283516120cc816001840160208801611ad5565b0160010194935050505056fe5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b5072a26469706673582212200934c93692d281e9d89ed2e17022e289297dd78e723d3ba32c6645f05d3b8df864736f6c634300081c0033", "devdoc": { "kind": "dev", "methods": { diff --git a/deployments/optimism/DecentHatsModificationModule.json b/deployments/optimism/DecentHatsModificationModule.json index 808345e..c7a365c 100644 --- a/deployments/optimism/DecentHatsModificationModule.json +++ b/deployments/optimism/DecentHatsModificationModule.json @@ -1,5 +1,5 @@ { - "address": "0x1aFEB80Bf1c6a3a77ecdc97Cff5eB8B24B843D72", + "address": "0xC2b11836723C621a22A43ace8616Cb21c4c9ddd5", "abi": [ { "inputs": [], @@ -43,6 +43,11 @@ "name": "topHatAccount", "type": "address" }, + { + "internalType": "address", + "name": "keyValuePairs", + "type": "address" + }, { "internalType": "contract IHatsModuleFactory", "name": "hatsModuleFactory", @@ -183,32 +188,32 @@ "type": "function" } ], - "transactionHash": "0xc62208972d1260a2f54b43aa6f5535e1e91f014f6abd88c723c6a7b5031e5f62", + "transactionHash": "0x46c62de0264f214d74b3057532cb8b953989d5fa88e2e1421b72105a01de04b2", "receipt": { "to": null, "from": "0xb5Ca125166C1987A35EDD550E16846Fa1e1D9bB3", - "contractAddress": "0x1aFEB80Bf1c6a3a77ecdc97Cff5eB8B24B843D72", - "transactionIndex": 5, - "gasUsed": "1061522", + "contractAddress": "0xC2b11836723C621a22A43ace8616Cb21c4c9ddd5", + "transactionIndex": 10, + "gasUsed": "1316194", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x8998c7031bf93736d72edb295d53c8bd3f5493add4dafacc405e277496700f3e", - "transactionHash": "0xc62208972d1260a2f54b43aa6f5535e1e91f014f6abd88c723c6a7b5031e5f62", + "blockHash": "0x9f0a2fd4e83b14e15060853e777e751bd0818f93750080ba31937d4f31ba4427", + "transactionHash": "0x46c62de0264f214d74b3057532cb8b953989d5fa88e2e1421b72105a01de04b2", "logs": [], - "blockNumber": 127617814, - "cumulativeGasUsed": "1658082", + "blockNumber": 128342615, + "cumulativeGasUsed": "3183185", "status": 1, "byzantium": true }, "args": [], - "numDeployments": 1, - "solcInputHash": "e3ec7808efccf5e6b24e16a29ead3983", - "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"SALT\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"contract IHats\",\"name\":\"hatsProtocol\",\"type\":\"address\"},{\"internalType\":\"contract IERC6551Registry\",\"name\":\"erc6551Registry\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"hatsAccountImplementation\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"topHatId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"topHatAccount\",\"type\":\"address\"},{\"internalType\":\"contract IHatsModuleFactory\",\"name\":\"hatsModuleFactory\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"hatsElectionsEligibilityImplementation\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"adminHatId\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"wearer\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"details\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"imageURI\",\"type\":\"string\"},{\"components\":[{\"internalType\":\"contract ISablierV2LockupLinear\",\"name\":\"sablier\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint40\",\"name\":\"start\",\"type\":\"uint40\"},{\"internalType\":\"uint40\",\"name\":\"cliff\",\"type\":\"uint40\"},{\"internalType\":\"uint40\",\"name\":\"end\",\"type\":\"uint40\"}],\"internalType\":\"struct LockupLinear.Timestamps\",\"name\":\"timestamps\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"UD60x18\",\"name\":\"fee\",\"type\":\"uint256\"}],\"internalType\":\"struct Broker\",\"name\":\"broker\",\"type\":\"tuple\"},{\"internalType\":\"uint128\",\"name\":\"totalAmount\",\"type\":\"uint128\"},{\"internalType\":\"bool\",\"name\":\"cancelable\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"transferable\",\"type\":\"bool\"}],\"internalType\":\"struct DecentHatsModuleUtils.SablierStreamParams[]\",\"name\":\"sablierStreamsParams\",\"type\":\"tuple[]\"},{\"internalType\":\"uint128\",\"name\":\"termEndDateTs\",\"type\":\"uint128\"},{\"internalType\":\"uint32\",\"name\":\"maxSupply\",\"type\":\"uint32\"},{\"internalType\":\"bool\",\"name\":\"isMutable\",\"type\":\"bool\"}],\"internalType\":\"struct DecentHatsModuleUtils.HatParams[]\",\"name\":\"hats\",\"type\":\"tuple[]\"}],\"internalType\":\"struct DecentHatsModuleUtils.CreateRoleHatsParams\",\"name\":\"roleHatsParams\",\"type\":\"tuple\"}],\"name\":\"createRoleHats\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"createRoleHats((address,address,address,uint256,address,address,address,uint256,(address,string,string,(address,address,address,(uint40,uint40,uint40),(address,uint256),uint128,bool,bool)[],uint128,uint32,bool)[]))\":{\"details\":\"Stream funds on untermed Roles are targeted at the hat's smart account. In order to withdraw funds from the stream, the hat's smart account must be the one call to `withdraw-` on the Sablier contract, setting the recipient arg to its wearer.Stream funds on termed Roles are targeted directly at the nominated wearer. The wearer should directly call `withdraw-` on the Sablier contract.Role hat creation, minting, smart account creation and stream creation are handled here in order to avoid a race condition where not more than one active proposal to create a new role can exist at a time. See: https://github.com/decentdao/decent-interface/issues/2402\",\"params\":{\"roleHatsParams\":\"An array of params for each role hat to be created.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"createRoleHats((address,address,address,uint256,address,address,address,uint256,(address,string,string,(address,address,address,(uint40,uint40,uint40),(address,uint256),uint128,bool,bool)[],uint128,uint32,bool)[]))\":{\"notice\":\"Creates a new termed or untermed role hat and any streams on it.This contract should be enabled a module on the Safe for which the role is to be created, and disabled after.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/modules/DecentHatsModificationModule.sol\":\"DecentHatsModificationModule\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\npragma solidity >=0.7.0 <0.9.0;\\n\\n/// @title Enum - Collection of enums\\n/// @author Richard Meissner - \\ncontract Enum {\\n enum Operation {Call, DelegateCall}\\n}\\n\",\"keccak256\":\"0x473e45b1a5cc47be494b0e123c9127f0c11c1e0992a321ae5a644c0bfdb2c14f\",\"license\":\"LGPL-3.0-only\"},\"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\n\\n/// @title Zodiac Avatar - A contract that manages modules that can execute transactions via this contract.\\npragma solidity >=0.7.0 <0.9.0;\\n\\nimport \\\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\\\";\\n\\ninterface IAvatar {\\n event EnabledModule(address module);\\n event DisabledModule(address module);\\n event ExecutionFromModuleSuccess(address indexed module);\\n event ExecutionFromModuleFailure(address indexed module);\\n\\n /// @dev Enables a module on the avatar.\\n /// @notice Can only be called by the avatar.\\n /// @notice Modules should be stored as a linked list.\\n /// @notice Must emit EnabledModule(address module) if successful.\\n /// @param module Module to be enabled.\\n function enableModule(address module) external;\\n\\n /// @dev Disables a module on the avatar.\\n /// @notice Can only be called by the avatar.\\n /// @notice Must emit DisabledModule(address module) if successful.\\n /// @param prevModule Address that pointed to the module to be removed in the linked list\\n /// @param module Module to be removed.\\n function disableModule(address prevModule, address module) external;\\n\\n /// @dev Allows a Module to execute a transaction.\\n /// @notice Can only be called by an enabled module.\\n /// @notice Must emit ExecutionFromModuleSuccess(address module) if successful.\\n /// @notice Must emit ExecutionFromModuleFailure(address module) if unsuccessful.\\n /// @param to Destination address of module transaction.\\n /// @param value Ether value of module transaction.\\n /// @param data Data payload of module transaction.\\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\\n function execTransactionFromModule(\\n address to,\\n uint256 value,\\n bytes memory data,\\n Enum.Operation operation\\n ) external returns (bool success);\\n\\n /// @dev Allows a Module to execute a transaction and return data\\n /// @notice Can only be called by an enabled module.\\n /// @notice Must emit ExecutionFromModuleSuccess(address module) if successful.\\n /// @notice Must emit ExecutionFromModuleFailure(address module) if unsuccessful.\\n /// @param to Destination address of module transaction.\\n /// @param value Ether value of module transaction.\\n /// @param data Data payload of module transaction.\\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\\n function execTransactionFromModuleReturnData(\\n address to,\\n uint256 value,\\n bytes memory data,\\n Enum.Operation operation\\n ) external returns (bool success, bytes memory returnData);\\n\\n /// @dev Returns if an module is enabled\\n /// @return True if the module is enabled\\n function isModuleEnabled(address module) external view returns (bool);\\n\\n /// @dev Returns array of modules.\\n /// @param start Start of the page.\\n /// @param pageSize Maximum number of modules that should be returned.\\n /// @return array Array of modules.\\n /// @return next Start of the next page.\\n function getModulesPaginated(address start, uint256 pageSize)\\n external\\n view\\n returns (address[] memory array, address next);\\n}\\n\",\"keccak256\":\"0xcd5508ffe596eef8fbccfd5fc4f10a34397773547ce64e212d48b5212865ec1f\",\"license\":\"LGPL-3.0-only\"},\"@openzeppelin/contracts/interfaces/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/introspection/IERC165.sol\\\";\\n\",\"keccak256\":\"0xd04b0f06e0666f29cf7cccc82894de541e19bb30a765b107b1e40bb7fe5f7d7a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev 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 amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `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 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes calldata data\\n ) external;\\n\\n /**\\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 {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the caller.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool _approved) external;\\n\\n /**\\n * @dev Returns 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\",\"keccak256\":\"0xed6a749c5373af398105ce6ee3ac4763aa450ea7285d268c85d9eeca809cdb1f\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../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\",\"keccak256\":\"0x75b829ff2f26c14355d1cba20e16fe7b29ca58eb5fef665ede48bc0f9c6c74b9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"@prb/math/src/Common.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\n// Common.sol\\n//\\n// Common mathematical functions used in both SD59x18 and UD60x18. Note that these global functions do not\\n// always operate with SD59x18 and UD60x18 numbers.\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CUSTOM ERRORS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @notice Thrown when the resultant value in {mulDiv} overflows uint256.\\nerror PRBMath_MulDiv_Overflow(uint256 x, uint256 y, uint256 denominator);\\n\\n/// @notice Thrown when the resultant value in {mulDiv18} overflows uint256.\\nerror PRBMath_MulDiv18_Overflow(uint256 x, uint256 y);\\n\\n/// @notice Thrown when one of the inputs passed to {mulDivSigned} is `type(int256).min`.\\nerror PRBMath_MulDivSigned_InputTooSmall();\\n\\n/// @notice Thrown when the resultant value in {mulDivSigned} overflows int256.\\nerror PRBMath_MulDivSigned_Overflow(int256 x, int256 y);\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CONSTANTS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @dev The maximum value a uint128 number can have.\\nuint128 constant MAX_UINT128 = type(uint128).max;\\n\\n/// @dev The maximum value a uint40 number can have.\\nuint40 constant MAX_UINT40 = type(uint40).max;\\n\\n/// @dev The unit number, which the decimal precision of the fixed-point types.\\nuint256 constant UNIT = 1e18;\\n\\n/// @dev The unit number inverted mod 2^256.\\nuint256 constant UNIT_INVERSE = 78156646155174841979727994598816262306175212592076161876661_508869554232690281;\\n\\n/// @dev The the largest power of two that divides the decimal value of `UNIT`. The logarithm of this value is the least significant\\n/// bit in the binary representation of `UNIT`.\\nuint256 constant UNIT_LPOTD = 262144;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @notice Calculates the binary exponent of x using the binary fraction method.\\n/// @dev Has to use 192.64-bit fixed-point numbers. See https://ethereum.stackexchange.com/a/96594/24693.\\n/// @param x The exponent as an unsigned 192.64-bit fixed-point number.\\n/// @return result The result as an unsigned 60.18-decimal fixed-point number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp2(uint256 x) pure returns (uint256 result) {\\n unchecked {\\n // Start from 0.5 in the 192.64-bit fixed-point format.\\n result = 0x800000000000000000000000000000000000000000000000;\\n\\n // The following logic multiplies the result by $\\\\sqrt{2^{-i}}$ when the bit at position i is 1. Key points:\\n //\\n // 1. Intermediate results will not overflow, as the starting point is 2^191 and all magic factors are under 2^65.\\n // 2. The rationale for organizing the if statements into groups of 8 is gas savings. If the result of performing\\n // a bitwise AND operation between x and any value in the array [0x80; 0x40; 0x20; 0x10; 0x08; 0x04; 0x02; 0x01] is 1,\\n // we know that `x & 0xFF` is also 1.\\n if (x & 0xFF00000000000000 > 0) {\\n if (x & 0x8000000000000000 > 0) {\\n result = (result * 0x16A09E667F3BCC909) >> 64;\\n }\\n if (x & 0x4000000000000000 > 0) {\\n result = (result * 0x1306FE0A31B7152DF) >> 64;\\n }\\n if (x & 0x2000000000000000 > 0) {\\n result = (result * 0x1172B83C7D517ADCE) >> 64;\\n }\\n if (x & 0x1000000000000000 > 0) {\\n result = (result * 0x10B5586CF9890F62A) >> 64;\\n }\\n if (x & 0x800000000000000 > 0) {\\n result = (result * 0x1059B0D31585743AE) >> 64;\\n }\\n if (x & 0x400000000000000 > 0) {\\n result = (result * 0x102C9A3E778060EE7) >> 64;\\n }\\n if (x & 0x200000000000000 > 0) {\\n result = (result * 0x10163DA9FB33356D8) >> 64;\\n }\\n if (x & 0x100000000000000 > 0) {\\n result = (result * 0x100B1AFA5ABCBED61) >> 64;\\n }\\n }\\n\\n if (x & 0xFF000000000000 > 0) {\\n if (x & 0x80000000000000 > 0) {\\n result = (result * 0x10058C86DA1C09EA2) >> 64;\\n }\\n if (x & 0x40000000000000 > 0) {\\n result = (result * 0x1002C605E2E8CEC50) >> 64;\\n }\\n if (x & 0x20000000000000 > 0) {\\n result = (result * 0x100162F3904051FA1) >> 64;\\n }\\n if (x & 0x10000000000000 > 0) {\\n result = (result * 0x1000B175EFFDC76BA) >> 64;\\n }\\n if (x & 0x8000000000000 > 0) {\\n result = (result * 0x100058BA01FB9F96D) >> 64;\\n }\\n if (x & 0x4000000000000 > 0) {\\n result = (result * 0x10002C5CC37DA9492) >> 64;\\n }\\n if (x & 0x2000000000000 > 0) {\\n result = (result * 0x1000162E525EE0547) >> 64;\\n }\\n if (x & 0x1000000000000 > 0) {\\n result = (result * 0x10000B17255775C04) >> 64;\\n }\\n }\\n\\n if (x & 0xFF0000000000 > 0) {\\n if (x & 0x800000000000 > 0) {\\n result = (result * 0x1000058B91B5BC9AE) >> 64;\\n }\\n if (x & 0x400000000000 > 0) {\\n result = (result * 0x100002C5C89D5EC6D) >> 64;\\n }\\n if (x & 0x200000000000 > 0) {\\n result = (result * 0x10000162E43F4F831) >> 64;\\n }\\n if (x & 0x100000000000 > 0) {\\n result = (result * 0x100000B1721BCFC9A) >> 64;\\n }\\n if (x & 0x80000000000 > 0) {\\n result = (result * 0x10000058B90CF1E6E) >> 64;\\n }\\n if (x & 0x40000000000 > 0) {\\n result = (result * 0x1000002C5C863B73F) >> 64;\\n }\\n if (x & 0x20000000000 > 0) {\\n result = (result * 0x100000162E430E5A2) >> 64;\\n }\\n if (x & 0x10000000000 > 0) {\\n result = (result * 0x1000000B172183551) >> 64;\\n }\\n }\\n\\n if (x & 0xFF00000000 > 0) {\\n if (x & 0x8000000000 > 0) {\\n result = (result * 0x100000058B90C0B49) >> 64;\\n }\\n if (x & 0x4000000000 > 0) {\\n result = (result * 0x10000002C5C8601CC) >> 64;\\n }\\n if (x & 0x2000000000 > 0) {\\n result = (result * 0x1000000162E42FFF0) >> 64;\\n }\\n if (x & 0x1000000000 > 0) {\\n result = (result * 0x10000000B17217FBB) >> 64;\\n }\\n if (x & 0x800000000 > 0) {\\n result = (result * 0x1000000058B90BFCE) >> 64;\\n }\\n if (x & 0x400000000 > 0) {\\n result = (result * 0x100000002C5C85FE3) >> 64;\\n }\\n if (x & 0x200000000 > 0) {\\n result = (result * 0x10000000162E42FF1) >> 64;\\n }\\n if (x & 0x100000000 > 0) {\\n result = (result * 0x100000000B17217F8) >> 64;\\n }\\n }\\n\\n if (x & 0xFF000000 > 0) {\\n if (x & 0x80000000 > 0) {\\n result = (result * 0x10000000058B90BFC) >> 64;\\n }\\n if (x & 0x40000000 > 0) {\\n result = (result * 0x1000000002C5C85FE) >> 64;\\n }\\n if (x & 0x20000000 > 0) {\\n result = (result * 0x100000000162E42FF) >> 64;\\n }\\n if (x & 0x10000000 > 0) {\\n result = (result * 0x1000000000B17217F) >> 64;\\n }\\n if (x & 0x8000000 > 0) {\\n result = (result * 0x100000000058B90C0) >> 64;\\n }\\n if (x & 0x4000000 > 0) {\\n result = (result * 0x10000000002C5C860) >> 64;\\n }\\n if (x & 0x2000000 > 0) {\\n result = (result * 0x1000000000162E430) >> 64;\\n }\\n if (x & 0x1000000 > 0) {\\n result = (result * 0x10000000000B17218) >> 64;\\n }\\n }\\n\\n if (x & 0xFF0000 > 0) {\\n if (x & 0x800000 > 0) {\\n result = (result * 0x1000000000058B90C) >> 64;\\n }\\n if (x & 0x400000 > 0) {\\n result = (result * 0x100000000002C5C86) >> 64;\\n }\\n if (x & 0x200000 > 0) {\\n result = (result * 0x10000000000162E43) >> 64;\\n }\\n if (x & 0x100000 > 0) {\\n result = (result * 0x100000000000B1721) >> 64;\\n }\\n if (x & 0x80000 > 0) {\\n result = (result * 0x10000000000058B91) >> 64;\\n }\\n if (x & 0x40000 > 0) {\\n result = (result * 0x1000000000002C5C8) >> 64;\\n }\\n if (x & 0x20000 > 0) {\\n result = (result * 0x100000000000162E4) >> 64;\\n }\\n if (x & 0x10000 > 0) {\\n result = (result * 0x1000000000000B172) >> 64;\\n }\\n }\\n\\n if (x & 0xFF00 > 0) {\\n if (x & 0x8000 > 0) {\\n result = (result * 0x100000000000058B9) >> 64;\\n }\\n if (x & 0x4000 > 0) {\\n result = (result * 0x10000000000002C5D) >> 64;\\n }\\n if (x & 0x2000 > 0) {\\n result = (result * 0x1000000000000162E) >> 64;\\n }\\n if (x & 0x1000 > 0) {\\n result = (result * 0x10000000000000B17) >> 64;\\n }\\n if (x & 0x800 > 0) {\\n result = (result * 0x1000000000000058C) >> 64;\\n }\\n if (x & 0x400 > 0) {\\n result = (result * 0x100000000000002C6) >> 64;\\n }\\n if (x & 0x200 > 0) {\\n result = (result * 0x10000000000000163) >> 64;\\n }\\n if (x & 0x100 > 0) {\\n result = (result * 0x100000000000000B1) >> 64;\\n }\\n }\\n\\n if (x & 0xFF > 0) {\\n if (x & 0x80 > 0) {\\n result = (result * 0x10000000000000059) >> 64;\\n }\\n if (x & 0x40 > 0) {\\n result = (result * 0x1000000000000002C) >> 64;\\n }\\n if (x & 0x20 > 0) {\\n result = (result * 0x10000000000000016) >> 64;\\n }\\n if (x & 0x10 > 0) {\\n result = (result * 0x1000000000000000B) >> 64;\\n }\\n if (x & 0x8 > 0) {\\n result = (result * 0x10000000000000006) >> 64;\\n }\\n if (x & 0x4 > 0) {\\n result = (result * 0x10000000000000003) >> 64;\\n }\\n if (x & 0x2 > 0) {\\n result = (result * 0x10000000000000001) >> 64;\\n }\\n if (x & 0x1 > 0) {\\n result = (result * 0x10000000000000001) >> 64;\\n }\\n }\\n\\n // In the code snippet below, two operations are executed simultaneously:\\n //\\n // 1. The result is multiplied by $(2^n + 1)$, where $2^n$ represents the integer part, and the additional 1\\n // accounts for the initial guess of 0.5. This is achieved by subtracting from 191 instead of 192.\\n // 2. The result is then converted to an unsigned 60.18-decimal fixed-point format.\\n //\\n // The underlying logic is based on the relationship $2^{191-ip} = 2^{ip} / 2^{191}$, where $ip$ denotes the,\\n // integer part, $2^n$.\\n result *= UNIT;\\n result >>= (191 - (x >> 64));\\n }\\n}\\n\\n/// @notice Finds the zero-based index of the first 1 in the binary representation of x.\\n///\\n/// @dev See the note on \\\"msb\\\" in this Wikipedia article: https://en.wikipedia.org/wiki/Find_first_set\\n///\\n/// Each step in this implementation is equivalent to this high-level code:\\n///\\n/// ```solidity\\n/// if (x >= 2 ** 128) {\\n/// x >>= 128;\\n/// result += 128;\\n/// }\\n/// ```\\n///\\n/// Where 128 is replaced with each respective power of two factor. See the full high-level implementation here:\\n/// https://gist.github.com/PaulRBerg/f932f8693f2733e30c4d479e8e980948\\n///\\n/// The Yul instructions used below are:\\n///\\n/// - \\\"gt\\\" is \\\"greater than\\\"\\n/// - \\\"or\\\" is the OR bitwise operator\\n/// - \\\"shl\\\" is \\\"shift left\\\"\\n/// - \\\"shr\\\" is \\\"shift right\\\"\\n///\\n/// @param x The uint256 number for which to find the index of the most significant bit.\\n/// @return result The index of the most significant bit as a uint256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction msb(uint256 x) pure returns (uint256 result) {\\n // 2^128\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(7, gt(x, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^64\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(6, gt(x, 0xFFFFFFFFFFFFFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^32\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(5, gt(x, 0xFFFFFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^16\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(4, gt(x, 0xFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^8\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(3, gt(x, 0xFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^4\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(2, gt(x, 0xF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^2\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(1, gt(x, 0x3))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^1\\n // No need to shift x any more.\\n assembly (\\\"memory-safe\\\") {\\n let factor := gt(x, 0x1)\\n result := or(result, factor)\\n }\\n}\\n\\n/// @notice Calculates x*y\\u00f7denominator with 512-bit precision.\\n///\\n/// @dev Credits to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv.\\n///\\n/// Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - The denominator must not be zero.\\n/// - The result must fit in uint256.\\n///\\n/// @param x The multiplicand as a uint256.\\n/// @param y The multiplier as a uint256.\\n/// @param denominator The divisor as a uint256.\\n/// @return result The result as a uint256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mulDiv(uint256 x, uint256 y, uint256 denominator) pure returns (uint256 result) {\\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; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly (\\\"memory-safe\\\") {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\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 unchecked {\\n return prod0 / denominator;\\n }\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n if (prod1 >= denominator) {\\n revert PRBMath_MulDiv_Overflow(x, y, denominator);\\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 (\\\"memory-safe\\\") {\\n // Compute remainder using the mulmod Yul instruction.\\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 unchecked {\\n // Calculate the largest power of two divisor of the denominator using the unary operator ~. This operation cannot overflow\\n // because the denominator cannot be zero at this point in the function execution. The result is always >= 1.\\n // For more detail, see https://cs.stackexchange.com/q/138556/92363.\\n uint256 lpotdod = denominator & (~denominator + 1);\\n uint256 flippedLpotdod;\\n\\n assembly (\\\"memory-safe\\\") {\\n // Factor powers of two out of denominator.\\n denominator := div(denominator, lpotdod)\\n\\n // Divide [prod1 prod0] by lpotdod.\\n prod0 := div(prod0, lpotdod)\\n\\n // Get the flipped value `2^256 / lpotdod`. If the `lpotdod` is zero, the flipped value is one.\\n // `sub(0, lpotdod)` produces the two's complement version of `lpotdod`, which is equivalent to flipping all the bits.\\n // However, `div` interprets this value as an unsigned value: https://ethereum.stackexchange.com/q/147168/24693\\n flippedLpotdod := add(div(sub(0, lpotdod), lpotdod), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * flippedLpotdod;\\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 works\\n // 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 }\\n}\\n\\n/// @notice Calculates x*y\\u00f71e18 with 512-bit precision.\\n///\\n/// @dev A variant of {mulDiv} with constant folding, i.e. in which the denominator is hard coded to 1e18.\\n///\\n/// Notes:\\n/// - The body is purposely left uncommented; to understand how this works, see the documentation in {mulDiv}.\\n/// - The result is rounded toward zero.\\n/// - We take as an axiom that the result cannot be `MAX_UINT256` when x and y solve the following system of equations:\\n///\\n/// $$\\n/// \\\\begin{cases}\\n/// x * y = MAX\\\\_UINT256 * UNIT \\\\\\\\\\n/// (x * y) \\\\% UNIT \\\\geq \\\\frac{UNIT}{2}\\n/// \\\\end{cases}\\n/// $$\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {mulDiv}.\\n/// - The result must fit in uint256.\\n///\\n/// @param x The multiplicand as an unsigned 60.18-decimal fixed-point number.\\n/// @param y The multiplier as an unsigned 60.18-decimal fixed-point number.\\n/// @return result The result as an unsigned 60.18-decimal fixed-point number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mulDiv18(uint256 x, uint256 y) pure returns (uint256 result) {\\n uint256 prod0;\\n uint256 prod1;\\n assembly (\\\"memory-safe\\\") {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n if (prod1 == 0) {\\n unchecked {\\n return prod0 / UNIT;\\n }\\n }\\n\\n if (prod1 >= UNIT) {\\n revert PRBMath_MulDiv18_Overflow(x, y);\\n }\\n\\n uint256 remainder;\\n assembly (\\\"memory-safe\\\") {\\n remainder := mulmod(x, y, UNIT)\\n result :=\\n mul(\\n or(\\n div(sub(prod0, remainder), UNIT_LPOTD),\\n mul(sub(prod1, gt(remainder, prod0)), add(div(sub(0, UNIT_LPOTD), UNIT_LPOTD), 1))\\n ),\\n UNIT_INVERSE\\n )\\n }\\n}\\n\\n/// @notice Calculates x*y\\u00f7denominator with 512-bit precision.\\n///\\n/// @dev This is an extension of {mulDiv} for signed numbers, which works by computing the signs and the absolute values separately.\\n///\\n/// Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {mulDiv}.\\n/// - None of the inputs can be `type(int256).min`.\\n/// - The result must fit in int256.\\n///\\n/// @param x The multiplicand as an int256.\\n/// @param y The multiplier as an int256.\\n/// @param denominator The divisor as an int256.\\n/// @return result The result as an int256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mulDivSigned(int256 x, int256 y, int256 denominator) pure returns (int256 result) {\\n if (x == type(int256).min || y == type(int256).min || denominator == type(int256).min) {\\n revert PRBMath_MulDivSigned_InputTooSmall();\\n }\\n\\n // Get hold of the absolute values of x, y and the denominator.\\n uint256 xAbs;\\n uint256 yAbs;\\n uint256 dAbs;\\n unchecked {\\n xAbs = x < 0 ? uint256(-x) : uint256(x);\\n yAbs = y < 0 ? uint256(-y) : uint256(y);\\n dAbs = denominator < 0 ? uint256(-denominator) : uint256(denominator);\\n }\\n\\n // Compute the absolute value of x*y\\u00f7denominator. The result must fit in int256.\\n uint256 resultAbs = mulDiv(xAbs, yAbs, dAbs);\\n if (resultAbs > uint256(type(int256).max)) {\\n revert PRBMath_MulDivSigned_Overflow(x, y);\\n }\\n\\n // Get the signs of x, y and the denominator.\\n uint256 sx;\\n uint256 sy;\\n uint256 sd;\\n assembly (\\\"memory-safe\\\") {\\n // \\\"sgt\\\" is the \\\"signed greater than\\\" assembly instruction and \\\"sub(0,1)\\\" is -1 in two's complement.\\n sx := sgt(x, sub(0, 1))\\n sy := sgt(y, sub(0, 1))\\n sd := sgt(denominator, sub(0, 1))\\n }\\n\\n // XOR over sx, sy and sd. What this does is to check whether there are 1 or 3 negative signs in the inputs.\\n // If there are, the result should be negative. Otherwise, it should be positive.\\n unchecked {\\n result = sx ^ sy ^ sd == 0 ? -int256(resultAbs) : int256(resultAbs);\\n }\\n}\\n\\n/// @notice Calculates the square root of x using the Babylonian method.\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\\n///\\n/// Notes:\\n/// - If x is not a perfect square, the result is rounded down.\\n/// - Credits to OpenZeppelin for the explanations in comments below.\\n///\\n/// @param x The uint256 number for which to calculate the square root.\\n/// @return result The result as a uint256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction sqrt(uint256 x) pure returns (uint256 result) {\\n if (x == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we calculate the biggest power of 2 which is smaller than the square root of x.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of x is a power of 2 such that we have:\\n //\\n // $$\\n // msb(x) <= x <= 2*msb(x)$\\n // $$\\n //\\n // We write $msb(x)$ as $2^k$, and we get:\\n //\\n // $$\\n // k = log_2(x)\\n // $$\\n //\\n // Thus, we can write the initial inequality as:\\n //\\n // $$\\n // 2^{log_2(x)} <= x <= 2*2^{log_2(x)+1} \\\\\\\\\\n // sqrt(2^k) <= sqrt(x) < sqrt(2^{k+1}) \\\\\\\\\\n // 2^{k/2} <= sqrt(x) < 2^{(k+1)/2} <= 2^{(k/2)+1}\\n // $$\\n //\\n // Consequently, $2^{log_2(x) /2} is a good first approximation of sqrt(x) with at least one correct bit.\\n uint256 xAux = uint256(x);\\n result = 1;\\n if (xAux >= 2 ** 128) {\\n xAux >>= 128;\\n result <<= 64;\\n }\\n if (xAux >= 2 ** 64) {\\n xAux >>= 64;\\n result <<= 32;\\n }\\n if (xAux >= 2 ** 32) {\\n xAux >>= 32;\\n result <<= 16;\\n }\\n if (xAux >= 2 ** 16) {\\n xAux >>= 16;\\n result <<= 8;\\n }\\n if (xAux >= 2 ** 8) {\\n xAux >>= 8;\\n result <<= 4;\\n }\\n if (xAux >= 2 ** 4) {\\n xAux >>= 4;\\n result <<= 2;\\n }\\n if (xAux >= 2 ** 2) {\\n result <<= 1;\\n }\\n\\n // At this point, `result` is an estimation with at least one bit of precision. We know the true value has at\\n // most 128 bits, since it is the square root of a uint256. Newton's method converges quadratically (precision\\n // doubles at every iteration). We thus need at most 7 iteration to turn our partial result with one bit of\\n // precision into the expected uint128 result.\\n unchecked {\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n\\n // If x is not a perfect square, round the result toward zero.\\n uint256 roundedResult = x / result;\\n if (result >= roundedResult) {\\n result = roundedResult;\\n }\\n }\\n}\\n\",\"keccak256\":\"0xaa374e2c26cc93e8c22a6953804ee05f811597ef5fa82f76824378b22944778b\",\"license\":\"MIT\"},\"@prb/math/src/UD2x18.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\n/*\\n\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2550\\u2550\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2554\\u2588\\u2588\\u2588\\u2588\\u2554\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551 \\u255a\\u2550\\u255d \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\n\\n\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2550\\u2550\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d \\u255a\\u2588\\u2588\\u2588\\u2554\\u255d \\u255a\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u255d\\n\\n*/\\n\\nimport \\\"./ud2x18/Casting.sol\\\";\\nimport \\\"./ud2x18/Constants.sol\\\";\\nimport \\\"./ud2x18/Errors.sol\\\";\\nimport \\\"./ud2x18/ValueType.sol\\\";\\n\",\"keccak256\":\"0xfb624e24cd8bb790fa08e7827819de85504a86e20e961fa4ad126c65b6d90641\",\"license\":\"MIT\"},\"@prb/math/src/UD60x18.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\n/*\\n\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2550\\u2550\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2554\\u2588\\u2588\\u2588\\u2588\\u2554\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551 \\u255a\\u2550\\u255d \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\n\\n\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2550\\u2588\\u2588\\u2588\\u2588\\u2557\\u255a\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2588\\u2588\\u2551 \\u255a\\u2588\\u2588\\u2588\\u2554\\u255d \\u255a\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2554\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2554\\u255d \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u255d\\n\\n*/\\n\\nimport \\\"./ud60x18/Casting.sol\\\";\\nimport \\\"./ud60x18/Constants.sol\\\";\\nimport \\\"./ud60x18/Conversions.sol\\\";\\nimport \\\"./ud60x18/Errors.sol\\\";\\nimport \\\"./ud60x18/Helpers.sol\\\";\\nimport \\\"./ud60x18/Math.sol\\\";\\nimport \\\"./ud60x18/ValueType.sol\\\";\\n\",\"keccak256\":\"0xb98c6f74275914d279e8af6c502c2b1f50d5f6e1ed418d3b0153f5a193206c48\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as CastingErrors;\\nimport { SD59x18 } from \\\"../sd59x18/ValueType.sol\\\";\\nimport { UD2x18 } from \\\"../ud2x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"../ud60x18/ValueType.sol\\\";\\nimport { SD1x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts an SD1x18 number into SD59x18.\\n/// @dev There is no overflow check because the domain of SD1x18 is a subset of SD59x18.\\nfunction intoSD59x18(SD1x18 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(int256(SD1x18.unwrap(x)));\\n}\\n\\n/// @notice Casts an SD1x18 number into UD2x18.\\n/// - x must be positive.\\nfunction intoUD2x18(SD1x18 x) pure returns (UD2x18 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUD2x18_Underflow(x);\\n }\\n result = UD2x18.wrap(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into UD60x18.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUD60x18(SD1x18 x) pure returns (UD60x18 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUD60x18_Underflow(x);\\n }\\n result = UD60x18.wrap(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into uint256.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUint256(SD1x18 x) pure returns (uint256 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint256_Underflow(x);\\n }\\n result = uint256(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into uint128.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUint128(SD1x18 x) pure returns (uint128 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint128_Underflow(x);\\n }\\n result = uint128(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(SD1x18 x) pure returns (uint40 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint40_Underflow(x);\\n }\\n if (xInt > int64(uint64(Common.MAX_UINT40))) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint40_Overflow(x);\\n }\\n result = uint40(uint64(xInt));\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction sd1x18(int64 x) pure returns (SD1x18 result) {\\n result = SD1x18.wrap(x);\\n}\\n\\n/// @notice Unwraps an SD1x18 number into int64.\\nfunction unwrap(SD1x18 x) pure returns (int64 result) {\\n result = SD1x18.unwrap(x);\\n}\\n\\n/// @notice Wraps an int64 number into SD1x18.\\nfunction wrap(int64 x) pure returns (SD1x18 result) {\\n result = SD1x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x9e49e2b37c1bb845861740805edaaef3fe951a7b96eef16ce84fbf76e8278670\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD1x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @dev Euler's number as an SD1x18 number.\\nSD1x18 constant E = SD1x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum value an SD1x18 number can have.\\nint64 constant uMAX_SD1x18 = 9_223372036854775807;\\nSD1x18 constant MAX_SD1x18 = SD1x18.wrap(uMAX_SD1x18);\\n\\n/// @dev The maximum value an SD1x18 number can have.\\nint64 constant uMIN_SD1x18 = -9_223372036854775808;\\nSD1x18 constant MIN_SD1x18 = SD1x18.wrap(uMIN_SD1x18);\\n\\n/// @dev PI as an SD1x18 number.\\nSD1x18 constant PI = SD1x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of SD1x18.\\nSD1x18 constant UNIT = SD1x18.wrap(1e18);\\nint64 constant uUNIT = 1e18;\\n\",\"keccak256\":\"0x6496165b80552785a4b65a239b96e2a5fedf62fe54f002eeed72d75e566d7585\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD1x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in UD2x18.\\nerror PRBMath_SD1x18_ToUD2x18_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in UD60x18.\\nerror PRBMath_SD1x18_ToUD60x18_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint128.\\nerror PRBMath_SD1x18_ToUint128_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint256.\\nerror PRBMath_SD1x18_ToUint256_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint40.\\nerror PRBMath_SD1x18_ToUint40_Overflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint40.\\nerror PRBMath_SD1x18_ToUint40_Underflow(SD1x18 x);\\n\",\"keccak256\":\"0x836cb42ba619ca369fd4765bc47fefc3c3621369c5861882af14660aca5057ee\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\n\\n/// @notice The signed 1.18-decimal fixed-point number representation, which can have up to 1 digit and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\\n/// type int64. This is useful when end users want to use int64 to save gas, e.g. with tight variable packing in contract\\n/// storage.\\ntype SD1x18 is int64;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoSD59x18,\\n Casting.intoUD2x18,\\n Casting.intoUD60x18,\\n Casting.intoUint256,\\n Casting.intoUint128,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for SD1x18 global;\\n\",\"keccak256\":\"0x2f86f1aa9fca42f40808b51a879b406ac51817647bdb9642f8a79dd8fdb754a7\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Errors.sol\\\" as CastingErrors;\\nimport { MAX_UINT128, MAX_UINT40 } from \\\"../Common.sol\\\";\\nimport { uMAX_SD1x18, uMIN_SD1x18 } from \\\"../sd1x18/Constants.sol\\\";\\nimport { SD1x18 } from \\\"../sd1x18/ValueType.sol\\\";\\nimport { uMAX_UD2x18 } from \\\"../ud2x18/Constants.sol\\\";\\nimport { UD2x18 } from \\\"../ud2x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"../ud60x18/ValueType.sol\\\";\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts an SD59x18 number into int256.\\n/// @dev This is basically a functional alias for {unwrap}.\\nfunction intoInt256(SD59x18 x) pure returns (int256 result) {\\n result = SD59x18.unwrap(x);\\n}\\n\\n/// @notice Casts an SD59x18 number into SD1x18.\\n/// @dev Requirements:\\n/// - x must be greater than or equal to `uMIN_SD1x18`.\\n/// - x must be less than or equal to `uMAX_SD1x18`.\\nfunction intoSD1x18(SD59x18 x) pure returns (SD1x18 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < uMIN_SD1x18) {\\n revert CastingErrors.PRBMath_SD59x18_IntoSD1x18_Underflow(x);\\n }\\n if (xInt > uMAX_SD1x18) {\\n revert CastingErrors.PRBMath_SD59x18_IntoSD1x18_Overflow(x);\\n }\\n result = SD1x18.wrap(int64(xInt));\\n}\\n\\n/// @notice Casts an SD59x18 number into UD2x18.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `uMAX_UD2x18`.\\nfunction intoUD2x18(SD59x18 x) pure returns (UD2x18 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUD2x18_Underflow(x);\\n }\\n if (xInt > int256(uint256(uMAX_UD2x18))) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUD2x18_Overflow(x);\\n }\\n result = UD2x18.wrap(uint64(uint256(xInt)));\\n}\\n\\n/// @notice Casts an SD59x18 number into UD60x18.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUD60x18(SD59x18 x) pure returns (UD60x18 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUD60x18_Underflow(x);\\n }\\n result = UD60x18.wrap(uint256(xInt));\\n}\\n\\n/// @notice Casts an SD59x18 number into uint256.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUint256(SD59x18 x) pure returns (uint256 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint256_Underflow(x);\\n }\\n result = uint256(xInt);\\n}\\n\\n/// @notice Casts an SD59x18 number into uint128.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `uMAX_UINT128`.\\nfunction intoUint128(SD59x18 x) pure returns (uint128 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint128_Underflow(x);\\n }\\n if (xInt > int256(uint256(MAX_UINT128))) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint128_Overflow(x);\\n }\\n result = uint128(uint256(xInt));\\n}\\n\\n/// @notice Casts an SD59x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(SD59x18 x) pure returns (uint40 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint40_Underflow(x);\\n }\\n if (xInt > int256(uint256(MAX_UINT40))) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint40_Overflow(x);\\n }\\n result = uint40(uint256(xInt));\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction sd(int256 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(x);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction sd59x18(int256 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(x);\\n}\\n\\n/// @notice Unwraps an SD59x18 number into int256.\\nfunction unwrap(SD59x18 x) pure returns (int256 result) {\\n result = SD59x18.unwrap(x);\\n}\\n\\n/// @notice Wraps an int256 number into SD59x18.\\nfunction wrap(int256 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x3b21b60ec2998c3ae32f647412da51d3683b3f183a807198cc8d157499484f99\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n// NOTICE: the \\\"u\\\" prefix stands for \\\"unwrapped\\\".\\n\\n/// @dev Euler's number as an SD59x18 number.\\nSD59x18 constant E = SD59x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum input permitted in {exp}.\\nint256 constant uEXP_MAX_INPUT = 133_084258667509499440;\\nSD59x18 constant EXP_MAX_INPUT = SD59x18.wrap(uEXP_MAX_INPUT);\\n\\n/// @dev Any value less than this returns 0 in {exp}.\\nint256 constant uEXP_MIN_THRESHOLD = -41_446531673892822322;\\nSD59x18 constant EXP_MIN_THRESHOLD = SD59x18.wrap(uEXP_MIN_THRESHOLD);\\n\\n/// @dev The maximum input permitted in {exp2}.\\nint256 constant uEXP2_MAX_INPUT = 192e18 - 1;\\nSD59x18 constant EXP2_MAX_INPUT = SD59x18.wrap(uEXP2_MAX_INPUT);\\n\\n/// @dev Any value less than this returns 0 in {exp2}.\\nint256 constant uEXP2_MIN_THRESHOLD = -59_794705707972522261;\\nSD59x18 constant EXP2_MIN_THRESHOLD = SD59x18.wrap(uEXP2_MIN_THRESHOLD);\\n\\n/// @dev Half the UNIT number.\\nint256 constant uHALF_UNIT = 0.5e18;\\nSD59x18 constant HALF_UNIT = SD59x18.wrap(uHALF_UNIT);\\n\\n/// @dev $log_2(10)$ as an SD59x18 number.\\nint256 constant uLOG2_10 = 3_321928094887362347;\\nSD59x18 constant LOG2_10 = SD59x18.wrap(uLOG2_10);\\n\\n/// @dev $log_2(e)$ as an SD59x18 number.\\nint256 constant uLOG2_E = 1_442695040888963407;\\nSD59x18 constant LOG2_E = SD59x18.wrap(uLOG2_E);\\n\\n/// @dev The maximum value an SD59x18 number can have.\\nint256 constant uMAX_SD59x18 = 57896044618658097711785492504343953926634992332820282019728_792003956564819967;\\nSD59x18 constant MAX_SD59x18 = SD59x18.wrap(uMAX_SD59x18);\\n\\n/// @dev The maximum whole value an SD59x18 number can have.\\nint256 constant uMAX_WHOLE_SD59x18 = 57896044618658097711785492504343953926634992332820282019728_000000000000000000;\\nSD59x18 constant MAX_WHOLE_SD59x18 = SD59x18.wrap(uMAX_WHOLE_SD59x18);\\n\\n/// @dev The minimum value an SD59x18 number can have.\\nint256 constant uMIN_SD59x18 = -57896044618658097711785492504343953926634992332820282019728_792003956564819968;\\nSD59x18 constant MIN_SD59x18 = SD59x18.wrap(uMIN_SD59x18);\\n\\n/// @dev The minimum whole value an SD59x18 number can have.\\nint256 constant uMIN_WHOLE_SD59x18 = -57896044618658097711785492504343953926634992332820282019728_000000000000000000;\\nSD59x18 constant MIN_WHOLE_SD59x18 = SD59x18.wrap(uMIN_WHOLE_SD59x18);\\n\\n/// @dev PI as an SD59x18 number.\\nSD59x18 constant PI = SD59x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of SD59x18.\\nint256 constant uUNIT = 1e18;\\nSD59x18 constant UNIT = SD59x18.wrap(1e18);\\n\\n/// @dev The unit number squared.\\nint256 constant uUNIT_SQUARED = 1e36;\\nSD59x18 constant UNIT_SQUARED = SD59x18.wrap(uUNIT_SQUARED);\\n\\n/// @dev Zero as an SD59x18 number.\\nSD59x18 constant ZERO = SD59x18.wrap(0);\\n\",\"keccak256\":\"0x9bcb8dd6b3e886d140ad1c32747a4f6d29a492529ceb835be878ae837aa6cc3a\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when taking the absolute value of `MIN_SD59x18`.\\nerror PRBMath_SD59x18_Abs_MinSD59x18();\\n\\n/// @notice Thrown when ceiling a number overflows SD59x18.\\nerror PRBMath_SD59x18_Ceil_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when converting a basic integer to the fixed-point format overflows SD59x18.\\nerror PRBMath_SD59x18_Convert_Overflow(int256 x);\\n\\n/// @notice Thrown when converting a basic integer to the fixed-point format underflows SD59x18.\\nerror PRBMath_SD59x18_Convert_Underflow(int256 x);\\n\\n/// @notice Thrown when dividing two numbers and one of them is `MIN_SD59x18`.\\nerror PRBMath_SD59x18_Div_InputTooSmall();\\n\\n/// @notice Thrown when dividing two numbers and one of the intermediary unsigned results overflows SD59x18.\\nerror PRBMath_SD59x18_Div_Overflow(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when taking the natural exponent of a base greater than 133_084258667509499441.\\nerror PRBMath_SD59x18_Exp_InputTooBig(SD59x18 x);\\n\\n/// @notice Thrown when taking the binary exponent of a base greater than 192e18.\\nerror PRBMath_SD59x18_Exp2_InputTooBig(SD59x18 x);\\n\\n/// @notice Thrown when flooring a number underflows SD59x18.\\nerror PRBMath_SD59x18_Floor_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when taking the geometric mean of two numbers and their product is negative.\\nerror PRBMath_SD59x18_Gm_NegativeProduct(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when taking the geometric mean of two numbers and multiplying them overflows SD59x18.\\nerror PRBMath_SD59x18_Gm_Overflow(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\\nerror PRBMath_SD59x18_IntoSD1x18_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\\nerror PRBMath_SD59x18_IntoSD1x18_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\\nerror PRBMath_SD59x18_IntoUD2x18_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\\nerror PRBMath_SD59x18_IntoUD2x18_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD60x18.\\nerror PRBMath_SD59x18_IntoUD60x18_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\\nerror PRBMath_SD59x18_IntoUint128_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\\nerror PRBMath_SD59x18_IntoUint128_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint256.\\nerror PRBMath_SD59x18_IntoUint256_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\\nerror PRBMath_SD59x18_IntoUint40_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\\nerror PRBMath_SD59x18_IntoUint40_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when taking the logarithm of a number less than or equal to zero.\\nerror PRBMath_SD59x18_Log_InputTooSmall(SD59x18 x);\\n\\n/// @notice Thrown when multiplying two numbers and one of the inputs is `MIN_SD59x18`.\\nerror PRBMath_SD59x18_Mul_InputTooSmall();\\n\\n/// @notice Thrown when multiplying two numbers and the intermediary absolute result overflows SD59x18.\\nerror PRBMath_SD59x18_Mul_Overflow(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when raising a number to a power and the intermediary absolute result overflows SD59x18.\\nerror PRBMath_SD59x18_Powu_Overflow(SD59x18 x, uint256 y);\\n\\n/// @notice Thrown when taking the square root of a negative number.\\nerror PRBMath_SD59x18_Sqrt_NegativeInput(SD59x18 x);\\n\\n/// @notice Thrown when the calculating the square root overflows SD59x18.\\nerror PRBMath_SD59x18_Sqrt_Overflow(SD59x18 x);\\n\",\"keccak256\":\"0xa6d00fe5efa215ac0df25c896e3da99a12fb61e799644b2ec32da947313d3db4\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Helpers.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { wrap } from \\\"./Casting.sol\\\";\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Implements the checked addition operation (+) in the SD59x18 type.\\nfunction add(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n return wrap(x.unwrap() + y.unwrap());\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the SD59x18 type.\\nfunction and(SD59x18 x, int256 bits) pure returns (SD59x18 result) {\\n return wrap(x.unwrap() & bits);\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the SD59x18 type.\\nfunction and2(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n return wrap(x.unwrap() & y.unwrap());\\n}\\n\\n/// @notice Implements the equal (=) operation in the SD59x18 type.\\nfunction eq(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() == y.unwrap();\\n}\\n\\n/// @notice Implements the greater than operation (>) in the SD59x18 type.\\nfunction gt(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() > y.unwrap();\\n}\\n\\n/// @notice Implements the greater than or equal to operation (>=) in the SD59x18 type.\\nfunction gte(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() >= y.unwrap();\\n}\\n\\n/// @notice Implements a zero comparison check function in the SD59x18 type.\\nfunction isZero(SD59x18 x) pure returns (bool result) {\\n result = x.unwrap() == 0;\\n}\\n\\n/// @notice Implements the left shift operation (<<) in the SD59x18 type.\\nfunction lshift(SD59x18 x, uint256 bits) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() << bits);\\n}\\n\\n/// @notice Implements the lower than operation (<) in the SD59x18 type.\\nfunction lt(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() < y.unwrap();\\n}\\n\\n/// @notice Implements the lower than or equal to operation (<=) in the SD59x18 type.\\nfunction lte(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() <= y.unwrap();\\n}\\n\\n/// @notice Implements the unchecked modulo operation (%) in the SD59x18 type.\\nfunction mod(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() % y.unwrap());\\n}\\n\\n/// @notice Implements the not equal operation (!=) in the SD59x18 type.\\nfunction neq(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() != y.unwrap();\\n}\\n\\n/// @notice Implements the NOT (~) bitwise operation in the SD59x18 type.\\nfunction not(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(~x.unwrap());\\n}\\n\\n/// @notice Implements the OR (|) bitwise operation in the SD59x18 type.\\nfunction or(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() | y.unwrap());\\n}\\n\\n/// @notice Implements the right shift operation (>>) in the SD59x18 type.\\nfunction rshift(SD59x18 x, uint256 bits) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() >> bits);\\n}\\n\\n/// @notice Implements the checked subtraction operation (-) in the SD59x18 type.\\nfunction sub(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() - y.unwrap());\\n}\\n\\n/// @notice Implements the checked unary minus operation (-) in the SD59x18 type.\\nfunction unary(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(-x.unwrap());\\n}\\n\\n/// @notice Implements the unchecked addition operation (+) in the SD59x18 type.\\nfunction uncheckedAdd(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() + y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the unchecked subtraction operation (-) in the SD59x18 type.\\nfunction uncheckedSub(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() - y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the unchecked unary minus operation (-) in the SD59x18 type.\\nfunction uncheckedUnary(SD59x18 x) pure returns (SD59x18 result) {\\n unchecked {\\n result = wrap(-x.unwrap());\\n }\\n}\\n\\n/// @notice Implements the XOR (^) bitwise operation in the SD59x18 type.\\nfunction xor(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() ^ y.unwrap());\\n}\\n\",\"keccak256\":\"0x208570f1657cf730cb6c3d81aa14030e0d45cf906cdedea5059369d7df4bb716\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as Errors;\\nimport {\\n uEXP_MAX_INPUT,\\n uEXP2_MAX_INPUT,\\n uEXP_MIN_THRESHOLD,\\n uEXP2_MIN_THRESHOLD,\\n uHALF_UNIT,\\n uLOG2_10,\\n uLOG2_E,\\n uMAX_SD59x18,\\n uMAX_WHOLE_SD59x18,\\n uMIN_SD59x18,\\n uMIN_WHOLE_SD59x18,\\n UNIT,\\n uUNIT,\\n uUNIT_SQUARED,\\n ZERO\\n} from \\\"./Constants.sol\\\";\\nimport { wrap } from \\\"./Helpers.sol\\\";\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Calculates the absolute value of x.\\n///\\n/// @dev Requirements:\\n/// - x must be greater than `MIN_SD59x18`.\\n///\\n/// @param x The SD59x18 number for which to calculate the absolute value.\\n/// @param result The absolute value of x as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction abs(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt == uMIN_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Abs_MinSD59x18();\\n }\\n result = xInt < 0 ? wrap(-xInt) : x;\\n}\\n\\n/// @notice Calculates the arithmetic average of x and y.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// @param x The first operand as an SD59x18 number.\\n/// @param y The second operand as an SD59x18 number.\\n/// @return result The arithmetic average as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction avg(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n\\n unchecked {\\n // This operation is equivalent to `x / 2 + y / 2`, and it can never overflow.\\n int256 sum = (xInt >> 1) + (yInt >> 1);\\n\\n if (sum < 0) {\\n // If at least one of x and y is odd, add 1 to the result, because shifting negative numbers to the right\\n // rounds toward negative infinity. The right part is equivalent to `sum + (x % 2 == 1 || y % 2 == 1)`.\\n assembly (\\\"memory-safe\\\") {\\n result := add(sum, and(or(xInt, yInt), 1))\\n }\\n } else {\\n // Add 1 if both x and y are odd to account for the double 0.5 remainder truncated after shifting.\\n result = wrap(sum + (xInt & yInt & 1));\\n }\\n }\\n}\\n\\n/// @notice Yields the smallest whole number greater than or equal to x.\\n///\\n/// @dev Optimized for fractional value inputs, because every whole value has (1e18 - 1) fractional counterparts.\\n/// See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n///\\n/// Requirements:\\n/// - x must be less than or equal to `MAX_WHOLE_SD59x18`.\\n///\\n/// @param x The SD59x18 number to ceil.\\n/// @param result The smallest whole number greater than or equal to x, as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ceil(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt > uMAX_WHOLE_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Ceil_Overflow(x);\\n }\\n\\n int256 remainder = xInt % uUNIT;\\n if (remainder == 0) {\\n result = x;\\n } else {\\n unchecked {\\n // Solidity uses C fmod style, which returns a modulus with the same sign as x.\\n int256 resultInt = xInt - remainder;\\n if (xInt > 0) {\\n resultInt += uUNIT;\\n }\\n result = wrap(resultInt);\\n }\\n }\\n}\\n\\n/// @notice Divides two SD59x18 numbers, returning a new SD59x18 number.\\n///\\n/// @dev This is an extension of {Common.mulDiv} for signed numbers, which works by computing the signs and the absolute\\n/// values separately.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv}.\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv}.\\n/// - None of the inputs can be `MIN_SD59x18`.\\n/// - The denominator must not be zero.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The numerator as an SD59x18 number.\\n/// @param y The denominator as an SD59x18 number.\\n/// @param result The quotient as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction div(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n if (xInt == uMIN_SD59x18 || yInt == uMIN_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Div_InputTooSmall();\\n }\\n\\n // Get hold of the absolute values of x and y.\\n uint256 xAbs;\\n uint256 yAbs;\\n unchecked {\\n xAbs = xInt < 0 ? uint256(-xInt) : uint256(xInt);\\n yAbs = yInt < 0 ? uint256(-yInt) : uint256(yInt);\\n }\\n\\n // Compute the absolute value (x*UNIT\\u00f7y). The resulting value must fit in SD59x18.\\n uint256 resultAbs = Common.mulDiv(xAbs, uint256(uUNIT), yAbs);\\n if (resultAbs > uint256(uMAX_SD59x18)) {\\n revert Errors.PRBMath_SD59x18_Div_Overflow(x, y);\\n }\\n\\n // Check if x and y have the same sign using two's complement representation. The left-most bit represents the sign (1 for\\n // negative, 0 for positive or zero).\\n bool sameSign = (xInt ^ yInt) > -1;\\n\\n // If the inputs have the same sign, the result should be positive. Otherwise, it should be negative.\\n unchecked {\\n result = wrap(sameSign ? int256(resultAbs) : -int256(resultAbs));\\n }\\n}\\n\\n/// @notice Calculates the natural exponent of x using the following formula:\\n///\\n/// $$\\n/// e^x = 2^{x * log_2{e}}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {exp2}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {exp2}.\\n/// - x must be less than 133_084258667509499441.\\n///\\n/// @param x The exponent as an SD59x18 number.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n\\n // Any input less than the threshold returns zero.\\n // This check also prevents an overflow for very small numbers.\\n if (xInt < uEXP_MIN_THRESHOLD) {\\n return ZERO;\\n }\\n\\n // This check prevents values greater than 192e18 from being passed to {exp2}.\\n if (xInt > uEXP_MAX_INPUT) {\\n revert Errors.PRBMath_SD59x18_Exp_InputTooBig(x);\\n }\\n\\n unchecked {\\n // Inline the fixed-point multiplication to save gas.\\n int256 doubleUnitProduct = xInt * uLOG2_E;\\n result = exp2(wrap(doubleUnitProduct / uUNIT));\\n }\\n}\\n\\n/// @notice Calculates the binary exponent of x using the binary fraction method using the following formula:\\n///\\n/// $$\\n/// 2^{-x} = \\\\frac{1}{2^x}\\n/// $$\\n///\\n/// @dev See https://ethereum.stackexchange.com/q/79903/24693.\\n///\\n/// Notes:\\n/// - If x is less than -59_794705707972522261, the result is zero.\\n///\\n/// Requirements:\\n/// - x must be less than 192e18.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The exponent as an SD59x18 number.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp2(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < 0) {\\n // The inverse of any number less than the threshold is truncated to zero.\\n if (xInt < uEXP2_MIN_THRESHOLD) {\\n return ZERO;\\n }\\n\\n unchecked {\\n // Inline the fixed-point inversion to save gas.\\n result = wrap(uUNIT_SQUARED / exp2(wrap(-xInt)).unwrap());\\n }\\n } else {\\n // Numbers greater than or equal to 192e18 don't fit in the 192.64-bit format.\\n if (xInt > uEXP2_MAX_INPUT) {\\n revert Errors.PRBMath_SD59x18_Exp2_InputTooBig(x);\\n }\\n\\n unchecked {\\n // Convert x to the 192.64-bit fixed-point format.\\n uint256 x_192x64 = uint256((xInt << 64) / uUNIT);\\n\\n // It is safe to cast the result to int256 due to the checks above.\\n result = wrap(int256(Common.exp2(x_192x64)));\\n }\\n }\\n}\\n\\n/// @notice Yields the greatest whole number less than or equal to x.\\n///\\n/// @dev Optimized for fractional value inputs, because for every whole value there are (1e18 - 1) fractional\\n/// counterparts. See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n///\\n/// Requirements:\\n/// - x must be greater than or equal to `MIN_WHOLE_SD59x18`.\\n///\\n/// @param x The SD59x18 number to floor.\\n/// @param result The greatest whole number less than or equal to x, as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction floor(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < uMIN_WHOLE_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Floor_Underflow(x);\\n }\\n\\n int256 remainder = xInt % uUNIT;\\n if (remainder == 0) {\\n result = x;\\n } else {\\n unchecked {\\n // Solidity uses C fmod style, which returns a modulus with the same sign as x.\\n int256 resultInt = xInt - remainder;\\n if (xInt < 0) {\\n resultInt -= uUNIT;\\n }\\n result = wrap(resultInt);\\n }\\n }\\n}\\n\\n/// @notice Yields the excess beyond the floor of x for positive numbers and the part of the number to the right.\\n/// of the radix point for negative numbers.\\n/// @dev Based on the odd function definition. https://en.wikipedia.org/wiki/Fractional_part\\n/// @param x The SD59x18 number to get the fractional part of.\\n/// @param result The fractional part of x as an SD59x18 number.\\nfunction frac(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() % uUNIT);\\n}\\n\\n/// @notice Calculates the geometric mean of x and y, i.e. $\\\\sqrt{x * y}$.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x * y must fit in SD59x18.\\n/// - x * y must not be negative, since complex numbers are not supported.\\n///\\n/// @param x The first operand as an SD59x18 number.\\n/// @param y The second operand as an SD59x18 number.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction gm(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n if (xInt == 0 || yInt == 0) {\\n return ZERO;\\n }\\n\\n unchecked {\\n // Equivalent to `xy / x != y`. Checking for overflow this way is faster than letting Solidity do it.\\n int256 xyInt = xInt * yInt;\\n if (xyInt / xInt != yInt) {\\n revert Errors.PRBMath_SD59x18_Gm_Overflow(x, y);\\n }\\n\\n // The product must not be negative, since complex numbers are not supported.\\n if (xyInt < 0) {\\n revert Errors.PRBMath_SD59x18_Gm_NegativeProduct(x, y);\\n }\\n\\n // We don't need to multiply the result by `UNIT` here because the x*y product picked up a factor of `UNIT`\\n // during multiplication. See the comments in {Common.sqrt}.\\n uint256 resultUint = Common.sqrt(uint256(xyInt));\\n result = wrap(int256(resultUint));\\n }\\n}\\n\\n/// @notice Calculates the inverse of x.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x must not be zero.\\n///\\n/// @param x The SD59x18 number for which to calculate the inverse.\\n/// @return result The inverse as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction inv(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(uUNIT_SQUARED / x.unwrap());\\n}\\n\\n/// @notice Calculates the natural logarithm of x using the following formula:\\n///\\n/// $$\\n/// ln{x} = log_2{x} / log_2{e}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n/// - The precision isn't sufficiently fine-grained to return exactly `UNIT` when the input is `E`.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The SD59x18 number for which to calculate the natural logarithm.\\n/// @return result The natural logarithm as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ln(SD59x18 x) pure returns (SD59x18 result) {\\n // Inline the fixed-point multiplication to save gas. This is overflow-safe because the maximum value that\\n // {log2} can return is ~195_205294292027477728.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_E);\\n}\\n\\n/// @notice Calculates the common logarithm of x using the following formula:\\n///\\n/// $$\\n/// log_{10}{x} = log_2{x} / log_2{10}\\n/// $$\\n///\\n/// However, if x is an exact power of ten, a hard coded value is returned.\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The SD59x18 number for which to calculate the common logarithm.\\n/// @return result The common logarithm as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log10(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < 0) {\\n revert Errors.PRBMath_SD59x18_Log_InputTooSmall(x);\\n }\\n\\n // Note that the `mul` in this block is the standard multiplication operation, not {SD59x18.mul}.\\n // prettier-ignore\\n assembly (\\\"memory-safe\\\") {\\n switch x\\n case 1 { result := mul(uUNIT, sub(0, 18)) }\\n case 10 { result := mul(uUNIT, sub(1, 18)) }\\n case 100 { result := mul(uUNIT, sub(2, 18)) }\\n case 1000 { result := mul(uUNIT, sub(3, 18)) }\\n case 10000 { result := mul(uUNIT, sub(4, 18)) }\\n case 100000 { result := mul(uUNIT, sub(5, 18)) }\\n case 1000000 { result := mul(uUNIT, sub(6, 18)) }\\n case 10000000 { result := mul(uUNIT, sub(7, 18)) }\\n case 100000000 { result := mul(uUNIT, sub(8, 18)) }\\n case 1000000000 { result := mul(uUNIT, sub(9, 18)) }\\n case 10000000000 { result := mul(uUNIT, sub(10, 18)) }\\n case 100000000000 { result := mul(uUNIT, sub(11, 18)) }\\n case 1000000000000 { result := mul(uUNIT, sub(12, 18)) }\\n case 10000000000000 { result := mul(uUNIT, sub(13, 18)) }\\n case 100000000000000 { result := mul(uUNIT, sub(14, 18)) }\\n case 1000000000000000 { result := mul(uUNIT, sub(15, 18)) }\\n case 10000000000000000 { result := mul(uUNIT, sub(16, 18)) }\\n case 100000000000000000 { result := mul(uUNIT, sub(17, 18)) }\\n case 1000000000000000000 { result := 0 }\\n case 10000000000000000000 { result := uUNIT }\\n case 100000000000000000000 { result := mul(uUNIT, 2) }\\n case 1000000000000000000000 { result := mul(uUNIT, 3) }\\n case 10000000000000000000000 { result := mul(uUNIT, 4) }\\n case 100000000000000000000000 { result := mul(uUNIT, 5) }\\n case 1000000000000000000000000 { result := mul(uUNIT, 6) }\\n case 10000000000000000000000000 { result := mul(uUNIT, 7) }\\n case 100000000000000000000000000 { result := mul(uUNIT, 8) }\\n case 1000000000000000000000000000 { result := mul(uUNIT, 9) }\\n case 10000000000000000000000000000 { result := mul(uUNIT, 10) }\\n case 100000000000000000000000000000 { result := mul(uUNIT, 11) }\\n case 1000000000000000000000000000000 { result := mul(uUNIT, 12) }\\n case 10000000000000000000000000000000 { result := mul(uUNIT, 13) }\\n case 100000000000000000000000000000000 { result := mul(uUNIT, 14) }\\n case 1000000000000000000000000000000000 { result := mul(uUNIT, 15) }\\n case 10000000000000000000000000000000000 { result := mul(uUNIT, 16) }\\n case 100000000000000000000000000000000000 { result := mul(uUNIT, 17) }\\n case 1000000000000000000000000000000000000 { result := mul(uUNIT, 18) }\\n case 10000000000000000000000000000000000000 { result := mul(uUNIT, 19) }\\n case 100000000000000000000000000000000000000 { result := mul(uUNIT, 20) }\\n case 1000000000000000000000000000000000000000 { result := mul(uUNIT, 21) }\\n case 10000000000000000000000000000000000000000 { result := mul(uUNIT, 22) }\\n case 100000000000000000000000000000000000000000 { result := mul(uUNIT, 23) }\\n case 1000000000000000000000000000000000000000000 { result := mul(uUNIT, 24) }\\n case 10000000000000000000000000000000000000000000 { result := mul(uUNIT, 25) }\\n case 100000000000000000000000000000000000000000000 { result := mul(uUNIT, 26) }\\n case 1000000000000000000000000000000000000000000000 { result := mul(uUNIT, 27) }\\n case 10000000000000000000000000000000000000000000000 { result := mul(uUNIT, 28) }\\n case 100000000000000000000000000000000000000000000000 { result := mul(uUNIT, 29) }\\n case 1000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 30) }\\n case 10000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 31) }\\n case 100000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 32) }\\n case 1000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 33) }\\n case 10000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 34) }\\n case 100000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 35) }\\n case 1000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 36) }\\n case 10000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 37) }\\n case 100000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 38) }\\n case 1000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 39) }\\n case 10000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 40) }\\n case 100000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 41) }\\n case 1000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 42) }\\n case 10000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 43) }\\n case 100000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 44) }\\n case 1000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 45) }\\n case 10000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 46) }\\n case 100000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 47) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 48) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 49) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 50) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 51) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 52) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 53) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 54) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 55) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 56) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 57) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 58) }\\n default { result := uMAX_SD59x18 }\\n }\\n\\n if (result.unwrap() == uMAX_SD59x18) {\\n unchecked {\\n // Inline the fixed-point division to save gas.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_10);\\n }\\n }\\n}\\n\\n/// @notice Calculates the binary logarithm of x using the iterative approximation algorithm:\\n///\\n/// $$\\n/// log_2{x} = n + log_2{y}, \\\\text{ where } y = x*2^{-n}, \\\\ y \\\\in [1, 2)\\n/// $$\\n///\\n/// For $0 \\\\leq x \\\\lt 1$, the input is inverted:\\n///\\n/// $$\\n/// log_2{x} = -log_2{\\\\frac{1}{x}}\\n/// $$\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Binary_logarithm#Iterative_approximation.\\n///\\n/// Notes:\\n/// - Due to the lossy precision of the iterative approximation, the results are not perfectly accurate to the last decimal.\\n///\\n/// Requirements:\\n/// - x must be greater than zero.\\n///\\n/// @param x The SD59x18 number for which to calculate the binary logarithm.\\n/// @return result The binary logarithm as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log2(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt <= 0) {\\n revert Errors.PRBMath_SD59x18_Log_InputTooSmall(x);\\n }\\n\\n unchecked {\\n int256 sign;\\n if (xInt >= uUNIT) {\\n sign = 1;\\n } else {\\n sign = -1;\\n // Inline the fixed-point inversion to save gas.\\n xInt = uUNIT_SQUARED / xInt;\\n }\\n\\n // Calculate the integer part of the logarithm.\\n uint256 n = Common.msb(uint256(xInt / uUNIT));\\n\\n // This is the integer part of the logarithm as an SD59x18 number. The operation can't overflow\\n // because n is at most 255, `UNIT` is 1e18, and the sign is either 1 or -1.\\n int256 resultInt = int256(n) * uUNIT;\\n\\n // Calculate $y = x * 2^{-n}$.\\n int256 y = xInt >> n;\\n\\n // If y is the unit number, the fractional part is zero.\\n if (y == uUNIT) {\\n return wrap(resultInt * sign);\\n }\\n\\n // Calculate the fractional part via the iterative approximation.\\n // The `delta >>= 1` part is equivalent to `delta /= 2`, but shifting bits is more gas efficient.\\n int256 DOUBLE_UNIT = 2e18;\\n for (int256 delta = uHALF_UNIT; delta > 0; delta >>= 1) {\\n y = (y * y) / uUNIT;\\n\\n // Is y^2 >= 2e18 and so in the range [2e18, 4e18)?\\n if (y >= DOUBLE_UNIT) {\\n // Add the 2^{-m} factor to the logarithm.\\n resultInt = resultInt + delta;\\n\\n // Halve y, which corresponds to z/2 in the Wikipedia article.\\n y >>= 1;\\n }\\n }\\n resultInt *= sign;\\n result = wrap(resultInt);\\n }\\n}\\n\\n/// @notice Multiplies two SD59x18 numbers together, returning a new SD59x18 number.\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {Common.mulDiv18}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv18}.\\n/// - None of the inputs can be `MIN_SD59x18`.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The multiplicand as an SD59x18 number.\\n/// @param y The multiplier as an SD59x18 number.\\n/// @return result The product as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mul(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n if (xInt == uMIN_SD59x18 || yInt == uMIN_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Mul_InputTooSmall();\\n }\\n\\n // Get hold of the absolute values of x and y.\\n uint256 xAbs;\\n uint256 yAbs;\\n unchecked {\\n xAbs = xInt < 0 ? uint256(-xInt) : uint256(xInt);\\n yAbs = yInt < 0 ? uint256(-yInt) : uint256(yInt);\\n }\\n\\n // Compute the absolute value (x*y\\u00f7UNIT). The resulting value must fit in SD59x18.\\n uint256 resultAbs = Common.mulDiv18(xAbs, yAbs);\\n if (resultAbs > uint256(uMAX_SD59x18)) {\\n revert Errors.PRBMath_SD59x18_Mul_Overflow(x, y);\\n }\\n\\n // Check if x and y have the same sign using two's complement representation. The left-most bit represents the sign (1 for\\n // negative, 0 for positive or zero).\\n bool sameSign = (xInt ^ yInt) > -1;\\n\\n // If the inputs have the same sign, the result should be positive. Otherwise, it should be negative.\\n unchecked {\\n result = wrap(sameSign ? int256(resultAbs) : -int256(resultAbs));\\n }\\n}\\n\\n/// @notice Raises x to the power of y using the following formula:\\n///\\n/// $$\\n/// x^y = 2^{log_2{x} * y}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {exp2}, {log2}, and {mul}.\\n/// - Returns `UNIT` for 0^0.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {exp2}, {log2}, and {mul}.\\n///\\n/// @param x The base as an SD59x18 number.\\n/// @param y Exponent to raise x to, as an SD59x18 number\\n/// @return result x raised to power y, as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction pow(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n\\n // If both x and y are zero, the result is `UNIT`. If just x is zero, the result is always zero.\\n if (xInt == 0) {\\n return yInt == 0 ? UNIT : ZERO;\\n }\\n // If x is `UNIT`, the result is always `UNIT`.\\n else if (xInt == uUNIT) {\\n return UNIT;\\n }\\n\\n // If y is zero, the result is always `UNIT`.\\n if (yInt == 0) {\\n return UNIT;\\n }\\n // If y is `UNIT`, the result is always x.\\n else if (yInt == uUNIT) {\\n return x;\\n }\\n\\n // Calculate the result using the formula.\\n result = exp2(mul(log2(x), y));\\n}\\n\\n/// @notice Raises x (an SD59x18 number) to the power y (an unsigned basic integer) using the well-known\\n/// algorithm \\\"exponentiation by squaring\\\".\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Exponentiation_by_squaring.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv18}.\\n/// - Returns `UNIT` for 0^0.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {abs} and {Common.mulDiv18}.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The base as an SD59x18 number.\\n/// @param y The exponent as a uint256.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction powu(SD59x18 x, uint256 y) pure returns (SD59x18 result) {\\n uint256 xAbs = uint256(abs(x).unwrap());\\n\\n // Calculate the first iteration of the loop in advance.\\n uint256 resultAbs = y & 1 > 0 ? xAbs : uint256(uUNIT);\\n\\n // Equivalent to `for(y /= 2; y > 0; y /= 2)`.\\n uint256 yAux = y;\\n for (yAux >>= 1; yAux > 0; yAux >>= 1) {\\n xAbs = Common.mulDiv18(xAbs, xAbs);\\n\\n // Equivalent to `y % 2 == 1`.\\n if (yAux & 1 > 0) {\\n resultAbs = Common.mulDiv18(resultAbs, xAbs);\\n }\\n }\\n\\n // The result must fit in SD59x18.\\n if (resultAbs > uint256(uMAX_SD59x18)) {\\n revert Errors.PRBMath_SD59x18_Powu_Overflow(x, y);\\n }\\n\\n unchecked {\\n // Is the base negative and the exponent odd? If yes, the result should be negative.\\n int256 resultInt = int256(resultAbs);\\n bool isNegative = x.unwrap() < 0 && y & 1 == 1;\\n if (isNegative) {\\n resultInt = -resultInt;\\n }\\n result = wrap(resultInt);\\n }\\n}\\n\\n/// @notice Calculates the square root of x using the Babylonian method.\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\\n///\\n/// Notes:\\n/// - Only the positive root is returned.\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x cannot be negative, since complex numbers are not supported.\\n/// - x must be less than `MAX_SD59x18 / UNIT`.\\n///\\n/// @param x The SD59x18 number for which to calculate the square root.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction sqrt(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < 0) {\\n revert Errors.PRBMath_SD59x18_Sqrt_NegativeInput(x);\\n }\\n if (xInt > uMAX_SD59x18 / uUNIT) {\\n revert Errors.PRBMath_SD59x18_Sqrt_Overflow(x);\\n }\\n\\n unchecked {\\n // Multiply x by `UNIT` to account for the factor of `UNIT` picked up when multiplying two SD59x18 numbers.\\n // In this case, the two numbers are both the square root.\\n uint256 resultUint = Common.sqrt(uint256(xInt * uUNIT));\\n result = wrap(int256(resultUint));\\n }\\n}\\n\",\"keccak256\":\"0xa074831139fc89ca0e5a36086b30eb50896bb6770cd5823461b1f2769017d2f0\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\nimport \\\"./Helpers.sol\\\" as Helpers;\\nimport \\\"./Math.sol\\\" as Math;\\n\\n/// @notice The signed 59.18-decimal fixed-point number representation, which can have up to 59 digits and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\\n/// type int256.\\ntype SD59x18 is int256;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoInt256,\\n Casting.intoSD1x18,\\n Casting.intoUD2x18,\\n Casting.intoUD60x18,\\n Casting.intoUint256,\\n Casting.intoUint128,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for SD59x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n MATHEMATICAL FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Math.abs,\\n Math.avg,\\n Math.ceil,\\n Math.div,\\n Math.exp,\\n Math.exp2,\\n Math.floor,\\n Math.frac,\\n Math.gm,\\n Math.inv,\\n Math.log10,\\n Math.log2,\\n Math.ln,\\n Math.mul,\\n Math.pow,\\n Math.powu,\\n Math.sqrt\\n} for SD59x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n HELPER FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Helpers.add,\\n Helpers.and,\\n Helpers.eq,\\n Helpers.gt,\\n Helpers.gte,\\n Helpers.isZero,\\n Helpers.lshift,\\n Helpers.lt,\\n Helpers.lte,\\n Helpers.mod,\\n Helpers.neq,\\n Helpers.not,\\n Helpers.or,\\n Helpers.rshift,\\n Helpers.sub,\\n Helpers.uncheckedAdd,\\n Helpers.uncheckedSub,\\n Helpers.uncheckedUnary,\\n Helpers.xor\\n} for SD59x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n OPERATORS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes it possible to use these operators on the SD59x18 type.\\nusing {\\n Helpers.add as +,\\n Helpers.and2 as &,\\n Math.div as /,\\n Helpers.eq as ==,\\n Helpers.gt as >,\\n Helpers.gte as >=,\\n Helpers.lt as <,\\n Helpers.lte as <=,\\n Helpers.mod as %,\\n Math.mul as *,\\n Helpers.neq as !=,\\n Helpers.not as ~,\\n Helpers.or as |,\\n Helpers.sub as -,\\n Helpers.unary as -,\\n Helpers.xor as ^\\n} for SD59x18 global;\\n\",\"keccak256\":\"0xe03112d145dcd5863aff24e5f381debaae29d446acd5666f3d640e3d9af738d7\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as Errors;\\nimport { uMAX_SD1x18 } from \\\"../sd1x18/Constants.sol\\\";\\nimport { SD1x18 } from \\\"../sd1x18/ValueType.sol\\\";\\nimport { SD59x18 } from \\\"../sd59x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"../ud60x18/ValueType.sol\\\";\\nimport { UD2x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts a UD2x18 number into SD1x18.\\n/// - x must be less than or equal to `uMAX_SD1x18`.\\nfunction intoSD1x18(UD2x18 x) pure returns (SD1x18 result) {\\n uint64 xUint = UD2x18.unwrap(x);\\n if (xUint > uint64(uMAX_SD1x18)) {\\n revert Errors.PRBMath_UD2x18_IntoSD1x18_Overflow(x);\\n }\\n result = SD1x18.wrap(int64(xUint));\\n}\\n\\n/// @notice Casts a UD2x18 number into SD59x18.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of SD59x18.\\nfunction intoSD59x18(UD2x18 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(int256(uint256(UD2x18.unwrap(x))));\\n}\\n\\n/// @notice Casts a UD2x18 number into UD60x18.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of UD60x18.\\nfunction intoUD60x18(UD2x18 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(UD2x18.unwrap(x));\\n}\\n\\n/// @notice Casts a UD2x18 number into uint128.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of uint128.\\nfunction intoUint128(UD2x18 x) pure returns (uint128 result) {\\n result = uint128(UD2x18.unwrap(x));\\n}\\n\\n/// @notice Casts a UD2x18 number into uint256.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of uint256.\\nfunction intoUint256(UD2x18 x) pure returns (uint256 result) {\\n result = uint256(UD2x18.unwrap(x));\\n}\\n\\n/// @notice Casts a UD2x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(UD2x18 x) pure returns (uint40 result) {\\n uint64 xUint = UD2x18.unwrap(x);\\n if (xUint > uint64(Common.MAX_UINT40)) {\\n revert Errors.PRBMath_UD2x18_IntoUint40_Overflow(x);\\n }\\n result = uint40(xUint);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction ud2x18(uint64 x) pure returns (UD2x18 result) {\\n result = UD2x18.wrap(x);\\n}\\n\\n/// @notice Unwrap a UD2x18 number into uint64.\\nfunction unwrap(UD2x18 x) pure returns (uint64 result) {\\n result = UD2x18.unwrap(x);\\n}\\n\\n/// @notice Wraps a uint64 number into UD2x18.\\nfunction wrap(uint64 x) pure returns (UD2x18 result) {\\n result = UD2x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x9b1a35d432ef951a415fae8098b3c609a99b630a3d5464b3c8e1efa8893eea07\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD2x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @dev Euler's number as a UD2x18 number.\\nUD2x18 constant E = UD2x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum value a UD2x18 number can have.\\nuint64 constant uMAX_UD2x18 = 18_446744073709551615;\\nUD2x18 constant MAX_UD2x18 = UD2x18.wrap(uMAX_UD2x18);\\n\\n/// @dev PI as a UD2x18 number.\\nUD2x18 constant PI = UD2x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of UD2x18.\\nUD2x18 constant UNIT = UD2x18.wrap(1e18);\\nuint64 constant uUNIT = 1e18;\\n\",\"keccak256\":\"0x29b0e050c865899e1fb9022b460a7829cdee248c44c4299f068ba80695eec3fc\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD2x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when trying to cast a UD2x18 number that doesn't fit in SD1x18.\\nerror PRBMath_UD2x18_IntoSD1x18_Overflow(UD2x18 x);\\n\\n/// @notice Thrown when trying to cast a UD2x18 number that doesn't fit in uint40.\\nerror PRBMath_UD2x18_IntoUint40_Overflow(UD2x18 x);\\n\",\"keccak256\":\"0xdf1e22f0b4c8032bcc8b7f63fe3984e1387f3dc7b2e9ab381822249f75376d33\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\n\\n/// @notice The unsigned 2.18-decimal fixed-point number representation, which can have up to 2 digits and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\\n/// type uint64. This is useful when end users want to use uint64 to save gas, e.g. with tight variable packing in contract\\n/// storage.\\ntype UD2x18 is uint64;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoSD1x18,\\n Casting.intoSD59x18,\\n Casting.intoUD60x18,\\n Casting.intoUint256,\\n Casting.intoUint128,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for UD2x18 global;\\n\",\"keccak256\":\"0x2802edc9869db116a0b5c490cc5f8554742f747183fa30ac5e9c80bb967e61a1\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Errors.sol\\\" as CastingErrors;\\nimport { MAX_UINT128, MAX_UINT40 } from \\\"../Common.sol\\\";\\nimport { uMAX_SD1x18 } from \\\"../sd1x18/Constants.sol\\\";\\nimport { SD1x18 } from \\\"../sd1x18/ValueType.sol\\\";\\nimport { uMAX_SD59x18 } from \\\"../sd59x18/Constants.sol\\\";\\nimport { SD59x18 } from \\\"../sd59x18/ValueType.sol\\\";\\nimport { uMAX_UD2x18 } from \\\"../ud2x18/Constants.sol\\\";\\nimport { UD2x18 } from \\\"../ud2x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts a UD60x18 number into SD1x18.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `uMAX_SD1x18`.\\nfunction intoSD1x18(UD60x18 x) pure returns (SD1x18 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > uint256(int256(uMAX_SD1x18))) {\\n revert CastingErrors.PRBMath_UD60x18_IntoSD1x18_Overflow(x);\\n }\\n result = SD1x18.wrap(int64(uint64(xUint)));\\n}\\n\\n/// @notice Casts a UD60x18 number into UD2x18.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `uMAX_UD2x18`.\\nfunction intoUD2x18(UD60x18 x) pure returns (UD2x18 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > uMAX_UD2x18) {\\n revert CastingErrors.PRBMath_UD60x18_IntoUD2x18_Overflow(x);\\n }\\n result = UD2x18.wrap(uint64(xUint));\\n}\\n\\n/// @notice Casts a UD60x18 number into SD59x18.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `uMAX_SD59x18`.\\nfunction intoSD59x18(UD60x18 x) pure returns (SD59x18 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > uint256(uMAX_SD59x18)) {\\n revert CastingErrors.PRBMath_UD60x18_IntoSD59x18_Overflow(x);\\n }\\n result = SD59x18.wrap(int256(xUint));\\n}\\n\\n/// @notice Casts a UD60x18 number into uint128.\\n/// @dev This is basically an alias for {unwrap}.\\nfunction intoUint256(UD60x18 x) pure returns (uint256 result) {\\n result = UD60x18.unwrap(x);\\n}\\n\\n/// @notice Casts a UD60x18 number into uint128.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UINT128`.\\nfunction intoUint128(UD60x18 x) pure returns (uint128 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > MAX_UINT128) {\\n revert CastingErrors.PRBMath_UD60x18_IntoUint128_Overflow(x);\\n }\\n result = uint128(xUint);\\n}\\n\\n/// @notice Casts a UD60x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(UD60x18 x) pure returns (uint40 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > MAX_UINT40) {\\n revert CastingErrors.PRBMath_UD60x18_IntoUint40_Overflow(x);\\n }\\n result = uint40(xUint);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction ud(uint256 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(x);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction ud60x18(uint256 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(x);\\n}\\n\\n/// @notice Unwraps a UD60x18 number into uint256.\\nfunction unwrap(UD60x18 x) pure returns (uint256 result) {\\n result = UD60x18.unwrap(x);\\n}\\n\\n/// @notice Wraps a uint256 number into the UD60x18 value type.\\nfunction wrap(uint256 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x5bb532da36921cbdac64d1f16de5d366ef1f664502e3b7c07d0ad06917551f85\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n// NOTICE: the \\\"u\\\" prefix stands for \\\"unwrapped\\\".\\n\\n/// @dev Euler's number as a UD60x18 number.\\nUD60x18 constant E = UD60x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum input permitted in {exp}.\\nuint256 constant uEXP_MAX_INPUT = 133_084258667509499440;\\nUD60x18 constant EXP_MAX_INPUT = UD60x18.wrap(uEXP_MAX_INPUT);\\n\\n/// @dev The maximum input permitted in {exp2}.\\nuint256 constant uEXP2_MAX_INPUT = 192e18 - 1;\\nUD60x18 constant EXP2_MAX_INPUT = UD60x18.wrap(uEXP2_MAX_INPUT);\\n\\n/// @dev Half the UNIT number.\\nuint256 constant uHALF_UNIT = 0.5e18;\\nUD60x18 constant HALF_UNIT = UD60x18.wrap(uHALF_UNIT);\\n\\n/// @dev $log_2(10)$ as a UD60x18 number.\\nuint256 constant uLOG2_10 = 3_321928094887362347;\\nUD60x18 constant LOG2_10 = UD60x18.wrap(uLOG2_10);\\n\\n/// @dev $log_2(e)$ as a UD60x18 number.\\nuint256 constant uLOG2_E = 1_442695040888963407;\\nUD60x18 constant LOG2_E = UD60x18.wrap(uLOG2_E);\\n\\n/// @dev The maximum value a UD60x18 number can have.\\nuint256 constant uMAX_UD60x18 = 115792089237316195423570985008687907853269984665640564039457_584007913129639935;\\nUD60x18 constant MAX_UD60x18 = UD60x18.wrap(uMAX_UD60x18);\\n\\n/// @dev The maximum whole value a UD60x18 number can have.\\nuint256 constant uMAX_WHOLE_UD60x18 = 115792089237316195423570985008687907853269984665640564039457_000000000000000000;\\nUD60x18 constant MAX_WHOLE_UD60x18 = UD60x18.wrap(uMAX_WHOLE_UD60x18);\\n\\n/// @dev PI as a UD60x18 number.\\nUD60x18 constant PI = UD60x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of UD60x18.\\nuint256 constant uUNIT = 1e18;\\nUD60x18 constant UNIT = UD60x18.wrap(uUNIT);\\n\\n/// @dev The unit number squared.\\nuint256 constant uUNIT_SQUARED = 1e36;\\nUD60x18 constant UNIT_SQUARED = UD60x18.wrap(uUNIT_SQUARED);\\n\\n/// @dev Zero as a UD60x18 number.\\nUD60x18 constant ZERO = UD60x18.wrap(0);\\n\",\"keccak256\":\"0x2b80d26153d3fdcfb3a9ca772d9309d31ed1275f5b8b54c3ffb54d3652b37d90\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Conversions.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { uMAX_UD60x18, uUNIT } from \\\"./Constants.sol\\\";\\nimport { PRBMath_UD60x18_Convert_Overflow } from \\\"./Errors.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Converts a UD60x18 number to a simple integer by dividing it by `UNIT`.\\n/// @dev The result is rounded toward zero.\\n/// @param x The UD60x18 number to convert.\\n/// @return result The same number in basic integer form.\\nfunction convert(UD60x18 x) pure returns (uint256 result) {\\n result = UD60x18.unwrap(x) / uUNIT;\\n}\\n\\n/// @notice Converts a simple integer to UD60x18 by multiplying it by `UNIT`.\\n///\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UD60x18 / UNIT`.\\n///\\n/// @param x The basic integer to convert.\\n/// @param result The same number converted to UD60x18.\\nfunction convert(uint256 x) pure returns (UD60x18 result) {\\n if (x > uMAX_UD60x18 / uUNIT) {\\n revert PRBMath_UD60x18_Convert_Overflow(x);\\n }\\n unchecked {\\n result = UD60x18.wrap(x * uUNIT);\\n }\\n}\\n\",\"keccak256\":\"0xaf7fc2523413822de3b66ba339fe2884fb3b8c6f6cf38ec90a2c3e3aae71df6b\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when ceiling a number overflows UD60x18.\\nerror PRBMath_UD60x18_Ceil_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when converting a basic integer to the fixed-point format overflows UD60x18.\\nerror PRBMath_UD60x18_Convert_Overflow(uint256 x);\\n\\n/// @notice Thrown when taking the natural exponent of a base greater than 133_084258667509499441.\\nerror PRBMath_UD60x18_Exp_InputTooBig(UD60x18 x);\\n\\n/// @notice Thrown when taking the binary exponent of a base greater than 192e18.\\nerror PRBMath_UD60x18_Exp2_InputTooBig(UD60x18 x);\\n\\n/// @notice Thrown when taking the geometric mean of two numbers and multiplying them overflows UD60x18.\\nerror PRBMath_UD60x18_Gm_Overflow(UD60x18 x, UD60x18 y);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\\nerror PRBMath_UD60x18_IntoSD1x18_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD59x18.\\nerror PRBMath_UD60x18_IntoSD59x18_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\\nerror PRBMath_UD60x18_IntoUD2x18_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\\nerror PRBMath_UD60x18_IntoUint128_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\\nerror PRBMath_UD60x18_IntoUint40_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when taking the logarithm of a number less than 1.\\nerror PRBMath_UD60x18_Log_InputTooSmall(UD60x18 x);\\n\\n/// @notice Thrown when calculating the square root overflows UD60x18.\\nerror PRBMath_UD60x18_Sqrt_Overflow(UD60x18 x);\\n\",\"keccak256\":\"0xa8c60d4066248df22c49c882873efbc017344107edabc48c52209abbc39cb1e3\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Helpers.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { wrap } from \\\"./Casting.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Implements the checked addition operation (+) in the UD60x18 type.\\nfunction add(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() + y.unwrap());\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the UD60x18 type.\\nfunction and(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() & bits);\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the UD60x18 type.\\nfunction and2(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() & y.unwrap());\\n}\\n\\n/// @notice Implements the equal operation (==) in the UD60x18 type.\\nfunction eq(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() == y.unwrap();\\n}\\n\\n/// @notice Implements the greater than operation (>) in the UD60x18 type.\\nfunction gt(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() > y.unwrap();\\n}\\n\\n/// @notice Implements the greater than or equal to operation (>=) in the UD60x18 type.\\nfunction gte(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() >= y.unwrap();\\n}\\n\\n/// @notice Implements a zero comparison check function in the UD60x18 type.\\nfunction isZero(UD60x18 x) pure returns (bool result) {\\n // This wouldn't work if x could be negative.\\n result = x.unwrap() == 0;\\n}\\n\\n/// @notice Implements the left shift operation (<<) in the UD60x18 type.\\nfunction lshift(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() << bits);\\n}\\n\\n/// @notice Implements the lower than operation (<) in the UD60x18 type.\\nfunction lt(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() < y.unwrap();\\n}\\n\\n/// @notice Implements the lower than or equal to operation (<=) in the UD60x18 type.\\nfunction lte(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() <= y.unwrap();\\n}\\n\\n/// @notice Implements the checked modulo operation (%) in the UD60x18 type.\\nfunction mod(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() % y.unwrap());\\n}\\n\\n/// @notice Implements the not equal operation (!=) in the UD60x18 type.\\nfunction neq(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() != y.unwrap();\\n}\\n\\n/// @notice Implements the NOT (~) bitwise operation in the UD60x18 type.\\nfunction not(UD60x18 x) pure returns (UD60x18 result) {\\n result = wrap(~x.unwrap());\\n}\\n\\n/// @notice Implements the OR (|) bitwise operation in the UD60x18 type.\\nfunction or(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() | y.unwrap());\\n}\\n\\n/// @notice Implements the right shift operation (>>) in the UD60x18 type.\\nfunction rshift(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() >> bits);\\n}\\n\\n/// @notice Implements the checked subtraction operation (-) in the UD60x18 type.\\nfunction sub(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() - y.unwrap());\\n}\\n\\n/// @notice Implements the unchecked addition operation (+) in the UD60x18 type.\\nfunction uncheckedAdd(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() + y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the unchecked subtraction operation (-) in the UD60x18 type.\\nfunction uncheckedSub(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() - y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the XOR (^) bitwise operation in the UD60x18 type.\\nfunction xor(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() ^ y.unwrap());\\n}\\n\",\"keccak256\":\"0xf5faff881391d2c060029499a666cc5f0bea90a213150bb476fae8f02a5df268\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as Errors;\\nimport { wrap } from \\\"./Casting.sol\\\";\\nimport {\\n uEXP_MAX_INPUT,\\n uEXP2_MAX_INPUT,\\n uHALF_UNIT,\\n uLOG2_10,\\n uLOG2_E,\\n uMAX_UD60x18,\\n uMAX_WHOLE_UD60x18,\\n UNIT,\\n uUNIT,\\n uUNIT_SQUARED,\\n ZERO\\n} from \\\"./Constants.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n MATHEMATICAL FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @notice Calculates the arithmetic average of x and y using the following formula:\\n///\\n/// $$\\n/// avg(x, y) = (x & y) + ((xUint ^ yUint) / 2)\\n/// $$\\n///\\n/// In English, this is what this formula does:\\n///\\n/// 1. AND x and y.\\n/// 2. Calculate half of XOR x and y.\\n/// 3. Add the two results together.\\n///\\n/// This technique is known as SWAR, which stands for \\\"SIMD within a register\\\". You can read more about it here:\\n/// https://devblogs.microsoft.com/oldnewthing/20220207-00/?p=106223\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// @param x The first operand as a UD60x18 number.\\n/// @param y The second operand as a UD60x18 number.\\n/// @return result The arithmetic average as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction avg(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n uint256 yUint = y.unwrap();\\n unchecked {\\n result = wrap((xUint & yUint) + ((xUint ^ yUint) >> 1));\\n }\\n}\\n\\n/// @notice Yields the smallest whole number greater than or equal to x.\\n///\\n/// @dev This is optimized for fractional value inputs, because for every whole value there are (1e18 - 1) fractional\\n/// counterparts. See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n///\\n/// Requirements:\\n/// - x must be less than or equal to `MAX_WHOLE_UD60x18`.\\n///\\n/// @param x The UD60x18 number to ceil.\\n/// @param result The smallest whole number greater than or equal to x, as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ceil(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n if (xUint > uMAX_WHOLE_UD60x18) {\\n revert Errors.PRBMath_UD60x18_Ceil_Overflow(x);\\n }\\n\\n assembly (\\\"memory-safe\\\") {\\n // Equivalent to `x % UNIT`.\\n let remainder := mod(x, uUNIT)\\n\\n // Equivalent to `UNIT - remainder`.\\n let delta := sub(uUNIT, remainder)\\n\\n // Equivalent to `x + remainder > 0 ? delta : 0`.\\n result := add(x, mul(delta, gt(remainder, 0)))\\n }\\n}\\n\\n/// @notice Divides two UD60x18 numbers, returning a new UD60x18 number.\\n///\\n/// @dev Uses {Common.mulDiv} to enable overflow-safe multiplication and division.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv}.\\n///\\n/// @param x The numerator as a UD60x18 number.\\n/// @param y The denominator as a UD60x18 number.\\n/// @param result The quotient as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction div(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(Common.mulDiv(x.unwrap(), uUNIT, y.unwrap()));\\n}\\n\\n/// @notice Calculates the natural exponent of x using the following formula:\\n///\\n/// $$\\n/// e^x = 2^{x * log_2{e}}\\n/// $$\\n///\\n/// @dev Requirements:\\n/// - x must be less than 133_084258667509499441.\\n///\\n/// @param x The exponent as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n // This check prevents values greater than 192e18 from being passed to {exp2}.\\n if (xUint > uEXP_MAX_INPUT) {\\n revert Errors.PRBMath_UD60x18_Exp_InputTooBig(x);\\n }\\n\\n unchecked {\\n // Inline the fixed-point multiplication to save gas.\\n uint256 doubleUnitProduct = xUint * uLOG2_E;\\n result = exp2(wrap(doubleUnitProduct / uUNIT));\\n }\\n}\\n\\n/// @notice Calculates the binary exponent of x using the binary fraction method.\\n///\\n/// @dev See https://ethereum.stackexchange.com/q/79903/24693\\n///\\n/// Requirements:\\n/// - x must be less than 192e18.\\n/// - The result must fit in UD60x18.\\n///\\n/// @param x The exponent as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp2(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n // Numbers greater than or equal to 192e18 don't fit in the 192.64-bit format.\\n if (xUint > uEXP2_MAX_INPUT) {\\n revert Errors.PRBMath_UD60x18_Exp2_InputTooBig(x);\\n }\\n\\n // Convert x to the 192.64-bit fixed-point format.\\n uint256 x_192x64 = (xUint << 64) / uUNIT;\\n\\n // Pass x to the {Common.exp2} function, which uses the 192.64-bit fixed-point number representation.\\n result = wrap(Common.exp2(x_192x64));\\n}\\n\\n/// @notice Yields the greatest whole number less than or equal to x.\\n/// @dev Optimized for fractional value inputs, because every whole value has (1e18 - 1) fractional counterparts.\\n/// See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n/// @param x The UD60x18 number to floor.\\n/// @param result The greatest whole number less than or equal to x, as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction floor(UD60x18 x) pure returns (UD60x18 result) {\\n assembly (\\\"memory-safe\\\") {\\n // Equivalent to `x % UNIT`.\\n let remainder := mod(x, uUNIT)\\n\\n // Equivalent to `x - remainder > 0 ? remainder : 0)`.\\n result := sub(x, mul(remainder, gt(remainder, 0)))\\n }\\n}\\n\\n/// @notice Yields the excess beyond the floor of x using the odd function definition.\\n/// @dev See https://en.wikipedia.org/wiki/Fractional_part.\\n/// @param x The UD60x18 number to get the fractional part of.\\n/// @param result The fractional part of x as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction frac(UD60x18 x) pure returns (UD60x18 result) {\\n assembly (\\\"memory-safe\\\") {\\n result := mod(x, uUNIT)\\n }\\n}\\n\\n/// @notice Calculates the geometric mean of x and y, i.e. $\\\\sqrt{x * y}$, rounding down.\\n///\\n/// @dev Requirements:\\n/// - x * y must fit in UD60x18.\\n///\\n/// @param x The first operand as a UD60x18 number.\\n/// @param y The second operand as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction gm(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n uint256 yUint = y.unwrap();\\n if (xUint == 0 || yUint == 0) {\\n return ZERO;\\n }\\n\\n unchecked {\\n // Checking for overflow this way is faster than letting Solidity do it.\\n uint256 xyUint = xUint * yUint;\\n if (xyUint / xUint != yUint) {\\n revert Errors.PRBMath_UD60x18_Gm_Overflow(x, y);\\n }\\n\\n // We don't need to multiply the result by `UNIT` here because the x*y product picked up a factor of `UNIT`\\n // during multiplication. See the comments in {Common.sqrt}.\\n result = wrap(Common.sqrt(xyUint));\\n }\\n}\\n\\n/// @notice Calculates the inverse of x.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x must not be zero.\\n///\\n/// @param x The UD60x18 number for which to calculate the inverse.\\n/// @return result The inverse as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction inv(UD60x18 x) pure returns (UD60x18 result) {\\n unchecked {\\n result = wrap(uUNIT_SQUARED / x.unwrap());\\n }\\n}\\n\\n/// @notice Calculates the natural logarithm of x using the following formula:\\n///\\n/// $$\\n/// ln{x} = log_2{x} / log_2{e}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n/// - The precision isn't sufficiently fine-grained to return exactly `UNIT` when the input is `E`.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The UD60x18 number for which to calculate the natural logarithm.\\n/// @return result The natural logarithm as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ln(UD60x18 x) pure returns (UD60x18 result) {\\n unchecked {\\n // Inline the fixed-point multiplication to save gas. This is overflow-safe because the maximum value that\\n // {log2} can return is ~196_205294292027477728.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_E);\\n }\\n}\\n\\n/// @notice Calculates the common logarithm of x using the following formula:\\n///\\n/// $$\\n/// log_{10}{x} = log_2{x} / log_2{10}\\n/// $$\\n///\\n/// However, if x is an exact power of ten, a hard coded value is returned.\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The UD60x18 number for which to calculate the common logarithm.\\n/// @return result The common logarithm as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log10(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n if (xUint < uUNIT) {\\n revert Errors.PRBMath_UD60x18_Log_InputTooSmall(x);\\n }\\n\\n // Note that the `mul` in this assembly block is the standard multiplication operation, not {UD60x18.mul}.\\n // prettier-ignore\\n assembly (\\\"memory-safe\\\") {\\n switch x\\n case 1 { result := mul(uUNIT, sub(0, 18)) }\\n case 10 { result := mul(uUNIT, sub(1, 18)) }\\n case 100 { result := mul(uUNIT, sub(2, 18)) }\\n case 1000 { result := mul(uUNIT, sub(3, 18)) }\\n case 10000 { result := mul(uUNIT, sub(4, 18)) }\\n case 100000 { result := mul(uUNIT, sub(5, 18)) }\\n case 1000000 { result := mul(uUNIT, sub(6, 18)) }\\n case 10000000 { result := mul(uUNIT, sub(7, 18)) }\\n case 100000000 { result := mul(uUNIT, sub(8, 18)) }\\n case 1000000000 { result := mul(uUNIT, sub(9, 18)) }\\n case 10000000000 { result := mul(uUNIT, sub(10, 18)) }\\n case 100000000000 { result := mul(uUNIT, sub(11, 18)) }\\n case 1000000000000 { result := mul(uUNIT, sub(12, 18)) }\\n case 10000000000000 { result := mul(uUNIT, sub(13, 18)) }\\n case 100000000000000 { result := mul(uUNIT, sub(14, 18)) }\\n case 1000000000000000 { result := mul(uUNIT, sub(15, 18)) }\\n case 10000000000000000 { result := mul(uUNIT, sub(16, 18)) }\\n case 100000000000000000 { result := mul(uUNIT, sub(17, 18)) }\\n case 1000000000000000000 { result := 0 }\\n case 10000000000000000000 { result := uUNIT }\\n case 100000000000000000000 { result := mul(uUNIT, 2) }\\n case 1000000000000000000000 { result := mul(uUNIT, 3) }\\n case 10000000000000000000000 { result := mul(uUNIT, 4) }\\n case 100000000000000000000000 { result := mul(uUNIT, 5) }\\n case 1000000000000000000000000 { result := mul(uUNIT, 6) }\\n case 10000000000000000000000000 { result := mul(uUNIT, 7) }\\n case 100000000000000000000000000 { result := mul(uUNIT, 8) }\\n case 1000000000000000000000000000 { result := mul(uUNIT, 9) }\\n case 10000000000000000000000000000 { result := mul(uUNIT, 10) }\\n case 100000000000000000000000000000 { result := mul(uUNIT, 11) }\\n case 1000000000000000000000000000000 { result := mul(uUNIT, 12) }\\n case 10000000000000000000000000000000 { result := mul(uUNIT, 13) }\\n case 100000000000000000000000000000000 { result := mul(uUNIT, 14) }\\n case 1000000000000000000000000000000000 { result := mul(uUNIT, 15) }\\n case 10000000000000000000000000000000000 { result := mul(uUNIT, 16) }\\n case 100000000000000000000000000000000000 { result := mul(uUNIT, 17) }\\n case 1000000000000000000000000000000000000 { result := mul(uUNIT, 18) }\\n case 10000000000000000000000000000000000000 { result := mul(uUNIT, 19) }\\n case 100000000000000000000000000000000000000 { result := mul(uUNIT, 20) }\\n case 1000000000000000000000000000000000000000 { result := mul(uUNIT, 21) }\\n case 10000000000000000000000000000000000000000 { result := mul(uUNIT, 22) }\\n case 100000000000000000000000000000000000000000 { result := mul(uUNIT, 23) }\\n case 1000000000000000000000000000000000000000000 { result := mul(uUNIT, 24) }\\n case 10000000000000000000000000000000000000000000 { result := mul(uUNIT, 25) }\\n case 100000000000000000000000000000000000000000000 { result := mul(uUNIT, 26) }\\n case 1000000000000000000000000000000000000000000000 { result := mul(uUNIT, 27) }\\n case 10000000000000000000000000000000000000000000000 { result := mul(uUNIT, 28) }\\n case 100000000000000000000000000000000000000000000000 { result := mul(uUNIT, 29) }\\n case 1000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 30) }\\n case 10000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 31) }\\n case 100000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 32) }\\n case 1000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 33) }\\n case 10000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 34) }\\n case 100000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 35) }\\n case 1000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 36) }\\n case 10000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 37) }\\n case 100000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 38) }\\n case 1000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 39) }\\n case 10000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 40) }\\n case 100000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 41) }\\n case 1000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 42) }\\n case 10000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 43) }\\n case 100000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 44) }\\n case 1000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 45) }\\n case 10000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 46) }\\n case 100000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 47) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 48) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 49) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 50) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 51) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 52) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 53) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 54) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 55) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 56) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 57) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 58) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 59) }\\n default { result := uMAX_UD60x18 }\\n }\\n\\n if (result.unwrap() == uMAX_UD60x18) {\\n unchecked {\\n // Inline the fixed-point division to save gas.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_10);\\n }\\n }\\n}\\n\\n/// @notice Calculates the binary logarithm of x using the iterative approximation algorithm:\\n///\\n/// $$\\n/// log_2{x} = n + log_2{y}, \\\\text{ where } y = x*2^{-n}, \\\\ y \\\\in [1, 2)\\n/// $$\\n///\\n/// For $0 \\\\leq x \\\\lt 1$, the input is inverted:\\n///\\n/// $$\\n/// log_2{x} = -log_2{\\\\frac{1}{x}}\\n/// $$\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Binary_logarithm#Iterative_approximation\\n///\\n/// Notes:\\n/// - Due to the lossy precision of the iterative approximation, the results are not perfectly accurate to the last decimal.\\n///\\n/// Requirements:\\n/// - x must be greater than zero.\\n///\\n/// @param x The UD60x18 number for which to calculate the binary logarithm.\\n/// @return result The binary logarithm as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log2(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n if (xUint < uUNIT) {\\n revert Errors.PRBMath_UD60x18_Log_InputTooSmall(x);\\n }\\n\\n unchecked {\\n // Calculate the integer part of the logarithm.\\n uint256 n = Common.msb(xUint / uUNIT);\\n\\n // This is the integer part of the logarithm as a UD60x18 number. The operation can't overflow because n\\n // n is at most 255 and UNIT is 1e18.\\n uint256 resultUint = n * uUNIT;\\n\\n // Calculate $y = x * 2^{-n}$.\\n uint256 y = xUint >> n;\\n\\n // If y is the unit number, the fractional part is zero.\\n if (y == uUNIT) {\\n return wrap(resultUint);\\n }\\n\\n // Calculate the fractional part via the iterative approximation.\\n // The `delta >>= 1` part is equivalent to `delta /= 2`, but shifting bits is more gas efficient.\\n uint256 DOUBLE_UNIT = 2e18;\\n for (uint256 delta = uHALF_UNIT; delta > 0; delta >>= 1) {\\n y = (y * y) / uUNIT;\\n\\n // Is y^2 >= 2e18 and so in the range [2e18, 4e18)?\\n if (y >= DOUBLE_UNIT) {\\n // Add the 2^{-m} factor to the logarithm.\\n resultUint += delta;\\n\\n // Halve y, which corresponds to z/2 in the Wikipedia article.\\n y >>= 1;\\n }\\n }\\n result = wrap(resultUint);\\n }\\n}\\n\\n/// @notice Multiplies two UD60x18 numbers together, returning a new UD60x18 number.\\n///\\n/// @dev Uses {Common.mulDiv} to enable overflow-safe multiplication and division.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv}.\\n///\\n/// @dev See the documentation in {Common.mulDiv18}.\\n/// @param x The multiplicand as a UD60x18 number.\\n/// @param y The multiplier as a UD60x18 number.\\n/// @return result The product as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mul(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(Common.mulDiv18(x.unwrap(), y.unwrap()));\\n}\\n\\n/// @notice Raises x to the power of y.\\n///\\n/// For $1 \\\\leq x \\\\leq \\\\infty$, the following standard formula is used:\\n///\\n/// $$\\n/// x^y = 2^{log_2{x} * y}\\n/// $$\\n///\\n/// For $0 \\\\leq x \\\\lt 1$, since the unsigned {log2} is undefined, an equivalent formula is used:\\n///\\n/// $$\\n/// i = \\\\frac{1}{x}\\n/// w = 2^{log_2{i} * y}\\n/// x^y = \\\\frac{1}{w}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2} and {mul}.\\n/// - Returns `UNIT` for 0^0.\\n/// - It may not perform well with very small values of x. Consider using SD59x18 as an alternative.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {exp2}, {log2}, and {mul}.\\n///\\n/// @param x The base as a UD60x18 number.\\n/// @param y The exponent as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction pow(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n uint256 yUint = y.unwrap();\\n\\n // If both x and y are zero, the result is `UNIT`. If just x is zero, the result is always zero.\\n if (xUint == 0) {\\n return yUint == 0 ? UNIT : ZERO;\\n }\\n // If x is `UNIT`, the result is always `UNIT`.\\n else if (xUint == uUNIT) {\\n return UNIT;\\n }\\n\\n // If y is zero, the result is always `UNIT`.\\n if (yUint == 0) {\\n return UNIT;\\n }\\n // If y is `UNIT`, the result is always x.\\n else if (yUint == uUNIT) {\\n return x;\\n }\\n\\n // If x is greater than `UNIT`, use the standard formula.\\n if (xUint > uUNIT) {\\n result = exp2(mul(log2(x), y));\\n }\\n // Conversely, if x is less than `UNIT`, use the equivalent formula.\\n else {\\n UD60x18 i = wrap(uUNIT_SQUARED / xUint);\\n UD60x18 w = exp2(mul(log2(i), y));\\n result = wrap(uUNIT_SQUARED / w.unwrap());\\n }\\n}\\n\\n/// @notice Raises x (a UD60x18 number) to the power y (an unsigned basic integer) using the well-known\\n/// algorithm \\\"exponentiation by squaring\\\".\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Exponentiation_by_squaring.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv18}.\\n/// - Returns `UNIT` for 0^0.\\n///\\n/// Requirements:\\n/// - The result must fit in UD60x18.\\n///\\n/// @param x The base as a UD60x18 number.\\n/// @param y The exponent as a uint256.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction powu(UD60x18 x, uint256 y) pure returns (UD60x18 result) {\\n // Calculate the first iteration of the loop in advance.\\n uint256 xUint = x.unwrap();\\n uint256 resultUint = y & 1 > 0 ? xUint : uUNIT;\\n\\n // Equivalent to `for(y /= 2; y > 0; y /= 2)`.\\n for (y >>= 1; y > 0; y >>= 1) {\\n xUint = Common.mulDiv18(xUint, xUint);\\n\\n // Equivalent to `y % 2 == 1`.\\n if (y & 1 > 0) {\\n resultUint = Common.mulDiv18(resultUint, xUint);\\n }\\n }\\n result = wrap(resultUint);\\n}\\n\\n/// @notice Calculates the square root of x using the Babylonian method.\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\\n///\\n/// Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x must be less than `MAX_UD60x18 / UNIT`.\\n///\\n/// @param x The UD60x18 number for which to calculate the square root.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction sqrt(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n unchecked {\\n if (xUint > uMAX_UD60x18 / uUNIT) {\\n revert Errors.PRBMath_UD60x18_Sqrt_Overflow(x);\\n }\\n // Multiply x by `UNIT` to account for the factor of `UNIT` picked up when multiplying two UD60x18 numbers.\\n // In this case, the two numbers are both the square root.\\n result = wrap(Common.sqrt(xUint * uUNIT));\\n }\\n}\\n\",\"keccak256\":\"0x462144667aac3f96d5f8dba7aa68fe4c5a3f61e1d7bbbc81bee21168817f9c09\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\nimport \\\"./Helpers.sol\\\" as Helpers;\\nimport \\\"./Math.sol\\\" as Math;\\n\\n/// @notice The unsigned 60.18-decimal fixed-point number representation, which can have up to 60 digits and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the Solidity type uint256.\\n/// @dev The value type is defined here so it can be imported in all other files.\\ntype UD60x18 is uint256;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoSD1x18,\\n Casting.intoUD2x18,\\n Casting.intoSD59x18,\\n Casting.intoUint128,\\n Casting.intoUint256,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for UD60x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n MATHEMATICAL FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes the functions in this library callable on the UD60x18 type.\\nusing {\\n Math.avg,\\n Math.ceil,\\n Math.div,\\n Math.exp,\\n Math.exp2,\\n Math.floor,\\n Math.frac,\\n Math.gm,\\n Math.inv,\\n Math.ln,\\n Math.log10,\\n Math.log2,\\n Math.mul,\\n Math.pow,\\n Math.powu,\\n Math.sqrt\\n} for UD60x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n HELPER FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes the functions in this library callable on the UD60x18 type.\\nusing {\\n Helpers.add,\\n Helpers.and,\\n Helpers.eq,\\n Helpers.gt,\\n Helpers.gte,\\n Helpers.isZero,\\n Helpers.lshift,\\n Helpers.lt,\\n Helpers.lte,\\n Helpers.mod,\\n Helpers.neq,\\n Helpers.not,\\n Helpers.or,\\n Helpers.rshift,\\n Helpers.sub,\\n Helpers.uncheckedAdd,\\n Helpers.uncheckedSub,\\n Helpers.xor\\n} for UD60x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n OPERATORS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes it possible to use these operators on the UD60x18 type.\\nusing {\\n Helpers.add as +,\\n Helpers.and2 as &,\\n Math.div as /,\\n Helpers.eq as ==,\\n Helpers.gt as >,\\n Helpers.gte as >=,\\n Helpers.lt as <,\\n Helpers.lte as <=,\\n Helpers.or as |,\\n Helpers.mod as %,\\n Math.mul as *,\\n Helpers.neq as !=,\\n Helpers.not as ~,\\n Helpers.sub as -,\\n Helpers.xor as ^\\n} for UD60x18 global;\\n\",\"keccak256\":\"0xdd873b5124180d9b71498b3a7fe93b1c08c368bec741f7d5f8e17f78a0b70f31\",\"license\":\"MIT\"},\"contracts/interfaces/IERC6551Registry.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\ninterface IERC6551Registry {\\n /**\\n * @dev Creates a token bound account for a non-fungible token.\\n *\\n * If account has already been created, returns the account address without calling create2.\\n *\\n * Emits ERC6551AccountCreated event.\\n *\\n * @return account The address of the token bound account\\n */\\n function createAccount(\\n address implementation,\\n bytes32 salt,\\n uint256 chainId,\\n address tokenContract,\\n uint256 tokenId\\n ) external returns (address account);\\n}\\n\",\"keccak256\":\"0x64c52de8a8e68398e61dd8b42dda8e9af8cf6abf93bb85629c322440991ea568\",\"license\":\"MIT\"},\"contracts/interfaces/hats/HatsErrors.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface HatsErrors {\\n /// @notice Emitted when `user` is attempting to perform an action on `hatId` but is not wearing one of `hatId`'s admin hats\\n /// @dev Can be equivalent to `NotHatWearer(buildHatId(hatId))`, such as when emitted by `approveLinkTopHatToTree` or `relinkTopHatToTree`\\n error NotAdmin(address user, uint256 hatId);\\n\\n /// @notice Emitted when attempting to perform an action as or for an account that is not a wearer of a given hat\\n error NotHatWearer();\\n\\n /// @notice Emitted when attempting to perform an action that requires being either an admin or wearer of a given hat\\n error NotAdminOrWearer();\\n\\n /// @notice Emitted when attempting to mint `hatId` but `hatId`'s maxSupply has been reached\\n error AllHatsWorn(uint256 hatId);\\n\\n /// @notice Emitted when attempting to create a hat with a level 14 hat as its admin\\n error MaxLevelsReached();\\n\\n /// @notice Emitted when an attempted hat id has empty intermediate level(s)\\n error InvalidHatId();\\n\\n /// @notice Emitted when attempting to mint `hatId` to a `wearer` who is already wearing the hat\\n error AlreadyWearingHat(address wearer, uint256 hatId);\\n\\n /// @notice Emitted when attempting to mint a non-existant hat\\n error HatDoesNotExist(uint256 hatId);\\n\\n /// @notice Emmitted when attempting to mint or transfer a hat that is not active\\n error HatNotActive();\\n\\n /// @notice Emitted when attempting to mint or transfer a hat to an ineligible wearer\\n error NotEligible();\\n\\n /// @notice Emitted when attempting to check or set a hat's status from an account that is not that hat's toggle module\\n error NotHatsToggle();\\n\\n /// @notice Emitted when attempting to check or set a hat wearer's status from an account that is not that hat's eligibility module\\n error NotHatsEligibility();\\n\\n /// @notice Emitted when array arguments to a batch function have mismatching lengths\\n error BatchArrayLengthMismatch();\\n\\n /// @notice Emitted when attempting to mutate or transfer an immutable hat\\n error Immutable();\\n\\n /// @notice Emitted when attempting to change a hat's maxSupply to a value lower than its current supply\\n error NewMaxSupplyTooLow();\\n\\n /// @notice Emitted when attempting to link a tophat to a new admin for which the tophat serves as an admin\\n error CircularLinkage();\\n\\n /// @notice Emitted when attempting to link or relink a tophat to a separate tree\\n error CrossTreeLinkage();\\n\\n /// @notice Emitted when attempting to link a tophat without a request\\n error LinkageNotRequested();\\n\\n /// @notice Emitted when attempting to unlink a tophat that does not have a wearer\\n /// @dev This ensures that unlinking never results in a bricked tophat\\n error InvalidUnlink();\\n\\n /// @notice Emmited when attempting to change a hat's eligibility or toggle module to the zero address\\n error ZeroAddress();\\n\\n /// @notice Emmitted when attempting to change a hat's details or imageURI to a string with over 7000 bytes (~characters)\\n /// @dev This protects against a DOS attack where an admin iteratively extend's a hat's details or imageURI\\n /// to be so long that reading it exceeds the block gas limit, breaking `uri()` and `viewHat()`\\n error StringTooLong();\\n}\\n\",\"keccak256\":\"0x81b0056b7bed86eabc07c0e4a9655c586ddb8e6c128320593669b76efd5a08de\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/HatsEvents.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface HatsEvents {\\n /// @notice Emitted when a new hat is created\\n /// @param id The id for the new hat\\n /// @param details A description of the Hat\\n /// @param maxSupply The total instances of the Hat that can be worn at once\\n /// @param eligibility The address that can report on the Hat wearer's status\\n /// @param toggle The address that can deactivate the Hat\\n /// @param mutable_ Whether the hat's properties are changeable after creation\\n /// @param imageURI The image uri for this hat and the fallback for its\\n event HatCreated(\\n uint256 id,\\n string details,\\n uint32 maxSupply,\\n address eligibility,\\n address toggle,\\n bool mutable_,\\n string imageURI\\n );\\n\\n /// @notice Emitted when a hat wearer's standing is updated\\n /// @dev Eligibility is excluded since the source of truth for eligibility is the eligibility module and may change without a transaction\\n /// @param hatId The id of the wearer's hat\\n /// @param wearer The wearer's address\\n /// @param wearerStanding Whether the wearer is in good standing for the hat\\n event WearerStandingChanged(\\n uint256 hatId,\\n address wearer,\\n bool wearerStanding\\n );\\n\\n /// @notice Emitted when a hat's status is updated\\n /// @param hatId The id of the hat\\n /// @param newStatus Whether the hat is active\\n event HatStatusChanged(uint256 hatId, bool newStatus);\\n\\n /// @notice Emitted when a hat's details are updated\\n /// @param hatId The id of the hat\\n /// @param newDetails The updated details\\n event HatDetailsChanged(uint256 hatId, string newDetails);\\n\\n /// @notice Emitted when a hat's eligibility module is updated\\n /// @param hatId The id of the hat\\n /// @param newEligibility The updated eligibiliy module\\n event HatEligibilityChanged(uint256 hatId, address newEligibility);\\n\\n /// @notice Emitted when a hat's toggle module is updated\\n /// @param hatId The id of the hat\\n /// @param newToggle The updated toggle module\\n event HatToggleChanged(uint256 hatId, address newToggle);\\n\\n /// @notice Emitted when a hat's mutability is updated\\n /// @param hatId The id of the hat\\n event HatMutabilityChanged(uint256 hatId);\\n\\n /// @notice Emitted when a hat's maximum supply is updated\\n /// @param hatId The id of the hat\\n /// @param newMaxSupply The updated max supply\\n event HatMaxSupplyChanged(uint256 hatId, uint32 newMaxSupply);\\n\\n /// @notice Emitted when a hat's image URI is updated\\n /// @param hatId The id of the hat\\n /// @param newImageURI The updated image URI\\n event HatImageURIChanged(uint256 hatId, string newImageURI);\\n\\n /// @notice Emitted when a tophat linkage is requested by its admin\\n /// @param domain The domain of the tree tophat to link\\n /// @param newAdmin The tophat's would-be admin in the parent tree\\n event TopHatLinkRequested(uint32 domain, uint256 newAdmin);\\n\\n /// @notice Emitted when a tophat is linked to a another tree\\n /// @param domain The domain of the newly-linked tophat\\n /// @param newAdmin The tophat's new admin in the parent tree\\n event TopHatLinked(uint32 domain, uint256 newAdmin);\\n}\\n\",\"keccak256\":\"0x53413397d15e1636c3cd7bd667656b79bc2886785403b824bcd4ed122667f2c6\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/IHats.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\nimport \\\"./IHatsIdUtilities.sol\\\";\\nimport \\\"./HatsErrors.sol\\\";\\nimport \\\"./HatsEvents.sol\\\";\\n\\ninterface IHats is IHatsIdUtilities, HatsErrors, HatsEvents {\\n function mintTopHat(\\n address _target,\\n string memory _details,\\n string memory _imageURI\\n ) external returns (uint256 topHatId);\\n\\n function createHat(\\n uint256 _admin,\\n string calldata _details,\\n uint32 _maxSupply,\\n address _eligibility,\\n address _toggle,\\n bool _mutable,\\n string calldata _imageURI\\n ) external returns (uint256 newHatId);\\n\\n function batchCreateHats(\\n uint256[] calldata _admins,\\n string[] calldata _details,\\n uint32[] calldata _maxSupplies,\\n address[] memory _eligibilityModules,\\n address[] memory _toggleModules,\\n bool[] calldata _mutables,\\n string[] calldata _imageURIs\\n ) external returns (bool success);\\n\\n function getNextId(uint256 _admin) external view returns (uint256 nextId);\\n\\n function mintHat(\\n uint256 _hatId,\\n address _wearer\\n ) external returns (bool success);\\n\\n function batchMintHats(\\n uint256[] calldata _hatIds,\\n address[] calldata _wearers\\n ) external returns (bool success);\\n\\n function setHatStatus(\\n uint256 _hatId,\\n bool _newStatus\\n ) external returns (bool toggled);\\n\\n function checkHatStatus(uint256 _hatId) external returns (bool toggled);\\n\\n function setHatWearerStatus(\\n uint256 _hatId,\\n address _wearer,\\n bool _eligible,\\n bool _standing\\n ) external returns (bool updated);\\n\\n function checkHatWearerStatus(\\n uint256 _hatId,\\n address _wearer\\n ) external returns (bool updated);\\n\\n function renounceHat(uint256 _hatId) external;\\n\\n function transferHat(uint256 _hatId, address _from, address _to) external;\\n\\n /*//////////////////////////////////////////////////////////////\\n HATS ADMIN FUNCTIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n function makeHatImmutable(uint256 _hatId) external;\\n\\n function changeHatDetails(\\n uint256 _hatId,\\n string memory _newDetails\\n ) external;\\n\\n function changeHatEligibility(\\n uint256 _hatId,\\n address _newEligibility\\n ) external;\\n\\n function changeHatToggle(uint256 _hatId, address _newToggle) external;\\n\\n function changeHatImageURI(\\n uint256 _hatId,\\n string memory _newImageURI\\n ) external;\\n\\n function changeHatMaxSupply(uint256 _hatId, uint32 _newMaxSupply) external;\\n\\n function requestLinkTopHatToTree(\\n uint32 _topHatId,\\n uint256 _newAdminHat\\n ) external;\\n\\n function approveLinkTopHatToTree(\\n uint32 _topHatId,\\n uint256 _newAdminHat,\\n address _eligibility,\\n address _toggle,\\n string calldata _details,\\n string calldata _imageURI\\n ) external;\\n\\n function unlinkTopHatFromTree(uint32 _topHatId, address _wearer) external;\\n\\n function relinkTopHatWithinTree(\\n uint32 _topHatDomain,\\n uint256 _newAdminHat,\\n address _eligibility,\\n address _toggle,\\n string calldata _details,\\n string calldata _imageURI\\n ) external;\\n\\n /*//////////////////////////////////////////////////////////////\\n VIEW FUNCTIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n function viewHat(\\n uint256 _hatId\\n )\\n external\\n view\\n returns (\\n string memory details,\\n uint32 maxSupply,\\n uint32 supply,\\n address eligibility,\\n address toggle,\\n string memory imageURI,\\n uint16 lastHatId,\\n bool mutable_,\\n bool active\\n );\\n\\n function isWearerOfHat(\\n address _user,\\n uint256 _hatId\\n ) external view returns (bool isWearer);\\n\\n function isAdminOfHat(\\n address _user,\\n uint256 _hatId\\n ) external view returns (bool isAdmin);\\n\\n function isInGoodStanding(\\n address _wearer,\\n uint256 _hatId\\n ) external view returns (bool standing);\\n\\n function isEligible(\\n address _wearer,\\n uint256 _hatId\\n ) external view returns (bool eligible);\\n\\n function getHatEligibilityModule(\\n uint256 _hatId\\n ) external view returns (address eligibility);\\n\\n function getHatToggleModule(\\n uint256 _hatId\\n ) external view returns (address toggle);\\n\\n function getHatMaxSupply(\\n uint256 _hatId\\n ) external view returns (uint32 maxSupply);\\n\\n function hatSupply(uint256 _hatId) external view returns (uint32 supply);\\n\\n function getImageURIForHat(\\n uint256 _hatId\\n ) external view returns (string memory _uri);\\n\\n function balanceOf(\\n address wearer,\\n uint256 hatId\\n ) external view returns (uint256 balance);\\n\\n function balanceOfBatch(\\n address[] calldata _wearers,\\n uint256[] calldata _hatIds\\n ) external view returns (uint256[] memory);\\n\\n function uri(uint256 id) external view returns (string memory _uri);\\n}\\n\",\"keccak256\":\"0x2867004bddc5148fa1937f25c0403e5d9977583aaf50fdbdb74bd463f64f21c8\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/IHatsIdUtilities.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface IHatsIdUtilities {\\n function buildHatId(\\n uint256 _admin,\\n uint16 _newHat\\n ) external pure returns (uint256 id);\\n\\n function getHatLevel(uint256 _hatId) external view returns (uint32 level);\\n\\n function getLocalHatLevel(\\n uint256 _hatId\\n ) external pure returns (uint32 level);\\n\\n function isTopHat(uint256 _hatId) external view returns (bool _topHat);\\n\\n function isLocalTopHat(\\n uint256 _hatId\\n ) external pure returns (bool _localTopHat);\\n\\n function isValidHatId(\\n uint256 _hatId\\n ) external view returns (bool validHatId);\\n\\n function getAdminAtLevel(\\n uint256 _hatId,\\n uint32 _level\\n ) external view returns (uint256 admin);\\n\\n function getAdminAtLocalLevel(\\n uint256 _hatId,\\n uint32 _level\\n ) external pure returns (uint256 admin);\\n\\n function getTopHatDomain(\\n uint256 _hatId\\n ) external view returns (uint32 domain);\\n\\n function getTippyTopHatDomain(\\n uint32 _topHatDomain\\n ) external view returns (uint32 domain);\\n\\n function noCircularLinkage(\\n uint32 _topHatDomain,\\n uint256 _linkedAdmin\\n ) external view returns (bool notCircular);\\n\\n function sameTippyTopHatDomain(\\n uint32 _topHatDomain,\\n uint256 _newAdminHat\\n ) external view returns (bool sameDomain);\\n}\\n\",\"keccak256\":\"0x007fcc07b20bf84bacad1f9a2ddf4e30e1a8be961e144b7bef8e98a51781aee9\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/IHatsModuleFactory.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.19;\\n\\ninterface IHatsModuleFactory {\\n error HatsModuleFactory_ModuleAlreadyDeployed(\\n address implementation,\\n uint256 hatId,\\n bytes otherImmutableArgs,\\n uint256 saltNonce\\n );\\n\\n error BatchArrayLengthMismatch();\\n\\n event HatsModuleFactory_ModuleDeployed(\\n address implementation,\\n address instance,\\n uint256 hatId,\\n bytes otherImmutableArgs,\\n bytes initData,\\n uint256 saltNonce\\n );\\n\\n function HATS() external view returns (address);\\n\\n function version() external view returns (string memory);\\n\\n function createHatsModule(\\n address _implementation,\\n uint256 _hatId,\\n bytes calldata _otherImmutableArgs,\\n bytes calldata _initData,\\n uint256 _saltNonce\\n ) external returns (address _instance);\\n\\n function batchCreateHatsModule(\\n address[] calldata _implementations,\\n uint256[] calldata _hatIds,\\n bytes[] calldata _otherImmutableArgsArray,\\n bytes[] calldata _initDataArray,\\n uint256[] calldata _saltNonces\\n ) external returns (bool success);\\n\\n function getHatsModuleAddress(\\n address _implementation,\\n uint256 _hatId,\\n bytes calldata _otherImmutableArgs,\\n uint256 _saltNonce\\n ) external view returns (address);\\n\\n function deployed(\\n address _implementation,\\n uint256 _hatId,\\n bytes calldata _otherImmutableArgs,\\n uint256 _saltNonce\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x861faf40785cedb829243116d492653414a367853408a5c27d201522f6c3bfdd\",\"license\":\"MIT\"},\"contracts/interfaces/sablier/IAdminable.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\n/// @title IAdminable\\n/// @notice Contract module that provides a basic access control mechanism, with an admin that can be\\n/// granted exclusive access to specific functions. The inheriting contract must set the initial admin\\n/// in the constructor.\\ninterface IAdminable {\\n /*//////////////////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Emitted when the admin is transferred.\\n /// @param oldAdmin The address of the old admin.\\n /// @param newAdmin The address of the new admin.\\n event TransferAdmin(address indexed oldAdmin, address indexed newAdmin);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice The address of the admin account or contract.\\n function admin() external view returns (address);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n NON-CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Transfers the contract admin to a new address.\\n ///\\n /// @dev Notes:\\n /// - Does not revert if the admin is the same.\\n /// - This function can potentially leave the contract without an admin, thereby removing any\\n /// functionality that is only available to the admin.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the contract admin.\\n ///\\n /// @param newAdmin The address of the new admin.\\n function transferAdmin(address newAdmin) external;\\n}\\n\",\"keccak256\":\"0xa279c49e51228b571329164e36250e82b2c1378e8b549194ab7dd90fca9c3b2b\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/IERC4096.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 \\\"@openzeppelin/contracts/interfaces/IERC165.sol\\\";\\nimport {IERC721} from \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\n\\n/// @title ERC-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\",\"keccak256\":\"0xa34b9c52cbe36be860244f52256f1b05badf0cb797d208664b87337610d0e82d\",\"license\":\"MIT\"},\"contracts/interfaces/sablier/ISablierV2Lockup.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC4906} from \\\"./IERC4096.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IERC721Metadata} from \\\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\\\";\\nimport {UD60x18} from \\\"@prb/math/src/UD60x18.sol\\\";\\n\\nimport {Lockup} from \\\"./types/DataTypes.sol\\\";\\nimport {IAdminable} from \\\"./IAdminable.sol\\\";\\nimport {ISablierV2NFTDescriptor} from \\\"./ISablierV2NFTDescriptor.sol\\\";\\n\\n/// @title ISablierV2Lockup\\n/// @notice Common logic between all Sablier V2 Lockup contracts.\\ninterface ISablierV2Lockup is\\n IAdminable, // 0 inherited components\\n IERC4906, // 2 inherited components\\n IERC721Metadata // 2 inherited components\\n{\\n /*//////////////////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Emitted when the admin allows a new recipient contract to hook to Sablier.\\n /// @param admin The address of the current contract admin.\\n /// @param recipient The address of the recipient contract put on the allowlist.\\n event AllowToHook(address indexed admin, address recipient);\\n\\n /// @notice Emitted when a stream is canceled.\\n /// @param streamId The ID of the stream.\\n /// @param sender The address of the stream's sender.\\n /// @param recipient The address of the stream's recipient.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param senderAmount The amount of assets refunded to the stream's sender, denoted in units of the asset's\\n /// decimals.\\n /// @param recipientAmount The amount of assets left for the stream's recipient to withdraw, denoted in units of the\\n /// asset's decimals.\\n event CancelLockupStream(\\n uint256 streamId,\\n address indexed sender,\\n address indexed recipient,\\n IERC20 indexed asset,\\n uint128 senderAmount,\\n uint128 recipientAmount\\n );\\n\\n /// @notice Emitted when a sender gives up the right to cancel a stream.\\n /// @param streamId The ID of the stream.\\n event RenounceLockupStream(uint256 indexed streamId);\\n\\n /// @notice Emitted when the admin sets a new NFT descriptor contract.\\n /// @param admin The address of the current contract admin.\\n /// @param oldNFTDescriptor The address of the old NFT descriptor contract.\\n /// @param newNFTDescriptor The address of the new NFT descriptor contract.\\n event SetNFTDescriptor(\\n address indexed admin,\\n ISablierV2NFTDescriptor oldNFTDescriptor,\\n ISablierV2NFTDescriptor newNFTDescriptor\\n );\\n\\n /// @notice Emitted when assets are withdrawn from a stream.\\n /// @param streamId The ID of the stream.\\n /// @param to The address that has received the withdrawn assets.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param amount The amount of assets withdrawn, denoted in units of the asset's decimals.\\n event WithdrawFromLockupStream(\\n uint256 indexed streamId,\\n address indexed to,\\n IERC20 indexed asset,\\n uint128 amount\\n );\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Retrieves the address of the ERC-20 asset to be distributed.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getAsset(uint256 streamId) external view returns (IERC20 asset);\\n\\n /// @notice Retrieves the amount deposited in the stream, denoted in units of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getDepositedAmount(\\n uint256 streamId\\n ) external view returns (uint128 depositedAmount);\\n\\n /// @notice Retrieves the stream's end time, which is a Unix timestamp.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getEndTime(\\n uint256 streamId\\n ) external view returns (uint40 endTime);\\n\\n /// @notice Retrieves the stream's recipient.\\n /// @dev Reverts if the NFT has been burned.\\n /// @param streamId The stream ID for the query.\\n function getRecipient(\\n uint256 streamId\\n ) external view returns (address recipient);\\n\\n /// @notice Retrieves the amount refunded to the sender after a cancellation, denoted in units of the asset's\\n /// decimals. This amount is always zero unless the stream was canceled.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getRefundedAmount(\\n uint256 streamId\\n ) external view returns (uint128 refundedAmount);\\n\\n /// @notice Retrieves the stream's sender.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getSender(uint256 streamId) external view returns (address sender);\\n\\n /// @notice Retrieves the stream's start time, which is a Unix timestamp.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getStartTime(\\n uint256 streamId\\n ) external view returns (uint40 startTime);\\n\\n /// @notice Retrieves the amount withdrawn from the stream, denoted in units of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getWithdrawnAmount(\\n uint256 streamId\\n ) external view returns (uint128 withdrawnAmount);\\n\\n /// @notice Retrieves a flag indicating whether the provided address is a contract allowed to hook to Sablier\\n /// when a stream is canceled or when assets are withdrawn.\\n /// @dev See {ISablierLockupRecipient} for more information.\\n function isAllowedToHook(\\n address recipient\\n ) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream can be canceled. When the stream is cold, this\\n /// flag is always `false`.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isCancelable(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream is cold, i.e. settled, canceled, or depleted.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isCold(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream is depleted.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isDepleted(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream exists.\\n /// @dev Does not revert if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isStream(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream NFT can be transferred.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isTransferable(\\n uint256 streamId\\n ) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream is warm, i.e. either pending or streaming.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isWarm(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves the maximum broker fee that can be charged by the broker, denoted as a fixed-point\\n /// number where 1e18 is 100%.\\n /// @dev This value is hard coded as a constant.\\n function MAX_BROKER_FEE() external view returns (UD60x18);\\n\\n /// @notice Counter for stream IDs, used in the create functions.\\n function nextStreamId() external view returns (uint256);\\n\\n /// @notice Contract that generates the non-fungible token URI.\\n function nftDescriptor() external view returns (ISablierV2NFTDescriptor);\\n\\n /// @notice Calculates the amount that the sender would be refunded if the stream were canceled, denoted in units\\n /// of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function refundableAmountOf(\\n uint256 streamId\\n ) external view returns (uint128 refundableAmount);\\n\\n /// @notice Retrieves the stream's status.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function statusOf(\\n uint256 streamId\\n ) external view returns (Lockup.Status status);\\n\\n /// @notice Calculates the amount streamed to the recipient, denoted in units of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n ///\\n /// Notes:\\n /// - Upon cancellation of the stream, the amount streamed is calculated as the difference between the deposited\\n /// amount and the refunded amount. Ultimately, when the stream becomes depleted, the streamed amount is equivalent\\n /// to the total amount withdrawn.\\n ///\\n /// @param streamId The stream ID for the query.\\n function streamedAmountOf(\\n uint256 streamId\\n ) external view returns (uint128 streamedAmount);\\n\\n /// @notice Retrieves a flag indicating whether the stream was canceled.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function wasCanceled(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Calculates the amount that the recipient can withdraw from the stream, denoted in units of the asset's\\n /// decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function withdrawableAmountOf(\\n uint256 streamId\\n ) external view returns (uint128 withdrawableAmount);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n NON-CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Allows a recipient contract to hook to Sablier when a stream is canceled or when assets are withdrawn.\\n /// Useful for implementing contracts that hold streams on behalf of users, such as vaults or staking contracts.\\n ///\\n /// @dev Emits an {AllowToHook} event.\\n ///\\n /// Notes:\\n /// - Does not revert if the contract is already on the allowlist.\\n /// - This is an irreversible operation. The contract cannot be removed from the allowlist.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the contract admin.\\n /// - `recipient` must have a non-zero code size.\\n /// - `recipient` must implement {ISablierLockupRecipient}.\\n ///\\n /// @param recipient The address of the contract to allow for hooks.\\n function allowToHook(address recipient) external;\\n\\n /// @notice Burns the NFT associated with the stream.\\n ///\\n /// @dev Emits a {Transfer} event.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `streamId` must reference a depleted stream.\\n /// - The NFT must exist.\\n /// - `msg.sender` must be either the NFT owner or an approved third party.\\n ///\\n /// @param streamId The ID of the stream NFT to burn.\\n function burn(uint256 streamId) external;\\n\\n /// @notice Cancels the stream and refunds any remaining assets to the sender.\\n ///\\n /// @dev Emits a {Transfer}, {CancelLockupStream}, and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - If there any assets left for the recipient to withdraw, the stream is marked as canceled. Otherwise, the\\n /// stream is marked as depleted.\\n /// - This function attempts to invoke a hook on the recipient, if the resolved address is a contract.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - The stream must be warm and cancelable.\\n /// - `msg.sender` must be the stream's sender.\\n ///\\n /// @param streamId The ID of the stream to cancel.\\n function cancel(uint256 streamId) external;\\n\\n /// @notice Cancels multiple streams and refunds any remaining assets to the sender.\\n ///\\n /// @dev Emits multiple {Transfer}, {CancelLockupStream}, and {MetadataUpdate} events.\\n ///\\n /// Notes:\\n /// - Refer to the notes in {cancel}.\\n ///\\n /// Requirements:\\n /// - All requirements from {cancel} must be met for each stream.\\n ///\\n /// @param streamIds The IDs of the streams to cancel.\\n function cancelMultiple(uint256[] calldata streamIds) external;\\n\\n /// @notice Removes the right of the stream's sender to cancel the stream.\\n ///\\n /// @dev Emits a {RenounceLockupStream} and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - This is an irreversible operation.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `streamId` must reference a warm stream.\\n /// - `msg.sender` must be the stream's sender.\\n /// - The stream must be cancelable.\\n ///\\n /// @param streamId The ID of the stream to renounce.\\n function renounce(uint256 streamId) external;\\n\\n /// @notice Sets a new NFT descriptor contract, which produces the URI describing the Sablier stream NFTs.\\n ///\\n /// @dev Emits a {SetNFTDescriptor} and {BatchMetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - Does not revert if the NFT descriptor is the same.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the contract admin.\\n ///\\n /// @param newNFTDescriptor The address of the new NFT descriptor contract.\\n function setNFTDescriptor(\\n ISablierV2NFTDescriptor newNFTDescriptor\\n ) external;\\n\\n /// @notice Withdraws the provided amount of assets from the stream to the `to` address.\\n ///\\n /// @dev Emits a {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - This function attempts to call a hook on the recipient of the stream, unless `msg.sender` is the recipient.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `streamId` must not reference a null or depleted stream.\\n /// - `to` must not be the zero address.\\n /// - `amount` must be greater than zero and must not exceed the withdrawable amount.\\n /// - `to` must be the recipient if `msg.sender` is not the stream's recipient or an approved third party.\\n ///\\n /// @param streamId The ID of the stream to withdraw from.\\n /// @param to The address receiving the withdrawn assets.\\n /// @param amount The amount to withdraw, denoted in units of the asset's decimals.\\n function withdraw(uint256 streamId, address to, uint128 amount) external;\\n\\n /// @notice Withdraws the maximum withdrawable amount from the stream to the provided address `to`.\\n ///\\n /// @dev Emits a {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - Refer to the notes in {withdraw}.\\n ///\\n /// Requirements:\\n /// - Refer to the requirements in {withdraw}.\\n ///\\n /// @param streamId The ID of the stream to withdraw from.\\n /// @param to The address receiving the withdrawn assets.\\n /// @return withdrawnAmount The amount withdrawn, denoted in units of the asset's decimals.\\n function withdrawMax(\\n uint256 streamId,\\n address to\\n ) external returns (uint128 withdrawnAmount);\\n\\n /// @notice Withdraws the maximum withdrawable amount from the stream to the current recipient, and transfers the\\n /// NFT to `newRecipient`.\\n ///\\n /// @dev Emits a {WithdrawFromLockupStream} and a {Transfer} event.\\n ///\\n /// Notes:\\n /// - If the withdrawable amount is zero, the withdrawal is skipped.\\n /// - Refer to the notes in {withdraw}.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the stream's recipient.\\n /// - Refer to the requirements in {withdraw}.\\n /// - Refer to the requirements in {IERC721.transferFrom}.\\n ///\\n /// @param streamId The ID of the stream NFT to transfer.\\n /// @param newRecipient The address of the new owner of the stream NFT.\\n /// @return withdrawnAmount The amount withdrawn, denoted in units of the asset's decimals.\\n function withdrawMaxAndTransfer(\\n uint256 streamId,\\n address newRecipient\\n ) external returns (uint128 withdrawnAmount);\\n\\n /// @notice Withdraws assets from streams to the recipient of each stream.\\n ///\\n /// @dev Emits multiple {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} events.\\n ///\\n /// Notes:\\n /// - This function attempts to call a hook on the recipient of each stream, unless `msg.sender` is the recipient.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - There must be an equal number of `streamIds` and `amounts`.\\n /// - Each stream ID in the array must not reference a null or depleted stream.\\n /// - Each amount in the array must be greater than zero and must not exceed the withdrawable amount.\\n ///\\n /// @param streamIds The IDs of the streams to withdraw from.\\n /// @param amounts The amounts to withdraw, denoted in units of the asset's decimals.\\n function withdrawMultiple(\\n uint256[] calldata streamIds,\\n uint128[] calldata amounts\\n ) external;\\n}\\n\",\"keccak256\":\"0x3e5541c38a901637bd310965deb5bbde73ef07fe4ee3c752cbec330c6b9d62a3\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/ISablierV2LockupLinear.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\nimport {Lockup, LockupLinear} from \\\"./types/DataTypes.sol\\\";\\nimport {ISablierV2Lockup} from \\\"./ISablierV2Lockup.sol\\\";\\n\\n/// @title ISablierV2LockupLinear\\n/// @notice Creates and manages Lockup streams with a linear distribution function.\\ninterface ISablierV2LockupLinear is ISablierV2Lockup {\\n /*//////////////////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Emitted when a stream is created.\\n /// @param streamId The ID of the newly created stream.\\n /// @param funder The address which funded the stream.\\n /// @param sender The address distributing the assets, which will have the ability to cancel the stream.\\n /// @param recipient The address receiving the assets.\\n /// @param amounts Struct encapsulating (i) the deposit amount, and (ii) the broker fee amount, both denoted\\n /// in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Boolean indicating whether the stream will be cancelable or not.\\n /// @param transferable Boolean indicating whether the stream NFT is transferable or not.\\n /// @param timestamps Struct encapsulating (i) the stream's start time, (ii) cliff time, and (iii) end time, all as\\n /// Unix timestamps.\\n /// @param broker The address of the broker who has helped create the stream, e.g. a front-end website.\\n event CreateLockupLinearStream(\\n uint256 streamId,\\n address funder,\\n address indexed sender,\\n address indexed recipient,\\n Lockup.CreateAmounts amounts,\\n IERC20 indexed asset,\\n bool cancelable,\\n bool transferable,\\n LockupLinear.Timestamps timestamps,\\n address broker\\n );\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Retrieves the stream's cliff time, which is a Unix timestamp. A value of zero means there\\n /// is no cliff.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getCliffTime(\\n uint256 streamId\\n ) external view returns (uint40 cliffTime);\\n\\n /// @notice Retrieves the full stream details.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n /// @return stream See the documentation in {DataTypes}.\\n function getStream(\\n uint256 streamId\\n ) external view returns (LockupLinear.StreamLL memory stream);\\n\\n /// @notice Retrieves the stream's start, cliff and end timestamps.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n /// @return timestamps See the documentation in {DataTypes}.\\n function getTimestamps(\\n uint256 streamId\\n ) external view returns (LockupLinear.Timestamps memory timestamps);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n NON-CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Creates a stream by setting the start time to `block.timestamp`, and the end time to\\n /// the sum of `block.timestamp` and `params.durations.total`. The stream is funded by `msg.sender` and is wrapped\\n /// in an ERC-721 NFT.\\n ///\\n /// @dev Emits a {Transfer} and {CreateLockupLinearStream} event.\\n ///\\n /// Requirements:\\n /// - All requirements in {createWithTimestamps} must be met for the calculated parameters.\\n ///\\n /// @param params Struct encapsulating the function parameters, which are documented in {DataTypes}.\\n /// @return streamId The ID of the newly created stream.\\n function createWithDurations(\\n LockupLinear.CreateWithDurations calldata params\\n ) external returns (uint256 streamId);\\n\\n /// @notice Creates a stream with the provided start time and end time. The stream is funded by `msg.sender` and is\\n /// wrapped in an ERC-721 NFT.\\n ///\\n /// @dev Emits a {Transfer} and {CreateLockupLinearStream} event.\\n ///\\n /// Notes:\\n /// - A cliff time of zero means there is no cliff.\\n /// - As long as the times are ordered, it is not an error for the start or the cliff time to be in the past.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `params.totalAmount` must be greater than zero.\\n /// - If set, `params.broker.fee` must not be greater than `MAX_BROKER_FEE`.\\n /// - `params.timestamps.start` must be greater than zero and less than `params.timestamps.end`.\\n /// - If set, `params.timestamps.cliff` must be greater than `params.timestamps.start` and less than\\n /// `params.timestamps.end`.\\n /// - `params.timestamps.end` must be in the future.\\n /// - `params.recipient` must not be the zero address.\\n /// - `msg.sender` must have allowed this contract to spend at least `params.totalAmount` assets.\\n ///\\n /// @param params Struct encapsulating the function parameters, which are documented in {DataTypes}.\\n /// @return streamId The ID of the newly created stream.\\n function createWithTimestamps(\\n LockupLinear.CreateWithTimestamps calldata params\\n ) external returns (uint256 streamId);\\n}\\n\",\"keccak256\":\"0x064264723114b1f1cf3953fd79874dfcbb42cf313857aee6d5e6b09a23e0010b\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/ISablierV2NFTDescriptor.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC721Metadata} from \\\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\\\";\\n\\n/// @title ISablierV2NFTDescriptor\\n/// @notice This contract generates the URI describing the Sablier V2 stream NFTs.\\n/// @dev Inspired by Uniswap V3 Positions NFTs.\\ninterface ISablierV2NFTDescriptor {\\n /// @notice Produces the URI describing a particular stream NFT.\\n /// @dev This is a data URI with the JSON contents directly inlined.\\n /// @param sablier The address of the Sablier contract the stream was created in.\\n /// @param streamId The ID of the stream for which to produce a description.\\n /// @return uri The URI of the ERC721-compliant metadata.\\n function tokenURI(\\n IERC721Metadata sablier,\\n uint256 streamId\\n ) external view returns (string memory uri);\\n}\\n\",\"keccak256\":\"0x4ed430e553d14161e93efdaaacd1a502f49b38969c9d714b45d2e682a74fa0bc\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/types/DataTypes.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {UD2x18} from \\\"@prb/math/src/UD2x18.sol\\\";\\nimport {UD60x18} from \\\"@prb/math/src/UD60x18.sol\\\";\\n\\n// DataTypes.sol\\n//\\n// This file defines all structs used in V2 Core, most of which are organized under three namespaces:\\n//\\n// - Lockup\\n// - LockupDynamic\\n// - LockupLinear\\n// - LockupTranched\\n//\\n// You will notice that some structs contain \\\"slot\\\" annotations - they are used to indicate the\\n// storage layout of the struct. It is more gas efficient to group small data types together so\\n// that they fit in a single 32-byte slot.\\n\\n/// @notice Struct encapsulating the broker parameters passed to the create functions. Both can be set to zero.\\n/// @param account The address receiving the broker's fee.\\n/// @param fee The broker's percentage fee from the total amount, denoted as a fixed-point number where 1e18 is 100%.\\nstruct Broker {\\n address account;\\n UD60x18 fee;\\n}\\n\\n/// @notice Namespace for the structs used in both {SablierV2LockupLinear} and {SablierV2LockupDynamic}.\\nlibrary Lockup {\\n /// @notice Struct encapsulating the deposit, withdrawn, and refunded amounts, all denoted in units of the asset's\\n /// decimals.\\n /// @dev Because the deposited and the withdrawn amount are often read together, declaring them in the same slot\\n /// saves gas.\\n /// @param deposited The initial amount deposited in the stream, net of broker fee.\\n /// @param withdrawn The cumulative amount withdrawn from the stream.\\n /// @param refunded The amount refunded to the sender. Unless the stream was canceled, this is always zero.\\n struct Amounts {\\n // slot 0\\n uint128 deposited;\\n uint128 withdrawn;\\n // slot 1\\n uint128 refunded;\\n }\\n\\n /// @notice Struct encapsulating (i) the deposit amount and (ii) the broker fee amount, both denoted in units of the\\n /// asset's decimals.\\n /// @param deposit The amount to deposit in the stream.\\n /// @param brokerFee The broker fee amount.\\n struct CreateAmounts {\\n uint128 deposit;\\n uint128 brokerFee;\\n }\\n\\n /// @notice Enum representing the different statuses of a stream.\\n /// @custom:value0 PENDING Stream created but not started; assets are in a pending state.\\n /// @custom:value1 STREAMING Active stream where assets are currently being streamed.\\n /// @custom:value2 SETTLED All assets have been streamed; recipient is due to withdraw them.\\n /// @custom:value3 CANCELED Canceled stream; remaining assets await recipient's withdrawal.\\n /// @custom:value4 DEPLETED Depleted stream; all assets have been withdrawn and/or refunded.\\n enum Status {\\n PENDING,\\n STREAMING,\\n SETTLED,\\n CANCELED,\\n DEPLETED\\n }\\n\\n /// @notice A common data structure to be stored in all {SablierV2Lockup} models.\\n /// @dev The fields are arranged like this to save gas via tight variable packing.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream.\\n /// @param startTime The Unix timestamp indicating the stream's start.\\n /// @param endTime The Unix timestamp indicating the stream's end.\\n /// @param isCancelable Boolean indicating if the stream is cancelable.\\n /// @param wasCanceled Boolean indicating if the stream was canceled.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param isDepleted Boolean indicating if the stream is depleted.\\n /// @param isStream Boolean indicating if the struct entity exists.\\n /// @param isTransferable Boolean indicating if the stream NFT is transferable.\\n /// @param amounts Struct encapsulating the deposit, withdrawn, and refunded amounts, all denoted in units of the\\n /// asset's decimals.\\n struct Stream {\\n // slot 0\\n address sender;\\n uint40 startTime;\\n uint40 endTime;\\n bool isCancelable;\\n bool wasCanceled;\\n // slot 1\\n IERC20 asset;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n // slot 2 and 3\\n Lockup.Amounts amounts;\\n }\\n}\\n\\n/// @notice Namespace for the structs used in {SablierV2LockupDynamic}.\\nlibrary LockupDynamic {\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupDynamic.createWithDurations} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param segments Segments with durations used to compose the dynamic distribution function. Timestamps are\\n /// calculated by starting from `block.timestamp` and adding each duration to the previous timestamp.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithDurations {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n SegmentWithDuration[] segments;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupDynamic.createWithTimestamps} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param startTime The Unix timestamp indicating the stream's start.\\n /// @param segments Segments used to compose the dynamic distribution function.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithTimestamps {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n uint40 startTime;\\n Segment[] segments;\\n Broker broker;\\n }\\n\\n /// @notice Segment struct used in the Lockup Dynamic stream.\\n /// @param amount The amount of assets to be streamed in the segment, denoted in units of the asset's decimals.\\n /// @param exponent The exponent of the segment, denoted as a fixed-point number.\\n /// @param timestamp The Unix timestamp indicating the segment's end.\\n struct Segment {\\n // slot 0\\n uint128 amount;\\n UD2x18 exponent;\\n uint40 timestamp;\\n }\\n\\n /// @notice Segment struct used at runtime in {SablierV2LockupDynamic.createWithDurations}.\\n /// @param amount The amount of assets to be streamed in the segment, denoted in units of the asset's decimals.\\n /// @param exponent The exponent of the segment, denoted as a fixed-point number.\\n /// @param duration The time difference in seconds between the segment and the previous one.\\n struct SegmentWithDuration {\\n uint128 amount;\\n UD2x18 exponent;\\n uint40 duration;\\n }\\n\\n /// @notice Struct encapsulating the full details of a stream.\\n /// @dev Extends `Lockup.Stream` by including the recipient and the segments.\\n struct StreamLD {\\n address sender;\\n address recipient;\\n uint40 startTime;\\n uint40 endTime;\\n bool isCancelable;\\n bool wasCanceled;\\n IERC20 asset;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n Lockup.Amounts amounts;\\n Segment[] segments;\\n }\\n\\n /// @notice Struct encapsulating the LockupDynamic timestamps.\\n /// @param start The Unix timestamp indicating the stream's start.\\n /// @param end The Unix timestamp indicating the stream's end.\\n struct Timestamps {\\n uint40 start;\\n uint40 end;\\n }\\n}\\n\\n/// @notice Namespace for the structs used in {SablierV2LockupLinear}.\\nlibrary LockupLinear {\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupLinear.createWithDurations} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param durations Struct encapsulating (i) cliff period duration and (ii) total stream duration, both in seconds.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithDurations {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n Durations durations;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupLinear.createWithTimestamps} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param timestamps Struct encapsulating (i) the stream's start time, (ii) cliff time, and (iii) end time, all as\\n /// Unix timestamps.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithTimestamps {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n Timestamps timestamps;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the cliff duration and the total duration.\\n /// @param cliff The cliff duration in seconds.\\n /// @param total The total duration in seconds.\\n struct Durations {\\n uint40 cliff;\\n uint40 total;\\n }\\n\\n /// @notice Struct encapsulating the full details of a stream.\\n /// @dev Extends `Lockup.Stream` by including the recipient and the cliff time.\\n struct StreamLL {\\n address sender;\\n address recipient;\\n uint40 startTime;\\n bool isCancelable;\\n bool wasCanceled;\\n IERC20 asset;\\n uint40 endTime;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n Lockup.Amounts amounts;\\n uint40 cliffTime;\\n }\\n\\n /// @notice Struct encapsulating the LockupLinear timestamps.\\n /// @param start The Unix timestamp for the stream's start.\\n /// @param cliff The Unix timestamp for the cliff period's end. A value of zero means there is no cliff.\\n /// @param end The Unix timestamp for the stream's end.\\n struct Timestamps {\\n uint40 start;\\n uint40 cliff;\\n uint40 end;\\n }\\n}\\n\\n/// @notice Namespace for the structs used in {SablierV2LockupTranched}.\\nlibrary LockupTranched {\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupTranched.createWithDurations} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param tranches Tranches with durations used to compose the tranched distribution function. Timestamps are\\n /// calculated by starting from `block.timestamp` and adding each duration to the previous timestamp.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithDurations {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n TrancheWithDuration[] tranches;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupTranched.createWithTimestamps} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param startTime The Unix timestamp indicating the stream's start.\\n /// @param tranches Tranches used to compose the tranched distribution function.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithTimestamps {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n uint40 startTime;\\n Tranche[] tranches;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the full details of a stream.\\n /// @dev Extends `Lockup.Stream` by including the recipient and the tranches.\\n struct StreamLT {\\n address sender;\\n address recipient;\\n uint40 startTime;\\n uint40 endTime;\\n bool isCancelable;\\n bool wasCanceled;\\n IERC20 asset;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n Lockup.Amounts amounts;\\n Tranche[] tranches;\\n }\\n\\n /// @notice Struct encapsulating the LockupTranched timestamps.\\n /// @param start The Unix timestamp indicating the stream's start.\\n /// @param end The Unix timestamp indicating the stream's end.\\n struct Timestamps {\\n uint40 start;\\n uint40 end;\\n }\\n\\n /// @notice Tranche struct used in the Lockup Tranched stream.\\n /// @param amount The amount of assets to be unlocked in the tranche, denoted in units of the asset's decimals.\\n /// @param timestamp The Unix timestamp indicating the tranche's end.\\n struct Tranche {\\n // slot 0\\n uint128 amount;\\n uint40 timestamp;\\n }\\n\\n /// @notice Tranche struct used at runtime in {SablierV2LockupTranched.createWithDurations}.\\n /// @param amount The amount of assets to be unlocked in the tranche, denoted in units of the asset's decimals.\\n /// @param duration The time difference in seconds between the tranche and the previous one.\\n struct TrancheWithDuration {\\n uint128 amount;\\n uint40 duration;\\n }\\n}\\n\",\"keccak256\":\"0x727722c0ec71a76a947b935c9dfcac8fd846d6c3547dfbc8739c7109f3b95068\",\"license\":\"GPL-3.0-or-later\"},\"contracts/modules/DecentHatsModificationModule.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.28;\\n\\nimport {DecentHatsModuleUtils} from \\\"./DecentHatsModuleUtils.sol\\\";\\n\\ncontract DecentHatsModificationModule is DecentHatsModuleUtils {\\n /**\\n * @notice Creates a new termed or untermed role hat and any streams on it.\\n *\\n * @notice This contract should be enabled a module on the Safe for which the role is to be created, and disabled after.\\n *\\n * @dev Stream funds on untermed Roles are targeted at the hat's smart account. In order to withdraw funds from the stream, the\\n * hat's smart account must be the one call to `withdraw-` on the Sablier contract, setting the recipient arg to its wearer.\\n *\\n * @dev Stream funds on termed Roles are targeted directly at the nominated wearer.\\n * The wearer should directly call `withdraw-` on the Sablier contract.\\n *\\n * @dev Role hat creation, minting, smart account creation and stream creation are handled here in order\\n * to avoid a race condition where not more than one active proposal to create a new role can exist at a time.\\n * See: https://github.com/decentdao/decent-interface/issues/2402\\n *\\n * @param roleHatsParams An array of params for each role hat to be created.\\n */\\n function createRoleHats(\\n CreateRoleHatsParams calldata roleHatsParams\\n ) external {\\n _processRoleHats(roleHatsParams);\\n }\\n}\\n\",\"keccak256\":\"0x45b9470e000a416382deebea44a8c8734a2d6b453e8c7fbba5ea9bc6fdd4917c\",\"license\":\"MIT\"},\"contracts/modules/DecentHatsModuleUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.28;\\n\\nimport {Enum} from \\\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\\\";\\nimport {IAvatar} from \\\"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IERC6551Registry} from \\\"../interfaces/IERC6551Registry.sol\\\";\\nimport {IHats} from \\\"../interfaces/hats/IHats.sol\\\";\\nimport {LockupLinear, Broker} from \\\"../interfaces/sablier/types/DataTypes.sol\\\";\\nimport {IHatsModuleFactory} from \\\"../interfaces/hats/IHatsModuleFactory.sol\\\";\\nimport {ISablierV2LockupLinear} from \\\"../interfaces/sablier/ISablierV2LockupLinear.sol\\\";\\n\\nabstract contract DecentHatsModuleUtils {\\n bytes32 public constant SALT =\\n 0x5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b5072;\\n\\n struct SablierStreamParams {\\n ISablierV2LockupLinear sablier;\\n address sender;\\n address asset;\\n LockupLinear.Timestamps timestamps;\\n Broker broker;\\n uint128 totalAmount;\\n bool cancelable;\\n bool transferable;\\n }\\n\\n struct HatParams {\\n address wearer;\\n string details;\\n string imageURI;\\n SablierStreamParams[] sablierStreamsParams;\\n uint128 termEndDateTs; // If 0, this is an untermed Hat\\n uint32 maxSupply;\\n bool isMutable;\\n }\\n\\n struct CreateRoleHatsParams {\\n IHats hatsProtocol;\\n IERC6551Registry erc6551Registry;\\n address hatsAccountImplementation;\\n uint256 topHatId;\\n address topHatAccount;\\n IHatsModuleFactory hatsModuleFactory;\\n address hatsElectionsEligibilityImplementation;\\n uint256 adminHatId;\\n HatParams[] hats;\\n }\\n\\n function _processRoleHats(\\n CreateRoleHatsParams memory roleHatsParams\\n ) internal {\\n for (uint256 i = 0; i < roleHatsParams.hats.length; ) {\\n HatParams memory hatParams = roleHatsParams.hats[i];\\n\\n // Create eligibility module if needed\\n address eligibilityAddress = _createEligibilityModule(\\n roleHatsParams.hatsProtocol,\\n roleHatsParams.hatsModuleFactory,\\n roleHatsParams.hatsElectionsEligibilityImplementation,\\n roleHatsParams.topHatId,\\n roleHatsParams.topHatAccount,\\n roleHatsParams.adminHatId,\\n hatParams.termEndDateTs\\n );\\n\\n // Create and Mint the Role Hat\\n uint256 hatId = _createAndMintHat(\\n roleHatsParams.hatsProtocol,\\n roleHatsParams.adminHatId,\\n hatParams,\\n eligibilityAddress,\\n roleHatsParams.topHatAccount\\n );\\n\\n // Get the stream recipient (based on termed or not)\\n address streamRecipient = _setupStreamRecipient(\\n roleHatsParams.erc6551Registry,\\n roleHatsParams.hatsAccountImplementation,\\n address(roleHatsParams.hatsProtocol),\\n hatParams.termEndDateTs,\\n hatParams.wearer,\\n hatId\\n );\\n\\n // Create streams\\n _processSablierStreams(\\n hatParams.sablierStreamsParams,\\n streamRecipient\\n );\\n\\n unchecked {\\n ++i;\\n }\\n }\\n }\\n\\n function _createEligibilityModule(\\n IHats hatsProtocol,\\n IHatsModuleFactory hatsModuleFactory,\\n address hatsElectionsEligibilityImplementation,\\n uint256 topHatId,\\n address topHatAccount,\\n uint256 adminHatId,\\n uint128 termEndDateTs\\n ) private returns (address) {\\n // If the Hat is termed, create the eligibility module\\n if (termEndDateTs != 0) {\\n return\\n hatsModuleFactory.createHatsModule(\\n hatsElectionsEligibilityImplementation,\\n hatsProtocol.getNextId(adminHatId),\\n abi.encode(topHatId, uint256(0)), // [BALLOT_BOX_ID, ADMIN_HAT_ID]\\n abi.encode(termEndDateTs),\\n uint256(SALT)\\n );\\n }\\n\\n // Otherwise, return the Top Hat account\\n return topHatAccount;\\n }\\n\\n function _createAndMintHat(\\n IHats hatsProtocol,\\n uint256 adminHatId,\\n HatParams memory hat,\\n address eligibilityAddress,\\n address topHatAccount\\n ) private returns (uint256) {\\n // Grab the next Hat ID (before creating it)\\n uint256 hatId = hatsProtocol.getNextId(adminHatId);\\n\\n // Create the new Hat\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"createHat(uint256,string,uint32,address,address,bool,string)\\\",\\n adminHatId,\\n hat.details,\\n hat.maxSupply,\\n eligibilityAddress,\\n topHatAccount,\\n hat.isMutable,\\n hat.imageURI\\n ),\\n Enum.Operation.Call\\n );\\n\\n // If the Hat is termed, nominate the wearer as the eligible member\\n if (hat.termEndDateTs != 0) {\\n address[] memory nominatedWearers = new address[](1);\\n nominatedWearers[0] = hat.wearer;\\n\\n IAvatar(msg.sender).execTransactionFromModule(\\n eligibilityAddress,\\n 0,\\n abi.encodeWithSignature(\\n \\\"elect(uint128,address[])\\\",\\n hat.termEndDateTs,\\n nominatedWearers\\n ),\\n Enum.Operation.Call\\n );\\n }\\n\\n // Mint the Hat\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"mintHat(uint256,address)\\\",\\n hatId,\\n hat.wearer\\n ),\\n Enum.Operation.Call\\n );\\n return hatId;\\n }\\n\\n // Exists to avoid stack too deep errors\\n function _setupStreamRecipient(\\n IERC6551Registry erc6551Registry,\\n address hatsAccountImplementation,\\n address hatsProtocol,\\n uint128 termEndDateTs,\\n address wearer,\\n uint256 hatId\\n ) private returns (address) {\\n // If the hat is termed, the wearer is the stream recipient\\n if (termEndDateTs != 0) {\\n return wearer;\\n }\\n\\n // Otherwise, the Hat's smart account is the stream recipient\\n return\\n erc6551Registry.createAccount(\\n hatsAccountImplementation,\\n SALT,\\n block.chainid,\\n hatsProtocol,\\n hatId\\n );\\n }\\n\\n function _processSablierStreams(\\n SablierStreamParams[] memory streamParams,\\n address streamRecipient\\n ) private {\\n for (uint256 i = 0; i < streamParams.length; ) {\\n SablierStreamParams memory sablierStreamParams = streamParams[i];\\n\\n // Approve tokens for Sablier\\n IAvatar(msg.sender).execTransactionFromModule(\\n sablierStreamParams.asset,\\n 0,\\n abi.encodeWithSignature(\\n \\\"approve(address,uint256)\\\",\\n sablierStreamParams.sablier,\\n sablierStreamParams.totalAmount\\n ),\\n Enum.Operation.Call\\n );\\n\\n // Proxy the Sablier call through IAvatar\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(sablierStreamParams.sablier),\\n 0,\\n abi.encodeWithSignature(\\n \\\"createWithTimestamps((address,address,uint128,address,bool,bool,(uint40,uint40,uint40),(address,uint256)))\\\",\\n LockupLinear.CreateWithTimestamps({\\n sender: sablierStreamParams.sender,\\n recipient: streamRecipient,\\n totalAmount: sablierStreamParams.totalAmount,\\n asset: IERC20(sablierStreamParams.asset),\\n cancelable: sablierStreamParams.cancelable,\\n transferable: sablierStreamParams.transferable,\\n timestamps: sablierStreamParams.timestamps,\\n broker: sablierStreamParams.broker\\n })\\n ),\\n Enum.Operation.Call\\n );\\n\\n unchecked {\\n ++i;\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x357c5264ecb63f8f15f67ffb7498c7fb55d9efe8d46358790933b4892bd38cde\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x6080604052348015600f57600080fd5b5061123d8061001f6000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80633dac44e81461003b578063ba9a91a514610050575b600080fd5b61004e610049366004610929565b610089565b005b6100777f5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b507281565b60405190815260200160405180910390f35b61009a61009582610e60565b61009d565b50565b60005b8161010001515181101561016057600082610100015182815181106100c7576100c7610f22565b6020026020010151905060006100fe84600001518560a001518660c00151876060015188608001518960e001518860800151610164565b9050600061011b85600001518660e00151858589608001516102dd565b90506000610141866020015187604001518860000151876080015188600001518761060f565b90506101518460600151826106db565b846001019450505050506100a0565b5050565b60006001600160801b038216156102cf57866001600160a01b0316632f7fb7b6878a6001600160a01b0316631183a8c0876040518263ffffffff1660e01b81526004016101b391815260200190565b602060405180830381865afa1580156101d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101f49190610f38565b886000604051602001610211929190918252602082015260400190565b60408051601f198184030181528282526001600160801b0389166020840152910160408051601f19818403018152908290526001600160e01b031960e087901b168252610285949392917f5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b507290600401610f97565b6020604051808303816000875af11580156102a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102c89190610fe3565b90506102d2565b50825b979650505050505050565b60405162460ea360e61b81526004810185905260009081906001600160a01b03881690631183a8c090602401602060405180830381865afa158015610326573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061034a9190610f38565b9050336001600160a01b031663468721a78860008989602001518a60a001518a8a8d60c001518e6040015160405160240161038b9796959493929190611000565b60408051601f198184030181529181526020820180516001600160e01b0316635829492f60e11b1790525160e085901b6001600160e01b03191681526103d993929190600090600401611064565b6020604051808303816000875af11580156103f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061041c91906110ba565b5060808501516001600160801b031615610547576040805160018082528183019092526000916020808301908036833701905050905085600001518160008151811061046a5761046a610f22565b60200260200101906001600160a01b031690816001600160a01b031681525050336001600160a01b031663468721a78660008960800151856040516024016104b39291906110d7565b60408051601f198184030181529181526020820180516001600160e01b0316634a231cef60e01b1790525160e085901b6001600160e01b031916815261050193929190600090600401611064565b6020604051808303816000875af1158015610520573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061054491906110ba565b50505b8451604051602481018390526001600160a01b039091166044820152339063468721a790899060009060640160408051601f198184030181529181526020820180516001600160e01b031663320fbbb760e11b1790525160e085901b6001600160e01b03191681526105c193929190600090600401611064565b6020604051808303816000875af11580156105e0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061060491906110ba565b509695505050505050565b60006001600160801b038416156106275750816106d1565b604051638a54c52f60e01b81526001600160a01b0387811660048301527f5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b50726024830152466044830152868116606483015260848201849052881690638a54c52f9060a4016020604051808303816000875af11580156106aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106ce9190610fe3565b90505b9695505050505050565b60005b82518110156109245760008382815181106106fb576106fb610f22565b60200260200101519050336001600160a01b031663468721a78260400151600084600001518560a001516040516024016107539291906001600160a01b039290921682526001600160801b0316602082015260400190565b60408051601f198184030181529181526020820180516001600160e01b031663095ea7b360e01b1790525160e085901b6001600160e01b03191681526107a193929190600090600401611064565b6020604051808303816000875af11580156107c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107e491906110ba565b50336001600160a01b031663468721a78260000151600060405180610100016040528086602001516001600160a01b03168152602001886001600160a01b031681526020018660a001516001600160801b0316815260200186604001516001600160a01b031681526020018660c00151151581526020018660e00151151581526020018660600151815260200186608001518152506040516024016108899190611138565b60408051601f198184030181529181526020820180516001600160e01b03166353b1572760e01b1790525160e085901b6001600160e01b03191681526108d793929190600090600401611064565b6020604051808303816000875af11580156108f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061091a91906110ba565b50506001016106de565b505050565b60006020828403121561093b57600080fd5b81356001600160401b0381111561095157600080fd5b8201610120818503121561096457600080fd5b9392505050565b634e487b7160e01b600052604160045260246000fd5b60405161010081016001600160401b03811182821017156109a4576109a461096b565b60405290565b60405160e081016001600160401b03811182821017156109a4576109a461096b565b60405161012081016001600160401b03811182821017156109a4576109a461096b565b604051601f8201601f191681016001600160401b0381118282101715610a1757610a1761096b565b604052919050565b6001600160a01b038116811461009a57600080fd5b8035610a3f81610a1f565b919050565b60006001600160401b03821115610a5d57610a5d61096b565b5060051b60200190565b600082601f830112610a7857600080fd5b81356001600160401b03811115610a9157610a9161096b565b610aa4601f8201601f19166020016109ef565b818152846020838601011115610ab957600080fd5b816020850160208301376000918101602001919091529392505050565b803564ffffffffff81168114610a3f57600080fd5b600060608284031215610afd57600080fd5b604051606081016001600160401b0381118282101715610b1f57610b1f61096b565b604052905080610b2e83610ad6565b8152610b3c60208401610ad6565b6020820152610b4d60408401610ad6565b60408201525092915050565b600060408284031215610b6b57600080fd5b604080519081016001600160401b0381118282101715610b8d57610b8d61096b565b6040529050808235610b9e81610a1f565b8152602092830135920191909152919050565b80356001600160801b0381168114610a3f57600080fd5b801515811461009a57600080fd5b8035610a3f81610bc8565b600082601f830112610bf257600080fd5b8135610c05610c0082610a44565b6109ef565b8082825260208201915060206101608402860101925085831115610c2857600080fd5b602085015b83811015610ce6576101608188031215610c4657600080fd5b610c4e610981565b610c5782610a34565b8152610c6560208301610a34565b6020820152610c7660408301610a34565b6040820152610c888860608401610aeb565b6060820152610c9a8860c08401610b59565b6080820152610cac6101008301610bb1565b60a0820152610cbe6101208301610bd6565b60c0820152610cd06101408301610bd6565b60e0820152835260209092019161016001610c2d565b5095945050505050565b803563ffffffff81168114610a3f57600080fd5b600082601f830112610d1557600080fd5b8135610d23610c0082610a44565b8082825260208201915060208360051b860101925085831115610d4557600080fd5b602085015b83811015610ce65780356001600160401b03811115610d6857600080fd5b860160e0818903601f19011215610d7e57600080fd5b610d866109aa565b610d9260208301610a34565b815260408201356001600160401b03811115610dad57600080fd5b610dbc8a602083860101610a67565b60208301525060608201356001600160401b03811115610ddb57600080fd5b610dea8a602083860101610a67565b60408301525060808201356001600160401b03811115610e0957600080fd5b610e188a602083860101610be1565b606083015250610e2a60a08301610bb1565b6080820152610e3b60c08301610cf0565b60a0820152610e4c60e08301610bd6565b60c082015284525060209283019201610d4a565b60006101208236031215610e7357600080fd5b610e7b6109cc565b610e8483610a34565b8152610e9260208401610a34565b6020820152610ea360408401610a34565b604082015260608381013590820152610ebe60808401610a34565b6080820152610ecf60a08401610a34565b60a0820152610ee060c08401610a34565b60c082015260e083810135908201526101008301356001600160401b03811115610f0957600080fd5b610f1536828601610d04565b6101008301525092915050565b634e487b7160e01b600052603260045260246000fd5b600060208284031215610f4a57600080fd5b5051919050565b6000815180845260005b81811015610f7757602081850181015186830182015201610f5b565b506000602082860101526020601f19601f83011685010191505092915050565b60018060a01b038616815284602082015260a060408201526000610fbe60a0830186610f51565b8281036060840152610fd08186610f51565b9150508260808301529695505050505050565b600060208284031215610ff557600080fd5b815161096481610a1f565b87815260e06020820152600061101960e0830189610f51565b63ffffffff881660408401526001600160a01b0387811660608501528616608084015284151560a084015282810360c08401526110568185610f51565b9a9950505050505050505050565b60018060a01b038516815283602082015260806040820152600061108b6080830185610f51565b9050600283106110ab57634e487b7160e01b600052602160045260246000fd5b82606083015295945050505050565b6000602082840312156110cc57600080fd5b815161096481610bc8565b6000604082016001600160801b03851683526040602084015280845180835260608501915060208601925060005b8181101561112c5783516001600160a01b0316835260209384019390920191600101611105565b50909695505050505050565b81516001600160a01b0390811682526020808401518216908301526040808401516001600160801b0316908301526060808401519182169083015261016082019050608083015161118d608084018215159052565b5060a08301516111a160a084018215159052565b5060c08301516111e060c084018264ffffffffff815116825264ffffffffff602082015116602083015264ffffffffff60408201511660408301525050565b5060e0929092015180516001600160a01b031661012083015260200151610140909101529056fea26469706673582212208ecde80de6a92bc6f34289d7626d01b9bebb41eb9991597e67fb6a0be17a938664736f6c634300081c0033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100365760003560e01c80633dac44e81461003b578063ba9a91a514610050575b600080fd5b61004e610049366004610929565b610089565b005b6100777f5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b507281565b60405190815260200160405180910390f35b61009a61009582610e60565b61009d565b50565b60005b8161010001515181101561016057600082610100015182815181106100c7576100c7610f22565b6020026020010151905060006100fe84600001518560a001518660c00151876060015188608001518960e001518860800151610164565b9050600061011b85600001518660e00151858589608001516102dd565b90506000610141866020015187604001518860000151876080015188600001518761060f565b90506101518460600151826106db565b846001019450505050506100a0565b5050565b60006001600160801b038216156102cf57866001600160a01b0316632f7fb7b6878a6001600160a01b0316631183a8c0876040518263ffffffff1660e01b81526004016101b391815260200190565b602060405180830381865afa1580156101d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101f49190610f38565b886000604051602001610211929190918252602082015260400190565b60408051601f198184030181528282526001600160801b0389166020840152910160408051601f19818403018152908290526001600160e01b031960e087901b168252610285949392917f5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b507290600401610f97565b6020604051808303816000875af11580156102a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102c89190610fe3565b90506102d2565b50825b979650505050505050565b60405162460ea360e61b81526004810185905260009081906001600160a01b03881690631183a8c090602401602060405180830381865afa158015610326573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061034a9190610f38565b9050336001600160a01b031663468721a78860008989602001518a60a001518a8a8d60c001518e6040015160405160240161038b9796959493929190611000565b60408051601f198184030181529181526020820180516001600160e01b0316635829492f60e11b1790525160e085901b6001600160e01b03191681526103d993929190600090600401611064565b6020604051808303816000875af11580156103f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061041c91906110ba565b5060808501516001600160801b031615610547576040805160018082528183019092526000916020808301908036833701905050905085600001518160008151811061046a5761046a610f22565b60200260200101906001600160a01b031690816001600160a01b031681525050336001600160a01b031663468721a78660008960800151856040516024016104b39291906110d7565b60408051601f198184030181529181526020820180516001600160e01b0316634a231cef60e01b1790525160e085901b6001600160e01b031916815261050193929190600090600401611064565b6020604051808303816000875af1158015610520573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061054491906110ba565b50505b8451604051602481018390526001600160a01b039091166044820152339063468721a790899060009060640160408051601f198184030181529181526020820180516001600160e01b031663320fbbb760e11b1790525160e085901b6001600160e01b03191681526105c193929190600090600401611064565b6020604051808303816000875af11580156105e0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061060491906110ba565b509695505050505050565b60006001600160801b038416156106275750816106d1565b604051638a54c52f60e01b81526001600160a01b0387811660048301527f5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b50726024830152466044830152868116606483015260848201849052881690638a54c52f9060a4016020604051808303816000875af11580156106aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106ce9190610fe3565b90505b9695505050505050565b60005b82518110156109245760008382815181106106fb576106fb610f22565b60200260200101519050336001600160a01b031663468721a78260400151600084600001518560a001516040516024016107539291906001600160a01b039290921682526001600160801b0316602082015260400190565b60408051601f198184030181529181526020820180516001600160e01b031663095ea7b360e01b1790525160e085901b6001600160e01b03191681526107a193929190600090600401611064565b6020604051808303816000875af11580156107c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107e491906110ba565b50336001600160a01b031663468721a78260000151600060405180610100016040528086602001516001600160a01b03168152602001886001600160a01b031681526020018660a001516001600160801b0316815260200186604001516001600160a01b031681526020018660c00151151581526020018660e00151151581526020018660600151815260200186608001518152506040516024016108899190611138565b60408051601f198184030181529181526020820180516001600160e01b03166353b1572760e01b1790525160e085901b6001600160e01b03191681526108d793929190600090600401611064565b6020604051808303816000875af11580156108f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061091a91906110ba565b50506001016106de565b505050565b60006020828403121561093b57600080fd5b81356001600160401b0381111561095157600080fd5b8201610120818503121561096457600080fd5b9392505050565b634e487b7160e01b600052604160045260246000fd5b60405161010081016001600160401b03811182821017156109a4576109a461096b565b60405290565b60405160e081016001600160401b03811182821017156109a4576109a461096b565b60405161012081016001600160401b03811182821017156109a4576109a461096b565b604051601f8201601f191681016001600160401b0381118282101715610a1757610a1761096b565b604052919050565b6001600160a01b038116811461009a57600080fd5b8035610a3f81610a1f565b919050565b60006001600160401b03821115610a5d57610a5d61096b565b5060051b60200190565b600082601f830112610a7857600080fd5b81356001600160401b03811115610a9157610a9161096b565b610aa4601f8201601f19166020016109ef565b818152846020838601011115610ab957600080fd5b816020850160208301376000918101602001919091529392505050565b803564ffffffffff81168114610a3f57600080fd5b600060608284031215610afd57600080fd5b604051606081016001600160401b0381118282101715610b1f57610b1f61096b565b604052905080610b2e83610ad6565b8152610b3c60208401610ad6565b6020820152610b4d60408401610ad6565b60408201525092915050565b600060408284031215610b6b57600080fd5b604080519081016001600160401b0381118282101715610b8d57610b8d61096b565b6040529050808235610b9e81610a1f565b8152602092830135920191909152919050565b80356001600160801b0381168114610a3f57600080fd5b801515811461009a57600080fd5b8035610a3f81610bc8565b600082601f830112610bf257600080fd5b8135610c05610c0082610a44565b6109ef565b8082825260208201915060206101608402860101925085831115610c2857600080fd5b602085015b83811015610ce6576101608188031215610c4657600080fd5b610c4e610981565b610c5782610a34565b8152610c6560208301610a34565b6020820152610c7660408301610a34565b6040820152610c888860608401610aeb565b6060820152610c9a8860c08401610b59565b6080820152610cac6101008301610bb1565b60a0820152610cbe6101208301610bd6565b60c0820152610cd06101408301610bd6565b60e0820152835260209092019161016001610c2d565b5095945050505050565b803563ffffffff81168114610a3f57600080fd5b600082601f830112610d1557600080fd5b8135610d23610c0082610a44565b8082825260208201915060208360051b860101925085831115610d4557600080fd5b602085015b83811015610ce65780356001600160401b03811115610d6857600080fd5b860160e0818903601f19011215610d7e57600080fd5b610d866109aa565b610d9260208301610a34565b815260408201356001600160401b03811115610dad57600080fd5b610dbc8a602083860101610a67565b60208301525060608201356001600160401b03811115610ddb57600080fd5b610dea8a602083860101610a67565b60408301525060808201356001600160401b03811115610e0957600080fd5b610e188a602083860101610be1565b606083015250610e2a60a08301610bb1565b6080820152610e3b60c08301610cf0565b60a0820152610e4c60e08301610bd6565b60c082015284525060209283019201610d4a565b60006101208236031215610e7357600080fd5b610e7b6109cc565b610e8483610a34565b8152610e9260208401610a34565b6020820152610ea360408401610a34565b604082015260608381013590820152610ebe60808401610a34565b6080820152610ecf60a08401610a34565b60a0820152610ee060c08401610a34565b60c082015260e083810135908201526101008301356001600160401b03811115610f0957600080fd5b610f1536828601610d04565b6101008301525092915050565b634e487b7160e01b600052603260045260246000fd5b600060208284031215610f4a57600080fd5b5051919050565b6000815180845260005b81811015610f7757602081850181015186830182015201610f5b565b506000602082860101526020601f19601f83011685010191505092915050565b60018060a01b038616815284602082015260a060408201526000610fbe60a0830186610f51565b8281036060840152610fd08186610f51565b9150508260808301529695505050505050565b600060208284031215610ff557600080fd5b815161096481610a1f565b87815260e06020820152600061101960e0830189610f51565b63ffffffff881660408401526001600160a01b0387811660608501528616608084015284151560a084015282810360c08401526110568185610f51565b9a9950505050505050505050565b60018060a01b038516815283602082015260806040820152600061108b6080830185610f51565b9050600283106110ab57634e487b7160e01b600052602160045260246000fd5b82606083015295945050505050565b6000602082840312156110cc57600080fd5b815161096481610bc8565b6000604082016001600160801b03851683526040602084015280845180835260608501915060208601925060005b8181101561112c5783516001600160a01b0316835260209384019390920191600101611105565b50909695505050505050565b81516001600160a01b0390811682526020808401518216908301526040808401516001600160801b0316908301526060808401519182169083015261016082019050608083015161118d608084018215159052565b5060a08301516111a160a084018215159052565b5060c08301516111e060c084018264ffffffffff815116825264ffffffffff602082015116602083015264ffffffffff60408201511660408301525050565b5060e0929092015180516001600160a01b031661012083015260200151610140909101529056fea26469706673582212208ecde80de6a92bc6f34289d7626d01b9bebb41eb9991597e67fb6a0be17a938664736f6c634300081c0033", + "numDeployments": 2, + "solcInputHash": "f1fca9a70591742a2aedd10e2fd7e744", + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"SALT\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"contract IHats\",\"name\":\"hatsProtocol\",\"type\":\"address\"},{\"internalType\":\"contract IERC6551Registry\",\"name\":\"erc6551Registry\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"hatsAccountImplementation\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"topHatId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"topHatAccount\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"keyValuePairs\",\"type\":\"address\"},{\"internalType\":\"contract IHatsModuleFactory\",\"name\":\"hatsModuleFactory\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"hatsElectionsEligibilityImplementation\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"adminHatId\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"wearer\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"details\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"imageURI\",\"type\":\"string\"},{\"components\":[{\"internalType\":\"contract ISablierV2LockupLinear\",\"name\":\"sablier\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint40\",\"name\":\"start\",\"type\":\"uint40\"},{\"internalType\":\"uint40\",\"name\":\"cliff\",\"type\":\"uint40\"},{\"internalType\":\"uint40\",\"name\":\"end\",\"type\":\"uint40\"}],\"internalType\":\"struct LockupLinear.Timestamps\",\"name\":\"timestamps\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"UD60x18\",\"name\":\"fee\",\"type\":\"uint256\"}],\"internalType\":\"struct Broker\",\"name\":\"broker\",\"type\":\"tuple\"},{\"internalType\":\"uint128\",\"name\":\"totalAmount\",\"type\":\"uint128\"},{\"internalType\":\"bool\",\"name\":\"cancelable\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"transferable\",\"type\":\"bool\"}],\"internalType\":\"struct DecentHatsModuleUtils.SablierStreamParams[]\",\"name\":\"sablierStreamsParams\",\"type\":\"tuple[]\"},{\"internalType\":\"uint128\",\"name\":\"termEndDateTs\",\"type\":\"uint128\"},{\"internalType\":\"uint32\",\"name\":\"maxSupply\",\"type\":\"uint32\"},{\"internalType\":\"bool\",\"name\":\"isMutable\",\"type\":\"bool\"}],\"internalType\":\"struct DecentHatsModuleUtils.HatParams[]\",\"name\":\"hats\",\"type\":\"tuple[]\"}],\"internalType\":\"struct DecentHatsModuleUtils.CreateRoleHatsParams\",\"name\":\"roleHatsParams\",\"type\":\"tuple\"}],\"name\":\"createRoleHats\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"createRoleHats((address,address,address,uint256,address,address,address,address,uint256,(address,string,string,(address,address,address,(uint40,uint40,uint40),(address,uint256),uint128,bool,bool)[],uint128,uint32,bool)[]))\":{\"details\":\"Stream funds on untermed Roles are targeted at the hat's smart account. In order to withdraw funds from the stream, the hat's smart account must be the one call to `withdraw-` on the Sablier contract, setting the recipient arg to its wearer.Stream funds on termed Roles are targeted directly at the nominated wearer. The wearer should directly call `withdraw-` on the Sablier contract.Role hat creation, minting, smart account creation and stream creation are handled here in order to avoid a race condition where not more than one active proposal to create a new role can exist at a time. See: https://github.com/decentdao/decent-interface/issues/2402\",\"params\":{\"roleHatsParams\":\"An array of params for each role hat to be created.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"createRoleHats((address,address,address,uint256,address,address,address,address,uint256,(address,string,string,(address,address,address,(uint40,uint40,uint40),(address,uint256),uint128,bool,bool)[],uint128,uint32,bool)[]))\":{\"notice\":\"Creates a new termed or untermed role hat and any streams on it.This contract should be enabled a module on the Safe for which the role is to be created, and disabled after.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/modules/DecentHatsModificationModule.sol\":\"DecentHatsModificationModule\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\npragma solidity >=0.7.0 <0.9.0;\\n\\n/// @title Enum - Collection of enums\\n/// @author Richard Meissner - \\ncontract Enum {\\n enum Operation {Call, DelegateCall}\\n}\\n\",\"keccak256\":\"0x473e45b1a5cc47be494b0e123c9127f0c11c1e0992a321ae5a644c0bfdb2c14f\",\"license\":\"LGPL-3.0-only\"},\"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\n\\n/// @title Zodiac Avatar - A contract that manages modules that can execute transactions via this contract.\\npragma solidity >=0.7.0 <0.9.0;\\n\\nimport \\\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\\\";\\n\\ninterface IAvatar {\\n event EnabledModule(address module);\\n event DisabledModule(address module);\\n event ExecutionFromModuleSuccess(address indexed module);\\n event ExecutionFromModuleFailure(address indexed module);\\n\\n /// @dev Enables a module on the avatar.\\n /// @notice Can only be called by the avatar.\\n /// @notice Modules should be stored as a linked list.\\n /// @notice Must emit EnabledModule(address module) if successful.\\n /// @param module Module to be enabled.\\n function enableModule(address module) external;\\n\\n /// @dev Disables a module on the avatar.\\n /// @notice Can only be called by the avatar.\\n /// @notice Must emit DisabledModule(address module) if successful.\\n /// @param prevModule Address that pointed to the module to be removed in the linked list\\n /// @param module Module to be removed.\\n function disableModule(address prevModule, address module) external;\\n\\n /// @dev Allows a Module to execute a transaction.\\n /// @notice Can only be called by an enabled module.\\n /// @notice Must emit ExecutionFromModuleSuccess(address module) if successful.\\n /// @notice Must emit ExecutionFromModuleFailure(address module) if unsuccessful.\\n /// @param to Destination address of module transaction.\\n /// @param value Ether value of module transaction.\\n /// @param data Data payload of module transaction.\\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\\n function execTransactionFromModule(\\n address to,\\n uint256 value,\\n bytes memory data,\\n Enum.Operation operation\\n ) external returns (bool success);\\n\\n /// @dev Allows a Module to execute a transaction and return data\\n /// @notice Can only be called by an enabled module.\\n /// @notice Must emit ExecutionFromModuleSuccess(address module) if successful.\\n /// @notice Must emit ExecutionFromModuleFailure(address module) if unsuccessful.\\n /// @param to Destination address of module transaction.\\n /// @param value Ether value of module transaction.\\n /// @param data Data payload of module transaction.\\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\\n function execTransactionFromModuleReturnData(\\n address to,\\n uint256 value,\\n bytes memory data,\\n Enum.Operation operation\\n ) external returns (bool success, bytes memory returnData);\\n\\n /// @dev Returns if an module is enabled\\n /// @return True if the module is enabled\\n function isModuleEnabled(address module) external view returns (bool);\\n\\n /// @dev Returns array of modules.\\n /// @param start Start of the page.\\n /// @param pageSize Maximum number of modules that should be returned.\\n /// @return array Array of modules.\\n /// @return next Start of the next page.\\n function getModulesPaginated(address start, uint256 pageSize)\\n external\\n view\\n returns (address[] memory array, address next);\\n}\\n\",\"keccak256\":\"0xcd5508ffe596eef8fbccfd5fc4f10a34397773547ce64e212d48b5212865ec1f\",\"license\":\"LGPL-3.0-only\"},\"@openzeppelin/contracts/interfaces/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/introspection/IERC165.sol\\\";\\n\",\"keccak256\":\"0xd04b0f06e0666f29cf7cccc82894de541e19bb30a765b107b1e40bb7fe5f7d7a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev 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 amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `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 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes calldata data\\n ) external;\\n\\n /**\\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 {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the caller.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool _approved) external;\\n\\n /**\\n * @dev Returns 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\",\"keccak256\":\"0xed6a749c5373af398105ce6ee3ac4763aa450ea7285d268c85d9eeca809cdb1f\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../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\",\"keccak256\":\"0x75b829ff2f26c14355d1cba20e16fe7b29ca58eb5fef665ede48bc0f9c6c74b9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _HEX_SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\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 // Inspired by OraclizeAPI's implementation - MIT licence\\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\\n\\n if (value == 0) {\\n return \\\"0\\\";\\n }\\n uint256 temp = value;\\n uint256 digits;\\n while (temp != 0) {\\n digits++;\\n temp /= 10;\\n }\\n bytes memory buffer = new bytes(digits);\\n while (value != 0) {\\n digits -= 1;\\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\\n value /= 10;\\n }\\n return string(buffer);\\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 if (value == 0) {\\n return \\\"0x00\\\";\\n }\\n uint256 temp = value;\\n uint256 length = 0;\\n while (temp != 0) {\\n length++;\\n temp >>= 8;\\n }\\n return toHexString(value, length);\\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 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_SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\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 representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n}\\n\",\"keccak256\":\"0xaf159a8b1923ad2a26d516089bceca9bdeaeacd04be50983ea00ba63070f08a3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"@prb/math/src/Common.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\n// Common.sol\\n//\\n// Common mathematical functions used in both SD59x18 and UD60x18. Note that these global functions do not\\n// always operate with SD59x18 and UD60x18 numbers.\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CUSTOM ERRORS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @notice Thrown when the resultant value in {mulDiv} overflows uint256.\\nerror PRBMath_MulDiv_Overflow(uint256 x, uint256 y, uint256 denominator);\\n\\n/// @notice Thrown when the resultant value in {mulDiv18} overflows uint256.\\nerror PRBMath_MulDiv18_Overflow(uint256 x, uint256 y);\\n\\n/// @notice Thrown when one of the inputs passed to {mulDivSigned} is `type(int256).min`.\\nerror PRBMath_MulDivSigned_InputTooSmall();\\n\\n/// @notice Thrown when the resultant value in {mulDivSigned} overflows int256.\\nerror PRBMath_MulDivSigned_Overflow(int256 x, int256 y);\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CONSTANTS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @dev The maximum value a uint128 number can have.\\nuint128 constant MAX_UINT128 = type(uint128).max;\\n\\n/// @dev The maximum value a uint40 number can have.\\nuint40 constant MAX_UINT40 = type(uint40).max;\\n\\n/// @dev The unit number, which the decimal precision of the fixed-point types.\\nuint256 constant UNIT = 1e18;\\n\\n/// @dev The unit number inverted mod 2^256.\\nuint256 constant UNIT_INVERSE = 78156646155174841979727994598816262306175212592076161876661_508869554232690281;\\n\\n/// @dev The the largest power of two that divides the decimal value of `UNIT`. The logarithm of this value is the least significant\\n/// bit in the binary representation of `UNIT`.\\nuint256 constant UNIT_LPOTD = 262144;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @notice Calculates the binary exponent of x using the binary fraction method.\\n/// @dev Has to use 192.64-bit fixed-point numbers. See https://ethereum.stackexchange.com/a/96594/24693.\\n/// @param x The exponent as an unsigned 192.64-bit fixed-point number.\\n/// @return result The result as an unsigned 60.18-decimal fixed-point number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp2(uint256 x) pure returns (uint256 result) {\\n unchecked {\\n // Start from 0.5 in the 192.64-bit fixed-point format.\\n result = 0x800000000000000000000000000000000000000000000000;\\n\\n // The following logic multiplies the result by $\\\\sqrt{2^{-i}}$ when the bit at position i is 1. Key points:\\n //\\n // 1. Intermediate results will not overflow, as the starting point is 2^191 and all magic factors are under 2^65.\\n // 2. The rationale for organizing the if statements into groups of 8 is gas savings. If the result of performing\\n // a bitwise AND operation between x and any value in the array [0x80; 0x40; 0x20; 0x10; 0x08; 0x04; 0x02; 0x01] is 1,\\n // we know that `x & 0xFF` is also 1.\\n if (x & 0xFF00000000000000 > 0) {\\n if (x & 0x8000000000000000 > 0) {\\n result = (result * 0x16A09E667F3BCC909) >> 64;\\n }\\n if (x & 0x4000000000000000 > 0) {\\n result = (result * 0x1306FE0A31B7152DF) >> 64;\\n }\\n if (x & 0x2000000000000000 > 0) {\\n result = (result * 0x1172B83C7D517ADCE) >> 64;\\n }\\n if (x & 0x1000000000000000 > 0) {\\n result = (result * 0x10B5586CF9890F62A) >> 64;\\n }\\n if (x & 0x800000000000000 > 0) {\\n result = (result * 0x1059B0D31585743AE) >> 64;\\n }\\n if (x & 0x400000000000000 > 0) {\\n result = (result * 0x102C9A3E778060EE7) >> 64;\\n }\\n if (x & 0x200000000000000 > 0) {\\n result = (result * 0x10163DA9FB33356D8) >> 64;\\n }\\n if (x & 0x100000000000000 > 0) {\\n result = (result * 0x100B1AFA5ABCBED61) >> 64;\\n }\\n }\\n\\n if (x & 0xFF000000000000 > 0) {\\n if (x & 0x80000000000000 > 0) {\\n result = (result * 0x10058C86DA1C09EA2) >> 64;\\n }\\n if (x & 0x40000000000000 > 0) {\\n result = (result * 0x1002C605E2E8CEC50) >> 64;\\n }\\n if (x & 0x20000000000000 > 0) {\\n result = (result * 0x100162F3904051FA1) >> 64;\\n }\\n if (x & 0x10000000000000 > 0) {\\n result = (result * 0x1000B175EFFDC76BA) >> 64;\\n }\\n if (x & 0x8000000000000 > 0) {\\n result = (result * 0x100058BA01FB9F96D) >> 64;\\n }\\n if (x & 0x4000000000000 > 0) {\\n result = (result * 0x10002C5CC37DA9492) >> 64;\\n }\\n if (x & 0x2000000000000 > 0) {\\n result = (result * 0x1000162E525EE0547) >> 64;\\n }\\n if (x & 0x1000000000000 > 0) {\\n result = (result * 0x10000B17255775C04) >> 64;\\n }\\n }\\n\\n if (x & 0xFF0000000000 > 0) {\\n if (x & 0x800000000000 > 0) {\\n result = (result * 0x1000058B91B5BC9AE) >> 64;\\n }\\n if (x & 0x400000000000 > 0) {\\n result = (result * 0x100002C5C89D5EC6D) >> 64;\\n }\\n if (x & 0x200000000000 > 0) {\\n result = (result * 0x10000162E43F4F831) >> 64;\\n }\\n if (x & 0x100000000000 > 0) {\\n result = (result * 0x100000B1721BCFC9A) >> 64;\\n }\\n if (x & 0x80000000000 > 0) {\\n result = (result * 0x10000058B90CF1E6E) >> 64;\\n }\\n if (x & 0x40000000000 > 0) {\\n result = (result * 0x1000002C5C863B73F) >> 64;\\n }\\n if (x & 0x20000000000 > 0) {\\n result = (result * 0x100000162E430E5A2) >> 64;\\n }\\n if (x & 0x10000000000 > 0) {\\n result = (result * 0x1000000B172183551) >> 64;\\n }\\n }\\n\\n if (x & 0xFF00000000 > 0) {\\n if (x & 0x8000000000 > 0) {\\n result = (result * 0x100000058B90C0B49) >> 64;\\n }\\n if (x & 0x4000000000 > 0) {\\n result = (result * 0x10000002C5C8601CC) >> 64;\\n }\\n if (x & 0x2000000000 > 0) {\\n result = (result * 0x1000000162E42FFF0) >> 64;\\n }\\n if (x & 0x1000000000 > 0) {\\n result = (result * 0x10000000B17217FBB) >> 64;\\n }\\n if (x & 0x800000000 > 0) {\\n result = (result * 0x1000000058B90BFCE) >> 64;\\n }\\n if (x & 0x400000000 > 0) {\\n result = (result * 0x100000002C5C85FE3) >> 64;\\n }\\n if (x & 0x200000000 > 0) {\\n result = (result * 0x10000000162E42FF1) >> 64;\\n }\\n if (x & 0x100000000 > 0) {\\n result = (result * 0x100000000B17217F8) >> 64;\\n }\\n }\\n\\n if (x & 0xFF000000 > 0) {\\n if (x & 0x80000000 > 0) {\\n result = (result * 0x10000000058B90BFC) >> 64;\\n }\\n if (x & 0x40000000 > 0) {\\n result = (result * 0x1000000002C5C85FE) >> 64;\\n }\\n if (x & 0x20000000 > 0) {\\n result = (result * 0x100000000162E42FF) >> 64;\\n }\\n if (x & 0x10000000 > 0) {\\n result = (result * 0x1000000000B17217F) >> 64;\\n }\\n if (x & 0x8000000 > 0) {\\n result = (result * 0x100000000058B90C0) >> 64;\\n }\\n if (x & 0x4000000 > 0) {\\n result = (result * 0x10000000002C5C860) >> 64;\\n }\\n if (x & 0x2000000 > 0) {\\n result = (result * 0x1000000000162E430) >> 64;\\n }\\n if (x & 0x1000000 > 0) {\\n result = (result * 0x10000000000B17218) >> 64;\\n }\\n }\\n\\n if (x & 0xFF0000 > 0) {\\n if (x & 0x800000 > 0) {\\n result = (result * 0x1000000000058B90C) >> 64;\\n }\\n if (x & 0x400000 > 0) {\\n result = (result * 0x100000000002C5C86) >> 64;\\n }\\n if (x & 0x200000 > 0) {\\n result = (result * 0x10000000000162E43) >> 64;\\n }\\n if (x & 0x100000 > 0) {\\n result = (result * 0x100000000000B1721) >> 64;\\n }\\n if (x & 0x80000 > 0) {\\n result = (result * 0x10000000000058B91) >> 64;\\n }\\n if (x & 0x40000 > 0) {\\n result = (result * 0x1000000000002C5C8) >> 64;\\n }\\n if (x & 0x20000 > 0) {\\n result = (result * 0x100000000000162E4) >> 64;\\n }\\n if (x & 0x10000 > 0) {\\n result = (result * 0x1000000000000B172) >> 64;\\n }\\n }\\n\\n if (x & 0xFF00 > 0) {\\n if (x & 0x8000 > 0) {\\n result = (result * 0x100000000000058B9) >> 64;\\n }\\n if (x & 0x4000 > 0) {\\n result = (result * 0x10000000000002C5D) >> 64;\\n }\\n if (x & 0x2000 > 0) {\\n result = (result * 0x1000000000000162E) >> 64;\\n }\\n if (x & 0x1000 > 0) {\\n result = (result * 0x10000000000000B17) >> 64;\\n }\\n if (x & 0x800 > 0) {\\n result = (result * 0x1000000000000058C) >> 64;\\n }\\n if (x & 0x400 > 0) {\\n result = (result * 0x100000000000002C6) >> 64;\\n }\\n if (x & 0x200 > 0) {\\n result = (result * 0x10000000000000163) >> 64;\\n }\\n if (x & 0x100 > 0) {\\n result = (result * 0x100000000000000B1) >> 64;\\n }\\n }\\n\\n if (x & 0xFF > 0) {\\n if (x & 0x80 > 0) {\\n result = (result * 0x10000000000000059) >> 64;\\n }\\n if (x & 0x40 > 0) {\\n result = (result * 0x1000000000000002C) >> 64;\\n }\\n if (x & 0x20 > 0) {\\n result = (result * 0x10000000000000016) >> 64;\\n }\\n if (x & 0x10 > 0) {\\n result = (result * 0x1000000000000000B) >> 64;\\n }\\n if (x & 0x8 > 0) {\\n result = (result * 0x10000000000000006) >> 64;\\n }\\n if (x & 0x4 > 0) {\\n result = (result * 0x10000000000000003) >> 64;\\n }\\n if (x & 0x2 > 0) {\\n result = (result * 0x10000000000000001) >> 64;\\n }\\n if (x & 0x1 > 0) {\\n result = (result * 0x10000000000000001) >> 64;\\n }\\n }\\n\\n // In the code snippet below, two operations are executed simultaneously:\\n //\\n // 1. The result is multiplied by $(2^n + 1)$, where $2^n$ represents the integer part, and the additional 1\\n // accounts for the initial guess of 0.5. This is achieved by subtracting from 191 instead of 192.\\n // 2. The result is then converted to an unsigned 60.18-decimal fixed-point format.\\n //\\n // The underlying logic is based on the relationship $2^{191-ip} = 2^{ip} / 2^{191}$, where $ip$ denotes the,\\n // integer part, $2^n$.\\n result *= UNIT;\\n result >>= (191 - (x >> 64));\\n }\\n}\\n\\n/// @notice Finds the zero-based index of the first 1 in the binary representation of x.\\n///\\n/// @dev See the note on \\\"msb\\\" in this Wikipedia article: https://en.wikipedia.org/wiki/Find_first_set\\n///\\n/// Each step in this implementation is equivalent to this high-level code:\\n///\\n/// ```solidity\\n/// if (x >= 2 ** 128) {\\n/// x >>= 128;\\n/// result += 128;\\n/// }\\n/// ```\\n///\\n/// Where 128 is replaced with each respective power of two factor. See the full high-level implementation here:\\n/// https://gist.github.com/PaulRBerg/f932f8693f2733e30c4d479e8e980948\\n///\\n/// The Yul instructions used below are:\\n///\\n/// - \\\"gt\\\" is \\\"greater than\\\"\\n/// - \\\"or\\\" is the OR bitwise operator\\n/// - \\\"shl\\\" is \\\"shift left\\\"\\n/// - \\\"shr\\\" is \\\"shift right\\\"\\n///\\n/// @param x The uint256 number for which to find the index of the most significant bit.\\n/// @return result The index of the most significant bit as a uint256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction msb(uint256 x) pure returns (uint256 result) {\\n // 2^128\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(7, gt(x, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^64\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(6, gt(x, 0xFFFFFFFFFFFFFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^32\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(5, gt(x, 0xFFFFFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^16\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(4, gt(x, 0xFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^8\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(3, gt(x, 0xFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^4\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(2, gt(x, 0xF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^2\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(1, gt(x, 0x3))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^1\\n // No need to shift x any more.\\n assembly (\\\"memory-safe\\\") {\\n let factor := gt(x, 0x1)\\n result := or(result, factor)\\n }\\n}\\n\\n/// @notice Calculates x*y\\u00f7denominator with 512-bit precision.\\n///\\n/// @dev Credits to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv.\\n///\\n/// Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - The denominator must not be zero.\\n/// - The result must fit in uint256.\\n///\\n/// @param x The multiplicand as a uint256.\\n/// @param y The multiplier as a uint256.\\n/// @param denominator The divisor as a uint256.\\n/// @return result The result as a uint256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mulDiv(uint256 x, uint256 y, uint256 denominator) pure returns (uint256 result) {\\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; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly (\\\"memory-safe\\\") {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\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 unchecked {\\n return prod0 / denominator;\\n }\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n if (prod1 >= denominator) {\\n revert PRBMath_MulDiv_Overflow(x, y, denominator);\\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 (\\\"memory-safe\\\") {\\n // Compute remainder using the mulmod Yul instruction.\\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 unchecked {\\n // Calculate the largest power of two divisor of the denominator using the unary operator ~. This operation cannot overflow\\n // because the denominator cannot be zero at this point in the function execution. The result is always >= 1.\\n // For more detail, see https://cs.stackexchange.com/q/138556/92363.\\n uint256 lpotdod = denominator & (~denominator + 1);\\n uint256 flippedLpotdod;\\n\\n assembly (\\\"memory-safe\\\") {\\n // Factor powers of two out of denominator.\\n denominator := div(denominator, lpotdod)\\n\\n // Divide [prod1 prod0] by lpotdod.\\n prod0 := div(prod0, lpotdod)\\n\\n // Get the flipped value `2^256 / lpotdod`. If the `lpotdod` is zero, the flipped value is one.\\n // `sub(0, lpotdod)` produces the two's complement version of `lpotdod`, which is equivalent to flipping all the bits.\\n // However, `div` interprets this value as an unsigned value: https://ethereum.stackexchange.com/q/147168/24693\\n flippedLpotdod := add(div(sub(0, lpotdod), lpotdod), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * flippedLpotdod;\\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 works\\n // 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 }\\n}\\n\\n/// @notice Calculates x*y\\u00f71e18 with 512-bit precision.\\n///\\n/// @dev A variant of {mulDiv} with constant folding, i.e. in which the denominator is hard coded to 1e18.\\n///\\n/// Notes:\\n/// - The body is purposely left uncommented; to understand how this works, see the documentation in {mulDiv}.\\n/// - The result is rounded toward zero.\\n/// - We take as an axiom that the result cannot be `MAX_UINT256` when x and y solve the following system of equations:\\n///\\n/// $$\\n/// \\\\begin{cases}\\n/// x * y = MAX\\\\_UINT256 * UNIT \\\\\\\\\\n/// (x * y) \\\\% UNIT \\\\geq \\\\frac{UNIT}{2}\\n/// \\\\end{cases}\\n/// $$\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {mulDiv}.\\n/// - The result must fit in uint256.\\n///\\n/// @param x The multiplicand as an unsigned 60.18-decimal fixed-point number.\\n/// @param y The multiplier as an unsigned 60.18-decimal fixed-point number.\\n/// @return result The result as an unsigned 60.18-decimal fixed-point number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mulDiv18(uint256 x, uint256 y) pure returns (uint256 result) {\\n uint256 prod0;\\n uint256 prod1;\\n assembly (\\\"memory-safe\\\") {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n if (prod1 == 0) {\\n unchecked {\\n return prod0 / UNIT;\\n }\\n }\\n\\n if (prod1 >= UNIT) {\\n revert PRBMath_MulDiv18_Overflow(x, y);\\n }\\n\\n uint256 remainder;\\n assembly (\\\"memory-safe\\\") {\\n remainder := mulmod(x, y, UNIT)\\n result :=\\n mul(\\n or(\\n div(sub(prod0, remainder), UNIT_LPOTD),\\n mul(sub(prod1, gt(remainder, prod0)), add(div(sub(0, UNIT_LPOTD), UNIT_LPOTD), 1))\\n ),\\n UNIT_INVERSE\\n )\\n }\\n}\\n\\n/// @notice Calculates x*y\\u00f7denominator with 512-bit precision.\\n///\\n/// @dev This is an extension of {mulDiv} for signed numbers, which works by computing the signs and the absolute values separately.\\n///\\n/// Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {mulDiv}.\\n/// - None of the inputs can be `type(int256).min`.\\n/// - The result must fit in int256.\\n///\\n/// @param x The multiplicand as an int256.\\n/// @param y The multiplier as an int256.\\n/// @param denominator The divisor as an int256.\\n/// @return result The result as an int256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mulDivSigned(int256 x, int256 y, int256 denominator) pure returns (int256 result) {\\n if (x == type(int256).min || y == type(int256).min || denominator == type(int256).min) {\\n revert PRBMath_MulDivSigned_InputTooSmall();\\n }\\n\\n // Get hold of the absolute values of x, y and the denominator.\\n uint256 xAbs;\\n uint256 yAbs;\\n uint256 dAbs;\\n unchecked {\\n xAbs = x < 0 ? uint256(-x) : uint256(x);\\n yAbs = y < 0 ? uint256(-y) : uint256(y);\\n dAbs = denominator < 0 ? uint256(-denominator) : uint256(denominator);\\n }\\n\\n // Compute the absolute value of x*y\\u00f7denominator. The result must fit in int256.\\n uint256 resultAbs = mulDiv(xAbs, yAbs, dAbs);\\n if (resultAbs > uint256(type(int256).max)) {\\n revert PRBMath_MulDivSigned_Overflow(x, y);\\n }\\n\\n // Get the signs of x, y and the denominator.\\n uint256 sx;\\n uint256 sy;\\n uint256 sd;\\n assembly (\\\"memory-safe\\\") {\\n // \\\"sgt\\\" is the \\\"signed greater than\\\" assembly instruction and \\\"sub(0,1)\\\" is -1 in two's complement.\\n sx := sgt(x, sub(0, 1))\\n sy := sgt(y, sub(0, 1))\\n sd := sgt(denominator, sub(0, 1))\\n }\\n\\n // XOR over sx, sy and sd. What this does is to check whether there are 1 or 3 negative signs in the inputs.\\n // If there are, the result should be negative. Otherwise, it should be positive.\\n unchecked {\\n result = sx ^ sy ^ sd == 0 ? -int256(resultAbs) : int256(resultAbs);\\n }\\n}\\n\\n/// @notice Calculates the square root of x using the Babylonian method.\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\\n///\\n/// Notes:\\n/// - If x is not a perfect square, the result is rounded down.\\n/// - Credits to OpenZeppelin for the explanations in comments below.\\n///\\n/// @param x The uint256 number for which to calculate the square root.\\n/// @return result The result as a uint256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction sqrt(uint256 x) pure returns (uint256 result) {\\n if (x == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we calculate the biggest power of 2 which is smaller than the square root of x.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of x is a power of 2 such that we have:\\n //\\n // $$\\n // msb(x) <= x <= 2*msb(x)$\\n // $$\\n //\\n // We write $msb(x)$ as $2^k$, and we get:\\n //\\n // $$\\n // k = log_2(x)\\n // $$\\n //\\n // Thus, we can write the initial inequality as:\\n //\\n // $$\\n // 2^{log_2(x)} <= x <= 2*2^{log_2(x)+1} \\\\\\\\\\n // sqrt(2^k) <= sqrt(x) < sqrt(2^{k+1}) \\\\\\\\\\n // 2^{k/2} <= sqrt(x) < 2^{(k+1)/2} <= 2^{(k/2)+1}\\n // $$\\n //\\n // Consequently, $2^{log_2(x) /2} is a good first approximation of sqrt(x) with at least one correct bit.\\n uint256 xAux = uint256(x);\\n result = 1;\\n if (xAux >= 2 ** 128) {\\n xAux >>= 128;\\n result <<= 64;\\n }\\n if (xAux >= 2 ** 64) {\\n xAux >>= 64;\\n result <<= 32;\\n }\\n if (xAux >= 2 ** 32) {\\n xAux >>= 32;\\n result <<= 16;\\n }\\n if (xAux >= 2 ** 16) {\\n xAux >>= 16;\\n result <<= 8;\\n }\\n if (xAux >= 2 ** 8) {\\n xAux >>= 8;\\n result <<= 4;\\n }\\n if (xAux >= 2 ** 4) {\\n xAux >>= 4;\\n result <<= 2;\\n }\\n if (xAux >= 2 ** 2) {\\n result <<= 1;\\n }\\n\\n // At this point, `result` is an estimation with at least one bit of precision. We know the true value has at\\n // most 128 bits, since it is the square root of a uint256. Newton's method converges quadratically (precision\\n // doubles at every iteration). We thus need at most 7 iteration to turn our partial result with one bit of\\n // precision into the expected uint128 result.\\n unchecked {\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n\\n // If x is not a perfect square, round the result toward zero.\\n uint256 roundedResult = x / result;\\n if (result >= roundedResult) {\\n result = roundedResult;\\n }\\n }\\n}\\n\",\"keccak256\":\"0xaa374e2c26cc93e8c22a6953804ee05f811597ef5fa82f76824378b22944778b\",\"license\":\"MIT\"},\"@prb/math/src/UD2x18.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\n/*\\n\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2550\\u2550\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2554\\u2588\\u2588\\u2588\\u2588\\u2554\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551 \\u255a\\u2550\\u255d \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\n\\n\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2550\\u2550\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d \\u255a\\u2588\\u2588\\u2588\\u2554\\u255d \\u255a\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u255d\\n\\n*/\\n\\nimport \\\"./ud2x18/Casting.sol\\\";\\nimport \\\"./ud2x18/Constants.sol\\\";\\nimport \\\"./ud2x18/Errors.sol\\\";\\nimport \\\"./ud2x18/ValueType.sol\\\";\\n\",\"keccak256\":\"0xfb624e24cd8bb790fa08e7827819de85504a86e20e961fa4ad126c65b6d90641\",\"license\":\"MIT\"},\"@prb/math/src/UD60x18.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\n/*\\n\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2550\\u2550\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2554\\u2588\\u2588\\u2588\\u2588\\u2554\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551 \\u255a\\u2550\\u255d \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\n\\n\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2550\\u2588\\u2588\\u2588\\u2588\\u2557\\u255a\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2588\\u2588\\u2551 \\u255a\\u2588\\u2588\\u2588\\u2554\\u255d \\u255a\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2554\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2554\\u255d \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u255d\\n\\n*/\\n\\nimport \\\"./ud60x18/Casting.sol\\\";\\nimport \\\"./ud60x18/Constants.sol\\\";\\nimport \\\"./ud60x18/Conversions.sol\\\";\\nimport \\\"./ud60x18/Errors.sol\\\";\\nimport \\\"./ud60x18/Helpers.sol\\\";\\nimport \\\"./ud60x18/Math.sol\\\";\\nimport \\\"./ud60x18/ValueType.sol\\\";\\n\",\"keccak256\":\"0xb98c6f74275914d279e8af6c502c2b1f50d5f6e1ed418d3b0153f5a193206c48\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as CastingErrors;\\nimport { SD59x18 } from \\\"../sd59x18/ValueType.sol\\\";\\nimport { UD2x18 } from \\\"../ud2x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"../ud60x18/ValueType.sol\\\";\\nimport { SD1x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts an SD1x18 number into SD59x18.\\n/// @dev There is no overflow check because the domain of SD1x18 is a subset of SD59x18.\\nfunction intoSD59x18(SD1x18 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(int256(SD1x18.unwrap(x)));\\n}\\n\\n/// @notice Casts an SD1x18 number into UD2x18.\\n/// - x must be positive.\\nfunction intoUD2x18(SD1x18 x) pure returns (UD2x18 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUD2x18_Underflow(x);\\n }\\n result = UD2x18.wrap(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into UD60x18.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUD60x18(SD1x18 x) pure returns (UD60x18 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUD60x18_Underflow(x);\\n }\\n result = UD60x18.wrap(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into uint256.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUint256(SD1x18 x) pure returns (uint256 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint256_Underflow(x);\\n }\\n result = uint256(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into uint128.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUint128(SD1x18 x) pure returns (uint128 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint128_Underflow(x);\\n }\\n result = uint128(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(SD1x18 x) pure returns (uint40 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint40_Underflow(x);\\n }\\n if (xInt > int64(uint64(Common.MAX_UINT40))) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint40_Overflow(x);\\n }\\n result = uint40(uint64(xInt));\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction sd1x18(int64 x) pure returns (SD1x18 result) {\\n result = SD1x18.wrap(x);\\n}\\n\\n/// @notice Unwraps an SD1x18 number into int64.\\nfunction unwrap(SD1x18 x) pure returns (int64 result) {\\n result = SD1x18.unwrap(x);\\n}\\n\\n/// @notice Wraps an int64 number into SD1x18.\\nfunction wrap(int64 x) pure returns (SD1x18 result) {\\n result = SD1x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x9e49e2b37c1bb845861740805edaaef3fe951a7b96eef16ce84fbf76e8278670\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD1x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @dev Euler's number as an SD1x18 number.\\nSD1x18 constant E = SD1x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum value an SD1x18 number can have.\\nint64 constant uMAX_SD1x18 = 9_223372036854775807;\\nSD1x18 constant MAX_SD1x18 = SD1x18.wrap(uMAX_SD1x18);\\n\\n/// @dev The maximum value an SD1x18 number can have.\\nint64 constant uMIN_SD1x18 = -9_223372036854775808;\\nSD1x18 constant MIN_SD1x18 = SD1x18.wrap(uMIN_SD1x18);\\n\\n/// @dev PI as an SD1x18 number.\\nSD1x18 constant PI = SD1x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of SD1x18.\\nSD1x18 constant UNIT = SD1x18.wrap(1e18);\\nint64 constant uUNIT = 1e18;\\n\",\"keccak256\":\"0x6496165b80552785a4b65a239b96e2a5fedf62fe54f002eeed72d75e566d7585\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD1x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in UD2x18.\\nerror PRBMath_SD1x18_ToUD2x18_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in UD60x18.\\nerror PRBMath_SD1x18_ToUD60x18_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint128.\\nerror PRBMath_SD1x18_ToUint128_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint256.\\nerror PRBMath_SD1x18_ToUint256_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint40.\\nerror PRBMath_SD1x18_ToUint40_Overflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint40.\\nerror PRBMath_SD1x18_ToUint40_Underflow(SD1x18 x);\\n\",\"keccak256\":\"0x836cb42ba619ca369fd4765bc47fefc3c3621369c5861882af14660aca5057ee\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\n\\n/// @notice The signed 1.18-decimal fixed-point number representation, which can have up to 1 digit and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\\n/// type int64. This is useful when end users want to use int64 to save gas, e.g. with tight variable packing in contract\\n/// storage.\\ntype SD1x18 is int64;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoSD59x18,\\n Casting.intoUD2x18,\\n Casting.intoUD60x18,\\n Casting.intoUint256,\\n Casting.intoUint128,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for SD1x18 global;\\n\",\"keccak256\":\"0x2f86f1aa9fca42f40808b51a879b406ac51817647bdb9642f8a79dd8fdb754a7\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Errors.sol\\\" as CastingErrors;\\nimport { MAX_UINT128, MAX_UINT40 } from \\\"../Common.sol\\\";\\nimport { uMAX_SD1x18, uMIN_SD1x18 } from \\\"../sd1x18/Constants.sol\\\";\\nimport { SD1x18 } from \\\"../sd1x18/ValueType.sol\\\";\\nimport { uMAX_UD2x18 } from \\\"../ud2x18/Constants.sol\\\";\\nimport { UD2x18 } from \\\"../ud2x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"../ud60x18/ValueType.sol\\\";\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts an SD59x18 number into int256.\\n/// @dev This is basically a functional alias for {unwrap}.\\nfunction intoInt256(SD59x18 x) pure returns (int256 result) {\\n result = SD59x18.unwrap(x);\\n}\\n\\n/// @notice Casts an SD59x18 number into SD1x18.\\n/// @dev Requirements:\\n/// - x must be greater than or equal to `uMIN_SD1x18`.\\n/// - x must be less than or equal to `uMAX_SD1x18`.\\nfunction intoSD1x18(SD59x18 x) pure returns (SD1x18 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < uMIN_SD1x18) {\\n revert CastingErrors.PRBMath_SD59x18_IntoSD1x18_Underflow(x);\\n }\\n if (xInt > uMAX_SD1x18) {\\n revert CastingErrors.PRBMath_SD59x18_IntoSD1x18_Overflow(x);\\n }\\n result = SD1x18.wrap(int64(xInt));\\n}\\n\\n/// @notice Casts an SD59x18 number into UD2x18.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `uMAX_UD2x18`.\\nfunction intoUD2x18(SD59x18 x) pure returns (UD2x18 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUD2x18_Underflow(x);\\n }\\n if (xInt > int256(uint256(uMAX_UD2x18))) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUD2x18_Overflow(x);\\n }\\n result = UD2x18.wrap(uint64(uint256(xInt)));\\n}\\n\\n/// @notice Casts an SD59x18 number into UD60x18.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUD60x18(SD59x18 x) pure returns (UD60x18 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUD60x18_Underflow(x);\\n }\\n result = UD60x18.wrap(uint256(xInt));\\n}\\n\\n/// @notice Casts an SD59x18 number into uint256.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUint256(SD59x18 x) pure returns (uint256 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint256_Underflow(x);\\n }\\n result = uint256(xInt);\\n}\\n\\n/// @notice Casts an SD59x18 number into uint128.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `uMAX_UINT128`.\\nfunction intoUint128(SD59x18 x) pure returns (uint128 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint128_Underflow(x);\\n }\\n if (xInt > int256(uint256(MAX_UINT128))) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint128_Overflow(x);\\n }\\n result = uint128(uint256(xInt));\\n}\\n\\n/// @notice Casts an SD59x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(SD59x18 x) pure returns (uint40 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint40_Underflow(x);\\n }\\n if (xInt > int256(uint256(MAX_UINT40))) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint40_Overflow(x);\\n }\\n result = uint40(uint256(xInt));\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction sd(int256 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(x);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction sd59x18(int256 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(x);\\n}\\n\\n/// @notice Unwraps an SD59x18 number into int256.\\nfunction unwrap(SD59x18 x) pure returns (int256 result) {\\n result = SD59x18.unwrap(x);\\n}\\n\\n/// @notice Wraps an int256 number into SD59x18.\\nfunction wrap(int256 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x3b21b60ec2998c3ae32f647412da51d3683b3f183a807198cc8d157499484f99\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n// NOTICE: the \\\"u\\\" prefix stands for \\\"unwrapped\\\".\\n\\n/// @dev Euler's number as an SD59x18 number.\\nSD59x18 constant E = SD59x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum input permitted in {exp}.\\nint256 constant uEXP_MAX_INPUT = 133_084258667509499440;\\nSD59x18 constant EXP_MAX_INPUT = SD59x18.wrap(uEXP_MAX_INPUT);\\n\\n/// @dev Any value less than this returns 0 in {exp}.\\nint256 constant uEXP_MIN_THRESHOLD = -41_446531673892822322;\\nSD59x18 constant EXP_MIN_THRESHOLD = SD59x18.wrap(uEXP_MIN_THRESHOLD);\\n\\n/// @dev The maximum input permitted in {exp2}.\\nint256 constant uEXP2_MAX_INPUT = 192e18 - 1;\\nSD59x18 constant EXP2_MAX_INPUT = SD59x18.wrap(uEXP2_MAX_INPUT);\\n\\n/// @dev Any value less than this returns 0 in {exp2}.\\nint256 constant uEXP2_MIN_THRESHOLD = -59_794705707972522261;\\nSD59x18 constant EXP2_MIN_THRESHOLD = SD59x18.wrap(uEXP2_MIN_THRESHOLD);\\n\\n/// @dev Half the UNIT number.\\nint256 constant uHALF_UNIT = 0.5e18;\\nSD59x18 constant HALF_UNIT = SD59x18.wrap(uHALF_UNIT);\\n\\n/// @dev $log_2(10)$ as an SD59x18 number.\\nint256 constant uLOG2_10 = 3_321928094887362347;\\nSD59x18 constant LOG2_10 = SD59x18.wrap(uLOG2_10);\\n\\n/// @dev $log_2(e)$ as an SD59x18 number.\\nint256 constant uLOG2_E = 1_442695040888963407;\\nSD59x18 constant LOG2_E = SD59x18.wrap(uLOG2_E);\\n\\n/// @dev The maximum value an SD59x18 number can have.\\nint256 constant uMAX_SD59x18 = 57896044618658097711785492504343953926634992332820282019728_792003956564819967;\\nSD59x18 constant MAX_SD59x18 = SD59x18.wrap(uMAX_SD59x18);\\n\\n/// @dev The maximum whole value an SD59x18 number can have.\\nint256 constant uMAX_WHOLE_SD59x18 = 57896044618658097711785492504343953926634992332820282019728_000000000000000000;\\nSD59x18 constant MAX_WHOLE_SD59x18 = SD59x18.wrap(uMAX_WHOLE_SD59x18);\\n\\n/// @dev The minimum value an SD59x18 number can have.\\nint256 constant uMIN_SD59x18 = -57896044618658097711785492504343953926634992332820282019728_792003956564819968;\\nSD59x18 constant MIN_SD59x18 = SD59x18.wrap(uMIN_SD59x18);\\n\\n/// @dev The minimum whole value an SD59x18 number can have.\\nint256 constant uMIN_WHOLE_SD59x18 = -57896044618658097711785492504343953926634992332820282019728_000000000000000000;\\nSD59x18 constant MIN_WHOLE_SD59x18 = SD59x18.wrap(uMIN_WHOLE_SD59x18);\\n\\n/// @dev PI as an SD59x18 number.\\nSD59x18 constant PI = SD59x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of SD59x18.\\nint256 constant uUNIT = 1e18;\\nSD59x18 constant UNIT = SD59x18.wrap(1e18);\\n\\n/// @dev The unit number squared.\\nint256 constant uUNIT_SQUARED = 1e36;\\nSD59x18 constant UNIT_SQUARED = SD59x18.wrap(uUNIT_SQUARED);\\n\\n/// @dev Zero as an SD59x18 number.\\nSD59x18 constant ZERO = SD59x18.wrap(0);\\n\",\"keccak256\":\"0x9bcb8dd6b3e886d140ad1c32747a4f6d29a492529ceb835be878ae837aa6cc3a\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when taking the absolute value of `MIN_SD59x18`.\\nerror PRBMath_SD59x18_Abs_MinSD59x18();\\n\\n/// @notice Thrown when ceiling a number overflows SD59x18.\\nerror PRBMath_SD59x18_Ceil_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when converting a basic integer to the fixed-point format overflows SD59x18.\\nerror PRBMath_SD59x18_Convert_Overflow(int256 x);\\n\\n/// @notice Thrown when converting a basic integer to the fixed-point format underflows SD59x18.\\nerror PRBMath_SD59x18_Convert_Underflow(int256 x);\\n\\n/// @notice Thrown when dividing two numbers and one of them is `MIN_SD59x18`.\\nerror PRBMath_SD59x18_Div_InputTooSmall();\\n\\n/// @notice Thrown when dividing two numbers and one of the intermediary unsigned results overflows SD59x18.\\nerror PRBMath_SD59x18_Div_Overflow(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when taking the natural exponent of a base greater than 133_084258667509499441.\\nerror PRBMath_SD59x18_Exp_InputTooBig(SD59x18 x);\\n\\n/// @notice Thrown when taking the binary exponent of a base greater than 192e18.\\nerror PRBMath_SD59x18_Exp2_InputTooBig(SD59x18 x);\\n\\n/// @notice Thrown when flooring a number underflows SD59x18.\\nerror PRBMath_SD59x18_Floor_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when taking the geometric mean of two numbers and their product is negative.\\nerror PRBMath_SD59x18_Gm_NegativeProduct(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when taking the geometric mean of two numbers and multiplying them overflows SD59x18.\\nerror PRBMath_SD59x18_Gm_Overflow(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\\nerror PRBMath_SD59x18_IntoSD1x18_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\\nerror PRBMath_SD59x18_IntoSD1x18_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\\nerror PRBMath_SD59x18_IntoUD2x18_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\\nerror PRBMath_SD59x18_IntoUD2x18_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD60x18.\\nerror PRBMath_SD59x18_IntoUD60x18_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\\nerror PRBMath_SD59x18_IntoUint128_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\\nerror PRBMath_SD59x18_IntoUint128_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint256.\\nerror PRBMath_SD59x18_IntoUint256_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\\nerror PRBMath_SD59x18_IntoUint40_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\\nerror PRBMath_SD59x18_IntoUint40_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when taking the logarithm of a number less than or equal to zero.\\nerror PRBMath_SD59x18_Log_InputTooSmall(SD59x18 x);\\n\\n/// @notice Thrown when multiplying two numbers and one of the inputs is `MIN_SD59x18`.\\nerror PRBMath_SD59x18_Mul_InputTooSmall();\\n\\n/// @notice Thrown when multiplying two numbers and the intermediary absolute result overflows SD59x18.\\nerror PRBMath_SD59x18_Mul_Overflow(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when raising a number to a power and the intermediary absolute result overflows SD59x18.\\nerror PRBMath_SD59x18_Powu_Overflow(SD59x18 x, uint256 y);\\n\\n/// @notice Thrown when taking the square root of a negative number.\\nerror PRBMath_SD59x18_Sqrt_NegativeInput(SD59x18 x);\\n\\n/// @notice Thrown when the calculating the square root overflows SD59x18.\\nerror PRBMath_SD59x18_Sqrt_Overflow(SD59x18 x);\\n\",\"keccak256\":\"0xa6d00fe5efa215ac0df25c896e3da99a12fb61e799644b2ec32da947313d3db4\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Helpers.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { wrap } from \\\"./Casting.sol\\\";\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Implements the checked addition operation (+) in the SD59x18 type.\\nfunction add(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n return wrap(x.unwrap() + y.unwrap());\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the SD59x18 type.\\nfunction and(SD59x18 x, int256 bits) pure returns (SD59x18 result) {\\n return wrap(x.unwrap() & bits);\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the SD59x18 type.\\nfunction and2(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n return wrap(x.unwrap() & y.unwrap());\\n}\\n\\n/// @notice Implements the equal (=) operation in the SD59x18 type.\\nfunction eq(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() == y.unwrap();\\n}\\n\\n/// @notice Implements the greater than operation (>) in the SD59x18 type.\\nfunction gt(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() > y.unwrap();\\n}\\n\\n/// @notice Implements the greater than or equal to operation (>=) in the SD59x18 type.\\nfunction gte(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() >= y.unwrap();\\n}\\n\\n/// @notice Implements a zero comparison check function in the SD59x18 type.\\nfunction isZero(SD59x18 x) pure returns (bool result) {\\n result = x.unwrap() == 0;\\n}\\n\\n/// @notice Implements the left shift operation (<<) in the SD59x18 type.\\nfunction lshift(SD59x18 x, uint256 bits) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() << bits);\\n}\\n\\n/// @notice Implements the lower than operation (<) in the SD59x18 type.\\nfunction lt(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() < y.unwrap();\\n}\\n\\n/// @notice Implements the lower than or equal to operation (<=) in the SD59x18 type.\\nfunction lte(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() <= y.unwrap();\\n}\\n\\n/// @notice Implements the unchecked modulo operation (%) in the SD59x18 type.\\nfunction mod(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() % y.unwrap());\\n}\\n\\n/// @notice Implements the not equal operation (!=) in the SD59x18 type.\\nfunction neq(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() != y.unwrap();\\n}\\n\\n/// @notice Implements the NOT (~) bitwise operation in the SD59x18 type.\\nfunction not(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(~x.unwrap());\\n}\\n\\n/// @notice Implements the OR (|) bitwise operation in the SD59x18 type.\\nfunction or(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() | y.unwrap());\\n}\\n\\n/// @notice Implements the right shift operation (>>) in the SD59x18 type.\\nfunction rshift(SD59x18 x, uint256 bits) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() >> bits);\\n}\\n\\n/// @notice Implements the checked subtraction operation (-) in the SD59x18 type.\\nfunction sub(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() - y.unwrap());\\n}\\n\\n/// @notice Implements the checked unary minus operation (-) in the SD59x18 type.\\nfunction unary(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(-x.unwrap());\\n}\\n\\n/// @notice Implements the unchecked addition operation (+) in the SD59x18 type.\\nfunction uncheckedAdd(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() + y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the unchecked subtraction operation (-) in the SD59x18 type.\\nfunction uncheckedSub(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() - y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the unchecked unary minus operation (-) in the SD59x18 type.\\nfunction uncheckedUnary(SD59x18 x) pure returns (SD59x18 result) {\\n unchecked {\\n result = wrap(-x.unwrap());\\n }\\n}\\n\\n/// @notice Implements the XOR (^) bitwise operation in the SD59x18 type.\\nfunction xor(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() ^ y.unwrap());\\n}\\n\",\"keccak256\":\"0x208570f1657cf730cb6c3d81aa14030e0d45cf906cdedea5059369d7df4bb716\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as Errors;\\nimport {\\n uEXP_MAX_INPUT,\\n uEXP2_MAX_INPUT,\\n uEXP_MIN_THRESHOLD,\\n uEXP2_MIN_THRESHOLD,\\n uHALF_UNIT,\\n uLOG2_10,\\n uLOG2_E,\\n uMAX_SD59x18,\\n uMAX_WHOLE_SD59x18,\\n uMIN_SD59x18,\\n uMIN_WHOLE_SD59x18,\\n UNIT,\\n uUNIT,\\n uUNIT_SQUARED,\\n ZERO\\n} from \\\"./Constants.sol\\\";\\nimport { wrap } from \\\"./Helpers.sol\\\";\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Calculates the absolute value of x.\\n///\\n/// @dev Requirements:\\n/// - x must be greater than `MIN_SD59x18`.\\n///\\n/// @param x The SD59x18 number for which to calculate the absolute value.\\n/// @param result The absolute value of x as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction abs(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt == uMIN_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Abs_MinSD59x18();\\n }\\n result = xInt < 0 ? wrap(-xInt) : x;\\n}\\n\\n/// @notice Calculates the arithmetic average of x and y.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// @param x The first operand as an SD59x18 number.\\n/// @param y The second operand as an SD59x18 number.\\n/// @return result The arithmetic average as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction avg(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n\\n unchecked {\\n // This operation is equivalent to `x / 2 + y / 2`, and it can never overflow.\\n int256 sum = (xInt >> 1) + (yInt >> 1);\\n\\n if (sum < 0) {\\n // If at least one of x and y is odd, add 1 to the result, because shifting negative numbers to the right\\n // rounds toward negative infinity. The right part is equivalent to `sum + (x % 2 == 1 || y % 2 == 1)`.\\n assembly (\\\"memory-safe\\\") {\\n result := add(sum, and(or(xInt, yInt), 1))\\n }\\n } else {\\n // Add 1 if both x and y are odd to account for the double 0.5 remainder truncated after shifting.\\n result = wrap(sum + (xInt & yInt & 1));\\n }\\n }\\n}\\n\\n/// @notice Yields the smallest whole number greater than or equal to x.\\n///\\n/// @dev Optimized for fractional value inputs, because every whole value has (1e18 - 1) fractional counterparts.\\n/// See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n///\\n/// Requirements:\\n/// - x must be less than or equal to `MAX_WHOLE_SD59x18`.\\n///\\n/// @param x The SD59x18 number to ceil.\\n/// @param result The smallest whole number greater than or equal to x, as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ceil(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt > uMAX_WHOLE_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Ceil_Overflow(x);\\n }\\n\\n int256 remainder = xInt % uUNIT;\\n if (remainder == 0) {\\n result = x;\\n } else {\\n unchecked {\\n // Solidity uses C fmod style, which returns a modulus with the same sign as x.\\n int256 resultInt = xInt - remainder;\\n if (xInt > 0) {\\n resultInt += uUNIT;\\n }\\n result = wrap(resultInt);\\n }\\n }\\n}\\n\\n/// @notice Divides two SD59x18 numbers, returning a new SD59x18 number.\\n///\\n/// @dev This is an extension of {Common.mulDiv} for signed numbers, which works by computing the signs and the absolute\\n/// values separately.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv}.\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv}.\\n/// - None of the inputs can be `MIN_SD59x18`.\\n/// - The denominator must not be zero.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The numerator as an SD59x18 number.\\n/// @param y The denominator as an SD59x18 number.\\n/// @param result The quotient as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction div(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n if (xInt == uMIN_SD59x18 || yInt == uMIN_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Div_InputTooSmall();\\n }\\n\\n // Get hold of the absolute values of x and y.\\n uint256 xAbs;\\n uint256 yAbs;\\n unchecked {\\n xAbs = xInt < 0 ? uint256(-xInt) : uint256(xInt);\\n yAbs = yInt < 0 ? uint256(-yInt) : uint256(yInt);\\n }\\n\\n // Compute the absolute value (x*UNIT\\u00f7y). The resulting value must fit in SD59x18.\\n uint256 resultAbs = Common.mulDiv(xAbs, uint256(uUNIT), yAbs);\\n if (resultAbs > uint256(uMAX_SD59x18)) {\\n revert Errors.PRBMath_SD59x18_Div_Overflow(x, y);\\n }\\n\\n // Check if x and y have the same sign using two's complement representation. The left-most bit represents the sign (1 for\\n // negative, 0 for positive or zero).\\n bool sameSign = (xInt ^ yInt) > -1;\\n\\n // If the inputs have the same sign, the result should be positive. Otherwise, it should be negative.\\n unchecked {\\n result = wrap(sameSign ? int256(resultAbs) : -int256(resultAbs));\\n }\\n}\\n\\n/// @notice Calculates the natural exponent of x using the following formula:\\n///\\n/// $$\\n/// e^x = 2^{x * log_2{e}}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {exp2}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {exp2}.\\n/// - x must be less than 133_084258667509499441.\\n///\\n/// @param x The exponent as an SD59x18 number.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n\\n // Any input less than the threshold returns zero.\\n // This check also prevents an overflow for very small numbers.\\n if (xInt < uEXP_MIN_THRESHOLD) {\\n return ZERO;\\n }\\n\\n // This check prevents values greater than 192e18 from being passed to {exp2}.\\n if (xInt > uEXP_MAX_INPUT) {\\n revert Errors.PRBMath_SD59x18_Exp_InputTooBig(x);\\n }\\n\\n unchecked {\\n // Inline the fixed-point multiplication to save gas.\\n int256 doubleUnitProduct = xInt * uLOG2_E;\\n result = exp2(wrap(doubleUnitProduct / uUNIT));\\n }\\n}\\n\\n/// @notice Calculates the binary exponent of x using the binary fraction method using the following formula:\\n///\\n/// $$\\n/// 2^{-x} = \\\\frac{1}{2^x}\\n/// $$\\n///\\n/// @dev See https://ethereum.stackexchange.com/q/79903/24693.\\n///\\n/// Notes:\\n/// - If x is less than -59_794705707972522261, the result is zero.\\n///\\n/// Requirements:\\n/// - x must be less than 192e18.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The exponent as an SD59x18 number.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp2(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < 0) {\\n // The inverse of any number less than the threshold is truncated to zero.\\n if (xInt < uEXP2_MIN_THRESHOLD) {\\n return ZERO;\\n }\\n\\n unchecked {\\n // Inline the fixed-point inversion to save gas.\\n result = wrap(uUNIT_SQUARED / exp2(wrap(-xInt)).unwrap());\\n }\\n } else {\\n // Numbers greater than or equal to 192e18 don't fit in the 192.64-bit format.\\n if (xInt > uEXP2_MAX_INPUT) {\\n revert Errors.PRBMath_SD59x18_Exp2_InputTooBig(x);\\n }\\n\\n unchecked {\\n // Convert x to the 192.64-bit fixed-point format.\\n uint256 x_192x64 = uint256((xInt << 64) / uUNIT);\\n\\n // It is safe to cast the result to int256 due to the checks above.\\n result = wrap(int256(Common.exp2(x_192x64)));\\n }\\n }\\n}\\n\\n/// @notice Yields the greatest whole number less than or equal to x.\\n///\\n/// @dev Optimized for fractional value inputs, because for every whole value there are (1e18 - 1) fractional\\n/// counterparts. See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n///\\n/// Requirements:\\n/// - x must be greater than or equal to `MIN_WHOLE_SD59x18`.\\n///\\n/// @param x The SD59x18 number to floor.\\n/// @param result The greatest whole number less than or equal to x, as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction floor(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < uMIN_WHOLE_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Floor_Underflow(x);\\n }\\n\\n int256 remainder = xInt % uUNIT;\\n if (remainder == 0) {\\n result = x;\\n } else {\\n unchecked {\\n // Solidity uses C fmod style, which returns a modulus with the same sign as x.\\n int256 resultInt = xInt - remainder;\\n if (xInt < 0) {\\n resultInt -= uUNIT;\\n }\\n result = wrap(resultInt);\\n }\\n }\\n}\\n\\n/// @notice Yields the excess beyond the floor of x for positive numbers and the part of the number to the right.\\n/// of the radix point for negative numbers.\\n/// @dev Based on the odd function definition. https://en.wikipedia.org/wiki/Fractional_part\\n/// @param x The SD59x18 number to get the fractional part of.\\n/// @param result The fractional part of x as an SD59x18 number.\\nfunction frac(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() % uUNIT);\\n}\\n\\n/// @notice Calculates the geometric mean of x and y, i.e. $\\\\sqrt{x * y}$.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x * y must fit in SD59x18.\\n/// - x * y must not be negative, since complex numbers are not supported.\\n///\\n/// @param x The first operand as an SD59x18 number.\\n/// @param y The second operand as an SD59x18 number.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction gm(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n if (xInt == 0 || yInt == 0) {\\n return ZERO;\\n }\\n\\n unchecked {\\n // Equivalent to `xy / x != y`. Checking for overflow this way is faster than letting Solidity do it.\\n int256 xyInt = xInt * yInt;\\n if (xyInt / xInt != yInt) {\\n revert Errors.PRBMath_SD59x18_Gm_Overflow(x, y);\\n }\\n\\n // The product must not be negative, since complex numbers are not supported.\\n if (xyInt < 0) {\\n revert Errors.PRBMath_SD59x18_Gm_NegativeProduct(x, y);\\n }\\n\\n // We don't need to multiply the result by `UNIT` here because the x*y product picked up a factor of `UNIT`\\n // during multiplication. See the comments in {Common.sqrt}.\\n uint256 resultUint = Common.sqrt(uint256(xyInt));\\n result = wrap(int256(resultUint));\\n }\\n}\\n\\n/// @notice Calculates the inverse of x.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x must not be zero.\\n///\\n/// @param x The SD59x18 number for which to calculate the inverse.\\n/// @return result The inverse as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction inv(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(uUNIT_SQUARED / x.unwrap());\\n}\\n\\n/// @notice Calculates the natural logarithm of x using the following formula:\\n///\\n/// $$\\n/// ln{x} = log_2{x} / log_2{e}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n/// - The precision isn't sufficiently fine-grained to return exactly `UNIT` when the input is `E`.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The SD59x18 number for which to calculate the natural logarithm.\\n/// @return result The natural logarithm as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ln(SD59x18 x) pure returns (SD59x18 result) {\\n // Inline the fixed-point multiplication to save gas. This is overflow-safe because the maximum value that\\n // {log2} can return is ~195_205294292027477728.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_E);\\n}\\n\\n/// @notice Calculates the common logarithm of x using the following formula:\\n///\\n/// $$\\n/// log_{10}{x} = log_2{x} / log_2{10}\\n/// $$\\n///\\n/// However, if x is an exact power of ten, a hard coded value is returned.\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The SD59x18 number for which to calculate the common logarithm.\\n/// @return result The common logarithm as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log10(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < 0) {\\n revert Errors.PRBMath_SD59x18_Log_InputTooSmall(x);\\n }\\n\\n // Note that the `mul` in this block is the standard multiplication operation, not {SD59x18.mul}.\\n // prettier-ignore\\n assembly (\\\"memory-safe\\\") {\\n switch x\\n case 1 { result := mul(uUNIT, sub(0, 18)) }\\n case 10 { result := mul(uUNIT, sub(1, 18)) }\\n case 100 { result := mul(uUNIT, sub(2, 18)) }\\n case 1000 { result := mul(uUNIT, sub(3, 18)) }\\n case 10000 { result := mul(uUNIT, sub(4, 18)) }\\n case 100000 { result := mul(uUNIT, sub(5, 18)) }\\n case 1000000 { result := mul(uUNIT, sub(6, 18)) }\\n case 10000000 { result := mul(uUNIT, sub(7, 18)) }\\n case 100000000 { result := mul(uUNIT, sub(8, 18)) }\\n case 1000000000 { result := mul(uUNIT, sub(9, 18)) }\\n case 10000000000 { result := mul(uUNIT, sub(10, 18)) }\\n case 100000000000 { result := mul(uUNIT, sub(11, 18)) }\\n case 1000000000000 { result := mul(uUNIT, sub(12, 18)) }\\n case 10000000000000 { result := mul(uUNIT, sub(13, 18)) }\\n case 100000000000000 { result := mul(uUNIT, sub(14, 18)) }\\n case 1000000000000000 { result := mul(uUNIT, sub(15, 18)) }\\n case 10000000000000000 { result := mul(uUNIT, sub(16, 18)) }\\n case 100000000000000000 { result := mul(uUNIT, sub(17, 18)) }\\n case 1000000000000000000 { result := 0 }\\n case 10000000000000000000 { result := uUNIT }\\n case 100000000000000000000 { result := mul(uUNIT, 2) }\\n case 1000000000000000000000 { result := mul(uUNIT, 3) }\\n case 10000000000000000000000 { result := mul(uUNIT, 4) }\\n case 100000000000000000000000 { result := mul(uUNIT, 5) }\\n case 1000000000000000000000000 { result := mul(uUNIT, 6) }\\n case 10000000000000000000000000 { result := mul(uUNIT, 7) }\\n case 100000000000000000000000000 { result := mul(uUNIT, 8) }\\n case 1000000000000000000000000000 { result := mul(uUNIT, 9) }\\n case 10000000000000000000000000000 { result := mul(uUNIT, 10) }\\n case 100000000000000000000000000000 { result := mul(uUNIT, 11) }\\n case 1000000000000000000000000000000 { result := mul(uUNIT, 12) }\\n case 10000000000000000000000000000000 { result := mul(uUNIT, 13) }\\n case 100000000000000000000000000000000 { result := mul(uUNIT, 14) }\\n case 1000000000000000000000000000000000 { result := mul(uUNIT, 15) }\\n case 10000000000000000000000000000000000 { result := mul(uUNIT, 16) }\\n case 100000000000000000000000000000000000 { result := mul(uUNIT, 17) }\\n case 1000000000000000000000000000000000000 { result := mul(uUNIT, 18) }\\n case 10000000000000000000000000000000000000 { result := mul(uUNIT, 19) }\\n case 100000000000000000000000000000000000000 { result := mul(uUNIT, 20) }\\n case 1000000000000000000000000000000000000000 { result := mul(uUNIT, 21) }\\n case 10000000000000000000000000000000000000000 { result := mul(uUNIT, 22) }\\n case 100000000000000000000000000000000000000000 { result := mul(uUNIT, 23) }\\n case 1000000000000000000000000000000000000000000 { result := mul(uUNIT, 24) }\\n case 10000000000000000000000000000000000000000000 { result := mul(uUNIT, 25) }\\n case 100000000000000000000000000000000000000000000 { result := mul(uUNIT, 26) }\\n case 1000000000000000000000000000000000000000000000 { result := mul(uUNIT, 27) }\\n case 10000000000000000000000000000000000000000000000 { result := mul(uUNIT, 28) }\\n case 100000000000000000000000000000000000000000000000 { result := mul(uUNIT, 29) }\\n case 1000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 30) }\\n case 10000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 31) }\\n case 100000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 32) }\\n case 1000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 33) }\\n case 10000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 34) }\\n case 100000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 35) }\\n case 1000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 36) }\\n case 10000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 37) }\\n case 100000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 38) }\\n case 1000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 39) }\\n case 10000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 40) }\\n case 100000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 41) }\\n case 1000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 42) }\\n case 10000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 43) }\\n case 100000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 44) }\\n case 1000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 45) }\\n case 10000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 46) }\\n case 100000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 47) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 48) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 49) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 50) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 51) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 52) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 53) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 54) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 55) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 56) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 57) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 58) }\\n default { result := uMAX_SD59x18 }\\n }\\n\\n if (result.unwrap() == uMAX_SD59x18) {\\n unchecked {\\n // Inline the fixed-point division to save gas.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_10);\\n }\\n }\\n}\\n\\n/// @notice Calculates the binary logarithm of x using the iterative approximation algorithm:\\n///\\n/// $$\\n/// log_2{x} = n + log_2{y}, \\\\text{ where } y = x*2^{-n}, \\\\ y \\\\in [1, 2)\\n/// $$\\n///\\n/// For $0 \\\\leq x \\\\lt 1$, the input is inverted:\\n///\\n/// $$\\n/// log_2{x} = -log_2{\\\\frac{1}{x}}\\n/// $$\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Binary_logarithm#Iterative_approximation.\\n///\\n/// Notes:\\n/// - Due to the lossy precision of the iterative approximation, the results are not perfectly accurate to the last decimal.\\n///\\n/// Requirements:\\n/// - x must be greater than zero.\\n///\\n/// @param x The SD59x18 number for which to calculate the binary logarithm.\\n/// @return result The binary logarithm as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log2(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt <= 0) {\\n revert Errors.PRBMath_SD59x18_Log_InputTooSmall(x);\\n }\\n\\n unchecked {\\n int256 sign;\\n if (xInt >= uUNIT) {\\n sign = 1;\\n } else {\\n sign = -1;\\n // Inline the fixed-point inversion to save gas.\\n xInt = uUNIT_SQUARED / xInt;\\n }\\n\\n // Calculate the integer part of the logarithm.\\n uint256 n = Common.msb(uint256(xInt / uUNIT));\\n\\n // This is the integer part of the logarithm as an SD59x18 number. The operation can't overflow\\n // because n is at most 255, `UNIT` is 1e18, and the sign is either 1 or -1.\\n int256 resultInt = int256(n) * uUNIT;\\n\\n // Calculate $y = x * 2^{-n}$.\\n int256 y = xInt >> n;\\n\\n // If y is the unit number, the fractional part is zero.\\n if (y == uUNIT) {\\n return wrap(resultInt * sign);\\n }\\n\\n // Calculate the fractional part via the iterative approximation.\\n // The `delta >>= 1` part is equivalent to `delta /= 2`, but shifting bits is more gas efficient.\\n int256 DOUBLE_UNIT = 2e18;\\n for (int256 delta = uHALF_UNIT; delta > 0; delta >>= 1) {\\n y = (y * y) / uUNIT;\\n\\n // Is y^2 >= 2e18 and so in the range [2e18, 4e18)?\\n if (y >= DOUBLE_UNIT) {\\n // Add the 2^{-m} factor to the logarithm.\\n resultInt = resultInt + delta;\\n\\n // Halve y, which corresponds to z/2 in the Wikipedia article.\\n y >>= 1;\\n }\\n }\\n resultInt *= sign;\\n result = wrap(resultInt);\\n }\\n}\\n\\n/// @notice Multiplies two SD59x18 numbers together, returning a new SD59x18 number.\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {Common.mulDiv18}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv18}.\\n/// - None of the inputs can be `MIN_SD59x18`.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The multiplicand as an SD59x18 number.\\n/// @param y The multiplier as an SD59x18 number.\\n/// @return result The product as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mul(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n if (xInt == uMIN_SD59x18 || yInt == uMIN_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Mul_InputTooSmall();\\n }\\n\\n // Get hold of the absolute values of x and y.\\n uint256 xAbs;\\n uint256 yAbs;\\n unchecked {\\n xAbs = xInt < 0 ? uint256(-xInt) : uint256(xInt);\\n yAbs = yInt < 0 ? uint256(-yInt) : uint256(yInt);\\n }\\n\\n // Compute the absolute value (x*y\\u00f7UNIT). The resulting value must fit in SD59x18.\\n uint256 resultAbs = Common.mulDiv18(xAbs, yAbs);\\n if (resultAbs > uint256(uMAX_SD59x18)) {\\n revert Errors.PRBMath_SD59x18_Mul_Overflow(x, y);\\n }\\n\\n // Check if x and y have the same sign using two's complement representation. The left-most bit represents the sign (1 for\\n // negative, 0 for positive or zero).\\n bool sameSign = (xInt ^ yInt) > -1;\\n\\n // If the inputs have the same sign, the result should be positive. Otherwise, it should be negative.\\n unchecked {\\n result = wrap(sameSign ? int256(resultAbs) : -int256(resultAbs));\\n }\\n}\\n\\n/// @notice Raises x to the power of y using the following formula:\\n///\\n/// $$\\n/// x^y = 2^{log_2{x} * y}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {exp2}, {log2}, and {mul}.\\n/// - Returns `UNIT` for 0^0.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {exp2}, {log2}, and {mul}.\\n///\\n/// @param x The base as an SD59x18 number.\\n/// @param y Exponent to raise x to, as an SD59x18 number\\n/// @return result x raised to power y, as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction pow(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n\\n // If both x and y are zero, the result is `UNIT`. If just x is zero, the result is always zero.\\n if (xInt == 0) {\\n return yInt == 0 ? UNIT : ZERO;\\n }\\n // If x is `UNIT`, the result is always `UNIT`.\\n else if (xInt == uUNIT) {\\n return UNIT;\\n }\\n\\n // If y is zero, the result is always `UNIT`.\\n if (yInt == 0) {\\n return UNIT;\\n }\\n // If y is `UNIT`, the result is always x.\\n else if (yInt == uUNIT) {\\n return x;\\n }\\n\\n // Calculate the result using the formula.\\n result = exp2(mul(log2(x), y));\\n}\\n\\n/// @notice Raises x (an SD59x18 number) to the power y (an unsigned basic integer) using the well-known\\n/// algorithm \\\"exponentiation by squaring\\\".\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Exponentiation_by_squaring.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv18}.\\n/// - Returns `UNIT` for 0^0.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {abs} and {Common.mulDiv18}.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The base as an SD59x18 number.\\n/// @param y The exponent as a uint256.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction powu(SD59x18 x, uint256 y) pure returns (SD59x18 result) {\\n uint256 xAbs = uint256(abs(x).unwrap());\\n\\n // Calculate the first iteration of the loop in advance.\\n uint256 resultAbs = y & 1 > 0 ? xAbs : uint256(uUNIT);\\n\\n // Equivalent to `for(y /= 2; y > 0; y /= 2)`.\\n uint256 yAux = y;\\n for (yAux >>= 1; yAux > 0; yAux >>= 1) {\\n xAbs = Common.mulDiv18(xAbs, xAbs);\\n\\n // Equivalent to `y % 2 == 1`.\\n if (yAux & 1 > 0) {\\n resultAbs = Common.mulDiv18(resultAbs, xAbs);\\n }\\n }\\n\\n // The result must fit in SD59x18.\\n if (resultAbs > uint256(uMAX_SD59x18)) {\\n revert Errors.PRBMath_SD59x18_Powu_Overflow(x, y);\\n }\\n\\n unchecked {\\n // Is the base negative and the exponent odd? If yes, the result should be negative.\\n int256 resultInt = int256(resultAbs);\\n bool isNegative = x.unwrap() < 0 && y & 1 == 1;\\n if (isNegative) {\\n resultInt = -resultInt;\\n }\\n result = wrap(resultInt);\\n }\\n}\\n\\n/// @notice Calculates the square root of x using the Babylonian method.\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\\n///\\n/// Notes:\\n/// - Only the positive root is returned.\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x cannot be negative, since complex numbers are not supported.\\n/// - x must be less than `MAX_SD59x18 / UNIT`.\\n///\\n/// @param x The SD59x18 number for which to calculate the square root.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction sqrt(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < 0) {\\n revert Errors.PRBMath_SD59x18_Sqrt_NegativeInput(x);\\n }\\n if (xInt > uMAX_SD59x18 / uUNIT) {\\n revert Errors.PRBMath_SD59x18_Sqrt_Overflow(x);\\n }\\n\\n unchecked {\\n // Multiply x by `UNIT` to account for the factor of `UNIT` picked up when multiplying two SD59x18 numbers.\\n // In this case, the two numbers are both the square root.\\n uint256 resultUint = Common.sqrt(uint256(xInt * uUNIT));\\n result = wrap(int256(resultUint));\\n }\\n}\\n\",\"keccak256\":\"0xa074831139fc89ca0e5a36086b30eb50896bb6770cd5823461b1f2769017d2f0\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\nimport \\\"./Helpers.sol\\\" as Helpers;\\nimport \\\"./Math.sol\\\" as Math;\\n\\n/// @notice The signed 59.18-decimal fixed-point number representation, which can have up to 59 digits and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\\n/// type int256.\\ntype SD59x18 is int256;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoInt256,\\n Casting.intoSD1x18,\\n Casting.intoUD2x18,\\n Casting.intoUD60x18,\\n Casting.intoUint256,\\n Casting.intoUint128,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for SD59x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n MATHEMATICAL FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Math.abs,\\n Math.avg,\\n Math.ceil,\\n Math.div,\\n Math.exp,\\n Math.exp2,\\n Math.floor,\\n Math.frac,\\n Math.gm,\\n Math.inv,\\n Math.log10,\\n Math.log2,\\n Math.ln,\\n Math.mul,\\n Math.pow,\\n Math.powu,\\n Math.sqrt\\n} for SD59x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n HELPER FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Helpers.add,\\n Helpers.and,\\n Helpers.eq,\\n Helpers.gt,\\n Helpers.gte,\\n Helpers.isZero,\\n Helpers.lshift,\\n Helpers.lt,\\n Helpers.lte,\\n Helpers.mod,\\n Helpers.neq,\\n Helpers.not,\\n Helpers.or,\\n Helpers.rshift,\\n Helpers.sub,\\n Helpers.uncheckedAdd,\\n Helpers.uncheckedSub,\\n Helpers.uncheckedUnary,\\n Helpers.xor\\n} for SD59x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n OPERATORS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes it possible to use these operators on the SD59x18 type.\\nusing {\\n Helpers.add as +,\\n Helpers.and2 as &,\\n Math.div as /,\\n Helpers.eq as ==,\\n Helpers.gt as >,\\n Helpers.gte as >=,\\n Helpers.lt as <,\\n Helpers.lte as <=,\\n Helpers.mod as %,\\n Math.mul as *,\\n Helpers.neq as !=,\\n Helpers.not as ~,\\n Helpers.or as |,\\n Helpers.sub as -,\\n Helpers.unary as -,\\n Helpers.xor as ^\\n} for SD59x18 global;\\n\",\"keccak256\":\"0xe03112d145dcd5863aff24e5f381debaae29d446acd5666f3d640e3d9af738d7\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as Errors;\\nimport { uMAX_SD1x18 } from \\\"../sd1x18/Constants.sol\\\";\\nimport { SD1x18 } from \\\"../sd1x18/ValueType.sol\\\";\\nimport { SD59x18 } from \\\"../sd59x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"../ud60x18/ValueType.sol\\\";\\nimport { UD2x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts a UD2x18 number into SD1x18.\\n/// - x must be less than or equal to `uMAX_SD1x18`.\\nfunction intoSD1x18(UD2x18 x) pure returns (SD1x18 result) {\\n uint64 xUint = UD2x18.unwrap(x);\\n if (xUint > uint64(uMAX_SD1x18)) {\\n revert Errors.PRBMath_UD2x18_IntoSD1x18_Overflow(x);\\n }\\n result = SD1x18.wrap(int64(xUint));\\n}\\n\\n/// @notice Casts a UD2x18 number into SD59x18.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of SD59x18.\\nfunction intoSD59x18(UD2x18 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(int256(uint256(UD2x18.unwrap(x))));\\n}\\n\\n/// @notice Casts a UD2x18 number into UD60x18.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of UD60x18.\\nfunction intoUD60x18(UD2x18 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(UD2x18.unwrap(x));\\n}\\n\\n/// @notice Casts a UD2x18 number into uint128.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of uint128.\\nfunction intoUint128(UD2x18 x) pure returns (uint128 result) {\\n result = uint128(UD2x18.unwrap(x));\\n}\\n\\n/// @notice Casts a UD2x18 number into uint256.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of uint256.\\nfunction intoUint256(UD2x18 x) pure returns (uint256 result) {\\n result = uint256(UD2x18.unwrap(x));\\n}\\n\\n/// @notice Casts a UD2x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(UD2x18 x) pure returns (uint40 result) {\\n uint64 xUint = UD2x18.unwrap(x);\\n if (xUint > uint64(Common.MAX_UINT40)) {\\n revert Errors.PRBMath_UD2x18_IntoUint40_Overflow(x);\\n }\\n result = uint40(xUint);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction ud2x18(uint64 x) pure returns (UD2x18 result) {\\n result = UD2x18.wrap(x);\\n}\\n\\n/// @notice Unwrap a UD2x18 number into uint64.\\nfunction unwrap(UD2x18 x) pure returns (uint64 result) {\\n result = UD2x18.unwrap(x);\\n}\\n\\n/// @notice Wraps a uint64 number into UD2x18.\\nfunction wrap(uint64 x) pure returns (UD2x18 result) {\\n result = UD2x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x9b1a35d432ef951a415fae8098b3c609a99b630a3d5464b3c8e1efa8893eea07\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD2x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @dev Euler's number as a UD2x18 number.\\nUD2x18 constant E = UD2x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum value a UD2x18 number can have.\\nuint64 constant uMAX_UD2x18 = 18_446744073709551615;\\nUD2x18 constant MAX_UD2x18 = UD2x18.wrap(uMAX_UD2x18);\\n\\n/// @dev PI as a UD2x18 number.\\nUD2x18 constant PI = UD2x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of UD2x18.\\nUD2x18 constant UNIT = UD2x18.wrap(1e18);\\nuint64 constant uUNIT = 1e18;\\n\",\"keccak256\":\"0x29b0e050c865899e1fb9022b460a7829cdee248c44c4299f068ba80695eec3fc\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD2x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when trying to cast a UD2x18 number that doesn't fit in SD1x18.\\nerror PRBMath_UD2x18_IntoSD1x18_Overflow(UD2x18 x);\\n\\n/// @notice Thrown when trying to cast a UD2x18 number that doesn't fit in uint40.\\nerror PRBMath_UD2x18_IntoUint40_Overflow(UD2x18 x);\\n\",\"keccak256\":\"0xdf1e22f0b4c8032bcc8b7f63fe3984e1387f3dc7b2e9ab381822249f75376d33\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\n\\n/// @notice The unsigned 2.18-decimal fixed-point number representation, which can have up to 2 digits and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\\n/// type uint64. This is useful when end users want to use uint64 to save gas, e.g. with tight variable packing in contract\\n/// storage.\\ntype UD2x18 is uint64;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoSD1x18,\\n Casting.intoSD59x18,\\n Casting.intoUD60x18,\\n Casting.intoUint256,\\n Casting.intoUint128,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for UD2x18 global;\\n\",\"keccak256\":\"0x2802edc9869db116a0b5c490cc5f8554742f747183fa30ac5e9c80bb967e61a1\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Errors.sol\\\" as CastingErrors;\\nimport { MAX_UINT128, MAX_UINT40 } from \\\"../Common.sol\\\";\\nimport { uMAX_SD1x18 } from \\\"../sd1x18/Constants.sol\\\";\\nimport { SD1x18 } from \\\"../sd1x18/ValueType.sol\\\";\\nimport { uMAX_SD59x18 } from \\\"../sd59x18/Constants.sol\\\";\\nimport { SD59x18 } from \\\"../sd59x18/ValueType.sol\\\";\\nimport { uMAX_UD2x18 } from \\\"../ud2x18/Constants.sol\\\";\\nimport { UD2x18 } from \\\"../ud2x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts a UD60x18 number into SD1x18.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `uMAX_SD1x18`.\\nfunction intoSD1x18(UD60x18 x) pure returns (SD1x18 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > uint256(int256(uMAX_SD1x18))) {\\n revert CastingErrors.PRBMath_UD60x18_IntoSD1x18_Overflow(x);\\n }\\n result = SD1x18.wrap(int64(uint64(xUint)));\\n}\\n\\n/// @notice Casts a UD60x18 number into UD2x18.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `uMAX_UD2x18`.\\nfunction intoUD2x18(UD60x18 x) pure returns (UD2x18 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > uMAX_UD2x18) {\\n revert CastingErrors.PRBMath_UD60x18_IntoUD2x18_Overflow(x);\\n }\\n result = UD2x18.wrap(uint64(xUint));\\n}\\n\\n/// @notice Casts a UD60x18 number into SD59x18.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `uMAX_SD59x18`.\\nfunction intoSD59x18(UD60x18 x) pure returns (SD59x18 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > uint256(uMAX_SD59x18)) {\\n revert CastingErrors.PRBMath_UD60x18_IntoSD59x18_Overflow(x);\\n }\\n result = SD59x18.wrap(int256(xUint));\\n}\\n\\n/// @notice Casts a UD60x18 number into uint128.\\n/// @dev This is basically an alias for {unwrap}.\\nfunction intoUint256(UD60x18 x) pure returns (uint256 result) {\\n result = UD60x18.unwrap(x);\\n}\\n\\n/// @notice Casts a UD60x18 number into uint128.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UINT128`.\\nfunction intoUint128(UD60x18 x) pure returns (uint128 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > MAX_UINT128) {\\n revert CastingErrors.PRBMath_UD60x18_IntoUint128_Overflow(x);\\n }\\n result = uint128(xUint);\\n}\\n\\n/// @notice Casts a UD60x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(UD60x18 x) pure returns (uint40 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > MAX_UINT40) {\\n revert CastingErrors.PRBMath_UD60x18_IntoUint40_Overflow(x);\\n }\\n result = uint40(xUint);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction ud(uint256 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(x);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction ud60x18(uint256 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(x);\\n}\\n\\n/// @notice Unwraps a UD60x18 number into uint256.\\nfunction unwrap(UD60x18 x) pure returns (uint256 result) {\\n result = UD60x18.unwrap(x);\\n}\\n\\n/// @notice Wraps a uint256 number into the UD60x18 value type.\\nfunction wrap(uint256 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x5bb532da36921cbdac64d1f16de5d366ef1f664502e3b7c07d0ad06917551f85\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n// NOTICE: the \\\"u\\\" prefix stands for \\\"unwrapped\\\".\\n\\n/// @dev Euler's number as a UD60x18 number.\\nUD60x18 constant E = UD60x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum input permitted in {exp}.\\nuint256 constant uEXP_MAX_INPUT = 133_084258667509499440;\\nUD60x18 constant EXP_MAX_INPUT = UD60x18.wrap(uEXP_MAX_INPUT);\\n\\n/// @dev The maximum input permitted in {exp2}.\\nuint256 constant uEXP2_MAX_INPUT = 192e18 - 1;\\nUD60x18 constant EXP2_MAX_INPUT = UD60x18.wrap(uEXP2_MAX_INPUT);\\n\\n/// @dev Half the UNIT number.\\nuint256 constant uHALF_UNIT = 0.5e18;\\nUD60x18 constant HALF_UNIT = UD60x18.wrap(uHALF_UNIT);\\n\\n/// @dev $log_2(10)$ as a UD60x18 number.\\nuint256 constant uLOG2_10 = 3_321928094887362347;\\nUD60x18 constant LOG2_10 = UD60x18.wrap(uLOG2_10);\\n\\n/// @dev $log_2(e)$ as a UD60x18 number.\\nuint256 constant uLOG2_E = 1_442695040888963407;\\nUD60x18 constant LOG2_E = UD60x18.wrap(uLOG2_E);\\n\\n/// @dev The maximum value a UD60x18 number can have.\\nuint256 constant uMAX_UD60x18 = 115792089237316195423570985008687907853269984665640564039457_584007913129639935;\\nUD60x18 constant MAX_UD60x18 = UD60x18.wrap(uMAX_UD60x18);\\n\\n/// @dev The maximum whole value a UD60x18 number can have.\\nuint256 constant uMAX_WHOLE_UD60x18 = 115792089237316195423570985008687907853269984665640564039457_000000000000000000;\\nUD60x18 constant MAX_WHOLE_UD60x18 = UD60x18.wrap(uMAX_WHOLE_UD60x18);\\n\\n/// @dev PI as a UD60x18 number.\\nUD60x18 constant PI = UD60x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of UD60x18.\\nuint256 constant uUNIT = 1e18;\\nUD60x18 constant UNIT = UD60x18.wrap(uUNIT);\\n\\n/// @dev The unit number squared.\\nuint256 constant uUNIT_SQUARED = 1e36;\\nUD60x18 constant UNIT_SQUARED = UD60x18.wrap(uUNIT_SQUARED);\\n\\n/// @dev Zero as a UD60x18 number.\\nUD60x18 constant ZERO = UD60x18.wrap(0);\\n\",\"keccak256\":\"0x2b80d26153d3fdcfb3a9ca772d9309d31ed1275f5b8b54c3ffb54d3652b37d90\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Conversions.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { uMAX_UD60x18, uUNIT } from \\\"./Constants.sol\\\";\\nimport { PRBMath_UD60x18_Convert_Overflow } from \\\"./Errors.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Converts a UD60x18 number to a simple integer by dividing it by `UNIT`.\\n/// @dev The result is rounded toward zero.\\n/// @param x The UD60x18 number to convert.\\n/// @return result The same number in basic integer form.\\nfunction convert(UD60x18 x) pure returns (uint256 result) {\\n result = UD60x18.unwrap(x) / uUNIT;\\n}\\n\\n/// @notice Converts a simple integer to UD60x18 by multiplying it by `UNIT`.\\n///\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UD60x18 / UNIT`.\\n///\\n/// @param x The basic integer to convert.\\n/// @param result The same number converted to UD60x18.\\nfunction convert(uint256 x) pure returns (UD60x18 result) {\\n if (x > uMAX_UD60x18 / uUNIT) {\\n revert PRBMath_UD60x18_Convert_Overflow(x);\\n }\\n unchecked {\\n result = UD60x18.wrap(x * uUNIT);\\n }\\n}\\n\",\"keccak256\":\"0xaf7fc2523413822de3b66ba339fe2884fb3b8c6f6cf38ec90a2c3e3aae71df6b\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when ceiling a number overflows UD60x18.\\nerror PRBMath_UD60x18_Ceil_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when converting a basic integer to the fixed-point format overflows UD60x18.\\nerror PRBMath_UD60x18_Convert_Overflow(uint256 x);\\n\\n/// @notice Thrown when taking the natural exponent of a base greater than 133_084258667509499441.\\nerror PRBMath_UD60x18_Exp_InputTooBig(UD60x18 x);\\n\\n/// @notice Thrown when taking the binary exponent of a base greater than 192e18.\\nerror PRBMath_UD60x18_Exp2_InputTooBig(UD60x18 x);\\n\\n/// @notice Thrown when taking the geometric mean of two numbers and multiplying them overflows UD60x18.\\nerror PRBMath_UD60x18_Gm_Overflow(UD60x18 x, UD60x18 y);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\\nerror PRBMath_UD60x18_IntoSD1x18_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD59x18.\\nerror PRBMath_UD60x18_IntoSD59x18_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\\nerror PRBMath_UD60x18_IntoUD2x18_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\\nerror PRBMath_UD60x18_IntoUint128_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\\nerror PRBMath_UD60x18_IntoUint40_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when taking the logarithm of a number less than 1.\\nerror PRBMath_UD60x18_Log_InputTooSmall(UD60x18 x);\\n\\n/// @notice Thrown when calculating the square root overflows UD60x18.\\nerror PRBMath_UD60x18_Sqrt_Overflow(UD60x18 x);\\n\",\"keccak256\":\"0xa8c60d4066248df22c49c882873efbc017344107edabc48c52209abbc39cb1e3\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Helpers.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { wrap } from \\\"./Casting.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Implements the checked addition operation (+) in the UD60x18 type.\\nfunction add(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() + y.unwrap());\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the UD60x18 type.\\nfunction and(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() & bits);\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the UD60x18 type.\\nfunction and2(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() & y.unwrap());\\n}\\n\\n/// @notice Implements the equal operation (==) in the UD60x18 type.\\nfunction eq(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() == y.unwrap();\\n}\\n\\n/// @notice Implements the greater than operation (>) in the UD60x18 type.\\nfunction gt(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() > y.unwrap();\\n}\\n\\n/// @notice Implements the greater than or equal to operation (>=) in the UD60x18 type.\\nfunction gte(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() >= y.unwrap();\\n}\\n\\n/// @notice Implements a zero comparison check function in the UD60x18 type.\\nfunction isZero(UD60x18 x) pure returns (bool result) {\\n // This wouldn't work if x could be negative.\\n result = x.unwrap() == 0;\\n}\\n\\n/// @notice Implements the left shift operation (<<) in the UD60x18 type.\\nfunction lshift(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() << bits);\\n}\\n\\n/// @notice Implements the lower than operation (<) in the UD60x18 type.\\nfunction lt(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() < y.unwrap();\\n}\\n\\n/// @notice Implements the lower than or equal to operation (<=) in the UD60x18 type.\\nfunction lte(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() <= y.unwrap();\\n}\\n\\n/// @notice Implements the checked modulo operation (%) in the UD60x18 type.\\nfunction mod(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() % y.unwrap());\\n}\\n\\n/// @notice Implements the not equal operation (!=) in the UD60x18 type.\\nfunction neq(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() != y.unwrap();\\n}\\n\\n/// @notice Implements the NOT (~) bitwise operation in the UD60x18 type.\\nfunction not(UD60x18 x) pure returns (UD60x18 result) {\\n result = wrap(~x.unwrap());\\n}\\n\\n/// @notice Implements the OR (|) bitwise operation in the UD60x18 type.\\nfunction or(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() | y.unwrap());\\n}\\n\\n/// @notice Implements the right shift operation (>>) in the UD60x18 type.\\nfunction rshift(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() >> bits);\\n}\\n\\n/// @notice Implements the checked subtraction operation (-) in the UD60x18 type.\\nfunction sub(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() - y.unwrap());\\n}\\n\\n/// @notice Implements the unchecked addition operation (+) in the UD60x18 type.\\nfunction uncheckedAdd(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() + y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the unchecked subtraction operation (-) in the UD60x18 type.\\nfunction uncheckedSub(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() - y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the XOR (^) bitwise operation in the UD60x18 type.\\nfunction xor(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() ^ y.unwrap());\\n}\\n\",\"keccak256\":\"0xf5faff881391d2c060029499a666cc5f0bea90a213150bb476fae8f02a5df268\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as Errors;\\nimport { wrap } from \\\"./Casting.sol\\\";\\nimport {\\n uEXP_MAX_INPUT,\\n uEXP2_MAX_INPUT,\\n uHALF_UNIT,\\n uLOG2_10,\\n uLOG2_E,\\n uMAX_UD60x18,\\n uMAX_WHOLE_UD60x18,\\n UNIT,\\n uUNIT,\\n uUNIT_SQUARED,\\n ZERO\\n} from \\\"./Constants.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n MATHEMATICAL FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @notice Calculates the arithmetic average of x and y using the following formula:\\n///\\n/// $$\\n/// avg(x, y) = (x & y) + ((xUint ^ yUint) / 2)\\n/// $$\\n///\\n/// In English, this is what this formula does:\\n///\\n/// 1. AND x and y.\\n/// 2. Calculate half of XOR x and y.\\n/// 3. Add the two results together.\\n///\\n/// This technique is known as SWAR, which stands for \\\"SIMD within a register\\\". You can read more about it here:\\n/// https://devblogs.microsoft.com/oldnewthing/20220207-00/?p=106223\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// @param x The first operand as a UD60x18 number.\\n/// @param y The second operand as a UD60x18 number.\\n/// @return result The arithmetic average as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction avg(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n uint256 yUint = y.unwrap();\\n unchecked {\\n result = wrap((xUint & yUint) + ((xUint ^ yUint) >> 1));\\n }\\n}\\n\\n/// @notice Yields the smallest whole number greater than or equal to x.\\n///\\n/// @dev This is optimized for fractional value inputs, because for every whole value there are (1e18 - 1) fractional\\n/// counterparts. See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n///\\n/// Requirements:\\n/// - x must be less than or equal to `MAX_WHOLE_UD60x18`.\\n///\\n/// @param x The UD60x18 number to ceil.\\n/// @param result The smallest whole number greater than or equal to x, as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ceil(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n if (xUint > uMAX_WHOLE_UD60x18) {\\n revert Errors.PRBMath_UD60x18_Ceil_Overflow(x);\\n }\\n\\n assembly (\\\"memory-safe\\\") {\\n // Equivalent to `x % UNIT`.\\n let remainder := mod(x, uUNIT)\\n\\n // Equivalent to `UNIT - remainder`.\\n let delta := sub(uUNIT, remainder)\\n\\n // Equivalent to `x + remainder > 0 ? delta : 0`.\\n result := add(x, mul(delta, gt(remainder, 0)))\\n }\\n}\\n\\n/// @notice Divides two UD60x18 numbers, returning a new UD60x18 number.\\n///\\n/// @dev Uses {Common.mulDiv} to enable overflow-safe multiplication and division.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv}.\\n///\\n/// @param x The numerator as a UD60x18 number.\\n/// @param y The denominator as a UD60x18 number.\\n/// @param result The quotient as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction div(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(Common.mulDiv(x.unwrap(), uUNIT, y.unwrap()));\\n}\\n\\n/// @notice Calculates the natural exponent of x using the following formula:\\n///\\n/// $$\\n/// e^x = 2^{x * log_2{e}}\\n/// $$\\n///\\n/// @dev Requirements:\\n/// - x must be less than 133_084258667509499441.\\n///\\n/// @param x The exponent as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n // This check prevents values greater than 192e18 from being passed to {exp2}.\\n if (xUint > uEXP_MAX_INPUT) {\\n revert Errors.PRBMath_UD60x18_Exp_InputTooBig(x);\\n }\\n\\n unchecked {\\n // Inline the fixed-point multiplication to save gas.\\n uint256 doubleUnitProduct = xUint * uLOG2_E;\\n result = exp2(wrap(doubleUnitProduct / uUNIT));\\n }\\n}\\n\\n/// @notice Calculates the binary exponent of x using the binary fraction method.\\n///\\n/// @dev See https://ethereum.stackexchange.com/q/79903/24693\\n///\\n/// Requirements:\\n/// - x must be less than 192e18.\\n/// - The result must fit in UD60x18.\\n///\\n/// @param x The exponent as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp2(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n // Numbers greater than or equal to 192e18 don't fit in the 192.64-bit format.\\n if (xUint > uEXP2_MAX_INPUT) {\\n revert Errors.PRBMath_UD60x18_Exp2_InputTooBig(x);\\n }\\n\\n // Convert x to the 192.64-bit fixed-point format.\\n uint256 x_192x64 = (xUint << 64) / uUNIT;\\n\\n // Pass x to the {Common.exp2} function, which uses the 192.64-bit fixed-point number representation.\\n result = wrap(Common.exp2(x_192x64));\\n}\\n\\n/// @notice Yields the greatest whole number less than or equal to x.\\n/// @dev Optimized for fractional value inputs, because every whole value has (1e18 - 1) fractional counterparts.\\n/// See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n/// @param x The UD60x18 number to floor.\\n/// @param result The greatest whole number less than or equal to x, as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction floor(UD60x18 x) pure returns (UD60x18 result) {\\n assembly (\\\"memory-safe\\\") {\\n // Equivalent to `x % UNIT`.\\n let remainder := mod(x, uUNIT)\\n\\n // Equivalent to `x - remainder > 0 ? remainder : 0)`.\\n result := sub(x, mul(remainder, gt(remainder, 0)))\\n }\\n}\\n\\n/// @notice Yields the excess beyond the floor of x using the odd function definition.\\n/// @dev See https://en.wikipedia.org/wiki/Fractional_part.\\n/// @param x The UD60x18 number to get the fractional part of.\\n/// @param result The fractional part of x as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction frac(UD60x18 x) pure returns (UD60x18 result) {\\n assembly (\\\"memory-safe\\\") {\\n result := mod(x, uUNIT)\\n }\\n}\\n\\n/// @notice Calculates the geometric mean of x and y, i.e. $\\\\sqrt{x * y}$, rounding down.\\n///\\n/// @dev Requirements:\\n/// - x * y must fit in UD60x18.\\n///\\n/// @param x The first operand as a UD60x18 number.\\n/// @param y The second operand as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction gm(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n uint256 yUint = y.unwrap();\\n if (xUint == 0 || yUint == 0) {\\n return ZERO;\\n }\\n\\n unchecked {\\n // Checking for overflow this way is faster than letting Solidity do it.\\n uint256 xyUint = xUint * yUint;\\n if (xyUint / xUint != yUint) {\\n revert Errors.PRBMath_UD60x18_Gm_Overflow(x, y);\\n }\\n\\n // We don't need to multiply the result by `UNIT` here because the x*y product picked up a factor of `UNIT`\\n // during multiplication. See the comments in {Common.sqrt}.\\n result = wrap(Common.sqrt(xyUint));\\n }\\n}\\n\\n/// @notice Calculates the inverse of x.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x must not be zero.\\n///\\n/// @param x The UD60x18 number for which to calculate the inverse.\\n/// @return result The inverse as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction inv(UD60x18 x) pure returns (UD60x18 result) {\\n unchecked {\\n result = wrap(uUNIT_SQUARED / x.unwrap());\\n }\\n}\\n\\n/// @notice Calculates the natural logarithm of x using the following formula:\\n///\\n/// $$\\n/// ln{x} = log_2{x} / log_2{e}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n/// - The precision isn't sufficiently fine-grained to return exactly `UNIT` when the input is `E`.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The UD60x18 number for which to calculate the natural logarithm.\\n/// @return result The natural logarithm as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ln(UD60x18 x) pure returns (UD60x18 result) {\\n unchecked {\\n // Inline the fixed-point multiplication to save gas. This is overflow-safe because the maximum value that\\n // {log2} can return is ~196_205294292027477728.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_E);\\n }\\n}\\n\\n/// @notice Calculates the common logarithm of x using the following formula:\\n///\\n/// $$\\n/// log_{10}{x} = log_2{x} / log_2{10}\\n/// $$\\n///\\n/// However, if x is an exact power of ten, a hard coded value is returned.\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The UD60x18 number for which to calculate the common logarithm.\\n/// @return result The common logarithm as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log10(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n if (xUint < uUNIT) {\\n revert Errors.PRBMath_UD60x18_Log_InputTooSmall(x);\\n }\\n\\n // Note that the `mul` in this assembly block is the standard multiplication operation, not {UD60x18.mul}.\\n // prettier-ignore\\n assembly (\\\"memory-safe\\\") {\\n switch x\\n case 1 { result := mul(uUNIT, sub(0, 18)) }\\n case 10 { result := mul(uUNIT, sub(1, 18)) }\\n case 100 { result := mul(uUNIT, sub(2, 18)) }\\n case 1000 { result := mul(uUNIT, sub(3, 18)) }\\n case 10000 { result := mul(uUNIT, sub(4, 18)) }\\n case 100000 { result := mul(uUNIT, sub(5, 18)) }\\n case 1000000 { result := mul(uUNIT, sub(6, 18)) }\\n case 10000000 { result := mul(uUNIT, sub(7, 18)) }\\n case 100000000 { result := mul(uUNIT, sub(8, 18)) }\\n case 1000000000 { result := mul(uUNIT, sub(9, 18)) }\\n case 10000000000 { result := mul(uUNIT, sub(10, 18)) }\\n case 100000000000 { result := mul(uUNIT, sub(11, 18)) }\\n case 1000000000000 { result := mul(uUNIT, sub(12, 18)) }\\n case 10000000000000 { result := mul(uUNIT, sub(13, 18)) }\\n case 100000000000000 { result := mul(uUNIT, sub(14, 18)) }\\n case 1000000000000000 { result := mul(uUNIT, sub(15, 18)) }\\n case 10000000000000000 { result := mul(uUNIT, sub(16, 18)) }\\n case 100000000000000000 { result := mul(uUNIT, sub(17, 18)) }\\n case 1000000000000000000 { result := 0 }\\n case 10000000000000000000 { result := uUNIT }\\n case 100000000000000000000 { result := mul(uUNIT, 2) }\\n case 1000000000000000000000 { result := mul(uUNIT, 3) }\\n case 10000000000000000000000 { result := mul(uUNIT, 4) }\\n case 100000000000000000000000 { result := mul(uUNIT, 5) }\\n case 1000000000000000000000000 { result := mul(uUNIT, 6) }\\n case 10000000000000000000000000 { result := mul(uUNIT, 7) }\\n case 100000000000000000000000000 { result := mul(uUNIT, 8) }\\n case 1000000000000000000000000000 { result := mul(uUNIT, 9) }\\n case 10000000000000000000000000000 { result := mul(uUNIT, 10) }\\n case 100000000000000000000000000000 { result := mul(uUNIT, 11) }\\n case 1000000000000000000000000000000 { result := mul(uUNIT, 12) }\\n case 10000000000000000000000000000000 { result := mul(uUNIT, 13) }\\n case 100000000000000000000000000000000 { result := mul(uUNIT, 14) }\\n case 1000000000000000000000000000000000 { result := mul(uUNIT, 15) }\\n case 10000000000000000000000000000000000 { result := mul(uUNIT, 16) }\\n case 100000000000000000000000000000000000 { result := mul(uUNIT, 17) }\\n case 1000000000000000000000000000000000000 { result := mul(uUNIT, 18) }\\n case 10000000000000000000000000000000000000 { result := mul(uUNIT, 19) }\\n case 100000000000000000000000000000000000000 { result := mul(uUNIT, 20) }\\n case 1000000000000000000000000000000000000000 { result := mul(uUNIT, 21) }\\n case 10000000000000000000000000000000000000000 { result := mul(uUNIT, 22) }\\n case 100000000000000000000000000000000000000000 { result := mul(uUNIT, 23) }\\n case 1000000000000000000000000000000000000000000 { result := mul(uUNIT, 24) }\\n case 10000000000000000000000000000000000000000000 { result := mul(uUNIT, 25) }\\n case 100000000000000000000000000000000000000000000 { result := mul(uUNIT, 26) }\\n case 1000000000000000000000000000000000000000000000 { result := mul(uUNIT, 27) }\\n case 10000000000000000000000000000000000000000000000 { result := mul(uUNIT, 28) }\\n case 100000000000000000000000000000000000000000000000 { result := mul(uUNIT, 29) }\\n case 1000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 30) }\\n case 10000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 31) }\\n case 100000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 32) }\\n case 1000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 33) }\\n case 10000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 34) }\\n case 100000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 35) }\\n case 1000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 36) }\\n case 10000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 37) }\\n case 100000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 38) }\\n case 1000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 39) }\\n case 10000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 40) }\\n case 100000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 41) }\\n case 1000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 42) }\\n case 10000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 43) }\\n case 100000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 44) }\\n case 1000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 45) }\\n case 10000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 46) }\\n case 100000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 47) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 48) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 49) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 50) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 51) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 52) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 53) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 54) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 55) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 56) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 57) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 58) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 59) }\\n default { result := uMAX_UD60x18 }\\n }\\n\\n if (result.unwrap() == uMAX_UD60x18) {\\n unchecked {\\n // Inline the fixed-point division to save gas.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_10);\\n }\\n }\\n}\\n\\n/// @notice Calculates the binary logarithm of x using the iterative approximation algorithm:\\n///\\n/// $$\\n/// log_2{x} = n + log_2{y}, \\\\text{ where } y = x*2^{-n}, \\\\ y \\\\in [1, 2)\\n/// $$\\n///\\n/// For $0 \\\\leq x \\\\lt 1$, the input is inverted:\\n///\\n/// $$\\n/// log_2{x} = -log_2{\\\\frac{1}{x}}\\n/// $$\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Binary_logarithm#Iterative_approximation\\n///\\n/// Notes:\\n/// - Due to the lossy precision of the iterative approximation, the results are not perfectly accurate to the last decimal.\\n///\\n/// Requirements:\\n/// - x must be greater than zero.\\n///\\n/// @param x The UD60x18 number for which to calculate the binary logarithm.\\n/// @return result The binary logarithm as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log2(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n if (xUint < uUNIT) {\\n revert Errors.PRBMath_UD60x18_Log_InputTooSmall(x);\\n }\\n\\n unchecked {\\n // Calculate the integer part of the logarithm.\\n uint256 n = Common.msb(xUint / uUNIT);\\n\\n // This is the integer part of the logarithm as a UD60x18 number. The operation can't overflow because n\\n // n is at most 255 and UNIT is 1e18.\\n uint256 resultUint = n * uUNIT;\\n\\n // Calculate $y = x * 2^{-n}$.\\n uint256 y = xUint >> n;\\n\\n // If y is the unit number, the fractional part is zero.\\n if (y == uUNIT) {\\n return wrap(resultUint);\\n }\\n\\n // Calculate the fractional part via the iterative approximation.\\n // The `delta >>= 1` part is equivalent to `delta /= 2`, but shifting bits is more gas efficient.\\n uint256 DOUBLE_UNIT = 2e18;\\n for (uint256 delta = uHALF_UNIT; delta > 0; delta >>= 1) {\\n y = (y * y) / uUNIT;\\n\\n // Is y^2 >= 2e18 and so in the range [2e18, 4e18)?\\n if (y >= DOUBLE_UNIT) {\\n // Add the 2^{-m} factor to the logarithm.\\n resultUint += delta;\\n\\n // Halve y, which corresponds to z/2 in the Wikipedia article.\\n y >>= 1;\\n }\\n }\\n result = wrap(resultUint);\\n }\\n}\\n\\n/// @notice Multiplies two UD60x18 numbers together, returning a new UD60x18 number.\\n///\\n/// @dev Uses {Common.mulDiv} to enable overflow-safe multiplication and division.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv}.\\n///\\n/// @dev See the documentation in {Common.mulDiv18}.\\n/// @param x The multiplicand as a UD60x18 number.\\n/// @param y The multiplier as a UD60x18 number.\\n/// @return result The product as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mul(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(Common.mulDiv18(x.unwrap(), y.unwrap()));\\n}\\n\\n/// @notice Raises x to the power of y.\\n///\\n/// For $1 \\\\leq x \\\\leq \\\\infty$, the following standard formula is used:\\n///\\n/// $$\\n/// x^y = 2^{log_2{x} * y}\\n/// $$\\n///\\n/// For $0 \\\\leq x \\\\lt 1$, since the unsigned {log2} is undefined, an equivalent formula is used:\\n///\\n/// $$\\n/// i = \\\\frac{1}{x}\\n/// w = 2^{log_2{i} * y}\\n/// x^y = \\\\frac{1}{w}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2} and {mul}.\\n/// - Returns `UNIT` for 0^0.\\n/// - It may not perform well with very small values of x. Consider using SD59x18 as an alternative.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {exp2}, {log2}, and {mul}.\\n///\\n/// @param x The base as a UD60x18 number.\\n/// @param y The exponent as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction pow(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n uint256 yUint = y.unwrap();\\n\\n // If both x and y are zero, the result is `UNIT`. If just x is zero, the result is always zero.\\n if (xUint == 0) {\\n return yUint == 0 ? UNIT : ZERO;\\n }\\n // If x is `UNIT`, the result is always `UNIT`.\\n else if (xUint == uUNIT) {\\n return UNIT;\\n }\\n\\n // If y is zero, the result is always `UNIT`.\\n if (yUint == 0) {\\n return UNIT;\\n }\\n // If y is `UNIT`, the result is always x.\\n else if (yUint == uUNIT) {\\n return x;\\n }\\n\\n // If x is greater than `UNIT`, use the standard formula.\\n if (xUint > uUNIT) {\\n result = exp2(mul(log2(x), y));\\n }\\n // Conversely, if x is less than `UNIT`, use the equivalent formula.\\n else {\\n UD60x18 i = wrap(uUNIT_SQUARED / xUint);\\n UD60x18 w = exp2(mul(log2(i), y));\\n result = wrap(uUNIT_SQUARED / w.unwrap());\\n }\\n}\\n\\n/// @notice Raises x (a UD60x18 number) to the power y (an unsigned basic integer) using the well-known\\n/// algorithm \\\"exponentiation by squaring\\\".\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Exponentiation_by_squaring.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv18}.\\n/// - Returns `UNIT` for 0^0.\\n///\\n/// Requirements:\\n/// - The result must fit in UD60x18.\\n///\\n/// @param x The base as a UD60x18 number.\\n/// @param y The exponent as a uint256.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction powu(UD60x18 x, uint256 y) pure returns (UD60x18 result) {\\n // Calculate the first iteration of the loop in advance.\\n uint256 xUint = x.unwrap();\\n uint256 resultUint = y & 1 > 0 ? xUint : uUNIT;\\n\\n // Equivalent to `for(y /= 2; y > 0; y /= 2)`.\\n for (y >>= 1; y > 0; y >>= 1) {\\n xUint = Common.mulDiv18(xUint, xUint);\\n\\n // Equivalent to `y % 2 == 1`.\\n if (y & 1 > 0) {\\n resultUint = Common.mulDiv18(resultUint, xUint);\\n }\\n }\\n result = wrap(resultUint);\\n}\\n\\n/// @notice Calculates the square root of x using the Babylonian method.\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\\n///\\n/// Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x must be less than `MAX_UD60x18 / UNIT`.\\n///\\n/// @param x The UD60x18 number for which to calculate the square root.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction sqrt(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n unchecked {\\n if (xUint > uMAX_UD60x18 / uUNIT) {\\n revert Errors.PRBMath_UD60x18_Sqrt_Overflow(x);\\n }\\n // Multiply x by `UNIT` to account for the factor of `UNIT` picked up when multiplying two UD60x18 numbers.\\n // In this case, the two numbers are both the square root.\\n result = wrap(Common.sqrt(xUint * uUNIT));\\n }\\n}\\n\",\"keccak256\":\"0x462144667aac3f96d5f8dba7aa68fe4c5a3f61e1d7bbbc81bee21168817f9c09\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\nimport \\\"./Helpers.sol\\\" as Helpers;\\nimport \\\"./Math.sol\\\" as Math;\\n\\n/// @notice The unsigned 60.18-decimal fixed-point number representation, which can have up to 60 digits and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the Solidity type uint256.\\n/// @dev The value type is defined here so it can be imported in all other files.\\ntype UD60x18 is uint256;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoSD1x18,\\n Casting.intoUD2x18,\\n Casting.intoSD59x18,\\n Casting.intoUint128,\\n Casting.intoUint256,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for UD60x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n MATHEMATICAL FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes the functions in this library callable on the UD60x18 type.\\nusing {\\n Math.avg,\\n Math.ceil,\\n Math.div,\\n Math.exp,\\n Math.exp2,\\n Math.floor,\\n Math.frac,\\n Math.gm,\\n Math.inv,\\n Math.ln,\\n Math.log10,\\n Math.log2,\\n Math.mul,\\n Math.pow,\\n Math.powu,\\n Math.sqrt\\n} for UD60x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n HELPER FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes the functions in this library callable on the UD60x18 type.\\nusing {\\n Helpers.add,\\n Helpers.and,\\n Helpers.eq,\\n Helpers.gt,\\n Helpers.gte,\\n Helpers.isZero,\\n Helpers.lshift,\\n Helpers.lt,\\n Helpers.lte,\\n Helpers.mod,\\n Helpers.neq,\\n Helpers.not,\\n Helpers.or,\\n Helpers.rshift,\\n Helpers.sub,\\n Helpers.uncheckedAdd,\\n Helpers.uncheckedSub,\\n Helpers.xor\\n} for UD60x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n OPERATORS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes it possible to use these operators on the UD60x18 type.\\nusing {\\n Helpers.add as +,\\n Helpers.and2 as &,\\n Math.div as /,\\n Helpers.eq as ==,\\n Helpers.gt as >,\\n Helpers.gte as >=,\\n Helpers.lt as <,\\n Helpers.lte as <=,\\n Helpers.or as |,\\n Helpers.mod as %,\\n Math.mul as *,\\n Helpers.neq as !=,\\n Helpers.not as ~,\\n Helpers.sub as -,\\n Helpers.xor as ^\\n} for UD60x18 global;\\n\",\"keccak256\":\"0xdd873b5124180d9b71498b3a7fe93b1c08c368bec741f7d5f8e17f78a0b70f31\",\"license\":\"MIT\"},\"contracts/interfaces/IERC6551Registry.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\ninterface IERC6551Registry {\\n /**\\n * @dev Creates a token bound account for a non-fungible token.\\n *\\n * If account has already been created, returns the account address without calling create2.\\n *\\n * Emits ERC6551AccountCreated event.\\n *\\n * @return account The address of the token bound account\\n */\\n function createAccount(\\n address implementation,\\n bytes32 salt,\\n uint256 chainId,\\n address tokenContract,\\n uint256 tokenId\\n ) external returns (address account);\\n}\\n\",\"keccak256\":\"0x64c52de8a8e68398e61dd8b42dda8e9af8cf6abf93bb85629c322440991ea568\",\"license\":\"MIT\"},\"contracts/interfaces/hats/HatsErrors.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface HatsErrors {\\n /// @notice Emitted when `user` is attempting to perform an action on `hatId` but is not wearing one of `hatId`'s admin hats\\n /// @dev Can be equivalent to `NotHatWearer(buildHatId(hatId))`, such as when emitted by `approveLinkTopHatToTree` or `relinkTopHatToTree`\\n error NotAdmin(address user, uint256 hatId);\\n\\n /// @notice Emitted when attempting to perform an action as or for an account that is not a wearer of a given hat\\n error NotHatWearer();\\n\\n /// @notice Emitted when attempting to perform an action that requires being either an admin or wearer of a given hat\\n error NotAdminOrWearer();\\n\\n /// @notice Emitted when attempting to mint `hatId` but `hatId`'s maxSupply has been reached\\n error AllHatsWorn(uint256 hatId);\\n\\n /// @notice Emitted when attempting to create a hat with a level 14 hat as its admin\\n error MaxLevelsReached();\\n\\n /// @notice Emitted when an attempted hat id has empty intermediate level(s)\\n error InvalidHatId();\\n\\n /// @notice Emitted when attempting to mint `hatId` to a `wearer` who is already wearing the hat\\n error AlreadyWearingHat(address wearer, uint256 hatId);\\n\\n /// @notice Emitted when attempting to mint a non-existant hat\\n error HatDoesNotExist(uint256 hatId);\\n\\n /// @notice Emmitted when attempting to mint or transfer a hat that is not active\\n error HatNotActive();\\n\\n /// @notice Emitted when attempting to mint or transfer a hat to an ineligible wearer\\n error NotEligible();\\n\\n /// @notice Emitted when attempting to check or set a hat's status from an account that is not that hat's toggle module\\n error NotHatsToggle();\\n\\n /// @notice Emitted when attempting to check or set a hat wearer's status from an account that is not that hat's eligibility module\\n error NotHatsEligibility();\\n\\n /// @notice Emitted when array arguments to a batch function have mismatching lengths\\n error BatchArrayLengthMismatch();\\n\\n /// @notice Emitted when attempting to mutate or transfer an immutable hat\\n error Immutable();\\n\\n /// @notice Emitted when attempting to change a hat's maxSupply to a value lower than its current supply\\n error NewMaxSupplyTooLow();\\n\\n /// @notice Emitted when attempting to link a tophat to a new admin for which the tophat serves as an admin\\n error CircularLinkage();\\n\\n /// @notice Emitted when attempting to link or relink a tophat to a separate tree\\n error CrossTreeLinkage();\\n\\n /// @notice Emitted when attempting to link a tophat without a request\\n error LinkageNotRequested();\\n\\n /// @notice Emitted when attempting to unlink a tophat that does not have a wearer\\n /// @dev This ensures that unlinking never results in a bricked tophat\\n error InvalidUnlink();\\n\\n /// @notice Emmited when attempting to change a hat's eligibility or toggle module to the zero address\\n error ZeroAddress();\\n\\n /// @notice Emmitted when attempting to change a hat's details or imageURI to a string with over 7000 bytes (~characters)\\n /// @dev This protects against a DOS attack where an admin iteratively extend's a hat's details or imageURI\\n /// to be so long that reading it exceeds the block gas limit, breaking `uri()` and `viewHat()`\\n error StringTooLong();\\n}\\n\",\"keccak256\":\"0x81b0056b7bed86eabc07c0e4a9655c586ddb8e6c128320593669b76efd5a08de\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/HatsEvents.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface HatsEvents {\\n /// @notice Emitted when a new hat is created\\n /// @param id The id for the new hat\\n /// @param details A description of the Hat\\n /// @param maxSupply The total instances of the Hat that can be worn at once\\n /// @param eligibility The address that can report on the Hat wearer's status\\n /// @param toggle The address that can deactivate the Hat\\n /// @param mutable_ Whether the hat's properties are changeable after creation\\n /// @param imageURI The image uri for this hat and the fallback for its\\n event HatCreated(\\n uint256 id,\\n string details,\\n uint32 maxSupply,\\n address eligibility,\\n address toggle,\\n bool mutable_,\\n string imageURI\\n );\\n\\n /// @notice Emitted when a hat wearer's standing is updated\\n /// @dev Eligibility is excluded since the source of truth for eligibility is the eligibility module and may change without a transaction\\n /// @param hatId The id of the wearer's hat\\n /// @param wearer The wearer's address\\n /// @param wearerStanding Whether the wearer is in good standing for the hat\\n event WearerStandingChanged(\\n uint256 hatId,\\n address wearer,\\n bool wearerStanding\\n );\\n\\n /// @notice Emitted when a hat's status is updated\\n /// @param hatId The id of the hat\\n /// @param newStatus Whether the hat is active\\n event HatStatusChanged(uint256 hatId, bool newStatus);\\n\\n /// @notice Emitted when a hat's details are updated\\n /// @param hatId The id of the hat\\n /// @param newDetails The updated details\\n event HatDetailsChanged(uint256 hatId, string newDetails);\\n\\n /// @notice Emitted when a hat's eligibility module is updated\\n /// @param hatId The id of the hat\\n /// @param newEligibility The updated eligibiliy module\\n event HatEligibilityChanged(uint256 hatId, address newEligibility);\\n\\n /// @notice Emitted when a hat's toggle module is updated\\n /// @param hatId The id of the hat\\n /// @param newToggle The updated toggle module\\n event HatToggleChanged(uint256 hatId, address newToggle);\\n\\n /// @notice Emitted when a hat's mutability is updated\\n /// @param hatId The id of the hat\\n event HatMutabilityChanged(uint256 hatId);\\n\\n /// @notice Emitted when a hat's maximum supply is updated\\n /// @param hatId The id of the hat\\n /// @param newMaxSupply The updated max supply\\n event HatMaxSupplyChanged(uint256 hatId, uint32 newMaxSupply);\\n\\n /// @notice Emitted when a hat's image URI is updated\\n /// @param hatId The id of the hat\\n /// @param newImageURI The updated image URI\\n event HatImageURIChanged(uint256 hatId, string newImageURI);\\n\\n /// @notice Emitted when a tophat linkage is requested by its admin\\n /// @param domain The domain of the tree tophat to link\\n /// @param newAdmin The tophat's would-be admin in the parent tree\\n event TopHatLinkRequested(uint32 domain, uint256 newAdmin);\\n\\n /// @notice Emitted when a tophat is linked to a another tree\\n /// @param domain The domain of the newly-linked tophat\\n /// @param newAdmin The tophat's new admin in the parent tree\\n event TopHatLinked(uint32 domain, uint256 newAdmin);\\n}\\n\",\"keccak256\":\"0x53413397d15e1636c3cd7bd667656b79bc2886785403b824bcd4ed122667f2c6\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/IHats.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\nimport \\\"./IHatsIdUtilities.sol\\\";\\nimport \\\"./HatsErrors.sol\\\";\\nimport \\\"./HatsEvents.sol\\\";\\n\\ninterface IHats is IHatsIdUtilities, HatsErrors, HatsEvents {\\n function mintTopHat(\\n address _target,\\n string memory _details,\\n string memory _imageURI\\n ) external returns (uint256 topHatId);\\n\\n function createHat(\\n uint256 _admin,\\n string calldata _details,\\n uint32 _maxSupply,\\n address _eligibility,\\n address _toggle,\\n bool _mutable,\\n string calldata _imageURI\\n ) external returns (uint256 newHatId);\\n\\n function batchCreateHats(\\n uint256[] calldata _admins,\\n string[] calldata _details,\\n uint32[] calldata _maxSupplies,\\n address[] memory _eligibilityModules,\\n address[] memory _toggleModules,\\n bool[] calldata _mutables,\\n string[] calldata _imageURIs\\n ) external returns (bool success);\\n\\n function getNextId(uint256 _admin) external view returns (uint256 nextId);\\n\\n function mintHat(\\n uint256 _hatId,\\n address _wearer\\n ) external returns (bool success);\\n\\n function batchMintHats(\\n uint256[] calldata _hatIds,\\n address[] calldata _wearers\\n ) external returns (bool success);\\n\\n function setHatStatus(\\n uint256 _hatId,\\n bool _newStatus\\n ) external returns (bool toggled);\\n\\n function checkHatStatus(uint256 _hatId) external returns (bool toggled);\\n\\n function setHatWearerStatus(\\n uint256 _hatId,\\n address _wearer,\\n bool _eligible,\\n bool _standing\\n ) external returns (bool updated);\\n\\n function checkHatWearerStatus(\\n uint256 _hatId,\\n address _wearer\\n ) external returns (bool updated);\\n\\n function renounceHat(uint256 _hatId) external;\\n\\n function transferHat(uint256 _hatId, address _from, address _to) external;\\n\\n /*//////////////////////////////////////////////////////////////\\n HATS ADMIN FUNCTIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n function makeHatImmutable(uint256 _hatId) external;\\n\\n function changeHatDetails(\\n uint256 _hatId,\\n string memory _newDetails\\n ) external;\\n\\n function changeHatEligibility(\\n uint256 _hatId,\\n address _newEligibility\\n ) external;\\n\\n function changeHatToggle(uint256 _hatId, address _newToggle) external;\\n\\n function changeHatImageURI(\\n uint256 _hatId,\\n string memory _newImageURI\\n ) external;\\n\\n function changeHatMaxSupply(uint256 _hatId, uint32 _newMaxSupply) external;\\n\\n function requestLinkTopHatToTree(\\n uint32 _topHatId,\\n uint256 _newAdminHat\\n ) external;\\n\\n function approveLinkTopHatToTree(\\n uint32 _topHatId,\\n uint256 _newAdminHat,\\n address _eligibility,\\n address _toggle,\\n string calldata _details,\\n string calldata _imageURI\\n ) external;\\n\\n function unlinkTopHatFromTree(uint32 _topHatId, address _wearer) external;\\n\\n function relinkTopHatWithinTree(\\n uint32 _topHatDomain,\\n uint256 _newAdminHat,\\n address _eligibility,\\n address _toggle,\\n string calldata _details,\\n string calldata _imageURI\\n ) external;\\n\\n /*//////////////////////////////////////////////////////////////\\n VIEW FUNCTIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n function viewHat(\\n uint256 _hatId\\n )\\n external\\n view\\n returns (\\n string memory details,\\n uint32 maxSupply,\\n uint32 supply,\\n address eligibility,\\n address toggle,\\n string memory imageURI,\\n uint16 lastHatId,\\n bool mutable_,\\n bool active\\n );\\n\\n function isWearerOfHat(\\n address _user,\\n uint256 _hatId\\n ) external view returns (bool isWearer);\\n\\n function isAdminOfHat(\\n address _user,\\n uint256 _hatId\\n ) external view returns (bool isAdmin);\\n\\n function isInGoodStanding(\\n address _wearer,\\n uint256 _hatId\\n ) external view returns (bool standing);\\n\\n function isEligible(\\n address _wearer,\\n uint256 _hatId\\n ) external view returns (bool eligible);\\n\\n function getHatEligibilityModule(\\n uint256 _hatId\\n ) external view returns (address eligibility);\\n\\n function getHatToggleModule(\\n uint256 _hatId\\n ) external view returns (address toggle);\\n\\n function getHatMaxSupply(\\n uint256 _hatId\\n ) external view returns (uint32 maxSupply);\\n\\n function hatSupply(uint256 _hatId) external view returns (uint32 supply);\\n\\n function getImageURIForHat(\\n uint256 _hatId\\n ) external view returns (string memory _uri);\\n\\n function balanceOf(\\n address wearer,\\n uint256 hatId\\n ) external view returns (uint256 balance);\\n\\n function balanceOfBatch(\\n address[] calldata _wearers,\\n uint256[] calldata _hatIds\\n ) external view returns (uint256[] memory);\\n\\n function uri(uint256 id) external view returns (string memory _uri);\\n}\\n\",\"keccak256\":\"0x2867004bddc5148fa1937f25c0403e5d9977583aaf50fdbdb74bd463f64f21c8\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/IHatsIdUtilities.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface IHatsIdUtilities {\\n function buildHatId(\\n uint256 _admin,\\n uint16 _newHat\\n ) external pure returns (uint256 id);\\n\\n function getHatLevel(uint256 _hatId) external view returns (uint32 level);\\n\\n function getLocalHatLevel(\\n uint256 _hatId\\n ) external pure returns (uint32 level);\\n\\n function isTopHat(uint256 _hatId) external view returns (bool _topHat);\\n\\n function isLocalTopHat(\\n uint256 _hatId\\n ) external pure returns (bool _localTopHat);\\n\\n function isValidHatId(\\n uint256 _hatId\\n ) external view returns (bool validHatId);\\n\\n function getAdminAtLevel(\\n uint256 _hatId,\\n uint32 _level\\n ) external view returns (uint256 admin);\\n\\n function getAdminAtLocalLevel(\\n uint256 _hatId,\\n uint32 _level\\n ) external pure returns (uint256 admin);\\n\\n function getTopHatDomain(\\n uint256 _hatId\\n ) external view returns (uint32 domain);\\n\\n function getTippyTopHatDomain(\\n uint32 _topHatDomain\\n ) external view returns (uint32 domain);\\n\\n function noCircularLinkage(\\n uint32 _topHatDomain,\\n uint256 _linkedAdmin\\n ) external view returns (bool notCircular);\\n\\n function sameTippyTopHatDomain(\\n uint32 _topHatDomain,\\n uint256 _newAdminHat\\n ) external view returns (bool sameDomain);\\n}\\n\",\"keccak256\":\"0x007fcc07b20bf84bacad1f9a2ddf4e30e1a8be961e144b7bef8e98a51781aee9\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/IHatsModuleFactory.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.19;\\n\\ninterface IHatsModuleFactory {\\n error HatsModuleFactory_ModuleAlreadyDeployed(\\n address implementation,\\n uint256 hatId,\\n bytes otherImmutableArgs,\\n uint256 saltNonce\\n );\\n\\n error BatchArrayLengthMismatch();\\n\\n event HatsModuleFactory_ModuleDeployed(\\n address implementation,\\n address instance,\\n uint256 hatId,\\n bytes otherImmutableArgs,\\n bytes initData,\\n uint256 saltNonce\\n );\\n\\n function HATS() external view returns (address);\\n\\n function version() external view returns (string memory);\\n\\n function createHatsModule(\\n address _implementation,\\n uint256 _hatId,\\n bytes calldata _otherImmutableArgs,\\n bytes calldata _initData,\\n uint256 _saltNonce\\n ) external returns (address _instance);\\n\\n function batchCreateHatsModule(\\n address[] calldata _implementations,\\n uint256[] calldata _hatIds,\\n bytes[] calldata _otherImmutableArgsArray,\\n bytes[] calldata _initDataArray,\\n uint256[] calldata _saltNonces\\n ) external returns (bool success);\\n\\n function getHatsModuleAddress(\\n address _implementation,\\n uint256 _hatId,\\n bytes calldata _otherImmutableArgs,\\n uint256 _saltNonce\\n ) external view returns (address);\\n\\n function deployed(\\n address _implementation,\\n uint256 _hatId,\\n bytes calldata _otherImmutableArgs,\\n uint256 _saltNonce\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x861faf40785cedb829243116d492653414a367853408a5c27d201522f6c3bfdd\",\"license\":\"MIT\"},\"contracts/interfaces/sablier/IAdminable.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\n/// @title IAdminable\\n/// @notice Contract module that provides a basic access control mechanism, with an admin that can be\\n/// granted exclusive access to specific functions. The inheriting contract must set the initial admin\\n/// in the constructor.\\ninterface IAdminable {\\n /*//////////////////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Emitted when the admin is transferred.\\n /// @param oldAdmin The address of the old admin.\\n /// @param newAdmin The address of the new admin.\\n event TransferAdmin(address indexed oldAdmin, address indexed newAdmin);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice The address of the admin account or contract.\\n function admin() external view returns (address);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n NON-CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Transfers the contract admin to a new address.\\n ///\\n /// @dev Notes:\\n /// - Does not revert if the admin is the same.\\n /// - This function can potentially leave the contract without an admin, thereby removing any\\n /// functionality that is only available to the admin.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the contract admin.\\n ///\\n /// @param newAdmin The address of the new admin.\\n function transferAdmin(address newAdmin) external;\\n}\\n\",\"keccak256\":\"0xa279c49e51228b571329164e36250e82b2c1378e8b549194ab7dd90fca9c3b2b\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/IERC4096.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 \\\"@openzeppelin/contracts/interfaces/IERC165.sol\\\";\\nimport {IERC721} from \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\n\\n/// @title ERC-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\",\"keccak256\":\"0xa34b9c52cbe36be860244f52256f1b05badf0cb797d208664b87337610d0e82d\",\"license\":\"MIT\"},\"contracts/interfaces/sablier/ISablierV2Lockup.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC4906} from \\\"./IERC4096.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IERC721Metadata} from \\\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\\\";\\nimport {UD60x18} from \\\"@prb/math/src/UD60x18.sol\\\";\\n\\nimport {Lockup} from \\\"./types/DataTypes.sol\\\";\\nimport {IAdminable} from \\\"./IAdminable.sol\\\";\\nimport {ISablierV2NFTDescriptor} from \\\"./ISablierV2NFTDescriptor.sol\\\";\\n\\n/// @title ISablierV2Lockup\\n/// @notice Common logic between all Sablier V2 Lockup contracts.\\ninterface ISablierV2Lockup is\\n IAdminable, // 0 inherited components\\n IERC4906, // 2 inherited components\\n IERC721Metadata // 2 inherited components\\n{\\n /*//////////////////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Emitted when the admin allows a new recipient contract to hook to Sablier.\\n /// @param admin The address of the current contract admin.\\n /// @param recipient The address of the recipient contract put on the allowlist.\\n event AllowToHook(address indexed admin, address recipient);\\n\\n /// @notice Emitted when a stream is canceled.\\n /// @param streamId The ID of the stream.\\n /// @param sender The address of the stream's sender.\\n /// @param recipient The address of the stream's recipient.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param senderAmount The amount of assets refunded to the stream's sender, denoted in units of the asset's\\n /// decimals.\\n /// @param recipientAmount The amount of assets left for the stream's recipient to withdraw, denoted in units of the\\n /// asset's decimals.\\n event CancelLockupStream(\\n uint256 streamId,\\n address indexed sender,\\n address indexed recipient,\\n IERC20 indexed asset,\\n uint128 senderAmount,\\n uint128 recipientAmount\\n );\\n\\n /// @notice Emitted when a sender gives up the right to cancel a stream.\\n /// @param streamId The ID of the stream.\\n event RenounceLockupStream(uint256 indexed streamId);\\n\\n /// @notice Emitted when the admin sets a new NFT descriptor contract.\\n /// @param admin The address of the current contract admin.\\n /// @param oldNFTDescriptor The address of the old NFT descriptor contract.\\n /// @param newNFTDescriptor The address of the new NFT descriptor contract.\\n event SetNFTDescriptor(\\n address indexed admin,\\n ISablierV2NFTDescriptor oldNFTDescriptor,\\n ISablierV2NFTDescriptor newNFTDescriptor\\n );\\n\\n /// @notice Emitted when assets are withdrawn from a stream.\\n /// @param streamId The ID of the stream.\\n /// @param to The address that has received the withdrawn assets.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param amount The amount of assets withdrawn, denoted in units of the asset's decimals.\\n event WithdrawFromLockupStream(\\n uint256 indexed streamId,\\n address indexed to,\\n IERC20 indexed asset,\\n uint128 amount\\n );\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Retrieves the address of the ERC-20 asset to be distributed.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getAsset(uint256 streamId) external view returns (IERC20 asset);\\n\\n /// @notice Retrieves the amount deposited in the stream, denoted in units of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getDepositedAmount(\\n uint256 streamId\\n ) external view returns (uint128 depositedAmount);\\n\\n /// @notice Retrieves the stream's end time, which is a Unix timestamp.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getEndTime(\\n uint256 streamId\\n ) external view returns (uint40 endTime);\\n\\n /// @notice Retrieves the stream's recipient.\\n /// @dev Reverts if the NFT has been burned.\\n /// @param streamId The stream ID for the query.\\n function getRecipient(\\n uint256 streamId\\n ) external view returns (address recipient);\\n\\n /// @notice Retrieves the amount refunded to the sender after a cancellation, denoted in units of the asset's\\n /// decimals. This amount is always zero unless the stream was canceled.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getRefundedAmount(\\n uint256 streamId\\n ) external view returns (uint128 refundedAmount);\\n\\n /// @notice Retrieves the stream's sender.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getSender(uint256 streamId) external view returns (address sender);\\n\\n /// @notice Retrieves the stream's start time, which is a Unix timestamp.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getStartTime(\\n uint256 streamId\\n ) external view returns (uint40 startTime);\\n\\n /// @notice Retrieves the amount withdrawn from the stream, denoted in units of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getWithdrawnAmount(\\n uint256 streamId\\n ) external view returns (uint128 withdrawnAmount);\\n\\n /// @notice Retrieves a flag indicating whether the provided address is a contract allowed to hook to Sablier\\n /// when a stream is canceled or when assets are withdrawn.\\n /// @dev See {ISablierLockupRecipient} for more information.\\n function isAllowedToHook(\\n address recipient\\n ) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream can be canceled. When the stream is cold, this\\n /// flag is always `false`.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isCancelable(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream is cold, i.e. settled, canceled, or depleted.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isCold(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream is depleted.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isDepleted(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream exists.\\n /// @dev Does not revert if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isStream(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream NFT can be transferred.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isTransferable(\\n uint256 streamId\\n ) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream is warm, i.e. either pending or streaming.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isWarm(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves the maximum broker fee that can be charged by the broker, denoted as a fixed-point\\n /// number where 1e18 is 100%.\\n /// @dev This value is hard coded as a constant.\\n function MAX_BROKER_FEE() external view returns (UD60x18);\\n\\n /// @notice Counter for stream IDs, used in the create functions.\\n function nextStreamId() external view returns (uint256);\\n\\n /// @notice Contract that generates the non-fungible token URI.\\n function nftDescriptor() external view returns (ISablierV2NFTDescriptor);\\n\\n /// @notice Calculates the amount that the sender would be refunded if the stream were canceled, denoted in units\\n /// of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function refundableAmountOf(\\n uint256 streamId\\n ) external view returns (uint128 refundableAmount);\\n\\n /// @notice Retrieves the stream's status.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function statusOf(\\n uint256 streamId\\n ) external view returns (Lockup.Status status);\\n\\n /// @notice Calculates the amount streamed to the recipient, denoted in units of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n ///\\n /// Notes:\\n /// - Upon cancellation of the stream, the amount streamed is calculated as the difference between the deposited\\n /// amount and the refunded amount. Ultimately, when the stream becomes depleted, the streamed amount is equivalent\\n /// to the total amount withdrawn.\\n ///\\n /// @param streamId The stream ID for the query.\\n function streamedAmountOf(\\n uint256 streamId\\n ) external view returns (uint128 streamedAmount);\\n\\n /// @notice Retrieves a flag indicating whether the stream was canceled.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function wasCanceled(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Calculates the amount that the recipient can withdraw from the stream, denoted in units of the asset's\\n /// decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function withdrawableAmountOf(\\n uint256 streamId\\n ) external view returns (uint128 withdrawableAmount);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n NON-CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Allows a recipient contract to hook to Sablier when a stream is canceled or when assets are withdrawn.\\n /// Useful for implementing contracts that hold streams on behalf of users, such as vaults or staking contracts.\\n ///\\n /// @dev Emits an {AllowToHook} event.\\n ///\\n /// Notes:\\n /// - Does not revert if the contract is already on the allowlist.\\n /// - This is an irreversible operation. The contract cannot be removed from the allowlist.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the contract admin.\\n /// - `recipient` must have a non-zero code size.\\n /// - `recipient` must implement {ISablierLockupRecipient}.\\n ///\\n /// @param recipient The address of the contract to allow for hooks.\\n function allowToHook(address recipient) external;\\n\\n /// @notice Burns the NFT associated with the stream.\\n ///\\n /// @dev Emits a {Transfer} event.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `streamId` must reference a depleted stream.\\n /// - The NFT must exist.\\n /// - `msg.sender` must be either the NFT owner or an approved third party.\\n ///\\n /// @param streamId The ID of the stream NFT to burn.\\n function burn(uint256 streamId) external;\\n\\n /// @notice Cancels the stream and refunds any remaining assets to the sender.\\n ///\\n /// @dev Emits a {Transfer}, {CancelLockupStream}, and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - If there any assets left for the recipient to withdraw, the stream is marked as canceled. Otherwise, the\\n /// stream is marked as depleted.\\n /// - This function attempts to invoke a hook on the recipient, if the resolved address is a contract.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - The stream must be warm and cancelable.\\n /// - `msg.sender` must be the stream's sender.\\n ///\\n /// @param streamId The ID of the stream to cancel.\\n function cancel(uint256 streamId) external;\\n\\n /// @notice Cancels multiple streams and refunds any remaining assets to the sender.\\n ///\\n /// @dev Emits multiple {Transfer}, {CancelLockupStream}, and {MetadataUpdate} events.\\n ///\\n /// Notes:\\n /// - Refer to the notes in {cancel}.\\n ///\\n /// Requirements:\\n /// - All requirements from {cancel} must be met for each stream.\\n ///\\n /// @param streamIds The IDs of the streams to cancel.\\n function cancelMultiple(uint256[] calldata streamIds) external;\\n\\n /// @notice Removes the right of the stream's sender to cancel the stream.\\n ///\\n /// @dev Emits a {RenounceLockupStream} and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - This is an irreversible operation.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `streamId` must reference a warm stream.\\n /// - `msg.sender` must be the stream's sender.\\n /// - The stream must be cancelable.\\n ///\\n /// @param streamId The ID of the stream to renounce.\\n function renounce(uint256 streamId) external;\\n\\n /// @notice Sets a new NFT descriptor contract, which produces the URI describing the Sablier stream NFTs.\\n ///\\n /// @dev Emits a {SetNFTDescriptor} and {BatchMetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - Does not revert if the NFT descriptor is the same.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the contract admin.\\n ///\\n /// @param newNFTDescriptor The address of the new NFT descriptor contract.\\n function setNFTDescriptor(\\n ISablierV2NFTDescriptor newNFTDescriptor\\n ) external;\\n\\n /// @notice Withdraws the provided amount of assets from the stream to the `to` address.\\n ///\\n /// @dev Emits a {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - This function attempts to call a hook on the recipient of the stream, unless `msg.sender` is the recipient.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `streamId` must not reference a null or depleted stream.\\n /// - `to` must not be the zero address.\\n /// - `amount` must be greater than zero and must not exceed the withdrawable amount.\\n /// - `to` must be the recipient if `msg.sender` is not the stream's recipient or an approved third party.\\n ///\\n /// @param streamId The ID of the stream to withdraw from.\\n /// @param to The address receiving the withdrawn assets.\\n /// @param amount The amount to withdraw, denoted in units of the asset's decimals.\\n function withdraw(uint256 streamId, address to, uint128 amount) external;\\n\\n /// @notice Withdraws the maximum withdrawable amount from the stream to the provided address `to`.\\n ///\\n /// @dev Emits a {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - Refer to the notes in {withdraw}.\\n ///\\n /// Requirements:\\n /// - Refer to the requirements in {withdraw}.\\n ///\\n /// @param streamId The ID of the stream to withdraw from.\\n /// @param to The address receiving the withdrawn assets.\\n /// @return withdrawnAmount The amount withdrawn, denoted in units of the asset's decimals.\\n function withdrawMax(\\n uint256 streamId,\\n address to\\n ) external returns (uint128 withdrawnAmount);\\n\\n /// @notice Withdraws the maximum withdrawable amount from the stream to the current recipient, and transfers the\\n /// NFT to `newRecipient`.\\n ///\\n /// @dev Emits a {WithdrawFromLockupStream} and a {Transfer} event.\\n ///\\n /// Notes:\\n /// - If the withdrawable amount is zero, the withdrawal is skipped.\\n /// - Refer to the notes in {withdraw}.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the stream's recipient.\\n /// - Refer to the requirements in {withdraw}.\\n /// - Refer to the requirements in {IERC721.transferFrom}.\\n ///\\n /// @param streamId The ID of the stream NFT to transfer.\\n /// @param newRecipient The address of the new owner of the stream NFT.\\n /// @return withdrawnAmount The amount withdrawn, denoted in units of the asset's decimals.\\n function withdrawMaxAndTransfer(\\n uint256 streamId,\\n address newRecipient\\n ) external returns (uint128 withdrawnAmount);\\n\\n /// @notice Withdraws assets from streams to the recipient of each stream.\\n ///\\n /// @dev Emits multiple {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} events.\\n ///\\n /// Notes:\\n /// - This function attempts to call a hook on the recipient of each stream, unless `msg.sender` is the recipient.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - There must be an equal number of `streamIds` and `amounts`.\\n /// - Each stream ID in the array must not reference a null or depleted stream.\\n /// - Each amount in the array must be greater than zero and must not exceed the withdrawable amount.\\n ///\\n /// @param streamIds The IDs of the streams to withdraw from.\\n /// @param amounts The amounts to withdraw, denoted in units of the asset's decimals.\\n function withdrawMultiple(\\n uint256[] calldata streamIds,\\n uint128[] calldata amounts\\n ) external;\\n}\\n\",\"keccak256\":\"0x3e5541c38a901637bd310965deb5bbde73ef07fe4ee3c752cbec330c6b9d62a3\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/ISablierV2LockupLinear.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\nimport {Lockup, LockupLinear} from \\\"./types/DataTypes.sol\\\";\\nimport {ISablierV2Lockup} from \\\"./ISablierV2Lockup.sol\\\";\\n\\n/// @title ISablierV2LockupLinear\\n/// @notice Creates and manages Lockup streams with a linear distribution function.\\ninterface ISablierV2LockupLinear is ISablierV2Lockup {\\n /*//////////////////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Emitted when a stream is created.\\n /// @param streamId The ID of the newly created stream.\\n /// @param funder The address which funded the stream.\\n /// @param sender The address distributing the assets, which will have the ability to cancel the stream.\\n /// @param recipient The address receiving the assets.\\n /// @param amounts Struct encapsulating (i) the deposit amount, and (ii) the broker fee amount, both denoted\\n /// in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Boolean indicating whether the stream will be cancelable or not.\\n /// @param transferable Boolean indicating whether the stream NFT is transferable or not.\\n /// @param timestamps Struct encapsulating (i) the stream's start time, (ii) cliff time, and (iii) end time, all as\\n /// Unix timestamps.\\n /// @param broker The address of the broker who has helped create the stream, e.g. a front-end website.\\n event CreateLockupLinearStream(\\n uint256 streamId,\\n address funder,\\n address indexed sender,\\n address indexed recipient,\\n Lockup.CreateAmounts amounts,\\n IERC20 indexed asset,\\n bool cancelable,\\n bool transferable,\\n LockupLinear.Timestamps timestamps,\\n address broker\\n );\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Retrieves the stream's cliff time, which is a Unix timestamp. A value of zero means there\\n /// is no cliff.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getCliffTime(\\n uint256 streamId\\n ) external view returns (uint40 cliffTime);\\n\\n /// @notice Retrieves the full stream details.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n /// @return stream See the documentation in {DataTypes}.\\n function getStream(\\n uint256 streamId\\n ) external view returns (LockupLinear.StreamLL memory stream);\\n\\n /// @notice Retrieves the stream's start, cliff and end timestamps.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n /// @return timestamps See the documentation in {DataTypes}.\\n function getTimestamps(\\n uint256 streamId\\n ) external view returns (LockupLinear.Timestamps memory timestamps);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n NON-CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Creates a stream by setting the start time to `block.timestamp`, and the end time to\\n /// the sum of `block.timestamp` and `params.durations.total`. The stream is funded by `msg.sender` and is wrapped\\n /// in an ERC-721 NFT.\\n ///\\n /// @dev Emits a {Transfer} and {CreateLockupLinearStream} event.\\n ///\\n /// Requirements:\\n /// - All requirements in {createWithTimestamps} must be met for the calculated parameters.\\n ///\\n /// @param params Struct encapsulating the function parameters, which are documented in {DataTypes}.\\n /// @return streamId The ID of the newly created stream.\\n function createWithDurations(\\n LockupLinear.CreateWithDurations calldata params\\n ) external returns (uint256 streamId);\\n\\n /// @notice Creates a stream with the provided start time and end time. The stream is funded by `msg.sender` and is\\n /// wrapped in an ERC-721 NFT.\\n ///\\n /// @dev Emits a {Transfer} and {CreateLockupLinearStream} event.\\n ///\\n /// Notes:\\n /// - A cliff time of zero means there is no cliff.\\n /// - As long as the times are ordered, it is not an error for the start or the cliff time to be in the past.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `params.totalAmount` must be greater than zero.\\n /// - If set, `params.broker.fee` must not be greater than `MAX_BROKER_FEE`.\\n /// - `params.timestamps.start` must be greater than zero and less than `params.timestamps.end`.\\n /// - If set, `params.timestamps.cliff` must be greater than `params.timestamps.start` and less than\\n /// `params.timestamps.end`.\\n /// - `params.timestamps.end` must be in the future.\\n /// - `params.recipient` must not be the zero address.\\n /// - `msg.sender` must have allowed this contract to spend at least `params.totalAmount` assets.\\n ///\\n /// @param params Struct encapsulating the function parameters, which are documented in {DataTypes}.\\n /// @return streamId The ID of the newly created stream.\\n function createWithTimestamps(\\n LockupLinear.CreateWithTimestamps calldata params\\n ) external returns (uint256 streamId);\\n}\\n\",\"keccak256\":\"0x064264723114b1f1cf3953fd79874dfcbb42cf313857aee6d5e6b09a23e0010b\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/ISablierV2NFTDescriptor.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC721Metadata} from \\\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\\\";\\n\\n/// @title ISablierV2NFTDescriptor\\n/// @notice This contract generates the URI describing the Sablier V2 stream NFTs.\\n/// @dev Inspired by Uniswap V3 Positions NFTs.\\ninterface ISablierV2NFTDescriptor {\\n /// @notice Produces the URI describing a particular stream NFT.\\n /// @dev This is a data URI with the JSON contents directly inlined.\\n /// @param sablier The address of the Sablier contract the stream was created in.\\n /// @param streamId The ID of the stream for which to produce a description.\\n /// @return uri The URI of the ERC721-compliant metadata.\\n function tokenURI(\\n IERC721Metadata sablier,\\n uint256 streamId\\n ) external view returns (string memory uri);\\n}\\n\",\"keccak256\":\"0x4ed430e553d14161e93efdaaacd1a502f49b38969c9d714b45d2e682a74fa0bc\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/types/DataTypes.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {UD2x18} from \\\"@prb/math/src/UD2x18.sol\\\";\\nimport {UD60x18} from \\\"@prb/math/src/UD60x18.sol\\\";\\n\\n// DataTypes.sol\\n//\\n// This file defines all structs used in V2 Core, most of which are organized under three namespaces:\\n//\\n// - Lockup\\n// - LockupDynamic\\n// - LockupLinear\\n// - LockupTranched\\n//\\n// You will notice that some structs contain \\\"slot\\\" annotations - they are used to indicate the\\n// storage layout of the struct. It is more gas efficient to group small data types together so\\n// that they fit in a single 32-byte slot.\\n\\n/// @notice Struct encapsulating the broker parameters passed to the create functions. Both can be set to zero.\\n/// @param account The address receiving the broker's fee.\\n/// @param fee The broker's percentage fee from the total amount, denoted as a fixed-point number where 1e18 is 100%.\\nstruct Broker {\\n address account;\\n UD60x18 fee;\\n}\\n\\n/// @notice Namespace for the structs used in both {SablierV2LockupLinear} and {SablierV2LockupDynamic}.\\nlibrary Lockup {\\n /// @notice Struct encapsulating the deposit, withdrawn, and refunded amounts, all denoted in units of the asset's\\n /// decimals.\\n /// @dev Because the deposited and the withdrawn amount are often read together, declaring them in the same slot\\n /// saves gas.\\n /// @param deposited The initial amount deposited in the stream, net of broker fee.\\n /// @param withdrawn The cumulative amount withdrawn from the stream.\\n /// @param refunded The amount refunded to the sender. Unless the stream was canceled, this is always zero.\\n struct Amounts {\\n // slot 0\\n uint128 deposited;\\n uint128 withdrawn;\\n // slot 1\\n uint128 refunded;\\n }\\n\\n /// @notice Struct encapsulating (i) the deposit amount and (ii) the broker fee amount, both denoted in units of the\\n /// asset's decimals.\\n /// @param deposit The amount to deposit in the stream.\\n /// @param brokerFee The broker fee amount.\\n struct CreateAmounts {\\n uint128 deposit;\\n uint128 brokerFee;\\n }\\n\\n /// @notice Enum representing the different statuses of a stream.\\n /// @custom:value0 PENDING Stream created but not started; assets are in a pending state.\\n /// @custom:value1 STREAMING Active stream where assets are currently being streamed.\\n /// @custom:value2 SETTLED All assets have been streamed; recipient is due to withdraw them.\\n /// @custom:value3 CANCELED Canceled stream; remaining assets await recipient's withdrawal.\\n /// @custom:value4 DEPLETED Depleted stream; all assets have been withdrawn and/or refunded.\\n enum Status {\\n PENDING,\\n STREAMING,\\n SETTLED,\\n CANCELED,\\n DEPLETED\\n }\\n\\n /// @notice A common data structure to be stored in all {SablierV2Lockup} models.\\n /// @dev The fields are arranged like this to save gas via tight variable packing.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream.\\n /// @param startTime The Unix timestamp indicating the stream's start.\\n /// @param endTime The Unix timestamp indicating the stream's end.\\n /// @param isCancelable Boolean indicating if the stream is cancelable.\\n /// @param wasCanceled Boolean indicating if the stream was canceled.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param isDepleted Boolean indicating if the stream is depleted.\\n /// @param isStream Boolean indicating if the struct entity exists.\\n /// @param isTransferable Boolean indicating if the stream NFT is transferable.\\n /// @param amounts Struct encapsulating the deposit, withdrawn, and refunded amounts, all denoted in units of the\\n /// asset's decimals.\\n struct Stream {\\n // slot 0\\n address sender;\\n uint40 startTime;\\n uint40 endTime;\\n bool isCancelable;\\n bool wasCanceled;\\n // slot 1\\n IERC20 asset;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n // slot 2 and 3\\n Lockup.Amounts amounts;\\n }\\n}\\n\\n/// @notice Namespace for the structs used in {SablierV2LockupDynamic}.\\nlibrary LockupDynamic {\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupDynamic.createWithDurations} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param segments Segments with durations used to compose the dynamic distribution function. Timestamps are\\n /// calculated by starting from `block.timestamp` and adding each duration to the previous timestamp.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithDurations {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n SegmentWithDuration[] segments;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupDynamic.createWithTimestamps} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param startTime The Unix timestamp indicating the stream's start.\\n /// @param segments Segments used to compose the dynamic distribution function.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithTimestamps {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n uint40 startTime;\\n Segment[] segments;\\n Broker broker;\\n }\\n\\n /// @notice Segment struct used in the Lockup Dynamic stream.\\n /// @param amount The amount of assets to be streamed in the segment, denoted in units of the asset's decimals.\\n /// @param exponent The exponent of the segment, denoted as a fixed-point number.\\n /// @param timestamp The Unix timestamp indicating the segment's end.\\n struct Segment {\\n // slot 0\\n uint128 amount;\\n UD2x18 exponent;\\n uint40 timestamp;\\n }\\n\\n /// @notice Segment struct used at runtime in {SablierV2LockupDynamic.createWithDurations}.\\n /// @param amount The amount of assets to be streamed in the segment, denoted in units of the asset's decimals.\\n /// @param exponent The exponent of the segment, denoted as a fixed-point number.\\n /// @param duration The time difference in seconds between the segment and the previous one.\\n struct SegmentWithDuration {\\n uint128 amount;\\n UD2x18 exponent;\\n uint40 duration;\\n }\\n\\n /// @notice Struct encapsulating the full details of a stream.\\n /// @dev Extends `Lockup.Stream` by including the recipient and the segments.\\n struct StreamLD {\\n address sender;\\n address recipient;\\n uint40 startTime;\\n uint40 endTime;\\n bool isCancelable;\\n bool wasCanceled;\\n IERC20 asset;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n Lockup.Amounts amounts;\\n Segment[] segments;\\n }\\n\\n /// @notice Struct encapsulating the LockupDynamic timestamps.\\n /// @param start The Unix timestamp indicating the stream's start.\\n /// @param end The Unix timestamp indicating the stream's end.\\n struct Timestamps {\\n uint40 start;\\n uint40 end;\\n }\\n}\\n\\n/// @notice Namespace for the structs used in {SablierV2LockupLinear}.\\nlibrary LockupLinear {\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupLinear.createWithDurations} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param durations Struct encapsulating (i) cliff period duration and (ii) total stream duration, both in seconds.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithDurations {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n Durations durations;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupLinear.createWithTimestamps} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param timestamps Struct encapsulating (i) the stream's start time, (ii) cliff time, and (iii) end time, all as\\n /// Unix timestamps.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithTimestamps {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n Timestamps timestamps;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the cliff duration and the total duration.\\n /// @param cliff The cliff duration in seconds.\\n /// @param total The total duration in seconds.\\n struct Durations {\\n uint40 cliff;\\n uint40 total;\\n }\\n\\n /// @notice Struct encapsulating the full details of a stream.\\n /// @dev Extends `Lockup.Stream` by including the recipient and the cliff time.\\n struct StreamLL {\\n address sender;\\n address recipient;\\n uint40 startTime;\\n bool isCancelable;\\n bool wasCanceled;\\n IERC20 asset;\\n uint40 endTime;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n Lockup.Amounts amounts;\\n uint40 cliffTime;\\n }\\n\\n /// @notice Struct encapsulating the LockupLinear timestamps.\\n /// @param start The Unix timestamp for the stream's start.\\n /// @param cliff The Unix timestamp for the cliff period's end. A value of zero means there is no cliff.\\n /// @param end The Unix timestamp for the stream's end.\\n struct Timestamps {\\n uint40 start;\\n uint40 cliff;\\n uint40 end;\\n }\\n}\\n\\n/// @notice Namespace for the structs used in {SablierV2LockupTranched}.\\nlibrary LockupTranched {\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupTranched.createWithDurations} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param tranches Tranches with durations used to compose the tranched distribution function. Timestamps are\\n /// calculated by starting from `block.timestamp` and adding each duration to the previous timestamp.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithDurations {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n TrancheWithDuration[] tranches;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupTranched.createWithTimestamps} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param startTime The Unix timestamp indicating the stream's start.\\n /// @param tranches Tranches used to compose the tranched distribution function.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithTimestamps {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n uint40 startTime;\\n Tranche[] tranches;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the full details of a stream.\\n /// @dev Extends `Lockup.Stream` by including the recipient and the tranches.\\n struct StreamLT {\\n address sender;\\n address recipient;\\n uint40 startTime;\\n uint40 endTime;\\n bool isCancelable;\\n bool wasCanceled;\\n IERC20 asset;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n Lockup.Amounts amounts;\\n Tranche[] tranches;\\n }\\n\\n /// @notice Struct encapsulating the LockupTranched timestamps.\\n /// @param start The Unix timestamp indicating the stream's start.\\n /// @param end The Unix timestamp indicating the stream's end.\\n struct Timestamps {\\n uint40 start;\\n uint40 end;\\n }\\n\\n /// @notice Tranche struct used in the Lockup Tranched stream.\\n /// @param amount The amount of assets to be unlocked in the tranche, denoted in units of the asset's decimals.\\n /// @param timestamp The Unix timestamp indicating the tranche's end.\\n struct Tranche {\\n // slot 0\\n uint128 amount;\\n uint40 timestamp;\\n }\\n\\n /// @notice Tranche struct used at runtime in {SablierV2LockupTranched.createWithDurations}.\\n /// @param amount The amount of assets to be unlocked in the tranche, denoted in units of the asset's decimals.\\n /// @param duration The time difference in seconds between the tranche and the previous one.\\n struct TrancheWithDuration {\\n uint128 amount;\\n uint40 duration;\\n }\\n}\\n\",\"keccak256\":\"0x727722c0ec71a76a947b935c9dfcac8fd846d6c3547dfbc8739c7109f3b95068\",\"license\":\"GPL-3.0-or-later\"},\"contracts/modules/DecentHatsModificationModule.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.28;\\n\\nimport {DecentHatsModuleUtils} from \\\"./DecentHatsModuleUtils.sol\\\";\\n\\ncontract DecentHatsModificationModule is DecentHatsModuleUtils {\\n /**\\n * @notice Creates a new termed or untermed role hat and any streams on it.\\n *\\n * @notice This contract should be enabled a module on the Safe for which the role is to be created, and disabled after.\\n *\\n * @dev Stream funds on untermed Roles are targeted at the hat's smart account. In order to withdraw funds from the stream, the\\n * hat's smart account must be the one call to `withdraw-` on the Sablier contract, setting the recipient arg to its wearer.\\n *\\n * @dev Stream funds on termed Roles are targeted directly at the nominated wearer.\\n * The wearer should directly call `withdraw-` on the Sablier contract.\\n *\\n * @dev Role hat creation, minting, smart account creation and stream creation are handled here in order\\n * to avoid a race condition where not more than one active proposal to create a new role can exist at a time.\\n * See: https://github.com/decentdao/decent-interface/issues/2402\\n *\\n * @param roleHatsParams An array of params for each role hat to be created.\\n */\\n function createRoleHats(\\n CreateRoleHatsParams calldata roleHatsParams\\n ) external {\\n _processRoleHats(roleHatsParams);\\n }\\n}\\n\",\"keccak256\":\"0x45b9470e000a416382deebea44a8c8734a2d6b453e8c7fbba5ea9bc6fdd4917c\",\"license\":\"MIT\"},\"contracts/modules/DecentHatsModuleUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.28;\\n\\nimport {Enum} from \\\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\\\";\\nimport {IAvatar} from \\\"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IERC6551Registry} from \\\"../interfaces/IERC6551Registry.sol\\\";\\nimport {IHats} from \\\"../interfaces/hats/IHats.sol\\\";\\nimport {LockupLinear, Broker} from \\\"../interfaces/sablier/types/DataTypes.sol\\\";\\nimport {IHatsModuleFactory} from \\\"../interfaces/hats/IHatsModuleFactory.sol\\\";\\nimport {ISablierV2LockupLinear} from \\\"../interfaces/sablier/ISablierV2LockupLinear.sol\\\";\\nimport {Strings} from \\\"@openzeppelin/contracts/utils/Strings.sol\\\";\\n\\nabstract contract DecentHatsModuleUtils {\\n bytes32 public constant SALT =\\n 0x5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b5072;\\n\\n struct SablierStreamParams {\\n ISablierV2LockupLinear sablier;\\n address sender;\\n address asset;\\n LockupLinear.Timestamps timestamps;\\n Broker broker;\\n uint128 totalAmount;\\n bool cancelable;\\n bool transferable;\\n }\\n\\n struct HatParams {\\n address wearer;\\n string details;\\n string imageURI;\\n SablierStreamParams[] sablierStreamsParams;\\n uint128 termEndDateTs; // If 0, this is an untermed Hat\\n uint32 maxSupply;\\n bool isMutable;\\n }\\n\\n struct CreateRoleHatsParams {\\n IHats hatsProtocol;\\n IERC6551Registry erc6551Registry;\\n address hatsAccountImplementation;\\n uint256 topHatId;\\n address topHatAccount;\\n address keyValuePairs;\\n IHatsModuleFactory hatsModuleFactory;\\n address hatsElectionsEligibilityImplementation;\\n uint256 adminHatId;\\n HatParams[] hats;\\n }\\n\\n function _processRoleHats(\\n CreateRoleHatsParams memory roleHatsParams\\n ) internal {\\n for (uint256 i = 0; i < roleHatsParams.hats.length; ) {\\n HatParams memory hatParams = roleHatsParams.hats[i];\\n\\n // Create eligibility module if needed\\n address eligibilityAddress = _createEligibilityModule(\\n roleHatsParams.hatsProtocol,\\n roleHatsParams.hatsModuleFactory,\\n roleHatsParams.hatsElectionsEligibilityImplementation,\\n roleHatsParams.topHatId,\\n roleHatsParams.topHatAccount,\\n roleHatsParams.adminHatId,\\n hatParams.termEndDateTs\\n );\\n\\n // Create and Mint the Role Hat\\n uint256 hatId = _createAndMintHat(\\n roleHatsParams.hatsProtocol,\\n roleHatsParams.adminHatId,\\n hatParams,\\n eligibilityAddress,\\n roleHatsParams.topHatAccount\\n );\\n\\n // Get the stream recipient (based on termed or not)\\n address streamRecipient = _setupStreamRecipient(\\n roleHatsParams.erc6551Registry,\\n roleHatsParams.hatsAccountImplementation,\\n address(roleHatsParams.hatsProtocol),\\n hatParams.termEndDateTs,\\n hatParams.wearer,\\n hatId\\n );\\n\\n // Create streams\\n _processSablierStreams(\\n hatParams.sablierStreamsParams,\\n streamRecipient,\\n roleHatsParams.keyValuePairs,\\n hatId\\n );\\n\\n unchecked {\\n ++i;\\n }\\n }\\n }\\n\\n function _createEligibilityModule(\\n IHats hatsProtocol,\\n IHatsModuleFactory hatsModuleFactory,\\n address hatsElectionsEligibilityImplementation,\\n uint256 topHatId,\\n address topHatAccount,\\n uint256 adminHatId,\\n uint128 termEndDateTs\\n ) private returns (address) {\\n // If the Hat is termed, create the eligibility module\\n if (termEndDateTs != 0) {\\n return\\n hatsModuleFactory.createHatsModule(\\n hatsElectionsEligibilityImplementation,\\n hatsProtocol.getNextId(adminHatId),\\n abi.encode(topHatId, uint256(0)), // [BALLOT_BOX_ID, ADMIN_HAT_ID]\\n abi.encode(termEndDateTs),\\n uint256(SALT)\\n );\\n }\\n\\n // Otherwise, return the Top Hat account\\n return topHatAccount;\\n }\\n\\n function _createAndMintHat(\\n IHats hatsProtocol,\\n uint256 adminHatId,\\n HatParams memory hat,\\n address eligibilityAddress,\\n address topHatAccount\\n ) private returns (uint256) {\\n // Grab the next Hat ID (before creating it)\\n uint256 hatId = hatsProtocol.getNextId(adminHatId);\\n\\n // Create the new Hat\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"createHat(uint256,string,uint32,address,address,bool,string)\\\",\\n adminHatId,\\n hat.details,\\n hat.maxSupply,\\n eligibilityAddress,\\n topHatAccount,\\n hat.isMutable,\\n hat.imageURI\\n ),\\n Enum.Operation.Call\\n );\\n\\n // If the Hat is termed, nominate the wearer as the eligible member\\n if (hat.termEndDateTs != 0) {\\n address[] memory nominatedWearers = new address[](1);\\n nominatedWearers[0] = hat.wearer;\\n\\n IAvatar(msg.sender).execTransactionFromModule(\\n eligibilityAddress,\\n 0,\\n abi.encodeWithSignature(\\n \\\"elect(uint128,address[])\\\",\\n hat.termEndDateTs,\\n nominatedWearers\\n ),\\n Enum.Operation.Call\\n );\\n }\\n\\n // Mint the Hat\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"mintHat(uint256,address)\\\",\\n hatId,\\n hat.wearer\\n ),\\n Enum.Operation.Call\\n );\\n return hatId;\\n }\\n\\n // Exists to avoid stack too deep errors\\n function _setupStreamRecipient(\\n IERC6551Registry erc6551Registry,\\n address hatsAccountImplementation,\\n address hatsProtocol,\\n uint128 termEndDateTs,\\n address wearer,\\n uint256 hatId\\n ) private returns (address) {\\n // If the hat is termed, the wearer is the stream recipient\\n if (termEndDateTs != 0) {\\n return wearer;\\n }\\n\\n // Otherwise, the Hat's smart account is the stream recipient\\n return\\n erc6551Registry.createAccount(\\n hatsAccountImplementation,\\n SALT,\\n block.chainid,\\n hatsProtocol,\\n hatId\\n );\\n }\\n\\n function _processSablierStreams(\\n SablierStreamParams[] memory streamParams,\\n address streamRecipient,\\n address keyValuePairs,\\n uint256 hatId\\n ) private {\\n for (uint256 i = 0; i < streamParams.length; ) {\\n SablierStreamParams memory sablierStreamParams = streamParams[i];\\n\\n // Approve tokens for Sablier\\n IAvatar(msg.sender).execTransactionFromModule(\\n sablierStreamParams.asset,\\n 0,\\n abi.encodeWithSignature(\\n \\\"approve(address,uint256)\\\",\\n sablierStreamParams.sablier,\\n sablierStreamParams.totalAmount\\n ),\\n Enum.Operation.Call\\n );\\n uint256 streamId = ISablierV2LockupLinear(\\n sablierStreamParams.sablier\\n ).nextStreamId();\\n\\n // Proxy the Sablier call through IAvatar\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(sablierStreamParams.sablier),\\n 0,\\n abi.encodeWithSignature(\\n \\\"createWithTimestamps((address,address,uint128,address,bool,bool,(uint40,uint40,uint40),(address,uint256)))\\\",\\n LockupLinear.CreateWithTimestamps({\\n sender: sablierStreamParams.sender,\\n recipient: streamRecipient,\\n totalAmount: sablierStreamParams.totalAmount,\\n asset: IERC20(sablierStreamParams.asset),\\n cancelable: sablierStreamParams.cancelable,\\n transferable: sablierStreamParams.transferable,\\n timestamps: sablierStreamParams.timestamps,\\n broker: sablierStreamParams.broker\\n })\\n ),\\n Enum.Operation.Call\\n );\\n\\n // Update KeyValuePairs with the stream ID and Hat ID\\n string[] memory keys = new string[](1);\\n string[] memory values = new string[](1);\\n keys[0] = \\\"hatIdToStreamId\\\";\\n values[0] = string(\\n abi.encodePacked(\\n Strings.toString(hatId),\\n \\\":\\\",\\n Strings.toString(streamId)\\n )\\n );\\n\\n IAvatar(msg.sender).execTransactionFromModule(\\n keyValuePairs,\\n 0,\\n abi.encodeWithSignature(\\n \\\"updateValues(string[],string[])\\\",\\n keys,\\n values\\n ),\\n Enum.Operation.Call\\n );\\n\\n unchecked {\\n ++i;\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xcf91d6de2291dd71d2491292ee2d1120c444b8f4f11b8c31429ed4c630013e69\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052348015600f57600080fd5b506116d88061001f6000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80630ad5e4271461003b578063ba9a91a514610050575b600080fd5b61004e610049366004610c55565b610089565b005b6100777f5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b507281565b60405190815260200160405180910390f35b61009a6100958261118c565b61009d565b50565b60005b8161012001515181101561016857600082610120015182815181106100c7576100c7611260565b6020026020010151905060006100ff84600001518560c001518660e0015187606001518860800151896101000151886080015161016c565b9050600061011d8560000151866101000151858589608001516102e5565b905060006101438660200151876040015188600001518760800151886000015187610617565b90506101598460600151828860a00151856106e3565b846001019450505050506100a0565b5050565b60006001600160801b038216156102d757866001600160a01b0316632f7fb7b6878a6001600160a01b0316631183a8c0876040518263ffffffff1660e01b81526004016101bb91815260200190565b602060405180830381865afa1580156101d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101fc9190611276565b886000604051602001610219929190918252602082015260400190565b60408051601f198184030181528282526001600160801b0389166020840152910160408051601f19818403018152908290526001600160e01b031960e087901b16825261028d949392917f5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b5072906004016112df565b6020604051808303816000875af11580156102ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102d0919061132b565b90506102da565b50825b979650505050505050565b60405162460ea360e61b81526004810185905260009081906001600160a01b03881690631183a8c090602401602060405180830381865afa15801561032e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103529190611276565b9050336001600160a01b031663468721a78860008989602001518a60a001518a8a8d60c001518e604001516040516024016103939796959493929190611348565b60408051601f198184030181529181526020820180516001600160e01b0316635829492f60e11b1790525160e085901b6001600160e01b03191681526103e1939291906000906004016113ac565b6020604051808303816000875af1158015610400573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104249190611402565b5060808501516001600160801b03161561054f576040805160018082528183019092526000916020808301908036833701905050905085600001518160008151811061047257610472611260565b60200260200101906001600160a01b031690816001600160a01b031681525050336001600160a01b031663468721a78660008960800151856040516024016104bb92919061141f565b60408051601f198184030181529181526020820180516001600160e01b0316634a231cef60e01b1790525160e085901b6001600160e01b0319168152610509939291906000906004016113ac565b6020604051808303816000875af1158015610528573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061054c9190611402565b50505b8451604051602481018390526001600160a01b039091166044820152339063468721a790899060009060640160408051601f198184030181529181526020820180516001600160e01b031663320fbbb760e11b1790525160e085901b6001600160e01b03191681526105c9939291906000906004016113ac565b6020604051808303816000875af11580156105e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061060c9190611402565b509695505050505050565b60006001600160801b0384161561062f5750816106d9565b604051638a54c52f60e01b81526001600160a01b0387811660048301527f5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b50726024830152466044830152868116606483015260848201849052881690638a54c52f9060a4016020604051808303816000875af11580156106b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106d6919061132b565b90505b9695505050505050565b60005b8451811015610b4657600085828151811061070357610703611260565b60200260200101519050336001600160a01b031663468721a78260400151600084600001518560a0015160405160240161075b9291906001600160a01b039290921682526001600160801b0316602082015260400190565b60408051601f198184030181529181526020820180516001600160e01b031663095ea7b360e01b1790525160e085901b6001600160e01b03191681526107a9939291906000906004016113ac565b6020604051808303816000875af11580156107c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ec9190611402565b50600081600001516001600160a01b0316631e99d5696040518163ffffffff1660e01b8152600401602060405180830381865afa158015610831573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108559190611276565b9050336001600160a01b031663468721a78360000151600060405180610100016040528087602001516001600160a01b031681526020018b6001600160a01b031681526020018760a001516001600160801b0316815260200187604001516001600160a01b031681526020018760c00151151581526020018760e00151151581526020018760600151815260200187608001518152506040516024016108fb9190611480565b60408051601f198184030181529181526020820180516001600160e01b03166353b1572760e01b1790525160e085901b6001600160e01b0319168152610949939291906000906004016113ac565b6020604051808303816000875af1158015610968573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061098c9190611402565b50604080516001808252818301909252600091816020015b60608152602001906001900390816109a457505060408051600180825281830190925291925060009190602082015b60608152602001906001900390816109d35790505090506040518060400160405280600f81526020016e1a185d1259151bd4dd1c99585b5259608a1b81525082600081518110610a2557610a25611260565b6020026020010181905250610a3986610b4d565b610a4284610b4d565b604051602001610a5392919061154f565b60405160208183030381529060405281600081518110610a7557610a75611260565b6020026020010181905250336001600160a01b031663468721a78860008585604051602401610aa59291906115db565b60408051601f198184030181529181526020820180516001600160e01b031663579374b960e11b1790525160e085901b6001600160e01b0319168152610af3939291906000906004016113ac565b6020604051808303816000875af1158015610b12573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b369190611402565b50846001019450505050506106e6565b5050505050565b606081600003610b745750506040805180820190915260018152600360fc1b602082015290565b8160005b8115610b9e5780610b888161161f565b9150610b979050600a8361164e565b9150610b78565b6000816001600160401b03811115610bb857610bb8610c97565b6040519080825280601f01601f191660200182016040528015610be2576020820181803683370190505b5090505b8415610c4d57610bf7600183611662565b9150610c04600a8661167b565b610c0f90603061168f565b60f81b818381518110610c2457610c24611260565b60200101906001600160f81b031916908160001a905350610c46600a8661164e565b9450610be6565b949350505050565b600060208284031215610c6757600080fd5b81356001600160401b03811115610c7d57600080fd5b82016101408185031215610c9057600080fd5b9392505050565b634e487b7160e01b600052604160045260246000fd5b60405161010081016001600160401b0381118282101715610cd057610cd0610c97565b60405290565b60405160e081016001600160401b0381118282101715610cd057610cd0610c97565b60405161014081016001600160401b0381118282101715610cd057610cd0610c97565b604051601f8201601f191681016001600160401b0381118282101715610d4357610d43610c97565b604052919050565b6001600160a01b038116811461009a57600080fd5b8035610d6b81610d4b565b919050565b60006001600160401b03821115610d8957610d89610c97565b5060051b60200190565b600082601f830112610da457600080fd5b81356001600160401b03811115610dbd57610dbd610c97565b610dd0601f8201601f1916602001610d1b565b818152846020838601011115610de557600080fd5b816020850160208301376000918101602001919091529392505050565b803564ffffffffff81168114610d6b57600080fd5b600060608284031215610e2957600080fd5b604051606081016001600160401b0381118282101715610e4b57610e4b610c97565b604052905080610e5a83610e02565b8152610e6860208401610e02565b6020820152610e7960408401610e02565b60408201525092915050565b600060408284031215610e9757600080fd5b604080519081016001600160401b0381118282101715610eb957610eb9610c97565b6040529050808235610eca81610d4b565b8152602092830135920191909152919050565b80356001600160801b0381168114610d6b57600080fd5b801515811461009a57600080fd5b8035610d6b81610ef4565b600082601f830112610f1e57600080fd5b8135610f31610f2c82610d70565b610d1b565b8082825260208201915060206101608402860101925085831115610f5457600080fd5b602085015b83811015611012576101608188031215610f7257600080fd5b610f7a610cad565b610f8382610d60565b8152610f9160208301610d60565b6020820152610fa260408301610d60565b6040820152610fb48860608401610e17565b6060820152610fc68860c08401610e85565b6080820152610fd86101008301610edd565b60a0820152610fea6101208301610f02565b60c0820152610ffc6101408301610f02565b60e0820152835260209092019161016001610f59565b5095945050505050565b803563ffffffff81168114610d6b57600080fd5b600082601f83011261104157600080fd5b813561104f610f2c82610d70565b8082825260208201915060208360051b86010192508583111561107157600080fd5b602085015b838110156110125780356001600160401b0381111561109457600080fd5b860160e0818903601f190112156110aa57600080fd5b6110b2610cd6565b6110be60208301610d60565b815260408201356001600160401b038111156110d957600080fd5b6110e88a602083860101610d93565b60208301525060608201356001600160401b0381111561110757600080fd5b6111168a602083860101610d93565b60408301525060808201356001600160401b0381111561113557600080fd5b6111448a602083860101610f0d565b60608301525061115660a08301610edd565b608082015261116760c0830161101c565b60a082015261117860e08301610f02565b60c082015284525060209283019201611076565b6000610140823603121561119f57600080fd5b6111a7610cf8565b6111b083610d60565b81526111be60208401610d60565b60208201526111cf60408401610d60565b6040820152606083810135908201526111ea60808401610d60565b60808201526111fb60a08401610d60565b60a082015261120c60c08401610d60565b60c082015261121d60e08401610d60565b60e082015261010083810135908201526101208301356001600160401b0381111561124757600080fd5b61125336828601611030565b6101208301525092915050565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561128857600080fd5b5051919050565b60005b838110156112aa578181015183820152602001611292565b50506000910152565b600081518084526112cb81602086016020860161128f565b601f01601f19169290920160200192915050565b60018060a01b038616815284602082015260a06040820152600061130660a08301866112b3565b828103606084015261131881866112b3565b9150508260808301529695505050505050565b60006020828403121561133d57600080fd5b8151610c9081610d4b565b87815260e06020820152600061136160e08301896112b3565b63ffffffff881660408401526001600160a01b0387811660608501528616608084015284151560a084015282810360c084015261139e81856112b3565b9a9950505050505050505050565b60018060a01b03851681528360208201526080604082015260006113d360808301856112b3565b9050600283106113f357634e487b7160e01b600052602160045260246000fd5b82606083015295945050505050565b60006020828403121561141457600080fd5b8151610c9081610ef4565b6000604082016001600160801b03851683526040602084015280845180835260608501915060208601925060005b818110156114745783516001600160a01b031683526020938401939092019160010161144d565b50909695505050505050565b81516001600160a01b0390811682526020808401518216908301526040808401516001600160801b031690830152606080840151918216908301526101608201905060808301516114d5608084018215159052565b5060a08301516114e960a084018215159052565b5060c083015161152860c084018264ffffffffff815116825264ffffffffff602082015116602083015264ffffffffff60408201511660408301525050565b5060e0929092015180516001600160a01b0316610120830152602001516101409091015290565b6000835161156181846020880161128f565b601d60f91b908301908152835161157f81600184016020880161128f565b01600101949350505050565b600082825180855260208501945060208160051b8301016020850160005b8381101561147457601f198584030188526115c58383516112b3565b60209889019890935091909101906001016115a9565b6040815260006115ee604083018561158b565b8281036020840152611600818561158b565b95945050505050565b634e487b7160e01b600052601160045260246000fd5b60006001820161163157611631611609565b5060010190565b634e487b7160e01b600052601260045260246000fd5b60008261165d5761165d611638565b500490565b8181038181111561167557611675611609565b92915050565b60008261168a5761168a611638565b500690565b808201808211156116755761167561160956fea2646970667358221220cbb4b307eab1d5ffde2b7ecaf86a40052d6217b110fff2ecda840a0a4b601bdc64736f6c634300081c0033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100365760003560e01c80630ad5e4271461003b578063ba9a91a514610050575b600080fd5b61004e610049366004610c55565b610089565b005b6100777f5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b507281565b60405190815260200160405180910390f35b61009a6100958261118c565b61009d565b50565b60005b8161012001515181101561016857600082610120015182815181106100c7576100c7611260565b6020026020010151905060006100ff84600001518560c001518660e0015187606001518860800151896101000151886080015161016c565b9050600061011d8560000151866101000151858589608001516102e5565b905060006101438660200151876040015188600001518760800151886000015187610617565b90506101598460600151828860a00151856106e3565b846001019450505050506100a0565b5050565b60006001600160801b038216156102d757866001600160a01b0316632f7fb7b6878a6001600160a01b0316631183a8c0876040518263ffffffff1660e01b81526004016101bb91815260200190565b602060405180830381865afa1580156101d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101fc9190611276565b886000604051602001610219929190918252602082015260400190565b60408051601f198184030181528282526001600160801b0389166020840152910160408051601f19818403018152908290526001600160e01b031960e087901b16825261028d949392917f5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b5072906004016112df565b6020604051808303816000875af11580156102ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102d0919061132b565b90506102da565b50825b979650505050505050565b60405162460ea360e61b81526004810185905260009081906001600160a01b03881690631183a8c090602401602060405180830381865afa15801561032e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103529190611276565b9050336001600160a01b031663468721a78860008989602001518a60a001518a8a8d60c001518e604001516040516024016103939796959493929190611348565b60408051601f198184030181529181526020820180516001600160e01b0316635829492f60e11b1790525160e085901b6001600160e01b03191681526103e1939291906000906004016113ac565b6020604051808303816000875af1158015610400573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104249190611402565b5060808501516001600160801b03161561054f576040805160018082528183019092526000916020808301908036833701905050905085600001518160008151811061047257610472611260565b60200260200101906001600160a01b031690816001600160a01b031681525050336001600160a01b031663468721a78660008960800151856040516024016104bb92919061141f565b60408051601f198184030181529181526020820180516001600160e01b0316634a231cef60e01b1790525160e085901b6001600160e01b0319168152610509939291906000906004016113ac565b6020604051808303816000875af1158015610528573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061054c9190611402565b50505b8451604051602481018390526001600160a01b039091166044820152339063468721a790899060009060640160408051601f198184030181529181526020820180516001600160e01b031663320fbbb760e11b1790525160e085901b6001600160e01b03191681526105c9939291906000906004016113ac565b6020604051808303816000875af11580156105e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061060c9190611402565b509695505050505050565b60006001600160801b0384161561062f5750816106d9565b604051638a54c52f60e01b81526001600160a01b0387811660048301527f5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b50726024830152466044830152868116606483015260848201849052881690638a54c52f9060a4016020604051808303816000875af11580156106b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106d6919061132b565b90505b9695505050505050565b60005b8451811015610b4657600085828151811061070357610703611260565b60200260200101519050336001600160a01b031663468721a78260400151600084600001518560a0015160405160240161075b9291906001600160a01b039290921682526001600160801b0316602082015260400190565b60408051601f198184030181529181526020820180516001600160e01b031663095ea7b360e01b1790525160e085901b6001600160e01b03191681526107a9939291906000906004016113ac565b6020604051808303816000875af11580156107c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ec9190611402565b50600081600001516001600160a01b0316631e99d5696040518163ffffffff1660e01b8152600401602060405180830381865afa158015610831573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108559190611276565b9050336001600160a01b031663468721a78360000151600060405180610100016040528087602001516001600160a01b031681526020018b6001600160a01b031681526020018760a001516001600160801b0316815260200187604001516001600160a01b031681526020018760c00151151581526020018760e00151151581526020018760600151815260200187608001518152506040516024016108fb9190611480565b60408051601f198184030181529181526020820180516001600160e01b03166353b1572760e01b1790525160e085901b6001600160e01b0319168152610949939291906000906004016113ac565b6020604051808303816000875af1158015610968573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061098c9190611402565b50604080516001808252818301909252600091816020015b60608152602001906001900390816109a457505060408051600180825281830190925291925060009190602082015b60608152602001906001900390816109d35790505090506040518060400160405280600f81526020016e1a185d1259151bd4dd1c99585b5259608a1b81525082600081518110610a2557610a25611260565b6020026020010181905250610a3986610b4d565b610a4284610b4d565b604051602001610a5392919061154f565b60405160208183030381529060405281600081518110610a7557610a75611260565b6020026020010181905250336001600160a01b031663468721a78860008585604051602401610aa59291906115db565b60408051601f198184030181529181526020820180516001600160e01b031663579374b960e11b1790525160e085901b6001600160e01b0319168152610af3939291906000906004016113ac565b6020604051808303816000875af1158015610b12573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b369190611402565b50846001019450505050506106e6565b5050505050565b606081600003610b745750506040805180820190915260018152600360fc1b602082015290565b8160005b8115610b9e5780610b888161161f565b9150610b979050600a8361164e565b9150610b78565b6000816001600160401b03811115610bb857610bb8610c97565b6040519080825280601f01601f191660200182016040528015610be2576020820181803683370190505b5090505b8415610c4d57610bf7600183611662565b9150610c04600a8661167b565b610c0f90603061168f565b60f81b818381518110610c2457610c24611260565b60200101906001600160f81b031916908160001a905350610c46600a8661164e565b9450610be6565b949350505050565b600060208284031215610c6757600080fd5b81356001600160401b03811115610c7d57600080fd5b82016101408185031215610c9057600080fd5b9392505050565b634e487b7160e01b600052604160045260246000fd5b60405161010081016001600160401b0381118282101715610cd057610cd0610c97565b60405290565b60405160e081016001600160401b0381118282101715610cd057610cd0610c97565b60405161014081016001600160401b0381118282101715610cd057610cd0610c97565b604051601f8201601f191681016001600160401b0381118282101715610d4357610d43610c97565b604052919050565b6001600160a01b038116811461009a57600080fd5b8035610d6b81610d4b565b919050565b60006001600160401b03821115610d8957610d89610c97565b5060051b60200190565b600082601f830112610da457600080fd5b81356001600160401b03811115610dbd57610dbd610c97565b610dd0601f8201601f1916602001610d1b565b818152846020838601011115610de557600080fd5b816020850160208301376000918101602001919091529392505050565b803564ffffffffff81168114610d6b57600080fd5b600060608284031215610e2957600080fd5b604051606081016001600160401b0381118282101715610e4b57610e4b610c97565b604052905080610e5a83610e02565b8152610e6860208401610e02565b6020820152610e7960408401610e02565b60408201525092915050565b600060408284031215610e9757600080fd5b604080519081016001600160401b0381118282101715610eb957610eb9610c97565b6040529050808235610eca81610d4b565b8152602092830135920191909152919050565b80356001600160801b0381168114610d6b57600080fd5b801515811461009a57600080fd5b8035610d6b81610ef4565b600082601f830112610f1e57600080fd5b8135610f31610f2c82610d70565b610d1b565b8082825260208201915060206101608402860101925085831115610f5457600080fd5b602085015b83811015611012576101608188031215610f7257600080fd5b610f7a610cad565b610f8382610d60565b8152610f9160208301610d60565b6020820152610fa260408301610d60565b6040820152610fb48860608401610e17565b6060820152610fc68860c08401610e85565b6080820152610fd86101008301610edd565b60a0820152610fea6101208301610f02565b60c0820152610ffc6101408301610f02565b60e0820152835260209092019161016001610f59565b5095945050505050565b803563ffffffff81168114610d6b57600080fd5b600082601f83011261104157600080fd5b813561104f610f2c82610d70565b8082825260208201915060208360051b86010192508583111561107157600080fd5b602085015b838110156110125780356001600160401b0381111561109457600080fd5b860160e0818903601f190112156110aa57600080fd5b6110b2610cd6565b6110be60208301610d60565b815260408201356001600160401b038111156110d957600080fd5b6110e88a602083860101610d93565b60208301525060608201356001600160401b0381111561110757600080fd5b6111168a602083860101610d93565b60408301525060808201356001600160401b0381111561113557600080fd5b6111448a602083860101610f0d565b60608301525061115660a08301610edd565b608082015261116760c0830161101c565b60a082015261117860e08301610f02565b60c082015284525060209283019201611076565b6000610140823603121561119f57600080fd5b6111a7610cf8565b6111b083610d60565b81526111be60208401610d60565b60208201526111cf60408401610d60565b6040820152606083810135908201526111ea60808401610d60565b60808201526111fb60a08401610d60565b60a082015261120c60c08401610d60565b60c082015261121d60e08401610d60565b60e082015261010083810135908201526101208301356001600160401b0381111561124757600080fd5b61125336828601611030565b6101208301525092915050565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561128857600080fd5b5051919050565b60005b838110156112aa578181015183820152602001611292565b50506000910152565b600081518084526112cb81602086016020860161128f565b601f01601f19169290920160200192915050565b60018060a01b038616815284602082015260a06040820152600061130660a08301866112b3565b828103606084015261131881866112b3565b9150508260808301529695505050505050565b60006020828403121561133d57600080fd5b8151610c9081610d4b565b87815260e06020820152600061136160e08301896112b3565b63ffffffff881660408401526001600160a01b0387811660608501528616608084015284151560a084015282810360c084015261139e81856112b3565b9a9950505050505050505050565b60018060a01b03851681528360208201526080604082015260006113d360808301856112b3565b9050600283106113f357634e487b7160e01b600052602160045260246000fd5b82606083015295945050505050565b60006020828403121561141457600080fd5b8151610c9081610ef4565b6000604082016001600160801b03851683526040602084015280845180835260608501915060208601925060005b818110156114745783516001600160a01b031683526020938401939092019160010161144d565b50909695505050505050565b81516001600160a01b0390811682526020808401518216908301526040808401516001600160801b031690830152606080840151918216908301526101608201905060808301516114d5608084018215159052565b5060a08301516114e960a084018215159052565b5060c083015161152860c084018264ffffffffff815116825264ffffffffff602082015116602083015264ffffffffff60408201511660408301525050565b5060e0929092015180516001600160a01b0316610120830152602001516101409091015290565b6000835161156181846020880161128f565b601d60f91b908301908152835161157f81600184016020880161128f565b01600101949350505050565b600082825180855260208501945060208160051b8301016020850160005b8381101561147457601f198584030188526115c58383516112b3565b60209889019890935091909101906001016115a9565b6040815260006115ee604083018561158b565b8281036020840152611600818561158b565b95945050505050565b634e487b7160e01b600052601160045260246000fd5b60006001820161163157611631611609565b5060010190565b634e487b7160e01b600052601260045260246000fd5b60008261165d5761165d611638565b500490565b8181038181111561167557611675611609565b92915050565b60008261168a5761168a611638565b500690565b808201808211156116755761167561160956fea2646970667358221220cbb4b307eab1d5ffde2b7ecaf86a40052d6217b110fff2ecda840a0a4b601bdc64736f6c634300081c0033", "devdoc": { "kind": "dev", "methods": { - "createRoleHats((address,address,address,uint256,address,address,address,uint256,(address,string,string,(address,address,address,(uint40,uint40,uint40),(address,uint256),uint128,bool,bool)[],uint128,uint32,bool)[]))": { + "createRoleHats((address,address,address,uint256,address,address,address,address,uint256,(address,string,string,(address,address,address,(uint40,uint40,uint40),(address,uint256),uint128,bool,bool)[],uint128,uint32,bool)[]))": { "details": "Stream funds on untermed Roles are targeted at the hat's smart account. In order to withdraw funds from the stream, the hat's smart account must be the one call to `withdraw-` on the Sablier contract, setting the recipient arg to its wearer.Stream funds on termed Roles are targeted directly at the nominated wearer. The wearer should directly call `withdraw-` on the Sablier contract.Role hat creation, minting, smart account creation and stream creation are handled here in order to avoid a race condition where not more than one active proposal to create a new role can exist at a time. See: https://github.com/decentdao/decent-interface/issues/2402", "params": { "roleHatsParams": "An array of params for each role hat to be created." @@ -220,7 +225,7 @@ "userdoc": { "kind": "user", "methods": { - "createRoleHats((address,address,address,uint256,address,address,address,uint256,(address,string,string,(address,address,address,(uint40,uint40,uint40),(address,uint256),uint128,bool,bool)[],uint128,uint32,bool)[]))": { + "createRoleHats((address,address,address,uint256,address,address,address,address,uint256,(address,string,string,(address,address,address,(uint40,uint40,uint40),(address,uint256),uint128,bool,bool)[],uint128,uint32,bool)[]))": { "notice": "Creates a new termed or untermed role hat and any streams on it.This contract should be enabled a module on the Safe for which the role is to be created, and disabled after." } }, diff --git a/deployments/optimism/solcInputs/f1fca9a70591742a2aedd10e2fd7e744.json b/deployments/optimism/solcInputs/f1fca9a70591742a2aedd10e2fd7e744.json new file mode 100644 index 0000000..14e45d1 --- /dev/null +++ b/deployments/optimism/solcInputs/f1fca9a70591742a2aedd10e2fd7e744.json @@ -0,0 +1,387 @@ +{ + "language": "Solidity", + "sources": { + "@gnosis.pm/safe-contracts/contracts/base/Executor.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\nimport \"../common/Enum.sol\";\n\n/// @title Executor - A contract that can execute transactions\n/// @author Richard Meissner - \ncontract Executor {\n function execute(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation,\n uint256 txGas\n ) internal returns (bool success) {\n if (operation == Enum.Operation.DelegateCall) {\n // solhint-disable-next-line no-inline-assembly\n assembly {\n success := delegatecall(txGas, to, add(data, 0x20), mload(data), 0, 0)\n }\n } else {\n // solhint-disable-next-line no-inline-assembly\n assembly {\n success := call(txGas, to, value, add(data, 0x20), mload(data), 0, 0)\n }\n }\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/base/FallbackManager.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"../common/SelfAuthorized.sol\";\n\n/// @title Fallback Manager - A contract that manages fallback calls made to this contract\n/// @author Richard Meissner - \ncontract FallbackManager is SelfAuthorized {\n event ChangedFallbackHandler(address handler);\n\n // keccak256(\"fallback_manager.handler.address\")\n bytes32 internal constant FALLBACK_HANDLER_STORAGE_SLOT = 0x6c9a6c4a39284e37ed1cf53d337577d14212a4870fb976a4366c693b939918d5;\n\n function internalSetFallbackHandler(address handler) internal {\n bytes32 slot = FALLBACK_HANDLER_STORAGE_SLOT;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n sstore(slot, handler)\n }\n }\n\n /// @dev Allows to add a contract to handle fallback calls.\n /// Only fallback calls without value and with data will be forwarded.\n /// This can only be done via a Safe transaction.\n /// @param handler contract to handle fallbacks calls.\n function setFallbackHandler(address handler) public authorized {\n internalSetFallbackHandler(handler);\n emit ChangedFallbackHandler(handler);\n }\n\n // solhint-disable-next-line payable-fallback,no-complex-fallback\n fallback() external {\n bytes32 slot = FALLBACK_HANDLER_STORAGE_SLOT;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let handler := sload(slot)\n if iszero(handler) {\n return(0, 0)\n }\n calldatacopy(0, 0, calldatasize())\n // The msg.sender address is shifted to the left by 12 bytes to remove the padding\n // Then the address without padding is stored right after the calldata\n mstore(calldatasize(), shl(96, caller()))\n // Add 20 bytes for the address appended add the end\n let success := call(gas(), handler, 0, 0, add(calldatasize(), 20), 0, 0)\n returndatacopy(0, 0, returndatasize())\n if iszero(success) {\n revert(0, returndatasize())\n }\n return(0, returndatasize())\n }\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/base/GuardManager.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"../common/Enum.sol\";\nimport \"../common/SelfAuthorized.sol\";\n\ninterface Guard {\n function checkTransaction(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation,\n uint256 safeTxGas,\n uint256 baseGas,\n uint256 gasPrice,\n address gasToken,\n address payable refundReceiver,\n bytes memory signatures,\n address msgSender\n ) external;\n\n function checkAfterExecution(bytes32 txHash, bool success) external;\n}\n\n/// @title Fallback Manager - A contract that manages fallback calls made to this contract\n/// @author Richard Meissner - \ncontract GuardManager is SelfAuthorized {\n event ChangedGuard(address guard);\n // keccak256(\"guard_manager.guard.address\")\n bytes32 internal constant GUARD_STORAGE_SLOT = 0x4a204f620c8c5ccdca3fd54d003badd85ba500436a431f0cbda4f558c93c34c8;\n\n /// @dev Set a guard that checks transactions before execution\n /// @param guard The address of the guard to be used or the 0 address to disable the guard\n function setGuard(address guard) external authorized {\n bytes32 slot = GUARD_STORAGE_SLOT;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n sstore(slot, guard)\n }\n emit ChangedGuard(guard);\n }\n\n function getGuard() internal view returns (address guard) {\n bytes32 slot = GUARD_STORAGE_SLOT;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n guard := sload(slot)\n }\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/base/ModuleManager.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\nimport \"../common/Enum.sol\";\nimport \"../common/SelfAuthorized.sol\";\nimport \"./Executor.sol\";\n\n/// @title Module Manager - A contract that manages modules that can execute transactions via this contract\n/// @author Stefan George - \n/// @author Richard Meissner - \ncontract ModuleManager is SelfAuthorized, Executor {\n event EnabledModule(address module);\n event DisabledModule(address module);\n event ExecutionFromModuleSuccess(address indexed module);\n event ExecutionFromModuleFailure(address indexed module);\n\n address internal constant SENTINEL_MODULES = address(0x1);\n\n mapping(address => address) internal modules;\n\n function setupModules(address to, bytes memory data) internal {\n require(modules[SENTINEL_MODULES] == address(0), \"GS100\");\n modules[SENTINEL_MODULES] = SENTINEL_MODULES;\n if (to != address(0))\n // Setup has to complete successfully or transaction fails.\n require(execute(to, 0, data, Enum.Operation.DelegateCall, gasleft()), \"GS000\");\n }\n\n /// @dev Allows to add a module to the whitelist.\n /// This can only be done via a Safe transaction.\n /// @notice Enables the module `module` for the Safe.\n /// @param module Module to be whitelisted.\n function enableModule(address module) public authorized {\n // Module address cannot be null or sentinel.\n require(module != address(0) && module != SENTINEL_MODULES, \"GS101\");\n // Module cannot be added twice.\n require(modules[module] == address(0), \"GS102\");\n modules[module] = modules[SENTINEL_MODULES];\n modules[SENTINEL_MODULES] = module;\n emit EnabledModule(module);\n }\n\n /// @dev Allows to remove a module from the whitelist.\n /// This can only be done via a Safe transaction.\n /// @notice Disables the module `module` for the Safe.\n /// @param prevModule Module that pointed to the module to be removed in the linked list\n /// @param module Module to be removed.\n function disableModule(address prevModule, address module) public authorized {\n // Validate module address and check that it corresponds to module index.\n require(module != address(0) && module != SENTINEL_MODULES, \"GS101\");\n require(modules[prevModule] == module, \"GS103\");\n modules[prevModule] = modules[module];\n modules[module] = address(0);\n emit DisabledModule(module);\n }\n\n /// @dev Allows a Module to execute a Safe transaction without any further confirmations.\n /// @param to Destination address of module transaction.\n /// @param value Ether value of module transaction.\n /// @param data Data payload of module transaction.\n /// @param operation Operation type of module transaction.\n function execTransactionFromModule(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation\n ) public virtual returns (bool success) {\n // Only whitelisted modules are allowed.\n require(msg.sender != SENTINEL_MODULES && modules[msg.sender] != address(0), \"GS104\");\n // Execute transaction without further confirmations.\n success = execute(to, value, data, operation, gasleft());\n if (success) emit ExecutionFromModuleSuccess(msg.sender);\n else emit ExecutionFromModuleFailure(msg.sender);\n }\n\n /// @dev Allows a Module to execute a Safe transaction without any further confirmations and return data\n /// @param to Destination address of module transaction.\n /// @param value Ether value of module transaction.\n /// @param data Data payload of module transaction.\n /// @param operation Operation type of module transaction.\n function execTransactionFromModuleReturnData(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation\n ) public returns (bool success, bytes memory returnData) {\n success = execTransactionFromModule(to, value, data, operation);\n // solhint-disable-next-line no-inline-assembly\n assembly {\n // Load free memory location\n let ptr := mload(0x40)\n // We allocate memory for the return data by setting the free memory location to\n // current free memory location + data size + 32 bytes for data size value\n mstore(0x40, add(ptr, add(returndatasize(), 0x20)))\n // Store the size\n mstore(ptr, returndatasize())\n // Store the data\n returndatacopy(add(ptr, 0x20), 0, returndatasize())\n // Point the return data to the correct memory location\n returnData := ptr\n }\n }\n\n /// @dev Returns if an module is enabled\n /// @return True if the module is enabled\n function isModuleEnabled(address module) public view returns (bool) {\n return SENTINEL_MODULES != module && modules[module] != address(0);\n }\n\n /// @dev Returns array of modules.\n /// @param start Start of the page.\n /// @param pageSize Maximum number of modules that should be returned.\n /// @return array Array of modules.\n /// @return next Start of the next page.\n function getModulesPaginated(address start, uint256 pageSize) external view returns (address[] memory array, address next) {\n // Init array with max page size\n array = new address[](pageSize);\n\n // Populate return array\n uint256 moduleCount = 0;\n address currentModule = modules[start];\n while (currentModule != address(0x0) && currentModule != SENTINEL_MODULES && moduleCount < pageSize) {\n array[moduleCount] = currentModule;\n currentModule = modules[currentModule];\n moduleCount++;\n }\n next = currentModule;\n // Set correct size of returned array\n // solhint-disable-next-line no-inline-assembly\n assembly {\n mstore(array, moduleCount)\n }\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/base/OwnerManager.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\nimport \"../common/SelfAuthorized.sol\";\n\n/// @title OwnerManager - Manages a set of owners and a threshold to perform actions.\n/// @author Stefan George - \n/// @author Richard Meissner - \ncontract OwnerManager is SelfAuthorized {\n event AddedOwner(address owner);\n event RemovedOwner(address owner);\n event ChangedThreshold(uint256 threshold);\n\n address internal constant SENTINEL_OWNERS = address(0x1);\n\n mapping(address => address) internal owners;\n uint256 internal ownerCount;\n uint256 internal threshold;\n\n /// @dev Setup function sets initial storage of contract.\n /// @param _owners List of Safe owners.\n /// @param _threshold Number of required confirmations for a Safe transaction.\n function setupOwners(address[] memory _owners, uint256 _threshold) internal {\n // Threshold can only be 0 at initialization.\n // Check ensures that setup function can only be called once.\n require(threshold == 0, \"GS200\");\n // Validate that threshold is smaller than number of added owners.\n require(_threshold <= _owners.length, \"GS201\");\n // There has to be at least one Safe owner.\n require(_threshold >= 1, \"GS202\");\n // Initializing Safe owners.\n address currentOwner = SENTINEL_OWNERS;\n for (uint256 i = 0; i < _owners.length; i++) {\n // Owner address cannot be null.\n address owner = _owners[i];\n require(owner != address(0) && owner != SENTINEL_OWNERS && owner != address(this) && currentOwner != owner, \"GS203\");\n // No duplicate owners allowed.\n require(owners[owner] == address(0), \"GS204\");\n owners[currentOwner] = owner;\n currentOwner = owner;\n }\n owners[currentOwner] = SENTINEL_OWNERS;\n ownerCount = _owners.length;\n threshold = _threshold;\n }\n\n /// @dev Allows to add a new owner to the Safe and update the threshold at the same time.\n /// This can only be done via a Safe transaction.\n /// @notice Adds the owner `owner` to the Safe and updates the threshold to `_threshold`.\n /// @param owner New owner address.\n /// @param _threshold New threshold.\n function addOwnerWithThreshold(address owner, uint256 _threshold) public authorized {\n // Owner address cannot be null, the sentinel or the Safe itself.\n require(owner != address(0) && owner != SENTINEL_OWNERS && owner != address(this), \"GS203\");\n // No duplicate owners allowed.\n require(owners[owner] == address(0), \"GS204\");\n owners[owner] = owners[SENTINEL_OWNERS];\n owners[SENTINEL_OWNERS] = owner;\n ownerCount++;\n emit AddedOwner(owner);\n // Change threshold if threshold was changed.\n if (threshold != _threshold) changeThreshold(_threshold);\n }\n\n /// @dev Allows to remove an owner from the Safe and update the threshold at the same time.\n /// This can only be done via a Safe transaction.\n /// @notice Removes the owner `owner` from the Safe and updates the threshold to `_threshold`.\n /// @param prevOwner Owner that pointed to the owner to be removed in the linked list\n /// @param owner Owner address to be removed.\n /// @param _threshold New threshold.\n function removeOwner(\n address prevOwner,\n address owner,\n uint256 _threshold\n ) public authorized {\n // Only allow to remove an owner, if threshold can still be reached.\n require(ownerCount - 1 >= _threshold, \"GS201\");\n // Validate owner address and check that it corresponds to owner index.\n require(owner != address(0) && owner != SENTINEL_OWNERS, \"GS203\");\n require(owners[prevOwner] == owner, \"GS205\");\n owners[prevOwner] = owners[owner];\n owners[owner] = address(0);\n ownerCount--;\n emit RemovedOwner(owner);\n // Change threshold if threshold was changed.\n if (threshold != _threshold) changeThreshold(_threshold);\n }\n\n /// @dev Allows to swap/replace an owner from the Safe with another address.\n /// This can only be done via a Safe transaction.\n /// @notice Replaces the owner `oldOwner` in the Safe with `newOwner`.\n /// @param prevOwner Owner that pointed to the owner to be replaced in the linked list\n /// @param oldOwner Owner address to be replaced.\n /// @param newOwner New owner address.\n function swapOwner(\n address prevOwner,\n address oldOwner,\n address newOwner\n ) public authorized {\n // Owner address cannot be null, the sentinel or the Safe itself.\n require(newOwner != address(0) && newOwner != SENTINEL_OWNERS && newOwner != address(this), \"GS203\");\n // No duplicate owners allowed.\n require(owners[newOwner] == address(0), \"GS204\");\n // Validate oldOwner address and check that it corresponds to owner index.\n require(oldOwner != address(0) && oldOwner != SENTINEL_OWNERS, \"GS203\");\n require(owners[prevOwner] == oldOwner, \"GS205\");\n owners[newOwner] = owners[oldOwner];\n owners[prevOwner] = newOwner;\n owners[oldOwner] = address(0);\n emit RemovedOwner(oldOwner);\n emit AddedOwner(newOwner);\n }\n\n /// @dev Allows to update the number of required confirmations by Safe owners.\n /// This can only be done via a Safe transaction.\n /// @notice Changes the threshold of the Safe to `_threshold`.\n /// @param _threshold New threshold.\n function changeThreshold(uint256 _threshold) public authorized {\n // Validate that threshold is smaller than number of owners.\n require(_threshold <= ownerCount, \"GS201\");\n // There has to be at least one Safe owner.\n require(_threshold >= 1, \"GS202\");\n threshold = _threshold;\n emit ChangedThreshold(threshold);\n }\n\n function getThreshold() public view returns (uint256) {\n return threshold;\n }\n\n function isOwner(address owner) public view returns (bool) {\n return owner != SENTINEL_OWNERS && owners[owner] != address(0);\n }\n\n /// @dev Returns array of owners.\n /// @return Array of Safe owners.\n function getOwners() public view returns (address[] memory) {\n address[] memory array = new address[](ownerCount);\n\n // populate return array\n uint256 index = 0;\n address currentOwner = owners[SENTINEL_OWNERS];\n while (currentOwner != SENTINEL_OWNERS) {\n array[index] = currentOwner;\n currentOwner = owners[currentOwner];\n index++;\n }\n return array;\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/common/Enum.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\n/// @title Enum - Collection of enums\n/// @author Richard Meissner - \ncontract Enum {\n enum Operation {Call, DelegateCall}\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/common/EtherPaymentFallback.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\n/// @title EtherPaymentFallback - A contract that has a fallback to accept ether payments\n/// @author Richard Meissner - \ncontract EtherPaymentFallback {\n event SafeReceived(address indexed sender, uint256 value);\n\n /// @dev Fallback function accepts Ether transactions.\n receive() external payable {\n emit SafeReceived(msg.sender, msg.value);\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/common/SecuredTokenTransfer.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\n/// @title SecuredTokenTransfer - Secure token transfer\n/// @author Richard Meissner - \ncontract SecuredTokenTransfer {\n /// @dev Transfers a token and returns if it was a success\n /// @param token Token that should be transferred\n /// @param receiver Receiver to whom the token should be transferred\n /// @param amount The amount of tokens that should be transferred\n function transferToken(\n address token,\n address receiver,\n uint256 amount\n ) internal returns (bool transferred) {\n // 0xa9059cbb - keccack(\"transfer(address,uint256)\")\n bytes memory data = abi.encodeWithSelector(0xa9059cbb, receiver, amount);\n // solhint-disable-next-line no-inline-assembly\n assembly {\n // We write the return value to scratch space.\n // See https://docs.soliditylang.org/en/v0.7.6/internals/layout_in_memory.html#layout-in-memory\n let success := call(sub(gas(), 10000), token, 0, add(data, 0x20), mload(data), 0, 0x20)\n switch returndatasize()\n case 0 {\n transferred := success\n }\n case 0x20 {\n transferred := iszero(or(iszero(success), iszero(mload(0))))\n }\n default {\n transferred := 0\n }\n }\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/common/SelfAuthorized.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\n/// @title SelfAuthorized - authorizes current contract to perform actions\n/// @author Richard Meissner - \ncontract SelfAuthorized {\n function requireSelfCall() private view {\n require(msg.sender == address(this), \"GS031\");\n }\n\n modifier authorized() {\n // This is a function call as it minimized the bytecode size\n requireSelfCall();\n _;\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/common/SignatureDecoder.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\n/// @title SignatureDecoder - Decodes signatures that a encoded as bytes\n/// @author Richard Meissner - \ncontract SignatureDecoder {\n /// @dev divides bytes signature into `uint8 v, bytes32 r, bytes32 s`.\n /// @notice Make sure to peform a bounds check for @param pos, to avoid out of bounds access on @param signatures\n /// @param pos which signature to read. A prior bounds check of this parameter should be performed, to avoid out of bounds access\n /// @param signatures concatenated rsv signatures\n function signatureSplit(bytes memory signatures, uint256 pos)\n internal\n pure\n returns (\n uint8 v,\n bytes32 r,\n bytes32 s\n )\n {\n // The signature format is a compact form of:\n // {bytes32 r}{bytes32 s}{uint8 v}\n // Compact means, uint8 is not padded to 32 bytes.\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let signaturePos := mul(0x41, pos)\n r := mload(add(signatures, add(signaturePos, 0x20)))\n s := mload(add(signatures, add(signaturePos, 0x40)))\n // Here we are loading the last 32 bytes, including 31 bytes\n // of 's'. There is no 'mload8' to do this.\n //\n // 'byte' is not working due to the Solidity parser, so lets\n // use the second best option, 'and'\n v := and(mload(add(signatures, add(signaturePos, 0x41))), 0xff)\n }\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/common/Singleton.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\n/// @title Singleton - Base for singleton contracts (should always be first super contract)\n/// This contract is tightly coupled to our proxy contract (see `proxies/GnosisSafeProxy.sol`)\n/// @author Richard Meissner - \ncontract Singleton {\n // singleton always needs to be first declared variable, to ensure that it is at the same location as in the Proxy contract.\n // It should also always be ensured that the address is stored alone (uses a full word)\n address private singleton;\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/common/StorageAccessible.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\n/// @title StorageAccessible - generic base contract that allows callers to access all internal storage.\n/// @notice See https://github.com/gnosis/util-contracts/blob/bb5fe5fb5df6d8400998094fb1b32a178a47c3a1/contracts/StorageAccessible.sol\ncontract StorageAccessible {\n /**\n * @dev Reads `length` bytes of storage in the currents contract\n * @param offset - the offset in the current contract's storage in words to start reading from\n * @param length - the number of words (32 bytes) of data to read\n * @return the bytes that were read.\n */\n function getStorageAt(uint256 offset, uint256 length) public view returns (bytes memory) {\n bytes memory result = new bytes(length * 32);\n for (uint256 index = 0; index < length; index++) {\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let word := sload(add(offset, index))\n mstore(add(add(result, 0x20), mul(index, 0x20)), word)\n }\n }\n return result;\n }\n\n /**\n * @dev Performs a delegetecall on a targetContract in the context of self.\n * Internally reverts execution to avoid side effects (making it static).\n *\n * This method reverts with data equal to `abi.encode(bool(success), bytes(response))`.\n * Specifically, the `returndata` after a call to this method will be:\n * `success:bool || response.length:uint256 || response:bytes`.\n *\n * @param targetContract Address of the contract containing the code to execute.\n * @param calldataPayload Calldata that should be sent to the target contract (encoded method name and arguments).\n */\n function simulateAndRevert(address targetContract, bytes memory calldataPayload) external {\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let success := delegatecall(gas(), targetContract, add(calldataPayload, 0x20), mload(calldataPayload), 0, 0)\n\n mstore(0x00, success)\n mstore(0x20, returndatasize())\n returndatacopy(0x40, 0, returndatasize())\n revert(0, add(returndatasize(), 0x40))\n }\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/external/GnosisSafeMath.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\n/**\n * @title GnosisSafeMath\n * @dev Math operations with safety checks that revert on error\n * Renamed from SafeMath to GnosisSafeMath to avoid conflicts\n * TODO: remove once open zeppelin update to solc 0.5.0\n */\nlibrary GnosisSafeMath {\n /**\n * @dev Multiplies two numbers, reverts on overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\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-solidity/pull/522\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n require(c / a == b);\n\n return c;\n }\n\n /**\n * @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b <= a);\n uint256 c = a - b;\n\n return c;\n }\n\n /**\n * @dev Adds two numbers, reverts on overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a);\n\n return c;\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" + }, + "@gnosis.pm/safe-contracts/contracts/GnosisSafe.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"./base/ModuleManager.sol\";\nimport \"./base/OwnerManager.sol\";\nimport \"./base/FallbackManager.sol\";\nimport \"./base/GuardManager.sol\";\nimport \"./common/EtherPaymentFallback.sol\";\nimport \"./common/Singleton.sol\";\nimport \"./common/SignatureDecoder.sol\";\nimport \"./common/SecuredTokenTransfer.sol\";\nimport \"./common/StorageAccessible.sol\";\nimport \"./interfaces/ISignatureValidator.sol\";\nimport \"./external/GnosisSafeMath.sol\";\n\n/// @title Gnosis Safe - A multisignature wallet with support for confirmations using signed messages based on ERC191.\n/// @author Stefan George - \n/// @author Richard Meissner - \ncontract GnosisSafe is\n EtherPaymentFallback,\n Singleton,\n ModuleManager,\n OwnerManager,\n SignatureDecoder,\n SecuredTokenTransfer,\n ISignatureValidatorConstants,\n FallbackManager,\n StorageAccessible,\n GuardManager\n{\n using GnosisSafeMath for uint256;\n\n string public constant VERSION = \"1.3.0\";\n\n // keccak256(\n // \"EIP712Domain(uint256 chainId,address verifyingContract)\"\n // );\n bytes32 private constant DOMAIN_SEPARATOR_TYPEHASH = 0x47e79534a245952e8b16893a336b85a3d9ea9fa8c573f3d803afb92a79469218;\n\n // keccak256(\n // \"SafeTx(address to,uint256 value,bytes data,uint8 operation,uint256 safeTxGas,uint256 baseGas,uint256 gasPrice,address gasToken,address refundReceiver,uint256 nonce)\"\n // );\n bytes32 private constant SAFE_TX_TYPEHASH = 0xbb8310d486368db6bd6f849402fdd73ad53d316b5a4b2644ad6efe0f941286d8;\n\n event SafeSetup(address indexed initiator, address[] owners, uint256 threshold, address initializer, address fallbackHandler);\n event ApproveHash(bytes32 indexed approvedHash, address indexed owner);\n event SignMsg(bytes32 indexed msgHash);\n event ExecutionFailure(bytes32 txHash, uint256 payment);\n event ExecutionSuccess(bytes32 txHash, uint256 payment);\n\n uint256 public nonce;\n bytes32 private _deprecatedDomainSeparator;\n // Mapping to keep track of all message hashes that have been approve by ALL REQUIRED owners\n mapping(bytes32 => uint256) public signedMessages;\n // Mapping to keep track of all hashes (message or transaction) that have been approve by ANY owners\n mapping(address => mapping(bytes32 => uint256)) public approvedHashes;\n\n // This constructor ensures that this contract can only be used as a master copy for Proxy contracts\n constructor() {\n // By setting the threshold it is not possible to call setup anymore,\n // so we create a Safe with 0 owners and threshold 1.\n // This is an unusable Safe, perfect for the singleton\n threshold = 1;\n }\n\n /// @dev Setup function sets initial storage of contract.\n /// @param _owners List of Safe owners.\n /// @param _threshold Number of required confirmations for a Safe transaction.\n /// @param to Contract address for optional delegate call.\n /// @param data Data payload for optional delegate call.\n /// @param fallbackHandler Handler for fallback calls to this contract\n /// @param paymentToken Token that should be used for the payment (0 is ETH)\n /// @param payment Value that should be paid\n /// @param paymentReceiver Adddress that should receive the payment (or 0 if tx.origin)\n function setup(\n address[] calldata _owners,\n uint256 _threshold,\n address to,\n bytes calldata data,\n address fallbackHandler,\n address paymentToken,\n uint256 payment,\n address payable paymentReceiver\n ) external {\n // setupOwners checks if the Threshold is already set, therefore preventing that this method is called twice\n setupOwners(_owners, _threshold);\n if (fallbackHandler != address(0)) internalSetFallbackHandler(fallbackHandler);\n // As setupOwners can only be called if the contract has not been initialized we don't need a check for setupModules\n setupModules(to, data);\n\n if (payment > 0) {\n // To avoid running into issues with EIP-170 we reuse the handlePayment function (to avoid adjusting code of that has been verified we do not adjust the method itself)\n // baseGas = 0, gasPrice = 1 and gas = payment => amount = (payment + 0) * 1 = payment\n handlePayment(payment, 0, 1, paymentToken, paymentReceiver);\n }\n emit SafeSetup(msg.sender, _owners, _threshold, to, fallbackHandler);\n }\n\n /// @dev Allows to execute a Safe transaction confirmed by required number of owners and then pays the account that submitted the transaction.\n /// Note: The fees are always transferred, even if the user transaction fails.\n /// @param to Destination address of Safe transaction.\n /// @param value Ether value of Safe transaction.\n /// @param data Data payload of Safe transaction.\n /// @param operation Operation type of Safe transaction.\n /// @param safeTxGas Gas that should be used for the Safe transaction.\n /// @param baseGas Gas costs that are independent of the transaction execution(e.g. base transaction fee, signature check, payment of the refund)\n /// @param gasPrice Gas price that should be used for the payment calculation.\n /// @param gasToken Token address (or 0 if ETH) that is used for the payment.\n /// @param refundReceiver Address of receiver of gas payment (or 0 if tx.origin).\n /// @param signatures Packed signature data ({bytes32 r}{bytes32 s}{uint8 v})\n function execTransaction(\n address to,\n uint256 value,\n bytes calldata data,\n Enum.Operation operation,\n uint256 safeTxGas,\n uint256 baseGas,\n uint256 gasPrice,\n address gasToken,\n address payable refundReceiver,\n bytes memory signatures\n ) public payable virtual returns (bool success) {\n bytes32 txHash;\n // Use scope here to limit variable lifetime and prevent `stack too deep` errors\n {\n bytes memory txHashData =\n encodeTransactionData(\n // Transaction info\n to,\n value,\n data,\n operation,\n safeTxGas,\n // Payment info\n baseGas,\n gasPrice,\n gasToken,\n refundReceiver,\n // Signature info\n nonce\n );\n // Increase nonce and execute transaction.\n nonce++;\n txHash = keccak256(txHashData);\n checkSignatures(txHash, txHashData, signatures);\n }\n address guard = getGuard();\n {\n if (guard != address(0)) {\n Guard(guard).checkTransaction(\n // Transaction info\n to,\n value,\n data,\n operation,\n safeTxGas,\n // Payment info\n baseGas,\n gasPrice,\n gasToken,\n refundReceiver,\n // Signature info\n signatures,\n msg.sender\n );\n }\n }\n // We require some gas to emit the events (at least 2500) after the execution and some to perform code until the execution (500)\n // We also include the 1/64 in the check that is not send along with a call to counteract potential shortings because of EIP-150\n require(gasleft() >= ((safeTxGas * 64) / 63).max(safeTxGas + 2500) + 500, \"GS010\");\n // Use scope here to limit variable lifetime and prevent `stack too deep` errors\n {\n uint256 gasUsed = gasleft();\n // If the gasPrice is 0 we assume that nearly all available gas can be used (it is always more than safeTxGas)\n // We only substract 2500 (compared to the 3000 before) to ensure that the amount passed is still higher than safeTxGas\n success = execute(to, value, data, operation, gasPrice == 0 ? (gasleft() - 2500) : safeTxGas);\n gasUsed = gasUsed.sub(gasleft());\n // If no safeTxGas and no gasPrice was set (e.g. both are 0), then the internal tx is required to be successful\n // This makes it possible to use `estimateGas` without issues, as it searches for the minimum gas where the tx doesn't revert\n require(success || safeTxGas != 0 || gasPrice != 0, \"GS013\");\n // We transfer the calculated tx costs to the tx.origin to avoid sending it to intermediate contracts that have made calls\n uint256 payment = 0;\n if (gasPrice > 0) {\n payment = handlePayment(gasUsed, baseGas, gasPrice, gasToken, refundReceiver);\n }\n if (success) emit ExecutionSuccess(txHash, payment);\n else emit ExecutionFailure(txHash, payment);\n }\n {\n if (guard != address(0)) {\n Guard(guard).checkAfterExecution(txHash, success);\n }\n }\n }\n\n function handlePayment(\n uint256 gasUsed,\n uint256 baseGas,\n uint256 gasPrice,\n address gasToken,\n address payable refundReceiver\n ) private returns (uint256 payment) {\n // solhint-disable-next-line avoid-tx-origin\n address payable receiver = refundReceiver == address(0) ? payable(tx.origin) : refundReceiver;\n if (gasToken == address(0)) {\n // For ETH we will only adjust the gas price to not be higher than the actual used gas price\n payment = gasUsed.add(baseGas).mul(gasPrice < tx.gasprice ? gasPrice : tx.gasprice);\n require(receiver.send(payment), \"GS011\");\n } else {\n payment = gasUsed.add(baseGas).mul(gasPrice);\n require(transferToken(gasToken, receiver, payment), \"GS012\");\n }\n }\n\n /**\n * @dev Checks whether the signature provided is valid for the provided data, hash. Will revert otherwise.\n * @param dataHash Hash of the data (could be either a message hash or transaction hash)\n * @param data That should be signed (this is passed to an external validator contract)\n * @param signatures Signature data that should be verified. Can be ECDSA signature, contract signature (EIP-1271) or approved hash.\n */\n function checkSignatures(\n bytes32 dataHash,\n bytes memory data,\n bytes memory signatures\n ) public view {\n // Load threshold to avoid multiple storage loads\n uint256 _threshold = threshold;\n // Check that a threshold is set\n require(_threshold > 0, \"GS001\");\n checkNSignatures(dataHash, data, signatures, _threshold);\n }\n\n /**\n * @dev Checks whether the signature provided is valid for the provided data, hash. Will revert otherwise.\n * @param dataHash Hash of the data (could be either a message hash or transaction hash)\n * @param data That should be signed (this is passed to an external validator contract)\n * @param signatures Signature data that should be verified. Can be ECDSA signature, contract signature (EIP-1271) or approved hash.\n * @param requiredSignatures Amount of required valid signatures.\n */\n function checkNSignatures(\n bytes32 dataHash,\n bytes memory data,\n bytes memory signatures,\n uint256 requiredSignatures\n ) public view {\n // Check that the provided signature data is not too short\n require(signatures.length >= requiredSignatures.mul(65), \"GS020\");\n // There cannot be an owner with address 0.\n address lastOwner = address(0);\n address currentOwner;\n uint8 v;\n bytes32 r;\n bytes32 s;\n uint256 i;\n for (i = 0; i < requiredSignatures; i++) {\n (v, r, s) = signatureSplit(signatures, i);\n if (v == 0) {\n // If v is 0 then it is a contract signature\n // When handling contract signatures the address of the contract is encoded into r\n currentOwner = address(uint160(uint256(r)));\n\n // Check that signature data pointer (s) is not pointing inside the static part of the signatures bytes\n // This check is not completely accurate, since it is possible that more signatures than the threshold are send.\n // Here we only check that the pointer is not pointing inside the part that is being processed\n require(uint256(s) >= requiredSignatures.mul(65), \"GS021\");\n\n // Check that signature data pointer (s) is in bounds (points to the length of data -> 32 bytes)\n require(uint256(s).add(32) <= signatures.length, \"GS022\");\n\n // Check if the contract signature is in bounds: start of data is s + 32 and end is start + signature length\n uint256 contractSignatureLen;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n contractSignatureLen := mload(add(add(signatures, s), 0x20))\n }\n require(uint256(s).add(32).add(contractSignatureLen) <= signatures.length, \"GS023\");\n\n // Check signature\n bytes memory contractSignature;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n // The signature data for contract signatures is appended to the concatenated signatures and the offset is stored in s\n contractSignature := add(add(signatures, s), 0x20)\n }\n require(ISignatureValidator(currentOwner).isValidSignature(data, contractSignature) == EIP1271_MAGIC_VALUE, \"GS024\");\n } else if (v == 1) {\n // If v is 1 then it is an approved hash\n // When handling approved hashes the address of the approver is encoded into r\n currentOwner = address(uint160(uint256(r)));\n // Hashes are automatically approved by the sender of the message or when they have been pre-approved via a separate transaction\n require(msg.sender == currentOwner || approvedHashes[currentOwner][dataHash] != 0, \"GS025\");\n } else if (v > 30) {\n // If v > 30 then default va (27,28) has been adjusted for eth_sign flow\n // To support eth_sign and similar we adjust v and hash the messageHash with the Ethereum message prefix before applying ecrecover\n currentOwner = ecrecover(keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", dataHash)), v - 4, r, s);\n } else {\n // Default is the ecrecover flow with the provided data hash\n // Use ecrecover with the messageHash for EOA signatures\n currentOwner = ecrecover(dataHash, v, r, s);\n }\n require(currentOwner > lastOwner && owners[currentOwner] != address(0) && currentOwner != SENTINEL_OWNERS, \"GS026\");\n lastOwner = currentOwner;\n }\n }\n\n /// @dev Allows to estimate a Safe transaction.\n /// This method is only meant for estimation purpose, therefore the call will always revert and encode the result in the revert data.\n /// Since the `estimateGas` function includes refunds, call this method to get an estimated of the costs that are deducted from the safe with `execTransaction`\n /// @param to Destination address of Safe transaction.\n /// @param value Ether value of Safe transaction.\n /// @param data Data payload of Safe transaction.\n /// @param operation Operation type of Safe transaction.\n /// @return Estimate without refunds and overhead fees (base transaction and payload data gas costs).\n /// @notice Deprecated in favor of common/StorageAccessible.sol and will be removed in next version.\n function requiredTxGas(\n address to,\n uint256 value,\n bytes calldata data,\n Enum.Operation operation\n ) external returns (uint256) {\n uint256 startGas = gasleft();\n // We don't provide an error message here, as we use it to return the estimate\n require(execute(to, value, data, operation, gasleft()));\n uint256 requiredGas = startGas - gasleft();\n // Convert response to string and return via error message\n revert(string(abi.encodePacked(requiredGas)));\n }\n\n /**\n * @dev Marks a hash as approved. This can be used to validate a hash that is used by a signature.\n * @param hashToApprove The hash that should be marked as approved for signatures that are verified by this contract.\n */\n function approveHash(bytes32 hashToApprove) external {\n require(owners[msg.sender] != address(0), \"GS030\");\n approvedHashes[msg.sender][hashToApprove] = 1;\n emit ApproveHash(hashToApprove, msg.sender);\n }\n\n /// @dev Returns the chain id used by this contract.\n function getChainId() public view returns (uint256) {\n uint256 id;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n id := chainid()\n }\n return id;\n }\n\n function domainSeparator() public view returns (bytes32) {\n return keccak256(abi.encode(DOMAIN_SEPARATOR_TYPEHASH, getChainId(), this));\n }\n\n /// @dev Returns the bytes that are hashed to be signed by owners.\n /// @param to Destination address.\n /// @param value Ether value.\n /// @param data Data payload.\n /// @param operation Operation type.\n /// @param safeTxGas Gas that should be used for the safe transaction.\n /// @param baseGas Gas costs for that are independent of the transaction execution(e.g. base transaction fee, signature check, payment of the refund)\n /// @param gasPrice Maximum gas price that should be used for this transaction.\n /// @param gasToken Token address (or 0 if ETH) that is used for the payment.\n /// @param refundReceiver Address of receiver of gas payment (or 0 if tx.origin).\n /// @param _nonce Transaction nonce.\n /// @return Transaction hash bytes.\n function encodeTransactionData(\n address to,\n uint256 value,\n bytes calldata data,\n Enum.Operation operation,\n uint256 safeTxGas,\n uint256 baseGas,\n uint256 gasPrice,\n address gasToken,\n address refundReceiver,\n uint256 _nonce\n ) public view returns (bytes memory) {\n bytes32 safeTxHash =\n keccak256(\n abi.encode(\n SAFE_TX_TYPEHASH,\n to,\n value,\n keccak256(data),\n operation,\n safeTxGas,\n baseGas,\n gasPrice,\n gasToken,\n refundReceiver,\n _nonce\n )\n );\n return abi.encodePacked(bytes1(0x19), bytes1(0x01), domainSeparator(), safeTxHash);\n }\n\n /// @dev Returns hash to be signed by owners.\n /// @param to Destination address.\n /// @param value Ether value.\n /// @param data Data payload.\n /// @param operation Operation type.\n /// @param safeTxGas Fas that should be used for the safe transaction.\n /// @param baseGas Gas costs for data used to trigger the safe transaction.\n /// @param gasPrice Maximum gas price that should be used for this transaction.\n /// @param gasToken Token address (or 0 if ETH) that is used for the payment.\n /// @param refundReceiver Address of receiver of gas payment (or 0 if tx.origin).\n /// @param _nonce Transaction nonce.\n /// @return Transaction hash.\n function getTransactionHash(\n address to,\n uint256 value,\n bytes calldata data,\n Enum.Operation operation,\n uint256 safeTxGas,\n uint256 baseGas,\n uint256 gasPrice,\n address gasToken,\n address refundReceiver,\n uint256 _nonce\n ) public view returns (bytes32) {\n return keccak256(encodeTransactionData(to, value, data, operation, safeTxGas, baseGas, gasPrice, gasToken, refundReceiver, _nonce));\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/GnosisSafeL2.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"./GnosisSafe.sol\";\n\n/// @title Gnosis Safe - A multisignature wallet with support for confirmations using signed messages based on ERC191.\n/// @author Stefan George - \n/// @author Richard Meissner - \ncontract GnosisSafeL2 is GnosisSafe {\n event SafeMultiSigTransaction(\n address to,\n uint256 value,\n bytes data,\n Enum.Operation operation,\n uint256 safeTxGas,\n uint256 baseGas,\n uint256 gasPrice,\n address gasToken,\n address payable refundReceiver,\n bytes signatures,\n // We combine nonce, sender and threshold into one to avoid stack too deep\n // Dev note: additionalInfo should not contain `bytes`, as this complicates decoding\n bytes additionalInfo\n );\n\n event SafeModuleTransaction(address module, address to, uint256 value, bytes data, Enum.Operation operation);\n\n /// @dev Allows to execute a Safe transaction confirmed by required number of owners and then pays the account that submitted the transaction.\n /// Note: The fees are always transferred, even if the user transaction fails.\n /// @param to Destination address of Safe transaction.\n /// @param value Ether value of Safe transaction.\n /// @param data Data payload of Safe transaction.\n /// @param operation Operation type of Safe transaction.\n /// @param safeTxGas Gas that should be used for the Safe transaction.\n /// @param baseGas Gas costs that are independent of the transaction execution(e.g. base transaction fee, signature check, payment of the refund)\n /// @param gasPrice Gas price that should be used for the payment calculation.\n /// @param gasToken Token address (or 0 if ETH) that is used for the payment.\n /// @param refundReceiver Address of receiver of gas payment (or 0 if tx.origin).\n /// @param signatures Packed signature data ({bytes32 r}{bytes32 s}{uint8 v})\n function execTransaction(\n address to,\n uint256 value,\n bytes calldata data,\n Enum.Operation operation,\n uint256 safeTxGas,\n uint256 baseGas,\n uint256 gasPrice,\n address gasToken,\n address payable refundReceiver,\n bytes memory signatures\n ) public payable override returns (bool) {\n bytes memory additionalInfo;\n {\n additionalInfo = abi.encode(nonce, msg.sender, threshold);\n }\n emit SafeMultiSigTransaction(\n to,\n value,\n data,\n operation,\n safeTxGas,\n baseGas,\n gasPrice,\n gasToken,\n refundReceiver,\n signatures,\n additionalInfo\n );\n return super.execTransaction(to, value, data, operation, safeTxGas, baseGas, gasPrice, gasToken, refundReceiver, signatures);\n }\n\n /// @dev Allows a Module to execute a Safe transaction without any further confirmations.\n /// @param to Destination address of module transaction.\n /// @param value Ether value of module transaction.\n /// @param data Data payload of module transaction.\n /// @param operation Operation type of module transaction.\n function execTransactionFromModule(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation\n ) public override returns (bool success) {\n emit SafeModuleTransaction(msg.sender, to, value, data, operation);\n success = super.execTransactionFromModule(to, value, data, operation);\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/interfaces/ISignatureValidator.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\ncontract ISignatureValidatorConstants {\n // bytes4(keccak256(\"isValidSignature(bytes,bytes)\")\n bytes4 internal constant EIP1271_MAGIC_VALUE = 0x20c13b0b;\n}\n\nabstract contract ISignatureValidator is ISignatureValidatorConstants {\n /**\n * @dev Should return whether the signature provided is valid for the provided data\n * @param _data Arbitrary length data signed on the behalf of address(this)\n * @param _signature Signature byte array associated with _data\n *\n * MUST return the bytes4 magic value 0x20c13b0b when function passes.\n * MUST NOT modify state (using STATICCALL for solc < 0.5, view modifier for solc > 0.5)\n * MUST allow external calls\n */\n function isValidSignature(bytes memory _data, bytes memory _signature) public view virtual returns (bytes4);\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/libraries/MultiSendCallOnly.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\n/// @title Multi Send Call Only - Allows to batch multiple transactions into one, but only calls\n/// @author Stefan George - \n/// @author Richard Meissner - \n/// @notice The guard logic is not required here as this contract doesn't support nested delegate calls\ncontract MultiSendCallOnly {\n /// @dev Sends multiple transactions and reverts all if one fails.\n /// @param transactions Encoded transactions. Each transaction is encoded as a packed bytes of\n /// operation has to be uint8(0) in this version (=> 1 byte),\n /// to as a address (=> 20 bytes),\n /// value as a uint256 (=> 32 bytes),\n /// data length as a uint256 (=> 32 bytes),\n /// data as bytes.\n /// see abi.encodePacked for more information on packed encoding\n /// @notice The code is for most part the same as the normal MultiSend (to keep compatibility),\n /// but reverts if a transaction tries to use a delegatecall.\n /// @notice This method is payable as delegatecalls keep the msg.value from the previous call\n /// If the calling method (e.g. execTransaction) received ETH this would revert otherwise\n function multiSend(bytes memory transactions) public payable {\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let length := mload(transactions)\n let i := 0x20\n for {\n // Pre block is not used in \"while mode\"\n } lt(i, length) {\n // Post block is not used in \"while mode\"\n } {\n // First byte of the data is the operation.\n // We shift by 248 bits (256 - 8 [operation byte]) it right since mload will always load 32 bytes (a word).\n // This will also zero out unused data.\n let operation := shr(0xf8, mload(add(transactions, i)))\n // We offset the load address by 1 byte (operation byte)\n // We shift it right by 96 bits (256 - 160 [20 address bytes]) to right-align the data and zero out unused data.\n let to := shr(0x60, mload(add(transactions, add(i, 0x01))))\n // We offset the load address by 21 byte (operation byte + 20 address bytes)\n let value := mload(add(transactions, add(i, 0x15)))\n // We offset the load address by 53 byte (operation byte + 20 address bytes + 32 value bytes)\n let dataLength := mload(add(transactions, add(i, 0x35)))\n // We offset the load address by 85 byte (operation byte + 20 address bytes + 32 value bytes + 32 data length bytes)\n let data := add(transactions, add(i, 0x55))\n let success := 0\n switch operation\n case 0 {\n success := call(gas(), to, value, data, dataLength, 0, 0)\n }\n // This version does not allow delegatecalls\n case 1 {\n revert(0, 0)\n }\n if eq(success, 0) {\n revert(0, 0)\n }\n // Next entry starts at 85 byte + data length\n i := add(i, add(0x55, dataLength))\n }\n }\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/proxies/GnosisSafeProxy.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\n/// @title IProxy - Helper interface to access masterCopy of the Proxy on-chain\n/// @author Richard Meissner - \ninterface IProxy {\n function masterCopy() external view returns (address);\n}\n\n/// @title GnosisSafeProxy - Generic proxy contract allows to execute all transactions applying the code of a master contract.\n/// @author Stefan George - \n/// @author Richard Meissner - \ncontract GnosisSafeProxy {\n // 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.\n // To reduce deployment costs this variable is internal and needs to be retrieved via `getStorageAt`\n address internal singleton;\n\n /// @dev Constructor function sets address of singleton contract.\n /// @param _singleton Singleton address.\n constructor(address _singleton) {\n require(_singleton != address(0), \"Invalid singleton address provided\");\n singleton = _singleton;\n }\n\n /// @dev Fallback function forwards all transactions and returns all received return data.\n fallback() external payable {\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let _singleton := and(sload(0), 0xffffffffffffffffffffffffffffffffffffffff)\n // 0xa619486e == keccak(\"masterCopy()\"). The value is right padded to 32-bytes with 0s\n if eq(calldataload(0), 0xa619486e00000000000000000000000000000000000000000000000000000000) {\n mstore(0, _singleton)\n return(0, 0x20)\n }\n calldatacopy(0, 0, calldatasize())\n let success := delegatecall(gas(), _singleton, 0, calldatasize(), 0, 0)\n returndatacopy(0, 0, returndatasize())\n if eq(success, 0) {\n revert(0, returndatasize())\n }\n return(0, returndatasize())\n }\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/proxies/GnosisSafeProxyFactory.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"./GnosisSafeProxy.sol\";\nimport \"./IProxyCreationCallback.sol\";\n\n/// @title Proxy Factory - Allows to create new proxy contact and execute a message call to the new proxy within one transaction.\n/// @author Stefan George - \ncontract GnosisSafeProxyFactory {\n event ProxyCreation(GnosisSafeProxy proxy, address singleton);\n\n /// @dev Allows to create new proxy contact and execute a message call to the new proxy within one transaction.\n /// @param singleton Address of singleton contract.\n /// @param data Payload for message call sent to new proxy contract.\n function createProxy(address singleton, bytes memory data) public returns (GnosisSafeProxy proxy) {\n proxy = new GnosisSafeProxy(singleton);\n if (data.length > 0)\n // solhint-disable-next-line no-inline-assembly\n assembly {\n if eq(call(gas(), proxy, 0, add(data, 0x20), mload(data), 0, 0), 0) {\n revert(0, 0)\n }\n }\n emit ProxyCreation(proxy, singleton);\n }\n\n /// @dev Allows to retrieve the runtime code of a deployed Proxy. This can be used to check that the expected Proxy was deployed.\n function proxyRuntimeCode() public pure returns (bytes memory) {\n return type(GnosisSafeProxy).runtimeCode;\n }\n\n /// @dev Allows to retrieve the creation code used for the Proxy deployment. With this it is easily possible to calculate predicted address.\n function proxyCreationCode() public pure returns (bytes memory) {\n return type(GnosisSafeProxy).creationCode;\n }\n\n /// @dev Allows to create new proxy contact using CREATE2 but it doesn't run the initializer.\n /// This method is only meant as an utility to be called from other methods\n /// @param _singleton Address of singleton contract.\n /// @param initializer Payload for message call sent to new proxy contract.\n /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract.\n function deployProxyWithNonce(\n address _singleton,\n bytes memory initializer,\n uint256 saltNonce\n ) internal returns (GnosisSafeProxy proxy) {\n // If the initializer changes the proxy address should change too. Hashing the initializer data is cheaper than just concatinating it\n bytes32 salt = keccak256(abi.encodePacked(keccak256(initializer), saltNonce));\n bytes memory deploymentData = abi.encodePacked(type(GnosisSafeProxy).creationCode, uint256(uint160(_singleton)));\n // solhint-disable-next-line no-inline-assembly\n assembly {\n proxy := create2(0x0, add(0x20, deploymentData), mload(deploymentData), salt)\n }\n require(address(proxy) != address(0), \"Create2 call failed\");\n }\n\n /// @dev Allows to create new proxy contact and execute a message call to the new proxy within one transaction.\n /// @param _singleton Address of singleton contract.\n /// @param initializer Payload for message call sent to new proxy contract.\n /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract.\n function createProxyWithNonce(\n address _singleton,\n bytes memory initializer,\n uint256 saltNonce\n ) public returns (GnosisSafeProxy proxy) {\n proxy = deployProxyWithNonce(_singleton, initializer, saltNonce);\n if (initializer.length > 0)\n // solhint-disable-next-line no-inline-assembly\n assembly {\n if eq(call(gas(), proxy, 0, add(initializer, 0x20), mload(initializer), 0, 0), 0) {\n revert(0, 0)\n }\n }\n emit ProxyCreation(proxy, _singleton);\n }\n\n /// @dev Allows to create new proxy contact, execute a message call to the new proxy and call a specified callback within one transaction\n /// @param _singleton Address of singleton contract.\n /// @param initializer Payload for message call sent to new proxy contract.\n /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract.\n /// @param callback Callback that will be invoced after the new proxy contract has been successfully deployed and initialized.\n function createProxyWithCallback(\n address _singleton,\n bytes memory initializer,\n uint256 saltNonce,\n IProxyCreationCallback callback\n ) public returns (GnosisSafeProxy proxy) {\n uint256 saltNonceWithCallback = uint256(keccak256(abi.encodePacked(saltNonce, callback)));\n proxy = createProxyWithNonce(_singleton, initializer, saltNonceWithCallback);\n if (address(callback) != address(0)) callback.proxyCreated(proxy, _singleton, initializer, saltNonce);\n }\n\n /// @dev Allows to get the address for a new proxy contact created via `createProxyWithNonce`\n /// This method is only meant for address calculation purpose when you use an initializer that would revert,\n /// therefore the response is returned with a revert. When calling this method set `from` to the address of the proxy factory.\n /// @param _singleton Address of singleton contract.\n /// @param initializer Payload for message call sent to new proxy contract.\n /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract.\n function calculateCreateProxyWithNonceAddress(\n address _singleton,\n bytes calldata initializer,\n uint256 saltNonce\n ) external returns (GnosisSafeProxy proxy) {\n proxy = deployProxyWithNonce(_singleton, initializer, saltNonce);\n revert(string(abi.encodePacked(proxy)));\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/proxies/IProxyCreationCallback.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\nimport \"./GnosisSafeProxy.sol\";\n\ninterface IProxyCreationCallback {\n function proxyCreated(\n GnosisSafeProxy proxy,\n address _singleton,\n bytes calldata initializer,\n uint256 saltNonce\n ) external;\n}\n" + }, + "@gnosis.pm/zodiac/contracts/core/Module.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\n\n/// @title Module Interface - A contract that can pass messages to a Module Manager contract if enabled by that contract.\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"../interfaces/IAvatar.sol\";\nimport \"../factory/FactoryFriendly.sol\";\nimport \"../guard/Guardable.sol\";\n\nabstract contract Module is FactoryFriendly, Guardable {\n /// @dev Address that will ultimately execute function calls.\n address public avatar;\n /// @dev Address that this module will pass transactions to.\n address public target;\n\n /// @dev Emitted each time the avatar is set.\n event AvatarSet(address indexed previousAvatar, address indexed newAvatar);\n /// @dev Emitted each time the Target is set.\n event TargetSet(address indexed previousTarget, address indexed newTarget);\n\n /// @dev Sets the avatar to a new avatar (`newAvatar`).\n /// @notice Can only be called by the current owner.\n function setAvatar(address _avatar) public onlyOwner {\n address previousAvatar = avatar;\n avatar = _avatar;\n emit AvatarSet(previousAvatar, _avatar);\n }\n\n /// @dev Sets the target to a new target (`newTarget`).\n /// @notice Can only be called by the current owner.\n function setTarget(address _target) public onlyOwner {\n address previousTarget = target;\n target = _target;\n emit TargetSet(previousTarget, _target);\n }\n\n /// @dev Passes a transaction to be executed by the avatar.\n /// @notice Can only be called by this contract.\n /// @param to Destination address of module transaction.\n /// @param value Ether value of module transaction.\n /// @param data Data payload of module transaction.\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\n function exec(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation\n ) internal returns (bool success) {\n /// Check if a transactioon guard is enabled.\n if (guard != address(0)) {\n IGuard(guard).checkTransaction(\n /// Transaction info used by module transactions.\n to,\n value,\n data,\n operation,\n /// Zero out the redundant transaction information only used for Safe multisig transctions.\n 0,\n 0,\n 0,\n address(0),\n payable(0),\n bytes(\"0x\"),\n msg.sender\n );\n }\n success = IAvatar(target).execTransactionFromModule(\n to,\n value,\n data,\n operation\n );\n if (guard != address(0)) {\n IGuard(guard).checkAfterExecution(bytes32(\"0x\"), success);\n }\n return success;\n }\n\n /// @dev Passes a transaction to be executed by the target and returns data.\n /// @notice Can only be called by this contract.\n /// @param to Destination address of module transaction.\n /// @param value Ether value of module transaction.\n /// @param data Data payload of module transaction.\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\n function execAndReturnData(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation\n ) internal returns (bool success, bytes memory returnData) {\n /// Check if a transactioon guard is enabled.\n if (guard != address(0)) {\n IGuard(guard).checkTransaction(\n /// Transaction info used by module transactions.\n to,\n value,\n data,\n operation,\n /// Zero out the redundant transaction information only used for Safe multisig transctions.\n 0,\n 0,\n 0,\n address(0),\n payable(0),\n bytes(\"0x\"),\n msg.sender\n );\n }\n (success, returnData) = IAvatar(target)\n .execTransactionFromModuleReturnData(to, value, data, operation);\n if (guard != address(0)) {\n IGuard(guard).checkAfterExecution(bytes32(\"0x\"), success);\n }\n return (success, returnData);\n }\n}\n" + }, + "@gnosis.pm/zodiac/contracts/factory/FactoryFriendly.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\n\n/// @title Zodiac FactoryFriendly - A contract that allows other contracts to be initializable and pass bytes as arguments to define contract state\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\n\nabstract contract FactoryFriendly is OwnableUpgradeable {\n function setUp(bytes memory initializeParams) public virtual;\n}\n" + }, + "@gnosis.pm/zodiac/contracts/factory/ModuleProxyFactory.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.8.0;\n\ncontract ModuleProxyFactory {\n event ModuleProxyCreation(\n address indexed proxy,\n address indexed masterCopy\n );\n\n /// `target` can not be zero.\n error ZeroAddress(address target);\n\n /// `address_` is already taken.\n error TakenAddress(address address_);\n\n /// @notice Initialization failed.\n error FailedInitialization();\n\n function createProxy(address target, bytes32 salt)\n internal\n returns (address result)\n {\n if (address(target) == address(0)) revert ZeroAddress(target);\n bytes memory deployment = abi.encodePacked(\n hex\"602d8060093d393df3363d3d373d3d3d363d73\",\n target,\n hex\"5af43d82803e903d91602b57fd5bf3\"\n );\n // solhint-disable-next-line no-inline-assembly\n assembly {\n result := create2(0, add(deployment, 0x20), mload(deployment), salt)\n }\n if (result == address(0)) revert TakenAddress(result);\n }\n\n function deployModule(\n address masterCopy,\n bytes memory initializer,\n uint256 saltNonce\n ) public returns (address proxy) {\n proxy = createProxy(\n masterCopy,\n keccak256(abi.encodePacked(keccak256(initializer), saltNonce))\n );\n (bool success, ) = proxy.call(initializer);\n if (!success) revert FailedInitialization();\n\n emit ModuleProxyCreation(proxy, masterCopy);\n }\n}\n" + }, + "@gnosis.pm/zodiac/contracts/guard/BaseGuard.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"../interfaces/IGuard.sol\";\n\nabstract contract BaseGuard is IERC165 {\n function supportsInterface(bytes4 interfaceId)\n external\n pure\n override\n returns (bool)\n {\n return\n interfaceId == type(IGuard).interfaceId || // 0xe6d7a83a\n interfaceId == type(IERC165).interfaceId; // 0x01ffc9a7\n }\n\n /// @dev Module transactions only use the first four parameters: to, value, data, and operation.\n /// Module.sol hardcodes the remaining parameters as 0 since they are not used for module transactions.\n /// @notice This interface is used to maintain compatibilty with Gnosis Safe transaction guards.\n function checkTransaction(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation,\n uint256 safeTxGas,\n uint256 baseGas,\n uint256 gasPrice,\n address gasToken,\n address payable refundReceiver,\n bytes memory signatures,\n address msgSender\n ) external virtual;\n\n function checkAfterExecution(bytes32 txHash, bool success) external virtual;\n}\n" + }, + "@gnosis.pm/zodiac/contracts/guard/Guardable.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\";\nimport \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport \"./BaseGuard.sol\";\n\n/// @title Guardable - A contract that manages fallback calls made to this contract\ncontract Guardable is OwnableUpgradeable {\n address public guard;\n\n event ChangedGuard(address guard);\n\n /// `guard_` does not implement IERC165.\n error NotIERC165Compliant(address guard_);\n\n /// @dev Set a guard that checks transactions before execution.\n /// @param _guard The address of the guard to be used or the 0 address to disable the guard.\n function setGuard(address _guard) external onlyOwner {\n if (_guard != address(0)) {\n if (!BaseGuard(_guard).supportsInterface(type(IGuard).interfaceId))\n revert NotIERC165Compliant(_guard);\n }\n guard = _guard;\n emit ChangedGuard(guard);\n }\n\n function getGuard() external view returns (address _guard) {\n return guard;\n }\n}\n" + }, + "@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\n\n/// @title Zodiac Avatar - A contract that manages modules that can execute transactions via this contract.\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\";\n\ninterface IAvatar {\n event EnabledModule(address module);\n event DisabledModule(address module);\n event ExecutionFromModuleSuccess(address indexed module);\n event ExecutionFromModuleFailure(address indexed module);\n\n /// @dev Enables a module on the avatar.\n /// @notice Can only be called by the avatar.\n /// @notice Modules should be stored as a linked list.\n /// @notice Must emit EnabledModule(address module) if successful.\n /// @param module Module to be enabled.\n function enableModule(address module) external;\n\n /// @dev Disables a module on the avatar.\n /// @notice Can only be called by the avatar.\n /// @notice Must emit DisabledModule(address module) if successful.\n /// @param prevModule Address that pointed to the module to be removed in the linked list\n /// @param module Module to be removed.\n function disableModule(address prevModule, address module) external;\n\n /// @dev Allows a Module to execute a transaction.\n /// @notice Can only be called by an enabled module.\n /// @notice Must emit ExecutionFromModuleSuccess(address module) if successful.\n /// @notice Must emit ExecutionFromModuleFailure(address module) if unsuccessful.\n /// @param to Destination address of module transaction.\n /// @param value Ether value of module transaction.\n /// @param data Data payload of module transaction.\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\n function execTransactionFromModule(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation\n ) external returns (bool success);\n\n /// @dev Allows a Module to execute a transaction and return data\n /// @notice Can only be called by an enabled module.\n /// @notice Must emit ExecutionFromModuleSuccess(address module) if successful.\n /// @notice Must emit ExecutionFromModuleFailure(address module) if unsuccessful.\n /// @param to Destination address of module transaction.\n /// @param value Ether value of module transaction.\n /// @param data Data payload of module transaction.\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\n function execTransactionFromModuleReturnData(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation\n ) external returns (bool success, bytes memory returnData);\n\n /// @dev Returns if an module is enabled\n /// @return True if the module is enabled\n function isModuleEnabled(address module) external view returns (bool);\n\n /// @dev Returns array of modules.\n /// @param start Start of the page.\n /// @param pageSize Maximum number of modules that should be returned.\n /// @return array Array of modules.\n /// @return next Start of the next page.\n function getModulesPaginated(address start, uint256 pageSize)\n external\n view\n returns (address[] memory array, address next);\n}\n" + }, + "@gnosis.pm/zodiac/contracts/interfaces/IGuard.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\";\n\ninterface IGuard {\n function checkTransaction(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation,\n uint256 safeTxGas,\n uint256 baseGas,\n uint256 gasPrice,\n address gasToken,\n address payable refundReceiver,\n bytes memory signatures,\n address msgSender\n ) external;\n\n function checkAfterExecution(bytes32 txHash, bool success) external;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../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 * 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 OwnableUpgradeable is Initializable, ContextUpgradeable {\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 function __Ownable_init() internal onlyInitializing {\n __Ownable_init_unchained();\n }\n\n function __Ownable_init_unchained() internal onlyInitializing {\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 anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing 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 /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/governance/utils/IVotesUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (governance/utils/IVotes.sol)\npragma solidity ^0.8.0;\n\n/**\n * @dev Common interface for {ERC20Votes}, {ERC721Votes}, and other {Votes}-enabled contracts.\n *\n * _Available since v4.5._\n */\ninterface IVotesUpgradeable {\n /**\n * @dev Emitted when an account changes their delegate.\n */\n event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);\n\n /**\n * @dev Emitted when a token transfer or delegate change results in changes to a delegate's number of votes.\n */\n event DelegateVotesChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance);\n\n /**\n * @dev Returns the current amount of votes that `account` has.\n */\n function getVotes(address account) external view returns (uint256);\n\n /**\n * @dev Returns the amount of votes that `account` had at the end of a past block (`blockNumber`).\n */\n function getPastVotes(address account, uint256 blockNumber) external view returns (uint256);\n\n /**\n * @dev Returns the total supply of votes available at the end of a past block (`blockNumber`).\n *\n * NOTE: This value is the sum of all available votes, which is not necessarily the sum of all delegated votes.\n * Votes that have not been delegated are still part of total supply, even though they would not participate in a\n * vote.\n */\n function getPastTotalSupply(uint256 blockNumber) external view returns (uint256);\n\n /**\n * @dev Returns the delegate that `account` has chosen.\n */\n function delegates(address account) external view returns (address);\n\n /**\n * @dev Delegates votes from the sender to `delegatee`.\n */\n function delegate(address delegatee) external;\n\n /**\n * @dev Delegates votes from signer to `delegatee`.\n */\n function delegateBySig(\n address delegatee,\n uint256 nonce,\n uint256 expiry,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\n * initialization step. This is essential to configure modules that are added through upgrades and that require\n * initialization.\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 modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized < type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20Upgradeable.sol\";\nimport \"./extensions/IERC20MetadataUpgradeable.sol\";\nimport \"../../utils/ContextUpgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20Upgradeable, IERC20MetadataUpgradeable {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n function __ERC20_init(string memory name_, string memory symbol_) internal onlyInitializing {\n __ERC20_init_unchained(name_, symbol_);\n }\n\n function __ERC20_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n }\n _balances[to] += amount;\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n _balances[account] += amount;\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n }\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[45] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-ERC20PermitUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/extensions/draft-ERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./draft-IERC20PermitUpgradeable.sol\";\nimport \"../ERC20Upgradeable.sol\";\nimport \"../../../utils/cryptography/draft-EIP712Upgradeable.sol\";\nimport \"../../../utils/cryptography/ECDSAUpgradeable.sol\";\nimport \"../../../utils/CountersUpgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation 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 * _Available since v3.4._\n *\n * @custom:storage-size 51\n */\nabstract contract ERC20PermitUpgradeable is Initializable, ERC20Upgradeable, IERC20PermitUpgradeable, EIP712Upgradeable {\n using CountersUpgradeable for CountersUpgradeable.Counter;\n\n mapping(address => CountersUpgradeable.Counter) private _nonces;\n\n // solhint-disable-next-line var-name-mixedcase\n bytes32 private constant _PERMIT_TYPEHASH =\n keccak256(\"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\");\n /**\n * @dev In previous versions `_PERMIT_TYPEHASH` was declared as `immutable`.\n * However, to ensure consistency with the upgradeable transpiler, we will continue\n * to reserve a slot.\n * @custom:oz-renamed-from _PERMIT_TYPEHASH\n */\n // solhint-disable-next-line var-name-mixedcase\n bytes32 private _PERMIT_TYPEHASH_DEPRECATED_SLOT;\n\n /**\n * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `\"1\"`.\n *\n * It's a good idea to use the same `name` that is defined as the ERC20 token name.\n */\n function __ERC20Permit_init(string memory name) internal onlyInitializing {\n __EIP712_init_unchained(name, \"1\");\n }\n\n function __ERC20Permit_init_unchained(string memory) internal onlyInitializing {}\n\n /**\n * @dev See {IERC20Permit-permit}.\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 ) public virtual override {\n require(block.timestamp <= deadline, \"ERC20Permit: expired deadline\");\n\n bytes32 structHash = keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline));\n\n bytes32 hash = _hashTypedDataV4(structHash);\n\n address signer = ECDSAUpgradeable.recover(hash, v, r, s);\n require(signer == owner, \"ERC20Permit: invalid signature\");\n\n _approve(owner, spender, value);\n }\n\n /**\n * @dev See {IERC20Permit-nonces}.\n */\n function nonces(address owner) public view virtual override returns (uint256) {\n return _nonces[owner].current();\n }\n\n /**\n * @dev See {IERC20Permit-DOMAIN_SEPARATOR}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view override returns (bytes32) {\n return _domainSeparatorV4();\n }\n\n /**\n * @dev \"Consume a nonce\": return the current value and increment.\n *\n * _Available since v4.1._\n */\n function _useNonce(address owner) internal virtual returns (uint256 current) {\n CountersUpgradeable.Counter storage nonce = _nonces[owner];\n current = nonce.current();\n nonce.increment();\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\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 */\ninterface IERC20PermitUpgradeable {\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 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-upgradeable/token/ERC20/extensions/ERC20SnapshotUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/extensions/ERC20Snapshot.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC20Upgradeable.sol\";\nimport \"../../../utils/ArraysUpgradeable.sol\";\nimport \"../../../utils/CountersUpgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev This contract extends an ERC20 token with a snapshot mechanism. When a snapshot is created, the balances and\n * total supply at the time are recorded for later access.\n *\n * This can be used to safely create mechanisms based on token balances such as trustless dividends or weighted voting.\n * In naive implementations it's possible to perform a \"double spend\" attack by reusing the same balance from different\n * accounts. By using snapshots to calculate dividends or voting power, those attacks no longer apply. It can also be\n * used to create an efficient ERC20 forking mechanism.\n *\n * Snapshots are created by the internal {_snapshot} function, which will emit the {Snapshot} event and return a\n * snapshot id. To get the total supply at the time of a snapshot, call the function {totalSupplyAt} with the snapshot\n * id. To get the balance of an account at the time of a snapshot, call the {balanceOfAt} function with the snapshot id\n * and the account address.\n *\n * NOTE: Snapshot policy can be customized by overriding the {_getCurrentSnapshotId} method. For example, having it\n * return `block.number` will trigger the creation of snapshot at the beginning of each new block. When overriding this\n * function, be careful about the monotonicity of its result. Non-monotonic snapshot ids will break the contract.\n *\n * Implementing snapshots for every block using this method will incur significant gas costs. For a gas-efficient\n * alternative consider {ERC20Votes}.\n *\n * ==== Gas Costs\n *\n * Snapshots are efficient. Snapshot creation is _O(1)_. Retrieval of balances or total supply from a snapshot is _O(log\n * n)_ in the number of snapshots that have been created, although _n_ for a specific account will generally be much\n * smaller since identical balances in subsequent snapshots are stored as a single entry.\n *\n * There is a constant overhead for normal ERC20 transfers due to the additional snapshot bookkeeping. This overhead is\n * only significant for the first transfer that immediately follows a snapshot for a particular account. Subsequent\n * transfers will have normal cost until the next snapshot, and so on.\n */\n\nabstract contract ERC20SnapshotUpgradeable is Initializable, ERC20Upgradeable {\n function __ERC20Snapshot_init() internal onlyInitializing {\n }\n\n function __ERC20Snapshot_init_unchained() internal onlyInitializing {\n }\n // Inspired by Jordi Baylina's MiniMeToken to record historical balances:\n // https://github.com/Giveth/minime/blob/ea04d950eea153a04c51fa510b068b9dded390cb/contracts/MiniMeToken.sol\n\n using ArraysUpgradeable for uint256[];\n using CountersUpgradeable for CountersUpgradeable.Counter;\n\n // Snapshotted values have arrays of ids and the value corresponding to that id. These could be an array of a\n // Snapshot struct, but that would impede usage of functions that work on an array.\n struct Snapshots {\n uint256[] ids;\n uint256[] values;\n }\n\n mapping(address => Snapshots) private _accountBalanceSnapshots;\n Snapshots private _totalSupplySnapshots;\n\n // Snapshot ids increase monotonically, with the first value being 1. An id of 0 is invalid.\n CountersUpgradeable.Counter private _currentSnapshotId;\n\n /**\n * @dev Emitted by {_snapshot} when a snapshot identified by `id` is created.\n */\n event Snapshot(uint256 id);\n\n /**\n * @dev Creates a new snapshot and returns its snapshot id.\n *\n * Emits a {Snapshot} event that contains the same id.\n *\n * {_snapshot} is `internal` and you have to decide how to expose it externally. Its usage may be restricted to a\n * set of accounts, for example using {AccessControl}, or it may be open to the public.\n *\n * [WARNING]\n * ====\n * While an open way of calling {_snapshot} is required for certain trust minimization mechanisms such as forking,\n * you must consider that it can potentially be used by attackers in two ways.\n *\n * First, it can be used to increase the cost of retrieval of values from snapshots, although it will grow\n * logarithmically thus rendering this attack ineffective in the long term. Second, it can be used to target\n * specific accounts and increase the cost of ERC20 transfers for them, in the ways specified in the Gas Costs\n * section above.\n *\n * We haven't measured the actual numbers; if this is something you're interested in please reach out to us.\n * ====\n */\n function _snapshot() internal virtual returns (uint256) {\n _currentSnapshotId.increment();\n\n uint256 currentId = _getCurrentSnapshotId();\n emit Snapshot(currentId);\n return currentId;\n }\n\n /**\n * @dev Get the current snapshotId\n */\n function _getCurrentSnapshotId() internal view virtual returns (uint256) {\n return _currentSnapshotId.current();\n }\n\n /**\n * @dev Retrieves the balance of `account` at the time `snapshotId` was created.\n */\n function balanceOfAt(address account, uint256 snapshotId) public view virtual returns (uint256) {\n (bool snapshotted, uint256 value) = _valueAt(snapshotId, _accountBalanceSnapshots[account]);\n\n return snapshotted ? value : balanceOf(account);\n }\n\n /**\n * @dev Retrieves the total supply at the time `snapshotId` was created.\n */\n function totalSupplyAt(uint256 snapshotId) public view virtual returns (uint256) {\n (bool snapshotted, uint256 value) = _valueAt(snapshotId, _totalSupplySnapshots);\n\n return snapshotted ? value : totalSupply();\n }\n\n // Update balance and/or total supply snapshots before the values are modified. This is implemented\n // in the _beforeTokenTransfer hook, which is executed for _mint, _burn, and _transfer operations.\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual override {\n super._beforeTokenTransfer(from, to, amount);\n\n if (from == address(0)) {\n // mint\n _updateAccountSnapshot(to);\n _updateTotalSupplySnapshot();\n } else if (to == address(0)) {\n // burn\n _updateAccountSnapshot(from);\n _updateTotalSupplySnapshot();\n } else {\n // transfer\n _updateAccountSnapshot(from);\n _updateAccountSnapshot(to);\n }\n }\n\n function _valueAt(uint256 snapshotId, Snapshots storage snapshots) private view returns (bool, uint256) {\n require(snapshotId > 0, \"ERC20Snapshot: id is 0\");\n require(snapshotId <= _getCurrentSnapshotId(), \"ERC20Snapshot: nonexistent id\");\n\n // When a valid snapshot is queried, there are three possibilities:\n // a) The queried value was not modified after the snapshot was taken. Therefore, a snapshot entry was never\n // created for this id, and all stored snapshot ids are smaller than the requested one. The value that corresponds\n // to this id is the current one.\n // b) The queried value was modified after the snapshot was taken. Therefore, there will be an entry with the\n // requested id, and its value is the one to return.\n // c) More snapshots were created after the requested one, and the queried value was later modified. There will be\n // no entry for the requested id: the value that corresponds to it is that of the smallest snapshot id that is\n // larger than the requested one.\n //\n // In summary, we need to find an element in an array, returning the index of the smallest value that is larger if\n // it is not found, unless said value doesn't exist (e.g. when all values are smaller). Arrays.findUpperBound does\n // exactly this.\n\n uint256 index = snapshots.ids.findUpperBound(snapshotId);\n\n if (index == snapshots.ids.length) {\n return (false, 0);\n } else {\n return (true, snapshots.values[index]);\n }\n }\n\n function _updateAccountSnapshot(address account) private {\n _updateSnapshot(_accountBalanceSnapshots[account], balanceOf(account));\n }\n\n function _updateTotalSupplySnapshot() private {\n _updateSnapshot(_totalSupplySnapshots, totalSupply());\n }\n\n function _updateSnapshot(Snapshots storage snapshots, uint256 currentValue) private {\n uint256 currentId = _getCurrentSnapshotId();\n if (_lastSnapshotId(snapshots.ids) < currentId) {\n snapshots.ids.push(currentId);\n snapshots.values.push(currentValue);\n }\n }\n\n function _lastSnapshotId(uint256[] storage ids) private view returns (uint256) {\n if (ids.length == 0) {\n return 0;\n } else {\n return ids[ids.length - 1];\n }\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[46] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20VotesUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/extensions/ERC20Votes.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./draft-ERC20PermitUpgradeable.sol\";\nimport \"../../../utils/math/MathUpgradeable.sol\";\nimport \"../../../governance/utils/IVotesUpgradeable.sol\";\nimport \"../../../utils/math/SafeCastUpgradeable.sol\";\nimport \"../../../utils/cryptography/ECDSAUpgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Extension of ERC20 to support Compound-like voting and delegation. This version is more generic than Compound's,\n * and supports token supply up to 2^224^ - 1, while COMP is limited to 2^96^ - 1.\n *\n * NOTE: If exact COMP compatibility is required, use the {ERC20VotesComp} variant of this module.\n *\n * This extension keeps a history (checkpoints) of each account's vote power. Vote power can be delegated either\n * by calling the {delegate} function directly, or by providing a signature to be used with {delegateBySig}. Voting\n * power can be queried through the public accessors {getVotes} and {getPastVotes}.\n *\n * By default, token balance does not account for voting power. This makes transfers cheaper. The downside is that it\n * requires users to delegate to themselves in order to activate checkpoints and have their voting power tracked.\n *\n * _Available since v4.2._\n */\nabstract contract ERC20VotesUpgradeable is Initializable, IVotesUpgradeable, ERC20PermitUpgradeable {\n function __ERC20Votes_init() internal onlyInitializing {\n }\n\n function __ERC20Votes_init_unchained() internal onlyInitializing {\n }\n struct Checkpoint {\n uint32 fromBlock;\n uint224 votes;\n }\n\n bytes32 private constant _DELEGATION_TYPEHASH =\n keccak256(\"Delegation(address delegatee,uint256 nonce,uint256 expiry)\");\n\n mapping(address => address) private _delegates;\n mapping(address => Checkpoint[]) private _checkpoints;\n Checkpoint[] private _totalSupplyCheckpoints;\n\n /**\n * @dev Get the `pos`-th checkpoint for `account`.\n */\n function checkpoints(address account, uint32 pos) public view virtual returns (Checkpoint memory) {\n return _checkpoints[account][pos];\n }\n\n /**\n * @dev Get number of checkpoints for `account`.\n */\n function numCheckpoints(address account) public view virtual returns (uint32) {\n return SafeCastUpgradeable.toUint32(_checkpoints[account].length);\n }\n\n /**\n * @dev Get the address `account` is currently delegating to.\n */\n function delegates(address account) public view virtual override returns (address) {\n return _delegates[account];\n }\n\n /**\n * @dev Gets the current votes balance for `account`\n */\n function getVotes(address account) public view virtual override returns (uint256) {\n uint256 pos = _checkpoints[account].length;\n return pos == 0 ? 0 : _checkpoints[account][pos - 1].votes;\n }\n\n /**\n * @dev Retrieve the number of votes for `account` at the end of `blockNumber`.\n *\n * Requirements:\n *\n * - `blockNumber` must have been already mined\n */\n function getPastVotes(address account, uint256 blockNumber) public view virtual override returns (uint256) {\n require(blockNumber < block.number, \"ERC20Votes: block not yet mined\");\n return _checkpointsLookup(_checkpoints[account], blockNumber);\n }\n\n /**\n * @dev Retrieve the `totalSupply` at the end of `blockNumber`. Note, this value is the sum of all balances.\n * It is but NOT the sum of all the delegated votes!\n *\n * Requirements:\n *\n * - `blockNumber` must have been already mined\n */\n function getPastTotalSupply(uint256 blockNumber) public view virtual override returns (uint256) {\n require(blockNumber < block.number, \"ERC20Votes: block not yet mined\");\n return _checkpointsLookup(_totalSupplyCheckpoints, blockNumber);\n }\n\n /**\n * @dev Lookup a value in a list of (sorted) checkpoints.\n */\n function _checkpointsLookup(Checkpoint[] storage ckpts, uint256 blockNumber) private view returns (uint256) {\n // We run a binary search to look for the earliest checkpoint taken after `blockNumber`.\n //\n // During the loop, the index of the wanted checkpoint remains in the range [low-1, high).\n // With each iteration, either `low` or `high` is moved towards the middle of the range to maintain the invariant.\n // - If the middle checkpoint is after `blockNumber`, we look in [low, mid)\n // - If the middle checkpoint is before or equal to `blockNumber`, we look in [mid+1, high)\n // Once we reach a single value (when low == high), we've found the right checkpoint at the index high-1, if not\n // out of bounds (in which case we're looking too far in the past and the result is 0).\n // Note that if the latest checkpoint available is exactly for `blockNumber`, we end up with an index that is\n // past the end of the array, so we technically don't find a checkpoint after `blockNumber`, but it works out\n // the same.\n uint256 high = ckpts.length;\n uint256 low = 0;\n while (low < high) {\n uint256 mid = MathUpgradeable.average(low, high);\n if (ckpts[mid].fromBlock > blockNumber) {\n high = mid;\n } else {\n low = mid + 1;\n }\n }\n\n return high == 0 ? 0 : ckpts[high - 1].votes;\n }\n\n /**\n * @dev Delegate votes from the sender to `delegatee`.\n */\n function delegate(address delegatee) public virtual override {\n _delegate(_msgSender(), delegatee);\n }\n\n /**\n * @dev Delegates votes from signer to `delegatee`\n */\n function delegateBySig(\n address delegatee,\n uint256 nonce,\n uint256 expiry,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) public virtual override {\n require(block.timestamp <= expiry, \"ERC20Votes: signature expired\");\n address signer = ECDSAUpgradeable.recover(\n _hashTypedDataV4(keccak256(abi.encode(_DELEGATION_TYPEHASH, delegatee, nonce, expiry))),\n v,\n r,\n s\n );\n require(nonce == _useNonce(signer), \"ERC20Votes: invalid nonce\");\n _delegate(signer, delegatee);\n }\n\n /**\n * @dev Maximum token supply. Defaults to `type(uint224).max` (2^224^ - 1).\n */\n function _maxSupply() internal view virtual returns (uint224) {\n return type(uint224).max;\n }\n\n /**\n * @dev Snapshots the totalSupply after it has been increased.\n */\n function _mint(address account, uint256 amount) internal virtual override {\n super._mint(account, amount);\n require(totalSupply() <= _maxSupply(), \"ERC20Votes: total supply risks overflowing votes\");\n\n _writeCheckpoint(_totalSupplyCheckpoints, _add, amount);\n }\n\n /**\n * @dev Snapshots the totalSupply after it has been decreased.\n */\n function _burn(address account, uint256 amount) internal virtual override {\n super._burn(account, amount);\n\n _writeCheckpoint(_totalSupplyCheckpoints, _subtract, amount);\n }\n\n /**\n * @dev Move voting power when tokens are transferred.\n *\n * Emits a {DelegateVotesChanged} event.\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual override {\n super._afterTokenTransfer(from, to, amount);\n\n _moveVotingPower(delegates(from), delegates(to), amount);\n }\n\n /**\n * @dev Change delegation for `delegator` to `delegatee`.\n *\n * Emits events {DelegateChanged} and {DelegateVotesChanged}.\n */\n function _delegate(address delegator, address delegatee) internal virtual {\n address currentDelegate = delegates(delegator);\n uint256 delegatorBalance = balanceOf(delegator);\n _delegates[delegator] = delegatee;\n\n emit DelegateChanged(delegator, currentDelegate, delegatee);\n\n _moveVotingPower(currentDelegate, delegatee, delegatorBalance);\n }\n\n function _moveVotingPower(\n address src,\n address dst,\n uint256 amount\n ) private {\n if (src != dst && amount > 0) {\n if (src != address(0)) {\n (uint256 oldWeight, uint256 newWeight) = _writeCheckpoint(_checkpoints[src], _subtract, amount);\n emit DelegateVotesChanged(src, oldWeight, newWeight);\n }\n\n if (dst != address(0)) {\n (uint256 oldWeight, uint256 newWeight) = _writeCheckpoint(_checkpoints[dst], _add, amount);\n emit DelegateVotesChanged(dst, oldWeight, newWeight);\n }\n }\n }\n\n function _writeCheckpoint(\n Checkpoint[] storage ckpts,\n function(uint256, uint256) view returns (uint256) op,\n uint256 delta\n ) private returns (uint256 oldWeight, uint256 newWeight) {\n uint256 pos = ckpts.length;\n oldWeight = pos == 0 ? 0 : ckpts[pos - 1].votes;\n newWeight = op(oldWeight, delta);\n\n if (pos > 0 && ckpts[pos - 1].fromBlock == block.number) {\n ckpts[pos - 1].votes = SafeCastUpgradeable.toUint224(newWeight);\n } else {\n ckpts.push(Checkpoint({fromBlock: SafeCastUpgradeable.toUint32(block.number), votes: SafeCastUpgradeable.toUint224(newWeight)}));\n }\n }\n\n function _add(uint256 a, uint256 b) private pure returns (uint256) {\n return a + b;\n }\n\n function _subtract(uint256 a, uint256 b) private pure returns (uint256) {\n return a - b;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[47] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20WrapperUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/extensions/ERC20Wrapper.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC20Upgradeable.sol\";\nimport \"../utils/SafeERC20Upgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Extension of the ERC20 token contract to support token wrapping.\n *\n * Users can deposit and withdraw \"underlying tokens\" and receive a matching number of \"wrapped tokens\". This is useful\n * in conjunction with other modules. For example, combining this wrapping mechanism with {ERC20Votes} will allow the\n * wrapping of an existing \"basic\" ERC20 into a governance token.\n *\n * _Available since v4.2._\n *\n * @custom:storage-size 51\n */\nabstract contract ERC20WrapperUpgradeable is Initializable, ERC20Upgradeable {\n IERC20Upgradeable public underlying;\n\n function __ERC20Wrapper_init(IERC20Upgradeable underlyingToken) internal onlyInitializing {\n __ERC20Wrapper_init_unchained(underlyingToken);\n }\n\n function __ERC20Wrapper_init_unchained(IERC20Upgradeable underlyingToken) internal onlyInitializing {\n underlying = underlyingToken;\n }\n\n /**\n * @dev See {ERC20-decimals}.\n */\n function decimals() public view virtual override returns (uint8) {\n try IERC20MetadataUpgradeable(address(underlying)).decimals() returns (uint8 value) {\n return value;\n } catch {\n return super.decimals();\n }\n }\n\n /**\n * @dev Allow a user to deposit underlying tokens and mint the corresponding number of wrapped tokens.\n */\n function depositFor(address account, uint256 amount) public virtual returns (bool) {\n SafeERC20Upgradeable.safeTransferFrom(underlying, _msgSender(), address(this), amount);\n _mint(account, amount);\n return true;\n }\n\n /**\n * @dev Allow a user to burn a number of wrapped tokens and withdraw the corresponding number of underlying tokens.\n */\n function withdrawTo(address account, uint256 amount) public virtual returns (bool) {\n _burn(_msgSender(), amount);\n SafeERC20Upgradeable.safeTransfer(underlying, account, amount);\n return true;\n }\n\n /**\n * @dev Mint wrapped token to cover any underlyingTokens that would have been transferred by mistake. Internal\n * function that can be exposed with access control if desired.\n */\n function _recover(address account) internal virtual returns (uint256) {\n uint256 value = underlying.balanceOf(address(this)) - totalSupply();\n _mint(account, value);\n return value;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20Upgradeable.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20MetadataUpgradeable is IERC20Upgradeable {\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-upgradeable/token/ERC20/IERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\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 amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `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 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20Upgradeable.sol\";\nimport \"../extensions/draft-IERC20PermitUpgradeable.sol\";\nimport \"../../../utils/AddressUpgradeable.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 SafeERC20Upgradeable {\n using AddressUpgradeable for address;\n\n function safeTransfer(\n IERC20Upgradeable token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20Upgradeable token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20Upgradeable token,\n address spender,\n uint256 value\n ) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20Upgradeable token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20Upgradeable token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n function safePermit(\n IERC20PermitUpgradeable token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\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(IERC20Upgradeable token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.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 *\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://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @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}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/ArraysUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Arrays.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/MathUpgradeable.sol\";\n\n/**\n * @dev Collection of functions related to array types.\n */\nlibrary ArraysUpgradeable {\n /**\n * @dev Searches a sorted `array` and returns the first index that contains\n * a value greater or equal to `element`. If no such index exists (i.e. all\n * values in the array are strictly less than `element`), the array length is\n * returned. Time complexity O(log n).\n *\n * `array` is expected to be sorted in ascending order, and to contain no\n * repeated elements.\n */\n function findUpperBound(uint256[] storage array, uint256 element) internal view returns (uint256) {\n if (array.length == 0) {\n return 0;\n }\n\n uint256 low = 0;\n uint256 high = array.length;\n\n while (low < high) {\n uint256 mid = MathUpgradeable.average(low, high);\n\n // Note that mid will always be strictly less than high (i.e. it will be a valid array index)\n // because Math.average rounds down (it does integer division with truncation).\n if (array[mid] > element) {\n high = mid;\n } else {\n low = mid + 1;\n }\n }\n\n // At this point `low` is the exclusive upper bound. We will return the inclusive upper bound.\n if (low > 0 && array[low - 1] == element) {\n return low - 1;\n } else {\n return low;\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\nimport \"../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 /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title Counters\n * @author Matt Condon (@shrugs)\n * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number\n * of elements in a mapping, issuing ERC721 ids, or counting request ids.\n *\n * Include with `using Counters for Counters.Counter;`\n */\nlibrary CountersUpgradeable {\n struct Counter {\n // This variable should never be directly accessed by users of the library: interactions must be restricted to\n // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add\n // this feature: see https://github.com/ethereum/solidity/issues/4637\n uint256 _value; // default: 0\n }\n\n function current(Counter storage counter) internal view returns (uint256) {\n return counter._value;\n }\n\n function increment(Counter storage counter) internal {\n unchecked {\n counter._value += 1;\n }\n }\n\n function decrement(Counter storage counter) internal {\n uint256 value = counter._value;\n require(value > 0, \"Counter: decrement overflow\");\n unchecked {\n counter._value = value - 1;\n }\n }\n\n function reset(Counter storage counter) internal {\n counter._value = 0;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/cryptography/draft-EIP712Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/cryptography/draft-EIP712.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./ECDSAUpgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.\n *\n * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,\n * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding\n * they need in their contracts using a combination of `abi.encode` and `keccak256`.\n *\n * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding\n * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA\n * ({_hashTypedDataV4}).\n *\n * The implementation of the domain separator was designed to be as efficient as possible while still properly updating\n * the chain id to protect against replay attacks on an eventual fork of the chain.\n *\n * NOTE: This contract implements the version of the encoding known as \"v4\", as implemented by the JSON RPC method\n * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].\n *\n * _Available since v3.4._\n *\n * @custom:storage-size 52\n */\nabstract contract EIP712Upgradeable is Initializable {\n /* solhint-disable var-name-mixedcase */\n bytes32 private _HASHED_NAME;\n bytes32 private _HASHED_VERSION;\n bytes32 private constant _TYPE_HASH = keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\");\n\n /* solhint-enable var-name-mixedcase */\n\n /**\n * @dev Initializes the domain separator and parameter caches.\n *\n * The meaning of `name` and `version` is specified in\n * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:\n *\n * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.\n * - `version`: the current major version of the signing domain.\n *\n * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart\n * contract upgrade].\n */\n function __EIP712_init(string memory name, string memory version) internal onlyInitializing {\n __EIP712_init_unchained(name, version);\n }\n\n function __EIP712_init_unchained(string memory name, string memory version) internal onlyInitializing {\n bytes32 hashedName = keccak256(bytes(name));\n bytes32 hashedVersion = keccak256(bytes(version));\n _HASHED_NAME = hashedName;\n _HASHED_VERSION = hashedVersion;\n }\n\n /**\n * @dev Returns the domain separator for the current chain.\n */\n function _domainSeparatorV4() internal view returns (bytes32) {\n return _buildDomainSeparator(_TYPE_HASH, _EIP712NameHash(), _EIP712VersionHash());\n }\n\n function _buildDomainSeparator(\n bytes32 typeHash,\n bytes32 nameHash,\n bytes32 versionHash\n ) private view returns (bytes32) {\n return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this)));\n }\n\n /**\n * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this\n * function returns the hash of the fully encoded EIP712 message for this domain.\n *\n * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:\n *\n * ```solidity\n * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(\n * keccak256(\"Mail(address to,string contents)\"),\n * mailTo,\n * keccak256(bytes(mailContents))\n * )));\n * address signer = ECDSA.recover(digest, signature);\n * ```\n */\n function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {\n return ECDSAUpgradeable.toTypedDataHash(_domainSeparatorV4(), structHash);\n }\n\n /**\n * @dev The hash of the name parameter for the EIP712 domain.\n *\n * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs\n * are a concern.\n */\n function _EIP712NameHash() internal virtual view returns (bytes32) {\n return _HASHED_NAME;\n }\n\n /**\n * @dev The hash of the version parameter for the EIP712 domain.\n *\n * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs\n * are a concern.\n */\n function _EIP712VersionHash() internal virtual view returns (bytes32) {\n return _HASHED_VERSION;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.3) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../StringsUpgradeable.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSAUpgradeable {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS,\n InvalidSignatureV\n }\n\n function _throwError(RecoverError error) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert(\"ECDSA: invalid signature\");\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert(\"ECDSA: invalid signature length\");\n } else if (error == RecoverError.InvalidSignatureS) {\n revert(\"ECDSA: invalid signature 's' value\");\n } else if (error == RecoverError.InvalidSignatureV) {\n revert(\"ECDSA: invalid signature 'v' value\");\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature` or error string. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n /// @solidity memory-safe-assembly\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength);\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, signature);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n *\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address, RecoverError) {\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n uint8 v = uint8((uint256(vs) >> 255) + 27);\n return tryRecover(hash, v, r, s);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n *\n * _Available since v4.2._\n */\n function recover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n * `r` and `s` signature fields separately.\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address, RecoverError) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS);\n }\n if (v != 27 && v != 28) {\n return (address(0), RecoverError.InvalidSignatureV);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature);\n }\n\n return (signer, RecoverError.NoError);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", hash));\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from `s`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", StringsUpgradeable.toString(s.length), s));\n }\n\n /**\n * @dev Returns an Ethereum Signed Typed Data, created from a\n * `domainSeparator` and a `structHash`. This produces hash corresponding\n * to the one signed with the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n * JSON-RPC method as part of EIP-712.\n *\n * See {recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x01\", domainSeparator, structHash));\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary MathUpgradeable {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\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 up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 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 denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) 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; // 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 prod0 := mul(x, y)\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 return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n 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. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\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 works\n // 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(\n uint256 x,\n uint256 y,\n uint256 denominator,\n Rounding rounding\n ) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. It the number is not a perfect square, the value is rounded down.\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 // 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)`.\n // We also know that `k`, the position of the most significant bit, is such that `msb(a) = 2**k`.\n // This gives `2**k < a <= 2**(k+1)` → `2**(k/2) <= sqrt(a) < 2 ** (k/2+1)`.\n // Using an algorithm similar to the msb conmputation, we are able to compute `result = 2**(k/2)` which is a\n // good first aproximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1;\n uint256 x = a;\n if (x >> 128 > 0) {\n x >>= 128;\n result <<= 64;\n }\n if (x >> 64 > 0) {\n x >>= 64;\n result <<= 32;\n }\n if (x >> 32 > 0) {\n x >>= 32;\n result <<= 16;\n }\n if (x >> 16 > 0) {\n x >>= 16;\n result <<= 8;\n }\n if (x >> 8 > 0) {\n x >>= 8;\n result <<= 4;\n }\n if (x >> 4 > 0) {\n x >>= 4;\n result <<= 2;\n }\n if (x >> 2 > 0) {\n result <<= 1;\n }\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 uint256 result = sqrt(a);\n if (rounding == Rounding.Up && result * result < a) {\n result += 1;\n }\n return result;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/math/SafeCastUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/math/SafeCast.sol)\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 SafeCastUpgradeable {\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) {\n require(value >= type(int248).min && value <= type(int248).max, \"SafeCast: value doesn't fit in 248 bits\");\n return int248(value);\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) {\n require(value >= type(int240).min && value <= type(int240).max, \"SafeCast: value doesn't fit in 240 bits\");\n return int240(value);\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) {\n require(value >= type(int232).min && value <= type(int232).max, \"SafeCast: value doesn't fit in 232 bits\");\n return int232(value);\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) {\n require(value >= type(int224).min && value <= type(int224).max, \"SafeCast: value doesn't fit in 224 bits\");\n return int224(value);\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) {\n require(value >= type(int216).min && value <= type(int216).max, \"SafeCast: value doesn't fit in 216 bits\");\n return int216(value);\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) {\n require(value >= type(int208).min && value <= type(int208).max, \"SafeCast: value doesn't fit in 208 bits\");\n return int208(value);\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) {\n require(value >= type(int200).min && value <= type(int200).max, \"SafeCast: value doesn't fit in 200 bits\");\n return int200(value);\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) {\n require(value >= type(int192).min && value <= type(int192).max, \"SafeCast: value doesn't fit in 192 bits\");\n return int192(value);\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) {\n require(value >= type(int184).min && value <= type(int184).max, \"SafeCast: value doesn't fit in 184 bits\");\n return int184(value);\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) {\n require(value >= type(int176).min && value <= type(int176).max, \"SafeCast: value doesn't fit in 176 bits\");\n return int176(value);\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) {\n require(value >= type(int168).min && value <= type(int168).max, \"SafeCast: value doesn't fit in 168 bits\");\n return int168(value);\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) {\n require(value >= type(int160).min && value <= type(int160).max, \"SafeCast: value doesn't fit in 160 bits\");\n return int160(value);\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) {\n require(value >= type(int152).min && value <= type(int152).max, \"SafeCast: value doesn't fit in 152 bits\");\n return int152(value);\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) {\n require(value >= type(int144).min && value <= type(int144).max, \"SafeCast: value doesn't fit in 144 bits\");\n return int144(value);\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) {\n require(value >= type(int136).min && value <= type(int136).max, \"SafeCast: value doesn't fit in 136 bits\");\n return int136(value);\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) {\n require(value >= type(int128).min && value <= type(int128).max, \"SafeCast: value doesn't fit in 128 bits\");\n return int128(value);\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) {\n require(value >= type(int120).min && value <= type(int120).max, \"SafeCast: value doesn't fit in 120 bits\");\n return int120(value);\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) {\n require(value >= type(int112).min && value <= type(int112).max, \"SafeCast: value doesn't fit in 112 bits\");\n return int112(value);\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) {\n require(value >= type(int104).min && value <= type(int104).max, \"SafeCast: value doesn't fit in 104 bits\");\n return int104(value);\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) {\n require(value >= type(int96).min && value <= type(int96).max, \"SafeCast: value doesn't fit in 96 bits\");\n return int96(value);\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) {\n require(value >= type(int88).min && value <= type(int88).max, \"SafeCast: value doesn't fit in 88 bits\");\n return int88(value);\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) {\n require(value >= type(int80).min && value <= type(int80).max, \"SafeCast: value doesn't fit in 80 bits\");\n return int80(value);\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) {\n require(value >= type(int72).min && value <= type(int72).max, \"SafeCast: value doesn't fit in 72 bits\");\n return int72(value);\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) {\n require(value >= type(int64).min && value <= type(int64).max, \"SafeCast: value doesn't fit in 64 bits\");\n return int64(value);\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) {\n require(value >= type(int56).min && value <= type(int56).max, \"SafeCast: value doesn't fit in 56 bits\");\n return int56(value);\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) {\n require(value >= type(int48).min && value <= type(int48).max, \"SafeCast: value doesn't fit in 48 bits\");\n return int48(value);\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) {\n require(value >= type(int40).min && value <= type(int40).max, \"SafeCast: value doesn't fit in 40 bits\");\n return int40(value);\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) {\n require(value >= type(int32).min && value <= type(int32).max, \"SafeCast: value doesn't fit in 32 bits\");\n return int32(value);\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) {\n require(value >= type(int24).min && value <= type(int24).max, \"SafeCast: value doesn't fit in 24 bits\");\n return int24(value);\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) {\n require(value >= type(int16).min && value <= type(int16).max, \"SafeCast: value doesn't fit in 16 bits\");\n return int16(value);\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) {\n require(value >= type(int8).min && value <= type(int8).max, \"SafeCast: value doesn't fit in 8 bits\");\n return int8(value);\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" + }, + "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev String operations.\n */\nlibrary StringsUpgradeable {\n bytes16 private constant _HEX_SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\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 // Inspired by OraclizeAPI's implementation - MIT licence\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\n\n if (value == 0) {\n return \"0\";\n }\n uint256 temp = value;\n uint256 digits;\n while (temp != 0) {\n digits++;\n temp /= 10;\n }\n bytes memory buffer = new bytes(digits);\n while (value != 0) {\n digits -= 1;\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\n value /= 10;\n }\n return string(buffer);\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 if (value == 0) {\n return \"0x00\";\n }\n uint256 temp = value;\n uint256 length = 0;\n while (temp != 0) {\n length++;\n temp >>= 8;\n }\n return toHexString(value, length);\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 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_SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\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 representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "@openzeppelin/contracts/governance/utils/IVotes.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (governance/utils/IVotes.sol)\npragma solidity ^0.8.0;\n\n/**\n * @dev Common interface for {ERC20Votes}, {ERC721Votes}, and other {Votes}-enabled contracts.\n *\n * _Available since v4.5._\n */\ninterface IVotes {\n /**\n * @dev Emitted when an account changes their delegate.\n */\n event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);\n\n /**\n * @dev Emitted when a token transfer or delegate change results in changes to a delegate's number of votes.\n */\n event DelegateVotesChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance);\n\n /**\n * @dev Returns the current amount of votes that `account` has.\n */\n function getVotes(address account) external view returns (uint256);\n\n /**\n * @dev Returns the amount of votes that `account` had at the end of a past block (`blockNumber`).\n */\n function getPastVotes(address account, uint256 blockNumber) external view returns (uint256);\n\n /**\n * @dev Returns the total supply of votes available at the end of a past block (`blockNumber`).\n *\n * NOTE: This value is the sum of all available votes, which is not necessarily the sum of all delegated votes.\n * Votes that have not been delegated are still part of total supply, even though they would not participate in a\n * vote.\n */\n function getPastTotalSupply(uint256 blockNumber) external view returns (uint256);\n\n /**\n * @dev Returns the delegate that `account` has chosen.\n */\n function delegates(address account) external view returns (address);\n\n /**\n * @dev Delegates votes from the sender to `delegatee`.\n */\n function delegate(address delegatee) external;\n\n /**\n * @dev Delegates votes from signer to `delegatee`.\n */\n function delegateBySig(\n address delegatee,\n uint256 nonce,\n uint256 expiry,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n}\n" + }, + "@openzeppelin/contracts/interfaces/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/introspection/IERC165.sol\";\n" + }, + "@openzeppelin/contracts/token/ERC20/ERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n }\n _balances[to] += amount;\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n _balances[account] += amount;\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n }\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\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 */\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 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/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\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 v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev 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 amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `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 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../extensions/draft-IERC20Permit.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n function safePermit(\n IERC20Permit token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/ERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721.sol\";\nimport \"./IERC721Receiver.sol\";\nimport \"./extensions/IERC721Metadata.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/Context.sol\";\nimport \"../../utils/Strings.sol\";\nimport \"../../utils/introspection/ERC165.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 */\ncontract ERC721 is Context, ERC165, IERC721, IERC721Metadata {\n using Address for address;\n using Strings for uint256;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to owner address\n mapping(uint256 => address) private _owners;\n\n // Mapping owner address to token count\n mapping(address => uint256) private _balances;\n\n // Mapping from token ID to approved address\n mapping(uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, 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 override returns (uint256) {\n require(owner != address(0), \"ERC721: address zero is not a valid owner\");\n return _balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n address owner = _owners[tokenId];\n require(owner != address(0), \"ERC721: invalid token ID\");\n return owner;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(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 override {\n address owner = ERC721.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not token owner nor approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n _requireMinted(tokenId);\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner nor approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner nor approved\");\n _safeTransfer(from, to, tokenId, data);\n }\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 * `data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\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 `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(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _transfer(from, to, tokenId);\n require(_checkOnERC721Received(from, to, tokenId, data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n * and stop existing when they are burned (`_burn`).\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _owners[tokenId] != address(0);\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n address owner = ERC721.ownerOf(tokenId);\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\n }\n\n /**\n * @dev Safely mints `tokenId` and transfers it to `to`.\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 virtual {\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(\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _mint(to, tokenId);\n require(\n _checkOnERC721Received(address(0), to, tokenId, data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\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 virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId);\n\n _balances[to] += 1;\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId);\n\n // Clear approvals\n _approve(address(0), tokenId);\n\n _balances[owner] -= 1;\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId);\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(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId);\n\n // Clear approvals from the previous owner\n _approve(address(0), tokenId);\n\n _balances[from] -= 1;\n _balances[to] += 1;\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ERC721.ownerOf(tokenId), to, tokenId);\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(\n address owner,\n address operator,\n bool approved\n ) internal virtual {\n require(owner != operator, \"ERC721: approve to caller\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Reverts if the `tokenId` has not been minted yet.\n */\n function _requireMinted(uint256 tokenId) internal view virtual {\n require(_exists(tokenId), \"ERC721: invalid token ID\");\n }\n\n /**\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n * 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 * @return bool whether the call correctly returned the expected magic value\n */\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) private returns (bool) {\n if (to.isContract()) {\n try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n return retval == IERC721Receiver.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\"ERC721: transfer to non ERC721Receiver implementer\");\n } else {\n /// @solidity memory-safe-assembly\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting\n * and burning.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be\n * transferred to `to`.\n * - When `from` is zero, `tokenId` will be minted for `to`.\n * - When `to` is zero, ``from``'s `tokenId` will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../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 v4.7.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n\n /**\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 {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns 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 v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `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/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.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 *\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://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @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}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165Storage.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165Storage.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./ERC165.sol\";\n\n/**\n * @dev Storage based implementation of the {IERC165} interface.\n *\n * Contracts may inherit from this and call {_registerInterface} to declare\n * their support of an interface.\n */\nabstract contract ERC165Storage is ERC165 {\n /**\n * @dev Mapping of interface ids to whether or not it's supported.\n */\n mapping(bytes4 => bool) private _supportedInterfaces;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return super.supportsInterface(interfaceId) || _supportedInterfaces[interfaceId];\n }\n\n /**\n * @dev Registers the contract as an implementer of the interface defined by\n * `interfaceId`. Support of the actual ERC165 interface is automatic and\n * registering its interface id is not required.\n *\n * See {IERC165-supportsInterface}.\n *\n * Requirements:\n *\n * - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`).\n */\n function _registerInterface(bytes4 interfaceId) internal virtual {\n require(interfaceId != 0xffffffff, \"ERC165: invalid interface id\");\n _supportedInterfaces[interfaceId] = true;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _HEX_SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\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 // Inspired by OraclizeAPI's implementation - MIT licence\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\n\n if (value == 0) {\n return \"0\";\n }\n uint256 temp = value;\n uint256 digits;\n while (temp != 0) {\n digits++;\n temp /= 10;\n }\n bytes memory buffer = new bytes(digits);\n while (value != 0) {\n digits -= 1;\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\n value /= 10;\n }\n return string(buffer);\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 if (value == 0) {\n return \"0x00\";\n }\n uint256 temp = value;\n uint256 length = 0;\n while (temp != 0) {\n length++;\n temp >>= 8;\n }\n return toHexString(value, length);\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 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_SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\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 representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "@prb/math/src/Common.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\n// Common.sol\n//\n// Common mathematical functions used in both SD59x18 and UD60x18. Note that these global functions do not\n// always operate with SD59x18 and UD60x18 numbers.\n\n/*//////////////////////////////////////////////////////////////////////////\n CUSTOM ERRORS\n//////////////////////////////////////////////////////////////////////////*/\n\n/// @notice Thrown when the resultant value in {mulDiv} overflows uint256.\nerror PRBMath_MulDiv_Overflow(uint256 x, uint256 y, uint256 denominator);\n\n/// @notice Thrown when the resultant value in {mulDiv18} overflows uint256.\nerror PRBMath_MulDiv18_Overflow(uint256 x, uint256 y);\n\n/// @notice Thrown when one of the inputs passed to {mulDivSigned} is `type(int256).min`.\nerror PRBMath_MulDivSigned_InputTooSmall();\n\n/// @notice Thrown when the resultant value in {mulDivSigned} overflows int256.\nerror PRBMath_MulDivSigned_Overflow(int256 x, int256 y);\n\n/*//////////////////////////////////////////////////////////////////////////\n CONSTANTS\n//////////////////////////////////////////////////////////////////////////*/\n\n/// @dev The maximum value a uint128 number can have.\nuint128 constant MAX_UINT128 = type(uint128).max;\n\n/// @dev The maximum value a uint40 number can have.\nuint40 constant MAX_UINT40 = type(uint40).max;\n\n/// @dev The unit number, which the decimal precision of the fixed-point types.\nuint256 constant UNIT = 1e18;\n\n/// @dev The unit number inverted mod 2^256.\nuint256 constant UNIT_INVERSE = 78156646155174841979727994598816262306175212592076161876661_508869554232690281;\n\n/// @dev The the largest power of two that divides the decimal value of `UNIT`. The logarithm of this value is the least significant\n/// bit in the binary representation of `UNIT`.\nuint256 constant UNIT_LPOTD = 262144;\n\n/*//////////////////////////////////////////////////////////////////////////\n FUNCTIONS\n//////////////////////////////////////////////////////////////////////////*/\n\n/// @notice Calculates the binary exponent of x using the binary fraction method.\n/// @dev Has to use 192.64-bit fixed-point numbers. See https://ethereum.stackexchange.com/a/96594/24693.\n/// @param x The exponent as an unsigned 192.64-bit fixed-point number.\n/// @return result The result as an unsigned 60.18-decimal fixed-point number.\n/// @custom:smtchecker abstract-function-nondet\nfunction exp2(uint256 x) pure returns (uint256 result) {\n unchecked {\n // Start from 0.5 in the 192.64-bit fixed-point format.\n result = 0x800000000000000000000000000000000000000000000000;\n\n // The following logic multiplies the result by $\\sqrt{2^{-i}}$ when the bit at position i is 1. Key points:\n //\n // 1. Intermediate results will not overflow, as the starting point is 2^191 and all magic factors are under 2^65.\n // 2. The rationale for organizing the if statements into groups of 8 is gas savings. If the result of performing\n // a bitwise AND operation between x and any value in the array [0x80; 0x40; 0x20; 0x10; 0x08; 0x04; 0x02; 0x01] is 1,\n // we know that `x & 0xFF` is also 1.\n if (x & 0xFF00000000000000 > 0) {\n if (x & 0x8000000000000000 > 0) {\n result = (result * 0x16A09E667F3BCC909) >> 64;\n }\n if (x & 0x4000000000000000 > 0) {\n result = (result * 0x1306FE0A31B7152DF) >> 64;\n }\n if (x & 0x2000000000000000 > 0) {\n result = (result * 0x1172B83C7D517ADCE) >> 64;\n }\n if (x & 0x1000000000000000 > 0) {\n result = (result * 0x10B5586CF9890F62A) >> 64;\n }\n if (x & 0x800000000000000 > 0) {\n result = (result * 0x1059B0D31585743AE) >> 64;\n }\n if (x & 0x400000000000000 > 0) {\n result = (result * 0x102C9A3E778060EE7) >> 64;\n }\n if (x & 0x200000000000000 > 0) {\n result = (result * 0x10163DA9FB33356D8) >> 64;\n }\n if (x & 0x100000000000000 > 0) {\n result = (result * 0x100B1AFA5ABCBED61) >> 64;\n }\n }\n\n if (x & 0xFF000000000000 > 0) {\n if (x & 0x80000000000000 > 0) {\n result = (result * 0x10058C86DA1C09EA2) >> 64;\n }\n if (x & 0x40000000000000 > 0) {\n result = (result * 0x1002C605E2E8CEC50) >> 64;\n }\n if (x & 0x20000000000000 > 0) {\n result = (result * 0x100162F3904051FA1) >> 64;\n }\n if (x & 0x10000000000000 > 0) {\n result = (result * 0x1000B175EFFDC76BA) >> 64;\n }\n if (x & 0x8000000000000 > 0) {\n result = (result * 0x100058BA01FB9F96D) >> 64;\n }\n if (x & 0x4000000000000 > 0) {\n result = (result * 0x10002C5CC37DA9492) >> 64;\n }\n if (x & 0x2000000000000 > 0) {\n result = (result * 0x1000162E525EE0547) >> 64;\n }\n if (x & 0x1000000000000 > 0) {\n result = (result * 0x10000B17255775C04) >> 64;\n }\n }\n\n if (x & 0xFF0000000000 > 0) {\n if (x & 0x800000000000 > 0) {\n result = (result * 0x1000058B91B5BC9AE) >> 64;\n }\n if (x & 0x400000000000 > 0) {\n result = (result * 0x100002C5C89D5EC6D) >> 64;\n }\n if (x & 0x200000000000 > 0) {\n result = (result * 0x10000162E43F4F831) >> 64;\n }\n if (x & 0x100000000000 > 0) {\n result = (result * 0x100000B1721BCFC9A) >> 64;\n }\n if (x & 0x80000000000 > 0) {\n result = (result * 0x10000058B90CF1E6E) >> 64;\n }\n if (x & 0x40000000000 > 0) {\n result = (result * 0x1000002C5C863B73F) >> 64;\n }\n if (x & 0x20000000000 > 0) {\n result = (result * 0x100000162E430E5A2) >> 64;\n }\n if (x & 0x10000000000 > 0) {\n result = (result * 0x1000000B172183551) >> 64;\n }\n }\n\n if (x & 0xFF00000000 > 0) {\n if (x & 0x8000000000 > 0) {\n result = (result * 0x100000058B90C0B49) >> 64;\n }\n if (x & 0x4000000000 > 0) {\n result = (result * 0x10000002C5C8601CC) >> 64;\n }\n if (x & 0x2000000000 > 0) {\n result = (result * 0x1000000162E42FFF0) >> 64;\n }\n if (x & 0x1000000000 > 0) {\n result = (result * 0x10000000B17217FBB) >> 64;\n }\n if (x & 0x800000000 > 0) {\n result = (result * 0x1000000058B90BFCE) >> 64;\n }\n if (x & 0x400000000 > 0) {\n result = (result * 0x100000002C5C85FE3) >> 64;\n }\n if (x & 0x200000000 > 0) {\n result = (result * 0x10000000162E42FF1) >> 64;\n }\n if (x & 0x100000000 > 0) {\n result = (result * 0x100000000B17217F8) >> 64;\n }\n }\n\n if (x & 0xFF000000 > 0) {\n if (x & 0x80000000 > 0) {\n result = (result * 0x10000000058B90BFC) >> 64;\n }\n if (x & 0x40000000 > 0) {\n result = (result * 0x1000000002C5C85FE) >> 64;\n }\n if (x & 0x20000000 > 0) {\n result = (result * 0x100000000162E42FF) >> 64;\n }\n if (x & 0x10000000 > 0) {\n result = (result * 0x1000000000B17217F) >> 64;\n }\n if (x & 0x8000000 > 0) {\n result = (result * 0x100000000058B90C0) >> 64;\n }\n if (x & 0x4000000 > 0) {\n result = (result * 0x10000000002C5C860) >> 64;\n }\n if (x & 0x2000000 > 0) {\n result = (result * 0x1000000000162E430) >> 64;\n }\n if (x & 0x1000000 > 0) {\n result = (result * 0x10000000000B17218) >> 64;\n }\n }\n\n if (x & 0xFF0000 > 0) {\n if (x & 0x800000 > 0) {\n result = (result * 0x1000000000058B90C) >> 64;\n }\n if (x & 0x400000 > 0) {\n result = (result * 0x100000000002C5C86) >> 64;\n }\n if (x & 0x200000 > 0) {\n result = (result * 0x10000000000162E43) >> 64;\n }\n if (x & 0x100000 > 0) {\n result = (result * 0x100000000000B1721) >> 64;\n }\n if (x & 0x80000 > 0) {\n result = (result * 0x10000000000058B91) >> 64;\n }\n if (x & 0x40000 > 0) {\n result = (result * 0x1000000000002C5C8) >> 64;\n }\n if (x & 0x20000 > 0) {\n result = (result * 0x100000000000162E4) >> 64;\n }\n if (x & 0x10000 > 0) {\n result = (result * 0x1000000000000B172) >> 64;\n }\n }\n\n if (x & 0xFF00 > 0) {\n if (x & 0x8000 > 0) {\n result = (result * 0x100000000000058B9) >> 64;\n }\n if (x & 0x4000 > 0) {\n result = (result * 0x10000000000002C5D) >> 64;\n }\n if (x & 0x2000 > 0) {\n result = (result * 0x1000000000000162E) >> 64;\n }\n if (x & 0x1000 > 0) {\n result = (result * 0x10000000000000B17) >> 64;\n }\n if (x & 0x800 > 0) {\n result = (result * 0x1000000000000058C) >> 64;\n }\n if (x & 0x400 > 0) {\n result = (result * 0x100000000000002C6) >> 64;\n }\n if (x & 0x200 > 0) {\n result = (result * 0x10000000000000163) >> 64;\n }\n if (x & 0x100 > 0) {\n result = (result * 0x100000000000000B1) >> 64;\n }\n }\n\n if (x & 0xFF > 0) {\n if (x & 0x80 > 0) {\n result = (result * 0x10000000000000059) >> 64;\n }\n if (x & 0x40 > 0) {\n result = (result * 0x1000000000000002C) >> 64;\n }\n if (x & 0x20 > 0) {\n result = (result * 0x10000000000000016) >> 64;\n }\n if (x & 0x10 > 0) {\n result = (result * 0x1000000000000000B) >> 64;\n }\n if (x & 0x8 > 0) {\n result = (result * 0x10000000000000006) >> 64;\n }\n if (x & 0x4 > 0) {\n result = (result * 0x10000000000000003) >> 64;\n }\n if (x & 0x2 > 0) {\n result = (result * 0x10000000000000001) >> 64;\n }\n if (x & 0x1 > 0) {\n result = (result * 0x10000000000000001) >> 64;\n }\n }\n\n // In the code snippet below, two operations are executed simultaneously:\n //\n // 1. The result is multiplied by $(2^n + 1)$, where $2^n$ represents the integer part, and the additional 1\n // accounts for the initial guess of 0.5. This is achieved by subtracting from 191 instead of 192.\n // 2. The result is then converted to an unsigned 60.18-decimal fixed-point format.\n //\n // The underlying logic is based on the relationship $2^{191-ip} = 2^{ip} / 2^{191}$, where $ip$ denotes the,\n // integer part, $2^n$.\n result *= UNIT;\n result >>= (191 - (x >> 64));\n }\n}\n\n/// @notice Finds the zero-based index of the first 1 in the binary representation of x.\n///\n/// @dev See the note on \"msb\" in this Wikipedia article: https://en.wikipedia.org/wiki/Find_first_set\n///\n/// Each step in this implementation is equivalent to this high-level code:\n///\n/// ```solidity\n/// if (x >= 2 ** 128) {\n/// x >>= 128;\n/// result += 128;\n/// }\n/// ```\n///\n/// Where 128 is replaced with each respective power of two factor. See the full high-level implementation here:\n/// https://gist.github.com/PaulRBerg/f932f8693f2733e30c4d479e8e980948\n///\n/// The Yul instructions used below are:\n///\n/// - \"gt\" is \"greater than\"\n/// - \"or\" is the OR bitwise operator\n/// - \"shl\" is \"shift left\"\n/// - \"shr\" is \"shift right\"\n///\n/// @param x The uint256 number for which to find the index of the most significant bit.\n/// @return result The index of the most significant bit as a uint256.\n/// @custom:smtchecker abstract-function-nondet\nfunction msb(uint256 x) pure returns (uint256 result) {\n // 2^128\n assembly (\"memory-safe\") {\n let factor := shl(7, gt(x, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))\n x := shr(factor, x)\n result := or(result, factor)\n }\n // 2^64\n assembly (\"memory-safe\") {\n let factor := shl(6, gt(x, 0xFFFFFFFFFFFFFFFF))\n x := shr(factor, x)\n result := or(result, factor)\n }\n // 2^32\n assembly (\"memory-safe\") {\n let factor := shl(5, gt(x, 0xFFFFFFFF))\n x := shr(factor, x)\n result := or(result, factor)\n }\n // 2^16\n assembly (\"memory-safe\") {\n let factor := shl(4, gt(x, 0xFFFF))\n x := shr(factor, x)\n result := or(result, factor)\n }\n // 2^8\n assembly (\"memory-safe\") {\n let factor := shl(3, gt(x, 0xFF))\n x := shr(factor, x)\n result := or(result, factor)\n }\n // 2^4\n assembly (\"memory-safe\") {\n let factor := shl(2, gt(x, 0xF))\n x := shr(factor, x)\n result := or(result, factor)\n }\n // 2^2\n assembly (\"memory-safe\") {\n let factor := shl(1, gt(x, 0x3))\n x := shr(factor, x)\n result := or(result, factor)\n }\n // 2^1\n // No need to shift x any more.\n assembly (\"memory-safe\") {\n let factor := gt(x, 0x1)\n result := or(result, factor)\n }\n}\n\n/// @notice Calculates x*y÷denominator with 512-bit precision.\n///\n/// @dev Credits to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv.\n///\n/// Notes:\n/// - The result is rounded toward zero.\n///\n/// Requirements:\n/// - The denominator must not be zero.\n/// - The result must fit in uint256.\n///\n/// @param x The multiplicand as a uint256.\n/// @param y The multiplier as a uint256.\n/// @param denominator The divisor as a uint256.\n/// @return result The result as a uint256.\n/// @custom:smtchecker abstract-function-nondet\nfunction mulDiv(uint256 x, uint256 y, uint256 denominator) pure returns (uint256 result) {\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; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly (\"memory-safe\") {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\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 unchecked {\n return prod0 / denominator;\n }\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n if (prod1 >= denominator) {\n revert PRBMath_MulDiv_Overflow(x, y, denominator);\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 (\"memory-safe\") {\n // Compute remainder using the mulmod Yul instruction.\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 unchecked {\n // Calculate the largest power of two divisor of the denominator using the unary operator ~. This operation cannot overflow\n // because the denominator cannot be zero at this point in the function execution. The result is always >= 1.\n // For more detail, see https://cs.stackexchange.com/q/138556/92363.\n uint256 lpotdod = denominator & (~denominator + 1);\n uint256 flippedLpotdod;\n\n assembly (\"memory-safe\") {\n // Factor powers of two out of denominator.\n denominator := div(denominator, lpotdod)\n\n // Divide [prod1 prod0] by lpotdod.\n prod0 := div(prod0, lpotdod)\n\n // Get the flipped value `2^256 / lpotdod`. If the `lpotdod` is zero, the flipped value is one.\n // `sub(0, lpotdod)` produces the two's complement version of `lpotdod`, which is equivalent to flipping all the bits.\n // However, `div` interprets this value as an unsigned value: https://ethereum.stackexchange.com/q/147168/24693\n flippedLpotdod := add(div(sub(0, lpotdod), lpotdod), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * flippedLpotdod;\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 works\n // 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 }\n}\n\n/// @notice Calculates x*y÷1e18 with 512-bit precision.\n///\n/// @dev A variant of {mulDiv} with constant folding, i.e. in which the denominator is hard coded to 1e18.\n///\n/// Notes:\n/// - The body is purposely left uncommented; to understand how this works, see the documentation in {mulDiv}.\n/// - The result is rounded toward zero.\n/// - We take as an axiom that the result cannot be `MAX_UINT256` when x and y solve the following system of equations:\n///\n/// $$\n/// \\begin{cases}\n/// x * y = MAX\\_UINT256 * UNIT \\\\\n/// (x * y) \\% UNIT \\geq \\frac{UNIT}{2}\n/// \\end{cases}\n/// $$\n///\n/// Requirements:\n/// - Refer to the requirements in {mulDiv}.\n/// - The result must fit in uint256.\n///\n/// @param x The multiplicand as an unsigned 60.18-decimal fixed-point number.\n/// @param y The multiplier as an unsigned 60.18-decimal fixed-point number.\n/// @return result The result as an unsigned 60.18-decimal fixed-point number.\n/// @custom:smtchecker abstract-function-nondet\nfunction mulDiv18(uint256 x, uint256 y) pure returns (uint256 result) {\n uint256 prod0;\n uint256 prod1;\n assembly (\"memory-safe\") {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n if (prod1 == 0) {\n unchecked {\n return prod0 / UNIT;\n }\n }\n\n if (prod1 >= UNIT) {\n revert PRBMath_MulDiv18_Overflow(x, y);\n }\n\n uint256 remainder;\n assembly (\"memory-safe\") {\n remainder := mulmod(x, y, UNIT)\n result :=\n mul(\n or(\n div(sub(prod0, remainder), UNIT_LPOTD),\n mul(sub(prod1, gt(remainder, prod0)), add(div(sub(0, UNIT_LPOTD), UNIT_LPOTD), 1))\n ),\n UNIT_INVERSE\n )\n }\n}\n\n/// @notice Calculates x*y÷denominator with 512-bit precision.\n///\n/// @dev This is an extension of {mulDiv} for signed numbers, which works by computing the signs and the absolute values separately.\n///\n/// Notes:\n/// - The result is rounded toward zero.\n///\n/// Requirements:\n/// - Refer to the requirements in {mulDiv}.\n/// - None of the inputs can be `type(int256).min`.\n/// - The result must fit in int256.\n///\n/// @param x The multiplicand as an int256.\n/// @param y The multiplier as an int256.\n/// @param denominator The divisor as an int256.\n/// @return result The result as an int256.\n/// @custom:smtchecker abstract-function-nondet\nfunction mulDivSigned(int256 x, int256 y, int256 denominator) pure returns (int256 result) {\n if (x == type(int256).min || y == type(int256).min || denominator == type(int256).min) {\n revert PRBMath_MulDivSigned_InputTooSmall();\n }\n\n // Get hold of the absolute values of x, y and the denominator.\n uint256 xAbs;\n uint256 yAbs;\n uint256 dAbs;\n unchecked {\n xAbs = x < 0 ? uint256(-x) : uint256(x);\n yAbs = y < 0 ? uint256(-y) : uint256(y);\n dAbs = denominator < 0 ? uint256(-denominator) : uint256(denominator);\n }\n\n // Compute the absolute value of x*y÷denominator. The result must fit in int256.\n uint256 resultAbs = mulDiv(xAbs, yAbs, dAbs);\n if (resultAbs > uint256(type(int256).max)) {\n revert PRBMath_MulDivSigned_Overflow(x, y);\n }\n\n // Get the signs of x, y and the denominator.\n uint256 sx;\n uint256 sy;\n uint256 sd;\n assembly (\"memory-safe\") {\n // \"sgt\" is the \"signed greater than\" assembly instruction and \"sub(0,1)\" is -1 in two's complement.\n sx := sgt(x, sub(0, 1))\n sy := sgt(y, sub(0, 1))\n sd := sgt(denominator, sub(0, 1))\n }\n\n // XOR over sx, sy and sd. What this does is to check whether there are 1 or 3 negative signs in the inputs.\n // If there are, the result should be negative. Otherwise, it should be positive.\n unchecked {\n result = sx ^ sy ^ sd == 0 ? -int256(resultAbs) : int256(resultAbs);\n }\n}\n\n/// @notice Calculates the square root of x using the Babylonian method.\n///\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\n///\n/// Notes:\n/// - If x is not a perfect square, the result is rounded down.\n/// - Credits to OpenZeppelin for the explanations in comments below.\n///\n/// @param x The uint256 number for which to calculate the square root.\n/// @return result The result as a uint256.\n/// @custom:smtchecker abstract-function-nondet\nfunction sqrt(uint256 x) pure returns (uint256 result) {\n if (x == 0) {\n return 0;\n }\n\n // For our first guess, we calculate the biggest power of 2 which is smaller than the square root of x.\n //\n // We know that the \"msb\" (most significant bit) of x is a power of 2 such that we have:\n //\n // $$\n // msb(x) <= x <= 2*msb(x)$\n // $$\n //\n // We write $msb(x)$ as $2^k$, and we get:\n //\n // $$\n // k = log_2(x)\n // $$\n //\n // Thus, we can write the initial inequality as:\n //\n // $$\n // 2^{log_2(x)} <= x <= 2*2^{log_2(x)+1} \\\\\n // sqrt(2^k) <= sqrt(x) < sqrt(2^{k+1}) \\\\\n // 2^{k/2} <= sqrt(x) < 2^{(k+1)/2} <= 2^{(k/2)+1}\n // $$\n //\n // Consequently, $2^{log_2(x) /2} is a good first approximation of sqrt(x) with at least one correct bit.\n uint256 xAux = uint256(x);\n result = 1;\n if (xAux >= 2 ** 128) {\n xAux >>= 128;\n result <<= 64;\n }\n if (xAux >= 2 ** 64) {\n xAux >>= 64;\n result <<= 32;\n }\n if (xAux >= 2 ** 32) {\n xAux >>= 32;\n result <<= 16;\n }\n if (xAux >= 2 ** 16) {\n xAux >>= 16;\n result <<= 8;\n }\n if (xAux >= 2 ** 8) {\n xAux >>= 8;\n result <<= 4;\n }\n if (xAux >= 2 ** 4) {\n xAux >>= 4;\n result <<= 2;\n }\n if (xAux >= 2 ** 2) {\n result <<= 1;\n }\n\n // At this point, `result` is an estimation with at least one bit of precision. We know the true value has at\n // most 128 bits, since it is the square root of a uint256. Newton's method converges quadratically (precision\n // doubles at every iteration). We thus need at most 7 iteration to turn our partial result with one bit of\n // precision into the expected uint128 result.\n unchecked {\n result = (result + x / result) >> 1;\n result = (result + x / result) >> 1;\n result = (result + x / result) >> 1;\n result = (result + x / result) >> 1;\n result = (result + x / result) >> 1;\n result = (result + x / result) >> 1;\n result = (result + x / result) >> 1;\n\n // If x is not a perfect square, round the result toward zero.\n uint256 roundedResult = x / result;\n if (result >= roundedResult) {\n result = roundedResult;\n }\n }\n}\n" + }, + "@prb/math/src/sd1x18/Casting.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport \"../Common.sol\" as Common;\nimport \"./Errors.sol\" as CastingErrors;\nimport { SD59x18 } from \"../sd59x18/ValueType.sol\";\nimport { UD2x18 } from \"../ud2x18/ValueType.sol\";\nimport { UD60x18 } from \"../ud60x18/ValueType.sol\";\nimport { SD1x18 } from \"./ValueType.sol\";\n\n/// @notice Casts an SD1x18 number into SD59x18.\n/// @dev There is no overflow check because the domain of SD1x18 is a subset of SD59x18.\nfunction intoSD59x18(SD1x18 x) pure returns (SD59x18 result) {\n result = SD59x18.wrap(int256(SD1x18.unwrap(x)));\n}\n\n/// @notice Casts an SD1x18 number into UD2x18.\n/// - x must be positive.\nfunction intoUD2x18(SD1x18 x) pure returns (UD2x18 result) {\n int64 xInt = SD1x18.unwrap(x);\n if (xInt < 0) {\n revert CastingErrors.PRBMath_SD1x18_ToUD2x18_Underflow(x);\n }\n result = UD2x18.wrap(uint64(xInt));\n}\n\n/// @notice Casts an SD1x18 number into UD60x18.\n/// @dev Requirements:\n/// - x must be positive.\nfunction intoUD60x18(SD1x18 x) pure returns (UD60x18 result) {\n int64 xInt = SD1x18.unwrap(x);\n if (xInt < 0) {\n revert CastingErrors.PRBMath_SD1x18_ToUD60x18_Underflow(x);\n }\n result = UD60x18.wrap(uint64(xInt));\n}\n\n/// @notice Casts an SD1x18 number into uint256.\n/// @dev Requirements:\n/// - x must be positive.\nfunction intoUint256(SD1x18 x) pure returns (uint256 result) {\n int64 xInt = SD1x18.unwrap(x);\n if (xInt < 0) {\n revert CastingErrors.PRBMath_SD1x18_ToUint256_Underflow(x);\n }\n result = uint256(uint64(xInt));\n}\n\n/// @notice Casts an SD1x18 number into uint128.\n/// @dev Requirements:\n/// - x must be positive.\nfunction intoUint128(SD1x18 x) pure returns (uint128 result) {\n int64 xInt = SD1x18.unwrap(x);\n if (xInt < 0) {\n revert CastingErrors.PRBMath_SD1x18_ToUint128_Underflow(x);\n }\n result = uint128(uint64(xInt));\n}\n\n/// @notice Casts an SD1x18 number into uint40.\n/// @dev Requirements:\n/// - x must be positive.\n/// - x must be less than or equal to `MAX_UINT40`.\nfunction intoUint40(SD1x18 x) pure returns (uint40 result) {\n int64 xInt = SD1x18.unwrap(x);\n if (xInt < 0) {\n revert CastingErrors.PRBMath_SD1x18_ToUint40_Underflow(x);\n }\n if (xInt > int64(uint64(Common.MAX_UINT40))) {\n revert CastingErrors.PRBMath_SD1x18_ToUint40_Overflow(x);\n }\n result = uint40(uint64(xInt));\n}\n\n/// @notice Alias for {wrap}.\nfunction sd1x18(int64 x) pure returns (SD1x18 result) {\n result = SD1x18.wrap(x);\n}\n\n/// @notice Unwraps an SD1x18 number into int64.\nfunction unwrap(SD1x18 x) pure returns (int64 result) {\n result = SD1x18.unwrap(x);\n}\n\n/// @notice Wraps an int64 number into SD1x18.\nfunction wrap(int64 x) pure returns (SD1x18 result) {\n result = SD1x18.wrap(x);\n}\n" + }, + "@prb/math/src/sd1x18/Constants.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport { SD1x18 } from \"./ValueType.sol\";\n\n/// @dev Euler's number as an SD1x18 number.\nSD1x18 constant E = SD1x18.wrap(2_718281828459045235);\n\n/// @dev The maximum value an SD1x18 number can have.\nint64 constant uMAX_SD1x18 = 9_223372036854775807;\nSD1x18 constant MAX_SD1x18 = SD1x18.wrap(uMAX_SD1x18);\n\n/// @dev The maximum value an SD1x18 number can have.\nint64 constant uMIN_SD1x18 = -9_223372036854775808;\nSD1x18 constant MIN_SD1x18 = SD1x18.wrap(uMIN_SD1x18);\n\n/// @dev PI as an SD1x18 number.\nSD1x18 constant PI = SD1x18.wrap(3_141592653589793238);\n\n/// @dev The unit number, which gives the decimal precision of SD1x18.\nSD1x18 constant UNIT = SD1x18.wrap(1e18);\nint64 constant uUNIT = 1e18;\n" + }, + "@prb/math/src/sd1x18/Errors.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport { SD1x18 } from \"./ValueType.sol\";\n\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in UD2x18.\nerror PRBMath_SD1x18_ToUD2x18_Underflow(SD1x18 x);\n\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in UD60x18.\nerror PRBMath_SD1x18_ToUD60x18_Underflow(SD1x18 x);\n\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint128.\nerror PRBMath_SD1x18_ToUint128_Underflow(SD1x18 x);\n\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint256.\nerror PRBMath_SD1x18_ToUint256_Underflow(SD1x18 x);\n\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint40.\nerror PRBMath_SD1x18_ToUint40_Overflow(SD1x18 x);\n\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint40.\nerror PRBMath_SD1x18_ToUint40_Underflow(SD1x18 x);\n" + }, + "@prb/math/src/sd1x18/ValueType.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport \"./Casting.sol\" as Casting;\n\n/// @notice The signed 1.18-decimal fixed-point number representation, which can have up to 1 digit and up to 18\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\n/// type int64. This is useful when end users want to use int64 to save gas, e.g. with tight variable packing in contract\n/// storage.\ntype SD1x18 is int64;\n\n/*//////////////////////////////////////////////////////////////////////////\n CASTING\n//////////////////////////////////////////////////////////////////////////*/\n\nusing {\n Casting.intoSD59x18,\n Casting.intoUD2x18,\n Casting.intoUD60x18,\n Casting.intoUint256,\n Casting.intoUint128,\n Casting.intoUint40,\n Casting.unwrap\n} for SD1x18 global;\n" + }, + "@prb/math/src/sd59x18/Casting.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport \"./Errors.sol\" as CastingErrors;\nimport { MAX_UINT128, MAX_UINT40 } from \"../Common.sol\";\nimport { uMAX_SD1x18, uMIN_SD1x18 } from \"../sd1x18/Constants.sol\";\nimport { SD1x18 } from \"../sd1x18/ValueType.sol\";\nimport { uMAX_UD2x18 } from \"../ud2x18/Constants.sol\";\nimport { UD2x18 } from \"../ud2x18/ValueType.sol\";\nimport { UD60x18 } from \"../ud60x18/ValueType.sol\";\nimport { SD59x18 } from \"./ValueType.sol\";\n\n/// @notice Casts an SD59x18 number into int256.\n/// @dev This is basically a functional alias for {unwrap}.\nfunction intoInt256(SD59x18 x) pure returns (int256 result) {\n result = SD59x18.unwrap(x);\n}\n\n/// @notice Casts an SD59x18 number into SD1x18.\n/// @dev Requirements:\n/// - x must be greater than or equal to `uMIN_SD1x18`.\n/// - x must be less than or equal to `uMAX_SD1x18`.\nfunction intoSD1x18(SD59x18 x) pure returns (SD1x18 result) {\n int256 xInt = SD59x18.unwrap(x);\n if (xInt < uMIN_SD1x18) {\n revert CastingErrors.PRBMath_SD59x18_IntoSD1x18_Underflow(x);\n }\n if (xInt > uMAX_SD1x18) {\n revert CastingErrors.PRBMath_SD59x18_IntoSD1x18_Overflow(x);\n }\n result = SD1x18.wrap(int64(xInt));\n}\n\n/// @notice Casts an SD59x18 number into UD2x18.\n/// @dev Requirements:\n/// - x must be positive.\n/// - x must be less than or equal to `uMAX_UD2x18`.\nfunction intoUD2x18(SD59x18 x) pure returns (UD2x18 result) {\n int256 xInt = SD59x18.unwrap(x);\n if (xInt < 0) {\n revert CastingErrors.PRBMath_SD59x18_IntoUD2x18_Underflow(x);\n }\n if (xInt > int256(uint256(uMAX_UD2x18))) {\n revert CastingErrors.PRBMath_SD59x18_IntoUD2x18_Overflow(x);\n }\n result = UD2x18.wrap(uint64(uint256(xInt)));\n}\n\n/// @notice Casts an SD59x18 number into UD60x18.\n/// @dev Requirements:\n/// - x must be positive.\nfunction intoUD60x18(SD59x18 x) pure returns (UD60x18 result) {\n int256 xInt = SD59x18.unwrap(x);\n if (xInt < 0) {\n revert CastingErrors.PRBMath_SD59x18_IntoUD60x18_Underflow(x);\n }\n result = UD60x18.wrap(uint256(xInt));\n}\n\n/// @notice Casts an SD59x18 number into uint256.\n/// @dev Requirements:\n/// - x must be positive.\nfunction intoUint256(SD59x18 x) pure returns (uint256 result) {\n int256 xInt = SD59x18.unwrap(x);\n if (xInt < 0) {\n revert CastingErrors.PRBMath_SD59x18_IntoUint256_Underflow(x);\n }\n result = uint256(xInt);\n}\n\n/// @notice Casts an SD59x18 number into uint128.\n/// @dev Requirements:\n/// - x must be positive.\n/// - x must be less than or equal to `uMAX_UINT128`.\nfunction intoUint128(SD59x18 x) pure returns (uint128 result) {\n int256 xInt = SD59x18.unwrap(x);\n if (xInt < 0) {\n revert CastingErrors.PRBMath_SD59x18_IntoUint128_Underflow(x);\n }\n if (xInt > int256(uint256(MAX_UINT128))) {\n revert CastingErrors.PRBMath_SD59x18_IntoUint128_Overflow(x);\n }\n result = uint128(uint256(xInt));\n}\n\n/// @notice Casts an SD59x18 number into uint40.\n/// @dev Requirements:\n/// - x must be positive.\n/// - x must be less than or equal to `MAX_UINT40`.\nfunction intoUint40(SD59x18 x) pure returns (uint40 result) {\n int256 xInt = SD59x18.unwrap(x);\n if (xInt < 0) {\n revert CastingErrors.PRBMath_SD59x18_IntoUint40_Underflow(x);\n }\n if (xInt > int256(uint256(MAX_UINT40))) {\n revert CastingErrors.PRBMath_SD59x18_IntoUint40_Overflow(x);\n }\n result = uint40(uint256(xInt));\n}\n\n/// @notice Alias for {wrap}.\nfunction sd(int256 x) pure returns (SD59x18 result) {\n result = SD59x18.wrap(x);\n}\n\n/// @notice Alias for {wrap}.\nfunction sd59x18(int256 x) pure returns (SD59x18 result) {\n result = SD59x18.wrap(x);\n}\n\n/// @notice Unwraps an SD59x18 number into int256.\nfunction unwrap(SD59x18 x) pure returns (int256 result) {\n result = SD59x18.unwrap(x);\n}\n\n/// @notice Wraps an int256 number into SD59x18.\nfunction wrap(int256 x) pure returns (SD59x18 result) {\n result = SD59x18.wrap(x);\n}\n" + }, + "@prb/math/src/sd59x18/Constants.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport { SD59x18 } from \"./ValueType.sol\";\n\n// NOTICE: the \"u\" prefix stands for \"unwrapped\".\n\n/// @dev Euler's number as an SD59x18 number.\nSD59x18 constant E = SD59x18.wrap(2_718281828459045235);\n\n/// @dev The maximum input permitted in {exp}.\nint256 constant uEXP_MAX_INPUT = 133_084258667509499440;\nSD59x18 constant EXP_MAX_INPUT = SD59x18.wrap(uEXP_MAX_INPUT);\n\n/// @dev Any value less than this returns 0 in {exp}.\nint256 constant uEXP_MIN_THRESHOLD = -41_446531673892822322;\nSD59x18 constant EXP_MIN_THRESHOLD = SD59x18.wrap(uEXP_MIN_THRESHOLD);\n\n/// @dev The maximum input permitted in {exp2}.\nint256 constant uEXP2_MAX_INPUT = 192e18 - 1;\nSD59x18 constant EXP2_MAX_INPUT = SD59x18.wrap(uEXP2_MAX_INPUT);\n\n/// @dev Any value less than this returns 0 in {exp2}.\nint256 constant uEXP2_MIN_THRESHOLD = -59_794705707972522261;\nSD59x18 constant EXP2_MIN_THRESHOLD = SD59x18.wrap(uEXP2_MIN_THRESHOLD);\n\n/// @dev Half the UNIT number.\nint256 constant uHALF_UNIT = 0.5e18;\nSD59x18 constant HALF_UNIT = SD59x18.wrap(uHALF_UNIT);\n\n/// @dev $log_2(10)$ as an SD59x18 number.\nint256 constant uLOG2_10 = 3_321928094887362347;\nSD59x18 constant LOG2_10 = SD59x18.wrap(uLOG2_10);\n\n/// @dev $log_2(e)$ as an SD59x18 number.\nint256 constant uLOG2_E = 1_442695040888963407;\nSD59x18 constant LOG2_E = SD59x18.wrap(uLOG2_E);\n\n/// @dev The maximum value an SD59x18 number can have.\nint256 constant uMAX_SD59x18 = 57896044618658097711785492504343953926634992332820282019728_792003956564819967;\nSD59x18 constant MAX_SD59x18 = SD59x18.wrap(uMAX_SD59x18);\n\n/// @dev The maximum whole value an SD59x18 number can have.\nint256 constant uMAX_WHOLE_SD59x18 = 57896044618658097711785492504343953926634992332820282019728_000000000000000000;\nSD59x18 constant MAX_WHOLE_SD59x18 = SD59x18.wrap(uMAX_WHOLE_SD59x18);\n\n/// @dev The minimum value an SD59x18 number can have.\nint256 constant uMIN_SD59x18 = -57896044618658097711785492504343953926634992332820282019728_792003956564819968;\nSD59x18 constant MIN_SD59x18 = SD59x18.wrap(uMIN_SD59x18);\n\n/// @dev The minimum whole value an SD59x18 number can have.\nint256 constant uMIN_WHOLE_SD59x18 = -57896044618658097711785492504343953926634992332820282019728_000000000000000000;\nSD59x18 constant MIN_WHOLE_SD59x18 = SD59x18.wrap(uMIN_WHOLE_SD59x18);\n\n/// @dev PI as an SD59x18 number.\nSD59x18 constant PI = SD59x18.wrap(3_141592653589793238);\n\n/// @dev The unit number, which gives the decimal precision of SD59x18.\nint256 constant uUNIT = 1e18;\nSD59x18 constant UNIT = SD59x18.wrap(1e18);\n\n/// @dev The unit number squared.\nint256 constant uUNIT_SQUARED = 1e36;\nSD59x18 constant UNIT_SQUARED = SD59x18.wrap(uUNIT_SQUARED);\n\n/// @dev Zero as an SD59x18 number.\nSD59x18 constant ZERO = SD59x18.wrap(0);\n" + }, + "@prb/math/src/sd59x18/Errors.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport { SD59x18 } from \"./ValueType.sol\";\n\n/// @notice Thrown when taking the absolute value of `MIN_SD59x18`.\nerror PRBMath_SD59x18_Abs_MinSD59x18();\n\n/// @notice Thrown when ceiling a number overflows SD59x18.\nerror PRBMath_SD59x18_Ceil_Overflow(SD59x18 x);\n\n/// @notice Thrown when converting a basic integer to the fixed-point format overflows SD59x18.\nerror PRBMath_SD59x18_Convert_Overflow(int256 x);\n\n/// @notice Thrown when converting a basic integer to the fixed-point format underflows SD59x18.\nerror PRBMath_SD59x18_Convert_Underflow(int256 x);\n\n/// @notice Thrown when dividing two numbers and one of them is `MIN_SD59x18`.\nerror PRBMath_SD59x18_Div_InputTooSmall();\n\n/// @notice Thrown when dividing two numbers and one of the intermediary unsigned results overflows SD59x18.\nerror PRBMath_SD59x18_Div_Overflow(SD59x18 x, SD59x18 y);\n\n/// @notice Thrown when taking the natural exponent of a base greater than 133_084258667509499441.\nerror PRBMath_SD59x18_Exp_InputTooBig(SD59x18 x);\n\n/// @notice Thrown when taking the binary exponent of a base greater than 192e18.\nerror PRBMath_SD59x18_Exp2_InputTooBig(SD59x18 x);\n\n/// @notice Thrown when flooring a number underflows SD59x18.\nerror PRBMath_SD59x18_Floor_Underflow(SD59x18 x);\n\n/// @notice Thrown when taking the geometric mean of two numbers and their product is negative.\nerror PRBMath_SD59x18_Gm_NegativeProduct(SD59x18 x, SD59x18 y);\n\n/// @notice Thrown when taking the geometric mean of two numbers and multiplying them overflows SD59x18.\nerror PRBMath_SD59x18_Gm_Overflow(SD59x18 x, SD59x18 y);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\nerror PRBMath_SD59x18_IntoSD1x18_Overflow(SD59x18 x);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\nerror PRBMath_SD59x18_IntoSD1x18_Underflow(SD59x18 x);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\nerror PRBMath_SD59x18_IntoUD2x18_Overflow(SD59x18 x);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\nerror PRBMath_SD59x18_IntoUD2x18_Underflow(SD59x18 x);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD60x18.\nerror PRBMath_SD59x18_IntoUD60x18_Underflow(SD59x18 x);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\nerror PRBMath_SD59x18_IntoUint128_Overflow(SD59x18 x);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\nerror PRBMath_SD59x18_IntoUint128_Underflow(SD59x18 x);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint256.\nerror PRBMath_SD59x18_IntoUint256_Underflow(SD59x18 x);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\nerror PRBMath_SD59x18_IntoUint40_Overflow(SD59x18 x);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\nerror PRBMath_SD59x18_IntoUint40_Underflow(SD59x18 x);\n\n/// @notice Thrown when taking the logarithm of a number less than or equal to zero.\nerror PRBMath_SD59x18_Log_InputTooSmall(SD59x18 x);\n\n/// @notice Thrown when multiplying two numbers and one of the inputs is `MIN_SD59x18`.\nerror PRBMath_SD59x18_Mul_InputTooSmall();\n\n/// @notice Thrown when multiplying two numbers and the intermediary absolute result overflows SD59x18.\nerror PRBMath_SD59x18_Mul_Overflow(SD59x18 x, SD59x18 y);\n\n/// @notice Thrown when raising a number to a power and the intermediary absolute result overflows SD59x18.\nerror PRBMath_SD59x18_Powu_Overflow(SD59x18 x, uint256 y);\n\n/// @notice Thrown when taking the square root of a negative number.\nerror PRBMath_SD59x18_Sqrt_NegativeInput(SD59x18 x);\n\n/// @notice Thrown when the calculating the square root overflows SD59x18.\nerror PRBMath_SD59x18_Sqrt_Overflow(SD59x18 x);\n" + }, + "@prb/math/src/sd59x18/Helpers.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport { wrap } from \"./Casting.sol\";\nimport { SD59x18 } from \"./ValueType.sol\";\n\n/// @notice Implements the checked addition operation (+) in the SD59x18 type.\nfunction add(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\n return wrap(x.unwrap() + y.unwrap());\n}\n\n/// @notice Implements the AND (&) bitwise operation in the SD59x18 type.\nfunction and(SD59x18 x, int256 bits) pure returns (SD59x18 result) {\n return wrap(x.unwrap() & bits);\n}\n\n/// @notice Implements the AND (&) bitwise operation in the SD59x18 type.\nfunction and2(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\n return wrap(x.unwrap() & y.unwrap());\n}\n\n/// @notice Implements the equal (=) operation in the SD59x18 type.\nfunction eq(SD59x18 x, SD59x18 y) pure returns (bool result) {\n result = x.unwrap() == y.unwrap();\n}\n\n/// @notice Implements the greater than operation (>) in the SD59x18 type.\nfunction gt(SD59x18 x, SD59x18 y) pure returns (bool result) {\n result = x.unwrap() > y.unwrap();\n}\n\n/// @notice Implements the greater than or equal to operation (>=) in the SD59x18 type.\nfunction gte(SD59x18 x, SD59x18 y) pure returns (bool result) {\n result = x.unwrap() >= y.unwrap();\n}\n\n/// @notice Implements a zero comparison check function in the SD59x18 type.\nfunction isZero(SD59x18 x) pure returns (bool result) {\n result = x.unwrap() == 0;\n}\n\n/// @notice Implements the left shift operation (<<) in the SD59x18 type.\nfunction lshift(SD59x18 x, uint256 bits) pure returns (SD59x18 result) {\n result = wrap(x.unwrap() << bits);\n}\n\n/// @notice Implements the lower than operation (<) in the SD59x18 type.\nfunction lt(SD59x18 x, SD59x18 y) pure returns (bool result) {\n result = x.unwrap() < y.unwrap();\n}\n\n/// @notice Implements the lower than or equal to operation (<=) in the SD59x18 type.\nfunction lte(SD59x18 x, SD59x18 y) pure returns (bool result) {\n result = x.unwrap() <= y.unwrap();\n}\n\n/// @notice Implements the unchecked modulo operation (%) in the SD59x18 type.\nfunction mod(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\n result = wrap(x.unwrap() % y.unwrap());\n}\n\n/// @notice Implements the not equal operation (!=) in the SD59x18 type.\nfunction neq(SD59x18 x, SD59x18 y) pure returns (bool result) {\n result = x.unwrap() != y.unwrap();\n}\n\n/// @notice Implements the NOT (~) bitwise operation in the SD59x18 type.\nfunction not(SD59x18 x) pure returns (SD59x18 result) {\n result = wrap(~x.unwrap());\n}\n\n/// @notice Implements the OR (|) bitwise operation in the SD59x18 type.\nfunction or(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\n result = wrap(x.unwrap() | y.unwrap());\n}\n\n/// @notice Implements the right shift operation (>>) in the SD59x18 type.\nfunction rshift(SD59x18 x, uint256 bits) pure returns (SD59x18 result) {\n result = wrap(x.unwrap() >> bits);\n}\n\n/// @notice Implements the checked subtraction operation (-) in the SD59x18 type.\nfunction sub(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\n result = wrap(x.unwrap() - y.unwrap());\n}\n\n/// @notice Implements the checked unary minus operation (-) in the SD59x18 type.\nfunction unary(SD59x18 x) pure returns (SD59x18 result) {\n result = wrap(-x.unwrap());\n}\n\n/// @notice Implements the unchecked addition operation (+) in the SD59x18 type.\nfunction uncheckedAdd(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\n unchecked {\n result = wrap(x.unwrap() + y.unwrap());\n }\n}\n\n/// @notice Implements the unchecked subtraction operation (-) in the SD59x18 type.\nfunction uncheckedSub(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\n unchecked {\n result = wrap(x.unwrap() - y.unwrap());\n }\n}\n\n/// @notice Implements the unchecked unary minus operation (-) in the SD59x18 type.\nfunction uncheckedUnary(SD59x18 x) pure returns (SD59x18 result) {\n unchecked {\n result = wrap(-x.unwrap());\n }\n}\n\n/// @notice Implements the XOR (^) bitwise operation in the SD59x18 type.\nfunction xor(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\n result = wrap(x.unwrap() ^ y.unwrap());\n}\n" + }, + "@prb/math/src/sd59x18/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport \"../Common.sol\" as Common;\nimport \"./Errors.sol\" as Errors;\nimport {\n uEXP_MAX_INPUT,\n uEXP2_MAX_INPUT,\n uEXP_MIN_THRESHOLD,\n uEXP2_MIN_THRESHOLD,\n uHALF_UNIT,\n uLOG2_10,\n uLOG2_E,\n uMAX_SD59x18,\n uMAX_WHOLE_SD59x18,\n uMIN_SD59x18,\n uMIN_WHOLE_SD59x18,\n UNIT,\n uUNIT,\n uUNIT_SQUARED,\n ZERO\n} from \"./Constants.sol\";\nimport { wrap } from \"./Helpers.sol\";\nimport { SD59x18 } from \"./ValueType.sol\";\n\n/// @notice Calculates the absolute value of x.\n///\n/// @dev Requirements:\n/// - x must be greater than `MIN_SD59x18`.\n///\n/// @param x The SD59x18 number for which to calculate the absolute value.\n/// @param result The absolute value of x as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction abs(SD59x18 x) pure returns (SD59x18 result) {\n int256 xInt = x.unwrap();\n if (xInt == uMIN_SD59x18) {\n revert Errors.PRBMath_SD59x18_Abs_MinSD59x18();\n }\n result = xInt < 0 ? wrap(-xInt) : x;\n}\n\n/// @notice Calculates the arithmetic average of x and y.\n///\n/// @dev Notes:\n/// - The result is rounded toward zero.\n///\n/// @param x The first operand as an SD59x18 number.\n/// @param y The second operand as an SD59x18 number.\n/// @return result The arithmetic average as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction avg(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\n int256 xInt = x.unwrap();\n int256 yInt = y.unwrap();\n\n unchecked {\n // This operation is equivalent to `x / 2 + y / 2`, and it can never overflow.\n int256 sum = (xInt >> 1) + (yInt >> 1);\n\n if (sum < 0) {\n // If at least one of x and y is odd, add 1 to the result, because shifting negative numbers to the right\n // rounds toward negative infinity. The right part is equivalent to `sum + (x % 2 == 1 || y % 2 == 1)`.\n assembly (\"memory-safe\") {\n result := add(sum, and(or(xInt, yInt), 1))\n }\n } else {\n // Add 1 if both x and y are odd to account for the double 0.5 remainder truncated after shifting.\n result = wrap(sum + (xInt & yInt & 1));\n }\n }\n}\n\n/// @notice Yields the smallest whole number greater than or equal to x.\n///\n/// @dev Optimized for fractional value inputs, because every whole value has (1e18 - 1) fractional counterparts.\n/// See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\n///\n/// Requirements:\n/// - x must be less than or equal to `MAX_WHOLE_SD59x18`.\n///\n/// @param x The SD59x18 number to ceil.\n/// @param result The smallest whole number greater than or equal to x, as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction ceil(SD59x18 x) pure returns (SD59x18 result) {\n int256 xInt = x.unwrap();\n if (xInt > uMAX_WHOLE_SD59x18) {\n revert Errors.PRBMath_SD59x18_Ceil_Overflow(x);\n }\n\n int256 remainder = xInt % uUNIT;\n if (remainder == 0) {\n result = x;\n } else {\n unchecked {\n // Solidity uses C fmod style, which returns a modulus with the same sign as x.\n int256 resultInt = xInt - remainder;\n if (xInt > 0) {\n resultInt += uUNIT;\n }\n result = wrap(resultInt);\n }\n }\n}\n\n/// @notice Divides two SD59x18 numbers, returning a new SD59x18 number.\n///\n/// @dev This is an extension of {Common.mulDiv} for signed numbers, which works by computing the signs and the absolute\n/// values separately.\n///\n/// Notes:\n/// - Refer to the notes in {Common.mulDiv}.\n/// - The result is rounded toward zero.\n///\n/// Requirements:\n/// - Refer to the requirements in {Common.mulDiv}.\n/// - None of the inputs can be `MIN_SD59x18`.\n/// - The denominator must not be zero.\n/// - The result must fit in SD59x18.\n///\n/// @param x The numerator as an SD59x18 number.\n/// @param y The denominator as an SD59x18 number.\n/// @param result The quotient as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction div(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\n int256 xInt = x.unwrap();\n int256 yInt = y.unwrap();\n if (xInt == uMIN_SD59x18 || yInt == uMIN_SD59x18) {\n revert Errors.PRBMath_SD59x18_Div_InputTooSmall();\n }\n\n // Get hold of the absolute values of x and y.\n uint256 xAbs;\n uint256 yAbs;\n unchecked {\n xAbs = xInt < 0 ? uint256(-xInt) : uint256(xInt);\n yAbs = yInt < 0 ? uint256(-yInt) : uint256(yInt);\n }\n\n // Compute the absolute value (x*UNIT÷y). The resulting value must fit in SD59x18.\n uint256 resultAbs = Common.mulDiv(xAbs, uint256(uUNIT), yAbs);\n if (resultAbs > uint256(uMAX_SD59x18)) {\n revert Errors.PRBMath_SD59x18_Div_Overflow(x, y);\n }\n\n // Check if x and y have the same sign using two's complement representation. The left-most bit represents the sign (1 for\n // negative, 0 for positive or zero).\n bool sameSign = (xInt ^ yInt) > -1;\n\n // If the inputs have the same sign, the result should be positive. Otherwise, it should be negative.\n unchecked {\n result = wrap(sameSign ? int256(resultAbs) : -int256(resultAbs));\n }\n}\n\n/// @notice Calculates the natural exponent of x using the following formula:\n///\n/// $$\n/// e^x = 2^{x * log_2{e}}\n/// $$\n///\n/// @dev Notes:\n/// - Refer to the notes in {exp2}.\n///\n/// Requirements:\n/// - Refer to the requirements in {exp2}.\n/// - x must be less than 133_084258667509499441.\n///\n/// @param x The exponent as an SD59x18 number.\n/// @return result The result as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction exp(SD59x18 x) pure returns (SD59x18 result) {\n int256 xInt = x.unwrap();\n\n // Any input less than the threshold returns zero.\n // This check also prevents an overflow for very small numbers.\n if (xInt < uEXP_MIN_THRESHOLD) {\n return ZERO;\n }\n\n // This check prevents values greater than 192e18 from being passed to {exp2}.\n if (xInt > uEXP_MAX_INPUT) {\n revert Errors.PRBMath_SD59x18_Exp_InputTooBig(x);\n }\n\n unchecked {\n // Inline the fixed-point multiplication to save gas.\n int256 doubleUnitProduct = xInt * uLOG2_E;\n result = exp2(wrap(doubleUnitProduct / uUNIT));\n }\n}\n\n/// @notice Calculates the binary exponent of x using the binary fraction method using the following formula:\n///\n/// $$\n/// 2^{-x} = \\frac{1}{2^x}\n/// $$\n///\n/// @dev See https://ethereum.stackexchange.com/q/79903/24693.\n///\n/// Notes:\n/// - If x is less than -59_794705707972522261, the result is zero.\n///\n/// Requirements:\n/// - x must be less than 192e18.\n/// - The result must fit in SD59x18.\n///\n/// @param x The exponent as an SD59x18 number.\n/// @return result The result as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction exp2(SD59x18 x) pure returns (SD59x18 result) {\n int256 xInt = x.unwrap();\n if (xInt < 0) {\n // The inverse of any number less than the threshold is truncated to zero.\n if (xInt < uEXP2_MIN_THRESHOLD) {\n return ZERO;\n }\n\n unchecked {\n // Inline the fixed-point inversion to save gas.\n result = wrap(uUNIT_SQUARED / exp2(wrap(-xInt)).unwrap());\n }\n } else {\n // Numbers greater than or equal to 192e18 don't fit in the 192.64-bit format.\n if (xInt > uEXP2_MAX_INPUT) {\n revert Errors.PRBMath_SD59x18_Exp2_InputTooBig(x);\n }\n\n unchecked {\n // Convert x to the 192.64-bit fixed-point format.\n uint256 x_192x64 = uint256((xInt << 64) / uUNIT);\n\n // It is safe to cast the result to int256 due to the checks above.\n result = wrap(int256(Common.exp2(x_192x64)));\n }\n }\n}\n\n/// @notice Yields the greatest whole number less than or equal to x.\n///\n/// @dev Optimized for fractional value inputs, because for every whole value there are (1e18 - 1) fractional\n/// counterparts. See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\n///\n/// Requirements:\n/// - x must be greater than or equal to `MIN_WHOLE_SD59x18`.\n///\n/// @param x The SD59x18 number to floor.\n/// @param result The greatest whole number less than or equal to x, as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction floor(SD59x18 x) pure returns (SD59x18 result) {\n int256 xInt = x.unwrap();\n if (xInt < uMIN_WHOLE_SD59x18) {\n revert Errors.PRBMath_SD59x18_Floor_Underflow(x);\n }\n\n int256 remainder = xInt % uUNIT;\n if (remainder == 0) {\n result = x;\n } else {\n unchecked {\n // Solidity uses C fmod style, which returns a modulus with the same sign as x.\n int256 resultInt = xInt - remainder;\n if (xInt < 0) {\n resultInt -= uUNIT;\n }\n result = wrap(resultInt);\n }\n }\n}\n\n/// @notice Yields the excess beyond the floor of x for positive numbers and the part of the number to the right.\n/// of the radix point for negative numbers.\n/// @dev Based on the odd function definition. https://en.wikipedia.org/wiki/Fractional_part\n/// @param x The SD59x18 number to get the fractional part of.\n/// @param result The fractional part of x as an SD59x18 number.\nfunction frac(SD59x18 x) pure returns (SD59x18 result) {\n result = wrap(x.unwrap() % uUNIT);\n}\n\n/// @notice Calculates the geometric mean of x and y, i.e. $\\sqrt{x * y}$.\n///\n/// @dev Notes:\n/// - The result is rounded toward zero.\n///\n/// Requirements:\n/// - x * y must fit in SD59x18.\n/// - x * y must not be negative, since complex numbers are not supported.\n///\n/// @param x The first operand as an SD59x18 number.\n/// @param y The second operand as an SD59x18 number.\n/// @return result The result as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction gm(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\n int256 xInt = x.unwrap();\n int256 yInt = y.unwrap();\n if (xInt == 0 || yInt == 0) {\n return ZERO;\n }\n\n unchecked {\n // Equivalent to `xy / x != y`. Checking for overflow this way is faster than letting Solidity do it.\n int256 xyInt = xInt * yInt;\n if (xyInt / xInt != yInt) {\n revert Errors.PRBMath_SD59x18_Gm_Overflow(x, y);\n }\n\n // The product must not be negative, since complex numbers are not supported.\n if (xyInt < 0) {\n revert Errors.PRBMath_SD59x18_Gm_NegativeProduct(x, y);\n }\n\n // We don't need to multiply the result by `UNIT` here because the x*y product picked up a factor of `UNIT`\n // during multiplication. See the comments in {Common.sqrt}.\n uint256 resultUint = Common.sqrt(uint256(xyInt));\n result = wrap(int256(resultUint));\n }\n}\n\n/// @notice Calculates the inverse of x.\n///\n/// @dev Notes:\n/// - The result is rounded toward zero.\n///\n/// Requirements:\n/// - x must not be zero.\n///\n/// @param x The SD59x18 number for which to calculate the inverse.\n/// @return result The inverse as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction inv(SD59x18 x) pure returns (SD59x18 result) {\n result = wrap(uUNIT_SQUARED / x.unwrap());\n}\n\n/// @notice Calculates the natural logarithm of x using the following formula:\n///\n/// $$\n/// ln{x} = log_2{x} / log_2{e}\n/// $$\n///\n/// @dev Notes:\n/// - Refer to the notes in {log2}.\n/// - The precision isn't sufficiently fine-grained to return exactly `UNIT` when the input is `E`.\n///\n/// Requirements:\n/// - Refer to the requirements in {log2}.\n///\n/// @param x The SD59x18 number for which to calculate the natural logarithm.\n/// @return result The natural logarithm as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction ln(SD59x18 x) pure returns (SD59x18 result) {\n // Inline the fixed-point multiplication to save gas. This is overflow-safe because the maximum value that\n // {log2} can return is ~195_205294292027477728.\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_E);\n}\n\n/// @notice Calculates the common logarithm of x using the following formula:\n///\n/// $$\n/// log_{10}{x} = log_2{x} / log_2{10}\n/// $$\n///\n/// However, if x is an exact power of ten, a hard coded value is returned.\n///\n/// @dev Notes:\n/// - Refer to the notes in {log2}.\n///\n/// Requirements:\n/// - Refer to the requirements in {log2}.\n///\n/// @param x The SD59x18 number for which to calculate the common logarithm.\n/// @return result The common logarithm as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction log10(SD59x18 x) pure returns (SD59x18 result) {\n int256 xInt = x.unwrap();\n if (xInt < 0) {\n revert Errors.PRBMath_SD59x18_Log_InputTooSmall(x);\n }\n\n // Note that the `mul` in this block is the standard multiplication operation, not {SD59x18.mul}.\n // prettier-ignore\n assembly (\"memory-safe\") {\n switch x\n case 1 { result := mul(uUNIT, sub(0, 18)) }\n case 10 { result := mul(uUNIT, sub(1, 18)) }\n case 100 { result := mul(uUNIT, sub(2, 18)) }\n case 1000 { result := mul(uUNIT, sub(3, 18)) }\n case 10000 { result := mul(uUNIT, sub(4, 18)) }\n case 100000 { result := mul(uUNIT, sub(5, 18)) }\n case 1000000 { result := mul(uUNIT, sub(6, 18)) }\n case 10000000 { result := mul(uUNIT, sub(7, 18)) }\n case 100000000 { result := mul(uUNIT, sub(8, 18)) }\n case 1000000000 { result := mul(uUNIT, sub(9, 18)) }\n case 10000000000 { result := mul(uUNIT, sub(10, 18)) }\n case 100000000000 { result := mul(uUNIT, sub(11, 18)) }\n case 1000000000000 { result := mul(uUNIT, sub(12, 18)) }\n case 10000000000000 { result := mul(uUNIT, sub(13, 18)) }\n case 100000000000000 { result := mul(uUNIT, sub(14, 18)) }\n case 1000000000000000 { result := mul(uUNIT, sub(15, 18)) }\n case 10000000000000000 { result := mul(uUNIT, sub(16, 18)) }\n case 100000000000000000 { result := mul(uUNIT, sub(17, 18)) }\n case 1000000000000000000 { result := 0 }\n case 10000000000000000000 { result := uUNIT }\n case 100000000000000000000 { result := mul(uUNIT, 2) }\n case 1000000000000000000000 { result := mul(uUNIT, 3) }\n case 10000000000000000000000 { result := mul(uUNIT, 4) }\n case 100000000000000000000000 { result := mul(uUNIT, 5) }\n case 1000000000000000000000000 { result := mul(uUNIT, 6) }\n case 10000000000000000000000000 { result := mul(uUNIT, 7) }\n case 100000000000000000000000000 { result := mul(uUNIT, 8) }\n case 1000000000000000000000000000 { result := mul(uUNIT, 9) }\n case 10000000000000000000000000000 { result := mul(uUNIT, 10) }\n case 100000000000000000000000000000 { result := mul(uUNIT, 11) }\n case 1000000000000000000000000000000 { result := mul(uUNIT, 12) }\n case 10000000000000000000000000000000 { result := mul(uUNIT, 13) }\n case 100000000000000000000000000000000 { result := mul(uUNIT, 14) }\n case 1000000000000000000000000000000000 { result := mul(uUNIT, 15) }\n case 10000000000000000000000000000000000 { result := mul(uUNIT, 16) }\n case 100000000000000000000000000000000000 { result := mul(uUNIT, 17) }\n case 1000000000000000000000000000000000000 { result := mul(uUNIT, 18) }\n case 10000000000000000000000000000000000000 { result := mul(uUNIT, 19) }\n case 100000000000000000000000000000000000000 { result := mul(uUNIT, 20) }\n case 1000000000000000000000000000000000000000 { result := mul(uUNIT, 21) }\n case 10000000000000000000000000000000000000000 { result := mul(uUNIT, 22) }\n case 100000000000000000000000000000000000000000 { result := mul(uUNIT, 23) }\n case 1000000000000000000000000000000000000000000 { result := mul(uUNIT, 24) }\n case 10000000000000000000000000000000000000000000 { result := mul(uUNIT, 25) }\n case 100000000000000000000000000000000000000000000 { result := mul(uUNIT, 26) }\n case 1000000000000000000000000000000000000000000000 { result := mul(uUNIT, 27) }\n case 10000000000000000000000000000000000000000000000 { result := mul(uUNIT, 28) }\n case 100000000000000000000000000000000000000000000000 { result := mul(uUNIT, 29) }\n case 1000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 30) }\n case 10000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 31) }\n case 100000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 32) }\n case 1000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 33) }\n case 10000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 34) }\n case 100000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 35) }\n case 1000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 36) }\n case 10000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 37) }\n case 100000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 38) }\n case 1000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 39) }\n case 10000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 40) }\n case 100000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 41) }\n case 1000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 42) }\n case 10000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 43) }\n case 100000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 44) }\n case 1000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 45) }\n case 10000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 46) }\n case 100000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 47) }\n case 1000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 48) }\n case 10000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 49) }\n case 100000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 50) }\n case 1000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 51) }\n case 10000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 52) }\n case 100000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 53) }\n case 1000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 54) }\n case 10000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 55) }\n case 100000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 56) }\n case 1000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 57) }\n case 10000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 58) }\n default { result := uMAX_SD59x18 }\n }\n\n if (result.unwrap() == uMAX_SD59x18) {\n unchecked {\n // Inline the fixed-point division to save gas.\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_10);\n }\n }\n}\n\n/// @notice Calculates the binary logarithm of x using the iterative approximation algorithm:\n///\n/// $$\n/// log_2{x} = n + log_2{y}, \\text{ where } y = x*2^{-n}, \\ y \\in [1, 2)\n/// $$\n///\n/// For $0 \\leq x \\lt 1$, the input is inverted:\n///\n/// $$\n/// log_2{x} = -log_2{\\frac{1}{x}}\n/// $$\n///\n/// @dev See https://en.wikipedia.org/wiki/Binary_logarithm#Iterative_approximation.\n///\n/// Notes:\n/// - Due to the lossy precision of the iterative approximation, the results are not perfectly accurate to the last decimal.\n///\n/// Requirements:\n/// - x must be greater than zero.\n///\n/// @param x The SD59x18 number for which to calculate the binary logarithm.\n/// @return result The binary logarithm as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction log2(SD59x18 x) pure returns (SD59x18 result) {\n int256 xInt = x.unwrap();\n if (xInt <= 0) {\n revert Errors.PRBMath_SD59x18_Log_InputTooSmall(x);\n }\n\n unchecked {\n int256 sign;\n if (xInt >= uUNIT) {\n sign = 1;\n } else {\n sign = -1;\n // Inline the fixed-point inversion to save gas.\n xInt = uUNIT_SQUARED / xInt;\n }\n\n // Calculate the integer part of the logarithm.\n uint256 n = Common.msb(uint256(xInt / uUNIT));\n\n // This is the integer part of the logarithm as an SD59x18 number. The operation can't overflow\n // because n is at most 255, `UNIT` is 1e18, and the sign is either 1 or -1.\n int256 resultInt = int256(n) * uUNIT;\n\n // Calculate $y = x * 2^{-n}$.\n int256 y = xInt >> n;\n\n // If y is the unit number, the fractional part is zero.\n if (y == uUNIT) {\n return wrap(resultInt * sign);\n }\n\n // Calculate the fractional part via the iterative approximation.\n // The `delta >>= 1` part is equivalent to `delta /= 2`, but shifting bits is more gas efficient.\n int256 DOUBLE_UNIT = 2e18;\n for (int256 delta = uHALF_UNIT; delta > 0; delta >>= 1) {\n y = (y * y) / uUNIT;\n\n // Is y^2 >= 2e18 and so in the range [2e18, 4e18)?\n if (y >= DOUBLE_UNIT) {\n // Add the 2^{-m} factor to the logarithm.\n resultInt = resultInt + delta;\n\n // Halve y, which corresponds to z/2 in the Wikipedia article.\n y >>= 1;\n }\n }\n resultInt *= sign;\n result = wrap(resultInt);\n }\n}\n\n/// @notice Multiplies two SD59x18 numbers together, returning a new SD59x18 number.\n///\n/// @dev Notes:\n/// - Refer to the notes in {Common.mulDiv18}.\n///\n/// Requirements:\n/// - Refer to the requirements in {Common.mulDiv18}.\n/// - None of the inputs can be `MIN_SD59x18`.\n/// - The result must fit in SD59x18.\n///\n/// @param x The multiplicand as an SD59x18 number.\n/// @param y The multiplier as an SD59x18 number.\n/// @return result The product as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction mul(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\n int256 xInt = x.unwrap();\n int256 yInt = y.unwrap();\n if (xInt == uMIN_SD59x18 || yInt == uMIN_SD59x18) {\n revert Errors.PRBMath_SD59x18_Mul_InputTooSmall();\n }\n\n // Get hold of the absolute values of x and y.\n uint256 xAbs;\n uint256 yAbs;\n unchecked {\n xAbs = xInt < 0 ? uint256(-xInt) : uint256(xInt);\n yAbs = yInt < 0 ? uint256(-yInt) : uint256(yInt);\n }\n\n // Compute the absolute value (x*y÷UNIT). The resulting value must fit in SD59x18.\n uint256 resultAbs = Common.mulDiv18(xAbs, yAbs);\n if (resultAbs > uint256(uMAX_SD59x18)) {\n revert Errors.PRBMath_SD59x18_Mul_Overflow(x, y);\n }\n\n // Check if x and y have the same sign using two's complement representation. The left-most bit represents the sign (1 for\n // negative, 0 for positive or zero).\n bool sameSign = (xInt ^ yInt) > -1;\n\n // If the inputs have the same sign, the result should be positive. Otherwise, it should be negative.\n unchecked {\n result = wrap(sameSign ? int256(resultAbs) : -int256(resultAbs));\n }\n}\n\n/// @notice Raises x to the power of y using the following formula:\n///\n/// $$\n/// x^y = 2^{log_2{x} * y}\n/// $$\n///\n/// @dev Notes:\n/// - Refer to the notes in {exp2}, {log2}, and {mul}.\n/// - Returns `UNIT` for 0^0.\n///\n/// Requirements:\n/// - Refer to the requirements in {exp2}, {log2}, and {mul}.\n///\n/// @param x The base as an SD59x18 number.\n/// @param y Exponent to raise x to, as an SD59x18 number\n/// @return result x raised to power y, as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction pow(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\n int256 xInt = x.unwrap();\n int256 yInt = y.unwrap();\n\n // If both x and y are zero, the result is `UNIT`. If just x is zero, the result is always zero.\n if (xInt == 0) {\n return yInt == 0 ? UNIT : ZERO;\n }\n // If x is `UNIT`, the result is always `UNIT`.\n else if (xInt == uUNIT) {\n return UNIT;\n }\n\n // If y is zero, the result is always `UNIT`.\n if (yInt == 0) {\n return UNIT;\n }\n // If y is `UNIT`, the result is always x.\n else if (yInt == uUNIT) {\n return x;\n }\n\n // Calculate the result using the formula.\n result = exp2(mul(log2(x), y));\n}\n\n/// @notice Raises x (an SD59x18 number) to the power y (an unsigned basic integer) using the well-known\n/// algorithm \"exponentiation by squaring\".\n///\n/// @dev See https://en.wikipedia.org/wiki/Exponentiation_by_squaring.\n///\n/// Notes:\n/// - Refer to the notes in {Common.mulDiv18}.\n/// - Returns `UNIT` for 0^0.\n///\n/// Requirements:\n/// - Refer to the requirements in {abs} and {Common.mulDiv18}.\n/// - The result must fit in SD59x18.\n///\n/// @param x The base as an SD59x18 number.\n/// @param y The exponent as a uint256.\n/// @return result The result as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction powu(SD59x18 x, uint256 y) pure returns (SD59x18 result) {\n uint256 xAbs = uint256(abs(x).unwrap());\n\n // Calculate the first iteration of the loop in advance.\n uint256 resultAbs = y & 1 > 0 ? xAbs : uint256(uUNIT);\n\n // Equivalent to `for(y /= 2; y > 0; y /= 2)`.\n uint256 yAux = y;\n for (yAux >>= 1; yAux > 0; yAux >>= 1) {\n xAbs = Common.mulDiv18(xAbs, xAbs);\n\n // Equivalent to `y % 2 == 1`.\n if (yAux & 1 > 0) {\n resultAbs = Common.mulDiv18(resultAbs, xAbs);\n }\n }\n\n // The result must fit in SD59x18.\n if (resultAbs > uint256(uMAX_SD59x18)) {\n revert Errors.PRBMath_SD59x18_Powu_Overflow(x, y);\n }\n\n unchecked {\n // Is the base negative and the exponent odd? If yes, the result should be negative.\n int256 resultInt = int256(resultAbs);\n bool isNegative = x.unwrap() < 0 && y & 1 == 1;\n if (isNegative) {\n resultInt = -resultInt;\n }\n result = wrap(resultInt);\n }\n}\n\n/// @notice Calculates the square root of x using the Babylonian method.\n///\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\n///\n/// Notes:\n/// - Only the positive root is returned.\n/// - The result is rounded toward zero.\n///\n/// Requirements:\n/// - x cannot be negative, since complex numbers are not supported.\n/// - x must be less than `MAX_SD59x18 / UNIT`.\n///\n/// @param x The SD59x18 number for which to calculate the square root.\n/// @return result The result as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction sqrt(SD59x18 x) pure returns (SD59x18 result) {\n int256 xInt = x.unwrap();\n if (xInt < 0) {\n revert Errors.PRBMath_SD59x18_Sqrt_NegativeInput(x);\n }\n if (xInt > uMAX_SD59x18 / uUNIT) {\n revert Errors.PRBMath_SD59x18_Sqrt_Overflow(x);\n }\n\n unchecked {\n // Multiply x by `UNIT` to account for the factor of `UNIT` picked up when multiplying two SD59x18 numbers.\n // In this case, the two numbers are both the square root.\n uint256 resultUint = Common.sqrt(uint256(xInt * uUNIT));\n result = wrap(int256(resultUint));\n }\n}\n" + }, + "@prb/math/src/sd59x18/ValueType.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport \"./Casting.sol\" as Casting;\nimport \"./Helpers.sol\" as Helpers;\nimport \"./Math.sol\" as Math;\n\n/// @notice The signed 59.18-decimal fixed-point number representation, which can have up to 59 digits and up to 18\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\n/// type int256.\ntype SD59x18 is int256;\n\n/*//////////////////////////////////////////////////////////////////////////\n CASTING\n//////////////////////////////////////////////////////////////////////////*/\n\nusing {\n Casting.intoInt256,\n Casting.intoSD1x18,\n Casting.intoUD2x18,\n Casting.intoUD60x18,\n Casting.intoUint256,\n Casting.intoUint128,\n Casting.intoUint40,\n Casting.unwrap\n} for SD59x18 global;\n\n/*//////////////////////////////////////////////////////////////////////////\n MATHEMATICAL FUNCTIONS\n//////////////////////////////////////////////////////////////////////////*/\n\nusing {\n Math.abs,\n Math.avg,\n Math.ceil,\n Math.div,\n Math.exp,\n Math.exp2,\n Math.floor,\n Math.frac,\n Math.gm,\n Math.inv,\n Math.log10,\n Math.log2,\n Math.ln,\n Math.mul,\n Math.pow,\n Math.powu,\n Math.sqrt\n} for SD59x18 global;\n\n/*//////////////////////////////////////////////////////////////////////////\n HELPER FUNCTIONS\n//////////////////////////////////////////////////////////////////////////*/\n\nusing {\n Helpers.add,\n Helpers.and,\n Helpers.eq,\n Helpers.gt,\n Helpers.gte,\n Helpers.isZero,\n Helpers.lshift,\n Helpers.lt,\n Helpers.lte,\n Helpers.mod,\n Helpers.neq,\n Helpers.not,\n Helpers.or,\n Helpers.rshift,\n Helpers.sub,\n Helpers.uncheckedAdd,\n Helpers.uncheckedSub,\n Helpers.uncheckedUnary,\n Helpers.xor\n} for SD59x18 global;\n\n/*//////////////////////////////////////////////////////////////////////////\n OPERATORS\n//////////////////////////////////////////////////////////////////////////*/\n\n// The global \"using for\" directive makes it possible to use these operators on the SD59x18 type.\nusing {\n Helpers.add as +,\n Helpers.and2 as &,\n Math.div as /,\n Helpers.eq as ==,\n Helpers.gt as >,\n Helpers.gte as >=,\n Helpers.lt as <,\n Helpers.lte as <=,\n Helpers.mod as %,\n Math.mul as *,\n Helpers.neq as !=,\n Helpers.not as ~,\n Helpers.or as |,\n Helpers.sub as -,\n Helpers.unary as -,\n Helpers.xor as ^\n} for SD59x18 global;\n" + }, + "@prb/math/src/UD2x18.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\n/*\n\n██████╗ ██████╗ ██████╗ ███╗ ███╗ █████╗ ████████╗██╗ ██╗\n██╔══██╗██╔══██╗██╔══██╗████╗ ████║██╔══██╗╚══██╔══╝██║ ██║\n██████╔╝██████╔╝██████╔╝██╔████╔██║███████║ ██║ ███████║\n██╔═══╝ ██╔══██╗██╔══██╗██║╚██╔╝██║██╔══██║ ██║ ██╔══██║\n██║ ██║ ██║██████╔╝██║ ╚═╝ ██║██║ ██║ ██║ ██║ ██║\n╚═╝ ╚═╝ ╚═╝╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝\n\n██╗ ██╗██████╗ ██████╗ ██╗ ██╗ ██╗ █████╗\n██║ ██║██╔══██╗╚════██╗╚██╗██╔╝███║██╔══██╗\n██║ ██║██║ ██║ █████╔╝ ╚███╔╝ ╚██║╚█████╔╝\n██║ ██║██║ ██║██╔═══╝ ██╔██╗ ██║██╔══██╗\n╚██████╔╝██████╔╝███████╗██╔╝ ██╗ ██║╚█████╔╝\n ╚═════╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝ ╚═╝ ╚════╝\n\n*/\n\nimport \"./ud2x18/Casting.sol\";\nimport \"./ud2x18/Constants.sol\";\nimport \"./ud2x18/Errors.sol\";\nimport \"./ud2x18/ValueType.sol\";\n" + }, + "@prb/math/src/ud2x18/Casting.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport \"../Common.sol\" as Common;\nimport \"./Errors.sol\" as Errors;\nimport { uMAX_SD1x18 } from \"../sd1x18/Constants.sol\";\nimport { SD1x18 } from \"../sd1x18/ValueType.sol\";\nimport { SD59x18 } from \"../sd59x18/ValueType.sol\";\nimport { UD60x18 } from \"../ud60x18/ValueType.sol\";\nimport { UD2x18 } from \"./ValueType.sol\";\n\n/// @notice Casts a UD2x18 number into SD1x18.\n/// - x must be less than or equal to `uMAX_SD1x18`.\nfunction intoSD1x18(UD2x18 x) pure returns (SD1x18 result) {\n uint64 xUint = UD2x18.unwrap(x);\n if (xUint > uint64(uMAX_SD1x18)) {\n revert Errors.PRBMath_UD2x18_IntoSD1x18_Overflow(x);\n }\n result = SD1x18.wrap(int64(xUint));\n}\n\n/// @notice Casts a UD2x18 number into SD59x18.\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of SD59x18.\nfunction intoSD59x18(UD2x18 x) pure returns (SD59x18 result) {\n result = SD59x18.wrap(int256(uint256(UD2x18.unwrap(x))));\n}\n\n/// @notice Casts a UD2x18 number into UD60x18.\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of UD60x18.\nfunction intoUD60x18(UD2x18 x) pure returns (UD60x18 result) {\n result = UD60x18.wrap(UD2x18.unwrap(x));\n}\n\n/// @notice Casts a UD2x18 number into uint128.\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of uint128.\nfunction intoUint128(UD2x18 x) pure returns (uint128 result) {\n result = uint128(UD2x18.unwrap(x));\n}\n\n/// @notice Casts a UD2x18 number into uint256.\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of uint256.\nfunction intoUint256(UD2x18 x) pure returns (uint256 result) {\n result = uint256(UD2x18.unwrap(x));\n}\n\n/// @notice Casts a UD2x18 number into uint40.\n/// @dev Requirements:\n/// - x must be less than or equal to `MAX_UINT40`.\nfunction intoUint40(UD2x18 x) pure returns (uint40 result) {\n uint64 xUint = UD2x18.unwrap(x);\n if (xUint > uint64(Common.MAX_UINT40)) {\n revert Errors.PRBMath_UD2x18_IntoUint40_Overflow(x);\n }\n result = uint40(xUint);\n}\n\n/// @notice Alias for {wrap}.\nfunction ud2x18(uint64 x) pure returns (UD2x18 result) {\n result = UD2x18.wrap(x);\n}\n\n/// @notice Unwrap a UD2x18 number into uint64.\nfunction unwrap(UD2x18 x) pure returns (uint64 result) {\n result = UD2x18.unwrap(x);\n}\n\n/// @notice Wraps a uint64 number into UD2x18.\nfunction wrap(uint64 x) pure returns (UD2x18 result) {\n result = UD2x18.wrap(x);\n}\n" + }, + "@prb/math/src/ud2x18/Constants.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport { UD2x18 } from \"./ValueType.sol\";\n\n/// @dev Euler's number as a UD2x18 number.\nUD2x18 constant E = UD2x18.wrap(2_718281828459045235);\n\n/// @dev The maximum value a UD2x18 number can have.\nuint64 constant uMAX_UD2x18 = 18_446744073709551615;\nUD2x18 constant MAX_UD2x18 = UD2x18.wrap(uMAX_UD2x18);\n\n/// @dev PI as a UD2x18 number.\nUD2x18 constant PI = UD2x18.wrap(3_141592653589793238);\n\n/// @dev The unit number, which gives the decimal precision of UD2x18.\nUD2x18 constant UNIT = UD2x18.wrap(1e18);\nuint64 constant uUNIT = 1e18;\n" + }, + "@prb/math/src/ud2x18/Errors.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport { UD2x18 } from \"./ValueType.sol\";\n\n/// @notice Thrown when trying to cast a UD2x18 number that doesn't fit in SD1x18.\nerror PRBMath_UD2x18_IntoSD1x18_Overflow(UD2x18 x);\n\n/// @notice Thrown when trying to cast a UD2x18 number that doesn't fit in uint40.\nerror PRBMath_UD2x18_IntoUint40_Overflow(UD2x18 x);\n" + }, + "@prb/math/src/ud2x18/ValueType.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport \"./Casting.sol\" as Casting;\n\n/// @notice The unsigned 2.18-decimal fixed-point number representation, which can have up to 2 digits and up to 18\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\n/// type uint64. This is useful when end users want to use uint64 to save gas, e.g. with tight variable packing in contract\n/// storage.\ntype UD2x18 is uint64;\n\n/*//////////////////////////////////////////////////////////////////////////\n CASTING\n//////////////////////////////////////////////////////////////////////////*/\n\nusing {\n Casting.intoSD1x18,\n Casting.intoSD59x18,\n Casting.intoUD60x18,\n Casting.intoUint256,\n Casting.intoUint128,\n Casting.intoUint40,\n Casting.unwrap\n} for UD2x18 global;\n" + }, + "@prb/math/src/UD60x18.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\n/*\n\n██████╗ ██████╗ ██████╗ ███╗ ███╗ █████╗ ████████╗██╗ ██╗\n██╔══██╗██╔══██╗██╔══██╗████╗ ████║██╔══██╗╚══██╔══╝██║ ██║\n██████╔╝██████╔╝██████╔╝██╔████╔██║███████║ ██║ ███████║\n██╔═══╝ ██╔══██╗██╔══██╗██║╚██╔╝██║██╔══██║ ██║ ██╔══██║\n██║ ██║ ██║██████╔╝██║ ╚═╝ ██║██║ ██║ ██║ ██║ ██║\n╚═╝ ╚═╝ ╚═╝╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝\n\n██╗ ██╗██████╗ ██████╗ ██████╗ ██╗ ██╗ ██╗ █████╗\n██║ ██║██╔══██╗██╔════╝ ██╔═████╗╚██╗██╔╝███║██╔══██╗\n██║ ██║██║ ██║███████╗ ██║██╔██║ ╚███╔╝ ╚██║╚█████╔╝\n██║ ██║██║ ██║██╔═══██╗████╔╝██║ ██╔██╗ ██║██╔══██╗\n╚██████╔╝██████╔╝╚██████╔╝╚██████╔╝██╔╝ ██╗ ██║╚█████╔╝\n ╚═════╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚════╝\n\n*/\n\nimport \"./ud60x18/Casting.sol\";\nimport \"./ud60x18/Constants.sol\";\nimport \"./ud60x18/Conversions.sol\";\nimport \"./ud60x18/Errors.sol\";\nimport \"./ud60x18/Helpers.sol\";\nimport \"./ud60x18/Math.sol\";\nimport \"./ud60x18/ValueType.sol\";\n" + }, + "@prb/math/src/ud60x18/Casting.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport \"./Errors.sol\" as CastingErrors;\nimport { MAX_UINT128, MAX_UINT40 } from \"../Common.sol\";\nimport { uMAX_SD1x18 } from \"../sd1x18/Constants.sol\";\nimport { SD1x18 } from \"../sd1x18/ValueType.sol\";\nimport { uMAX_SD59x18 } from \"../sd59x18/Constants.sol\";\nimport { SD59x18 } from \"../sd59x18/ValueType.sol\";\nimport { uMAX_UD2x18 } from \"../ud2x18/Constants.sol\";\nimport { UD2x18 } from \"../ud2x18/ValueType.sol\";\nimport { UD60x18 } from \"./ValueType.sol\";\n\n/// @notice Casts a UD60x18 number into SD1x18.\n/// @dev Requirements:\n/// - x must be less than or equal to `uMAX_SD1x18`.\nfunction intoSD1x18(UD60x18 x) pure returns (SD1x18 result) {\n uint256 xUint = UD60x18.unwrap(x);\n if (xUint > uint256(int256(uMAX_SD1x18))) {\n revert CastingErrors.PRBMath_UD60x18_IntoSD1x18_Overflow(x);\n }\n result = SD1x18.wrap(int64(uint64(xUint)));\n}\n\n/// @notice Casts a UD60x18 number into UD2x18.\n/// @dev Requirements:\n/// - x must be less than or equal to `uMAX_UD2x18`.\nfunction intoUD2x18(UD60x18 x) pure returns (UD2x18 result) {\n uint256 xUint = UD60x18.unwrap(x);\n if (xUint > uMAX_UD2x18) {\n revert CastingErrors.PRBMath_UD60x18_IntoUD2x18_Overflow(x);\n }\n result = UD2x18.wrap(uint64(xUint));\n}\n\n/// @notice Casts a UD60x18 number into SD59x18.\n/// @dev Requirements:\n/// - x must be less than or equal to `uMAX_SD59x18`.\nfunction intoSD59x18(UD60x18 x) pure returns (SD59x18 result) {\n uint256 xUint = UD60x18.unwrap(x);\n if (xUint > uint256(uMAX_SD59x18)) {\n revert CastingErrors.PRBMath_UD60x18_IntoSD59x18_Overflow(x);\n }\n result = SD59x18.wrap(int256(xUint));\n}\n\n/// @notice Casts a UD60x18 number into uint128.\n/// @dev This is basically an alias for {unwrap}.\nfunction intoUint256(UD60x18 x) pure returns (uint256 result) {\n result = UD60x18.unwrap(x);\n}\n\n/// @notice Casts a UD60x18 number into uint128.\n/// @dev Requirements:\n/// - x must be less than or equal to `MAX_UINT128`.\nfunction intoUint128(UD60x18 x) pure returns (uint128 result) {\n uint256 xUint = UD60x18.unwrap(x);\n if (xUint > MAX_UINT128) {\n revert CastingErrors.PRBMath_UD60x18_IntoUint128_Overflow(x);\n }\n result = uint128(xUint);\n}\n\n/// @notice Casts a UD60x18 number into uint40.\n/// @dev Requirements:\n/// - x must be less than or equal to `MAX_UINT40`.\nfunction intoUint40(UD60x18 x) pure returns (uint40 result) {\n uint256 xUint = UD60x18.unwrap(x);\n if (xUint > MAX_UINT40) {\n revert CastingErrors.PRBMath_UD60x18_IntoUint40_Overflow(x);\n }\n result = uint40(xUint);\n}\n\n/// @notice Alias for {wrap}.\nfunction ud(uint256 x) pure returns (UD60x18 result) {\n result = UD60x18.wrap(x);\n}\n\n/// @notice Alias for {wrap}.\nfunction ud60x18(uint256 x) pure returns (UD60x18 result) {\n result = UD60x18.wrap(x);\n}\n\n/// @notice Unwraps a UD60x18 number into uint256.\nfunction unwrap(UD60x18 x) pure returns (uint256 result) {\n result = UD60x18.unwrap(x);\n}\n\n/// @notice Wraps a uint256 number into the UD60x18 value type.\nfunction wrap(uint256 x) pure returns (UD60x18 result) {\n result = UD60x18.wrap(x);\n}\n" + }, + "@prb/math/src/ud60x18/Constants.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport { UD60x18 } from \"./ValueType.sol\";\n\n// NOTICE: the \"u\" prefix stands for \"unwrapped\".\n\n/// @dev Euler's number as a UD60x18 number.\nUD60x18 constant E = UD60x18.wrap(2_718281828459045235);\n\n/// @dev The maximum input permitted in {exp}.\nuint256 constant uEXP_MAX_INPUT = 133_084258667509499440;\nUD60x18 constant EXP_MAX_INPUT = UD60x18.wrap(uEXP_MAX_INPUT);\n\n/// @dev The maximum input permitted in {exp2}.\nuint256 constant uEXP2_MAX_INPUT = 192e18 - 1;\nUD60x18 constant EXP2_MAX_INPUT = UD60x18.wrap(uEXP2_MAX_INPUT);\n\n/// @dev Half the UNIT number.\nuint256 constant uHALF_UNIT = 0.5e18;\nUD60x18 constant HALF_UNIT = UD60x18.wrap(uHALF_UNIT);\n\n/// @dev $log_2(10)$ as a UD60x18 number.\nuint256 constant uLOG2_10 = 3_321928094887362347;\nUD60x18 constant LOG2_10 = UD60x18.wrap(uLOG2_10);\n\n/// @dev $log_2(e)$ as a UD60x18 number.\nuint256 constant uLOG2_E = 1_442695040888963407;\nUD60x18 constant LOG2_E = UD60x18.wrap(uLOG2_E);\n\n/// @dev The maximum value a UD60x18 number can have.\nuint256 constant uMAX_UD60x18 = 115792089237316195423570985008687907853269984665640564039457_584007913129639935;\nUD60x18 constant MAX_UD60x18 = UD60x18.wrap(uMAX_UD60x18);\n\n/// @dev The maximum whole value a UD60x18 number can have.\nuint256 constant uMAX_WHOLE_UD60x18 = 115792089237316195423570985008687907853269984665640564039457_000000000000000000;\nUD60x18 constant MAX_WHOLE_UD60x18 = UD60x18.wrap(uMAX_WHOLE_UD60x18);\n\n/// @dev PI as a UD60x18 number.\nUD60x18 constant PI = UD60x18.wrap(3_141592653589793238);\n\n/// @dev The unit number, which gives the decimal precision of UD60x18.\nuint256 constant uUNIT = 1e18;\nUD60x18 constant UNIT = UD60x18.wrap(uUNIT);\n\n/// @dev The unit number squared.\nuint256 constant uUNIT_SQUARED = 1e36;\nUD60x18 constant UNIT_SQUARED = UD60x18.wrap(uUNIT_SQUARED);\n\n/// @dev Zero as a UD60x18 number.\nUD60x18 constant ZERO = UD60x18.wrap(0);\n" + }, + "@prb/math/src/ud60x18/Conversions.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport { uMAX_UD60x18, uUNIT } from \"./Constants.sol\";\nimport { PRBMath_UD60x18_Convert_Overflow } from \"./Errors.sol\";\nimport { UD60x18 } from \"./ValueType.sol\";\n\n/// @notice Converts a UD60x18 number to a simple integer by dividing it by `UNIT`.\n/// @dev The result is rounded toward zero.\n/// @param x The UD60x18 number to convert.\n/// @return result The same number in basic integer form.\nfunction convert(UD60x18 x) pure returns (uint256 result) {\n result = UD60x18.unwrap(x) / uUNIT;\n}\n\n/// @notice Converts a simple integer to UD60x18 by multiplying it by `UNIT`.\n///\n/// @dev Requirements:\n/// - x must be less than or equal to `MAX_UD60x18 / UNIT`.\n///\n/// @param x The basic integer to convert.\n/// @param result The same number converted to UD60x18.\nfunction convert(uint256 x) pure returns (UD60x18 result) {\n if (x > uMAX_UD60x18 / uUNIT) {\n revert PRBMath_UD60x18_Convert_Overflow(x);\n }\n unchecked {\n result = UD60x18.wrap(x * uUNIT);\n }\n}\n" + }, + "@prb/math/src/ud60x18/Errors.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport { UD60x18 } from \"./ValueType.sol\";\n\n/// @notice Thrown when ceiling a number overflows UD60x18.\nerror PRBMath_UD60x18_Ceil_Overflow(UD60x18 x);\n\n/// @notice Thrown when converting a basic integer to the fixed-point format overflows UD60x18.\nerror PRBMath_UD60x18_Convert_Overflow(uint256 x);\n\n/// @notice Thrown when taking the natural exponent of a base greater than 133_084258667509499441.\nerror PRBMath_UD60x18_Exp_InputTooBig(UD60x18 x);\n\n/// @notice Thrown when taking the binary exponent of a base greater than 192e18.\nerror PRBMath_UD60x18_Exp2_InputTooBig(UD60x18 x);\n\n/// @notice Thrown when taking the geometric mean of two numbers and multiplying them overflows UD60x18.\nerror PRBMath_UD60x18_Gm_Overflow(UD60x18 x, UD60x18 y);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\nerror PRBMath_UD60x18_IntoSD1x18_Overflow(UD60x18 x);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD59x18.\nerror PRBMath_UD60x18_IntoSD59x18_Overflow(UD60x18 x);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\nerror PRBMath_UD60x18_IntoUD2x18_Overflow(UD60x18 x);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\nerror PRBMath_UD60x18_IntoUint128_Overflow(UD60x18 x);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\nerror PRBMath_UD60x18_IntoUint40_Overflow(UD60x18 x);\n\n/// @notice Thrown when taking the logarithm of a number less than 1.\nerror PRBMath_UD60x18_Log_InputTooSmall(UD60x18 x);\n\n/// @notice Thrown when calculating the square root overflows UD60x18.\nerror PRBMath_UD60x18_Sqrt_Overflow(UD60x18 x);\n" + }, + "@prb/math/src/ud60x18/Helpers.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport { wrap } from \"./Casting.sol\";\nimport { UD60x18 } from \"./ValueType.sol\";\n\n/// @notice Implements the checked addition operation (+) in the UD60x18 type.\nfunction add(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\n result = wrap(x.unwrap() + y.unwrap());\n}\n\n/// @notice Implements the AND (&) bitwise operation in the UD60x18 type.\nfunction and(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\n result = wrap(x.unwrap() & bits);\n}\n\n/// @notice Implements the AND (&) bitwise operation in the UD60x18 type.\nfunction and2(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\n result = wrap(x.unwrap() & y.unwrap());\n}\n\n/// @notice Implements the equal operation (==) in the UD60x18 type.\nfunction eq(UD60x18 x, UD60x18 y) pure returns (bool result) {\n result = x.unwrap() == y.unwrap();\n}\n\n/// @notice Implements the greater than operation (>) in the UD60x18 type.\nfunction gt(UD60x18 x, UD60x18 y) pure returns (bool result) {\n result = x.unwrap() > y.unwrap();\n}\n\n/// @notice Implements the greater than or equal to operation (>=) in the UD60x18 type.\nfunction gte(UD60x18 x, UD60x18 y) pure returns (bool result) {\n result = x.unwrap() >= y.unwrap();\n}\n\n/// @notice Implements a zero comparison check function in the UD60x18 type.\nfunction isZero(UD60x18 x) pure returns (bool result) {\n // This wouldn't work if x could be negative.\n result = x.unwrap() == 0;\n}\n\n/// @notice Implements the left shift operation (<<) in the UD60x18 type.\nfunction lshift(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\n result = wrap(x.unwrap() << bits);\n}\n\n/// @notice Implements the lower than operation (<) in the UD60x18 type.\nfunction lt(UD60x18 x, UD60x18 y) pure returns (bool result) {\n result = x.unwrap() < y.unwrap();\n}\n\n/// @notice Implements the lower than or equal to operation (<=) in the UD60x18 type.\nfunction lte(UD60x18 x, UD60x18 y) pure returns (bool result) {\n result = x.unwrap() <= y.unwrap();\n}\n\n/// @notice Implements the checked modulo operation (%) in the UD60x18 type.\nfunction mod(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\n result = wrap(x.unwrap() % y.unwrap());\n}\n\n/// @notice Implements the not equal operation (!=) in the UD60x18 type.\nfunction neq(UD60x18 x, UD60x18 y) pure returns (bool result) {\n result = x.unwrap() != y.unwrap();\n}\n\n/// @notice Implements the NOT (~) bitwise operation in the UD60x18 type.\nfunction not(UD60x18 x) pure returns (UD60x18 result) {\n result = wrap(~x.unwrap());\n}\n\n/// @notice Implements the OR (|) bitwise operation in the UD60x18 type.\nfunction or(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\n result = wrap(x.unwrap() | y.unwrap());\n}\n\n/// @notice Implements the right shift operation (>>) in the UD60x18 type.\nfunction rshift(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\n result = wrap(x.unwrap() >> bits);\n}\n\n/// @notice Implements the checked subtraction operation (-) in the UD60x18 type.\nfunction sub(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\n result = wrap(x.unwrap() - y.unwrap());\n}\n\n/// @notice Implements the unchecked addition operation (+) in the UD60x18 type.\nfunction uncheckedAdd(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\n unchecked {\n result = wrap(x.unwrap() + y.unwrap());\n }\n}\n\n/// @notice Implements the unchecked subtraction operation (-) in the UD60x18 type.\nfunction uncheckedSub(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\n unchecked {\n result = wrap(x.unwrap() - y.unwrap());\n }\n}\n\n/// @notice Implements the XOR (^) bitwise operation in the UD60x18 type.\nfunction xor(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\n result = wrap(x.unwrap() ^ y.unwrap());\n}\n" + }, + "@prb/math/src/ud60x18/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport \"../Common.sol\" as Common;\nimport \"./Errors.sol\" as Errors;\nimport { wrap } from \"./Casting.sol\";\nimport {\n uEXP_MAX_INPUT,\n uEXP2_MAX_INPUT,\n uHALF_UNIT,\n uLOG2_10,\n uLOG2_E,\n uMAX_UD60x18,\n uMAX_WHOLE_UD60x18,\n UNIT,\n uUNIT,\n uUNIT_SQUARED,\n ZERO\n} from \"./Constants.sol\";\nimport { UD60x18 } from \"./ValueType.sol\";\n\n/*//////////////////////////////////////////////////////////////////////////\n MATHEMATICAL FUNCTIONS\n//////////////////////////////////////////////////////////////////////////*/\n\n/// @notice Calculates the arithmetic average of x and y using the following formula:\n///\n/// $$\n/// avg(x, y) = (x & y) + ((xUint ^ yUint) / 2)\n/// $$\n///\n/// In English, this is what this formula does:\n///\n/// 1. AND x and y.\n/// 2. Calculate half of XOR x and y.\n/// 3. Add the two results together.\n///\n/// This technique is known as SWAR, which stands for \"SIMD within a register\". You can read more about it here:\n/// https://devblogs.microsoft.com/oldnewthing/20220207-00/?p=106223\n///\n/// @dev Notes:\n/// - The result is rounded toward zero.\n///\n/// @param x The first operand as a UD60x18 number.\n/// @param y The second operand as a UD60x18 number.\n/// @return result The arithmetic average as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction avg(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\n uint256 xUint = x.unwrap();\n uint256 yUint = y.unwrap();\n unchecked {\n result = wrap((xUint & yUint) + ((xUint ^ yUint) >> 1));\n }\n}\n\n/// @notice Yields the smallest whole number greater than or equal to x.\n///\n/// @dev This is optimized for fractional value inputs, because for every whole value there are (1e18 - 1) fractional\n/// counterparts. See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\n///\n/// Requirements:\n/// - x must be less than or equal to `MAX_WHOLE_UD60x18`.\n///\n/// @param x The UD60x18 number to ceil.\n/// @param result The smallest whole number greater than or equal to x, as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction ceil(UD60x18 x) pure returns (UD60x18 result) {\n uint256 xUint = x.unwrap();\n if (xUint > uMAX_WHOLE_UD60x18) {\n revert Errors.PRBMath_UD60x18_Ceil_Overflow(x);\n }\n\n assembly (\"memory-safe\") {\n // Equivalent to `x % UNIT`.\n let remainder := mod(x, uUNIT)\n\n // Equivalent to `UNIT - remainder`.\n let delta := sub(uUNIT, remainder)\n\n // Equivalent to `x + remainder > 0 ? delta : 0`.\n result := add(x, mul(delta, gt(remainder, 0)))\n }\n}\n\n/// @notice Divides two UD60x18 numbers, returning a new UD60x18 number.\n///\n/// @dev Uses {Common.mulDiv} to enable overflow-safe multiplication and division.\n///\n/// Notes:\n/// - Refer to the notes in {Common.mulDiv}.\n///\n/// Requirements:\n/// - Refer to the requirements in {Common.mulDiv}.\n///\n/// @param x The numerator as a UD60x18 number.\n/// @param y The denominator as a UD60x18 number.\n/// @param result The quotient as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction div(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\n result = wrap(Common.mulDiv(x.unwrap(), uUNIT, y.unwrap()));\n}\n\n/// @notice Calculates the natural exponent of x using the following formula:\n///\n/// $$\n/// e^x = 2^{x * log_2{e}}\n/// $$\n///\n/// @dev Requirements:\n/// - x must be less than 133_084258667509499441.\n///\n/// @param x The exponent as a UD60x18 number.\n/// @return result The result as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction exp(UD60x18 x) pure returns (UD60x18 result) {\n uint256 xUint = x.unwrap();\n\n // This check prevents values greater than 192e18 from being passed to {exp2}.\n if (xUint > uEXP_MAX_INPUT) {\n revert Errors.PRBMath_UD60x18_Exp_InputTooBig(x);\n }\n\n unchecked {\n // Inline the fixed-point multiplication to save gas.\n uint256 doubleUnitProduct = xUint * uLOG2_E;\n result = exp2(wrap(doubleUnitProduct / uUNIT));\n }\n}\n\n/// @notice Calculates the binary exponent of x using the binary fraction method.\n///\n/// @dev See https://ethereum.stackexchange.com/q/79903/24693\n///\n/// Requirements:\n/// - x must be less than 192e18.\n/// - The result must fit in UD60x18.\n///\n/// @param x The exponent as a UD60x18 number.\n/// @return result The result as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction exp2(UD60x18 x) pure returns (UD60x18 result) {\n uint256 xUint = x.unwrap();\n\n // Numbers greater than or equal to 192e18 don't fit in the 192.64-bit format.\n if (xUint > uEXP2_MAX_INPUT) {\n revert Errors.PRBMath_UD60x18_Exp2_InputTooBig(x);\n }\n\n // Convert x to the 192.64-bit fixed-point format.\n uint256 x_192x64 = (xUint << 64) / uUNIT;\n\n // Pass x to the {Common.exp2} function, which uses the 192.64-bit fixed-point number representation.\n result = wrap(Common.exp2(x_192x64));\n}\n\n/// @notice Yields the greatest whole number less than or equal to x.\n/// @dev Optimized for fractional value inputs, because every whole value has (1e18 - 1) fractional counterparts.\n/// See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\n/// @param x The UD60x18 number to floor.\n/// @param result The greatest whole number less than or equal to x, as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction floor(UD60x18 x) pure returns (UD60x18 result) {\n assembly (\"memory-safe\") {\n // Equivalent to `x % UNIT`.\n let remainder := mod(x, uUNIT)\n\n // Equivalent to `x - remainder > 0 ? remainder : 0)`.\n result := sub(x, mul(remainder, gt(remainder, 0)))\n }\n}\n\n/// @notice Yields the excess beyond the floor of x using the odd function definition.\n/// @dev See https://en.wikipedia.org/wiki/Fractional_part.\n/// @param x The UD60x18 number to get the fractional part of.\n/// @param result The fractional part of x as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction frac(UD60x18 x) pure returns (UD60x18 result) {\n assembly (\"memory-safe\") {\n result := mod(x, uUNIT)\n }\n}\n\n/// @notice Calculates the geometric mean of x and y, i.e. $\\sqrt{x * y}$, rounding down.\n///\n/// @dev Requirements:\n/// - x * y must fit in UD60x18.\n///\n/// @param x The first operand as a UD60x18 number.\n/// @param y The second operand as a UD60x18 number.\n/// @return result The result as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction gm(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\n uint256 xUint = x.unwrap();\n uint256 yUint = y.unwrap();\n if (xUint == 0 || yUint == 0) {\n return ZERO;\n }\n\n unchecked {\n // Checking for overflow this way is faster than letting Solidity do it.\n uint256 xyUint = xUint * yUint;\n if (xyUint / xUint != yUint) {\n revert Errors.PRBMath_UD60x18_Gm_Overflow(x, y);\n }\n\n // We don't need to multiply the result by `UNIT` here because the x*y product picked up a factor of `UNIT`\n // during multiplication. See the comments in {Common.sqrt}.\n result = wrap(Common.sqrt(xyUint));\n }\n}\n\n/// @notice Calculates the inverse of x.\n///\n/// @dev Notes:\n/// - The result is rounded toward zero.\n///\n/// Requirements:\n/// - x must not be zero.\n///\n/// @param x The UD60x18 number for which to calculate the inverse.\n/// @return result The inverse as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction inv(UD60x18 x) pure returns (UD60x18 result) {\n unchecked {\n result = wrap(uUNIT_SQUARED / x.unwrap());\n }\n}\n\n/// @notice Calculates the natural logarithm of x using the following formula:\n///\n/// $$\n/// ln{x} = log_2{x} / log_2{e}\n/// $$\n///\n/// @dev Notes:\n/// - Refer to the notes in {log2}.\n/// - The precision isn't sufficiently fine-grained to return exactly `UNIT` when the input is `E`.\n///\n/// Requirements:\n/// - Refer to the requirements in {log2}.\n///\n/// @param x The UD60x18 number for which to calculate the natural logarithm.\n/// @return result The natural logarithm as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction ln(UD60x18 x) pure returns (UD60x18 result) {\n unchecked {\n // Inline the fixed-point multiplication to save gas. This is overflow-safe because the maximum value that\n // {log2} can return is ~196_205294292027477728.\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_E);\n }\n}\n\n/// @notice Calculates the common logarithm of x using the following formula:\n///\n/// $$\n/// log_{10}{x} = log_2{x} / log_2{10}\n/// $$\n///\n/// However, if x is an exact power of ten, a hard coded value is returned.\n///\n/// @dev Notes:\n/// - Refer to the notes in {log2}.\n///\n/// Requirements:\n/// - Refer to the requirements in {log2}.\n///\n/// @param x The UD60x18 number for which to calculate the common logarithm.\n/// @return result The common logarithm as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction log10(UD60x18 x) pure returns (UD60x18 result) {\n uint256 xUint = x.unwrap();\n if (xUint < uUNIT) {\n revert Errors.PRBMath_UD60x18_Log_InputTooSmall(x);\n }\n\n // Note that the `mul` in this assembly block is the standard multiplication operation, not {UD60x18.mul}.\n // prettier-ignore\n assembly (\"memory-safe\") {\n switch x\n case 1 { result := mul(uUNIT, sub(0, 18)) }\n case 10 { result := mul(uUNIT, sub(1, 18)) }\n case 100 { result := mul(uUNIT, sub(2, 18)) }\n case 1000 { result := mul(uUNIT, sub(3, 18)) }\n case 10000 { result := mul(uUNIT, sub(4, 18)) }\n case 100000 { result := mul(uUNIT, sub(5, 18)) }\n case 1000000 { result := mul(uUNIT, sub(6, 18)) }\n case 10000000 { result := mul(uUNIT, sub(7, 18)) }\n case 100000000 { result := mul(uUNIT, sub(8, 18)) }\n case 1000000000 { result := mul(uUNIT, sub(9, 18)) }\n case 10000000000 { result := mul(uUNIT, sub(10, 18)) }\n case 100000000000 { result := mul(uUNIT, sub(11, 18)) }\n case 1000000000000 { result := mul(uUNIT, sub(12, 18)) }\n case 10000000000000 { result := mul(uUNIT, sub(13, 18)) }\n case 100000000000000 { result := mul(uUNIT, sub(14, 18)) }\n case 1000000000000000 { result := mul(uUNIT, sub(15, 18)) }\n case 10000000000000000 { result := mul(uUNIT, sub(16, 18)) }\n case 100000000000000000 { result := mul(uUNIT, sub(17, 18)) }\n case 1000000000000000000 { result := 0 }\n case 10000000000000000000 { result := uUNIT }\n case 100000000000000000000 { result := mul(uUNIT, 2) }\n case 1000000000000000000000 { result := mul(uUNIT, 3) }\n case 10000000000000000000000 { result := mul(uUNIT, 4) }\n case 100000000000000000000000 { result := mul(uUNIT, 5) }\n case 1000000000000000000000000 { result := mul(uUNIT, 6) }\n case 10000000000000000000000000 { result := mul(uUNIT, 7) }\n case 100000000000000000000000000 { result := mul(uUNIT, 8) }\n case 1000000000000000000000000000 { result := mul(uUNIT, 9) }\n case 10000000000000000000000000000 { result := mul(uUNIT, 10) }\n case 100000000000000000000000000000 { result := mul(uUNIT, 11) }\n case 1000000000000000000000000000000 { result := mul(uUNIT, 12) }\n case 10000000000000000000000000000000 { result := mul(uUNIT, 13) }\n case 100000000000000000000000000000000 { result := mul(uUNIT, 14) }\n case 1000000000000000000000000000000000 { result := mul(uUNIT, 15) }\n case 10000000000000000000000000000000000 { result := mul(uUNIT, 16) }\n case 100000000000000000000000000000000000 { result := mul(uUNIT, 17) }\n case 1000000000000000000000000000000000000 { result := mul(uUNIT, 18) }\n case 10000000000000000000000000000000000000 { result := mul(uUNIT, 19) }\n case 100000000000000000000000000000000000000 { result := mul(uUNIT, 20) }\n case 1000000000000000000000000000000000000000 { result := mul(uUNIT, 21) }\n case 10000000000000000000000000000000000000000 { result := mul(uUNIT, 22) }\n case 100000000000000000000000000000000000000000 { result := mul(uUNIT, 23) }\n case 1000000000000000000000000000000000000000000 { result := mul(uUNIT, 24) }\n case 10000000000000000000000000000000000000000000 { result := mul(uUNIT, 25) }\n case 100000000000000000000000000000000000000000000 { result := mul(uUNIT, 26) }\n case 1000000000000000000000000000000000000000000000 { result := mul(uUNIT, 27) }\n case 10000000000000000000000000000000000000000000000 { result := mul(uUNIT, 28) }\n case 100000000000000000000000000000000000000000000000 { result := mul(uUNIT, 29) }\n case 1000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 30) }\n case 10000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 31) }\n case 100000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 32) }\n case 1000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 33) }\n case 10000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 34) }\n case 100000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 35) }\n case 1000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 36) }\n case 10000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 37) }\n case 100000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 38) }\n case 1000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 39) }\n case 10000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 40) }\n case 100000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 41) }\n case 1000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 42) }\n case 10000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 43) }\n case 100000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 44) }\n case 1000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 45) }\n case 10000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 46) }\n case 100000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 47) }\n case 1000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 48) }\n case 10000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 49) }\n case 100000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 50) }\n case 1000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 51) }\n case 10000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 52) }\n case 100000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 53) }\n case 1000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 54) }\n case 10000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 55) }\n case 100000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 56) }\n case 1000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 57) }\n case 10000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 58) }\n case 100000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 59) }\n default { result := uMAX_UD60x18 }\n }\n\n if (result.unwrap() == uMAX_UD60x18) {\n unchecked {\n // Inline the fixed-point division to save gas.\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_10);\n }\n }\n}\n\n/// @notice Calculates the binary logarithm of x using the iterative approximation algorithm:\n///\n/// $$\n/// log_2{x} = n + log_2{y}, \\text{ where } y = x*2^{-n}, \\ y \\in [1, 2)\n/// $$\n///\n/// For $0 \\leq x \\lt 1$, the input is inverted:\n///\n/// $$\n/// log_2{x} = -log_2{\\frac{1}{x}}\n/// $$\n///\n/// @dev See https://en.wikipedia.org/wiki/Binary_logarithm#Iterative_approximation\n///\n/// Notes:\n/// - Due to the lossy precision of the iterative approximation, the results are not perfectly accurate to the last decimal.\n///\n/// Requirements:\n/// - x must be greater than zero.\n///\n/// @param x The UD60x18 number for which to calculate the binary logarithm.\n/// @return result The binary logarithm as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction log2(UD60x18 x) pure returns (UD60x18 result) {\n uint256 xUint = x.unwrap();\n\n if (xUint < uUNIT) {\n revert Errors.PRBMath_UD60x18_Log_InputTooSmall(x);\n }\n\n unchecked {\n // Calculate the integer part of the logarithm.\n uint256 n = Common.msb(xUint / uUNIT);\n\n // This is the integer part of the logarithm as a UD60x18 number. The operation can't overflow because n\n // n is at most 255 and UNIT is 1e18.\n uint256 resultUint = n * uUNIT;\n\n // Calculate $y = x * 2^{-n}$.\n uint256 y = xUint >> n;\n\n // If y is the unit number, the fractional part is zero.\n if (y == uUNIT) {\n return wrap(resultUint);\n }\n\n // Calculate the fractional part via the iterative approximation.\n // The `delta >>= 1` part is equivalent to `delta /= 2`, but shifting bits is more gas efficient.\n uint256 DOUBLE_UNIT = 2e18;\n for (uint256 delta = uHALF_UNIT; delta > 0; delta >>= 1) {\n y = (y * y) / uUNIT;\n\n // Is y^2 >= 2e18 and so in the range [2e18, 4e18)?\n if (y >= DOUBLE_UNIT) {\n // Add the 2^{-m} factor to the logarithm.\n resultUint += delta;\n\n // Halve y, which corresponds to z/2 in the Wikipedia article.\n y >>= 1;\n }\n }\n result = wrap(resultUint);\n }\n}\n\n/// @notice Multiplies two UD60x18 numbers together, returning a new UD60x18 number.\n///\n/// @dev Uses {Common.mulDiv} to enable overflow-safe multiplication and division.\n///\n/// Notes:\n/// - Refer to the notes in {Common.mulDiv}.\n///\n/// Requirements:\n/// - Refer to the requirements in {Common.mulDiv}.\n///\n/// @dev See the documentation in {Common.mulDiv18}.\n/// @param x The multiplicand as a UD60x18 number.\n/// @param y The multiplier as a UD60x18 number.\n/// @return result The product as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction mul(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\n result = wrap(Common.mulDiv18(x.unwrap(), y.unwrap()));\n}\n\n/// @notice Raises x to the power of y.\n///\n/// For $1 \\leq x \\leq \\infty$, the following standard formula is used:\n///\n/// $$\n/// x^y = 2^{log_2{x} * y}\n/// $$\n///\n/// For $0 \\leq x \\lt 1$, since the unsigned {log2} is undefined, an equivalent formula is used:\n///\n/// $$\n/// i = \\frac{1}{x}\n/// w = 2^{log_2{i} * y}\n/// x^y = \\frac{1}{w}\n/// $$\n///\n/// @dev Notes:\n/// - Refer to the notes in {log2} and {mul}.\n/// - Returns `UNIT` for 0^0.\n/// - It may not perform well with very small values of x. Consider using SD59x18 as an alternative.\n///\n/// Requirements:\n/// - Refer to the requirements in {exp2}, {log2}, and {mul}.\n///\n/// @param x The base as a UD60x18 number.\n/// @param y The exponent as a UD60x18 number.\n/// @return result The result as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction pow(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\n uint256 xUint = x.unwrap();\n uint256 yUint = y.unwrap();\n\n // If both x and y are zero, the result is `UNIT`. If just x is zero, the result is always zero.\n if (xUint == 0) {\n return yUint == 0 ? UNIT : ZERO;\n }\n // If x is `UNIT`, the result is always `UNIT`.\n else if (xUint == uUNIT) {\n return UNIT;\n }\n\n // If y is zero, the result is always `UNIT`.\n if (yUint == 0) {\n return UNIT;\n }\n // If y is `UNIT`, the result is always x.\n else if (yUint == uUNIT) {\n return x;\n }\n\n // If x is greater than `UNIT`, use the standard formula.\n if (xUint > uUNIT) {\n result = exp2(mul(log2(x), y));\n }\n // Conversely, if x is less than `UNIT`, use the equivalent formula.\n else {\n UD60x18 i = wrap(uUNIT_SQUARED / xUint);\n UD60x18 w = exp2(mul(log2(i), y));\n result = wrap(uUNIT_SQUARED / w.unwrap());\n }\n}\n\n/// @notice Raises x (a UD60x18 number) to the power y (an unsigned basic integer) using the well-known\n/// algorithm \"exponentiation by squaring\".\n///\n/// @dev See https://en.wikipedia.org/wiki/Exponentiation_by_squaring.\n///\n/// Notes:\n/// - Refer to the notes in {Common.mulDiv18}.\n/// - Returns `UNIT` for 0^0.\n///\n/// Requirements:\n/// - The result must fit in UD60x18.\n///\n/// @param x The base as a UD60x18 number.\n/// @param y The exponent as a uint256.\n/// @return result The result as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction powu(UD60x18 x, uint256 y) pure returns (UD60x18 result) {\n // Calculate the first iteration of the loop in advance.\n uint256 xUint = x.unwrap();\n uint256 resultUint = y & 1 > 0 ? xUint : uUNIT;\n\n // Equivalent to `for(y /= 2; y > 0; y /= 2)`.\n for (y >>= 1; y > 0; y >>= 1) {\n xUint = Common.mulDiv18(xUint, xUint);\n\n // Equivalent to `y % 2 == 1`.\n if (y & 1 > 0) {\n resultUint = Common.mulDiv18(resultUint, xUint);\n }\n }\n result = wrap(resultUint);\n}\n\n/// @notice Calculates the square root of x using the Babylonian method.\n///\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\n///\n/// Notes:\n/// - The result is rounded toward zero.\n///\n/// Requirements:\n/// - x must be less than `MAX_UD60x18 / UNIT`.\n///\n/// @param x The UD60x18 number for which to calculate the square root.\n/// @return result The result as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction sqrt(UD60x18 x) pure returns (UD60x18 result) {\n uint256 xUint = x.unwrap();\n\n unchecked {\n if (xUint > uMAX_UD60x18 / uUNIT) {\n revert Errors.PRBMath_UD60x18_Sqrt_Overflow(x);\n }\n // Multiply x by `UNIT` to account for the factor of `UNIT` picked up when multiplying two UD60x18 numbers.\n // In this case, the two numbers are both the square root.\n result = wrap(Common.sqrt(xUint * uUNIT));\n }\n}\n" + }, + "@prb/math/src/ud60x18/ValueType.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport \"./Casting.sol\" as Casting;\nimport \"./Helpers.sol\" as Helpers;\nimport \"./Math.sol\" as Math;\n\n/// @notice The unsigned 60.18-decimal fixed-point number representation, which can have up to 60 digits and up to 18\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the Solidity type uint256.\n/// @dev The value type is defined here so it can be imported in all other files.\ntype UD60x18 is uint256;\n\n/*//////////////////////////////////////////////////////////////////////////\n CASTING\n//////////////////////////////////////////////////////////////////////////*/\n\nusing {\n Casting.intoSD1x18,\n Casting.intoUD2x18,\n Casting.intoSD59x18,\n Casting.intoUint128,\n Casting.intoUint256,\n Casting.intoUint40,\n Casting.unwrap\n} for UD60x18 global;\n\n/*//////////////////////////////////////////////////////////////////////////\n MATHEMATICAL FUNCTIONS\n//////////////////////////////////////////////////////////////////////////*/\n\n// The global \"using for\" directive makes the functions in this library callable on the UD60x18 type.\nusing {\n Math.avg,\n Math.ceil,\n Math.div,\n Math.exp,\n Math.exp2,\n Math.floor,\n Math.frac,\n Math.gm,\n Math.inv,\n Math.ln,\n Math.log10,\n Math.log2,\n Math.mul,\n Math.pow,\n Math.powu,\n Math.sqrt\n} for UD60x18 global;\n\n/*//////////////////////////////////////////////////////////////////////////\n HELPER FUNCTIONS\n//////////////////////////////////////////////////////////////////////////*/\n\n// The global \"using for\" directive makes the functions in this library callable on the UD60x18 type.\nusing {\n Helpers.add,\n Helpers.and,\n Helpers.eq,\n Helpers.gt,\n Helpers.gte,\n Helpers.isZero,\n Helpers.lshift,\n Helpers.lt,\n Helpers.lte,\n Helpers.mod,\n Helpers.neq,\n Helpers.not,\n Helpers.or,\n Helpers.rshift,\n Helpers.sub,\n Helpers.uncheckedAdd,\n Helpers.uncheckedSub,\n Helpers.xor\n} for UD60x18 global;\n\n/*//////////////////////////////////////////////////////////////////////////\n OPERATORS\n//////////////////////////////////////////////////////////////////////////*/\n\n// The global \"using for\" directive makes it possible to use these operators on the UD60x18 type.\nusing {\n Helpers.add as +,\n Helpers.and2 as &,\n Math.div as /,\n Helpers.eq as ==,\n Helpers.gt as >,\n Helpers.gte as >=,\n Helpers.lt as <,\n Helpers.lte as <=,\n Helpers.or as |,\n Helpers.mod as %,\n Math.mul as *,\n Helpers.neq as !=,\n Helpers.not as ~,\n Helpers.sub as -,\n Helpers.xor as ^\n} for UD60x18 global;\n" + }, + "contracts/autonomous-admin/DecentAutonomousAdminV1.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.28;\n\nimport {IHats} from \"../interfaces/hats/IHats.sol\";\nimport {IHatsElectionsEligibility} from \"../interfaces/hats/modules/IHatsElectionsEligibility.sol\";\nimport {FactoryFriendly} from \"@gnosis.pm/zodiac/contracts/factory/FactoryFriendly.sol\";\nimport {ERC165} from \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport {IDecentAutonomousAdminV1} from \"../interfaces/autonomous-admin/IDecentAutonomousAdminV1.sol\";\n\ncontract DecentAutonomousAdminV1 is\n IDecentAutonomousAdminV1,\n ERC165,\n FactoryFriendly\n{\n // //////////////////////////////////////////////////////////////\n // initializer\n // //////////////////////////////////////////////////////////////\n function setUp(bytes memory initializeParams) public override initializer {}\n\n // //////////////////////////////////////////////////////////////\n // Public Functions\n // //////////////////////////////////////////////////////////////\n function triggerStartNextTerm(TriggerStartArgs calldata args) public {\n IHatsElectionsEligibility hatsElectionModule = IHatsElectionsEligibility(\n args.hatsProtocol.getHatEligibilityModule(args.hatId)\n );\n\n hatsElectionModule.startNextTerm();\n\n // This will burn the hat if wearer is no longer eligible\n args.hatsProtocol.checkHatWearerStatus(args.hatId, args.currentWearer);\n\n // This will mint the hat to the nominated wearer, if necessary\n if (args.nominatedWearer != args.currentWearer) {\n args.hatsProtocol.mintHat(args.hatId, args.nominatedWearer);\n }\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view override returns (bool) {\n return\n interfaceId == type(IDecentAutonomousAdminV1).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n}\n" + }, + "contracts/hardhat-dependency-compiler/@gnosis.pm/safe-contracts/contracts/GnosisSafeL2.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >0.0.0;\nimport '@gnosis.pm/safe-contracts/contracts/GnosisSafeL2.sol';\n" + }, + "contracts/hardhat-dependency-compiler/@gnosis.pm/safe-contracts/contracts/libraries/MultiSendCallOnly.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >0.0.0;\nimport '@gnosis.pm/safe-contracts/contracts/libraries/MultiSendCallOnly.sol';\n" + }, + "contracts/hardhat-dependency-compiler/@gnosis.pm/safe-contracts/contracts/proxies/GnosisSafeProxyFactory.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >0.0.0;\nimport '@gnosis.pm/safe-contracts/contracts/proxies/GnosisSafeProxyFactory.sol';\n" + }, + "contracts/interfaces/autonomous-admin/IDecentAutonomousAdminV1.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.28;\n\nimport {IHats} from \"../hats/IHats.sol\";\n\ninterface IDecentAutonomousAdminV1 {\n error NotCurrentWearer();\n\n struct TriggerStartArgs {\n address currentWearer;\n IHats hatsProtocol;\n uint256 hatId;\n address nominatedWearer;\n }\n\n function triggerStartNextTerm(TriggerStartArgs calldata args) external;\n}\n" + }, + "contracts/interfaces/hats/HatsErrors.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\n// Copyright (C) 2023 Haberdasher Labs\n//\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU Affero General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU Affero General Public License for more details.\n//\n// You should have received a copy of the GNU Affero General Public License\n// along with this program. If not, see .\n\npragma solidity >=0.8.13;\n\ninterface HatsErrors {\n /// @notice Emitted when `user` is attempting to perform an action on `hatId` but is not wearing one of `hatId`'s admin hats\n /// @dev Can be equivalent to `NotHatWearer(buildHatId(hatId))`, such as when emitted by `approveLinkTopHatToTree` or `relinkTopHatToTree`\n error NotAdmin(address user, uint256 hatId);\n\n /// @notice Emitted when attempting to perform an action as or for an account that is not a wearer of a given hat\n error NotHatWearer();\n\n /// @notice Emitted when attempting to perform an action that requires being either an admin or wearer of a given hat\n error NotAdminOrWearer();\n\n /// @notice Emitted when attempting to mint `hatId` but `hatId`'s maxSupply has been reached\n error AllHatsWorn(uint256 hatId);\n\n /// @notice Emitted when attempting to create a hat with a level 14 hat as its admin\n error MaxLevelsReached();\n\n /// @notice Emitted when an attempted hat id has empty intermediate level(s)\n error InvalidHatId();\n\n /// @notice Emitted when attempting to mint `hatId` to a `wearer` who is already wearing the hat\n error AlreadyWearingHat(address wearer, uint256 hatId);\n\n /// @notice Emitted when attempting to mint a non-existant hat\n error HatDoesNotExist(uint256 hatId);\n\n /// @notice Emmitted when attempting to mint or transfer a hat that is not active\n error HatNotActive();\n\n /// @notice Emitted when attempting to mint or transfer a hat to an ineligible wearer\n error NotEligible();\n\n /// @notice Emitted when attempting to check or set a hat's status from an account that is not that hat's toggle module\n error NotHatsToggle();\n\n /// @notice Emitted when attempting to check or set a hat wearer's status from an account that is not that hat's eligibility module\n error NotHatsEligibility();\n\n /// @notice Emitted when array arguments to a batch function have mismatching lengths\n error BatchArrayLengthMismatch();\n\n /// @notice Emitted when attempting to mutate or transfer an immutable hat\n error Immutable();\n\n /// @notice Emitted when attempting to change a hat's maxSupply to a value lower than its current supply\n error NewMaxSupplyTooLow();\n\n /// @notice Emitted when attempting to link a tophat to a new admin for which the tophat serves as an admin\n error CircularLinkage();\n\n /// @notice Emitted when attempting to link or relink a tophat to a separate tree\n error CrossTreeLinkage();\n\n /// @notice Emitted when attempting to link a tophat without a request\n error LinkageNotRequested();\n\n /// @notice Emitted when attempting to unlink a tophat that does not have a wearer\n /// @dev This ensures that unlinking never results in a bricked tophat\n error InvalidUnlink();\n\n /// @notice Emmited when attempting to change a hat's eligibility or toggle module to the zero address\n error ZeroAddress();\n\n /// @notice Emmitted when attempting to change a hat's details or imageURI to a string with over 7000 bytes (~characters)\n /// @dev This protects against a DOS attack where an admin iteratively extend's a hat's details or imageURI\n /// to be so long that reading it exceeds the block gas limit, breaking `uri()` and `viewHat()`\n error StringTooLong();\n}\n" + }, + "contracts/interfaces/hats/HatsEvents.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\n// Copyright (C) 2023 Haberdasher Labs\n//\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU Affero General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU Affero General Public License for more details.\n//\n// You should have received a copy of the GNU Affero General Public License\n// along with this program. If not, see .\n\npragma solidity >=0.8.13;\n\ninterface HatsEvents {\n /// @notice Emitted when a new hat is created\n /// @param id The id for the new hat\n /// @param details A description of the Hat\n /// @param maxSupply The total instances of the Hat that can be worn at once\n /// @param eligibility The address that can report on the Hat wearer's status\n /// @param toggle The address that can deactivate the Hat\n /// @param mutable_ Whether the hat's properties are changeable after creation\n /// @param imageURI The image uri for this hat and the fallback for its\n event HatCreated(\n uint256 id,\n string details,\n uint32 maxSupply,\n address eligibility,\n address toggle,\n bool mutable_,\n string imageURI\n );\n\n /// @notice Emitted when a hat wearer's standing is updated\n /// @dev Eligibility is excluded since the source of truth for eligibility is the eligibility module and may change without a transaction\n /// @param hatId The id of the wearer's hat\n /// @param wearer The wearer's address\n /// @param wearerStanding Whether the wearer is in good standing for the hat\n event WearerStandingChanged(\n uint256 hatId,\n address wearer,\n bool wearerStanding\n );\n\n /// @notice Emitted when a hat's status is updated\n /// @param hatId The id of the hat\n /// @param newStatus Whether the hat is active\n event HatStatusChanged(uint256 hatId, bool newStatus);\n\n /// @notice Emitted when a hat's details are updated\n /// @param hatId The id of the hat\n /// @param newDetails The updated details\n event HatDetailsChanged(uint256 hatId, string newDetails);\n\n /// @notice Emitted when a hat's eligibility module is updated\n /// @param hatId The id of the hat\n /// @param newEligibility The updated eligibiliy module\n event HatEligibilityChanged(uint256 hatId, address newEligibility);\n\n /// @notice Emitted when a hat's toggle module is updated\n /// @param hatId The id of the hat\n /// @param newToggle The updated toggle module\n event HatToggleChanged(uint256 hatId, address newToggle);\n\n /// @notice Emitted when a hat's mutability is updated\n /// @param hatId The id of the hat\n event HatMutabilityChanged(uint256 hatId);\n\n /// @notice Emitted when a hat's maximum supply is updated\n /// @param hatId The id of the hat\n /// @param newMaxSupply The updated max supply\n event HatMaxSupplyChanged(uint256 hatId, uint32 newMaxSupply);\n\n /// @notice Emitted when a hat's image URI is updated\n /// @param hatId The id of the hat\n /// @param newImageURI The updated image URI\n event HatImageURIChanged(uint256 hatId, string newImageURI);\n\n /// @notice Emitted when a tophat linkage is requested by its admin\n /// @param domain The domain of the tree tophat to link\n /// @param newAdmin The tophat's would-be admin in the parent tree\n event TopHatLinkRequested(uint32 domain, uint256 newAdmin);\n\n /// @notice Emitted when a tophat is linked to a another tree\n /// @param domain The domain of the newly-linked tophat\n /// @param newAdmin The tophat's new admin in the parent tree\n event TopHatLinked(uint32 domain, uint256 newAdmin);\n}\n" + }, + "contracts/interfaces/hats/IHats.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\n// Copyright (C) 2023 Haberdasher Labs\n//\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU Affero General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU Affero General Public License for more details.\n//\n// You should have received a copy of the GNU Affero General Public License\n// along with this program. If not, see .\n\npragma solidity >=0.8.13;\n\nimport \"./IHatsIdUtilities.sol\";\nimport \"./HatsErrors.sol\";\nimport \"./HatsEvents.sol\";\n\ninterface IHats is IHatsIdUtilities, HatsErrors, HatsEvents {\n function mintTopHat(\n address _target,\n string memory _details,\n string memory _imageURI\n ) external returns (uint256 topHatId);\n\n function createHat(\n uint256 _admin,\n string calldata _details,\n uint32 _maxSupply,\n address _eligibility,\n address _toggle,\n bool _mutable,\n string calldata _imageURI\n ) external returns (uint256 newHatId);\n\n function batchCreateHats(\n uint256[] calldata _admins,\n string[] calldata _details,\n uint32[] calldata _maxSupplies,\n address[] memory _eligibilityModules,\n address[] memory _toggleModules,\n bool[] calldata _mutables,\n string[] calldata _imageURIs\n ) external returns (bool success);\n\n function getNextId(uint256 _admin) external view returns (uint256 nextId);\n\n function mintHat(\n uint256 _hatId,\n address _wearer\n ) external returns (bool success);\n\n function batchMintHats(\n uint256[] calldata _hatIds,\n address[] calldata _wearers\n ) external returns (bool success);\n\n function setHatStatus(\n uint256 _hatId,\n bool _newStatus\n ) external returns (bool toggled);\n\n function checkHatStatus(uint256 _hatId) external returns (bool toggled);\n\n function setHatWearerStatus(\n uint256 _hatId,\n address _wearer,\n bool _eligible,\n bool _standing\n ) external returns (bool updated);\n\n function checkHatWearerStatus(\n uint256 _hatId,\n address _wearer\n ) external returns (bool updated);\n\n function renounceHat(uint256 _hatId) external;\n\n function transferHat(uint256 _hatId, address _from, address _to) external;\n\n /*//////////////////////////////////////////////////////////////\n HATS ADMIN FUNCTIONS\n //////////////////////////////////////////////////////////////*/\n\n function makeHatImmutable(uint256 _hatId) external;\n\n function changeHatDetails(\n uint256 _hatId,\n string memory _newDetails\n ) external;\n\n function changeHatEligibility(\n uint256 _hatId,\n address _newEligibility\n ) external;\n\n function changeHatToggle(uint256 _hatId, address _newToggle) external;\n\n function changeHatImageURI(\n uint256 _hatId,\n string memory _newImageURI\n ) external;\n\n function changeHatMaxSupply(uint256 _hatId, uint32 _newMaxSupply) external;\n\n function requestLinkTopHatToTree(\n uint32 _topHatId,\n uint256 _newAdminHat\n ) external;\n\n function approveLinkTopHatToTree(\n uint32 _topHatId,\n uint256 _newAdminHat,\n address _eligibility,\n address _toggle,\n string calldata _details,\n string calldata _imageURI\n ) external;\n\n function unlinkTopHatFromTree(uint32 _topHatId, address _wearer) external;\n\n function relinkTopHatWithinTree(\n uint32 _topHatDomain,\n uint256 _newAdminHat,\n address _eligibility,\n address _toggle,\n string calldata _details,\n string calldata _imageURI\n ) external;\n\n /*//////////////////////////////////////////////////////////////\n VIEW FUNCTIONS\n //////////////////////////////////////////////////////////////*/\n\n function viewHat(\n uint256 _hatId\n )\n external\n view\n returns (\n string memory details,\n uint32 maxSupply,\n uint32 supply,\n address eligibility,\n address toggle,\n string memory imageURI,\n uint16 lastHatId,\n bool mutable_,\n bool active\n );\n\n function isWearerOfHat(\n address _user,\n uint256 _hatId\n ) external view returns (bool isWearer);\n\n function isAdminOfHat(\n address _user,\n uint256 _hatId\n ) external view returns (bool isAdmin);\n\n function isInGoodStanding(\n address _wearer,\n uint256 _hatId\n ) external view returns (bool standing);\n\n function isEligible(\n address _wearer,\n uint256 _hatId\n ) external view returns (bool eligible);\n\n function getHatEligibilityModule(\n uint256 _hatId\n ) external view returns (address eligibility);\n\n function getHatToggleModule(\n uint256 _hatId\n ) external view returns (address toggle);\n\n function getHatMaxSupply(\n uint256 _hatId\n ) external view returns (uint32 maxSupply);\n\n function hatSupply(uint256 _hatId) external view returns (uint32 supply);\n\n function getImageURIForHat(\n uint256 _hatId\n ) external view returns (string memory _uri);\n\n function balanceOf(\n address wearer,\n uint256 hatId\n ) external view returns (uint256 balance);\n\n function balanceOfBatch(\n address[] calldata _wearers,\n uint256[] calldata _hatIds\n ) external view returns (uint256[] memory);\n\n function uri(uint256 id) external view returns (string memory _uri);\n}\n" + }, + "contracts/interfaces/hats/IHatsIdUtilities.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\n// Copyright (C) 2023 Haberdasher Labs\n//\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU Affero General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU Affero General Public License for more details.\n//\n// You should have received a copy of the GNU Affero General Public License\n// along with this program. If not, see .\n\npragma solidity >=0.8.13;\n\ninterface IHatsIdUtilities {\n function buildHatId(\n uint256 _admin,\n uint16 _newHat\n ) external pure returns (uint256 id);\n\n function getHatLevel(uint256 _hatId) external view returns (uint32 level);\n\n function getLocalHatLevel(\n uint256 _hatId\n ) external pure returns (uint32 level);\n\n function isTopHat(uint256 _hatId) external view returns (bool _topHat);\n\n function isLocalTopHat(\n uint256 _hatId\n ) external pure returns (bool _localTopHat);\n\n function isValidHatId(\n uint256 _hatId\n ) external view returns (bool validHatId);\n\n function getAdminAtLevel(\n uint256 _hatId,\n uint32 _level\n ) external view returns (uint256 admin);\n\n function getAdminAtLocalLevel(\n uint256 _hatId,\n uint32 _level\n ) external pure returns (uint256 admin);\n\n function getTopHatDomain(\n uint256 _hatId\n ) external view returns (uint32 domain);\n\n function getTippyTopHatDomain(\n uint32 _topHatDomain\n ) external view returns (uint32 domain);\n\n function noCircularLinkage(\n uint32 _topHatDomain,\n uint256 _linkedAdmin\n ) external view returns (bool notCircular);\n\n function sameTippyTopHatDomain(\n uint32 _topHatDomain,\n uint256 _newAdminHat\n ) external view returns (bool sameDomain);\n}\n" + }, + "contracts/interfaces/hats/IHatsModuleFactory.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\ninterface IHatsModuleFactory {\n error HatsModuleFactory_ModuleAlreadyDeployed(\n address implementation,\n uint256 hatId,\n bytes otherImmutableArgs,\n uint256 saltNonce\n );\n\n error BatchArrayLengthMismatch();\n\n event HatsModuleFactory_ModuleDeployed(\n address implementation,\n address instance,\n uint256 hatId,\n bytes otherImmutableArgs,\n bytes initData,\n uint256 saltNonce\n );\n\n function HATS() external view returns (address);\n\n function version() external view returns (string memory);\n\n function createHatsModule(\n address _implementation,\n uint256 _hatId,\n bytes calldata _otherImmutableArgs,\n bytes calldata _initData,\n uint256 _saltNonce\n ) external returns (address _instance);\n\n function batchCreateHatsModule(\n address[] calldata _implementations,\n uint256[] calldata _hatIds,\n bytes[] calldata _otherImmutableArgsArray,\n bytes[] calldata _initDataArray,\n uint256[] calldata _saltNonces\n ) external returns (bool success);\n\n function getHatsModuleAddress(\n address _implementation,\n uint256 _hatId,\n bytes calldata _otherImmutableArgs,\n uint256 _saltNonce\n ) external view returns (address);\n\n function deployed(\n address _implementation,\n uint256 _hatId,\n bytes calldata _otherImmutableArgs,\n uint256 _saltNonce\n ) external view returns (bool);\n}\n" + }, + "contracts/interfaces/hats/modules/IHatsElectionsEligibility.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.13;\n\ninterface IHatsElectionsEligibility {\n event ElectionOpened(uint128 nextTermEnd);\n event ElectionCompleted(uint128 termEnd, address[] winners);\n event NewTermStarted(uint128 termEnd);\n event Recalled(uint128 termEnd, address[] accounts);\n\n /// @notice Returns the first second after the current term ends.\n /// @dev Also serves as the id for the current term.\n function currentTermEnd() external view returns (uint128);\n\n /// @notice Returns the first second after the next term ends.\n /// @dev Also serves as the id for the next term.\n function nextTermEnd() external view returns (uint128);\n\n /// @notice Returns the election status (open or closed) for a given term end.\n /// @param termEnd The term end timestamp to query.\n function electionStatus(\n uint128 termEnd\n ) external view returns (bool isElectionOpen);\n\n /// @notice Returns whether a candidate was elected in a given term.\n /// @param termEnd The term end timestamp to query.\n /// @param candidate The address of the candidate.\n function electionResults(\n uint128 termEnd,\n address candidate\n ) external view returns (bool elected);\n\n /// @notice Returns the BALLOT_BOX_HAT constant.\n function BALLOT_BOX_HAT() external pure returns (uint256);\n\n /// @notice Returns the ADMIN_HAT constant.\n function ADMIN_HAT() external pure returns (uint256);\n\n /**\n * @notice Submit the results of an election for a specified term.\n * @dev Only callable by the wearer(s) of the BALLOT_BOX_HAT.\n * @param _termEnd The id of the term for which the election results are being submitted.\n * @param _winners The addresses of the winners of the election.\n */\n function elect(uint128 _termEnd, address[] calldata _winners) external;\n\n /**\n * @notice Submit the results of a recall election for a specified term.\n * @dev Only callable by the wearer(s) of the BALLOT_BOX_HAT.\n * @param _termEnd The id of the term for which the recall results are being submitted.\n * @param _recallees The addresses to be recalled.\n */\n function recall(uint128 _termEnd, address[] calldata _recallees) external;\n\n /**\n * @notice Set the next term and open the election for it.\n * @dev Only callable by the wearer(s) of the ADMIN_HAT.\n * @param _newTermEnd The id of the term that will be opened.\n */\n function setNextTerm(uint128 _newTermEnd) external;\n\n /**\n * @notice Start the next term, updating the current term.\n * @dev Can be called by anyone, but will revert if conditions are not met.\n */\n function startNextTerm() external;\n\n /**\n * @notice Determine the eligibility and standing of a wearer for a hat.\n * @param _wearer The address of the hat wearer.\n * @param _hatId The ID of the hat.\n * @return eligible True if the wearer is eligible for the hat.\n * @return standing True if the wearer is in good standing.\n */\n function getWearerStatus(\n address _wearer,\n uint256 _hatId\n ) external view returns (bool eligible, bool standing);\n}\n" + }, + "contracts/interfaces/IERC6551Registry.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IERC6551Registry {\n /**\n * @dev Creates a token bound account for a non-fungible token.\n *\n * If account has already been created, returns the account address without calling create2.\n *\n * Emits ERC6551AccountCreated event.\n *\n * @return account The address of the token bound account\n */\n function createAccount(\n address implementation,\n bytes32 salt,\n uint256 chainId,\n address tokenContract,\n uint256 tokenId\n ) external returns (address account);\n}\n" + }, + "contracts/interfaces/sablier/IAdminable.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\npragma solidity >=0.8.22;\n\n/// @title IAdminable\n/// @notice Contract module that provides a basic access control mechanism, with an admin that can be\n/// granted exclusive access to specific functions. The inheriting contract must set the initial admin\n/// in the constructor.\ninterface IAdminable {\n /*//////////////////////////////////////////////////////////////////////////\n EVENTS\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @notice Emitted when the admin is transferred.\n /// @param oldAdmin The address of the old admin.\n /// @param newAdmin The address of the new admin.\n event TransferAdmin(address indexed oldAdmin, address indexed newAdmin);\n\n /*//////////////////////////////////////////////////////////////////////////\n CONSTANT FUNCTIONS\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @notice The address of the admin account or contract.\n function admin() external view returns (address);\n\n /*//////////////////////////////////////////////////////////////////////////\n NON-CONSTANT FUNCTIONS\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @notice Transfers the contract admin to a new address.\n ///\n /// @dev Notes:\n /// - Does not revert if the admin is the same.\n /// - This function can potentially leave the contract without an admin, thereby removing any\n /// functionality that is only available to the admin.\n ///\n /// Requirements:\n /// - `msg.sender` must be the contract admin.\n ///\n /// @param newAdmin The address of the new admin.\n function transferAdmin(address newAdmin) external;\n}\n" + }, + "contracts/interfaces/sablier/IERC4096.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 \"@openzeppelin/contracts/interfaces/IERC165.sol\";\nimport {IERC721} from \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\n\n/// @title ERC-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" + }, + "contracts/interfaces/sablier/ISablierV2Lockup.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\npragma solidity >=0.8.22;\n\nimport {IERC4906} from \"./IERC4096.sol\";\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {IERC721Metadata} from \"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\";\nimport {UD60x18} from \"@prb/math/src/UD60x18.sol\";\n\nimport {Lockup} from \"./types/DataTypes.sol\";\nimport {IAdminable} from \"./IAdminable.sol\";\nimport {ISablierV2NFTDescriptor} from \"./ISablierV2NFTDescriptor.sol\";\n\n/// @title ISablierV2Lockup\n/// @notice Common logic between all Sablier V2 Lockup contracts.\ninterface ISablierV2Lockup is\n IAdminable, // 0 inherited components\n IERC4906, // 2 inherited components\n IERC721Metadata // 2 inherited components\n{\n /*//////////////////////////////////////////////////////////////////////////\n EVENTS\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @notice Emitted when the admin allows a new recipient contract to hook to Sablier.\n /// @param admin The address of the current contract admin.\n /// @param recipient The address of the recipient contract put on the allowlist.\n event AllowToHook(address indexed admin, address recipient);\n\n /// @notice Emitted when a stream is canceled.\n /// @param streamId The ID of the stream.\n /// @param sender The address of the stream's sender.\n /// @param recipient The address of the stream's recipient.\n /// @param asset The contract address of the ERC-20 asset to be distributed.\n /// @param senderAmount The amount of assets refunded to the stream's sender, denoted in units of the asset's\n /// decimals.\n /// @param recipientAmount The amount of assets left for the stream's recipient to withdraw, denoted in units of the\n /// asset's decimals.\n event CancelLockupStream(\n uint256 streamId,\n address indexed sender,\n address indexed recipient,\n IERC20 indexed asset,\n uint128 senderAmount,\n uint128 recipientAmount\n );\n\n /// @notice Emitted when a sender gives up the right to cancel a stream.\n /// @param streamId The ID of the stream.\n event RenounceLockupStream(uint256 indexed streamId);\n\n /// @notice Emitted when the admin sets a new NFT descriptor contract.\n /// @param admin The address of the current contract admin.\n /// @param oldNFTDescriptor The address of the old NFT descriptor contract.\n /// @param newNFTDescriptor The address of the new NFT descriptor contract.\n event SetNFTDescriptor(\n address indexed admin,\n ISablierV2NFTDescriptor oldNFTDescriptor,\n ISablierV2NFTDescriptor newNFTDescriptor\n );\n\n /// @notice Emitted when assets are withdrawn from a stream.\n /// @param streamId The ID of the stream.\n /// @param to The address that has received the withdrawn assets.\n /// @param asset The contract address of the ERC-20 asset to be distributed.\n /// @param amount The amount of assets withdrawn, denoted in units of the asset's decimals.\n event WithdrawFromLockupStream(\n uint256 indexed streamId,\n address indexed to,\n IERC20 indexed asset,\n uint128 amount\n );\n\n /*//////////////////////////////////////////////////////////////////////////\n CONSTANT FUNCTIONS\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @notice Retrieves the address of the ERC-20 asset to be distributed.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function getAsset(uint256 streamId) external view returns (IERC20 asset);\n\n /// @notice Retrieves the amount deposited in the stream, denoted in units of the asset's decimals.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function getDepositedAmount(\n uint256 streamId\n ) external view returns (uint128 depositedAmount);\n\n /// @notice Retrieves the stream's end time, which is a Unix timestamp.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function getEndTime(\n uint256 streamId\n ) external view returns (uint40 endTime);\n\n /// @notice Retrieves the stream's recipient.\n /// @dev Reverts if the NFT has been burned.\n /// @param streamId The stream ID for the query.\n function getRecipient(\n uint256 streamId\n ) external view returns (address recipient);\n\n /// @notice Retrieves the amount refunded to the sender after a cancellation, denoted in units of the asset's\n /// decimals. This amount is always zero unless the stream was canceled.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function getRefundedAmount(\n uint256 streamId\n ) external view returns (uint128 refundedAmount);\n\n /// @notice Retrieves the stream's sender.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function getSender(uint256 streamId) external view returns (address sender);\n\n /// @notice Retrieves the stream's start time, which is a Unix timestamp.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function getStartTime(\n uint256 streamId\n ) external view returns (uint40 startTime);\n\n /// @notice Retrieves the amount withdrawn from the stream, denoted in units of the asset's decimals.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function getWithdrawnAmount(\n uint256 streamId\n ) external view returns (uint128 withdrawnAmount);\n\n /// @notice Retrieves a flag indicating whether the provided address is a contract allowed to hook to Sablier\n /// when a stream is canceled or when assets are withdrawn.\n /// @dev See {ISablierLockupRecipient} for more information.\n function isAllowedToHook(\n address recipient\n ) external view returns (bool result);\n\n /// @notice Retrieves a flag indicating whether the stream can be canceled. When the stream is cold, this\n /// flag is always `false`.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function isCancelable(uint256 streamId) external view returns (bool result);\n\n /// @notice Retrieves a flag indicating whether the stream is cold, i.e. settled, canceled, or depleted.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function isCold(uint256 streamId) external view returns (bool result);\n\n /// @notice Retrieves a flag indicating whether the stream is depleted.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function isDepleted(uint256 streamId) external view returns (bool result);\n\n /// @notice Retrieves a flag indicating whether the stream exists.\n /// @dev Does not revert if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function isStream(uint256 streamId) external view returns (bool result);\n\n /// @notice Retrieves a flag indicating whether the stream NFT can be transferred.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function isTransferable(\n uint256 streamId\n ) external view returns (bool result);\n\n /// @notice Retrieves a flag indicating whether the stream is warm, i.e. either pending or streaming.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function isWarm(uint256 streamId) external view returns (bool result);\n\n /// @notice Retrieves the maximum broker fee that can be charged by the broker, denoted as a fixed-point\n /// number where 1e18 is 100%.\n /// @dev This value is hard coded as a constant.\n function MAX_BROKER_FEE() external view returns (UD60x18);\n\n /// @notice Counter for stream IDs, used in the create functions.\n function nextStreamId() external view returns (uint256);\n\n /// @notice Contract that generates the non-fungible token URI.\n function nftDescriptor() external view returns (ISablierV2NFTDescriptor);\n\n /// @notice Calculates the amount that the sender would be refunded if the stream were canceled, denoted in units\n /// of the asset's decimals.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function refundableAmountOf(\n uint256 streamId\n ) external view returns (uint128 refundableAmount);\n\n /// @notice Retrieves the stream's status.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function statusOf(\n uint256 streamId\n ) external view returns (Lockup.Status status);\n\n /// @notice Calculates the amount streamed to the recipient, denoted in units of the asset's decimals.\n /// @dev Reverts if `streamId` references a null stream.\n ///\n /// Notes:\n /// - Upon cancellation of the stream, the amount streamed is calculated as the difference between the deposited\n /// amount and the refunded amount. Ultimately, when the stream becomes depleted, the streamed amount is equivalent\n /// to the total amount withdrawn.\n ///\n /// @param streamId The stream ID for the query.\n function streamedAmountOf(\n uint256 streamId\n ) external view returns (uint128 streamedAmount);\n\n /// @notice Retrieves a flag indicating whether the stream was canceled.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function wasCanceled(uint256 streamId) external view returns (bool result);\n\n /// @notice Calculates the amount that the recipient can withdraw from the stream, denoted in units of the asset's\n /// decimals.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function withdrawableAmountOf(\n uint256 streamId\n ) external view returns (uint128 withdrawableAmount);\n\n /*//////////////////////////////////////////////////////////////////////////\n NON-CONSTANT FUNCTIONS\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @notice Allows a recipient contract to hook to Sablier when a stream is canceled or when assets are withdrawn.\n /// Useful for implementing contracts that hold streams on behalf of users, such as vaults or staking contracts.\n ///\n /// @dev Emits an {AllowToHook} event.\n ///\n /// Notes:\n /// - Does not revert if the contract is already on the allowlist.\n /// - This is an irreversible operation. The contract cannot be removed from the allowlist.\n ///\n /// Requirements:\n /// - `msg.sender` must be the contract admin.\n /// - `recipient` must have a non-zero code size.\n /// - `recipient` must implement {ISablierLockupRecipient}.\n ///\n /// @param recipient The address of the contract to allow for hooks.\n function allowToHook(address recipient) external;\n\n /// @notice Burns the NFT associated with the stream.\n ///\n /// @dev Emits a {Transfer} event.\n ///\n /// Requirements:\n /// - Must not be delegate called.\n /// - `streamId` must reference a depleted stream.\n /// - The NFT must exist.\n /// - `msg.sender` must be either the NFT owner or an approved third party.\n ///\n /// @param streamId The ID of the stream NFT to burn.\n function burn(uint256 streamId) external;\n\n /// @notice Cancels the stream and refunds any remaining assets to the sender.\n ///\n /// @dev Emits a {Transfer}, {CancelLockupStream}, and {MetadataUpdate} event.\n ///\n /// Notes:\n /// - If there any assets left for the recipient to withdraw, the stream is marked as canceled. Otherwise, the\n /// stream is marked as depleted.\n /// - This function attempts to invoke a hook on the recipient, if the resolved address is a contract.\n ///\n /// Requirements:\n /// - Must not be delegate called.\n /// - The stream must be warm and cancelable.\n /// - `msg.sender` must be the stream's sender.\n ///\n /// @param streamId The ID of the stream to cancel.\n function cancel(uint256 streamId) external;\n\n /// @notice Cancels multiple streams and refunds any remaining assets to the sender.\n ///\n /// @dev Emits multiple {Transfer}, {CancelLockupStream}, and {MetadataUpdate} events.\n ///\n /// Notes:\n /// - Refer to the notes in {cancel}.\n ///\n /// Requirements:\n /// - All requirements from {cancel} must be met for each stream.\n ///\n /// @param streamIds The IDs of the streams to cancel.\n function cancelMultiple(uint256[] calldata streamIds) external;\n\n /// @notice Removes the right of the stream's sender to cancel the stream.\n ///\n /// @dev Emits a {RenounceLockupStream} and {MetadataUpdate} event.\n ///\n /// Notes:\n /// - This is an irreversible operation.\n ///\n /// Requirements:\n /// - Must not be delegate called.\n /// - `streamId` must reference a warm stream.\n /// - `msg.sender` must be the stream's sender.\n /// - The stream must be cancelable.\n ///\n /// @param streamId The ID of the stream to renounce.\n function renounce(uint256 streamId) external;\n\n /// @notice Sets a new NFT descriptor contract, which produces the URI describing the Sablier stream NFTs.\n ///\n /// @dev Emits a {SetNFTDescriptor} and {BatchMetadataUpdate} event.\n ///\n /// Notes:\n /// - Does not revert if the NFT descriptor is the same.\n ///\n /// Requirements:\n /// - `msg.sender` must be the contract admin.\n ///\n /// @param newNFTDescriptor The address of the new NFT descriptor contract.\n function setNFTDescriptor(\n ISablierV2NFTDescriptor newNFTDescriptor\n ) external;\n\n /// @notice Withdraws the provided amount of assets from the stream to the `to` address.\n ///\n /// @dev Emits a {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} event.\n ///\n /// Notes:\n /// - This function attempts to call a hook on the recipient of the stream, unless `msg.sender` is the recipient.\n ///\n /// Requirements:\n /// - Must not be delegate called.\n /// - `streamId` must not reference a null or depleted stream.\n /// - `to` must not be the zero address.\n /// - `amount` must be greater than zero and must not exceed the withdrawable amount.\n /// - `to` must be the recipient if `msg.sender` is not the stream's recipient or an approved third party.\n ///\n /// @param streamId The ID of the stream to withdraw from.\n /// @param to The address receiving the withdrawn assets.\n /// @param amount The amount to withdraw, denoted in units of the asset's decimals.\n function withdraw(uint256 streamId, address to, uint128 amount) external;\n\n /// @notice Withdraws the maximum withdrawable amount from the stream to the provided address `to`.\n ///\n /// @dev Emits a {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} event.\n ///\n /// Notes:\n /// - Refer to the notes in {withdraw}.\n ///\n /// Requirements:\n /// - Refer to the requirements in {withdraw}.\n ///\n /// @param streamId The ID of the stream to withdraw from.\n /// @param to The address receiving the withdrawn assets.\n /// @return withdrawnAmount The amount withdrawn, denoted in units of the asset's decimals.\n function withdrawMax(\n uint256 streamId,\n address to\n ) external returns (uint128 withdrawnAmount);\n\n /// @notice Withdraws the maximum withdrawable amount from the stream to the current recipient, and transfers the\n /// NFT to `newRecipient`.\n ///\n /// @dev Emits a {WithdrawFromLockupStream} and a {Transfer} event.\n ///\n /// Notes:\n /// - If the withdrawable amount is zero, the withdrawal is skipped.\n /// - Refer to the notes in {withdraw}.\n ///\n /// Requirements:\n /// - `msg.sender` must be the stream's recipient.\n /// - Refer to the requirements in {withdraw}.\n /// - Refer to the requirements in {IERC721.transferFrom}.\n ///\n /// @param streamId The ID of the stream NFT to transfer.\n /// @param newRecipient The address of the new owner of the stream NFT.\n /// @return withdrawnAmount The amount withdrawn, denoted in units of the asset's decimals.\n function withdrawMaxAndTransfer(\n uint256 streamId,\n address newRecipient\n ) external returns (uint128 withdrawnAmount);\n\n /// @notice Withdraws assets from streams to the recipient of each stream.\n ///\n /// @dev Emits multiple {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} events.\n ///\n /// Notes:\n /// - This function attempts to call a hook on the recipient of each stream, unless `msg.sender` is the recipient.\n ///\n /// Requirements:\n /// - Must not be delegate called.\n /// - There must be an equal number of `streamIds` and `amounts`.\n /// - Each stream ID in the array must not reference a null or depleted stream.\n /// - Each amount in the array must be greater than zero and must not exceed the withdrawable amount.\n ///\n /// @param streamIds The IDs of the streams to withdraw from.\n /// @param amounts The amounts to withdraw, denoted in units of the asset's decimals.\n function withdrawMultiple(\n uint256[] calldata streamIds,\n uint128[] calldata amounts\n ) external;\n}\n" + }, + "contracts/interfaces/sablier/ISablierV2LockupLinear.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\npragma solidity >=0.8.22;\n\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\nimport {Lockup, LockupLinear} from \"./types/DataTypes.sol\";\nimport {ISablierV2Lockup} from \"./ISablierV2Lockup.sol\";\n\n/// @title ISablierV2LockupLinear\n/// @notice Creates and manages Lockup streams with a linear distribution function.\ninterface ISablierV2LockupLinear is ISablierV2Lockup {\n /*//////////////////////////////////////////////////////////////////////////\n EVENTS\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @notice Emitted when a stream is created.\n /// @param streamId The ID of the newly created stream.\n /// @param funder The address which funded the stream.\n /// @param sender The address distributing the assets, which will have the ability to cancel the stream.\n /// @param recipient The address receiving the assets.\n /// @param amounts Struct encapsulating (i) the deposit amount, and (ii) the broker fee amount, both denoted\n /// in units of the asset's decimals.\n /// @param asset The contract address of the ERC-20 asset to be distributed.\n /// @param cancelable Boolean indicating whether the stream will be cancelable or not.\n /// @param transferable Boolean indicating whether the stream NFT is transferable or not.\n /// @param timestamps Struct encapsulating (i) the stream's start time, (ii) cliff time, and (iii) end time, all as\n /// Unix timestamps.\n /// @param broker The address of the broker who has helped create the stream, e.g. a front-end website.\n event CreateLockupLinearStream(\n uint256 streamId,\n address funder,\n address indexed sender,\n address indexed recipient,\n Lockup.CreateAmounts amounts,\n IERC20 indexed asset,\n bool cancelable,\n bool transferable,\n LockupLinear.Timestamps timestamps,\n address broker\n );\n\n /*//////////////////////////////////////////////////////////////////////////\n CONSTANT FUNCTIONS\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @notice Retrieves the stream's cliff time, which is a Unix timestamp. A value of zero means there\n /// is no cliff.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function getCliffTime(\n uint256 streamId\n ) external view returns (uint40 cliffTime);\n\n /// @notice Retrieves the full stream details.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n /// @return stream See the documentation in {DataTypes}.\n function getStream(\n uint256 streamId\n ) external view returns (LockupLinear.StreamLL memory stream);\n\n /// @notice Retrieves the stream's start, cliff and end timestamps.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n /// @return timestamps See the documentation in {DataTypes}.\n function getTimestamps(\n uint256 streamId\n ) external view returns (LockupLinear.Timestamps memory timestamps);\n\n /*//////////////////////////////////////////////////////////////////////////\n NON-CONSTANT FUNCTIONS\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @notice Creates a stream by setting the start time to `block.timestamp`, and the end time to\n /// the sum of `block.timestamp` and `params.durations.total`. The stream is funded by `msg.sender` and is wrapped\n /// in an ERC-721 NFT.\n ///\n /// @dev Emits a {Transfer} and {CreateLockupLinearStream} event.\n ///\n /// Requirements:\n /// - All requirements in {createWithTimestamps} must be met for the calculated parameters.\n ///\n /// @param params Struct encapsulating the function parameters, which are documented in {DataTypes}.\n /// @return streamId The ID of the newly created stream.\n function createWithDurations(\n LockupLinear.CreateWithDurations calldata params\n ) external returns (uint256 streamId);\n\n /// @notice Creates a stream with the provided start time and end time. The stream is funded by `msg.sender` and is\n /// wrapped in an ERC-721 NFT.\n ///\n /// @dev Emits a {Transfer} and {CreateLockupLinearStream} event.\n ///\n /// Notes:\n /// - A cliff time of zero means there is no cliff.\n /// - As long as the times are ordered, it is not an error for the start or the cliff time to be in the past.\n ///\n /// Requirements:\n /// - Must not be delegate called.\n /// - `params.totalAmount` must be greater than zero.\n /// - If set, `params.broker.fee` must not be greater than `MAX_BROKER_FEE`.\n /// - `params.timestamps.start` must be greater than zero and less than `params.timestamps.end`.\n /// - If set, `params.timestamps.cliff` must be greater than `params.timestamps.start` and less than\n /// `params.timestamps.end`.\n /// - `params.timestamps.end` must be in the future.\n /// - `params.recipient` must not be the zero address.\n /// - `msg.sender` must have allowed this contract to spend at least `params.totalAmount` assets.\n ///\n /// @param params Struct encapsulating the function parameters, which are documented in {DataTypes}.\n /// @return streamId The ID of the newly created stream.\n function createWithTimestamps(\n LockupLinear.CreateWithTimestamps calldata params\n ) external returns (uint256 streamId);\n}\n" + }, + "contracts/interfaces/sablier/ISablierV2NFTDescriptor.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\npragma solidity >=0.8.22;\n\nimport {IERC721Metadata} from \"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\";\n\n/// @title ISablierV2NFTDescriptor\n/// @notice This contract generates the URI describing the Sablier V2 stream NFTs.\n/// @dev Inspired by Uniswap V3 Positions NFTs.\ninterface ISablierV2NFTDescriptor {\n /// @notice Produces the URI describing a particular stream NFT.\n /// @dev This is a data URI with the JSON contents directly inlined.\n /// @param sablier The address of the Sablier contract the stream was created in.\n /// @param streamId The ID of the stream for which to produce a description.\n /// @return uri The URI of the ERC721-compliant metadata.\n function tokenURI(\n IERC721Metadata sablier,\n uint256 streamId\n ) external view returns (string memory uri);\n}\n" + }, + "contracts/interfaces/sablier/types/DataTypes.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\npragma solidity >=0.8.22;\n\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {UD2x18} from \"@prb/math/src/UD2x18.sol\";\nimport {UD60x18} from \"@prb/math/src/UD60x18.sol\";\n\n// DataTypes.sol\n//\n// This file defines all structs used in V2 Core, most of which are organized under three namespaces:\n//\n// - Lockup\n// - LockupDynamic\n// - LockupLinear\n// - LockupTranched\n//\n// You will notice that some structs contain \"slot\" annotations - they are used to indicate the\n// storage layout of the struct. It is more gas efficient to group small data types together so\n// that they fit in a single 32-byte slot.\n\n/// @notice Struct encapsulating the broker parameters passed to the create functions. Both can be set to zero.\n/// @param account The address receiving the broker's fee.\n/// @param fee The broker's percentage fee from the total amount, denoted as a fixed-point number where 1e18 is 100%.\nstruct Broker {\n address account;\n UD60x18 fee;\n}\n\n/// @notice Namespace for the structs used in both {SablierV2LockupLinear} and {SablierV2LockupDynamic}.\nlibrary Lockup {\n /// @notice Struct encapsulating the deposit, withdrawn, and refunded amounts, all denoted in units of the asset's\n /// decimals.\n /// @dev Because the deposited and the withdrawn amount are often read together, declaring them in the same slot\n /// saves gas.\n /// @param deposited The initial amount deposited in the stream, net of broker fee.\n /// @param withdrawn The cumulative amount withdrawn from the stream.\n /// @param refunded The amount refunded to the sender. Unless the stream was canceled, this is always zero.\n struct Amounts {\n // slot 0\n uint128 deposited;\n uint128 withdrawn;\n // slot 1\n uint128 refunded;\n }\n\n /// @notice Struct encapsulating (i) the deposit amount and (ii) the broker fee amount, both denoted in units of the\n /// asset's decimals.\n /// @param deposit The amount to deposit in the stream.\n /// @param brokerFee The broker fee amount.\n struct CreateAmounts {\n uint128 deposit;\n uint128 brokerFee;\n }\n\n /// @notice Enum representing the different statuses of a stream.\n /// @custom:value0 PENDING Stream created but not started; assets are in a pending state.\n /// @custom:value1 STREAMING Active stream where assets are currently being streamed.\n /// @custom:value2 SETTLED All assets have been streamed; recipient is due to withdraw them.\n /// @custom:value3 CANCELED Canceled stream; remaining assets await recipient's withdrawal.\n /// @custom:value4 DEPLETED Depleted stream; all assets have been withdrawn and/or refunded.\n enum Status {\n PENDING,\n STREAMING,\n SETTLED,\n CANCELED,\n DEPLETED\n }\n\n /// @notice A common data structure to be stored in all {SablierV2Lockup} models.\n /// @dev The fields are arranged like this to save gas via tight variable packing.\n /// @param sender The address distributing the assets, with the ability to cancel the stream.\n /// @param startTime The Unix timestamp indicating the stream's start.\n /// @param endTime The Unix timestamp indicating the stream's end.\n /// @param isCancelable Boolean indicating if the stream is cancelable.\n /// @param wasCanceled Boolean indicating if the stream was canceled.\n /// @param asset The contract address of the ERC-20 asset to be distributed.\n /// @param isDepleted Boolean indicating if the stream is depleted.\n /// @param isStream Boolean indicating if the struct entity exists.\n /// @param isTransferable Boolean indicating if the stream NFT is transferable.\n /// @param amounts Struct encapsulating the deposit, withdrawn, and refunded amounts, all denoted in units of the\n /// asset's decimals.\n struct Stream {\n // slot 0\n address sender;\n uint40 startTime;\n uint40 endTime;\n bool isCancelable;\n bool wasCanceled;\n // slot 1\n IERC20 asset;\n bool isDepleted;\n bool isStream;\n bool isTransferable;\n // slot 2 and 3\n Lockup.Amounts amounts;\n }\n}\n\n/// @notice Namespace for the structs used in {SablierV2LockupDynamic}.\nlibrary LockupDynamic {\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupDynamic.createWithDurations} function.\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\n /// the same as `msg.sender`.\n /// @param recipient The address receiving the assets.\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\n /// broker fee, denoted in units of the asset's decimals.\n /// @param asset The contract address of the ERC-20 asset to be distributed.\n /// @param cancelable Indicates if the stream is cancelable.\n /// @param transferable Indicates if the stream NFT is transferable.\n /// @param segments Segments with durations used to compose the dynamic distribution function. Timestamps are\n /// calculated by starting from `block.timestamp` and adding each duration to the previous timestamp.\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\n struct CreateWithDurations {\n address sender;\n address recipient;\n uint128 totalAmount;\n IERC20 asset;\n bool cancelable;\n bool transferable;\n SegmentWithDuration[] segments;\n Broker broker;\n }\n\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupDynamic.createWithTimestamps} function.\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\n /// the same as `msg.sender`.\n /// @param recipient The address receiving the assets.\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\n /// broker fee, denoted in units of the asset's decimals.\n /// @param asset The contract address of the ERC-20 asset to be distributed.\n /// @param cancelable Indicates if the stream is cancelable.\n /// @param transferable Indicates if the stream NFT is transferable.\n /// @param startTime The Unix timestamp indicating the stream's start.\n /// @param segments Segments used to compose the dynamic distribution function.\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\n struct CreateWithTimestamps {\n address sender;\n address recipient;\n uint128 totalAmount;\n IERC20 asset;\n bool cancelable;\n bool transferable;\n uint40 startTime;\n Segment[] segments;\n Broker broker;\n }\n\n /// @notice Segment struct used in the Lockup Dynamic stream.\n /// @param amount The amount of assets to be streamed in the segment, denoted in units of the asset's decimals.\n /// @param exponent The exponent of the segment, denoted as a fixed-point number.\n /// @param timestamp The Unix timestamp indicating the segment's end.\n struct Segment {\n // slot 0\n uint128 amount;\n UD2x18 exponent;\n uint40 timestamp;\n }\n\n /// @notice Segment struct used at runtime in {SablierV2LockupDynamic.createWithDurations}.\n /// @param amount The amount of assets to be streamed in the segment, denoted in units of the asset's decimals.\n /// @param exponent The exponent of the segment, denoted as a fixed-point number.\n /// @param duration The time difference in seconds between the segment and the previous one.\n struct SegmentWithDuration {\n uint128 amount;\n UD2x18 exponent;\n uint40 duration;\n }\n\n /// @notice Struct encapsulating the full details of a stream.\n /// @dev Extends `Lockup.Stream` by including the recipient and the segments.\n struct StreamLD {\n address sender;\n address recipient;\n uint40 startTime;\n uint40 endTime;\n bool isCancelable;\n bool wasCanceled;\n IERC20 asset;\n bool isDepleted;\n bool isStream;\n bool isTransferable;\n Lockup.Amounts amounts;\n Segment[] segments;\n }\n\n /// @notice Struct encapsulating the LockupDynamic timestamps.\n /// @param start The Unix timestamp indicating the stream's start.\n /// @param end The Unix timestamp indicating the stream's end.\n struct Timestamps {\n uint40 start;\n uint40 end;\n }\n}\n\n/// @notice Namespace for the structs used in {SablierV2LockupLinear}.\nlibrary LockupLinear {\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupLinear.createWithDurations} function.\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\n /// the same as `msg.sender`.\n /// @param recipient The address receiving the assets.\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\n /// broker fee, denoted in units of the asset's decimals.\n /// @param asset The contract address of the ERC-20 asset to be distributed.\n /// @param cancelable Indicates if the stream is cancelable.\n /// @param transferable Indicates if the stream NFT is transferable.\n /// @param durations Struct encapsulating (i) cliff period duration and (ii) total stream duration, both in seconds.\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\n struct CreateWithDurations {\n address sender;\n address recipient;\n uint128 totalAmount;\n IERC20 asset;\n bool cancelable;\n bool transferable;\n Durations durations;\n Broker broker;\n }\n\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupLinear.createWithTimestamps} function.\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\n /// the same as `msg.sender`.\n /// @param recipient The address receiving the assets.\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\n /// broker fee, denoted in units of the asset's decimals.\n /// @param asset The contract address of the ERC-20 asset to be distributed.\n /// @param cancelable Indicates if the stream is cancelable.\n /// @param transferable Indicates if the stream NFT is transferable.\n /// @param timestamps Struct encapsulating (i) the stream's start time, (ii) cliff time, and (iii) end time, all as\n /// Unix timestamps.\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\n struct CreateWithTimestamps {\n address sender;\n address recipient;\n uint128 totalAmount;\n IERC20 asset;\n bool cancelable;\n bool transferable;\n Timestamps timestamps;\n Broker broker;\n }\n\n /// @notice Struct encapsulating the cliff duration and the total duration.\n /// @param cliff The cliff duration in seconds.\n /// @param total The total duration in seconds.\n struct Durations {\n uint40 cliff;\n uint40 total;\n }\n\n /// @notice Struct encapsulating the full details of a stream.\n /// @dev Extends `Lockup.Stream` by including the recipient and the cliff time.\n struct StreamLL {\n address sender;\n address recipient;\n uint40 startTime;\n bool isCancelable;\n bool wasCanceled;\n IERC20 asset;\n uint40 endTime;\n bool isDepleted;\n bool isStream;\n bool isTransferable;\n Lockup.Amounts amounts;\n uint40 cliffTime;\n }\n\n /// @notice Struct encapsulating the LockupLinear timestamps.\n /// @param start The Unix timestamp for the stream's start.\n /// @param cliff The Unix timestamp for the cliff period's end. A value of zero means there is no cliff.\n /// @param end The Unix timestamp for the stream's end.\n struct Timestamps {\n uint40 start;\n uint40 cliff;\n uint40 end;\n }\n}\n\n/// @notice Namespace for the structs used in {SablierV2LockupTranched}.\nlibrary LockupTranched {\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupTranched.createWithDurations} function.\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\n /// the same as `msg.sender`.\n /// @param recipient The address receiving the assets.\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\n /// broker fee, denoted in units of the asset's decimals.\n /// @param asset The contract address of the ERC-20 asset to be distributed.\n /// @param cancelable Indicates if the stream is cancelable.\n /// @param transferable Indicates if the stream NFT is transferable.\n /// @param tranches Tranches with durations used to compose the tranched distribution function. Timestamps are\n /// calculated by starting from `block.timestamp` and adding each duration to the previous timestamp.\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\n struct CreateWithDurations {\n address sender;\n address recipient;\n uint128 totalAmount;\n IERC20 asset;\n bool cancelable;\n bool transferable;\n TrancheWithDuration[] tranches;\n Broker broker;\n }\n\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupTranched.createWithTimestamps} function.\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\n /// the same as `msg.sender`.\n /// @param recipient The address receiving the assets.\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\n /// broker fee, denoted in units of the asset's decimals.\n /// @param asset The contract address of the ERC-20 asset to be distributed.\n /// @param cancelable Indicates if the stream is cancelable.\n /// @param transferable Indicates if the stream NFT is transferable.\n /// @param startTime The Unix timestamp indicating the stream's start.\n /// @param tranches Tranches used to compose the tranched distribution function.\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\n struct CreateWithTimestamps {\n address sender;\n address recipient;\n uint128 totalAmount;\n IERC20 asset;\n bool cancelable;\n bool transferable;\n uint40 startTime;\n Tranche[] tranches;\n Broker broker;\n }\n\n /// @notice Struct encapsulating the full details of a stream.\n /// @dev Extends `Lockup.Stream` by including the recipient and the tranches.\n struct StreamLT {\n address sender;\n address recipient;\n uint40 startTime;\n uint40 endTime;\n bool isCancelable;\n bool wasCanceled;\n IERC20 asset;\n bool isDepleted;\n bool isStream;\n bool isTransferable;\n Lockup.Amounts amounts;\n Tranche[] tranches;\n }\n\n /// @notice Struct encapsulating the LockupTranched timestamps.\n /// @param start The Unix timestamp indicating the stream's start.\n /// @param end The Unix timestamp indicating the stream's end.\n struct Timestamps {\n uint40 start;\n uint40 end;\n }\n\n /// @notice Tranche struct used in the Lockup Tranched stream.\n /// @param amount The amount of assets to be unlocked in the tranche, denoted in units of the asset's decimals.\n /// @param timestamp The Unix timestamp indicating the tranche's end.\n struct Tranche {\n // slot 0\n uint128 amount;\n uint40 timestamp;\n }\n\n /// @notice Tranche struct used at runtime in {SablierV2LockupTranched.createWithDurations}.\n /// @param amount The amount of assets to be unlocked in the tranche, denoted in units of the asset's decimals.\n /// @param duration The time difference in seconds between the tranche and the previous one.\n struct TrancheWithDuration {\n uint128 amount;\n uint40 duration;\n }\n}\n" + }, + "contracts/mocks/ERC6551Registry.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IERC6551Registry {\n /**\n * @dev The registry MUST emit the ERC6551AccountCreated event upon successful account creation.\n */\n event ERC6551AccountCreated(\n address account,\n address indexed implementation,\n bytes32 salt,\n uint256 chainId,\n address indexed tokenContract,\n uint256 indexed tokenId\n );\n\n /**\n * @dev The registry MUST revert with AccountCreationFailed error if the create2 operation fails.\n */\n error AccountCreationFailed();\n\n /**\n * @dev Creates a token bound account for a non-fungible token.\n *\n * If account has already been created, returns the account address without calling create2.\n *\n * Emits ERC6551AccountCreated event.\n *\n * @return account The address of the token bound account\n */\n function createAccount(\n address implementation,\n bytes32 salt,\n uint256 chainId,\n address tokenContract,\n uint256 tokenId\n ) external returns (address account);\n\n /**\n * @dev Returns the computed token bound account address for a non-fungible token.\n *\n * @return account The address of the token bound account\n */\n function account(\n address implementation,\n bytes32 salt,\n uint256 chainId,\n address tokenContract,\n uint256 tokenId\n ) external view returns (address account);\n}\n\ncontract ERC6551Registry is IERC6551Registry {\n function createAccount(\n address implementation,\n bytes32 salt,\n uint256 chainId,\n address tokenContract,\n uint256 tokenId\n ) external returns (address) {\n assembly {\n // Memory Layout:\n // ----\n // 0x00 0xff (1 byte)\n // 0x01 registry (address) (20 bytes)\n // 0x15 salt (bytes32) (32 bytes)\n // 0x35 Bytecode Hash (bytes32) (32 bytes)\n // ----\n // 0x55 ERC-1167 Constructor + Header (20 bytes)\n // 0x69 implementation (address) (20 bytes)\n // 0x5D ERC-1167 Footer (15 bytes)\n // 0x8C salt (uint256) (32 bytes)\n // 0xAC chainId (uint256) (32 bytes)\n // 0xCC tokenContract (address) (32 bytes)\n // 0xEC tokenId (uint256) (32 bytes)\n\n // Silence unused variable warnings\n pop(chainId)\n\n // Copy bytecode + constant data to memory\n calldatacopy(0x8c, 0x24, 0x80) // salt, chainId, tokenContract, tokenId\n mstore(0x6c, 0x5af43d82803e903d91602b57fd5bf3) // ERC-1167 footer\n mstore(0x5d, implementation) // implementation\n mstore(0x49, 0x3d60ad80600a3d3981f3363d3d373d3d3d363d73) // ERC-1167 constructor + header\n\n // Copy create2 computation data to memory\n mstore8(0x00, 0xff) // 0xFF\n mstore(0x35, keccak256(0x55, 0xb7)) // keccak256(bytecode)\n mstore(0x01, shl(96, address())) // registry address\n mstore(0x15, salt) // salt\n\n // Compute account address\n let computed := keccak256(0x00, 0x55)\n\n // If the account has not yet been deployed\n if iszero(extcodesize(computed)) {\n // Deploy account contract\n let deployed := create2(0, 0x55, 0xb7, salt)\n\n // Revert if the deployment fails\n if iszero(deployed) {\n mstore(0x00, 0x20188a59) // `AccountCreationFailed()`\n revert(0x1c, 0x04)\n }\n\n // Store account address in memory before salt and chainId\n mstore(0x6c, deployed)\n\n // Emit the ERC6551AccountCreated event\n log4(\n 0x6c,\n 0x60,\n // `ERC6551AccountCreated(address,address,bytes32,uint256,address,uint256)`\n 0x79f19b3655ee38b1ce526556b7731a20c8f218fbda4a3990b6cc4172fdf88722,\n implementation,\n tokenContract,\n tokenId\n )\n\n // Return the account address\n return(0x6c, 0x20)\n }\n\n // Otherwise, return the computed account address\n mstore(0x00, shr(96, shl(96, computed)))\n return(0x00, 0x20)\n }\n }\n\n function account(\n address implementation,\n bytes32 salt,\n uint256 chainId,\n address tokenContract,\n uint256 tokenId\n ) external view returns (address) {\n assembly {\n // Silence unused variable warnings\n pop(chainId)\n pop(tokenContract)\n pop(tokenId)\n\n // Copy bytecode + constant data to memory\n calldatacopy(0x8c, 0x24, 0x80) // salt, chainId, tokenContract, tokenId\n mstore(0x6c, 0x5af43d82803e903d91602b57fd5bf3) // ERC-1167 footer\n mstore(0x5d, implementation) // implementation\n mstore(0x49, 0x3d60ad80600a3d3981f3363d3d373d3d3d363d73) // ERC-1167 constructor + header\n\n // Copy create2 computation data to memory\n mstore8(0x00, 0xff) // 0xFF\n mstore(0x35, keccak256(0x55, 0xb7)) // keccak256(bytecode)\n mstore(0x01, shl(96, address())) // registry address\n mstore(0x15, salt) // salt\n\n // Store computed account address in memory\n mstore(0x00, shr(96, shl(96, keccak256(0x00, 0x55))))\n\n // Return computed account address\n return(0x00, 0x20)\n }\n }\n}\n" + }, + "contracts/mocks/MockContract.sol": { + "content": "//SPDX-License-Identifier: Unlicense\n\npragma solidity ^0.8.19;\n\n/**\n * Mock contract for testing\n */\ncontract MockContract {\n event DidSomething(string message);\n\n error Reverting();\n\n function doSomething() public {\n doSomethingWithParam(\"doSomething()\");\n }\n\n function doSomethingWithParam(string memory _message) public {\n emit DidSomething(_message);\n }\n\n function returnSomething(string memory _s)\n external\n pure\n returns (string memory)\n {\n return _s;\n }\n\n function revertSomething() external pure {\n revert Reverting();\n }\n}\n" + }, + "contracts/mocks/MockDecentHatsUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.28;\n\nimport {DecentHatsModuleUtils} from \"../modules/DecentHatsModuleUtils.sol\";\n\ncontract MockDecentHatsModuleUtils is DecentHatsModuleUtils {\n // Expose the internal _processHat function for testing\n function processRoleHats(CreateRoleHatsParams calldata params) external {\n _processRoleHats(params);\n }\n}\n" + }, + "contracts/mocks/MockHatsElectionsEligibility.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\nimport {IHatsElectionsEligibility} from \"../interfaces/hats/modules/IHatsElectionsEligibility.sol\";\n\ncontract MockHatsElectionsEligibility is IHatsElectionsEligibility {\n // Storage\n mapping(uint128 termEnd => mapping(address candidates => bool elected))\n public electionResults;\n mapping(uint128 termEnd => bool isElectionOpen) public electionStatus;\n uint128 public currentTermEnd;\n uint128 public nextTermEnd;\n\n // Errors\n error AlreadySetup();\n error ElectionNotOpen();\n error InvalidTermEnd();\n error NoActiveElection();\n error ElectionClosed(uint128 termEnd);\n error TermNotEnded();\n error NextTermNotReady();\n error TooManyWinners();\n\n modifier onlyOnce() {\n if (currentTermEnd != 0) revert AlreadySetup();\n _;\n }\n\n function _setUp(bytes calldata _initData) external onlyOnce {\n // decode init data\n uint128 _firstTermEnd = abi.decode(_initData, (uint128));\n require(\n _firstTermEnd > block.timestamp,\n \"First term must end in the future\"\n );\n\n currentTermEnd = _firstTermEnd;\n\n // open the first election\n electionStatus[_firstTermEnd] = true;\n\n // log the first term\n emit ElectionOpened(_firstTermEnd);\n }\n\n function elect(uint128 _termEnd, address[] calldata _winners) external {\n // results can only be submitted for open elections\n if (!electionStatus[_termEnd]) revert ElectionClosed(_termEnd);\n\n // close the election\n electionStatus[_termEnd] = false;\n\n // set the election results\n for (uint256 i; i < _winners.length; ) {\n electionResults[_termEnd][_winners[i]] = true;\n\n unchecked {\n ++i;\n }\n }\n\n // log the election results\n emit ElectionCompleted(_termEnd, _winners);\n }\n\n function recall(uint128 _termEnd, address[] calldata _recallees) external {\n // loop through the accounts and set their election status to false\n for (uint256 i; i < _recallees.length; ) {\n electionResults[_termEnd][_recallees[i]] = false;\n\n unchecked {\n ++i;\n }\n }\n\n emit Recalled(_termEnd, _recallees);\n }\n\n function setNextTerm(uint128 _newTermEnd) external {\n // new term must end after current term\n if (_newTermEnd <= currentTermEnd) revert InvalidTermEnd();\n\n // if next term is already set, its election must still be open\n uint128 next = nextTermEnd;\n if (next > 0 && !electionStatus[next]) revert ElectionClosed(next);\n\n // set the next term\n nextTermEnd = _newTermEnd;\n\n // open the next election\n electionStatus[_newTermEnd] = true;\n\n // log the new term\n emit ElectionOpened(_newTermEnd);\n }\n\n function startNextTerm() external {\n // current term must be over\n if (block.timestamp < currentTermEnd) revert TermNotEnded();\n\n uint128 next = nextTermEnd; // save SLOADs\n\n // next term must be set and its election must be closed\n if (next == 0 || electionStatus[next]) revert NextTermNotReady();\n\n // set the current term to the next term\n currentTermEnd = next;\n\n // clear the next term\n nextTermEnd = 0;\n\n // log the change\n emit NewTermStarted(next);\n }\n\n function getWearerStatus(\n address _wearer,\n uint256 /* _hatId */\n ) public view override returns (bool eligible, bool standing) {\n /// @dev This eligibility module is not concerned with standing, so we default it to good standing\n standing = true;\n\n uint128 current = currentTermEnd; // save SLOAD\n\n if (block.timestamp < current) {\n // if the current term is still open, the wearer is eligible if they have been elected for the current term\n eligible = electionResults[current][_wearer];\n }\n // if the current term is closed, the wearer is not eligible\n }\n\n // // Test helper functions\n // function setWearerStatus(address wearer, bool eligible) external {\n // electionResults[currentTermEnd][wearer] = eligible;\n // }\n\n function BALLOT_BOX_HAT() external pure override returns (uint256) {}\n\n function ADMIN_HAT() external pure override returns (uint256) {}\n}\n" + }, + "contracts/mocks/MockHatsModuleFactory.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport {IHatsModuleFactory} from \"../interfaces/hats/IHatsModuleFactory.sol\";\nimport {MockHatsElectionsEligibility} from \"./MockHatsElectionsEligibility.sol\";\n\ncontract MockHatsModuleFactory is IHatsModuleFactory {\n function createHatsModule(\n address,\n uint256,\n bytes calldata,\n bytes calldata _initData,\n uint256\n ) external override returns (address _instance) {\n // Deploy a new instance of MockHatsElectionsEligibility\n MockHatsElectionsEligibility newModule = new MockHatsElectionsEligibility();\n newModule._setUp(_initData);\n _instance = address(newModule);\n }\n\n function getHatsModuleAddress(\n address _implementation,\n uint256 _hatId,\n bytes calldata _otherImmutableArgs,\n uint256 _saltNonce\n ) external view returns (address) {}\n\n function HATS() external view override returns (address) {}\n\n function version() external view override returns (string memory) {}\n\n function batchCreateHatsModule(\n address[] calldata _implementations,\n uint256[] calldata _hatIds,\n bytes[] calldata _otherImmutableArgsArray,\n bytes[] calldata _initDataArray,\n uint256[] calldata _saltNonces\n ) external override returns (bool success) {}\n\n function deployed(\n address _implementation,\n uint256 _hatId,\n bytes calldata _otherImmutableArgs,\n uint256 _saltNonce\n ) external view override returns (bool) {}\n}\n" + }, + "contracts/mocks/MockLockupLinear.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\nlibrary MockLockupLinear {\n struct CreateWithTimestamps {\n address sender;\n address recipient;\n uint128 totalAmount;\n IERC20 asset;\n bool cancelable;\n bool transferable;\n Timestamps timestamps;\n Broker broker;\n }\n\n struct Timestamps {\n uint40 start;\n uint40 cliff;\n uint40 end;\n }\n\n struct Broker {\n address account;\n uint256 fee;\n }\n\n struct Stream {\n address sender;\n uint40 startTime;\n uint40 endTime;\n uint40 cliffTime;\n bool cancelable;\n bool wasCanceled;\n address asset;\n bool transferable;\n uint128 totalAmount;\n address recipient;\n }\n\n /// @notice Enum representing the different statuses of a stream.\n /// @custom:value0 PENDING Stream created but not started; assets are in a pending state.\n /// @custom:value1 STREAMING Active stream where assets are currently being streamed.\n /// @custom:value2 SETTLED All assets have been streamed; recipient is due to withdraw them.\n /// @custom:value3 CANCELED Canceled stream; remaining assets await recipient's withdrawal.\n /// @custom:value4 DEPLETED Depleted stream; all assets have been withdrawn and/or refunded.\n enum Status {\n PENDING,\n STREAMING,\n SETTLED,\n CANCELED,\n DEPLETED\n }\n}\n" + }, + "contracts/mocks/MockSablierV2LockupLinear.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.22;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {ISablierV2LockupLinear} from \"../interfaces/sablier/ISablierV2LockupLinear.sol\";\nimport {MockLockupLinear} from \"./MockLockupLinear.sol\";\n\ncontract MockSablierV2LockupLinear {\n mapping(uint256 => MockLockupLinear.Stream) public streams;\n uint256 public nextStreamId = 1;\n\n // Add this event declaration at the contract level\n event StreamCreated(\n uint256 streamId,\n address indexed sender,\n address indexed recipient,\n uint128 totalAmount,\n address indexed asset,\n bool cancelable,\n bool transferable,\n uint40 startTime,\n uint40 cliffTime,\n uint40 endTime\n );\n\n function createWithTimestamps(\n MockLockupLinear.CreateWithTimestamps calldata params\n ) external returns (uint256 streamId) {\n require(\n params.asset.transferFrom(\n msg.sender,\n address(this),\n params.totalAmount\n ),\n \"Token transfer failed\"\n );\n\n streamId = nextStreamId++;\n streams[streamId] = MockLockupLinear.Stream({\n sender: params.sender,\n recipient: params.recipient,\n totalAmount: params.totalAmount,\n asset: address(params.asset),\n cancelable: params.cancelable,\n wasCanceled: false,\n transferable: params.transferable,\n startTime: params.timestamps.start,\n cliffTime: params.timestamps.cliff,\n endTime: params.timestamps.end\n });\n\n // Emit the StreamCreated event\n emit StreamCreated(\n streamId,\n params.sender,\n params.recipient,\n params.totalAmount,\n address(params.asset),\n params.cancelable,\n params.transferable,\n params.timestamps.start,\n params.timestamps.cliff,\n params.timestamps.end\n );\n\n return streamId;\n }\n\n function getStream(\n uint256 streamId\n ) external view returns (MockLockupLinear.Stream memory) {\n return streams[streamId];\n }\n\n function withdrawableAmountOf(\n uint256 streamId\n ) public view returns (uint128) {\n MockLockupLinear.Stream memory stream = streams[streamId];\n if (block.timestamp <= stream.startTime) {\n return 0;\n }\n if (block.timestamp >= stream.endTime) {\n return stream.totalAmount;\n }\n return\n uint128(\n (stream.totalAmount * (block.timestamp - stream.startTime)) /\n (stream.endTime - stream.startTime)\n );\n }\n\n function withdrawMax(\n uint256 streamId,\n address to\n ) external returns (uint128 withdrawnAmount) {\n withdrawnAmount = withdrawableAmountOf(streamId);\n MockLockupLinear.Stream storage stream = streams[streamId];\n\n require(\n msg.sender == stream.recipient,\n \"Only recipient can call withdraw\"\n );\n require(\n withdrawnAmount <= withdrawableAmountOf(streamId),\n \"Insufficient withdrawable amount\"\n );\n\n stream.totalAmount -= withdrawnAmount;\n IERC20(stream.asset).transfer(to, withdrawnAmount);\n }\n\n function cancel(uint256 streamId) external {\n MockLockupLinear.Stream memory stream = streams[streamId];\n require(stream.cancelable, \"Stream is not cancelable\");\n require(msg.sender == stream.sender, \"Only sender can cancel\");\n\n uint128 withdrawableAmount = withdrawableAmountOf(streamId);\n uint128 refundAmount = stream.totalAmount - withdrawableAmount;\n\n streams[streamId].wasCanceled = true;\n\n if (withdrawableAmount > 0) {\n IERC20(stream.asset).transfer(stream.recipient, withdrawableAmount);\n }\n if (refundAmount > 0) {\n IERC20(stream.asset).transfer(stream.sender, refundAmount);\n }\n }\n\n function isCancelable(uint256 streamId) external view returns (bool) {\n return streams[streamId].cancelable;\n }\n\n /// @dev Retrieves the stream's status without performing a null check.\n function statusOf(\n uint256 streamId\n ) public view returns (MockLockupLinear.Status) {\n uint256 withdrawableAmount = withdrawableAmountOf(streamId);\n if (withdrawableAmount == 0) {\n return MockLockupLinear.Status.DEPLETED;\n } else if (streams[streamId].wasCanceled) {\n return MockLockupLinear.Status.CANCELED;\n }\n\n if (block.timestamp < streams[streamId].startTime) {\n return MockLockupLinear.Status.PENDING;\n }\n\n if (block.timestamp < streams[streamId].endTime) {\n return MockLockupLinear.Status.STREAMING;\n } else {\n return MockLockupLinear.Status.SETTLED;\n }\n }\n}\n" + }, + "contracts/modules/DecentHatsCreationModule.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.28;\n\nimport {Enum} from \"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\";\nimport {IAvatar} from \"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol\";\nimport {Strings} from \"@openzeppelin/contracts/utils/Strings.sol\";\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {IERC6551Registry} from \"../interfaces/IERC6551Registry.sol\";\nimport {IHats} from \"../interfaces/hats/IHats.sol\";\nimport {LockupLinear, Broker} from \"../interfaces/sablier/types/DataTypes.sol\";\nimport {IHatsModuleFactory} from \"../interfaces/hats/IHatsModuleFactory.sol\";\nimport {IHatsElectionsEligibility} from \"../interfaces/hats/modules/IHatsElectionsEligibility.sol\";\nimport {ModuleProxyFactory} from \"@gnosis.pm/zodiac/contracts/factory/ModuleProxyFactory.sol\";\nimport {ISablierV2LockupLinear} from \"../interfaces/sablier/ISablierV2LockupLinear.sol\";\nimport {DecentHatsModuleUtils} from \"./DecentHatsModuleUtils.sol\";\n\ncontract DecentHatsCreationModule is DecentHatsModuleUtils {\n struct TopHatParams {\n string details;\n string imageURI;\n }\n\n struct AdminHatParams {\n string details;\n string imageURI;\n bool isMutable;\n }\n\n struct CreateTreeParams {\n IHats hatsProtocol;\n IERC6551Registry erc6551Registry;\n IHatsModuleFactory hatsModuleFactory;\n ModuleProxyFactory moduleProxyFactory;\n address keyValuePairs;\n address decentAutonomousAdminImplementation;\n address hatsAccountImplementation;\n address hatsElectionsEligibilityImplementation;\n TopHatParams topHat;\n AdminHatParams adminHat;\n HatParams[] hats;\n }\n\n /* /////////////////////////////////////////////////////////////////////////////\n EXTERNAL FUNCTIONS\n ///////////////////////////////////////////////////////////////////////////// */\n /**\n * @notice For a safe without any roles previously created on it, this function should be called. It sets up the\n * top hat and admin hat, as well as any other hats and their streams that are provided, then transfers the top hat\n * to the calling safe.\n *\n * @notice This contract should be enabled a module on the Safe for which the role(s) are to be created, and disabled after.\n *\n * @dev For each hat that is included, if the hat is:\n * - termed, its stream funds on are targeted directly at the nominated wearer. The wearer should directly call `withdraw-`\n * on the Sablier contract.\n * - untermed, its stream funds are targeted at the hat's smart account. In order to withdraw funds from the stream, the\n * hat's smart account must be the one call to `withdraw-` on the Sablier contract, setting the recipient arg to its wearer.\n *\n * @dev In order for a Safe to seamlessly create roles even if it has never previously created a role and thus has\n * no hat tree, we defer the creation of the hat tree and its setup to this contract. This way, in a single tx block,\n * the resulting topHatId of the newly created hat can be used to create an admin hat and any other hats needed.\n * We also make use of `KeyValuePairs` to associate the topHatId with the Safe.\n *\n * @param treeParams The parameters for creating the Hat Tree with Roles\n */\n function createAndDeclareTree(\n CreateTreeParams calldata treeParams\n ) external {\n // Create Top Hat\n (uint256 topHatId, address topHatAccount) = _processTopHat(\n treeParams.hatsProtocol,\n treeParams.erc6551Registry,\n treeParams.hatsAccountImplementation,\n treeParams.keyValuePairs,\n treeParams.topHat\n );\n\n // Create Admin Hat\n uint256 adminHatId = _processAdminHat(\n treeParams.hatsProtocol,\n treeParams.erc6551Registry,\n treeParams.hatsAccountImplementation,\n topHatId,\n topHatAccount,\n treeParams.moduleProxyFactory,\n treeParams.decentAutonomousAdminImplementation,\n treeParams.adminHat\n );\n\n // Create Role Hats\n _processRoleHats(\n CreateRoleHatsParams({\n hatsProtocol: treeParams.hatsProtocol,\n erc6551Registry: treeParams.erc6551Registry,\n hatsAccountImplementation: treeParams.hatsAccountImplementation,\n topHatId: topHatId,\n topHatAccount: topHatAccount,\n hatsModuleFactory: treeParams.hatsModuleFactory,\n hatsElectionsEligibilityImplementation: treeParams\n .hatsElectionsEligibilityImplementation,\n adminHatId: adminHatId,\n hats: treeParams.hats,\n keyValuePairs: treeParams.keyValuePairs\n })\n );\n }\n\n /* /////////////////////////////////////////////////////////////////////////////\n INTERNAL FUNCTIONS\n ///////////////////////////////////////////////////////////////////////////// */\n\n function _processTopHat(\n IHats hatsProtocol,\n IERC6551Registry erc6551Registry,\n address hatsAccountImplementation,\n address keyValuePairs,\n TopHatParams calldata topHat\n ) internal returns (uint256 topHatId, address topHatAccount) {\n // Call lastTopHatId() and properly decode the response\n (bool success, bytes memory data) = address(hatsProtocol).call(\n abi.encodeWithSignature(\"lastTopHatId()\")\n );\n require(success, \"Failed to get lastTopHatId\");\n topHatId = (abi.decode(data, (uint256)) + 1) << 224;\n\n // Mint Top Hat to the Safe\n IAvatar(msg.sender).execTransactionFromModule(\n address(hatsProtocol),\n 0,\n abi.encodeWithSignature(\n \"mintTopHat(address,string,string)\",\n msg.sender,\n topHat.details,\n topHat.imageURI\n ),\n Enum.Operation.Call\n );\n\n // Create Top Hat's ERC6551 Account\n topHatAccount = erc6551Registry.createAccount(\n hatsAccountImplementation,\n SALT,\n block.chainid,\n address(hatsProtocol),\n topHatId\n );\n\n // Declare Top Hat ID to Safe via KeyValuePairs\n string[] memory keys = new string[](1);\n string[] memory values = new string[](1);\n keys[0] = \"topHatId\";\n values[0] = Strings.toString(topHatId);\n IAvatar(msg.sender).execTransactionFromModule(\n keyValuePairs,\n 0,\n abi.encodeWithSignature(\n \"updateValues(string[],string[])\",\n keys,\n values\n ),\n Enum.Operation.Call\n );\n }\n\n function _processAdminHat(\n IHats hatsProtocol,\n IERC6551Registry erc6551Registry,\n address hatsAccountImplementation,\n uint256 topHatId,\n address topHatAccount,\n ModuleProxyFactory moduleProxyFactory,\n address decentAutonomousAdminImplementation,\n AdminHatParams calldata adminHat\n ) internal returns (uint256 adminHatId) {\n // Create Admin Hat\n adminHatId = hatsProtocol.getNextId(topHatId);\n IAvatar(msg.sender).execTransactionFromModule(\n address(hatsProtocol),\n 0,\n abi.encodeWithSignature(\n \"createHat(uint256,string,uint32,address,address,bool,string)\",\n topHatId,\n adminHat.details,\n 1, // only one Admin Hat\n topHatAccount,\n topHatAccount,\n adminHat.isMutable,\n adminHat.imageURI\n ),\n Enum.Operation.Call\n );\n\n // Create Admin Hat's ERC6551 Account\n erc6551Registry.createAccount(\n hatsAccountImplementation,\n SALT,\n block.chainid,\n address(hatsProtocol),\n adminHatId\n );\n\n // Deploy Decent Autonomous Admin Module, which will wear the Admin Hat\n address autonomousAdmin = moduleProxyFactory.deployModule(\n decentAutonomousAdminImplementation,\n abi.encodeWithSignature(\"setUp(bytes)\", bytes(\"\")),\n uint256(\n keccak256(\n abi.encodePacked(\n // for the salt, we'll concatenate our static salt\n // with the Admin Hat ID\n SALT,\n adminHatId\n )\n )\n )\n );\n\n // Mint Hat to the Decent Autonomous Admin Module\n IAvatar(msg.sender).execTransactionFromModule(\n address(hatsProtocol),\n 0,\n abi.encodeWithSignature(\n \"mintHat(uint256,address)\",\n adminHatId,\n autonomousAdmin\n ),\n Enum.Operation.Call\n );\n }\n}\n" + }, + "contracts/modules/DecentHatsModificationModule.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.28;\n\nimport {DecentHatsModuleUtils} from \"./DecentHatsModuleUtils.sol\";\n\ncontract DecentHatsModificationModule is DecentHatsModuleUtils {\n /**\n * @notice Creates a new termed or untermed role hat and any streams on it.\n *\n * @notice This contract should be enabled a module on the Safe for which the role is to be created, and disabled after.\n *\n * @dev Stream funds on untermed Roles are targeted at the hat's smart account. In order to withdraw funds from the stream, the\n * hat's smart account must be the one call to `withdraw-` on the Sablier contract, setting the recipient arg to its wearer.\n *\n * @dev Stream funds on termed Roles are targeted directly at the nominated wearer.\n * The wearer should directly call `withdraw-` on the Sablier contract.\n *\n * @dev Role hat creation, minting, smart account creation and stream creation are handled here in order\n * to avoid a race condition where not more than one active proposal to create a new role can exist at a time.\n * See: https://github.com/decentdao/decent-interface/issues/2402\n *\n * @param roleHatsParams An array of params for each role hat to be created.\n */\n function createRoleHats(\n CreateRoleHatsParams calldata roleHatsParams\n ) external {\n _processRoleHats(roleHatsParams);\n }\n}\n" + }, + "contracts/modules/DecentHatsModuleUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.28;\n\nimport {Enum} from \"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\";\nimport {IAvatar} from \"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol\";\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {IERC6551Registry} from \"../interfaces/IERC6551Registry.sol\";\nimport {IHats} from \"../interfaces/hats/IHats.sol\";\nimport {LockupLinear, Broker} from \"../interfaces/sablier/types/DataTypes.sol\";\nimport {IHatsModuleFactory} from \"../interfaces/hats/IHatsModuleFactory.sol\";\nimport {ISablierV2LockupLinear} from \"../interfaces/sablier/ISablierV2LockupLinear.sol\";\nimport {Strings} from \"@openzeppelin/contracts/utils/Strings.sol\";\n\nabstract contract DecentHatsModuleUtils {\n bytes32 public constant SALT =\n 0x5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b5072;\n\n struct SablierStreamParams {\n ISablierV2LockupLinear sablier;\n address sender;\n address asset;\n LockupLinear.Timestamps timestamps;\n Broker broker;\n uint128 totalAmount;\n bool cancelable;\n bool transferable;\n }\n\n struct HatParams {\n address wearer;\n string details;\n string imageURI;\n SablierStreamParams[] sablierStreamsParams;\n uint128 termEndDateTs; // If 0, this is an untermed Hat\n uint32 maxSupply;\n bool isMutable;\n }\n\n struct CreateRoleHatsParams {\n IHats hatsProtocol;\n IERC6551Registry erc6551Registry;\n address hatsAccountImplementation;\n uint256 topHatId;\n address topHatAccount;\n address keyValuePairs;\n IHatsModuleFactory hatsModuleFactory;\n address hatsElectionsEligibilityImplementation;\n uint256 adminHatId;\n HatParams[] hats;\n }\n\n function _processRoleHats(\n CreateRoleHatsParams memory roleHatsParams\n ) internal {\n for (uint256 i = 0; i < roleHatsParams.hats.length; ) {\n HatParams memory hatParams = roleHatsParams.hats[i];\n\n // Create eligibility module if needed\n address eligibilityAddress = _createEligibilityModule(\n roleHatsParams.hatsProtocol,\n roleHatsParams.hatsModuleFactory,\n roleHatsParams.hatsElectionsEligibilityImplementation,\n roleHatsParams.topHatId,\n roleHatsParams.topHatAccount,\n roleHatsParams.adminHatId,\n hatParams.termEndDateTs\n );\n\n // Create and Mint the Role Hat\n uint256 hatId = _createAndMintHat(\n roleHatsParams.hatsProtocol,\n roleHatsParams.adminHatId,\n hatParams,\n eligibilityAddress,\n roleHatsParams.topHatAccount\n );\n\n // Get the stream recipient (based on termed or not)\n address streamRecipient = _setupStreamRecipient(\n roleHatsParams.erc6551Registry,\n roleHatsParams.hatsAccountImplementation,\n address(roleHatsParams.hatsProtocol),\n hatParams.termEndDateTs,\n hatParams.wearer,\n hatId\n );\n\n // Create streams\n _processSablierStreams(\n hatParams.sablierStreamsParams,\n streamRecipient,\n roleHatsParams.keyValuePairs,\n hatId\n );\n\n unchecked {\n ++i;\n }\n }\n }\n\n function _createEligibilityModule(\n IHats hatsProtocol,\n IHatsModuleFactory hatsModuleFactory,\n address hatsElectionsEligibilityImplementation,\n uint256 topHatId,\n address topHatAccount,\n uint256 adminHatId,\n uint128 termEndDateTs\n ) private returns (address) {\n // If the Hat is termed, create the eligibility module\n if (termEndDateTs != 0) {\n return\n hatsModuleFactory.createHatsModule(\n hatsElectionsEligibilityImplementation,\n hatsProtocol.getNextId(adminHatId),\n abi.encode(topHatId, uint256(0)), // [BALLOT_BOX_ID, ADMIN_HAT_ID]\n abi.encode(termEndDateTs),\n uint256(SALT)\n );\n }\n\n // Otherwise, return the Top Hat account\n return topHatAccount;\n }\n\n function _createAndMintHat(\n IHats hatsProtocol,\n uint256 adminHatId,\n HatParams memory hat,\n address eligibilityAddress,\n address topHatAccount\n ) private returns (uint256) {\n // Grab the next Hat ID (before creating it)\n uint256 hatId = hatsProtocol.getNextId(adminHatId);\n\n // Create the new Hat\n IAvatar(msg.sender).execTransactionFromModule(\n address(hatsProtocol),\n 0,\n abi.encodeWithSignature(\n \"createHat(uint256,string,uint32,address,address,bool,string)\",\n adminHatId,\n hat.details,\n hat.maxSupply,\n eligibilityAddress,\n topHatAccount,\n hat.isMutable,\n hat.imageURI\n ),\n Enum.Operation.Call\n );\n\n // If the Hat is termed, nominate the wearer as the eligible member\n if (hat.termEndDateTs != 0) {\n address[] memory nominatedWearers = new address[](1);\n nominatedWearers[0] = hat.wearer;\n\n IAvatar(msg.sender).execTransactionFromModule(\n eligibilityAddress,\n 0,\n abi.encodeWithSignature(\n \"elect(uint128,address[])\",\n hat.termEndDateTs,\n nominatedWearers\n ),\n Enum.Operation.Call\n );\n }\n\n // Mint the Hat\n IAvatar(msg.sender).execTransactionFromModule(\n address(hatsProtocol),\n 0,\n abi.encodeWithSignature(\n \"mintHat(uint256,address)\",\n hatId,\n hat.wearer\n ),\n Enum.Operation.Call\n );\n return hatId;\n }\n\n // Exists to avoid stack too deep errors\n function _setupStreamRecipient(\n IERC6551Registry erc6551Registry,\n address hatsAccountImplementation,\n address hatsProtocol,\n uint128 termEndDateTs,\n address wearer,\n uint256 hatId\n ) private returns (address) {\n // If the hat is termed, the wearer is the stream recipient\n if (termEndDateTs != 0) {\n return wearer;\n }\n\n // Otherwise, the Hat's smart account is the stream recipient\n return\n erc6551Registry.createAccount(\n hatsAccountImplementation,\n SALT,\n block.chainid,\n hatsProtocol,\n hatId\n );\n }\n\n function _processSablierStreams(\n SablierStreamParams[] memory streamParams,\n address streamRecipient,\n address keyValuePairs,\n uint256 hatId\n ) private {\n for (uint256 i = 0; i < streamParams.length; ) {\n SablierStreamParams memory sablierStreamParams = streamParams[i];\n\n // Approve tokens for Sablier\n IAvatar(msg.sender).execTransactionFromModule(\n sablierStreamParams.asset,\n 0,\n abi.encodeWithSignature(\n \"approve(address,uint256)\",\n sablierStreamParams.sablier,\n sablierStreamParams.totalAmount\n ),\n Enum.Operation.Call\n );\n uint256 streamId = ISablierV2LockupLinear(\n sablierStreamParams.sablier\n ).nextStreamId();\n\n // Proxy the Sablier call through IAvatar\n IAvatar(msg.sender).execTransactionFromModule(\n address(sablierStreamParams.sablier),\n 0,\n abi.encodeWithSignature(\n \"createWithTimestamps((address,address,uint128,address,bool,bool,(uint40,uint40,uint40),(address,uint256)))\",\n LockupLinear.CreateWithTimestamps({\n sender: sablierStreamParams.sender,\n recipient: streamRecipient,\n totalAmount: sablierStreamParams.totalAmount,\n asset: IERC20(sablierStreamParams.asset),\n cancelable: sablierStreamParams.cancelable,\n transferable: sablierStreamParams.transferable,\n timestamps: sablierStreamParams.timestamps,\n broker: sablierStreamParams.broker\n })\n ),\n Enum.Operation.Call\n );\n\n // Update KeyValuePairs with the stream ID and Hat ID\n string[] memory keys = new string[](1);\n string[] memory values = new string[](1);\n keys[0] = \"hatIdToStreamId\";\n values[0] = string(\n abi.encodePacked(\n Strings.toString(hatId),\n \":\",\n Strings.toString(streamId)\n )\n );\n\n IAvatar(msg.sender).execTransactionFromModule(\n keyValuePairs,\n 0,\n abi.encodeWithSignature(\n \"updateValues(string[],string[])\",\n keys,\n values\n ),\n Enum.Operation.Call\n );\n\n unchecked {\n ++i;\n }\n }\n }\n}\n" + }, + "contracts/modules/DecentSablierStreamManagementModule.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.28;\n\nimport {Enum} from \"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\";\nimport {IAvatar} from \"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol\";\nimport {ISablierV2Lockup} from \"../interfaces/sablier/ISablierV2Lockup.sol\";\nimport {Lockup} from \"../interfaces/sablier/types/DataTypes.sol\";\n\ncontract DecentSablierStreamManagementModule {\n function withdrawMaxFromStream(\n ISablierV2Lockup sablier,\n address recipientHatAccount,\n uint256 streamId,\n address to\n ) public {\n // Check if there are funds to withdraw\n if (sablier.withdrawableAmountOf(streamId) == 0) {\n return;\n }\n\n // Proxy the Sablier withdrawMax call through IAvatar (Safe)\n IAvatar(msg.sender).execTransactionFromModule(\n recipientHatAccount,\n 0,\n abi.encodeWithSignature(\n \"execute(address,uint256,bytes,uint8)\",\n address(sablier),\n 0,\n abi.encodeWithSignature(\n \"withdrawMax(uint256,address)\",\n streamId,\n to\n ),\n 0\n ),\n Enum.Operation.Call\n );\n }\n\n function cancelStream(ISablierV2Lockup sablier, uint256 streamId) public {\n // Check if the stream can be cancelled\n Lockup.Status streamStatus = sablier.statusOf(streamId);\n if (\n streamStatus != Lockup.Status.PENDING &&\n streamStatus != Lockup.Status.STREAMING\n ) {\n return;\n }\n\n IAvatar(msg.sender).execTransactionFromModule(\n address(sablier),\n 0,\n abi.encodeWithSignature(\"cancel(uint256)\", streamId),\n Enum.Operation.Call\n );\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 200 + }, + "evmVersion": "paris", + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/deployments/polygon/DecentHatsCreationModule.json b/deployments/polygon/DecentHatsCreationModule.json index 5620ec3..b83c120 100644 --- a/deployments/polygon/DecentHatsCreationModule.json +++ b/deployments/polygon/DecentHatsCreationModule.json @@ -1,5 +1,5 @@ { - "address": "0xdA92DE0BF973De947d0CcEE739E89bA64697e47F", + "address": "0x75411F04c58C84daBDdEADE7cF6E1c1F40d4B611", "abi": [ { "inputs": [], @@ -222,44 +222,44 @@ "type": "function" } ], - "transactionHash": "0x7a2f517ac0b48f180affd0cb98fc84e92d1848a282006ae4cd7c165b33190149", + "transactionHash": "0x0f2c852519bf785e2d158cca1d50b9c7f4278bced6de9b38ceceac4fb715784a", "receipt": { "to": null, "from": "0xb5Ca125166C1987A35EDD550E16846Fa1e1D9bB3", - "contractAddress": "0xdA92DE0BF973De947d0CcEE739E89bA64697e47F", - "transactionIndex": 28, - "gasUsed": "1751463", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000008000000000000000000000000000000000000000000000000000000000800000000000000000000100000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000040000000000000000200000000000004000000000000000000000000000000000100000000000004000000000000000000001000000000000000000000000000000100004000000000000000000200000000000000000000000000000000000000000000000100000", - "blockHash": "0x1c463646a8e35a228be5284d1d748e992368522495eb58a82bdeab6c15c85126", - "transactionHash": "0x7a2f517ac0b48f180affd0cb98fc84e92d1848a282006ae4cd7c165b33190149", + "contractAddress": "0x75411F04c58C84daBDdEADE7cF6E1c1F40d4B611", + "transactionIndex": 43, + "gasUsed": "1887591", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000008000000000000000000000000000000000000000000000000000000000800000000000000000000100020000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000100000000000004000000000000000000001000000000000000000000000000000100004000000000000000000200000000000000000000000000000000000000000000020100000", + "blockHash": "0xf8feefd89bb7b016852fd0b3c3f37d8df1e56300a8e924af1aedb14913ffbbd7", + "transactionHash": "0x0f2c852519bf785e2d158cca1d50b9c7f4278bced6de9b38ceceac4fb715784a", "logs": [ { - "transactionIndex": 28, - "blockNumber": 63925610, - "transactionHash": "0x7a2f517ac0b48f180affd0cb98fc84e92d1848a282006ae4cd7c165b33190149", + "transactionIndex": 43, + "blockNumber": 64597158, + "transactionHash": "0x0f2c852519bf785e2d158cca1d50b9c7f4278bced6de9b38ceceac4fb715784a", "address": "0x0000000000000000000000000000000000001010", "topics": [ "0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63", "0x0000000000000000000000000000000000000000000000000000000000001010", "0x000000000000000000000000b5ca125166c1987a35edd550e16846fa1e1d9bb3", - "0x000000000000000000000000a8b52f02108aa5f4b675bdcc973760022d7c6020" + "0x000000000000000000000000794e44d1334a56fea7f4df12633b88820d0c5888" ], - "data": "0x00000000000000000000000000000000000000000000000001371f50e19cac0000000000000000000000000000000000000000000000000031c18eb5694a07a80000000000000000000000000000000000000000000000bab116ca96a2738718000000000000000000000000000000000000000000000000308a6f6487ad5ba80000000000000000000000000000000000000000000000bab24de9e784103318", - "logIndex": 200, - "blockHash": "0x1c463646a8e35a228be5284d1d748e992368522495eb58a82bdeab6c15c85126" + "data": "0x000000000000000000000000000000000000000000000000011777e5a287f1aa000000000000000000000000000000000000000000000000270f0c32b08a9184000000000000000000000000000000000000000000000588f8c18dd43267ad1e00000000000000000000000000000000000000000000000025f7944d0e029fda000000000000000000000000000000000000000000000588f9d905b9d4ef9ec8", + "logIndex": 263, + "blockHash": "0xf8feefd89bb7b016852fd0b3c3f37d8df1e56300a8e924af1aedb14913ffbbd7" } ], - "blockNumber": 63925610, - "cumulativeGasUsed": "7992177", + "blockNumber": 64597158, + "cumulativeGasUsed": "7731683", "status": 1, "byzantium": true }, "args": [], - "numDeployments": 1, - "solcInputHash": "e3ec7808efccf5e6b24e16a29ead3983", - "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"SALT\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"contract IHats\",\"name\":\"hatsProtocol\",\"type\":\"address\"},{\"internalType\":\"contract IERC6551Registry\",\"name\":\"erc6551Registry\",\"type\":\"address\"},{\"internalType\":\"contract IHatsModuleFactory\",\"name\":\"hatsModuleFactory\",\"type\":\"address\"},{\"internalType\":\"contract ModuleProxyFactory\",\"name\":\"moduleProxyFactory\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"keyValuePairs\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"decentAutonomousAdminImplementation\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"hatsAccountImplementation\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"hatsElectionsEligibilityImplementation\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"string\",\"name\":\"details\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"imageURI\",\"type\":\"string\"}],\"internalType\":\"struct DecentHatsCreationModule.TopHatParams\",\"name\":\"topHat\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"string\",\"name\":\"details\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"imageURI\",\"type\":\"string\"},{\"internalType\":\"bool\",\"name\":\"isMutable\",\"type\":\"bool\"}],\"internalType\":\"struct DecentHatsCreationModule.AdminHatParams\",\"name\":\"adminHat\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"wearer\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"details\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"imageURI\",\"type\":\"string\"},{\"components\":[{\"internalType\":\"contract ISablierV2LockupLinear\",\"name\":\"sablier\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint40\",\"name\":\"start\",\"type\":\"uint40\"},{\"internalType\":\"uint40\",\"name\":\"cliff\",\"type\":\"uint40\"},{\"internalType\":\"uint40\",\"name\":\"end\",\"type\":\"uint40\"}],\"internalType\":\"struct LockupLinear.Timestamps\",\"name\":\"timestamps\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"UD60x18\",\"name\":\"fee\",\"type\":\"uint256\"}],\"internalType\":\"struct Broker\",\"name\":\"broker\",\"type\":\"tuple\"},{\"internalType\":\"uint128\",\"name\":\"totalAmount\",\"type\":\"uint128\"},{\"internalType\":\"bool\",\"name\":\"cancelable\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"transferable\",\"type\":\"bool\"}],\"internalType\":\"struct DecentHatsModuleUtils.SablierStreamParams[]\",\"name\":\"sablierStreamsParams\",\"type\":\"tuple[]\"},{\"internalType\":\"uint128\",\"name\":\"termEndDateTs\",\"type\":\"uint128\"},{\"internalType\":\"uint32\",\"name\":\"maxSupply\",\"type\":\"uint32\"},{\"internalType\":\"bool\",\"name\":\"isMutable\",\"type\":\"bool\"}],\"internalType\":\"struct DecentHatsModuleUtils.HatParams[]\",\"name\":\"hats\",\"type\":\"tuple[]\"}],\"internalType\":\"struct DecentHatsCreationModule.CreateTreeParams\",\"name\":\"treeParams\",\"type\":\"tuple\"}],\"name\":\"createAndDeclareTree\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"createAndDeclareTree((address,address,address,address,address,address,address,address,(string,string),(string,string,bool),(address,string,string,(address,address,address,(uint40,uint40,uint40),(address,uint256),uint128,bool,bool)[],uint128,uint32,bool)[]))\":{\"details\":\"For each hat that is included, if the hat is: - termed, its stream funds on are targeted directly at the nominated wearer. The wearer should directly call `withdraw-` on the Sablier contract. - untermed, its stream funds are targeted at the hat's smart account. In order to withdraw funds from the stream, the hat's smart account must be the one call to `withdraw-` on the Sablier contract, setting the recipient arg to its wearer.In order for a Safe to seamlessly create roles even if it has never previously created a role and thus has no hat tree, we defer the creation of the hat tree and its setup to this contract. This way, in a single tx block, the resulting topHatId of the newly created hat can be used to create an admin hat and any other hats needed. We also make use of `KeyValuePairs` to associate the topHatId with the Safe.\",\"params\":{\"treeParams\":\"The parameters for creating the Hat Tree with Roles\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"createAndDeclareTree((address,address,address,address,address,address,address,address,(string,string),(string,string,bool),(address,string,string,(address,address,address,(uint40,uint40,uint40),(address,uint256),uint128,bool,bool)[],uint128,uint32,bool)[]))\":{\"notice\":\"For a safe without any roles previously created on it, this function should be called. It sets up the top hat and admin hat, as well as any other hats and their streams that are provided, then transfers the top hat to the calling safe.This contract should be enabled a module on the Safe for which the role(s) are to be created, and disabled after.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/modules/DecentHatsCreationModule.sol\":\"DecentHatsCreationModule\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\npragma solidity >=0.7.0 <0.9.0;\\n\\n/// @title Enum - Collection of enums\\n/// @author Richard Meissner - \\ncontract Enum {\\n enum Operation {Call, DelegateCall}\\n}\\n\",\"keccak256\":\"0x473e45b1a5cc47be494b0e123c9127f0c11c1e0992a321ae5a644c0bfdb2c14f\",\"license\":\"LGPL-3.0-only\"},\"@gnosis.pm/zodiac/contracts/factory/ModuleProxyFactory.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\npragma solidity >=0.8.0;\\n\\ncontract ModuleProxyFactory {\\n event ModuleProxyCreation(\\n address indexed proxy,\\n address indexed masterCopy\\n );\\n\\n /// `target` can not be zero.\\n error ZeroAddress(address target);\\n\\n /// `address_` is already taken.\\n error TakenAddress(address address_);\\n\\n /// @notice Initialization failed.\\n error FailedInitialization();\\n\\n function createProxy(address target, bytes32 salt)\\n internal\\n returns (address result)\\n {\\n if (address(target) == address(0)) revert ZeroAddress(target);\\n bytes memory deployment = abi.encodePacked(\\n hex\\\"602d8060093d393df3363d3d373d3d3d363d73\\\",\\n target,\\n hex\\\"5af43d82803e903d91602b57fd5bf3\\\"\\n );\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n result := create2(0, add(deployment, 0x20), mload(deployment), salt)\\n }\\n if (result == address(0)) revert TakenAddress(result);\\n }\\n\\n function deployModule(\\n address masterCopy,\\n bytes memory initializer,\\n uint256 saltNonce\\n ) public returns (address proxy) {\\n proxy = createProxy(\\n masterCopy,\\n keccak256(abi.encodePacked(keccak256(initializer), saltNonce))\\n );\\n (bool success, ) = proxy.call(initializer);\\n if (!success) revert FailedInitialization();\\n\\n emit ModuleProxyCreation(proxy, masterCopy);\\n }\\n}\\n\",\"keccak256\":\"0x70f6f1d88cf3382748e58f85ba87279f5bb8761863c293dd8c197a71ff558761\",\"license\":\"LGPL-3.0-only\"},\"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\n\\n/// @title Zodiac Avatar - A contract that manages modules that can execute transactions via this contract.\\npragma solidity >=0.7.0 <0.9.0;\\n\\nimport \\\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\\\";\\n\\ninterface IAvatar {\\n event EnabledModule(address module);\\n event DisabledModule(address module);\\n event ExecutionFromModuleSuccess(address indexed module);\\n event ExecutionFromModuleFailure(address indexed module);\\n\\n /// @dev Enables a module on the avatar.\\n /// @notice Can only be called by the avatar.\\n /// @notice Modules should be stored as a linked list.\\n /// @notice Must emit EnabledModule(address module) if successful.\\n /// @param module Module to be enabled.\\n function enableModule(address module) external;\\n\\n /// @dev Disables a module on the avatar.\\n /// @notice Can only be called by the avatar.\\n /// @notice Must emit DisabledModule(address module) if successful.\\n /// @param prevModule Address that pointed to the module to be removed in the linked list\\n /// @param module Module to be removed.\\n function disableModule(address prevModule, address module) external;\\n\\n /// @dev Allows a Module to execute a transaction.\\n /// @notice Can only be called by an enabled module.\\n /// @notice Must emit ExecutionFromModuleSuccess(address module) if successful.\\n /// @notice Must emit ExecutionFromModuleFailure(address module) if unsuccessful.\\n /// @param to Destination address of module transaction.\\n /// @param value Ether value of module transaction.\\n /// @param data Data payload of module transaction.\\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\\n function execTransactionFromModule(\\n address to,\\n uint256 value,\\n bytes memory data,\\n Enum.Operation operation\\n ) external returns (bool success);\\n\\n /// @dev Allows a Module to execute a transaction and return data\\n /// @notice Can only be called by an enabled module.\\n /// @notice Must emit ExecutionFromModuleSuccess(address module) if successful.\\n /// @notice Must emit ExecutionFromModuleFailure(address module) if unsuccessful.\\n /// @param to Destination address of module transaction.\\n /// @param value Ether value of module transaction.\\n /// @param data Data payload of module transaction.\\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\\n function execTransactionFromModuleReturnData(\\n address to,\\n uint256 value,\\n bytes memory data,\\n Enum.Operation operation\\n ) external returns (bool success, bytes memory returnData);\\n\\n /// @dev Returns if an module is enabled\\n /// @return True if the module is enabled\\n function isModuleEnabled(address module) external view returns (bool);\\n\\n /// @dev Returns array of modules.\\n /// @param start Start of the page.\\n /// @param pageSize Maximum number of modules that should be returned.\\n /// @return array Array of modules.\\n /// @return next Start of the next page.\\n function getModulesPaginated(address start, uint256 pageSize)\\n external\\n view\\n returns (address[] memory array, address next);\\n}\\n\",\"keccak256\":\"0xcd5508ffe596eef8fbccfd5fc4f10a34397773547ce64e212d48b5212865ec1f\",\"license\":\"LGPL-3.0-only\"},\"@openzeppelin/contracts/interfaces/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/introspection/IERC165.sol\\\";\\n\",\"keccak256\":\"0xd04b0f06e0666f29cf7cccc82894de541e19bb30a765b107b1e40bb7fe5f7d7a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev 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 amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `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 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes calldata data\\n ) external;\\n\\n /**\\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 {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the caller.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool _approved) external;\\n\\n /**\\n * @dev Returns 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\",\"keccak256\":\"0xed6a749c5373af398105ce6ee3ac4763aa450ea7285d268c85d9eeca809cdb1f\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../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\",\"keccak256\":\"0x75b829ff2f26c14355d1cba20e16fe7b29ca58eb5fef665ede48bc0f9c6c74b9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _HEX_SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\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 // Inspired by OraclizeAPI's implementation - MIT licence\\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\\n\\n if (value == 0) {\\n return \\\"0\\\";\\n }\\n uint256 temp = value;\\n uint256 digits;\\n while (temp != 0) {\\n digits++;\\n temp /= 10;\\n }\\n bytes memory buffer = new bytes(digits);\\n while (value != 0) {\\n digits -= 1;\\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\\n value /= 10;\\n }\\n return string(buffer);\\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 if (value == 0) {\\n return \\\"0x00\\\";\\n }\\n uint256 temp = value;\\n uint256 length = 0;\\n while (temp != 0) {\\n length++;\\n temp >>= 8;\\n }\\n return toHexString(value, length);\\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 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_SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\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 representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n}\\n\",\"keccak256\":\"0xaf159a8b1923ad2a26d516089bceca9bdeaeacd04be50983ea00ba63070f08a3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"@prb/math/src/Common.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\n// Common.sol\\n//\\n// Common mathematical functions used in both SD59x18 and UD60x18. Note that these global functions do not\\n// always operate with SD59x18 and UD60x18 numbers.\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CUSTOM ERRORS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @notice Thrown when the resultant value in {mulDiv} overflows uint256.\\nerror PRBMath_MulDiv_Overflow(uint256 x, uint256 y, uint256 denominator);\\n\\n/// @notice Thrown when the resultant value in {mulDiv18} overflows uint256.\\nerror PRBMath_MulDiv18_Overflow(uint256 x, uint256 y);\\n\\n/// @notice Thrown when one of the inputs passed to {mulDivSigned} is `type(int256).min`.\\nerror PRBMath_MulDivSigned_InputTooSmall();\\n\\n/// @notice Thrown when the resultant value in {mulDivSigned} overflows int256.\\nerror PRBMath_MulDivSigned_Overflow(int256 x, int256 y);\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CONSTANTS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @dev The maximum value a uint128 number can have.\\nuint128 constant MAX_UINT128 = type(uint128).max;\\n\\n/// @dev The maximum value a uint40 number can have.\\nuint40 constant MAX_UINT40 = type(uint40).max;\\n\\n/// @dev The unit number, which the decimal precision of the fixed-point types.\\nuint256 constant UNIT = 1e18;\\n\\n/// @dev The unit number inverted mod 2^256.\\nuint256 constant UNIT_INVERSE = 78156646155174841979727994598816262306175212592076161876661_508869554232690281;\\n\\n/// @dev The the largest power of two that divides the decimal value of `UNIT`. The logarithm of this value is the least significant\\n/// bit in the binary representation of `UNIT`.\\nuint256 constant UNIT_LPOTD = 262144;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @notice Calculates the binary exponent of x using the binary fraction method.\\n/// @dev Has to use 192.64-bit fixed-point numbers. See https://ethereum.stackexchange.com/a/96594/24693.\\n/// @param x The exponent as an unsigned 192.64-bit fixed-point number.\\n/// @return result The result as an unsigned 60.18-decimal fixed-point number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp2(uint256 x) pure returns (uint256 result) {\\n unchecked {\\n // Start from 0.5 in the 192.64-bit fixed-point format.\\n result = 0x800000000000000000000000000000000000000000000000;\\n\\n // The following logic multiplies the result by $\\\\sqrt{2^{-i}}$ when the bit at position i is 1. Key points:\\n //\\n // 1. Intermediate results will not overflow, as the starting point is 2^191 and all magic factors are under 2^65.\\n // 2. The rationale for organizing the if statements into groups of 8 is gas savings. If the result of performing\\n // a bitwise AND operation between x and any value in the array [0x80; 0x40; 0x20; 0x10; 0x08; 0x04; 0x02; 0x01] is 1,\\n // we know that `x & 0xFF` is also 1.\\n if (x & 0xFF00000000000000 > 0) {\\n if (x & 0x8000000000000000 > 0) {\\n result = (result * 0x16A09E667F3BCC909) >> 64;\\n }\\n if (x & 0x4000000000000000 > 0) {\\n result = (result * 0x1306FE0A31B7152DF) >> 64;\\n }\\n if (x & 0x2000000000000000 > 0) {\\n result = (result * 0x1172B83C7D517ADCE) >> 64;\\n }\\n if (x & 0x1000000000000000 > 0) {\\n result = (result * 0x10B5586CF9890F62A) >> 64;\\n }\\n if (x & 0x800000000000000 > 0) {\\n result = (result * 0x1059B0D31585743AE) >> 64;\\n }\\n if (x & 0x400000000000000 > 0) {\\n result = (result * 0x102C9A3E778060EE7) >> 64;\\n }\\n if (x & 0x200000000000000 > 0) {\\n result = (result * 0x10163DA9FB33356D8) >> 64;\\n }\\n if (x & 0x100000000000000 > 0) {\\n result = (result * 0x100B1AFA5ABCBED61) >> 64;\\n }\\n }\\n\\n if (x & 0xFF000000000000 > 0) {\\n if (x & 0x80000000000000 > 0) {\\n result = (result * 0x10058C86DA1C09EA2) >> 64;\\n }\\n if (x & 0x40000000000000 > 0) {\\n result = (result * 0x1002C605E2E8CEC50) >> 64;\\n }\\n if (x & 0x20000000000000 > 0) {\\n result = (result * 0x100162F3904051FA1) >> 64;\\n }\\n if (x & 0x10000000000000 > 0) {\\n result = (result * 0x1000B175EFFDC76BA) >> 64;\\n }\\n if (x & 0x8000000000000 > 0) {\\n result = (result * 0x100058BA01FB9F96D) >> 64;\\n }\\n if (x & 0x4000000000000 > 0) {\\n result = (result * 0x10002C5CC37DA9492) >> 64;\\n }\\n if (x & 0x2000000000000 > 0) {\\n result = (result * 0x1000162E525EE0547) >> 64;\\n }\\n if (x & 0x1000000000000 > 0) {\\n result = (result * 0x10000B17255775C04) >> 64;\\n }\\n }\\n\\n if (x & 0xFF0000000000 > 0) {\\n if (x & 0x800000000000 > 0) {\\n result = (result * 0x1000058B91B5BC9AE) >> 64;\\n }\\n if (x & 0x400000000000 > 0) {\\n result = (result * 0x100002C5C89D5EC6D) >> 64;\\n }\\n if (x & 0x200000000000 > 0) {\\n result = (result * 0x10000162E43F4F831) >> 64;\\n }\\n if (x & 0x100000000000 > 0) {\\n result = (result * 0x100000B1721BCFC9A) >> 64;\\n }\\n if (x & 0x80000000000 > 0) {\\n result = (result * 0x10000058B90CF1E6E) >> 64;\\n }\\n if (x & 0x40000000000 > 0) {\\n result = (result * 0x1000002C5C863B73F) >> 64;\\n }\\n if (x & 0x20000000000 > 0) {\\n result = (result * 0x100000162E430E5A2) >> 64;\\n }\\n if (x & 0x10000000000 > 0) {\\n result = (result * 0x1000000B172183551) >> 64;\\n }\\n }\\n\\n if (x & 0xFF00000000 > 0) {\\n if (x & 0x8000000000 > 0) {\\n result = (result * 0x100000058B90C0B49) >> 64;\\n }\\n if (x & 0x4000000000 > 0) {\\n result = (result * 0x10000002C5C8601CC) >> 64;\\n }\\n if (x & 0x2000000000 > 0) {\\n result = (result * 0x1000000162E42FFF0) >> 64;\\n }\\n if (x & 0x1000000000 > 0) {\\n result = (result * 0x10000000B17217FBB) >> 64;\\n }\\n if (x & 0x800000000 > 0) {\\n result = (result * 0x1000000058B90BFCE) >> 64;\\n }\\n if (x & 0x400000000 > 0) {\\n result = (result * 0x100000002C5C85FE3) >> 64;\\n }\\n if (x & 0x200000000 > 0) {\\n result = (result * 0x10000000162E42FF1) >> 64;\\n }\\n if (x & 0x100000000 > 0) {\\n result = (result * 0x100000000B17217F8) >> 64;\\n }\\n }\\n\\n if (x & 0xFF000000 > 0) {\\n if (x & 0x80000000 > 0) {\\n result = (result * 0x10000000058B90BFC) >> 64;\\n }\\n if (x & 0x40000000 > 0) {\\n result = (result * 0x1000000002C5C85FE) >> 64;\\n }\\n if (x & 0x20000000 > 0) {\\n result = (result * 0x100000000162E42FF) >> 64;\\n }\\n if (x & 0x10000000 > 0) {\\n result = (result * 0x1000000000B17217F) >> 64;\\n }\\n if (x & 0x8000000 > 0) {\\n result = (result * 0x100000000058B90C0) >> 64;\\n }\\n if (x & 0x4000000 > 0) {\\n result = (result * 0x10000000002C5C860) >> 64;\\n }\\n if (x & 0x2000000 > 0) {\\n result = (result * 0x1000000000162E430) >> 64;\\n }\\n if (x & 0x1000000 > 0) {\\n result = (result * 0x10000000000B17218) >> 64;\\n }\\n }\\n\\n if (x & 0xFF0000 > 0) {\\n if (x & 0x800000 > 0) {\\n result = (result * 0x1000000000058B90C) >> 64;\\n }\\n if (x & 0x400000 > 0) {\\n result = (result * 0x100000000002C5C86) >> 64;\\n }\\n if (x & 0x200000 > 0) {\\n result = (result * 0x10000000000162E43) >> 64;\\n }\\n if (x & 0x100000 > 0) {\\n result = (result * 0x100000000000B1721) >> 64;\\n }\\n if (x & 0x80000 > 0) {\\n result = (result * 0x10000000000058B91) >> 64;\\n }\\n if (x & 0x40000 > 0) {\\n result = (result * 0x1000000000002C5C8) >> 64;\\n }\\n if (x & 0x20000 > 0) {\\n result = (result * 0x100000000000162E4) >> 64;\\n }\\n if (x & 0x10000 > 0) {\\n result = (result * 0x1000000000000B172) >> 64;\\n }\\n }\\n\\n if (x & 0xFF00 > 0) {\\n if (x & 0x8000 > 0) {\\n result = (result * 0x100000000000058B9) >> 64;\\n }\\n if (x & 0x4000 > 0) {\\n result = (result * 0x10000000000002C5D) >> 64;\\n }\\n if (x & 0x2000 > 0) {\\n result = (result * 0x1000000000000162E) >> 64;\\n }\\n if (x & 0x1000 > 0) {\\n result = (result * 0x10000000000000B17) >> 64;\\n }\\n if (x & 0x800 > 0) {\\n result = (result * 0x1000000000000058C) >> 64;\\n }\\n if (x & 0x400 > 0) {\\n result = (result * 0x100000000000002C6) >> 64;\\n }\\n if (x & 0x200 > 0) {\\n result = (result * 0x10000000000000163) >> 64;\\n }\\n if (x & 0x100 > 0) {\\n result = (result * 0x100000000000000B1) >> 64;\\n }\\n }\\n\\n if (x & 0xFF > 0) {\\n if (x & 0x80 > 0) {\\n result = (result * 0x10000000000000059) >> 64;\\n }\\n if (x & 0x40 > 0) {\\n result = (result * 0x1000000000000002C) >> 64;\\n }\\n if (x & 0x20 > 0) {\\n result = (result * 0x10000000000000016) >> 64;\\n }\\n if (x & 0x10 > 0) {\\n result = (result * 0x1000000000000000B) >> 64;\\n }\\n if (x & 0x8 > 0) {\\n result = (result * 0x10000000000000006) >> 64;\\n }\\n if (x & 0x4 > 0) {\\n result = (result * 0x10000000000000003) >> 64;\\n }\\n if (x & 0x2 > 0) {\\n result = (result * 0x10000000000000001) >> 64;\\n }\\n if (x & 0x1 > 0) {\\n result = (result * 0x10000000000000001) >> 64;\\n }\\n }\\n\\n // In the code snippet below, two operations are executed simultaneously:\\n //\\n // 1. The result is multiplied by $(2^n + 1)$, where $2^n$ represents the integer part, and the additional 1\\n // accounts for the initial guess of 0.5. This is achieved by subtracting from 191 instead of 192.\\n // 2. The result is then converted to an unsigned 60.18-decimal fixed-point format.\\n //\\n // The underlying logic is based on the relationship $2^{191-ip} = 2^{ip} / 2^{191}$, where $ip$ denotes the,\\n // integer part, $2^n$.\\n result *= UNIT;\\n result >>= (191 - (x >> 64));\\n }\\n}\\n\\n/// @notice Finds the zero-based index of the first 1 in the binary representation of x.\\n///\\n/// @dev See the note on \\\"msb\\\" in this Wikipedia article: https://en.wikipedia.org/wiki/Find_first_set\\n///\\n/// Each step in this implementation is equivalent to this high-level code:\\n///\\n/// ```solidity\\n/// if (x >= 2 ** 128) {\\n/// x >>= 128;\\n/// result += 128;\\n/// }\\n/// ```\\n///\\n/// Where 128 is replaced with each respective power of two factor. See the full high-level implementation here:\\n/// https://gist.github.com/PaulRBerg/f932f8693f2733e30c4d479e8e980948\\n///\\n/// The Yul instructions used below are:\\n///\\n/// - \\\"gt\\\" is \\\"greater than\\\"\\n/// - \\\"or\\\" is the OR bitwise operator\\n/// - \\\"shl\\\" is \\\"shift left\\\"\\n/// - \\\"shr\\\" is \\\"shift right\\\"\\n///\\n/// @param x The uint256 number for which to find the index of the most significant bit.\\n/// @return result The index of the most significant bit as a uint256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction msb(uint256 x) pure returns (uint256 result) {\\n // 2^128\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(7, gt(x, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^64\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(6, gt(x, 0xFFFFFFFFFFFFFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^32\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(5, gt(x, 0xFFFFFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^16\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(4, gt(x, 0xFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^8\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(3, gt(x, 0xFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^4\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(2, gt(x, 0xF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^2\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(1, gt(x, 0x3))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^1\\n // No need to shift x any more.\\n assembly (\\\"memory-safe\\\") {\\n let factor := gt(x, 0x1)\\n result := or(result, factor)\\n }\\n}\\n\\n/// @notice Calculates x*y\\u00f7denominator with 512-bit precision.\\n///\\n/// @dev Credits to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv.\\n///\\n/// Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - The denominator must not be zero.\\n/// - The result must fit in uint256.\\n///\\n/// @param x The multiplicand as a uint256.\\n/// @param y The multiplier as a uint256.\\n/// @param denominator The divisor as a uint256.\\n/// @return result The result as a uint256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mulDiv(uint256 x, uint256 y, uint256 denominator) pure returns (uint256 result) {\\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; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly (\\\"memory-safe\\\") {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\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 unchecked {\\n return prod0 / denominator;\\n }\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n if (prod1 >= denominator) {\\n revert PRBMath_MulDiv_Overflow(x, y, denominator);\\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 (\\\"memory-safe\\\") {\\n // Compute remainder using the mulmod Yul instruction.\\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 unchecked {\\n // Calculate the largest power of two divisor of the denominator using the unary operator ~. This operation cannot overflow\\n // because the denominator cannot be zero at this point in the function execution. The result is always >= 1.\\n // For more detail, see https://cs.stackexchange.com/q/138556/92363.\\n uint256 lpotdod = denominator & (~denominator + 1);\\n uint256 flippedLpotdod;\\n\\n assembly (\\\"memory-safe\\\") {\\n // Factor powers of two out of denominator.\\n denominator := div(denominator, lpotdod)\\n\\n // Divide [prod1 prod0] by lpotdod.\\n prod0 := div(prod0, lpotdod)\\n\\n // Get the flipped value `2^256 / lpotdod`. If the `lpotdod` is zero, the flipped value is one.\\n // `sub(0, lpotdod)` produces the two's complement version of `lpotdod`, which is equivalent to flipping all the bits.\\n // However, `div` interprets this value as an unsigned value: https://ethereum.stackexchange.com/q/147168/24693\\n flippedLpotdod := add(div(sub(0, lpotdod), lpotdod), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * flippedLpotdod;\\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 works\\n // 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 }\\n}\\n\\n/// @notice Calculates x*y\\u00f71e18 with 512-bit precision.\\n///\\n/// @dev A variant of {mulDiv} with constant folding, i.e. in which the denominator is hard coded to 1e18.\\n///\\n/// Notes:\\n/// - The body is purposely left uncommented; to understand how this works, see the documentation in {mulDiv}.\\n/// - The result is rounded toward zero.\\n/// - We take as an axiom that the result cannot be `MAX_UINT256` when x and y solve the following system of equations:\\n///\\n/// $$\\n/// \\\\begin{cases}\\n/// x * y = MAX\\\\_UINT256 * UNIT \\\\\\\\\\n/// (x * y) \\\\% UNIT \\\\geq \\\\frac{UNIT}{2}\\n/// \\\\end{cases}\\n/// $$\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {mulDiv}.\\n/// - The result must fit in uint256.\\n///\\n/// @param x The multiplicand as an unsigned 60.18-decimal fixed-point number.\\n/// @param y The multiplier as an unsigned 60.18-decimal fixed-point number.\\n/// @return result The result as an unsigned 60.18-decimal fixed-point number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mulDiv18(uint256 x, uint256 y) pure returns (uint256 result) {\\n uint256 prod0;\\n uint256 prod1;\\n assembly (\\\"memory-safe\\\") {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n if (prod1 == 0) {\\n unchecked {\\n return prod0 / UNIT;\\n }\\n }\\n\\n if (prod1 >= UNIT) {\\n revert PRBMath_MulDiv18_Overflow(x, y);\\n }\\n\\n uint256 remainder;\\n assembly (\\\"memory-safe\\\") {\\n remainder := mulmod(x, y, UNIT)\\n result :=\\n mul(\\n or(\\n div(sub(prod0, remainder), UNIT_LPOTD),\\n mul(sub(prod1, gt(remainder, prod0)), add(div(sub(0, UNIT_LPOTD), UNIT_LPOTD), 1))\\n ),\\n UNIT_INVERSE\\n )\\n }\\n}\\n\\n/// @notice Calculates x*y\\u00f7denominator with 512-bit precision.\\n///\\n/// @dev This is an extension of {mulDiv} for signed numbers, which works by computing the signs and the absolute values separately.\\n///\\n/// Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {mulDiv}.\\n/// - None of the inputs can be `type(int256).min`.\\n/// - The result must fit in int256.\\n///\\n/// @param x The multiplicand as an int256.\\n/// @param y The multiplier as an int256.\\n/// @param denominator The divisor as an int256.\\n/// @return result The result as an int256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mulDivSigned(int256 x, int256 y, int256 denominator) pure returns (int256 result) {\\n if (x == type(int256).min || y == type(int256).min || denominator == type(int256).min) {\\n revert PRBMath_MulDivSigned_InputTooSmall();\\n }\\n\\n // Get hold of the absolute values of x, y and the denominator.\\n uint256 xAbs;\\n uint256 yAbs;\\n uint256 dAbs;\\n unchecked {\\n xAbs = x < 0 ? uint256(-x) : uint256(x);\\n yAbs = y < 0 ? uint256(-y) : uint256(y);\\n dAbs = denominator < 0 ? uint256(-denominator) : uint256(denominator);\\n }\\n\\n // Compute the absolute value of x*y\\u00f7denominator. The result must fit in int256.\\n uint256 resultAbs = mulDiv(xAbs, yAbs, dAbs);\\n if (resultAbs > uint256(type(int256).max)) {\\n revert PRBMath_MulDivSigned_Overflow(x, y);\\n }\\n\\n // Get the signs of x, y and the denominator.\\n uint256 sx;\\n uint256 sy;\\n uint256 sd;\\n assembly (\\\"memory-safe\\\") {\\n // \\\"sgt\\\" is the \\\"signed greater than\\\" assembly instruction and \\\"sub(0,1)\\\" is -1 in two's complement.\\n sx := sgt(x, sub(0, 1))\\n sy := sgt(y, sub(0, 1))\\n sd := sgt(denominator, sub(0, 1))\\n }\\n\\n // XOR over sx, sy and sd. What this does is to check whether there are 1 or 3 negative signs in the inputs.\\n // If there are, the result should be negative. Otherwise, it should be positive.\\n unchecked {\\n result = sx ^ sy ^ sd == 0 ? -int256(resultAbs) : int256(resultAbs);\\n }\\n}\\n\\n/// @notice Calculates the square root of x using the Babylonian method.\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\\n///\\n/// Notes:\\n/// - If x is not a perfect square, the result is rounded down.\\n/// - Credits to OpenZeppelin for the explanations in comments below.\\n///\\n/// @param x The uint256 number for which to calculate the square root.\\n/// @return result The result as a uint256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction sqrt(uint256 x) pure returns (uint256 result) {\\n if (x == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we calculate the biggest power of 2 which is smaller than the square root of x.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of x is a power of 2 such that we have:\\n //\\n // $$\\n // msb(x) <= x <= 2*msb(x)$\\n // $$\\n //\\n // We write $msb(x)$ as $2^k$, and we get:\\n //\\n // $$\\n // k = log_2(x)\\n // $$\\n //\\n // Thus, we can write the initial inequality as:\\n //\\n // $$\\n // 2^{log_2(x)} <= x <= 2*2^{log_2(x)+1} \\\\\\\\\\n // sqrt(2^k) <= sqrt(x) < sqrt(2^{k+1}) \\\\\\\\\\n // 2^{k/2} <= sqrt(x) < 2^{(k+1)/2} <= 2^{(k/2)+1}\\n // $$\\n //\\n // Consequently, $2^{log_2(x) /2} is a good first approximation of sqrt(x) with at least one correct bit.\\n uint256 xAux = uint256(x);\\n result = 1;\\n if (xAux >= 2 ** 128) {\\n xAux >>= 128;\\n result <<= 64;\\n }\\n if (xAux >= 2 ** 64) {\\n xAux >>= 64;\\n result <<= 32;\\n }\\n if (xAux >= 2 ** 32) {\\n xAux >>= 32;\\n result <<= 16;\\n }\\n if (xAux >= 2 ** 16) {\\n xAux >>= 16;\\n result <<= 8;\\n }\\n if (xAux >= 2 ** 8) {\\n xAux >>= 8;\\n result <<= 4;\\n }\\n if (xAux >= 2 ** 4) {\\n xAux >>= 4;\\n result <<= 2;\\n }\\n if (xAux >= 2 ** 2) {\\n result <<= 1;\\n }\\n\\n // At this point, `result` is an estimation with at least one bit of precision. We know the true value has at\\n // most 128 bits, since it is the square root of a uint256. Newton's method converges quadratically (precision\\n // doubles at every iteration). We thus need at most 7 iteration to turn our partial result with one bit of\\n // precision into the expected uint128 result.\\n unchecked {\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n\\n // If x is not a perfect square, round the result toward zero.\\n uint256 roundedResult = x / result;\\n if (result >= roundedResult) {\\n result = roundedResult;\\n }\\n }\\n}\\n\",\"keccak256\":\"0xaa374e2c26cc93e8c22a6953804ee05f811597ef5fa82f76824378b22944778b\",\"license\":\"MIT\"},\"@prb/math/src/UD2x18.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\n/*\\n\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2550\\u2550\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2554\\u2588\\u2588\\u2588\\u2588\\u2554\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551 \\u255a\\u2550\\u255d \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\n\\n\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2550\\u2550\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d \\u255a\\u2588\\u2588\\u2588\\u2554\\u255d \\u255a\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u255d\\n\\n*/\\n\\nimport \\\"./ud2x18/Casting.sol\\\";\\nimport \\\"./ud2x18/Constants.sol\\\";\\nimport \\\"./ud2x18/Errors.sol\\\";\\nimport \\\"./ud2x18/ValueType.sol\\\";\\n\",\"keccak256\":\"0xfb624e24cd8bb790fa08e7827819de85504a86e20e961fa4ad126c65b6d90641\",\"license\":\"MIT\"},\"@prb/math/src/UD60x18.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\n/*\\n\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2550\\u2550\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2554\\u2588\\u2588\\u2588\\u2588\\u2554\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551 \\u255a\\u2550\\u255d \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\n\\n\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2550\\u2588\\u2588\\u2588\\u2588\\u2557\\u255a\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2588\\u2588\\u2551 \\u255a\\u2588\\u2588\\u2588\\u2554\\u255d \\u255a\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2554\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2554\\u255d \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u255d\\n\\n*/\\n\\nimport \\\"./ud60x18/Casting.sol\\\";\\nimport \\\"./ud60x18/Constants.sol\\\";\\nimport \\\"./ud60x18/Conversions.sol\\\";\\nimport \\\"./ud60x18/Errors.sol\\\";\\nimport \\\"./ud60x18/Helpers.sol\\\";\\nimport \\\"./ud60x18/Math.sol\\\";\\nimport \\\"./ud60x18/ValueType.sol\\\";\\n\",\"keccak256\":\"0xb98c6f74275914d279e8af6c502c2b1f50d5f6e1ed418d3b0153f5a193206c48\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as CastingErrors;\\nimport { SD59x18 } from \\\"../sd59x18/ValueType.sol\\\";\\nimport { UD2x18 } from \\\"../ud2x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"../ud60x18/ValueType.sol\\\";\\nimport { SD1x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts an SD1x18 number into SD59x18.\\n/// @dev There is no overflow check because the domain of SD1x18 is a subset of SD59x18.\\nfunction intoSD59x18(SD1x18 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(int256(SD1x18.unwrap(x)));\\n}\\n\\n/// @notice Casts an SD1x18 number into UD2x18.\\n/// - x must be positive.\\nfunction intoUD2x18(SD1x18 x) pure returns (UD2x18 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUD2x18_Underflow(x);\\n }\\n result = UD2x18.wrap(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into UD60x18.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUD60x18(SD1x18 x) pure returns (UD60x18 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUD60x18_Underflow(x);\\n }\\n result = UD60x18.wrap(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into uint256.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUint256(SD1x18 x) pure returns (uint256 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint256_Underflow(x);\\n }\\n result = uint256(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into uint128.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUint128(SD1x18 x) pure returns (uint128 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint128_Underflow(x);\\n }\\n result = uint128(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(SD1x18 x) pure returns (uint40 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint40_Underflow(x);\\n }\\n if (xInt > int64(uint64(Common.MAX_UINT40))) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint40_Overflow(x);\\n }\\n result = uint40(uint64(xInt));\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction sd1x18(int64 x) pure returns (SD1x18 result) {\\n result = SD1x18.wrap(x);\\n}\\n\\n/// @notice Unwraps an SD1x18 number into int64.\\nfunction unwrap(SD1x18 x) pure returns (int64 result) {\\n result = SD1x18.unwrap(x);\\n}\\n\\n/// @notice Wraps an int64 number into SD1x18.\\nfunction wrap(int64 x) pure returns (SD1x18 result) {\\n result = SD1x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x9e49e2b37c1bb845861740805edaaef3fe951a7b96eef16ce84fbf76e8278670\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD1x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @dev Euler's number as an SD1x18 number.\\nSD1x18 constant E = SD1x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum value an SD1x18 number can have.\\nint64 constant uMAX_SD1x18 = 9_223372036854775807;\\nSD1x18 constant MAX_SD1x18 = SD1x18.wrap(uMAX_SD1x18);\\n\\n/// @dev The maximum value an SD1x18 number can have.\\nint64 constant uMIN_SD1x18 = -9_223372036854775808;\\nSD1x18 constant MIN_SD1x18 = SD1x18.wrap(uMIN_SD1x18);\\n\\n/// @dev PI as an SD1x18 number.\\nSD1x18 constant PI = SD1x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of SD1x18.\\nSD1x18 constant UNIT = SD1x18.wrap(1e18);\\nint64 constant uUNIT = 1e18;\\n\",\"keccak256\":\"0x6496165b80552785a4b65a239b96e2a5fedf62fe54f002eeed72d75e566d7585\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD1x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in UD2x18.\\nerror PRBMath_SD1x18_ToUD2x18_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in UD60x18.\\nerror PRBMath_SD1x18_ToUD60x18_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint128.\\nerror PRBMath_SD1x18_ToUint128_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint256.\\nerror PRBMath_SD1x18_ToUint256_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint40.\\nerror PRBMath_SD1x18_ToUint40_Overflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint40.\\nerror PRBMath_SD1x18_ToUint40_Underflow(SD1x18 x);\\n\",\"keccak256\":\"0x836cb42ba619ca369fd4765bc47fefc3c3621369c5861882af14660aca5057ee\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\n\\n/// @notice The signed 1.18-decimal fixed-point number representation, which can have up to 1 digit and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\\n/// type int64. This is useful when end users want to use int64 to save gas, e.g. with tight variable packing in contract\\n/// storage.\\ntype SD1x18 is int64;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoSD59x18,\\n Casting.intoUD2x18,\\n Casting.intoUD60x18,\\n Casting.intoUint256,\\n Casting.intoUint128,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for SD1x18 global;\\n\",\"keccak256\":\"0x2f86f1aa9fca42f40808b51a879b406ac51817647bdb9642f8a79dd8fdb754a7\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Errors.sol\\\" as CastingErrors;\\nimport { MAX_UINT128, MAX_UINT40 } from \\\"../Common.sol\\\";\\nimport { uMAX_SD1x18, uMIN_SD1x18 } from \\\"../sd1x18/Constants.sol\\\";\\nimport { SD1x18 } from \\\"../sd1x18/ValueType.sol\\\";\\nimport { uMAX_UD2x18 } from \\\"../ud2x18/Constants.sol\\\";\\nimport { UD2x18 } from \\\"../ud2x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"../ud60x18/ValueType.sol\\\";\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts an SD59x18 number into int256.\\n/// @dev This is basically a functional alias for {unwrap}.\\nfunction intoInt256(SD59x18 x) pure returns (int256 result) {\\n result = SD59x18.unwrap(x);\\n}\\n\\n/// @notice Casts an SD59x18 number into SD1x18.\\n/// @dev Requirements:\\n/// - x must be greater than or equal to `uMIN_SD1x18`.\\n/// - x must be less than or equal to `uMAX_SD1x18`.\\nfunction intoSD1x18(SD59x18 x) pure returns (SD1x18 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < uMIN_SD1x18) {\\n revert CastingErrors.PRBMath_SD59x18_IntoSD1x18_Underflow(x);\\n }\\n if (xInt > uMAX_SD1x18) {\\n revert CastingErrors.PRBMath_SD59x18_IntoSD1x18_Overflow(x);\\n }\\n result = SD1x18.wrap(int64(xInt));\\n}\\n\\n/// @notice Casts an SD59x18 number into UD2x18.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `uMAX_UD2x18`.\\nfunction intoUD2x18(SD59x18 x) pure returns (UD2x18 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUD2x18_Underflow(x);\\n }\\n if (xInt > int256(uint256(uMAX_UD2x18))) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUD2x18_Overflow(x);\\n }\\n result = UD2x18.wrap(uint64(uint256(xInt)));\\n}\\n\\n/// @notice Casts an SD59x18 number into UD60x18.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUD60x18(SD59x18 x) pure returns (UD60x18 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUD60x18_Underflow(x);\\n }\\n result = UD60x18.wrap(uint256(xInt));\\n}\\n\\n/// @notice Casts an SD59x18 number into uint256.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUint256(SD59x18 x) pure returns (uint256 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint256_Underflow(x);\\n }\\n result = uint256(xInt);\\n}\\n\\n/// @notice Casts an SD59x18 number into uint128.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `uMAX_UINT128`.\\nfunction intoUint128(SD59x18 x) pure returns (uint128 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint128_Underflow(x);\\n }\\n if (xInt > int256(uint256(MAX_UINT128))) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint128_Overflow(x);\\n }\\n result = uint128(uint256(xInt));\\n}\\n\\n/// @notice Casts an SD59x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(SD59x18 x) pure returns (uint40 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint40_Underflow(x);\\n }\\n if (xInt > int256(uint256(MAX_UINT40))) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint40_Overflow(x);\\n }\\n result = uint40(uint256(xInt));\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction sd(int256 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(x);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction sd59x18(int256 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(x);\\n}\\n\\n/// @notice Unwraps an SD59x18 number into int256.\\nfunction unwrap(SD59x18 x) pure returns (int256 result) {\\n result = SD59x18.unwrap(x);\\n}\\n\\n/// @notice Wraps an int256 number into SD59x18.\\nfunction wrap(int256 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x3b21b60ec2998c3ae32f647412da51d3683b3f183a807198cc8d157499484f99\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n// NOTICE: the \\\"u\\\" prefix stands for \\\"unwrapped\\\".\\n\\n/// @dev Euler's number as an SD59x18 number.\\nSD59x18 constant E = SD59x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum input permitted in {exp}.\\nint256 constant uEXP_MAX_INPUT = 133_084258667509499440;\\nSD59x18 constant EXP_MAX_INPUT = SD59x18.wrap(uEXP_MAX_INPUT);\\n\\n/// @dev Any value less than this returns 0 in {exp}.\\nint256 constant uEXP_MIN_THRESHOLD = -41_446531673892822322;\\nSD59x18 constant EXP_MIN_THRESHOLD = SD59x18.wrap(uEXP_MIN_THRESHOLD);\\n\\n/// @dev The maximum input permitted in {exp2}.\\nint256 constant uEXP2_MAX_INPUT = 192e18 - 1;\\nSD59x18 constant EXP2_MAX_INPUT = SD59x18.wrap(uEXP2_MAX_INPUT);\\n\\n/// @dev Any value less than this returns 0 in {exp2}.\\nint256 constant uEXP2_MIN_THRESHOLD = -59_794705707972522261;\\nSD59x18 constant EXP2_MIN_THRESHOLD = SD59x18.wrap(uEXP2_MIN_THRESHOLD);\\n\\n/// @dev Half the UNIT number.\\nint256 constant uHALF_UNIT = 0.5e18;\\nSD59x18 constant HALF_UNIT = SD59x18.wrap(uHALF_UNIT);\\n\\n/// @dev $log_2(10)$ as an SD59x18 number.\\nint256 constant uLOG2_10 = 3_321928094887362347;\\nSD59x18 constant LOG2_10 = SD59x18.wrap(uLOG2_10);\\n\\n/// @dev $log_2(e)$ as an SD59x18 number.\\nint256 constant uLOG2_E = 1_442695040888963407;\\nSD59x18 constant LOG2_E = SD59x18.wrap(uLOG2_E);\\n\\n/// @dev The maximum value an SD59x18 number can have.\\nint256 constant uMAX_SD59x18 = 57896044618658097711785492504343953926634992332820282019728_792003956564819967;\\nSD59x18 constant MAX_SD59x18 = SD59x18.wrap(uMAX_SD59x18);\\n\\n/// @dev The maximum whole value an SD59x18 number can have.\\nint256 constant uMAX_WHOLE_SD59x18 = 57896044618658097711785492504343953926634992332820282019728_000000000000000000;\\nSD59x18 constant MAX_WHOLE_SD59x18 = SD59x18.wrap(uMAX_WHOLE_SD59x18);\\n\\n/// @dev The minimum value an SD59x18 number can have.\\nint256 constant uMIN_SD59x18 = -57896044618658097711785492504343953926634992332820282019728_792003956564819968;\\nSD59x18 constant MIN_SD59x18 = SD59x18.wrap(uMIN_SD59x18);\\n\\n/// @dev The minimum whole value an SD59x18 number can have.\\nint256 constant uMIN_WHOLE_SD59x18 = -57896044618658097711785492504343953926634992332820282019728_000000000000000000;\\nSD59x18 constant MIN_WHOLE_SD59x18 = SD59x18.wrap(uMIN_WHOLE_SD59x18);\\n\\n/// @dev PI as an SD59x18 number.\\nSD59x18 constant PI = SD59x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of SD59x18.\\nint256 constant uUNIT = 1e18;\\nSD59x18 constant UNIT = SD59x18.wrap(1e18);\\n\\n/// @dev The unit number squared.\\nint256 constant uUNIT_SQUARED = 1e36;\\nSD59x18 constant UNIT_SQUARED = SD59x18.wrap(uUNIT_SQUARED);\\n\\n/// @dev Zero as an SD59x18 number.\\nSD59x18 constant ZERO = SD59x18.wrap(0);\\n\",\"keccak256\":\"0x9bcb8dd6b3e886d140ad1c32747a4f6d29a492529ceb835be878ae837aa6cc3a\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when taking the absolute value of `MIN_SD59x18`.\\nerror PRBMath_SD59x18_Abs_MinSD59x18();\\n\\n/// @notice Thrown when ceiling a number overflows SD59x18.\\nerror PRBMath_SD59x18_Ceil_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when converting a basic integer to the fixed-point format overflows SD59x18.\\nerror PRBMath_SD59x18_Convert_Overflow(int256 x);\\n\\n/// @notice Thrown when converting a basic integer to the fixed-point format underflows SD59x18.\\nerror PRBMath_SD59x18_Convert_Underflow(int256 x);\\n\\n/// @notice Thrown when dividing two numbers and one of them is `MIN_SD59x18`.\\nerror PRBMath_SD59x18_Div_InputTooSmall();\\n\\n/// @notice Thrown when dividing two numbers and one of the intermediary unsigned results overflows SD59x18.\\nerror PRBMath_SD59x18_Div_Overflow(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when taking the natural exponent of a base greater than 133_084258667509499441.\\nerror PRBMath_SD59x18_Exp_InputTooBig(SD59x18 x);\\n\\n/// @notice Thrown when taking the binary exponent of a base greater than 192e18.\\nerror PRBMath_SD59x18_Exp2_InputTooBig(SD59x18 x);\\n\\n/// @notice Thrown when flooring a number underflows SD59x18.\\nerror PRBMath_SD59x18_Floor_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when taking the geometric mean of two numbers and their product is negative.\\nerror PRBMath_SD59x18_Gm_NegativeProduct(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when taking the geometric mean of two numbers and multiplying them overflows SD59x18.\\nerror PRBMath_SD59x18_Gm_Overflow(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\\nerror PRBMath_SD59x18_IntoSD1x18_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\\nerror PRBMath_SD59x18_IntoSD1x18_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\\nerror PRBMath_SD59x18_IntoUD2x18_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\\nerror PRBMath_SD59x18_IntoUD2x18_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD60x18.\\nerror PRBMath_SD59x18_IntoUD60x18_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\\nerror PRBMath_SD59x18_IntoUint128_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\\nerror PRBMath_SD59x18_IntoUint128_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint256.\\nerror PRBMath_SD59x18_IntoUint256_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\\nerror PRBMath_SD59x18_IntoUint40_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\\nerror PRBMath_SD59x18_IntoUint40_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when taking the logarithm of a number less than or equal to zero.\\nerror PRBMath_SD59x18_Log_InputTooSmall(SD59x18 x);\\n\\n/// @notice Thrown when multiplying two numbers and one of the inputs is `MIN_SD59x18`.\\nerror PRBMath_SD59x18_Mul_InputTooSmall();\\n\\n/// @notice Thrown when multiplying two numbers and the intermediary absolute result overflows SD59x18.\\nerror PRBMath_SD59x18_Mul_Overflow(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when raising a number to a power and the intermediary absolute result overflows SD59x18.\\nerror PRBMath_SD59x18_Powu_Overflow(SD59x18 x, uint256 y);\\n\\n/// @notice Thrown when taking the square root of a negative number.\\nerror PRBMath_SD59x18_Sqrt_NegativeInput(SD59x18 x);\\n\\n/// @notice Thrown when the calculating the square root overflows SD59x18.\\nerror PRBMath_SD59x18_Sqrt_Overflow(SD59x18 x);\\n\",\"keccak256\":\"0xa6d00fe5efa215ac0df25c896e3da99a12fb61e799644b2ec32da947313d3db4\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Helpers.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { wrap } from \\\"./Casting.sol\\\";\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Implements the checked addition operation (+) in the SD59x18 type.\\nfunction add(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n return wrap(x.unwrap() + y.unwrap());\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the SD59x18 type.\\nfunction and(SD59x18 x, int256 bits) pure returns (SD59x18 result) {\\n return wrap(x.unwrap() & bits);\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the SD59x18 type.\\nfunction and2(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n return wrap(x.unwrap() & y.unwrap());\\n}\\n\\n/// @notice Implements the equal (=) operation in the SD59x18 type.\\nfunction eq(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() == y.unwrap();\\n}\\n\\n/// @notice Implements the greater than operation (>) in the SD59x18 type.\\nfunction gt(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() > y.unwrap();\\n}\\n\\n/// @notice Implements the greater than or equal to operation (>=) in the SD59x18 type.\\nfunction gte(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() >= y.unwrap();\\n}\\n\\n/// @notice Implements a zero comparison check function in the SD59x18 type.\\nfunction isZero(SD59x18 x) pure returns (bool result) {\\n result = x.unwrap() == 0;\\n}\\n\\n/// @notice Implements the left shift operation (<<) in the SD59x18 type.\\nfunction lshift(SD59x18 x, uint256 bits) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() << bits);\\n}\\n\\n/// @notice Implements the lower than operation (<) in the SD59x18 type.\\nfunction lt(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() < y.unwrap();\\n}\\n\\n/// @notice Implements the lower than or equal to operation (<=) in the SD59x18 type.\\nfunction lte(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() <= y.unwrap();\\n}\\n\\n/// @notice Implements the unchecked modulo operation (%) in the SD59x18 type.\\nfunction mod(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() % y.unwrap());\\n}\\n\\n/// @notice Implements the not equal operation (!=) in the SD59x18 type.\\nfunction neq(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() != y.unwrap();\\n}\\n\\n/// @notice Implements the NOT (~) bitwise operation in the SD59x18 type.\\nfunction not(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(~x.unwrap());\\n}\\n\\n/// @notice Implements the OR (|) bitwise operation in the SD59x18 type.\\nfunction or(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() | y.unwrap());\\n}\\n\\n/// @notice Implements the right shift operation (>>) in the SD59x18 type.\\nfunction rshift(SD59x18 x, uint256 bits) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() >> bits);\\n}\\n\\n/// @notice Implements the checked subtraction operation (-) in the SD59x18 type.\\nfunction sub(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() - y.unwrap());\\n}\\n\\n/// @notice Implements the checked unary minus operation (-) in the SD59x18 type.\\nfunction unary(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(-x.unwrap());\\n}\\n\\n/// @notice Implements the unchecked addition operation (+) in the SD59x18 type.\\nfunction uncheckedAdd(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() + y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the unchecked subtraction operation (-) in the SD59x18 type.\\nfunction uncheckedSub(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() - y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the unchecked unary minus operation (-) in the SD59x18 type.\\nfunction uncheckedUnary(SD59x18 x) pure returns (SD59x18 result) {\\n unchecked {\\n result = wrap(-x.unwrap());\\n }\\n}\\n\\n/// @notice Implements the XOR (^) bitwise operation in the SD59x18 type.\\nfunction xor(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() ^ y.unwrap());\\n}\\n\",\"keccak256\":\"0x208570f1657cf730cb6c3d81aa14030e0d45cf906cdedea5059369d7df4bb716\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as Errors;\\nimport {\\n uEXP_MAX_INPUT,\\n uEXP2_MAX_INPUT,\\n uEXP_MIN_THRESHOLD,\\n uEXP2_MIN_THRESHOLD,\\n uHALF_UNIT,\\n uLOG2_10,\\n uLOG2_E,\\n uMAX_SD59x18,\\n uMAX_WHOLE_SD59x18,\\n uMIN_SD59x18,\\n uMIN_WHOLE_SD59x18,\\n UNIT,\\n uUNIT,\\n uUNIT_SQUARED,\\n ZERO\\n} from \\\"./Constants.sol\\\";\\nimport { wrap } from \\\"./Helpers.sol\\\";\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Calculates the absolute value of x.\\n///\\n/// @dev Requirements:\\n/// - x must be greater than `MIN_SD59x18`.\\n///\\n/// @param x The SD59x18 number for which to calculate the absolute value.\\n/// @param result The absolute value of x as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction abs(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt == uMIN_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Abs_MinSD59x18();\\n }\\n result = xInt < 0 ? wrap(-xInt) : x;\\n}\\n\\n/// @notice Calculates the arithmetic average of x and y.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// @param x The first operand as an SD59x18 number.\\n/// @param y The second operand as an SD59x18 number.\\n/// @return result The arithmetic average as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction avg(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n\\n unchecked {\\n // This operation is equivalent to `x / 2 + y / 2`, and it can never overflow.\\n int256 sum = (xInt >> 1) + (yInt >> 1);\\n\\n if (sum < 0) {\\n // If at least one of x and y is odd, add 1 to the result, because shifting negative numbers to the right\\n // rounds toward negative infinity. The right part is equivalent to `sum + (x % 2 == 1 || y % 2 == 1)`.\\n assembly (\\\"memory-safe\\\") {\\n result := add(sum, and(or(xInt, yInt), 1))\\n }\\n } else {\\n // Add 1 if both x and y are odd to account for the double 0.5 remainder truncated after shifting.\\n result = wrap(sum + (xInt & yInt & 1));\\n }\\n }\\n}\\n\\n/// @notice Yields the smallest whole number greater than or equal to x.\\n///\\n/// @dev Optimized for fractional value inputs, because every whole value has (1e18 - 1) fractional counterparts.\\n/// See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n///\\n/// Requirements:\\n/// - x must be less than or equal to `MAX_WHOLE_SD59x18`.\\n///\\n/// @param x The SD59x18 number to ceil.\\n/// @param result The smallest whole number greater than or equal to x, as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ceil(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt > uMAX_WHOLE_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Ceil_Overflow(x);\\n }\\n\\n int256 remainder = xInt % uUNIT;\\n if (remainder == 0) {\\n result = x;\\n } else {\\n unchecked {\\n // Solidity uses C fmod style, which returns a modulus with the same sign as x.\\n int256 resultInt = xInt - remainder;\\n if (xInt > 0) {\\n resultInt += uUNIT;\\n }\\n result = wrap(resultInt);\\n }\\n }\\n}\\n\\n/// @notice Divides two SD59x18 numbers, returning a new SD59x18 number.\\n///\\n/// @dev This is an extension of {Common.mulDiv} for signed numbers, which works by computing the signs and the absolute\\n/// values separately.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv}.\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv}.\\n/// - None of the inputs can be `MIN_SD59x18`.\\n/// - The denominator must not be zero.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The numerator as an SD59x18 number.\\n/// @param y The denominator as an SD59x18 number.\\n/// @param result The quotient as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction div(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n if (xInt == uMIN_SD59x18 || yInt == uMIN_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Div_InputTooSmall();\\n }\\n\\n // Get hold of the absolute values of x and y.\\n uint256 xAbs;\\n uint256 yAbs;\\n unchecked {\\n xAbs = xInt < 0 ? uint256(-xInt) : uint256(xInt);\\n yAbs = yInt < 0 ? uint256(-yInt) : uint256(yInt);\\n }\\n\\n // Compute the absolute value (x*UNIT\\u00f7y). The resulting value must fit in SD59x18.\\n uint256 resultAbs = Common.mulDiv(xAbs, uint256(uUNIT), yAbs);\\n if (resultAbs > uint256(uMAX_SD59x18)) {\\n revert Errors.PRBMath_SD59x18_Div_Overflow(x, y);\\n }\\n\\n // Check if x and y have the same sign using two's complement representation. The left-most bit represents the sign (1 for\\n // negative, 0 for positive or zero).\\n bool sameSign = (xInt ^ yInt) > -1;\\n\\n // If the inputs have the same sign, the result should be positive. Otherwise, it should be negative.\\n unchecked {\\n result = wrap(sameSign ? int256(resultAbs) : -int256(resultAbs));\\n }\\n}\\n\\n/// @notice Calculates the natural exponent of x using the following formula:\\n///\\n/// $$\\n/// e^x = 2^{x * log_2{e}}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {exp2}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {exp2}.\\n/// - x must be less than 133_084258667509499441.\\n///\\n/// @param x The exponent as an SD59x18 number.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n\\n // Any input less than the threshold returns zero.\\n // This check also prevents an overflow for very small numbers.\\n if (xInt < uEXP_MIN_THRESHOLD) {\\n return ZERO;\\n }\\n\\n // This check prevents values greater than 192e18 from being passed to {exp2}.\\n if (xInt > uEXP_MAX_INPUT) {\\n revert Errors.PRBMath_SD59x18_Exp_InputTooBig(x);\\n }\\n\\n unchecked {\\n // Inline the fixed-point multiplication to save gas.\\n int256 doubleUnitProduct = xInt * uLOG2_E;\\n result = exp2(wrap(doubleUnitProduct / uUNIT));\\n }\\n}\\n\\n/// @notice Calculates the binary exponent of x using the binary fraction method using the following formula:\\n///\\n/// $$\\n/// 2^{-x} = \\\\frac{1}{2^x}\\n/// $$\\n///\\n/// @dev See https://ethereum.stackexchange.com/q/79903/24693.\\n///\\n/// Notes:\\n/// - If x is less than -59_794705707972522261, the result is zero.\\n///\\n/// Requirements:\\n/// - x must be less than 192e18.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The exponent as an SD59x18 number.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp2(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < 0) {\\n // The inverse of any number less than the threshold is truncated to zero.\\n if (xInt < uEXP2_MIN_THRESHOLD) {\\n return ZERO;\\n }\\n\\n unchecked {\\n // Inline the fixed-point inversion to save gas.\\n result = wrap(uUNIT_SQUARED / exp2(wrap(-xInt)).unwrap());\\n }\\n } else {\\n // Numbers greater than or equal to 192e18 don't fit in the 192.64-bit format.\\n if (xInt > uEXP2_MAX_INPUT) {\\n revert Errors.PRBMath_SD59x18_Exp2_InputTooBig(x);\\n }\\n\\n unchecked {\\n // Convert x to the 192.64-bit fixed-point format.\\n uint256 x_192x64 = uint256((xInt << 64) / uUNIT);\\n\\n // It is safe to cast the result to int256 due to the checks above.\\n result = wrap(int256(Common.exp2(x_192x64)));\\n }\\n }\\n}\\n\\n/// @notice Yields the greatest whole number less than or equal to x.\\n///\\n/// @dev Optimized for fractional value inputs, because for every whole value there are (1e18 - 1) fractional\\n/// counterparts. See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n///\\n/// Requirements:\\n/// - x must be greater than or equal to `MIN_WHOLE_SD59x18`.\\n///\\n/// @param x The SD59x18 number to floor.\\n/// @param result The greatest whole number less than or equal to x, as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction floor(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < uMIN_WHOLE_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Floor_Underflow(x);\\n }\\n\\n int256 remainder = xInt % uUNIT;\\n if (remainder == 0) {\\n result = x;\\n } else {\\n unchecked {\\n // Solidity uses C fmod style, which returns a modulus with the same sign as x.\\n int256 resultInt = xInt - remainder;\\n if (xInt < 0) {\\n resultInt -= uUNIT;\\n }\\n result = wrap(resultInt);\\n }\\n }\\n}\\n\\n/// @notice Yields the excess beyond the floor of x for positive numbers and the part of the number to the right.\\n/// of the radix point for negative numbers.\\n/// @dev Based on the odd function definition. https://en.wikipedia.org/wiki/Fractional_part\\n/// @param x The SD59x18 number to get the fractional part of.\\n/// @param result The fractional part of x as an SD59x18 number.\\nfunction frac(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() % uUNIT);\\n}\\n\\n/// @notice Calculates the geometric mean of x and y, i.e. $\\\\sqrt{x * y}$.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x * y must fit in SD59x18.\\n/// - x * y must not be negative, since complex numbers are not supported.\\n///\\n/// @param x The first operand as an SD59x18 number.\\n/// @param y The second operand as an SD59x18 number.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction gm(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n if (xInt == 0 || yInt == 0) {\\n return ZERO;\\n }\\n\\n unchecked {\\n // Equivalent to `xy / x != y`. Checking for overflow this way is faster than letting Solidity do it.\\n int256 xyInt = xInt * yInt;\\n if (xyInt / xInt != yInt) {\\n revert Errors.PRBMath_SD59x18_Gm_Overflow(x, y);\\n }\\n\\n // The product must not be negative, since complex numbers are not supported.\\n if (xyInt < 0) {\\n revert Errors.PRBMath_SD59x18_Gm_NegativeProduct(x, y);\\n }\\n\\n // We don't need to multiply the result by `UNIT` here because the x*y product picked up a factor of `UNIT`\\n // during multiplication. See the comments in {Common.sqrt}.\\n uint256 resultUint = Common.sqrt(uint256(xyInt));\\n result = wrap(int256(resultUint));\\n }\\n}\\n\\n/// @notice Calculates the inverse of x.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x must not be zero.\\n///\\n/// @param x The SD59x18 number for which to calculate the inverse.\\n/// @return result The inverse as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction inv(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(uUNIT_SQUARED / x.unwrap());\\n}\\n\\n/// @notice Calculates the natural logarithm of x using the following formula:\\n///\\n/// $$\\n/// ln{x} = log_2{x} / log_2{e}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n/// - The precision isn't sufficiently fine-grained to return exactly `UNIT` when the input is `E`.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The SD59x18 number for which to calculate the natural logarithm.\\n/// @return result The natural logarithm as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ln(SD59x18 x) pure returns (SD59x18 result) {\\n // Inline the fixed-point multiplication to save gas. This is overflow-safe because the maximum value that\\n // {log2} can return is ~195_205294292027477728.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_E);\\n}\\n\\n/// @notice Calculates the common logarithm of x using the following formula:\\n///\\n/// $$\\n/// log_{10}{x} = log_2{x} / log_2{10}\\n/// $$\\n///\\n/// However, if x is an exact power of ten, a hard coded value is returned.\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The SD59x18 number for which to calculate the common logarithm.\\n/// @return result The common logarithm as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log10(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < 0) {\\n revert Errors.PRBMath_SD59x18_Log_InputTooSmall(x);\\n }\\n\\n // Note that the `mul` in this block is the standard multiplication operation, not {SD59x18.mul}.\\n // prettier-ignore\\n assembly (\\\"memory-safe\\\") {\\n switch x\\n case 1 { result := mul(uUNIT, sub(0, 18)) }\\n case 10 { result := mul(uUNIT, sub(1, 18)) }\\n case 100 { result := mul(uUNIT, sub(2, 18)) }\\n case 1000 { result := mul(uUNIT, sub(3, 18)) }\\n case 10000 { result := mul(uUNIT, sub(4, 18)) }\\n case 100000 { result := mul(uUNIT, sub(5, 18)) }\\n case 1000000 { result := mul(uUNIT, sub(6, 18)) }\\n case 10000000 { result := mul(uUNIT, sub(7, 18)) }\\n case 100000000 { result := mul(uUNIT, sub(8, 18)) }\\n case 1000000000 { result := mul(uUNIT, sub(9, 18)) }\\n case 10000000000 { result := mul(uUNIT, sub(10, 18)) }\\n case 100000000000 { result := mul(uUNIT, sub(11, 18)) }\\n case 1000000000000 { result := mul(uUNIT, sub(12, 18)) }\\n case 10000000000000 { result := mul(uUNIT, sub(13, 18)) }\\n case 100000000000000 { result := mul(uUNIT, sub(14, 18)) }\\n case 1000000000000000 { result := mul(uUNIT, sub(15, 18)) }\\n case 10000000000000000 { result := mul(uUNIT, sub(16, 18)) }\\n case 100000000000000000 { result := mul(uUNIT, sub(17, 18)) }\\n case 1000000000000000000 { result := 0 }\\n case 10000000000000000000 { result := uUNIT }\\n case 100000000000000000000 { result := mul(uUNIT, 2) }\\n case 1000000000000000000000 { result := mul(uUNIT, 3) }\\n case 10000000000000000000000 { result := mul(uUNIT, 4) }\\n case 100000000000000000000000 { result := mul(uUNIT, 5) }\\n case 1000000000000000000000000 { result := mul(uUNIT, 6) }\\n case 10000000000000000000000000 { result := mul(uUNIT, 7) }\\n case 100000000000000000000000000 { result := mul(uUNIT, 8) }\\n case 1000000000000000000000000000 { result := mul(uUNIT, 9) }\\n case 10000000000000000000000000000 { result := mul(uUNIT, 10) }\\n case 100000000000000000000000000000 { result := mul(uUNIT, 11) }\\n case 1000000000000000000000000000000 { result := mul(uUNIT, 12) }\\n case 10000000000000000000000000000000 { result := mul(uUNIT, 13) }\\n case 100000000000000000000000000000000 { result := mul(uUNIT, 14) }\\n case 1000000000000000000000000000000000 { result := mul(uUNIT, 15) }\\n case 10000000000000000000000000000000000 { result := mul(uUNIT, 16) }\\n case 100000000000000000000000000000000000 { result := mul(uUNIT, 17) }\\n case 1000000000000000000000000000000000000 { result := mul(uUNIT, 18) }\\n case 10000000000000000000000000000000000000 { result := mul(uUNIT, 19) }\\n case 100000000000000000000000000000000000000 { result := mul(uUNIT, 20) }\\n case 1000000000000000000000000000000000000000 { result := mul(uUNIT, 21) }\\n case 10000000000000000000000000000000000000000 { result := mul(uUNIT, 22) }\\n case 100000000000000000000000000000000000000000 { result := mul(uUNIT, 23) }\\n case 1000000000000000000000000000000000000000000 { result := mul(uUNIT, 24) }\\n case 10000000000000000000000000000000000000000000 { result := mul(uUNIT, 25) }\\n case 100000000000000000000000000000000000000000000 { result := mul(uUNIT, 26) }\\n case 1000000000000000000000000000000000000000000000 { result := mul(uUNIT, 27) }\\n case 10000000000000000000000000000000000000000000000 { result := mul(uUNIT, 28) }\\n case 100000000000000000000000000000000000000000000000 { result := mul(uUNIT, 29) }\\n case 1000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 30) }\\n case 10000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 31) }\\n case 100000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 32) }\\n case 1000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 33) }\\n case 10000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 34) }\\n case 100000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 35) }\\n case 1000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 36) }\\n case 10000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 37) }\\n case 100000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 38) }\\n case 1000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 39) }\\n case 10000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 40) }\\n case 100000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 41) }\\n case 1000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 42) }\\n case 10000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 43) }\\n case 100000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 44) }\\n case 1000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 45) }\\n case 10000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 46) }\\n case 100000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 47) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 48) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 49) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 50) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 51) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 52) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 53) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 54) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 55) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 56) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 57) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 58) }\\n default { result := uMAX_SD59x18 }\\n }\\n\\n if (result.unwrap() == uMAX_SD59x18) {\\n unchecked {\\n // Inline the fixed-point division to save gas.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_10);\\n }\\n }\\n}\\n\\n/// @notice Calculates the binary logarithm of x using the iterative approximation algorithm:\\n///\\n/// $$\\n/// log_2{x} = n + log_2{y}, \\\\text{ where } y = x*2^{-n}, \\\\ y \\\\in [1, 2)\\n/// $$\\n///\\n/// For $0 \\\\leq x \\\\lt 1$, the input is inverted:\\n///\\n/// $$\\n/// log_2{x} = -log_2{\\\\frac{1}{x}}\\n/// $$\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Binary_logarithm#Iterative_approximation.\\n///\\n/// Notes:\\n/// - Due to the lossy precision of the iterative approximation, the results are not perfectly accurate to the last decimal.\\n///\\n/// Requirements:\\n/// - x must be greater than zero.\\n///\\n/// @param x The SD59x18 number for which to calculate the binary logarithm.\\n/// @return result The binary logarithm as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log2(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt <= 0) {\\n revert Errors.PRBMath_SD59x18_Log_InputTooSmall(x);\\n }\\n\\n unchecked {\\n int256 sign;\\n if (xInt >= uUNIT) {\\n sign = 1;\\n } else {\\n sign = -1;\\n // Inline the fixed-point inversion to save gas.\\n xInt = uUNIT_SQUARED / xInt;\\n }\\n\\n // Calculate the integer part of the logarithm.\\n uint256 n = Common.msb(uint256(xInt / uUNIT));\\n\\n // This is the integer part of the logarithm as an SD59x18 number. The operation can't overflow\\n // because n is at most 255, `UNIT` is 1e18, and the sign is either 1 or -1.\\n int256 resultInt = int256(n) * uUNIT;\\n\\n // Calculate $y = x * 2^{-n}$.\\n int256 y = xInt >> n;\\n\\n // If y is the unit number, the fractional part is zero.\\n if (y == uUNIT) {\\n return wrap(resultInt * sign);\\n }\\n\\n // Calculate the fractional part via the iterative approximation.\\n // The `delta >>= 1` part is equivalent to `delta /= 2`, but shifting bits is more gas efficient.\\n int256 DOUBLE_UNIT = 2e18;\\n for (int256 delta = uHALF_UNIT; delta > 0; delta >>= 1) {\\n y = (y * y) / uUNIT;\\n\\n // Is y^2 >= 2e18 and so in the range [2e18, 4e18)?\\n if (y >= DOUBLE_UNIT) {\\n // Add the 2^{-m} factor to the logarithm.\\n resultInt = resultInt + delta;\\n\\n // Halve y, which corresponds to z/2 in the Wikipedia article.\\n y >>= 1;\\n }\\n }\\n resultInt *= sign;\\n result = wrap(resultInt);\\n }\\n}\\n\\n/// @notice Multiplies two SD59x18 numbers together, returning a new SD59x18 number.\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {Common.mulDiv18}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv18}.\\n/// - None of the inputs can be `MIN_SD59x18`.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The multiplicand as an SD59x18 number.\\n/// @param y The multiplier as an SD59x18 number.\\n/// @return result The product as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mul(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n if (xInt == uMIN_SD59x18 || yInt == uMIN_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Mul_InputTooSmall();\\n }\\n\\n // Get hold of the absolute values of x and y.\\n uint256 xAbs;\\n uint256 yAbs;\\n unchecked {\\n xAbs = xInt < 0 ? uint256(-xInt) : uint256(xInt);\\n yAbs = yInt < 0 ? uint256(-yInt) : uint256(yInt);\\n }\\n\\n // Compute the absolute value (x*y\\u00f7UNIT). The resulting value must fit in SD59x18.\\n uint256 resultAbs = Common.mulDiv18(xAbs, yAbs);\\n if (resultAbs > uint256(uMAX_SD59x18)) {\\n revert Errors.PRBMath_SD59x18_Mul_Overflow(x, y);\\n }\\n\\n // Check if x and y have the same sign using two's complement representation. The left-most bit represents the sign (1 for\\n // negative, 0 for positive or zero).\\n bool sameSign = (xInt ^ yInt) > -1;\\n\\n // If the inputs have the same sign, the result should be positive. Otherwise, it should be negative.\\n unchecked {\\n result = wrap(sameSign ? int256(resultAbs) : -int256(resultAbs));\\n }\\n}\\n\\n/// @notice Raises x to the power of y using the following formula:\\n///\\n/// $$\\n/// x^y = 2^{log_2{x} * y}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {exp2}, {log2}, and {mul}.\\n/// - Returns `UNIT` for 0^0.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {exp2}, {log2}, and {mul}.\\n///\\n/// @param x The base as an SD59x18 number.\\n/// @param y Exponent to raise x to, as an SD59x18 number\\n/// @return result x raised to power y, as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction pow(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n\\n // If both x and y are zero, the result is `UNIT`. If just x is zero, the result is always zero.\\n if (xInt == 0) {\\n return yInt == 0 ? UNIT : ZERO;\\n }\\n // If x is `UNIT`, the result is always `UNIT`.\\n else if (xInt == uUNIT) {\\n return UNIT;\\n }\\n\\n // If y is zero, the result is always `UNIT`.\\n if (yInt == 0) {\\n return UNIT;\\n }\\n // If y is `UNIT`, the result is always x.\\n else if (yInt == uUNIT) {\\n return x;\\n }\\n\\n // Calculate the result using the formula.\\n result = exp2(mul(log2(x), y));\\n}\\n\\n/// @notice Raises x (an SD59x18 number) to the power y (an unsigned basic integer) using the well-known\\n/// algorithm \\\"exponentiation by squaring\\\".\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Exponentiation_by_squaring.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv18}.\\n/// - Returns `UNIT` for 0^0.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {abs} and {Common.mulDiv18}.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The base as an SD59x18 number.\\n/// @param y The exponent as a uint256.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction powu(SD59x18 x, uint256 y) pure returns (SD59x18 result) {\\n uint256 xAbs = uint256(abs(x).unwrap());\\n\\n // Calculate the first iteration of the loop in advance.\\n uint256 resultAbs = y & 1 > 0 ? xAbs : uint256(uUNIT);\\n\\n // Equivalent to `for(y /= 2; y > 0; y /= 2)`.\\n uint256 yAux = y;\\n for (yAux >>= 1; yAux > 0; yAux >>= 1) {\\n xAbs = Common.mulDiv18(xAbs, xAbs);\\n\\n // Equivalent to `y % 2 == 1`.\\n if (yAux & 1 > 0) {\\n resultAbs = Common.mulDiv18(resultAbs, xAbs);\\n }\\n }\\n\\n // The result must fit in SD59x18.\\n if (resultAbs > uint256(uMAX_SD59x18)) {\\n revert Errors.PRBMath_SD59x18_Powu_Overflow(x, y);\\n }\\n\\n unchecked {\\n // Is the base negative and the exponent odd? If yes, the result should be negative.\\n int256 resultInt = int256(resultAbs);\\n bool isNegative = x.unwrap() < 0 && y & 1 == 1;\\n if (isNegative) {\\n resultInt = -resultInt;\\n }\\n result = wrap(resultInt);\\n }\\n}\\n\\n/// @notice Calculates the square root of x using the Babylonian method.\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\\n///\\n/// Notes:\\n/// - Only the positive root is returned.\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x cannot be negative, since complex numbers are not supported.\\n/// - x must be less than `MAX_SD59x18 / UNIT`.\\n///\\n/// @param x The SD59x18 number for which to calculate the square root.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction sqrt(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < 0) {\\n revert Errors.PRBMath_SD59x18_Sqrt_NegativeInput(x);\\n }\\n if (xInt > uMAX_SD59x18 / uUNIT) {\\n revert Errors.PRBMath_SD59x18_Sqrt_Overflow(x);\\n }\\n\\n unchecked {\\n // Multiply x by `UNIT` to account for the factor of `UNIT` picked up when multiplying two SD59x18 numbers.\\n // In this case, the two numbers are both the square root.\\n uint256 resultUint = Common.sqrt(uint256(xInt * uUNIT));\\n result = wrap(int256(resultUint));\\n }\\n}\\n\",\"keccak256\":\"0xa074831139fc89ca0e5a36086b30eb50896bb6770cd5823461b1f2769017d2f0\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\nimport \\\"./Helpers.sol\\\" as Helpers;\\nimport \\\"./Math.sol\\\" as Math;\\n\\n/// @notice The signed 59.18-decimal fixed-point number representation, which can have up to 59 digits and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\\n/// type int256.\\ntype SD59x18 is int256;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoInt256,\\n Casting.intoSD1x18,\\n Casting.intoUD2x18,\\n Casting.intoUD60x18,\\n Casting.intoUint256,\\n Casting.intoUint128,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for SD59x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n MATHEMATICAL FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Math.abs,\\n Math.avg,\\n Math.ceil,\\n Math.div,\\n Math.exp,\\n Math.exp2,\\n Math.floor,\\n Math.frac,\\n Math.gm,\\n Math.inv,\\n Math.log10,\\n Math.log2,\\n Math.ln,\\n Math.mul,\\n Math.pow,\\n Math.powu,\\n Math.sqrt\\n} for SD59x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n HELPER FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Helpers.add,\\n Helpers.and,\\n Helpers.eq,\\n Helpers.gt,\\n Helpers.gte,\\n Helpers.isZero,\\n Helpers.lshift,\\n Helpers.lt,\\n Helpers.lte,\\n Helpers.mod,\\n Helpers.neq,\\n Helpers.not,\\n Helpers.or,\\n Helpers.rshift,\\n Helpers.sub,\\n Helpers.uncheckedAdd,\\n Helpers.uncheckedSub,\\n Helpers.uncheckedUnary,\\n Helpers.xor\\n} for SD59x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n OPERATORS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes it possible to use these operators on the SD59x18 type.\\nusing {\\n Helpers.add as +,\\n Helpers.and2 as &,\\n Math.div as /,\\n Helpers.eq as ==,\\n Helpers.gt as >,\\n Helpers.gte as >=,\\n Helpers.lt as <,\\n Helpers.lte as <=,\\n Helpers.mod as %,\\n Math.mul as *,\\n Helpers.neq as !=,\\n Helpers.not as ~,\\n Helpers.or as |,\\n Helpers.sub as -,\\n Helpers.unary as -,\\n Helpers.xor as ^\\n} for SD59x18 global;\\n\",\"keccak256\":\"0xe03112d145dcd5863aff24e5f381debaae29d446acd5666f3d640e3d9af738d7\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as Errors;\\nimport { uMAX_SD1x18 } from \\\"../sd1x18/Constants.sol\\\";\\nimport { SD1x18 } from \\\"../sd1x18/ValueType.sol\\\";\\nimport { SD59x18 } from \\\"../sd59x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"../ud60x18/ValueType.sol\\\";\\nimport { UD2x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts a UD2x18 number into SD1x18.\\n/// - x must be less than or equal to `uMAX_SD1x18`.\\nfunction intoSD1x18(UD2x18 x) pure returns (SD1x18 result) {\\n uint64 xUint = UD2x18.unwrap(x);\\n if (xUint > uint64(uMAX_SD1x18)) {\\n revert Errors.PRBMath_UD2x18_IntoSD1x18_Overflow(x);\\n }\\n result = SD1x18.wrap(int64(xUint));\\n}\\n\\n/// @notice Casts a UD2x18 number into SD59x18.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of SD59x18.\\nfunction intoSD59x18(UD2x18 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(int256(uint256(UD2x18.unwrap(x))));\\n}\\n\\n/// @notice Casts a UD2x18 number into UD60x18.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of UD60x18.\\nfunction intoUD60x18(UD2x18 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(UD2x18.unwrap(x));\\n}\\n\\n/// @notice Casts a UD2x18 number into uint128.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of uint128.\\nfunction intoUint128(UD2x18 x) pure returns (uint128 result) {\\n result = uint128(UD2x18.unwrap(x));\\n}\\n\\n/// @notice Casts a UD2x18 number into uint256.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of uint256.\\nfunction intoUint256(UD2x18 x) pure returns (uint256 result) {\\n result = uint256(UD2x18.unwrap(x));\\n}\\n\\n/// @notice Casts a UD2x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(UD2x18 x) pure returns (uint40 result) {\\n uint64 xUint = UD2x18.unwrap(x);\\n if (xUint > uint64(Common.MAX_UINT40)) {\\n revert Errors.PRBMath_UD2x18_IntoUint40_Overflow(x);\\n }\\n result = uint40(xUint);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction ud2x18(uint64 x) pure returns (UD2x18 result) {\\n result = UD2x18.wrap(x);\\n}\\n\\n/// @notice Unwrap a UD2x18 number into uint64.\\nfunction unwrap(UD2x18 x) pure returns (uint64 result) {\\n result = UD2x18.unwrap(x);\\n}\\n\\n/// @notice Wraps a uint64 number into UD2x18.\\nfunction wrap(uint64 x) pure returns (UD2x18 result) {\\n result = UD2x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x9b1a35d432ef951a415fae8098b3c609a99b630a3d5464b3c8e1efa8893eea07\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD2x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @dev Euler's number as a UD2x18 number.\\nUD2x18 constant E = UD2x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum value a UD2x18 number can have.\\nuint64 constant uMAX_UD2x18 = 18_446744073709551615;\\nUD2x18 constant MAX_UD2x18 = UD2x18.wrap(uMAX_UD2x18);\\n\\n/// @dev PI as a UD2x18 number.\\nUD2x18 constant PI = UD2x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of UD2x18.\\nUD2x18 constant UNIT = UD2x18.wrap(1e18);\\nuint64 constant uUNIT = 1e18;\\n\",\"keccak256\":\"0x29b0e050c865899e1fb9022b460a7829cdee248c44c4299f068ba80695eec3fc\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD2x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when trying to cast a UD2x18 number that doesn't fit in SD1x18.\\nerror PRBMath_UD2x18_IntoSD1x18_Overflow(UD2x18 x);\\n\\n/// @notice Thrown when trying to cast a UD2x18 number that doesn't fit in uint40.\\nerror PRBMath_UD2x18_IntoUint40_Overflow(UD2x18 x);\\n\",\"keccak256\":\"0xdf1e22f0b4c8032bcc8b7f63fe3984e1387f3dc7b2e9ab381822249f75376d33\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\n\\n/// @notice The unsigned 2.18-decimal fixed-point number representation, which can have up to 2 digits and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\\n/// type uint64. This is useful when end users want to use uint64 to save gas, e.g. with tight variable packing in contract\\n/// storage.\\ntype UD2x18 is uint64;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoSD1x18,\\n Casting.intoSD59x18,\\n Casting.intoUD60x18,\\n Casting.intoUint256,\\n Casting.intoUint128,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for UD2x18 global;\\n\",\"keccak256\":\"0x2802edc9869db116a0b5c490cc5f8554742f747183fa30ac5e9c80bb967e61a1\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Errors.sol\\\" as CastingErrors;\\nimport { MAX_UINT128, MAX_UINT40 } from \\\"../Common.sol\\\";\\nimport { uMAX_SD1x18 } from \\\"../sd1x18/Constants.sol\\\";\\nimport { SD1x18 } from \\\"../sd1x18/ValueType.sol\\\";\\nimport { uMAX_SD59x18 } from \\\"../sd59x18/Constants.sol\\\";\\nimport { SD59x18 } from \\\"../sd59x18/ValueType.sol\\\";\\nimport { uMAX_UD2x18 } from \\\"../ud2x18/Constants.sol\\\";\\nimport { UD2x18 } from \\\"../ud2x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts a UD60x18 number into SD1x18.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `uMAX_SD1x18`.\\nfunction intoSD1x18(UD60x18 x) pure returns (SD1x18 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > uint256(int256(uMAX_SD1x18))) {\\n revert CastingErrors.PRBMath_UD60x18_IntoSD1x18_Overflow(x);\\n }\\n result = SD1x18.wrap(int64(uint64(xUint)));\\n}\\n\\n/// @notice Casts a UD60x18 number into UD2x18.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `uMAX_UD2x18`.\\nfunction intoUD2x18(UD60x18 x) pure returns (UD2x18 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > uMAX_UD2x18) {\\n revert CastingErrors.PRBMath_UD60x18_IntoUD2x18_Overflow(x);\\n }\\n result = UD2x18.wrap(uint64(xUint));\\n}\\n\\n/// @notice Casts a UD60x18 number into SD59x18.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `uMAX_SD59x18`.\\nfunction intoSD59x18(UD60x18 x) pure returns (SD59x18 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > uint256(uMAX_SD59x18)) {\\n revert CastingErrors.PRBMath_UD60x18_IntoSD59x18_Overflow(x);\\n }\\n result = SD59x18.wrap(int256(xUint));\\n}\\n\\n/// @notice Casts a UD60x18 number into uint128.\\n/// @dev This is basically an alias for {unwrap}.\\nfunction intoUint256(UD60x18 x) pure returns (uint256 result) {\\n result = UD60x18.unwrap(x);\\n}\\n\\n/// @notice Casts a UD60x18 number into uint128.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UINT128`.\\nfunction intoUint128(UD60x18 x) pure returns (uint128 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > MAX_UINT128) {\\n revert CastingErrors.PRBMath_UD60x18_IntoUint128_Overflow(x);\\n }\\n result = uint128(xUint);\\n}\\n\\n/// @notice Casts a UD60x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(UD60x18 x) pure returns (uint40 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > MAX_UINT40) {\\n revert CastingErrors.PRBMath_UD60x18_IntoUint40_Overflow(x);\\n }\\n result = uint40(xUint);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction ud(uint256 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(x);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction ud60x18(uint256 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(x);\\n}\\n\\n/// @notice Unwraps a UD60x18 number into uint256.\\nfunction unwrap(UD60x18 x) pure returns (uint256 result) {\\n result = UD60x18.unwrap(x);\\n}\\n\\n/// @notice Wraps a uint256 number into the UD60x18 value type.\\nfunction wrap(uint256 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x5bb532da36921cbdac64d1f16de5d366ef1f664502e3b7c07d0ad06917551f85\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n// NOTICE: the \\\"u\\\" prefix stands for \\\"unwrapped\\\".\\n\\n/// @dev Euler's number as a UD60x18 number.\\nUD60x18 constant E = UD60x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum input permitted in {exp}.\\nuint256 constant uEXP_MAX_INPUT = 133_084258667509499440;\\nUD60x18 constant EXP_MAX_INPUT = UD60x18.wrap(uEXP_MAX_INPUT);\\n\\n/// @dev The maximum input permitted in {exp2}.\\nuint256 constant uEXP2_MAX_INPUT = 192e18 - 1;\\nUD60x18 constant EXP2_MAX_INPUT = UD60x18.wrap(uEXP2_MAX_INPUT);\\n\\n/// @dev Half the UNIT number.\\nuint256 constant uHALF_UNIT = 0.5e18;\\nUD60x18 constant HALF_UNIT = UD60x18.wrap(uHALF_UNIT);\\n\\n/// @dev $log_2(10)$ as a UD60x18 number.\\nuint256 constant uLOG2_10 = 3_321928094887362347;\\nUD60x18 constant LOG2_10 = UD60x18.wrap(uLOG2_10);\\n\\n/// @dev $log_2(e)$ as a UD60x18 number.\\nuint256 constant uLOG2_E = 1_442695040888963407;\\nUD60x18 constant LOG2_E = UD60x18.wrap(uLOG2_E);\\n\\n/// @dev The maximum value a UD60x18 number can have.\\nuint256 constant uMAX_UD60x18 = 115792089237316195423570985008687907853269984665640564039457_584007913129639935;\\nUD60x18 constant MAX_UD60x18 = UD60x18.wrap(uMAX_UD60x18);\\n\\n/// @dev The maximum whole value a UD60x18 number can have.\\nuint256 constant uMAX_WHOLE_UD60x18 = 115792089237316195423570985008687907853269984665640564039457_000000000000000000;\\nUD60x18 constant MAX_WHOLE_UD60x18 = UD60x18.wrap(uMAX_WHOLE_UD60x18);\\n\\n/// @dev PI as a UD60x18 number.\\nUD60x18 constant PI = UD60x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of UD60x18.\\nuint256 constant uUNIT = 1e18;\\nUD60x18 constant UNIT = UD60x18.wrap(uUNIT);\\n\\n/// @dev The unit number squared.\\nuint256 constant uUNIT_SQUARED = 1e36;\\nUD60x18 constant UNIT_SQUARED = UD60x18.wrap(uUNIT_SQUARED);\\n\\n/// @dev Zero as a UD60x18 number.\\nUD60x18 constant ZERO = UD60x18.wrap(0);\\n\",\"keccak256\":\"0x2b80d26153d3fdcfb3a9ca772d9309d31ed1275f5b8b54c3ffb54d3652b37d90\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Conversions.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { uMAX_UD60x18, uUNIT } from \\\"./Constants.sol\\\";\\nimport { PRBMath_UD60x18_Convert_Overflow } from \\\"./Errors.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Converts a UD60x18 number to a simple integer by dividing it by `UNIT`.\\n/// @dev The result is rounded toward zero.\\n/// @param x The UD60x18 number to convert.\\n/// @return result The same number in basic integer form.\\nfunction convert(UD60x18 x) pure returns (uint256 result) {\\n result = UD60x18.unwrap(x) / uUNIT;\\n}\\n\\n/// @notice Converts a simple integer to UD60x18 by multiplying it by `UNIT`.\\n///\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UD60x18 / UNIT`.\\n///\\n/// @param x The basic integer to convert.\\n/// @param result The same number converted to UD60x18.\\nfunction convert(uint256 x) pure returns (UD60x18 result) {\\n if (x > uMAX_UD60x18 / uUNIT) {\\n revert PRBMath_UD60x18_Convert_Overflow(x);\\n }\\n unchecked {\\n result = UD60x18.wrap(x * uUNIT);\\n }\\n}\\n\",\"keccak256\":\"0xaf7fc2523413822de3b66ba339fe2884fb3b8c6f6cf38ec90a2c3e3aae71df6b\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when ceiling a number overflows UD60x18.\\nerror PRBMath_UD60x18_Ceil_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when converting a basic integer to the fixed-point format overflows UD60x18.\\nerror PRBMath_UD60x18_Convert_Overflow(uint256 x);\\n\\n/// @notice Thrown when taking the natural exponent of a base greater than 133_084258667509499441.\\nerror PRBMath_UD60x18_Exp_InputTooBig(UD60x18 x);\\n\\n/// @notice Thrown when taking the binary exponent of a base greater than 192e18.\\nerror PRBMath_UD60x18_Exp2_InputTooBig(UD60x18 x);\\n\\n/// @notice Thrown when taking the geometric mean of two numbers and multiplying them overflows UD60x18.\\nerror PRBMath_UD60x18_Gm_Overflow(UD60x18 x, UD60x18 y);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\\nerror PRBMath_UD60x18_IntoSD1x18_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD59x18.\\nerror PRBMath_UD60x18_IntoSD59x18_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\\nerror PRBMath_UD60x18_IntoUD2x18_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\\nerror PRBMath_UD60x18_IntoUint128_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\\nerror PRBMath_UD60x18_IntoUint40_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when taking the logarithm of a number less than 1.\\nerror PRBMath_UD60x18_Log_InputTooSmall(UD60x18 x);\\n\\n/// @notice Thrown when calculating the square root overflows UD60x18.\\nerror PRBMath_UD60x18_Sqrt_Overflow(UD60x18 x);\\n\",\"keccak256\":\"0xa8c60d4066248df22c49c882873efbc017344107edabc48c52209abbc39cb1e3\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Helpers.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { wrap } from \\\"./Casting.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Implements the checked addition operation (+) in the UD60x18 type.\\nfunction add(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() + y.unwrap());\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the UD60x18 type.\\nfunction and(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() & bits);\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the UD60x18 type.\\nfunction and2(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() & y.unwrap());\\n}\\n\\n/// @notice Implements the equal operation (==) in the UD60x18 type.\\nfunction eq(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() == y.unwrap();\\n}\\n\\n/// @notice Implements the greater than operation (>) in the UD60x18 type.\\nfunction gt(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() > y.unwrap();\\n}\\n\\n/// @notice Implements the greater than or equal to operation (>=) in the UD60x18 type.\\nfunction gte(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() >= y.unwrap();\\n}\\n\\n/// @notice Implements a zero comparison check function in the UD60x18 type.\\nfunction isZero(UD60x18 x) pure returns (bool result) {\\n // This wouldn't work if x could be negative.\\n result = x.unwrap() == 0;\\n}\\n\\n/// @notice Implements the left shift operation (<<) in the UD60x18 type.\\nfunction lshift(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() << bits);\\n}\\n\\n/// @notice Implements the lower than operation (<) in the UD60x18 type.\\nfunction lt(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() < y.unwrap();\\n}\\n\\n/// @notice Implements the lower than or equal to operation (<=) in the UD60x18 type.\\nfunction lte(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() <= y.unwrap();\\n}\\n\\n/// @notice Implements the checked modulo operation (%) in the UD60x18 type.\\nfunction mod(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() % y.unwrap());\\n}\\n\\n/// @notice Implements the not equal operation (!=) in the UD60x18 type.\\nfunction neq(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() != y.unwrap();\\n}\\n\\n/// @notice Implements the NOT (~) bitwise operation in the UD60x18 type.\\nfunction not(UD60x18 x) pure returns (UD60x18 result) {\\n result = wrap(~x.unwrap());\\n}\\n\\n/// @notice Implements the OR (|) bitwise operation in the UD60x18 type.\\nfunction or(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() | y.unwrap());\\n}\\n\\n/// @notice Implements the right shift operation (>>) in the UD60x18 type.\\nfunction rshift(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() >> bits);\\n}\\n\\n/// @notice Implements the checked subtraction operation (-) in the UD60x18 type.\\nfunction sub(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() - y.unwrap());\\n}\\n\\n/// @notice Implements the unchecked addition operation (+) in the UD60x18 type.\\nfunction uncheckedAdd(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() + y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the unchecked subtraction operation (-) in the UD60x18 type.\\nfunction uncheckedSub(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() - y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the XOR (^) bitwise operation in the UD60x18 type.\\nfunction xor(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() ^ y.unwrap());\\n}\\n\",\"keccak256\":\"0xf5faff881391d2c060029499a666cc5f0bea90a213150bb476fae8f02a5df268\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as Errors;\\nimport { wrap } from \\\"./Casting.sol\\\";\\nimport {\\n uEXP_MAX_INPUT,\\n uEXP2_MAX_INPUT,\\n uHALF_UNIT,\\n uLOG2_10,\\n uLOG2_E,\\n uMAX_UD60x18,\\n uMAX_WHOLE_UD60x18,\\n UNIT,\\n uUNIT,\\n uUNIT_SQUARED,\\n ZERO\\n} from \\\"./Constants.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n MATHEMATICAL FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @notice Calculates the arithmetic average of x and y using the following formula:\\n///\\n/// $$\\n/// avg(x, y) = (x & y) + ((xUint ^ yUint) / 2)\\n/// $$\\n///\\n/// In English, this is what this formula does:\\n///\\n/// 1. AND x and y.\\n/// 2. Calculate half of XOR x and y.\\n/// 3. Add the two results together.\\n///\\n/// This technique is known as SWAR, which stands for \\\"SIMD within a register\\\". You can read more about it here:\\n/// https://devblogs.microsoft.com/oldnewthing/20220207-00/?p=106223\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// @param x The first operand as a UD60x18 number.\\n/// @param y The second operand as a UD60x18 number.\\n/// @return result The arithmetic average as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction avg(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n uint256 yUint = y.unwrap();\\n unchecked {\\n result = wrap((xUint & yUint) + ((xUint ^ yUint) >> 1));\\n }\\n}\\n\\n/// @notice Yields the smallest whole number greater than or equal to x.\\n///\\n/// @dev This is optimized for fractional value inputs, because for every whole value there are (1e18 - 1) fractional\\n/// counterparts. See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n///\\n/// Requirements:\\n/// - x must be less than or equal to `MAX_WHOLE_UD60x18`.\\n///\\n/// @param x The UD60x18 number to ceil.\\n/// @param result The smallest whole number greater than or equal to x, as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ceil(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n if (xUint > uMAX_WHOLE_UD60x18) {\\n revert Errors.PRBMath_UD60x18_Ceil_Overflow(x);\\n }\\n\\n assembly (\\\"memory-safe\\\") {\\n // Equivalent to `x % UNIT`.\\n let remainder := mod(x, uUNIT)\\n\\n // Equivalent to `UNIT - remainder`.\\n let delta := sub(uUNIT, remainder)\\n\\n // Equivalent to `x + remainder > 0 ? delta : 0`.\\n result := add(x, mul(delta, gt(remainder, 0)))\\n }\\n}\\n\\n/// @notice Divides two UD60x18 numbers, returning a new UD60x18 number.\\n///\\n/// @dev Uses {Common.mulDiv} to enable overflow-safe multiplication and division.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv}.\\n///\\n/// @param x The numerator as a UD60x18 number.\\n/// @param y The denominator as a UD60x18 number.\\n/// @param result The quotient as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction div(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(Common.mulDiv(x.unwrap(), uUNIT, y.unwrap()));\\n}\\n\\n/// @notice Calculates the natural exponent of x using the following formula:\\n///\\n/// $$\\n/// e^x = 2^{x * log_2{e}}\\n/// $$\\n///\\n/// @dev Requirements:\\n/// - x must be less than 133_084258667509499441.\\n///\\n/// @param x The exponent as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n // This check prevents values greater than 192e18 from being passed to {exp2}.\\n if (xUint > uEXP_MAX_INPUT) {\\n revert Errors.PRBMath_UD60x18_Exp_InputTooBig(x);\\n }\\n\\n unchecked {\\n // Inline the fixed-point multiplication to save gas.\\n uint256 doubleUnitProduct = xUint * uLOG2_E;\\n result = exp2(wrap(doubleUnitProduct / uUNIT));\\n }\\n}\\n\\n/// @notice Calculates the binary exponent of x using the binary fraction method.\\n///\\n/// @dev See https://ethereum.stackexchange.com/q/79903/24693\\n///\\n/// Requirements:\\n/// - x must be less than 192e18.\\n/// - The result must fit in UD60x18.\\n///\\n/// @param x The exponent as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp2(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n // Numbers greater than or equal to 192e18 don't fit in the 192.64-bit format.\\n if (xUint > uEXP2_MAX_INPUT) {\\n revert Errors.PRBMath_UD60x18_Exp2_InputTooBig(x);\\n }\\n\\n // Convert x to the 192.64-bit fixed-point format.\\n uint256 x_192x64 = (xUint << 64) / uUNIT;\\n\\n // Pass x to the {Common.exp2} function, which uses the 192.64-bit fixed-point number representation.\\n result = wrap(Common.exp2(x_192x64));\\n}\\n\\n/// @notice Yields the greatest whole number less than or equal to x.\\n/// @dev Optimized for fractional value inputs, because every whole value has (1e18 - 1) fractional counterparts.\\n/// See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n/// @param x The UD60x18 number to floor.\\n/// @param result The greatest whole number less than or equal to x, as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction floor(UD60x18 x) pure returns (UD60x18 result) {\\n assembly (\\\"memory-safe\\\") {\\n // Equivalent to `x % UNIT`.\\n let remainder := mod(x, uUNIT)\\n\\n // Equivalent to `x - remainder > 0 ? remainder : 0)`.\\n result := sub(x, mul(remainder, gt(remainder, 0)))\\n }\\n}\\n\\n/// @notice Yields the excess beyond the floor of x using the odd function definition.\\n/// @dev See https://en.wikipedia.org/wiki/Fractional_part.\\n/// @param x The UD60x18 number to get the fractional part of.\\n/// @param result The fractional part of x as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction frac(UD60x18 x) pure returns (UD60x18 result) {\\n assembly (\\\"memory-safe\\\") {\\n result := mod(x, uUNIT)\\n }\\n}\\n\\n/// @notice Calculates the geometric mean of x and y, i.e. $\\\\sqrt{x * y}$, rounding down.\\n///\\n/// @dev Requirements:\\n/// - x * y must fit in UD60x18.\\n///\\n/// @param x The first operand as a UD60x18 number.\\n/// @param y The second operand as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction gm(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n uint256 yUint = y.unwrap();\\n if (xUint == 0 || yUint == 0) {\\n return ZERO;\\n }\\n\\n unchecked {\\n // Checking for overflow this way is faster than letting Solidity do it.\\n uint256 xyUint = xUint * yUint;\\n if (xyUint / xUint != yUint) {\\n revert Errors.PRBMath_UD60x18_Gm_Overflow(x, y);\\n }\\n\\n // We don't need to multiply the result by `UNIT` here because the x*y product picked up a factor of `UNIT`\\n // during multiplication. See the comments in {Common.sqrt}.\\n result = wrap(Common.sqrt(xyUint));\\n }\\n}\\n\\n/// @notice Calculates the inverse of x.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x must not be zero.\\n///\\n/// @param x The UD60x18 number for which to calculate the inverse.\\n/// @return result The inverse as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction inv(UD60x18 x) pure returns (UD60x18 result) {\\n unchecked {\\n result = wrap(uUNIT_SQUARED / x.unwrap());\\n }\\n}\\n\\n/// @notice Calculates the natural logarithm of x using the following formula:\\n///\\n/// $$\\n/// ln{x} = log_2{x} / log_2{e}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n/// - The precision isn't sufficiently fine-grained to return exactly `UNIT` when the input is `E`.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The UD60x18 number for which to calculate the natural logarithm.\\n/// @return result The natural logarithm as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ln(UD60x18 x) pure returns (UD60x18 result) {\\n unchecked {\\n // Inline the fixed-point multiplication to save gas. This is overflow-safe because the maximum value that\\n // {log2} can return is ~196_205294292027477728.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_E);\\n }\\n}\\n\\n/// @notice Calculates the common logarithm of x using the following formula:\\n///\\n/// $$\\n/// log_{10}{x} = log_2{x} / log_2{10}\\n/// $$\\n///\\n/// However, if x is an exact power of ten, a hard coded value is returned.\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The UD60x18 number for which to calculate the common logarithm.\\n/// @return result The common logarithm as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log10(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n if (xUint < uUNIT) {\\n revert Errors.PRBMath_UD60x18_Log_InputTooSmall(x);\\n }\\n\\n // Note that the `mul` in this assembly block is the standard multiplication operation, not {UD60x18.mul}.\\n // prettier-ignore\\n assembly (\\\"memory-safe\\\") {\\n switch x\\n case 1 { result := mul(uUNIT, sub(0, 18)) }\\n case 10 { result := mul(uUNIT, sub(1, 18)) }\\n case 100 { result := mul(uUNIT, sub(2, 18)) }\\n case 1000 { result := mul(uUNIT, sub(3, 18)) }\\n case 10000 { result := mul(uUNIT, sub(4, 18)) }\\n case 100000 { result := mul(uUNIT, sub(5, 18)) }\\n case 1000000 { result := mul(uUNIT, sub(6, 18)) }\\n case 10000000 { result := mul(uUNIT, sub(7, 18)) }\\n case 100000000 { result := mul(uUNIT, sub(8, 18)) }\\n case 1000000000 { result := mul(uUNIT, sub(9, 18)) }\\n case 10000000000 { result := mul(uUNIT, sub(10, 18)) }\\n case 100000000000 { result := mul(uUNIT, sub(11, 18)) }\\n case 1000000000000 { result := mul(uUNIT, sub(12, 18)) }\\n case 10000000000000 { result := mul(uUNIT, sub(13, 18)) }\\n case 100000000000000 { result := mul(uUNIT, sub(14, 18)) }\\n case 1000000000000000 { result := mul(uUNIT, sub(15, 18)) }\\n case 10000000000000000 { result := mul(uUNIT, sub(16, 18)) }\\n case 100000000000000000 { result := mul(uUNIT, sub(17, 18)) }\\n case 1000000000000000000 { result := 0 }\\n case 10000000000000000000 { result := uUNIT }\\n case 100000000000000000000 { result := mul(uUNIT, 2) }\\n case 1000000000000000000000 { result := mul(uUNIT, 3) }\\n case 10000000000000000000000 { result := mul(uUNIT, 4) }\\n case 100000000000000000000000 { result := mul(uUNIT, 5) }\\n case 1000000000000000000000000 { result := mul(uUNIT, 6) }\\n case 10000000000000000000000000 { result := mul(uUNIT, 7) }\\n case 100000000000000000000000000 { result := mul(uUNIT, 8) }\\n case 1000000000000000000000000000 { result := mul(uUNIT, 9) }\\n case 10000000000000000000000000000 { result := mul(uUNIT, 10) }\\n case 100000000000000000000000000000 { result := mul(uUNIT, 11) }\\n case 1000000000000000000000000000000 { result := mul(uUNIT, 12) }\\n case 10000000000000000000000000000000 { result := mul(uUNIT, 13) }\\n case 100000000000000000000000000000000 { result := mul(uUNIT, 14) }\\n case 1000000000000000000000000000000000 { result := mul(uUNIT, 15) }\\n case 10000000000000000000000000000000000 { result := mul(uUNIT, 16) }\\n case 100000000000000000000000000000000000 { result := mul(uUNIT, 17) }\\n case 1000000000000000000000000000000000000 { result := mul(uUNIT, 18) }\\n case 10000000000000000000000000000000000000 { result := mul(uUNIT, 19) }\\n case 100000000000000000000000000000000000000 { result := mul(uUNIT, 20) }\\n case 1000000000000000000000000000000000000000 { result := mul(uUNIT, 21) }\\n case 10000000000000000000000000000000000000000 { result := mul(uUNIT, 22) }\\n case 100000000000000000000000000000000000000000 { result := mul(uUNIT, 23) }\\n case 1000000000000000000000000000000000000000000 { result := mul(uUNIT, 24) }\\n case 10000000000000000000000000000000000000000000 { result := mul(uUNIT, 25) }\\n case 100000000000000000000000000000000000000000000 { result := mul(uUNIT, 26) }\\n case 1000000000000000000000000000000000000000000000 { result := mul(uUNIT, 27) }\\n case 10000000000000000000000000000000000000000000000 { result := mul(uUNIT, 28) }\\n case 100000000000000000000000000000000000000000000000 { result := mul(uUNIT, 29) }\\n case 1000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 30) }\\n case 10000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 31) }\\n case 100000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 32) }\\n case 1000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 33) }\\n case 10000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 34) }\\n case 100000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 35) }\\n case 1000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 36) }\\n case 10000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 37) }\\n case 100000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 38) }\\n case 1000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 39) }\\n case 10000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 40) }\\n case 100000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 41) }\\n case 1000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 42) }\\n case 10000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 43) }\\n case 100000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 44) }\\n case 1000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 45) }\\n case 10000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 46) }\\n case 100000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 47) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 48) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 49) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 50) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 51) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 52) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 53) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 54) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 55) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 56) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 57) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 58) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 59) }\\n default { result := uMAX_UD60x18 }\\n }\\n\\n if (result.unwrap() == uMAX_UD60x18) {\\n unchecked {\\n // Inline the fixed-point division to save gas.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_10);\\n }\\n }\\n}\\n\\n/// @notice Calculates the binary logarithm of x using the iterative approximation algorithm:\\n///\\n/// $$\\n/// log_2{x} = n + log_2{y}, \\\\text{ where } y = x*2^{-n}, \\\\ y \\\\in [1, 2)\\n/// $$\\n///\\n/// For $0 \\\\leq x \\\\lt 1$, the input is inverted:\\n///\\n/// $$\\n/// log_2{x} = -log_2{\\\\frac{1}{x}}\\n/// $$\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Binary_logarithm#Iterative_approximation\\n///\\n/// Notes:\\n/// - Due to the lossy precision of the iterative approximation, the results are not perfectly accurate to the last decimal.\\n///\\n/// Requirements:\\n/// - x must be greater than zero.\\n///\\n/// @param x The UD60x18 number for which to calculate the binary logarithm.\\n/// @return result The binary logarithm as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log2(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n if (xUint < uUNIT) {\\n revert Errors.PRBMath_UD60x18_Log_InputTooSmall(x);\\n }\\n\\n unchecked {\\n // Calculate the integer part of the logarithm.\\n uint256 n = Common.msb(xUint / uUNIT);\\n\\n // This is the integer part of the logarithm as a UD60x18 number. The operation can't overflow because n\\n // n is at most 255 and UNIT is 1e18.\\n uint256 resultUint = n * uUNIT;\\n\\n // Calculate $y = x * 2^{-n}$.\\n uint256 y = xUint >> n;\\n\\n // If y is the unit number, the fractional part is zero.\\n if (y == uUNIT) {\\n return wrap(resultUint);\\n }\\n\\n // Calculate the fractional part via the iterative approximation.\\n // The `delta >>= 1` part is equivalent to `delta /= 2`, but shifting bits is more gas efficient.\\n uint256 DOUBLE_UNIT = 2e18;\\n for (uint256 delta = uHALF_UNIT; delta > 0; delta >>= 1) {\\n y = (y * y) / uUNIT;\\n\\n // Is y^2 >= 2e18 and so in the range [2e18, 4e18)?\\n if (y >= DOUBLE_UNIT) {\\n // Add the 2^{-m} factor to the logarithm.\\n resultUint += delta;\\n\\n // Halve y, which corresponds to z/2 in the Wikipedia article.\\n y >>= 1;\\n }\\n }\\n result = wrap(resultUint);\\n }\\n}\\n\\n/// @notice Multiplies two UD60x18 numbers together, returning a new UD60x18 number.\\n///\\n/// @dev Uses {Common.mulDiv} to enable overflow-safe multiplication and division.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv}.\\n///\\n/// @dev See the documentation in {Common.mulDiv18}.\\n/// @param x The multiplicand as a UD60x18 number.\\n/// @param y The multiplier as a UD60x18 number.\\n/// @return result The product as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mul(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(Common.mulDiv18(x.unwrap(), y.unwrap()));\\n}\\n\\n/// @notice Raises x to the power of y.\\n///\\n/// For $1 \\\\leq x \\\\leq \\\\infty$, the following standard formula is used:\\n///\\n/// $$\\n/// x^y = 2^{log_2{x} * y}\\n/// $$\\n///\\n/// For $0 \\\\leq x \\\\lt 1$, since the unsigned {log2} is undefined, an equivalent formula is used:\\n///\\n/// $$\\n/// i = \\\\frac{1}{x}\\n/// w = 2^{log_2{i} * y}\\n/// x^y = \\\\frac{1}{w}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2} and {mul}.\\n/// - Returns `UNIT` for 0^0.\\n/// - It may not perform well with very small values of x. Consider using SD59x18 as an alternative.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {exp2}, {log2}, and {mul}.\\n///\\n/// @param x The base as a UD60x18 number.\\n/// @param y The exponent as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction pow(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n uint256 yUint = y.unwrap();\\n\\n // If both x and y are zero, the result is `UNIT`. If just x is zero, the result is always zero.\\n if (xUint == 0) {\\n return yUint == 0 ? UNIT : ZERO;\\n }\\n // If x is `UNIT`, the result is always `UNIT`.\\n else if (xUint == uUNIT) {\\n return UNIT;\\n }\\n\\n // If y is zero, the result is always `UNIT`.\\n if (yUint == 0) {\\n return UNIT;\\n }\\n // If y is `UNIT`, the result is always x.\\n else if (yUint == uUNIT) {\\n return x;\\n }\\n\\n // If x is greater than `UNIT`, use the standard formula.\\n if (xUint > uUNIT) {\\n result = exp2(mul(log2(x), y));\\n }\\n // Conversely, if x is less than `UNIT`, use the equivalent formula.\\n else {\\n UD60x18 i = wrap(uUNIT_SQUARED / xUint);\\n UD60x18 w = exp2(mul(log2(i), y));\\n result = wrap(uUNIT_SQUARED / w.unwrap());\\n }\\n}\\n\\n/// @notice Raises x (a UD60x18 number) to the power y (an unsigned basic integer) using the well-known\\n/// algorithm \\\"exponentiation by squaring\\\".\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Exponentiation_by_squaring.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv18}.\\n/// - Returns `UNIT` for 0^0.\\n///\\n/// Requirements:\\n/// - The result must fit in UD60x18.\\n///\\n/// @param x The base as a UD60x18 number.\\n/// @param y The exponent as a uint256.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction powu(UD60x18 x, uint256 y) pure returns (UD60x18 result) {\\n // Calculate the first iteration of the loop in advance.\\n uint256 xUint = x.unwrap();\\n uint256 resultUint = y & 1 > 0 ? xUint : uUNIT;\\n\\n // Equivalent to `for(y /= 2; y > 0; y /= 2)`.\\n for (y >>= 1; y > 0; y >>= 1) {\\n xUint = Common.mulDiv18(xUint, xUint);\\n\\n // Equivalent to `y % 2 == 1`.\\n if (y & 1 > 0) {\\n resultUint = Common.mulDiv18(resultUint, xUint);\\n }\\n }\\n result = wrap(resultUint);\\n}\\n\\n/// @notice Calculates the square root of x using the Babylonian method.\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\\n///\\n/// Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x must be less than `MAX_UD60x18 / UNIT`.\\n///\\n/// @param x The UD60x18 number for which to calculate the square root.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction sqrt(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n unchecked {\\n if (xUint > uMAX_UD60x18 / uUNIT) {\\n revert Errors.PRBMath_UD60x18_Sqrt_Overflow(x);\\n }\\n // Multiply x by `UNIT` to account for the factor of `UNIT` picked up when multiplying two UD60x18 numbers.\\n // In this case, the two numbers are both the square root.\\n result = wrap(Common.sqrt(xUint * uUNIT));\\n }\\n}\\n\",\"keccak256\":\"0x462144667aac3f96d5f8dba7aa68fe4c5a3f61e1d7bbbc81bee21168817f9c09\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\nimport \\\"./Helpers.sol\\\" as Helpers;\\nimport \\\"./Math.sol\\\" as Math;\\n\\n/// @notice The unsigned 60.18-decimal fixed-point number representation, which can have up to 60 digits and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the Solidity type uint256.\\n/// @dev The value type is defined here so it can be imported in all other files.\\ntype UD60x18 is uint256;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoSD1x18,\\n Casting.intoUD2x18,\\n Casting.intoSD59x18,\\n Casting.intoUint128,\\n Casting.intoUint256,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for UD60x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n MATHEMATICAL FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes the functions in this library callable on the UD60x18 type.\\nusing {\\n Math.avg,\\n Math.ceil,\\n Math.div,\\n Math.exp,\\n Math.exp2,\\n Math.floor,\\n Math.frac,\\n Math.gm,\\n Math.inv,\\n Math.ln,\\n Math.log10,\\n Math.log2,\\n Math.mul,\\n Math.pow,\\n Math.powu,\\n Math.sqrt\\n} for UD60x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n HELPER FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes the functions in this library callable on the UD60x18 type.\\nusing {\\n Helpers.add,\\n Helpers.and,\\n Helpers.eq,\\n Helpers.gt,\\n Helpers.gte,\\n Helpers.isZero,\\n Helpers.lshift,\\n Helpers.lt,\\n Helpers.lte,\\n Helpers.mod,\\n Helpers.neq,\\n Helpers.not,\\n Helpers.or,\\n Helpers.rshift,\\n Helpers.sub,\\n Helpers.uncheckedAdd,\\n Helpers.uncheckedSub,\\n Helpers.xor\\n} for UD60x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n OPERATORS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes it possible to use these operators on the UD60x18 type.\\nusing {\\n Helpers.add as +,\\n Helpers.and2 as &,\\n Math.div as /,\\n Helpers.eq as ==,\\n Helpers.gt as >,\\n Helpers.gte as >=,\\n Helpers.lt as <,\\n Helpers.lte as <=,\\n Helpers.or as |,\\n Helpers.mod as %,\\n Math.mul as *,\\n Helpers.neq as !=,\\n Helpers.not as ~,\\n Helpers.sub as -,\\n Helpers.xor as ^\\n} for UD60x18 global;\\n\",\"keccak256\":\"0xdd873b5124180d9b71498b3a7fe93b1c08c368bec741f7d5f8e17f78a0b70f31\",\"license\":\"MIT\"},\"contracts/interfaces/IERC6551Registry.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\ninterface IERC6551Registry {\\n /**\\n * @dev Creates a token bound account for a non-fungible token.\\n *\\n * If account has already been created, returns the account address without calling create2.\\n *\\n * Emits ERC6551AccountCreated event.\\n *\\n * @return account The address of the token bound account\\n */\\n function createAccount(\\n address implementation,\\n bytes32 salt,\\n uint256 chainId,\\n address tokenContract,\\n uint256 tokenId\\n ) external returns (address account);\\n}\\n\",\"keccak256\":\"0x64c52de8a8e68398e61dd8b42dda8e9af8cf6abf93bb85629c322440991ea568\",\"license\":\"MIT\"},\"contracts/interfaces/hats/HatsErrors.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface HatsErrors {\\n /// @notice Emitted when `user` is attempting to perform an action on `hatId` but is not wearing one of `hatId`'s admin hats\\n /// @dev Can be equivalent to `NotHatWearer(buildHatId(hatId))`, such as when emitted by `approveLinkTopHatToTree` or `relinkTopHatToTree`\\n error NotAdmin(address user, uint256 hatId);\\n\\n /// @notice Emitted when attempting to perform an action as or for an account that is not a wearer of a given hat\\n error NotHatWearer();\\n\\n /// @notice Emitted when attempting to perform an action that requires being either an admin or wearer of a given hat\\n error NotAdminOrWearer();\\n\\n /// @notice Emitted when attempting to mint `hatId` but `hatId`'s maxSupply has been reached\\n error AllHatsWorn(uint256 hatId);\\n\\n /// @notice Emitted when attempting to create a hat with a level 14 hat as its admin\\n error MaxLevelsReached();\\n\\n /// @notice Emitted when an attempted hat id has empty intermediate level(s)\\n error InvalidHatId();\\n\\n /// @notice Emitted when attempting to mint `hatId` to a `wearer` who is already wearing the hat\\n error AlreadyWearingHat(address wearer, uint256 hatId);\\n\\n /// @notice Emitted when attempting to mint a non-existant hat\\n error HatDoesNotExist(uint256 hatId);\\n\\n /// @notice Emmitted when attempting to mint or transfer a hat that is not active\\n error HatNotActive();\\n\\n /// @notice Emitted when attempting to mint or transfer a hat to an ineligible wearer\\n error NotEligible();\\n\\n /// @notice Emitted when attempting to check or set a hat's status from an account that is not that hat's toggle module\\n error NotHatsToggle();\\n\\n /// @notice Emitted when attempting to check or set a hat wearer's status from an account that is not that hat's eligibility module\\n error NotHatsEligibility();\\n\\n /// @notice Emitted when array arguments to a batch function have mismatching lengths\\n error BatchArrayLengthMismatch();\\n\\n /// @notice Emitted when attempting to mutate or transfer an immutable hat\\n error Immutable();\\n\\n /// @notice Emitted when attempting to change a hat's maxSupply to a value lower than its current supply\\n error NewMaxSupplyTooLow();\\n\\n /// @notice Emitted when attempting to link a tophat to a new admin for which the tophat serves as an admin\\n error CircularLinkage();\\n\\n /// @notice Emitted when attempting to link or relink a tophat to a separate tree\\n error CrossTreeLinkage();\\n\\n /// @notice Emitted when attempting to link a tophat without a request\\n error LinkageNotRequested();\\n\\n /// @notice Emitted when attempting to unlink a tophat that does not have a wearer\\n /// @dev This ensures that unlinking never results in a bricked tophat\\n error InvalidUnlink();\\n\\n /// @notice Emmited when attempting to change a hat's eligibility or toggle module to the zero address\\n error ZeroAddress();\\n\\n /// @notice Emmitted when attempting to change a hat's details or imageURI to a string with over 7000 bytes (~characters)\\n /// @dev This protects against a DOS attack where an admin iteratively extend's a hat's details or imageURI\\n /// to be so long that reading it exceeds the block gas limit, breaking `uri()` and `viewHat()`\\n error StringTooLong();\\n}\\n\",\"keccak256\":\"0x81b0056b7bed86eabc07c0e4a9655c586ddb8e6c128320593669b76efd5a08de\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/HatsEvents.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface HatsEvents {\\n /// @notice Emitted when a new hat is created\\n /// @param id The id for the new hat\\n /// @param details A description of the Hat\\n /// @param maxSupply The total instances of the Hat that can be worn at once\\n /// @param eligibility The address that can report on the Hat wearer's status\\n /// @param toggle The address that can deactivate the Hat\\n /// @param mutable_ Whether the hat's properties are changeable after creation\\n /// @param imageURI The image uri for this hat and the fallback for its\\n event HatCreated(\\n uint256 id,\\n string details,\\n uint32 maxSupply,\\n address eligibility,\\n address toggle,\\n bool mutable_,\\n string imageURI\\n );\\n\\n /// @notice Emitted when a hat wearer's standing is updated\\n /// @dev Eligibility is excluded since the source of truth for eligibility is the eligibility module and may change without a transaction\\n /// @param hatId The id of the wearer's hat\\n /// @param wearer The wearer's address\\n /// @param wearerStanding Whether the wearer is in good standing for the hat\\n event WearerStandingChanged(\\n uint256 hatId,\\n address wearer,\\n bool wearerStanding\\n );\\n\\n /// @notice Emitted when a hat's status is updated\\n /// @param hatId The id of the hat\\n /// @param newStatus Whether the hat is active\\n event HatStatusChanged(uint256 hatId, bool newStatus);\\n\\n /// @notice Emitted when a hat's details are updated\\n /// @param hatId The id of the hat\\n /// @param newDetails The updated details\\n event HatDetailsChanged(uint256 hatId, string newDetails);\\n\\n /// @notice Emitted when a hat's eligibility module is updated\\n /// @param hatId The id of the hat\\n /// @param newEligibility The updated eligibiliy module\\n event HatEligibilityChanged(uint256 hatId, address newEligibility);\\n\\n /// @notice Emitted when a hat's toggle module is updated\\n /// @param hatId The id of the hat\\n /// @param newToggle The updated toggle module\\n event HatToggleChanged(uint256 hatId, address newToggle);\\n\\n /// @notice Emitted when a hat's mutability is updated\\n /// @param hatId The id of the hat\\n event HatMutabilityChanged(uint256 hatId);\\n\\n /// @notice Emitted when a hat's maximum supply is updated\\n /// @param hatId The id of the hat\\n /// @param newMaxSupply The updated max supply\\n event HatMaxSupplyChanged(uint256 hatId, uint32 newMaxSupply);\\n\\n /// @notice Emitted when a hat's image URI is updated\\n /// @param hatId The id of the hat\\n /// @param newImageURI The updated image URI\\n event HatImageURIChanged(uint256 hatId, string newImageURI);\\n\\n /// @notice Emitted when a tophat linkage is requested by its admin\\n /// @param domain The domain of the tree tophat to link\\n /// @param newAdmin The tophat's would-be admin in the parent tree\\n event TopHatLinkRequested(uint32 domain, uint256 newAdmin);\\n\\n /// @notice Emitted when a tophat is linked to a another tree\\n /// @param domain The domain of the newly-linked tophat\\n /// @param newAdmin The tophat's new admin in the parent tree\\n event TopHatLinked(uint32 domain, uint256 newAdmin);\\n}\\n\",\"keccak256\":\"0x53413397d15e1636c3cd7bd667656b79bc2886785403b824bcd4ed122667f2c6\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/IHats.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\nimport \\\"./IHatsIdUtilities.sol\\\";\\nimport \\\"./HatsErrors.sol\\\";\\nimport \\\"./HatsEvents.sol\\\";\\n\\ninterface IHats is IHatsIdUtilities, HatsErrors, HatsEvents {\\n function mintTopHat(\\n address _target,\\n string memory _details,\\n string memory _imageURI\\n ) external returns (uint256 topHatId);\\n\\n function createHat(\\n uint256 _admin,\\n string calldata _details,\\n uint32 _maxSupply,\\n address _eligibility,\\n address _toggle,\\n bool _mutable,\\n string calldata _imageURI\\n ) external returns (uint256 newHatId);\\n\\n function batchCreateHats(\\n uint256[] calldata _admins,\\n string[] calldata _details,\\n uint32[] calldata _maxSupplies,\\n address[] memory _eligibilityModules,\\n address[] memory _toggleModules,\\n bool[] calldata _mutables,\\n string[] calldata _imageURIs\\n ) external returns (bool success);\\n\\n function getNextId(uint256 _admin) external view returns (uint256 nextId);\\n\\n function mintHat(\\n uint256 _hatId,\\n address _wearer\\n ) external returns (bool success);\\n\\n function batchMintHats(\\n uint256[] calldata _hatIds,\\n address[] calldata _wearers\\n ) external returns (bool success);\\n\\n function setHatStatus(\\n uint256 _hatId,\\n bool _newStatus\\n ) external returns (bool toggled);\\n\\n function checkHatStatus(uint256 _hatId) external returns (bool toggled);\\n\\n function setHatWearerStatus(\\n uint256 _hatId,\\n address _wearer,\\n bool _eligible,\\n bool _standing\\n ) external returns (bool updated);\\n\\n function checkHatWearerStatus(\\n uint256 _hatId,\\n address _wearer\\n ) external returns (bool updated);\\n\\n function renounceHat(uint256 _hatId) external;\\n\\n function transferHat(uint256 _hatId, address _from, address _to) external;\\n\\n /*//////////////////////////////////////////////////////////////\\n HATS ADMIN FUNCTIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n function makeHatImmutable(uint256 _hatId) external;\\n\\n function changeHatDetails(\\n uint256 _hatId,\\n string memory _newDetails\\n ) external;\\n\\n function changeHatEligibility(\\n uint256 _hatId,\\n address _newEligibility\\n ) external;\\n\\n function changeHatToggle(uint256 _hatId, address _newToggle) external;\\n\\n function changeHatImageURI(\\n uint256 _hatId,\\n string memory _newImageURI\\n ) external;\\n\\n function changeHatMaxSupply(uint256 _hatId, uint32 _newMaxSupply) external;\\n\\n function requestLinkTopHatToTree(\\n uint32 _topHatId,\\n uint256 _newAdminHat\\n ) external;\\n\\n function approveLinkTopHatToTree(\\n uint32 _topHatId,\\n uint256 _newAdminHat,\\n address _eligibility,\\n address _toggle,\\n string calldata _details,\\n string calldata _imageURI\\n ) external;\\n\\n function unlinkTopHatFromTree(uint32 _topHatId, address _wearer) external;\\n\\n function relinkTopHatWithinTree(\\n uint32 _topHatDomain,\\n uint256 _newAdminHat,\\n address _eligibility,\\n address _toggle,\\n string calldata _details,\\n string calldata _imageURI\\n ) external;\\n\\n /*//////////////////////////////////////////////////////////////\\n VIEW FUNCTIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n function viewHat(\\n uint256 _hatId\\n )\\n external\\n view\\n returns (\\n string memory details,\\n uint32 maxSupply,\\n uint32 supply,\\n address eligibility,\\n address toggle,\\n string memory imageURI,\\n uint16 lastHatId,\\n bool mutable_,\\n bool active\\n );\\n\\n function isWearerOfHat(\\n address _user,\\n uint256 _hatId\\n ) external view returns (bool isWearer);\\n\\n function isAdminOfHat(\\n address _user,\\n uint256 _hatId\\n ) external view returns (bool isAdmin);\\n\\n function isInGoodStanding(\\n address _wearer,\\n uint256 _hatId\\n ) external view returns (bool standing);\\n\\n function isEligible(\\n address _wearer,\\n uint256 _hatId\\n ) external view returns (bool eligible);\\n\\n function getHatEligibilityModule(\\n uint256 _hatId\\n ) external view returns (address eligibility);\\n\\n function getHatToggleModule(\\n uint256 _hatId\\n ) external view returns (address toggle);\\n\\n function getHatMaxSupply(\\n uint256 _hatId\\n ) external view returns (uint32 maxSupply);\\n\\n function hatSupply(uint256 _hatId) external view returns (uint32 supply);\\n\\n function getImageURIForHat(\\n uint256 _hatId\\n ) external view returns (string memory _uri);\\n\\n function balanceOf(\\n address wearer,\\n uint256 hatId\\n ) external view returns (uint256 balance);\\n\\n function balanceOfBatch(\\n address[] calldata _wearers,\\n uint256[] calldata _hatIds\\n ) external view returns (uint256[] memory);\\n\\n function uri(uint256 id) external view returns (string memory _uri);\\n}\\n\",\"keccak256\":\"0x2867004bddc5148fa1937f25c0403e5d9977583aaf50fdbdb74bd463f64f21c8\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/IHatsIdUtilities.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface IHatsIdUtilities {\\n function buildHatId(\\n uint256 _admin,\\n uint16 _newHat\\n ) external pure returns (uint256 id);\\n\\n function getHatLevel(uint256 _hatId) external view returns (uint32 level);\\n\\n function getLocalHatLevel(\\n uint256 _hatId\\n ) external pure returns (uint32 level);\\n\\n function isTopHat(uint256 _hatId) external view returns (bool _topHat);\\n\\n function isLocalTopHat(\\n uint256 _hatId\\n ) external pure returns (bool _localTopHat);\\n\\n function isValidHatId(\\n uint256 _hatId\\n ) external view returns (bool validHatId);\\n\\n function getAdminAtLevel(\\n uint256 _hatId,\\n uint32 _level\\n ) external view returns (uint256 admin);\\n\\n function getAdminAtLocalLevel(\\n uint256 _hatId,\\n uint32 _level\\n ) external pure returns (uint256 admin);\\n\\n function getTopHatDomain(\\n uint256 _hatId\\n ) external view returns (uint32 domain);\\n\\n function getTippyTopHatDomain(\\n uint32 _topHatDomain\\n ) external view returns (uint32 domain);\\n\\n function noCircularLinkage(\\n uint32 _topHatDomain,\\n uint256 _linkedAdmin\\n ) external view returns (bool notCircular);\\n\\n function sameTippyTopHatDomain(\\n uint32 _topHatDomain,\\n uint256 _newAdminHat\\n ) external view returns (bool sameDomain);\\n}\\n\",\"keccak256\":\"0x007fcc07b20bf84bacad1f9a2ddf4e30e1a8be961e144b7bef8e98a51781aee9\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/IHatsModuleFactory.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.19;\\n\\ninterface IHatsModuleFactory {\\n error HatsModuleFactory_ModuleAlreadyDeployed(\\n address implementation,\\n uint256 hatId,\\n bytes otherImmutableArgs,\\n uint256 saltNonce\\n );\\n\\n error BatchArrayLengthMismatch();\\n\\n event HatsModuleFactory_ModuleDeployed(\\n address implementation,\\n address instance,\\n uint256 hatId,\\n bytes otherImmutableArgs,\\n bytes initData,\\n uint256 saltNonce\\n );\\n\\n function HATS() external view returns (address);\\n\\n function version() external view returns (string memory);\\n\\n function createHatsModule(\\n address _implementation,\\n uint256 _hatId,\\n bytes calldata _otherImmutableArgs,\\n bytes calldata _initData,\\n uint256 _saltNonce\\n ) external returns (address _instance);\\n\\n function batchCreateHatsModule(\\n address[] calldata _implementations,\\n uint256[] calldata _hatIds,\\n bytes[] calldata _otherImmutableArgsArray,\\n bytes[] calldata _initDataArray,\\n uint256[] calldata _saltNonces\\n ) external returns (bool success);\\n\\n function getHatsModuleAddress(\\n address _implementation,\\n uint256 _hatId,\\n bytes calldata _otherImmutableArgs,\\n uint256 _saltNonce\\n ) external view returns (address);\\n\\n function deployed(\\n address _implementation,\\n uint256 _hatId,\\n bytes calldata _otherImmutableArgs,\\n uint256 _saltNonce\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x861faf40785cedb829243116d492653414a367853408a5c27d201522f6c3bfdd\",\"license\":\"MIT\"},\"contracts/interfaces/hats/modules/IHatsElectionsEligibility.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.13;\\n\\ninterface IHatsElectionsEligibility {\\n event ElectionOpened(uint128 nextTermEnd);\\n event ElectionCompleted(uint128 termEnd, address[] winners);\\n event NewTermStarted(uint128 termEnd);\\n event Recalled(uint128 termEnd, address[] accounts);\\n\\n /// @notice Returns the first second after the current term ends.\\n /// @dev Also serves as the id for the current term.\\n function currentTermEnd() external view returns (uint128);\\n\\n /// @notice Returns the first second after the next term ends.\\n /// @dev Also serves as the id for the next term.\\n function nextTermEnd() external view returns (uint128);\\n\\n /// @notice Returns the election status (open or closed) for a given term end.\\n /// @param termEnd The term end timestamp to query.\\n function electionStatus(\\n uint128 termEnd\\n ) external view returns (bool isElectionOpen);\\n\\n /// @notice Returns whether a candidate was elected in a given term.\\n /// @param termEnd The term end timestamp to query.\\n /// @param candidate The address of the candidate.\\n function electionResults(\\n uint128 termEnd,\\n address candidate\\n ) external view returns (bool elected);\\n\\n /// @notice Returns the BALLOT_BOX_HAT constant.\\n function BALLOT_BOX_HAT() external pure returns (uint256);\\n\\n /// @notice Returns the ADMIN_HAT constant.\\n function ADMIN_HAT() external pure returns (uint256);\\n\\n /**\\n * @notice Submit the results of an election for a specified term.\\n * @dev Only callable by the wearer(s) of the BALLOT_BOX_HAT.\\n * @param _termEnd The id of the term for which the election results are being submitted.\\n * @param _winners The addresses of the winners of the election.\\n */\\n function elect(uint128 _termEnd, address[] calldata _winners) external;\\n\\n /**\\n * @notice Submit the results of a recall election for a specified term.\\n * @dev Only callable by the wearer(s) of the BALLOT_BOX_HAT.\\n * @param _termEnd The id of the term for which the recall results are being submitted.\\n * @param _recallees The addresses to be recalled.\\n */\\n function recall(uint128 _termEnd, address[] calldata _recallees) external;\\n\\n /**\\n * @notice Set the next term and open the election for it.\\n * @dev Only callable by the wearer(s) of the ADMIN_HAT.\\n * @param _newTermEnd The id of the term that will be opened.\\n */\\n function setNextTerm(uint128 _newTermEnd) external;\\n\\n /**\\n * @notice Start the next term, updating the current term.\\n * @dev Can be called by anyone, but will revert if conditions are not met.\\n */\\n function startNextTerm() external;\\n\\n /**\\n * @notice Determine the eligibility and standing of a wearer for a hat.\\n * @param _wearer The address of the hat wearer.\\n * @param _hatId The ID of the hat.\\n * @return eligible True if the wearer is eligible for the hat.\\n * @return standing True if the wearer is in good standing.\\n */\\n function getWearerStatus(\\n address _wearer,\\n uint256 _hatId\\n ) external view returns (bool eligible, bool standing);\\n}\\n\",\"keccak256\":\"0x74dfc5d538d866ddb8ee2ca1b569abf62e02d848c59f308adf6075ecff175c7d\",\"license\":\"MIT\"},\"contracts/interfaces/sablier/IAdminable.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\n/// @title IAdminable\\n/// @notice Contract module that provides a basic access control mechanism, with an admin that can be\\n/// granted exclusive access to specific functions. The inheriting contract must set the initial admin\\n/// in the constructor.\\ninterface IAdminable {\\n /*//////////////////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Emitted when the admin is transferred.\\n /// @param oldAdmin The address of the old admin.\\n /// @param newAdmin The address of the new admin.\\n event TransferAdmin(address indexed oldAdmin, address indexed newAdmin);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice The address of the admin account or contract.\\n function admin() external view returns (address);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n NON-CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Transfers the contract admin to a new address.\\n ///\\n /// @dev Notes:\\n /// - Does not revert if the admin is the same.\\n /// - This function can potentially leave the contract without an admin, thereby removing any\\n /// functionality that is only available to the admin.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the contract admin.\\n ///\\n /// @param newAdmin The address of the new admin.\\n function transferAdmin(address newAdmin) external;\\n}\\n\",\"keccak256\":\"0xa279c49e51228b571329164e36250e82b2c1378e8b549194ab7dd90fca9c3b2b\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/IERC4096.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 \\\"@openzeppelin/contracts/interfaces/IERC165.sol\\\";\\nimport {IERC721} from \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\n\\n/// @title ERC-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\",\"keccak256\":\"0xa34b9c52cbe36be860244f52256f1b05badf0cb797d208664b87337610d0e82d\",\"license\":\"MIT\"},\"contracts/interfaces/sablier/ISablierV2Lockup.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC4906} from \\\"./IERC4096.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IERC721Metadata} from \\\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\\\";\\nimport {UD60x18} from \\\"@prb/math/src/UD60x18.sol\\\";\\n\\nimport {Lockup} from \\\"./types/DataTypes.sol\\\";\\nimport {IAdminable} from \\\"./IAdminable.sol\\\";\\nimport {ISablierV2NFTDescriptor} from \\\"./ISablierV2NFTDescriptor.sol\\\";\\n\\n/// @title ISablierV2Lockup\\n/// @notice Common logic between all Sablier V2 Lockup contracts.\\ninterface ISablierV2Lockup is\\n IAdminable, // 0 inherited components\\n IERC4906, // 2 inherited components\\n IERC721Metadata // 2 inherited components\\n{\\n /*//////////////////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Emitted when the admin allows a new recipient contract to hook to Sablier.\\n /// @param admin The address of the current contract admin.\\n /// @param recipient The address of the recipient contract put on the allowlist.\\n event AllowToHook(address indexed admin, address recipient);\\n\\n /// @notice Emitted when a stream is canceled.\\n /// @param streamId The ID of the stream.\\n /// @param sender The address of the stream's sender.\\n /// @param recipient The address of the stream's recipient.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param senderAmount The amount of assets refunded to the stream's sender, denoted in units of the asset's\\n /// decimals.\\n /// @param recipientAmount The amount of assets left for the stream's recipient to withdraw, denoted in units of the\\n /// asset's decimals.\\n event CancelLockupStream(\\n uint256 streamId,\\n address indexed sender,\\n address indexed recipient,\\n IERC20 indexed asset,\\n uint128 senderAmount,\\n uint128 recipientAmount\\n );\\n\\n /// @notice Emitted when a sender gives up the right to cancel a stream.\\n /// @param streamId The ID of the stream.\\n event RenounceLockupStream(uint256 indexed streamId);\\n\\n /// @notice Emitted when the admin sets a new NFT descriptor contract.\\n /// @param admin The address of the current contract admin.\\n /// @param oldNFTDescriptor The address of the old NFT descriptor contract.\\n /// @param newNFTDescriptor The address of the new NFT descriptor contract.\\n event SetNFTDescriptor(\\n address indexed admin,\\n ISablierV2NFTDescriptor oldNFTDescriptor,\\n ISablierV2NFTDescriptor newNFTDescriptor\\n );\\n\\n /// @notice Emitted when assets are withdrawn from a stream.\\n /// @param streamId The ID of the stream.\\n /// @param to The address that has received the withdrawn assets.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param amount The amount of assets withdrawn, denoted in units of the asset's decimals.\\n event WithdrawFromLockupStream(\\n uint256 indexed streamId,\\n address indexed to,\\n IERC20 indexed asset,\\n uint128 amount\\n );\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Retrieves the address of the ERC-20 asset to be distributed.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getAsset(uint256 streamId) external view returns (IERC20 asset);\\n\\n /// @notice Retrieves the amount deposited in the stream, denoted in units of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getDepositedAmount(\\n uint256 streamId\\n ) external view returns (uint128 depositedAmount);\\n\\n /// @notice Retrieves the stream's end time, which is a Unix timestamp.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getEndTime(\\n uint256 streamId\\n ) external view returns (uint40 endTime);\\n\\n /// @notice Retrieves the stream's recipient.\\n /// @dev Reverts if the NFT has been burned.\\n /// @param streamId The stream ID for the query.\\n function getRecipient(\\n uint256 streamId\\n ) external view returns (address recipient);\\n\\n /// @notice Retrieves the amount refunded to the sender after a cancellation, denoted in units of the asset's\\n /// decimals. This amount is always zero unless the stream was canceled.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getRefundedAmount(\\n uint256 streamId\\n ) external view returns (uint128 refundedAmount);\\n\\n /// @notice Retrieves the stream's sender.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getSender(uint256 streamId) external view returns (address sender);\\n\\n /// @notice Retrieves the stream's start time, which is a Unix timestamp.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getStartTime(\\n uint256 streamId\\n ) external view returns (uint40 startTime);\\n\\n /// @notice Retrieves the amount withdrawn from the stream, denoted in units of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getWithdrawnAmount(\\n uint256 streamId\\n ) external view returns (uint128 withdrawnAmount);\\n\\n /// @notice Retrieves a flag indicating whether the provided address is a contract allowed to hook to Sablier\\n /// when a stream is canceled or when assets are withdrawn.\\n /// @dev See {ISablierLockupRecipient} for more information.\\n function isAllowedToHook(\\n address recipient\\n ) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream can be canceled. When the stream is cold, this\\n /// flag is always `false`.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isCancelable(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream is cold, i.e. settled, canceled, or depleted.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isCold(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream is depleted.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isDepleted(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream exists.\\n /// @dev Does not revert if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isStream(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream NFT can be transferred.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isTransferable(\\n uint256 streamId\\n ) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream is warm, i.e. either pending or streaming.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isWarm(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves the maximum broker fee that can be charged by the broker, denoted as a fixed-point\\n /// number where 1e18 is 100%.\\n /// @dev This value is hard coded as a constant.\\n function MAX_BROKER_FEE() external view returns (UD60x18);\\n\\n /// @notice Counter for stream IDs, used in the create functions.\\n function nextStreamId() external view returns (uint256);\\n\\n /// @notice Contract that generates the non-fungible token URI.\\n function nftDescriptor() external view returns (ISablierV2NFTDescriptor);\\n\\n /// @notice Calculates the amount that the sender would be refunded if the stream were canceled, denoted in units\\n /// of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function refundableAmountOf(\\n uint256 streamId\\n ) external view returns (uint128 refundableAmount);\\n\\n /// @notice Retrieves the stream's status.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function statusOf(\\n uint256 streamId\\n ) external view returns (Lockup.Status status);\\n\\n /// @notice Calculates the amount streamed to the recipient, denoted in units of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n ///\\n /// Notes:\\n /// - Upon cancellation of the stream, the amount streamed is calculated as the difference between the deposited\\n /// amount and the refunded amount. Ultimately, when the stream becomes depleted, the streamed amount is equivalent\\n /// to the total amount withdrawn.\\n ///\\n /// @param streamId The stream ID for the query.\\n function streamedAmountOf(\\n uint256 streamId\\n ) external view returns (uint128 streamedAmount);\\n\\n /// @notice Retrieves a flag indicating whether the stream was canceled.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function wasCanceled(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Calculates the amount that the recipient can withdraw from the stream, denoted in units of the asset's\\n /// decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function withdrawableAmountOf(\\n uint256 streamId\\n ) external view returns (uint128 withdrawableAmount);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n NON-CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Allows a recipient contract to hook to Sablier when a stream is canceled or when assets are withdrawn.\\n /// Useful for implementing contracts that hold streams on behalf of users, such as vaults or staking contracts.\\n ///\\n /// @dev Emits an {AllowToHook} event.\\n ///\\n /// Notes:\\n /// - Does not revert if the contract is already on the allowlist.\\n /// - This is an irreversible operation. The contract cannot be removed from the allowlist.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the contract admin.\\n /// - `recipient` must have a non-zero code size.\\n /// - `recipient` must implement {ISablierLockupRecipient}.\\n ///\\n /// @param recipient The address of the contract to allow for hooks.\\n function allowToHook(address recipient) external;\\n\\n /// @notice Burns the NFT associated with the stream.\\n ///\\n /// @dev Emits a {Transfer} event.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `streamId` must reference a depleted stream.\\n /// - The NFT must exist.\\n /// - `msg.sender` must be either the NFT owner or an approved third party.\\n ///\\n /// @param streamId The ID of the stream NFT to burn.\\n function burn(uint256 streamId) external;\\n\\n /// @notice Cancels the stream and refunds any remaining assets to the sender.\\n ///\\n /// @dev Emits a {Transfer}, {CancelLockupStream}, and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - If there any assets left for the recipient to withdraw, the stream is marked as canceled. Otherwise, the\\n /// stream is marked as depleted.\\n /// - This function attempts to invoke a hook on the recipient, if the resolved address is a contract.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - The stream must be warm and cancelable.\\n /// - `msg.sender` must be the stream's sender.\\n ///\\n /// @param streamId The ID of the stream to cancel.\\n function cancel(uint256 streamId) external;\\n\\n /// @notice Cancels multiple streams and refunds any remaining assets to the sender.\\n ///\\n /// @dev Emits multiple {Transfer}, {CancelLockupStream}, and {MetadataUpdate} events.\\n ///\\n /// Notes:\\n /// - Refer to the notes in {cancel}.\\n ///\\n /// Requirements:\\n /// - All requirements from {cancel} must be met for each stream.\\n ///\\n /// @param streamIds The IDs of the streams to cancel.\\n function cancelMultiple(uint256[] calldata streamIds) external;\\n\\n /// @notice Removes the right of the stream's sender to cancel the stream.\\n ///\\n /// @dev Emits a {RenounceLockupStream} and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - This is an irreversible operation.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `streamId` must reference a warm stream.\\n /// - `msg.sender` must be the stream's sender.\\n /// - The stream must be cancelable.\\n ///\\n /// @param streamId The ID of the stream to renounce.\\n function renounce(uint256 streamId) external;\\n\\n /// @notice Sets a new NFT descriptor contract, which produces the URI describing the Sablier stream NFTs.\\n ///\\n /// @dev Emits a {SetNFTDescriptor} and {BatchMetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - Does not revert if the NFT descriptor is the same.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the contract admin.\\n ///\\n /// @param newNFTDescriptor The address of the new NFT descriptor contract.\\n function setNFTDescriptor(\\n ISablierV2NFTDescriptor newNFTDescriptor\\n ) external;\\n\\n /// @notice Withdraws the provided amount of assets from the stream to the `to` address.\\n ///\\n /// @dev Emits a {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - This function attempts to call a hook on the recipient of the stream, unless `msg.sender` is the recipient.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `streamId` must not reference a null or depleted stream.\\n /// - `to` must not be the zero address.\\n /// - `amount` must be greater than zero and must not exceed the withdrawable amount.\\n /// - `to` must be the recipient if `msg.sender` is not the stream's recipient or an approved third party.\\n ///\\n /// @param streamId The ID of the stream to withdraw from.\\n /// @param to The address receiving the withdrawn assets.\\n /// @param amount The amount to withdraw, denoted in units of the asset's decimals.\\n function withdraw(uint256 streamId, address to, uint128 amount) external;\\n\\n /// @notice Withdraws the maximum withdrawable amount from the stream to the provided address `to`.\\n ///\\n /// @dev Emits a {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - Refer to the notes in {withdraw}.\\n ///\\n /// Requirements:\\n /// - Refer to the requirements in {withdraw}.\\n ///\\n /// @param streamId The ID of the stream to withdraw from.\\n /// @param to The address receiving the withdrawn assets.\\n /// @return withdrawnAmount The amount withdrawn, denoted in units of the asset's decimals.\\n function withdrawMax(\\n uint256 streamId,\\n address to\\n ) external returns (uint128 withdrawnAmount);\\n\\n /// @notice Withdraws the maximum withdrawable amount from the stream to the current recipient, and transfers the\\n /// NFT to `newRecipient`.\\n ///\\n /// @dev Emits a {WithdrawFromLockupStream} and a {Transfer} event.\\n ///\\n /// Notes:\\n /// - If the withdrawable amount is zero, the withdrawal is skipped.\\n /// - Refer to the notes in {withdraw}.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the stream's recipient.\\n /// - Refer to the requirements in {withdraw}.\\n /// - Refer to the requirements in {IERC721.transferFrom}.\\n ///\\n /// @param streamId The ID of the stream NFT to transfer.\\n /// @param newRecipient The address of the new owner of the stream NFT.\\n /// @return withdrawnAmount The amount withdrawn, denoted in units of the asset's decimals.\\n function withdrawMaxAndTransfer(\\n uint256 streamId,\\n address newRecipient\\n ) external returns (uint128 withdrawnAmount);\\n\\n /// @notice Withdraws assets from streams to the recipient of each stream.\\n ///\\n /// @dev Emits multiple {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} events.\\n ///\\n /// Notes:\\n /// - This function attempts to call a hook on the recipient of each stream, unless `msg.sender` is the recipient.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - There must be an equal number of `streamIds` and `amounts`.\\n /// - Each stream ID in the array must not reference a null or depleted stream.\\n /// - Each amount in the array must be greater than zero and must not exceed the withdrawable amount.\\n ///\\n /// @param streamIds The IDs of the streams to withdraw from.\\n /// @param amounts The amounts to withdraw, denoted in units of the asset's decimals.\\n function withdrawMultiple(\\n uint256[] calldata streamIds,\\n uint128[] calldata amounts\\n ) external;\\n}\\n\",\"keccak256\":\"0x3e5541c38a901637bd310965deb5bbde73ef07fe4ee3c752cbec330c6b9d62a3\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/ISablierV2LockupLinear.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\nimport {Lockup, LockupLinear} from \\\"./types/DataTypes.sol\\\";\\nimport {ISablierV2Lockup} from \\\"./ISablierV2Lockup.sol\\\";\\n\\n/// @title ISablierV2LockupLinear\\n/// @notice Creates and manages Lockup streams with a linear distribution function.\\ninterface ISablierV2LockupLinear is ISablierV2Lockup {\\n /*//////////////////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Emitted when a stream is created.\\n /// @param streamId The ID of the newly created stream.\\n /// @param funder The address which funded the stream.\\n /// @param sender The address distributing the assets, which will have the ability to cancel the stream.\\n /// @param recipient The address receiving the assets.\\n /// @param amounts Struct encapsulating (i) the deposit amount, and (ii) the broker fee amount, both denoted\\n /// in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Boolean indicating whether the stream will be cancelable or not.\\n /// @param transferable Boolean indicating whether the stream NFT is transferable or not.\\n /// @param timestamps Struct encapsulating (i) the stream's start time, (ii) cliff time, and (iii) end time, all as\\n /// Unix timestamps.\\n /// @param broker The address of the broker who has helped create the stream, e.g. a front-end website.\\n event CreateLockupLinearStream(\\n uint256 streamId,\\n address funder,\\n address indexed sender,\\n address indexed recipient,\\n Lockup.CreateAmounts amounts,\\n IERC20 indexed asset,\\n bool cancelable,\\n bool transferable,\\n LockupLinear.Timestamps timestamps,\\n address broker\\n );\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Retrieves the stream's cliff time, which is a Unix timestamp. A value of zero means there\\n /// is no cliff.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getCliffTime(\\n uint256 streamId\\n ) external view returns (uint40 cliffTime);\\n\\n /// @notice Retrieves the full stream details.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n /// @return stream See the documentation in {DataTypes}.\\n function getStream(\\n uint256 streamId\\n ) external view returns (LockupLinear.StreamLL memory stream);\\n\\n /// @notice Retrieves the stream's start, cliff and end timestamps.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n /// @return timestamps See the documentation in {DataTypes}.\\n function getTimestamps(\\n uint256 streamId\\n ) external view returns (LockupLinear.Timestamps memory timestamps);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n NON-CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Creates a stream by setting the start time to `block.timestamp`, and the end time to\\n /// the sum of `block.timestamp` and `params.durations.total`. The stream is funded by `msg.sender` and is wrapped\\n /// in an ERC-721 NFT.\\n ///\\n /// @dev Emits a {Transfer} and {CreateLockupLinearStream} event.\\n ///\\n /// Requirements:\\n /// - All requirements in {createWithTimestamps} must be met for the calculated parameters.\\n ///\\n /// @param params Struct encapsulating the function parameters, which are documented in {DataTypes}.\\n /// @return streamId The ID of the newly created stream.\\n function createWithDurations(\\n LockupLinear.CreateWithDurations calldata params\\n ) external returns (uint256 streamId);\\n\\n /// @notice Creates a stream with the provided start time and end time. The stream is funded by `msg.sender` and is\\n /// wrapped in an ERC-721 NFT.\\n ///\\n /// @dev Emits a {Transfer} and {CreateLockupLinearStream} event.\\n ///\\n /// Notes:\\n /// - A cliff time of zero means there is no cliff.\\n /// - As long as the times are ordered, it is not an error for the start or the cliff time to be in the past.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `params.totalAmount` must be greater than zero.\\n /// - If set, `params.broker.fee` must not be greater than `MAX_BROKER_FEE`.\\n /// - `params.timestamps.start` must be greater than zero and less than `params.timestamps.end`.\\n /// - If set, `params.timestamps.cliff` must be greater than `params.timestamps.start` and less than\\n /// `params.timestamps.end`.\\n /// - `params.timestamps.end` must be in the future.\\n /// - `params.recipient` must not be the zero address.\\n /// - `msg.sender` must have allowed this contract to spend at least `params.totalAmount` assets.\\n ///\\n /// @param params Struct encapsulating the function parameters, which are documented in {DataTypes}.\\n /// @return streamId The ID of the newly created stream.\\n function createWithTimestamps(\\n LockupLinear.CreateWithTimestamps calldata params\\n ) external returns (uint256 streamId);\\n}\\n\",\"keccak256\":\"0x064264723114b1f1cf3953fd79874dfcbb42cf313857aee6d5e6b09a23e0010b\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/ISablierV2NFTDescriptor.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC721Metadata} from \\\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\\\";\\n\\n/// @title ISablierV2NFTDescriptor\\n/// @notice This contract generates the URI describing the Sablier V2 stream NFTs.\\n/// @dev Inspired by Uniswap V3 Positions NFTs.\\ninterface ISablierV2NFTDescriptor {\\n /// @notice Produces the URI describing a particular stream NFT.\\n /// @dev This is a data URI with the JSON contents directly inlined.\\n /// @param sablier The address of the Sablier contract the stream was created in.\\n /// @param streamId The ID of the stream for which to produce a description.\\n /// @return uri The URI of the ERC721-compliant metadata.\\n function tokenURI(\\n IERC721Metadata sablier,\\n uint256 streamId\\n ) external view returns (string memory uri);\\n}\\n\",\"keccak256\":\"0x4ed430e553d14161e93efdaaacd1a502f49b38969c9d714b45d2e682a74fa0bc\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/types/DataTypes.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {UD2x18} from \\\"@prb/math/src/UD2x18.sol\\\";\\nimport {UD60x18} from \\\"@prb/math/src/UD60x18.sol\\\";\\n\\n// DataTypes.sol\\n//\\n// This file defines all structs used in V2 Core, most of which are organized under three namespaces:\\n//\\n// - Lockup\\n// - LockupDynamic\\n// - LockupLinear\\n// - LockupTranched\\n//\\n// You will notice that some structs contain \\\"slot\\\" annotations - they are used to indicate the\\n// storage layout of the struct. It is more gas efficient to group small data types together so\\n// that they fit in a single 32-byte slot.\\n\\n/// @notice Struct encapsulating the broker parameters passed to the create functions. Both can be set to zero.\\n/// @param account The address receiving the broker's fee.\\n/// @param fee The broker's percentage fee from the total amount, denoted as a fixed-point number where 1e18 is 100%.\\nstruct Broker {\\n address account;\\n UD60x18 fee;\\n}\\n\\n/// @notice Namespace for the structs used in both {SablierV2LockupLinear} and {SablierV2LockupDynamic}.\\nlibrary Lockup {\\n /// @notice Struct encapsulating the deposit, withdrawn, and refunded amounts, all denoted in units of the asset's\\n /// decimals.\\n /// @dev Because the deposited and the withdrawn amount are often read together, declaring them in the same slot\\n /// saves gas.\\n /// @param deposited The initial amount deposited in the stream, net of broker fee.\\n /// @param withdrawn The cumulative amount withdrawn from the stream.\\n /// @param refunded The amount refunded to the sender. Unless the stream was canceled, this is always zero.\\n struct Amounts {\\n // slot 0\\n uint128 deposited;\\n uint128 withdrawn;\\n // slot 1\\n uint128 refunded;\\n }\\n\\n /// @notice Struct encapsulating (i) the deposit amount and (ii) the broker fee amount, both denoted in units of the\\n /// asset's decimals.\\n /// @param deposit The amount to deposit in the stream.\\n /// @param brokerFee The broker fee amount.\\n struct CreateAmounts {\\n uint128 deposit;\\n uint128 brokerFee;\\n }\\n\\n /// @notice Enum representing the different statuses of a stream.\\n /// @custom:value0 PENDING Stream created but not started; assets are in a pending state.\\n /// @custom:value1 STREAMING Active stream where assets are currently being streamed.\\n /// @custom:value2 SETTLED All assets have been streamed; recipient is due to withdraw them.\\n /// @custom:value3 CANCELED Canceled stream; remaining assets await recipient's withdrawal.\\n /// @custom:value4 DEPLETED Depleted stream; all assets have been withdrawn and/or refunded.\\n enum Status {\\n PENDING,\\n STREAMING,\\n SETTLED,\\n CANCELED,\\n DEPLETED\\n }\\n\\n /// @notice A common data structure to be stored in all {SablierV2Lockup} models.\\n /// @dev The fields are arranged like this to save gas via tight variable packing.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream.\\n /// @param startTime The Unix timestamp indicating the stream's start.\\n /// @param endTime The Unix timestamp indicating the stream's end.\\n /// @param isCancelable Boolean indicating if the stream is cancelable.\\n /// @param wasCanceled Boolean indicating if the stream was canceled.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param isDepleted Boolean indicating if the stream is depleted.\\n /// @param isStream Boolean indicating if the struct entity exists.\\n /// @param isTransferable Boolean indicating if the stream NFT is transferable.\\n /// @param amounts Struct encapsulating the deposit, withdrawn, and refunded amounts, all denoted in units of the\\n /// asset's decimals.\\n struct Stream {\\n // slot 0\\n address sender;\\n uint40 startTime;\\n uint40 endTime;\\n bool isCancelable;\\n bool wasCanceled;\\n // slot 1\\n IERC20 asset;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n // slot 2 and 3\\n Lockup.Amounts amounts;\\n }\\n}\\n\\n/// @notice Namespace for the structs used in {SablierV2LockupDynamic}.\\nlibrary LockupDynamic {\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupDynamic.createWithDurations} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param segments Segments with durations used to compose the dynamic distribution function. Timestamps are\\n /// calculated by starting from `block.timestamp` and adding each duration to the previous timestamp.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithDurations {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n SegmentWithDuration[] segments;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupDynamic.createWithTimestamps} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param startTime The Unix timestamp indicating the stream's start.\\n /// @param segments Segments used to compose the dynamic distribution function.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithTimestamps {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n uint40 startTime;\\n Segment[] segments;\\n Broker broker;\\n }\\n\\n /// @notice Segment struct used in the Lockup Dynamic stream.\\n /// @param amount The amount of assets to be streamed in the segment, denoted in units of the asset's decimals.\\n /// @param exponent The exponent of the segment, denoted as a fixed-point number.\\n /// @param timestamp The Unix timestamp indicating the segment's end.\\n struct Segment {\\n // slot 0\\n uint128 amount;\\n UD2x18 exponent;\\n uint40 timestamp;\\n }\\n\\n /// @notice Segment struct used at runtime in {SablierV2LockupDynamic.createWithDurations}.\\n /// @param amount The amount of assets to be streamed in the segment, denoted in units of the asset's decimals.\\n /// @param exponent The exponent of the segment, denoted as a fixed-point number.\\n /// @param duration The time difference in seconds between the segment and the previous one.\\n struct SegmentWithDuration {\\n uint128 amount;\\n UD2x18 exponent;\\n uint40 duration;\\n }\\n\\n /// @notice Struct encapsulating the full details of a stream.\\n /// @dev Extends `Lockup.Stream` by including the recipient and the segments.\\n struct StreamLD {\\n address sender;\\n address recipient;\\n uint40 startTime;\\n uint40 endTime;\\n bool isCancelable;\\n bool wasCanceled;\\n IERC20 asset;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n Lockup.Amounts amounts;\\n Segment[] segments;\\n }\\n\\n /// @notice Struct encapsulating the LockupDynamic timestamps.\\n /// @param start The Unix timestamp indicating the stream's start.\\n /// @param end The Unix timestamp indicating the stream's end.\\n struct Timestamps {\\n uint40 start;\\n uint40 end;\\n }\\n}\\n\\n/// @notice Namespace for the structs used in {SablierV2LockupLinear}.\\nlibrary LockupLinear {\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupLinear.createWithDurations} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param durations Struct encapsulating (i) cliff period duration and (ii) total stream duration, both in seconds.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithDurations {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n Durations durations;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupLinear.createWithTimestamps} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param timestamps Struct encapsulating (i) the stream's start time, (ii) cliff time, and (iii) end time, all as\\n /// Unix timestamps.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithTimestamps {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n Timestamps timestamps;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the cliff duration and the total duration.\\n /// @param cliff The cliff duration in seconds.\\n /// @param total The total duration in seconds.\\n struct Durations {\\n uint40 cliff;\\n uint40 total;\\n }\\n\\n /// @notice Struct encapsulating the full details of a stream.\\n /// @dev Extends `Lockup.Stream` by including the recipient and the cliff time.\\n struct StreamLL {\\n address sender;\\n address recipient;\\n uint40 startTime;\\n bool isCancelable;\\n bool wasCanceled;\\n IERC20 asset;\\n uint40 endTime;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n Lockup.Amounts amounts;\\n uint40 cliffTime;\\n }\\n\\n /// @notice Struct encapsulating the LockupLinear timestamps.\\n /// @param start The Unix timestamp for the stream's start.\\n /// @param cliff The Unix timestamp for the cliff period's end. A value of zero means there is no cliff.\\n /// @param end The Unix timestamp for the stream's end.\\n struct Timestamps {\\n uint40 start;\\n uint40 cliff;\\n uint40 end;\\n }\\n}\\n\\n/// @notice Namespace for the structs used in {SablierV2LockupTranched}.\\nlibrary LockupTranched {\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupTranched.createWithDurations} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param tranches Tranches with durations used to compose the tranched distribution function. Timestamps are\\n /// calculated by starting from `block.timestamp` and adding each duration to the previous timestamp.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithDurations {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n TrancheWithDuration[] tranches;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupTranched.createWithTimestamps} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param startTime The Unix timestamp indicating the stream's start.\\n /// @param tranches Tranches used to compose the tranched distribution function.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithTimestamps {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n uint40 startTime;\\n Tranche[] tranches;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the full details of a stream.\\n /// @dev Extends `Lockup.Stream` by including the recipient and the tranches.\\n struct StreamLT {\\n address sender;\\n address recipient;\\n uint40 startTime;\\n uint40 endTime;\\n bool isCancelable;\\n bool wasCanceled;\\n IERC20 asset;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n Lockup.Amounts amounts;\\n Tranche[] tranches;\\n }\\n\\n /// @notice Struct encapsulating the LockupTranched timestamps.\\n /// @param start The Unix timestamp indicating the stream's start.\\n /// @param end The Unix timestamp indicating the stream's end.\\n struct Timestamps {\\n uint40 start;\\n uint40 end;\\n }\\n\\n /// @notice Tranche struct used in the Lockup Tranched stream.\\n /// @param amount The amount of assets to be unlocked in the tranche, denoted in units of the asset's decimals.\\n /// @param timestamp The Unix timestamp indicating the tranche's end.\\n struct Tranche {\\n // slot 0\\n uint128 amount;\\n uint40 timestamp;\\n }\\n\\n /// @notice Tranche struct used at runtime in {SablierV2LockupTranched.createWithDurations}.\\n /// @param amount The amount of assets to be unlocked in the tranche, denoted in units of the asset's decimals.\\n /// @param duration The time difference in seconds between the tranche and the previous one.\\n struct TrancheWithDuration {\\n uint128 amount;\\n uint40 duration;\\n }\\n}\\n\",\"keccak256\":\"0x727722c0ec71a76a947b935c9dfcac8fd846d6c3547dfbc8739c7109f3b95068\",\"license\":\"GPL-3.0-or-later\"},\"contracts/modules/DecentHatsCreationModule.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.28;\\n\\nimport {Enum} from \\\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\\\";\\nimport {IAvatar} from \\\"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol\\\";\\nimport {Strings} from \\\"@openzeppelin/contracts/utils/Strings.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IERC6551Registry} from \\\"../interfaces/IERC6551Registry.sol\\\";\\nimport {IHats} from \\\"../interfaces/hats/IHats.sol\\\";\\nimport {LockupLinear, Broker} from \\\"../interfaces/sablier/types/DataTypes.sol\\\";\\nimport {IHatsModuleFactory} from \\\"../interfaces/hats/IHatsModuleFactory.sol\\\";\\nimport {IHatsElectionsEligibility} from \\\"../interfaces/hats/modules/IHatsElectionsEligibility.sol\\\";\\nimport {ModuleProxyFactory} from \\\"@gnosis.pm/zodiac/contracts/factory/ModuleProxyFactory.sol\\\";\\nimport {ISablierV2LockupLinear} from \\\"../interfaces/sablier/ISablierV2LockupLinear.sol\\\";\\nimport {DecentHatsModuleUtils} from \\\"./DecentHatsModuleUtils.sol\\\";\\n\\ncontract DecentHatsCreationModule is DecentHatsModuleUtils {\\n struct TopHatParams {\\n string details;\\n string imageURI;\\n }\\n\\n struct AdminHatParams {\\n string details;\\n string imageURI;\\n bool isMutable;\\n }\\n\\n struct CreateTreeParams {\\n IHats hatsProtocol;\\n IERC6551Registry erc6551Registry;\\n IHatsModuleFactory hatsModuleFactory;\\n ModuleProxyFactory moduleProxyFactory;\\n address keyValuePairs;\\n address decentAutonomousAdminImplementation;\\n address hatsAccountImplementation;\\n address hatsElectionsEligibilityImplementation;\\n TopHatParams topHat;\\n AdminHatParams adminHat;\\n HatParams[] hats;\\n }\\n\\n /* /////////////////////////////////////////////////////////////////////////////\\n EXTERNAL FUNCTIONS\\n ///////////////////////////////////////////////////////////////////////////// */\\n /**\\n * @notice For a safe without any roles previously created on it, this function should be called. It sets up the\\n * top hat and admin hat, as well as any other hats and their streams that are provided, then transfers the top hat\\n * to the calling safe.\\n *\\n * @notice This contract should be enabled a module on the Safe for which the role(s) are to be created, and disabled after.\\n *\\n * @dev For each hat that is included, if the hat is:\\n * - termed, its stream funds on are targeted directly at the nominated wearer. The wearer should directly call `withdraw-`\\n * on the Sablier contract.\\n * - untermed, its stream funds are targeted at the hat's smart account. In order to withdraw funds from the stream, the\\n * hat's smart account must be the one call to `withdraw-` on the Sablier contract, setting the recipient arg to its wearer.\\n *\\n * @dev In order for a Safe to seamlessly create roles even if it has never previously created a role and thus has\\n * no hat tree, we defer the creation of the hat tree and its setup to this contract. This way, in a single tx block,\\n * the resulting topHatId of the newly created hat can be used to create an admin hat and any other hats needed.\\n * We also make use of `KeyValuePairs` to associate the topHatId with the Safe.\\n *\\n * @param treeParams The parameters for creating the Hat Tree with Roles\\n */\\n function createAndDeclareTree(\\n CreateTreeParams calldata treeParams\\n ) external {\\n // Create Top Hat\\n (uint256 topHatId, address topHatAccount) = _processTopHat(\\n treeParams.hatsProtocol,\\n treeParams.erc6551Registry,\\n treeParams.hatsAccountImplementation,\\n treeParams.keyValuePairs,\\n treeParams.topHat\\n );\\n\\n // Create Admin Hat\\n uint256 adminHatId = _processAdminHat(\\n treeParams.hatsProtocol,\\n treeParams.erc6551Registry,\\n treeParams.hatsAccountImplementation,\\n topHatId,\\n topHatAccount,\\n treeParams.moduleProxyFactory,\\n treeParams.decentAutonomousAdminImplementation,\\n treeParams.adminHat\\n );\\n\\n // Create Role Hats\\n _processRoleHats(\\n CreateRoleHatsParams({\\n hatsProtocol: treeParams.hatsProtocol,\\n erc6551Registry: treeParams.erc6551Registry,\\n hatsAccountImplementation: treeParams.hatsAccountImplementation,\\n topHatId: topHatId,\\n topHatAccount: topHatAccount,\\n hatsModuleFactory: treeParams.hatsModuleFactory,\\n hatsElectionsEligibilityImplementation: treeParams\\n .hatsElectionsEligibilityImplementation,\\n adminHatId: adminHatId,\\n hats: treeParams.hats\\n })\\n );\\n }\\n\\n /* /////////////////////////////////////////////////////////////////////////////\\n INTERNAL FUNCTIONS\\n ///////////////////////////////////////////////////////////////////////////// */\\n\\n function _processTopHat(\\n IHats hatsProtocol,\\n IERC6551Registry erc6551Registry,\\n address hatsAccountImplementation,\\n address keyValuePairs,\\n TopHatParams calldata topHat\\n ) internal returns (uint256 topHatId, address topHatAccount) {\\n // Call lastTopHatId() and properly decode the response\\n (bool success, bytes memory data) = address(hatsProtocol).call(\\n abi.encodeWithSignature(\\\"lastTopHatId()\\\")\\n );\\n require(success, \\\"Failed to get lastTopHatId\\\");\\n topHatId = (abi.decode(data, (uint256)) + 1) << 224;\\n\\n // Mint Top Hat to the Safe\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"mintTopHat(address,string,string)\\\",\\n msg.sender,\\n topHat.details,\\n topHat.imageURI\\n ),\\n Enum.Operation.Call\\n );\\n\\n // Create Top Hat's ERC6551 Account\\n topHatAccount = erc6551Registry.createAccount(\\n hatsAccountImplementation,\\n SALT,\\n block.chainid,\\n address(hatsProtocol),\\n topHatId\\n );\\n\\n // Declare Top Hat ID to Safe via KeyValuePairs\\n string[] memory keys = new string[](1);\\n string[] memory values = new string[](1);\\n keys[0] = \\\"topHatId\\\";\\n values[0] = Strings.toString(topHatId);\\n IAvatar(msg.sender).execTransactionFromModule(\\n keyValuePairs,\\n 0,\\n abi.encodeWithSignature(\\n \\\"updateValues(string[],string[])\\\",\\n keys,\\n values\\n ),\\n Enum.Operation.Call\\n );\\n }\\n\\n function _processAdminHat(\\n IHats hatsProtocol,\\n IERC6551Registry erc6551Registry,\\n address hatsAccountImplementation,\\n uint256 topHatId,\\n address topHatAccount,\\n ModuleProxyFactory moduleProxyFactory,\\n address decentAutonomousAdminImplementation,\\n AdminHatParams calldata adminHat\\n ) internal returns (uint256 adminHatId) {\\n // Create Admin Hat\\n adminHatId = hatsProtocol.getNextId(topHatId);\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"createHat(uint256,string,uint32,address,address,bool,string)\\\",\\n topHatId,\\n adminHat.details,\\n 1, // only one Admin Hat\\n topHatAccount,\\n topHatAccount,\\n adminHat.isMutable,\\n adminHat.imageURI\\n ),\\n Enum.Operation.Call\\n );\\n\\n // Create Admin Hat's ERC6551 Account\\n erc6551Registry.createAccount(\\n hatsAccountImplementation,\\n SALT,\\n block.chainid,\\n address(hatsProtocol),\\n adminHatId\\n );\\n\\n // Deploy Decent Autonomous Admin Module, which will wear the Admin Hat\\n address autonomousAdmin = moduleProxyFactory.deployModule(\\n decentAutonomousAdminImplementation,\\n abi.encodeWithSignature(\\\"setUp(bytes)\\\", bytes(\\\"\\\")),\\n uint256(\\n keccak256(\\n abi.encodePacked(\\n // for the salt, we'll concatenate our static salt\\n // with the Admin Hat ID\\n SALT,\\n adminHatId\\n )\\n )\\n )\\n );\\n\\n // Mint Hat to the Decent Autonomous Admin Module\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"mintHat(uint256,address)\\\",\\n adminHatId,\\n autonomousAdmin\\n ),\\n Enum.Operation.Call\\n );\\n }\\n}\\n\",\"keccak256\":\"0x0d952c31bdbe70343c618cdab6930200c3064eee26ccfb6913a94a2be635dd41\",\"license\":\"MIT\"},\"contracts/modules/DecentHatsModuleUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.28;\\n\\nimport {Enum} from \\\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\\\";\\nimport {IAvatar} from \\\"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IERC6551Registry} from \\\"../interfaces/IERC6551Registry.sol\\\";\\nimport {IHats} from \\\"../interfaces/hats/IHats.sol\\\";\\nimport {LockupLinear, Broker} from \\\"../interfaces/sablier/types/DataTypes.sol\\\";\\nimport {IHatsModuleFactory} from \\\"../interfaces/hats/IHatsModuleFactory.sol\\\";\\nimport {ISablierV2LockupLinear} from \\\"../interfaces/sablier/ISablierV2LockupLinear.sol\\\";\\n\\nabstract contract DecentHatsModuleUtils {\\n bytes32 public constant SALT =\\n 0x5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b5072;\\n\\n struct SablierStreamParams {\\n ISablierV2LockupLinear sablier;\\n address sender;\\n address asset;\\n LockupLinear.Timestamps timestamps;\\n Broker broker;\\n uint128 totalAmount;\\n bool cancelable;\\n bool transferable;\\n }\\n\\n struct HatParams {\\n address wearer;\\n string details;\\n string imageURI;\\n SablierStreamParams[] sablierStreamsParams;\\n uint128 termEndDateTs; // If 0, this is an untermed Hat\\n uint32 maxSupply;\\n bool isMutable;\\n }\\n\\n struct CreateRoleHatsParams {\\n IHats hatsProtocol;\\n IERC6551Registry erc6551Registry;\\n address hatsAccountImplementation;\\n uint256 topHatId;\\n address topHatAccount;\\n IHatsModuleFactory hatsModuleFactory;\\n address hatsElectionsEligibilityImplementation;\\n uint256 adminHatId;\\n HatParams[] hats;\\n }\\n\\n function _processRoleHats(\\n CreateRoleHatsParams memory roleHatsParams\\n ) internal {\\n for (uint256 i = 0; i < roleHatsParams.hats.length; ) {\\n HatParams memory hatParams = roleHatsParams.hats[i];\\n\\n // Create eligibility module if needed\\n address eligibilityAddress = _createEligibilityModule(\\n roleHatsParams.hatsProtocol,\\n roleHatsParams.hatsModuleFactory,\\n roleHatsParams.hatsElectionsEligibilityImplementation,\\n roleHatsParams.topHatId,\\n roleHatsParams.topHatAccount,\\n roleHatsParams.adminHatId,\\n hatParams.termEndDateTs\\n );\\n\\n // Create and Mint the Role Hat\\n uint256 hatId = _createAndMintHat(\\n roleHatsParams.hatsProtocol,\\n roleHatsParams.adminHatId,\\n hatParams,\\n eligibilityAddress,\\n roleHatsParams.topHatAccount\\n );\\n\\n // Get the stream recipient (based on termed or not)\\n address streamRecipient = _setupStreamRecipient(\\n roleHatsParams.erc6551Registry,\\n roleHatsParams.hatsAccountImplementation,\\n address(roleHatsParams.hatsProtocol),\\n hatParams.termEndDateTs,\\n hatParams.wearer,\\n hatId\\n );\\n\\n // Create streams\\n _processSablierStreams(\\n hatParams.sablierStreamsParams,\\n streamRecipient\\n );\\n\\n unchecked {\\n ++i;\\n }\\n }\\n }\\n\\n function _createEligibilityModule(\\n IHats hatsProtocol,\\n IHatsModuleFactory hatsModuleFactory,\\n address hatsElectionsEligibilityImplementation,\\n uint256 topHatId,\\n address topHatAccount,\\n uint256 adminHatId,\\n uint128 termEndDateTs\\n ) private returns (address) {\\n // If the Hat is termed, create the eligibility module\\n if (termEndDateTs != 0) {\\n return\\n hatsModuleFactory.createHatsModule(\\n hatsElectionsEligibilityImplementation,\\n hatsProtocol.getNextId(adminHatId),\\n abi.encode(topHatId, uint256(0)), // [BALLOT_BOX_ID, ADMIN_HAT_ID]\\n abi.encode(termEndDateTs),\\n uint256(SALT)\\n );\\n }\\n\\n // Otherwise, return the Top Hat account\\n return topHatAccount;\\n }\\n\\n function _createAndMintHat(\\n IHats hatsProtocol,\\n uint256 adminHatId,\\n HatParams memory hat,\\n address eligibilityAddress,\\n address topHatAccount\\n ) private returns (uint256) {\\n // Grab the next Hat ID (before creating it)\\n uint256 hatId = hatsProtocol.getNextId(adminHatId);\\n\\n // Create the new Hat\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"createHat(uint256,string,uint32,address,address,bool,string)\\\",\\n adminHatId,\\n hat.details,\\n hat.maxSupply,\\n eligibilityAddress,\\n topHatAccount,\\n hat.isMutable,\\n hat.imageURI\\n ),\\n Enum.Operation.Call\\n );\\n\\n // If the Hat is termed, nominate the wearer as the eligible member\\n if (hat.termEndDateTs != 0) {\\n address[] memory nominatedWearers = new address[](1);\\n nominatedWearers[0] = hat.wearer;\\n\\n IAvatar(msg.sender).execTransactionFromModule(\\n eligibilityAddress,\\n 0,\\n abi.encodeWithSignature(\\n \\\"elect(uint128,address[])\\\",\\n hat.termEndDateTs,\\n nominatedWearers\\n ),\\n Enum.Operation.Call\\n );\\n }\\n\\n // Mint the Hat\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"mintHat(uint256,address)\\\",\\n hatId,\\n hat.wearer\\n ),\\n Enum.Operation.Call\\n );\\n return hatId;\\n }\\n\\n // Exists to avoid stack too deep errors\\n function _setupStreamRecipient(\\n IERC6551Registry erc6551Registry,\\n address hatsAccountImplementation,\\n address hatsProtocol,\\n uint128 termEndDateTs,\\n address wearer,\\n uint256 hatId\\n ) private returns (address) {\\n // If the hat is termed, the wearer is the stream recipient\\n if (termEndDateTs != 0) {\\n return wearer;\\n }\\n\\n // Otherwise, the Hat's smart account is the stream recipient\\n return\\n erc6551Registry.createAccount(\\n hatsAccountImplementation,\\n SALT,\\n block.chainid,\\n hatsProtocol,\\n hatId\\n );\\n }\\n\\n function _processSablierStreams(\\n SablierStreamParams[] memory streamParams,\\n address streamRecipient\\n ) private {\\n for (uint256 i = 0; i < streamParams.length; ) {\\n SablierStreamParams memory sablierStreamParams = streamParams[i];\\n\\n // Approve tokens for Sablier\\n IAvatar(msg.sender).execTransactionFromModule(\\n sablierStreamParams.asset,\\n 0,\\n abi.encodeWithSignature(\\n \\\"approve(address,uint256)\\\",\\n sablierStreamParams.sablier,\\n sablierStreamParams.totalAmount\\n ),\\n Enum.Operation.Call\\n );\\n\\n // Proxy the Sablier call through IAvatar\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(sablierStreamParams.sablier),\\n 0,\\n abi.encodeWithSignature(\\n \\\"createWithTimestamps((address,address,uint128,address,bool,bool,(uint40,uint40,uint40),(address,uint256)))\\\",\\n LockupLinear.CreateWithTimestamps({\\n sender: sablierStreamParams.sender,\\n recipient: streamRecipient,\\n totalAmount: sablierStreamParams.totalAmount,\\n asset: IERC20(sablierStreamParams.asset),\\n cancelable: sablierStreamParams.cancelable,\\n transferable: sablierStreamParams.transferable,\\n timestamps: sablierStreamParams.timestamps,\\n broker: sablierStreamParams.broker\\n })\\n ),\\n Enum.Operation.Call\\n );\\n\\n unchecked {\\n ++i;\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x357c5264ecb63f8f15f67ffb7498c7fb55d9efe8d46358790933b4892bd38cde\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x6080604052348015600f57600080fd5b50611eb88061001f6000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c8063ba9a91a51461003b578063d58041b714610062575b600080fd5b610050600080516020611e6383398151915281565b60405190815260200160405180910390f35b6100756100703660046112ff565b610077565b005b6000806100cd61008a6020850185611359565b61009a6040860160208701611359565b6100aa60e0870160c08801611359565b6100ba60a0880160808901611359565b6100c8610100890189611386565b610227565b909250905060006101396100e46020860186611359565b6100f46040870160208801611359565b61010460e0880160c08901611359565b868661011660808b0160608c01611359565b61012660c08c0160a08d01611359565b6101346101208d018d6113a6565b610603565b604080516101208101909152909150610221908061015a6020880188611359565b6001600160a01b0316815260200186602001602081019061017b9190611359565b6001600160a01b0316815260200161019960e0880160c08901611359565b6001600160a01b03168152602001858152602001846001600160a01b031681526020018660400160208101906101cf9190611359565b6001600160a01b031681526020016101ee610100880160e08901611359565b6001600160a01b03168152602081018490526040016102116101408801886113bc565b61021a9161175d565b905261099f565b50505050565b60408051600481526024810182526020810180516001600160e01b0316633f0f816960e21b17905290516000918291829182916001600160a01b038b169161026e916118bf565b6000604051808303816000865af19150503d80600081146102ab576040519150601f19603f3d011682016040523d82523d6000602084013e6102b0565b606091505b5091509150816103065760405162461bcd60e51b815260206004820152601a60248201527f4661696c656420746f20676574206c617374546f704861744964000000000000604482015260640160405180910390fd5b60e08180602001905181019061031c91906118d1565b610327906001611900565b901b93503363468721a78a60008361033f8a80611919565b61034c60208d018d611919565b604051602401610360959493929190611988565b60408051601f198184030181529181526020820180516001600160e01b0316631a64dfad60e01b1790525160e085901b6001600160e01b03191681526103ae939291906000906004016119f8565b6020604051808303816000875af11580156103cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103f19190611a4e565b50604051638a54c52f60e01b81526001600160a01b03891690638a54c52f90610434908a90600080516020611e638339815191529046908f908b90600401611a6b565b6020604051808303816000875af1158015610453573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104779190611a9e565b60408051600180825281830190925291945060009190816020015b606081526020019060019003908161049257505060408051600180825281830190925291925060009190602082015b60608152602001906001900390816104c1579050509050604051806040016040528060088152602001671d1bdc12185d125960c21b8152508260008151811061050c5761050c611abb565b602002602001018190525061052086610a66565b8160008151811061053357610533611abb565b6020026020010181905250336001600160a01b031663468721a78960008585604051602401610563929190611b2d565b60408051601f198184030181529181526020820180516001600160e01b031663579374b960e11b1790525160e085901b6001600160e01b03191681526105b1939291906000906004016119f8565b6020604051808303816000875af11580156105d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105f49190611a4e565b50505050509550959350505050565b60405162460ea360e61b8152600481018690526000906001600160a01b038a1690631183a8c090602401602060405180830381865afa15801561064a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061066e91906118d1565b90503363468721a78a6000896106848780611919565b60018c8061069860608d0160408e01611b5b565b6106a560208e018e611919565b6040516024016106bd99989796959493929190611b78565b60408051601f198184030181529181526020820180516001600160e01b0316635829492f60e11b1790525160e085901b6001600160e01b031916815261070b939291906000906004016119f8565b6020604051808303816000875af115801561072a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061074e9190611a4e565b50604051638a54c52f60e01b81526001600160a01b03891690638a54c52f90610791908a90600080516020611e638339815191529046908f908890600401611a6b565b6020604051808303816000875af11580156107b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107d49190611a9e565b506000846001600160a01b031663f1ab873c85604051806020016040528060008152506040516024016108079190611bdd565b60408051601f19818403018152918152602080830180516001600160e01b031663a4f9edbf60e01b179052905161085991600080516020611e6383398151915291899101918252602082015260400190565b60408051601f198184030181529082905280516020909101206001600160e01b031960e086901b168252610891939291600401611bf0565b6020604051808303816000875af11580156108b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108d49190611a9e565b604051602481018490526001600160a01b0382166044820152909150339063468721a7908c9060009060640160408051601f198184030181529181526020820180516001600160e01b031663320fbbb760e11b1790525160e085901b6001600160e01b031916815261094e939291906000906004016119f8565b6020604051808303816000875af115801561096d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109919190611a4e565b505098975050505050505050565b60005b81610100015151811015610a6257600082610100015182815181106109c9576109c9611abb565b602002602001015190506000610a0084600001518560a001518660c00151876060015188608001518960e001518860800151610b6e565b90506000610a1d85600001518660e0015185858960800151610cd5565b90506000610a438660200151876040015188600001518760800151886000015187611007565b9050610a538460600151826110b1565b846001019450505050506109a2565b5050565b606081600003610a8d5750506040805180820190915260018152600360fc1b602082015290565b8160005b8115610ab75780610aa181611c24565b9150610ab09050600a83611c53565b9150610a91565b6000816001600160401b03811115610ad157610ad161140c565b6040519080825280601f01601f191660200182016040528015610afb576020820181803683370190505b5090505b8415610b6657610b10600183611c67565b9150610b1d600a86611c7a565b610b28906030611900565b60f81b818381518110610b3d57610b3d611abb565b60200101906001600160f81b031916908160001a905350610b5f600a86611c53565b9450610aff565b949350505050565b60006001600160801b03821615610cc757866001600160a01b0316632f7fb7b6878a6001600160a01b0316631183a8c0876040518263ffffffff1660e01b8152600401610bbd91815260200190565b602060405180830381865afa158015610bda573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bfe91906118d1565b886000604051602001610c1b929190918252602082015260400190565b60408051601f198184030181528282526001600160801b0389166020840152910160408051601f19818403018152908290526001600160e01b031960e087901b168252610c7d94939291600080516020611e6383398151915290600401611c8e565b6020604051808303816000875af1158015610c9c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cc09190611a9e565b9050610cca565b50825b979650505050505050565b60405162460ea360e61b81526004810185905260009081906001600160a01b03881690631183a8c090602401602060405180830381865afa158015610d1e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d4291906118d1565b9050336001600160a01b031663468721a78860008989602001518a60a001518a8a8d60c001518e60400151604051602401610d839796959493929190611cda565b60408051601f198184030181529181526020820180516001600160e01b0316635829492f60e11b1790525160e085901b6001600160e01b0319168152610dd1939291906000906004016119f8565b6020604051808303816000875af1158015610df0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e149190611a4e565b5060808501516001600160801b031615610f3f5760408051600180825281830190925260009160208083019080368337019050509050856000015181600081518110610e6257610e62611abb565b60200260200101906001600160a01b031690816001600160a01b031681525050336001600160a01b031663468721a7866000896080015185604051602401610eab929190611d3e565b60408051601f198184030181529181526020820180516001600160e01b0316634a231cef60e01b1790525160e085901b6001600160e01b0319168152610ef9939291906000906004016119f8565b6020604051808303816000875af1158015610f18573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f3c9190611a4e565b50505b8451604051602481018390526001600160a01b039091166044820152339063468721a790899060009060640160408051601f198184030181529181526020820180516001600160e01b031663320fbbb760e11b1790525160e085901b6001600160e01b0319168152610fb9939291906000906004016119f8565b6020604051808303816000875af1158015610fd8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ffc9190611a4e565b509695505050505050565b60006001600160801b0384161561101f5750816110a7565b604051638a54c52f60e01b81526001600160a01b03881690638a54c52f90611061908990600080516020611e638339815191529046908b908990600401611a6b565b6020604051808303816000875af1158015611080573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110a49190611a9e565b90505b9695505050505050565b60005b82518110156112fa5760008382815181106110d1576110d1611abb565b60200260200101519050336001600160a01b031663468721a78260400151600084600001518560a001516040516024016111299291906001600160a01b039290921682526001600160801b0316602082015260400190565b60408051601f198184030181529181526020820180516001600160e01b031663095ea7b360e01b1790525160e085901b6001600160e01b0319168152611177939291906000906004016119f8565b6020604051808303816000875af1158015611196573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111ba9190611a4e565b50336001600160a01b031663468721a78260000151600060405180610100016040528086602001516001600160a01b03168152602001886001600160a01b031681526020018660a001516001600160801b0316815260200186604001516001600160a01b031681526020018660c00151151581526020018660e001511515815260200186606001518152602001866080015181525060405160240161125f9190611d93565b60408051601f198184030181529181526020820180516001600160e01b03166353b1572760e01b1790525160e085901b6001600160e01b03191681526112ad939291906000906004016119f8565b6020604051808303816000875af11580156112cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112f09190611a4e565b50506001016110b4565b505050565b60006020828403121561131157600080fd5b81356001600160401b0381111561132757600080fd5b8201610160818503121561133a57600080fd5b9392505050565b6001600160a01b038116811461135657600080fd5b50565b60006020828403121561136b57600080fd5b813561133a81611341565b803561138181611341565b919050565b60008235603e1983360301811261139c57600080fd5b9190910192915050565b60008235605e1983360301811261139c57600080fd5b6000808335601e198436030181126113d357600080fd5b8301803591506001600160401b038211156113ed57600080fd5b6020019150600581901b360382131561140557600080fd5b9250929050565b634e487b7160e01b600052604160045260246000fd5b60405161010081016001600160401b03811182821017156114455761144561140c565b60405290565b60405160e081016001600160401b03811182821017156114455761144561140c565b604051601f8201601f191681016001600160401b03811182821017156114955761149561140c565b604052919050565b60006001600160401b038211156114b6576114b661140c565b5060051b60200190565b600082601f8301126114d157600080fd5b81356001600160401b038111156114ea576114ea61140c565b6114fd601f8201601f191660200161146d565b81815284602083860101111561151257600080fd5b816020850160208301376000918101602001919091529392505050565b803564ffffffffff8116811461138157600080fd5b60006060828403121561155657600080fd5b604051606081016001600160401b03811182821017156115785761157861140c565b6040529050806115878361152f565b81526115956020840161152f565b60208201526115a66040840161152f565b60408201525092915050565b6000604082840312156115c457600080fd5b604080519081016001600160401b03811182821017156115e6576115e661140c565b60405290508082356115f781611341565b8152602092830135920191909152919050565b80356001600160801b038116811461138157600080fd5b801515811461135657600080fd5b803561138181611621565b600082601f83011261164b57600080fd5b813561165e6116598261149d565b61146d565b808282526020820191506020610160840286010192508583111561168157600080fd5b602085015b8381101561173f57610160818803121561169f57600080fd5b6116a7611422565b6116b082611376565b81526116be60208301611376565b60208201526116cf60408301611376565b60408201526116e18860608401611544565b60608201526116f38860c084016115b2565b6080820152611705610100830161160a565b60a0820152611717610120830161162f565b60c0820152611729610140830161162f565b60e0820152835260209092019161016001611686565b5095945050505050565b803563ffffffff8116811461138157600080fd5b600061176b6116598461149d565b8381526020810190600585901b84013681111561178757600080fd5b845b818110156118905780356001600160401b038111156117a757600080fd5b860160e03682900312156117ba57600080fd5b6117c261144b565b6117cb82611376565b815260208201356001600160401b038111156117e657600080fd5b6117f2368285016114c0565b60208301525060408201356001600160401b0381111561181157600080fd5b61181d368285016114c0565b60408301525060608201356001600160401b0381111561183c57600080fd5b6118483682850161163a565b60608301525061185a6080830161160a565b608082015261186b60a08301611749565b60a082015261187c60c0830161162f565b60c082015285525060209384019301611789565b509095945050505050565b60005b838110156118b657818101518382015260200161189e565b50506000910152565b6000825161139c81846020870161189b565b6000602082840312156118e357600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b80820180821115611913576119136118ea565b92915050565b6000808335601e1984360301811261193057600080fd5b8301803591506001600160401b0382111561194a57600080fd5b60200191503681900382131561140557600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b03861681526060602082018190526000906119ad908301868861195f565b82810360408401526119c081858761195f565b98975050505050505050565b600081518084526119e481602086016020860161189b565b601f01601f19169290920160200192915050565b60018060a01b0385168152836020820152608060408201526000611a1f60808301856119cc565b905060028310611a3f57634e487b7160e01b600052602160045260246000fd5b82606083015295945050505050565b600060208284031215611a6057600080fd5b815161133a81611621565b6001600160a01b039586168152602081019490945260408401929092529092166060820152608081019190915260a00190565b600060208284031215611ab057600080fd5b815161133a81611341565b634e487b7160e01b600052603260045260246000fd5b600082825180855260208501945060208160051b8301016020850160005b83811015611b2157601f19858403018852611b0b8383516119cc565b6020988901989093509190910190600101611aef565b50909695505050505050565b604081526000611b406040830185611ad1565b8281036020840152611b528185611ad1565b95945050505050565b600060208284031215611b6d57600080fd5b813561133a81611621565b89815260e060208201526000611b9260e083018a8c61195f565b60ff891660408401526001600160a01b0388811660608501528716608084015285151560a084015282810360c0840152611bcd81858761195f565b9c9b505050505050505050505050565b60208152600061133a60208301846119cc565b6001600160a01b0384168152606060208201819052600090611c14908301856119cc565b9050826040830152949350505050565b600060018201611c3657611c366118ea565b5060010190565b634e487b7160e01b600052601260045260246000fd5b600082611c6257611c62611c3d565b500490565b81810381811115611913576119136118ea565b600082611c8957611c89611c3d565b500690565b60018060a01b038616815284602082015260a060408201526000611cb560a08301866119cc565b8281036060840152611cc781866119cc565b9150508260808301529695505050505050565b87815260e060208201526000611cf360e08301896119cc565b63ffffffff881660408401526001600160a01b0387811660608501528616608084015284151560a084015282810360c0840152611d3081856119cc565b9a9950505050505050505050565b6000604082016001600160801b03851683526040602084015280845180835260608501915060208601925060005b81811015611b215783516001600160a01b0316835260209384019390920191600101611d6c565b81516001600160a01b0390811682526020808401518216908301526040808401516001600160801b03169083015260608084015191821690830152610160820190506080830151611de8608084018215159052565b5060a0830151611dfc60a084018215159052565b5060c0830151611e3b60c084018264ffffffffff815116825264ffffffffff602082015116602083015264ffffffffff60408201511660408301525050565b5060e0929092015180516001600160a01b031661012083015260200151610140909101529056fe5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b5072a26469706673582212201f5f415bcb47b5bcc3f3fe15fa8e4612de722a3ea1aaa69d546320c040c561ba64736f6c634300081c0033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100365760003560e01c8063ba9a91a51461003b578063d58041b714610062575b600080fd5b610050600080516020611e6383398151915281565b60405190815260200160405180910390f35b6100756100703660046112ff565b610077565b005b6000806100cd61008a6020850185611359565b61009a6040860160208701611359565b6100aa60e0870160c08801611359565b6100ba60a0880160808901611359565b6100c8610100890189611386565b610227565b909250905060006101396100e46020860186611359565b6100f46040870160208801611359565b61010460e0880160c08901611359565b868661011660808b0160608c01611359565b61012660c08c0160a08d01611359565b6101346101208d018d6113a6565b610603565b604080516101208101909152909150610221908061015a6020880188611359565b6001600160a01b0316815260200186602001602081019061017b9190611359565b6001600160a01b0316815260200161019960e0880160c08901611359565b6001600160a01b03168152602001858152602001846001600160a01b031681526020018660400160208101906101cf9190611359565b6001600160a01b031681526020016101ee610100880160e08901611359565b6001600160a01b03168152602081018490526040016102116101408801886113bc565b61021a9161175d565b905261099f565b50505050565b60408051600481526024810182526020810180516001600160e01b0316633f0f816960e21b17905290516000918291829182916001600160a01b038b169161026e916118bf565b6000604051808303816000865af19150503d80600081146102ab576040519150601f19603f3d011682016040523d82523d6000602084013e6102b0565b606091505b5091509150816103065760405162461bcd60e51b815260206004820152601a60248201527f4661696c656420746f20676574206c617374546f704861744964000000000000604482015260640160405180910390fd5b60e08180602001905181019061031c91906118d1565b610327906001611900565b901b93503363468721a78a60008361033f8a80611919565b61034c60208d018d611919565b604051602401610360959493929190611988565b60408051601f198184030181529181526020820180516001600160e01b0316631a64dfad60e01b1790525160e085901b6001600160e01b03191681526103ae939291906000906004016119f8565b6020604051808303816000875af11580156103cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103f19190611a4e565b50604051638a54c52f60e01b81526001600160a01b03891690638a54c52f90610434908a90600080516020611e638339815191529046908f908b90600401611a6b565b6020604051808303816000875af1158015610453573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104779190611a9e565b60408051600180825281830190925291945060009190816020015b606081526020019060019003908161049257505060408051600180825281830190925291925060009190602082015b60608152602001906001900390816104c1579050509050604051806040016040528060088152602001671d1bdc12185d125960c21b8152508260008151811061050c5761050c611abb565b602002602001018190525061052086610a66565b8160008151811061053357610533611abb565b6020026020010181905250336001600160a01b031663468721a78960008585604051602401610563929190611b2d565b60408051601f198184030181529181526020820180516001600160e01b031663579374b960e11b1790525160e085901b6001600160e01b03191681526105b1939291906000906004016119f8565b6020604051808303816000875af11580156105d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105f49190611a4e565b50505050509550959350505050565b60405162460ea360e61b8152600481018690526000906001600160a01b038a1690631183a8c090602401602060405180830381865afa15801561064a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061066e91906118d1565b90503363468721a78a6000896106848780611919565b60018c8061069860608d0160408e01611b5b565b6106a560208e018e611919565b6040516024016106bd99989796959493929190611b78565b60408051601f198184030181529181526020820180516001600160e01b0316635829492f60e11b1790525160e085901b6001600160e01b031916815261070b939291906000906004016119f8565b6020604051808303816000875af115801561072a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061074e9190611a4e565b50604051638a54c52f60e01b81526001600160a01b03891690638a54c52f90610791908a90600080516020611e638339815191529046908f908890600401611a6b565b6020604051808303816000875af11580156107b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107d49190611a9e565b506000846001600160a01b031663f1ab873c85604051806020016040528060008152506040516024016108079190611bdd565b60408051601f19818403018152918152602080830180516001600160e01b031663a4f9edbf60e01b179052905161085991600080516020611e6383398151915291899101918252602082015260400190565b60408051601f198184030181529082905280516020909101206001600160e01b031960e086901b168252610891939291600401611bf0565b6020604051808303816000875af11580156108b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108d49190611a9e565b604051602481018490526001600160a01b0382166044820152909150339063468721a7908c9060009060640160408051601f198184030181529181526020820180516001600160e01b031663320fbbb760e11b1790525160e085901b6001600160e01b031916815261094e939291906000906004016119f8565b6020604051808303816000875af115801561096d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109919190611a4e565b505098975050505050505050565b60005b81610100015151811015610a6257600082610100015182815181106109c9576109c9611abb565b602002602001015190506000610a0084600001518560a001518660c00151876060015188608001518960e001518860800151610b6e565b90506000610a1d85600001518660e0015185858960800151610cd5565b90506000610a438660200151876040015188600001518760800151886000015187611007565b9050610a538460600151826110b1565b846001019450505050506109a2565b5050565b606081600003610a8d5750506040805180820190915260018152600360fc1b602082015290565b8160005b8115610ab75780610aa181611c24565b9150610ab09050600a83611c53565b9150610a91565b6000816001600160401b03811115610ad157610ad161140c565b6040519080825280601f01601f191660200182016040528015610afb576020820181803683370190505b5090505b8415610b6657610b10600183611c67565b9150610b1d600a86611c7a565b610b28906030611900565b60f81b818381518110610b3d57610b3d611abb565b60200101906001600160f81b031916908160001a905350610b5f600a86611c53565b9450610aff565b949350505050565b60006001600160801b03821615610cc757866001600160a01b0316632f7fb7b6878a6001600160a01b0316631183a8c0876040518263ffffffff1660e01b8152600401610bbd91815260200190565b602060405180830381865afa158015610bda573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bfe91906118d1565b886000604051602001610c1b929190918252602082015260400190565b60408051601f198184030181528282526001600160801b0389166020840152910160408051601f19818403018152908290526001600160e01b031960e087901b168252610c7d94939291600080516020611e6383398151915290600401611c8e565b6020604051808303816000875af1158015610c9c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cc09190611a9e565b9050610cca565b50825b979650505050505050565b60405162460ea360e61b81526004810185905260009081906001600160a01b03881690631183a8c090602401602060405180830381865afa158015610d1e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d4291906118d1565b9050336001600160a01b031663468721a78860008989602001518a60a001518a8a8d60c001518e60400151604051602401610d839796959493929190611cda565b60408051601f198184030181529181526020820180516001600160e01b0316635829492f60e11b1790525160e085901b6001600160e01b0319168152610dd1939291906000906004016119f8565b6020604051808303816000875af1158015610df0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e149190611a4e565b5060808501516001600160801b031615610f3f5760408051600180825281830190925260009160208083019080368337019050509050856000015181600081518110610e6257610e62611abb565b60200260200101906001600160a01b031690816001600160a01b031681525050336001600160a01b031663468721a7866000896080015185604051602401610eab929190611d3e565b60408051601f198184030181529181526020820180516001600160e01b0316634a231cef60e01b1790525160e085901b6001600160e01b0319168152610ef9939291906000906004016119f8565b6020604051808303816000875af1158015610f18573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f3c9190611a4e565b50505b8451604051602481018390526001600160a01b039091166044820152339063468721a790899060009060640160408051601f198184030181529181526020820180516001600160e01b031663320fbbb760e11b1790525160e085901b6001600160e01b0319168152610fb9939291906000906004016119f8565b6020604051808303816000875af1158015610fd8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ffc9190611a4e565b509695505050505050565b60006001600160801b0384161561101f5750816110a7565b604051638a54c52f60e01b81526001600160a01b03881690638a54c52f90611061908990600080516020611e638339815191529046908b908990600401611a6b565b6020604051808303816000875af1158015611080573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110a49190611a9e565b90505b9695505050505050565b60005b82518110156112fa5760008382815181106110d1576110d1611abb565b60200260200101519050336001600160a01b031663468721a78260400151600084600001518560a001516040516024016111299291906001600160a01b039290921682526001600160801b0316602082015260400190565b60408051601f198184030181529181526020820180516001600160e01b031663095ea7b360e01b1790525160e085901b6001600160e01b0319168152611177939291906000906004016119f8565b6020604051808303816000875af1158015611196573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111ba9190611a4e565b50336001600160a01b031663468721a78260000151600060405180610100016040528086602001516001600160a01b03168152602001886001600160a01b031681526020018660a001516001600160801b0316815260200186604001516001600160a01b031681526020018660c00151151581526020018660e001511515815260200186606001518152602001866080015181525060405160240161125f9190611d93565b60408051601f198184030181529181526020820180516001600160e01b03166353b1572760e01b1790525160e085901b6001600160e01b03191681526112ad939291906000906004016119f8565b6020604051808303816000875af11580156112cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112f09190611a4e565b50506001016110b4565b505050565b60006020828403121561131157600080fd5b81356001600160401b0381111561132757600080fd5b8201610160818503121561133a57600080fd5b9392505050565b6001600160a01b038116811461135657600080fd5b50565b60006020828403121561136b57600080fd5b813561133a81611341565b803561138181611341565b919050565b60008235603e1983360301811261139c57600080fd5b9190910192915050565b60008235605e1983360301811261139c57600080fd5b6000808335601e198436030181126113d357600080fd5b8301803591506001600160401b038211156113ed57600080fd5b6020019150600581901b360382131561140557600080fd5b9250929050565b634e487b7160e01b600052604160045260246000fd5b60405161010081016001600160401b03811182821017156114455761144561140c565b60405290565b60405160e081016001600160401b03811182821017156114455761144561140c565b604051601f8201601f191681016001600160401b03811182821017156114955761149561140c565b604052919050565b60006001600160401b038211156114b6576114b661140c565b5060051b60200190565b600082601f8301126114d157600080fd5b81356001600160401b038111156114ea576114ea61140c565b6114fd601f8201601f191660200161146d565b81815284602083860101111561151257600080fd5b816020850160208301376000918101602001919091529392505050565b803564ffffffffff8116811461138157600080fd5b60006060828403121561155657600080fd5b604051606081016001600160401b03811182821017156115785761157861140c565b6040529050806115878361152f565b81526115956020840161152f565b60208201526115a66040840161152f565b60408201525092915050565b6000604082840312156115c457600080fd5b604080519081016001600160401b03811182821017156115e6576115e661140c565b60405290508082356115f781611341565b8152602092830135920191909152919050565b80356001600160801b038116811461138157600080fd5b801515811461135657600080fd5b803561138181611621565b600082601f83011261164b57600080fd5b813561165e6116598261149d565b61146d565b808282526020820191506020610160840286010192508583111561168157600080fd5b602085015b8381101561173f57610160818803121561169f57600080fd5b6116a7611422565b6116b082611376565b81526116be60208301611376565b60208201526116cf60408301611376565b60408201526116e18860608401611544565b60608201526116f38860c084016115b2565b6080820152611705610100830161160a565b60a0820152611717610120830161162f565b60c0820152611729610140830161162f565b60e0820152835260209092019161016001611686565b5095945050505050565b803563ffffffff8116811461138157600080fd5b600061176b6116598461149d565b8381526020810190600585901b84013681111561178757600080fd5b845b818110156118905780356001600160401b038111156117a757600080fd5b860160e03682900312156117ba57600080fd5b6117c261144b565b6117cb82611376565b815260208201356001600160401b038111156117e657600080fd5b6117f2368285016114c0565b60208301525060408201356001600160401b0381111561181157600080fd5b61181d368285016114c0565b60408301525060608201356001600160401b0381111561183c57600080fd5b6118483682850161163a565b60608301525061185a6080830161160a565b608082015261186b60a08301611749565b60a082015261187c60c0830161162f565b60c082015285525060209384019301611789565b509095945050505050565b60005b838110156118b657818101518382015260200161189e565b50506000910152565b6000825161139c81846020870161189b565b6000602082840312156118e357600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b80820180821115611913576119136118ea565b92915050565b6000808335601e1984360301811261193057600080fd5b8301803591506001600160401b0382111561194a57600080fd5b60200191503681900382131561140557600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b03861681526060602082018190526000906119ad908301868861195f565b82810360408401526119c081858761195f565b98975050505050505050565b600081518084526119e481602086016020860161189b565b601f01601f19169290920160200192915050565b60018060a01b0385168152836020820152608060408201526000611a1f60808301856119cc565b905060028310611a3f57634e487b7160e01b600052602160045260246000fd5b82606083015295945050505050565b600060208284031215611a6057600080fd5b815161133a81611621565b6001600160a01b039586168152602081019490945260408401929092529092166060820152608081019190915260a00190565b600060208284031215611ab057600080fd5b815161133a81611341565b634e487b7160e01b600052603260045260246000fd5b600082825180855260208501945060208160051b8301016020850160005b83811015611b2157601f19858403018852611b0b8383516119cc565b6020988901989093509190910190600101611aef565b50909695505050505050565b604081526000611b406040830185611ad1565b8281036020840152611b528185611ad1565b95945050505050565b600060208284031215611b6d57600080fd5b813561133a81611621565b89815260e060208201526000611b9260e083018a8c61195f565b60ff891660408401526001600160a01b0388811660608501528716608084015285151560a084015282810360c0840152611bcd81858761195f565b9c9b505050505050505050505050565b60208152600061133a60208301846119cc565b6001600160a01b0384168152606060208201819052600090611c14908301856119cc565b9050826040830152949350505050565b600060018201611c3657611c366118ea565b5060010190565b634e487b7160e01b600052601260045260246000fd5b600082611c6257611c62611c3d565b500490565b81810381811115611913576119136118ea565b600082611c8957611c89611c3d565b500690565b60018060a01b038616815284602082015260a060408201526000611cb560a08301866119cc565b8281036060840152611cc781866119cc565b9150508260808301529695505050505050565b87815260e060208201526000611cf360e08301896119cc565b63ffffffff881660408401526001600160a01b0387811660608501528616608084015284151560a084015282810360c0840152611d3081856119cc565b9a9950505050505050505050565b6000604082016001600160801b03851683526040602084015280845180835260608501915060208601925060005b81811015611b215783516001600160a01b0316835260209384019390920191600101611d6c565b81516001600160a01b0390811682526020808401518216908301526040808401516001600160801b03169083015260608084015191821690830152610160820190506080830151611de8608084018215159052565b5060a0830151611dfc60a084018215159052565b5060c0830151611e3b60c084018264ffffffffff815116825264ffffffffff602082015116602083015264ffffffffff60408201511660408301525050565b5060e0929092015180516001600160a01b031661012083015260200151610140909101529056fe5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b5072a26469706673582212201f5f415bcb47b5bcc3f3fe15fa8e4612de722a3ea1aaa69d546320c040c561ba64736f6c634300081c0033", + "numDeployments": 2, + "solcInputHash": "f1fca9a70591742a2aedd10e2fd7e744", + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"SALT\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"contract IHats\",\"name\":\"hatsProtocol\",\"type\":\"address\"},{\"internalType\":\"contract IERC6551Registry\",\"name\":\"erc6551Registry\",\"type\":\"address\"},{\"internalType\":\"contract IHatsModuleFactory\",\"name\":\"hatsModuleFactory\",\"type\":\"address\"},{\"internalType\":\"contract ModuleProxyFactory\",\"name\":\"moduleProxyFactory\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"keyValuePairs\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"decentAutonomousAdminImplementation\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"hatsAccountImplementation\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"hatsElectionsEligibilityImplementation\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"string\",\"name\":\"details\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"imageURI\",\"type\":\"string\"}],\"internalType\":\"struct DecentHatsCreationModule.TopHatParams\",\"name\":\"topHat\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"string\",\"name\":\"details\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"imageURI\",\"type\":\"string\"},{\"internalType\":\"bool\",\"name\":\"isMutable\",\"type\":\"bool\"}],\"internalType\":\"struct DecentHatsCreationModule.AdminHatParams\",\"name\":\"adminHat\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"wearer\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"details\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"imageURI\",\"type\":\"string\"},{\"components\":[{\"internalType\":\"contract ISablierV2LockupLinear\",\"name\":\"sablier\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint40\",\"name\":\"start\",\"type\":\"uint40\"},{\"internalType\":\"uint40\",\"name\":\"cliff\",\"type\":\"uint40\"},{\"internalType\":\"uint40\",\"name\":\"end\",\"type\":\"uint40\"}],\"internalType\":\"struct LockupLinear.Timestamps\",\"name\":\"timestamps\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"UD60x18\",\"name\":\"fee\",\"type\":\"uint256\"}],\"internalType\":\"struct Broker\",\"name\":\"broker\",\"type\":\"tuple\"},{\"internalType\":\"uint128\",\"name\":\"totalAmount\",\"type\":\"uint128\"},{\"internalType\":\"bool\",\"name\":\"cancelable\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"transferable\",\"type\":\"bool\"}],\"internalType\":\"struct DecentHatsModuleUtils.SablierStreamParams[]\",\"name\":\"sablierStreamsParams\",\"type\":\"tuple[]\"},{\"internalType\":\"uint128\",\"name\":\"termEndDateTs\",\"type\":\"uint128\"},{\"internalType\":\"uint32\",\"name\":\"maxSupply\",\"type\":\"uint32\"},{\"internalType\":\"bool\",\"name\":\"isMutable\",\"type\":\"bool\"}],\"internalType\":\"struct DecentHatsModuleUtils.HatParams[]\",\"name\":\"hats\",\"type\":\"tuple[]\"}],\"internalType\":\"struct DecentHatsCreationModule.CreateTreeParams\",\"name\":\"treeParams\",\"type\":\"tuple\"}],\"name\":\"createAndDeclareTree\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"createAndDeclareTree((address,address,address,address,address,address,address,address,(string,string),(string,string,bool),(address,string,string,(address,address,address,(uint40,uint40,uint40),(address,uint256),uint128,bool,bool)[],uint128,uint32,bool)[]))\":{\"details\":\"For each hat that is included, if the hat is: - termed, its stream funds on are targeted directly at the nominated wearer. The wearer should directly call `withdraw-` on the Sablier contract. - untermed, its stream funds are targeted at the hat's smart account. In order to withdraw funds from the stream, the hat's smart account must be the one call to `withdraw-` on the Sablier contract, setting the recipient arg to its wearer.In order for a Safe to seamlessly create roles even if it has never previously created a role and thus has no hat tree, we defer the creation of the hat tree and its setup to this contract. This way, in a single tx block, the resulting topHatId of the newly created hat can be used to create an admin hat and any other hats needed. We also make use of `KeyValuePairs` to associate the topHatId with the Safe.\",\"params\":{\"treeParams\":\"The parameters for creating the Hat Tree with Roles\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"createAndDeclareTree((address,address,address,address,address,address,address,address,(string,string),(string,string,bool),(address,string,string,(address,address,address,(uint40,uint40,uint40),(address,uint256),uint128,bool,bool)[],uint128,uint32,bool)[]))\":{\"notice\":\"For a safe without any roles previously created on it, this function should be called. It sets up the top hat and admin hat, as well as any other hats and their streams that are provided, then transfers the top hat to the calling safe.This contract should be enabled a module on the Safe for which the role(s) are to be created, and disabled after.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/modules/DecentHatsCreationModule.sol\":\"DecentHatsCreationModule\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\npragma solidity >=0.7.0 <0.9.0;\\n\\n/// @title Enum - Collection of enums\\n/// @author Richard Meissner - \\ncontract Enum {\\n enum Operation {Call, DelegateCall}\\n}\\n\",\"keccak256\":\"0x473e45b1a5cc47be494b0e123c9127f0c11c1e0992a321ae5a644c0bfdb2c14f\",\"license\":\"LGPL-3.0-only\"},\"@gnosis.pm/zodiac/contracts/factory/ModuleProxyFactory.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\npragma solidity >=0.8.0;\\n\\ncontract ModuleProxyFactory {\\n event ModuleProxyCreation(\\n address indexed proxy,\\n address indexed masterCopy\\n );\\n\\n /// `target` can not be zero.\\n error ZeroAddress(address target);\\n\\n /// `address_` is already taken.\\n error TakenAddress(address address_);\\n\\n /// @notice Initialization failed.\\n error FailedInitialization();\\n\\n function createProxy(address target, bytes32 salt)\\n internal\\n returns (address result)\\n {\\n if (address(target) == address(0)) revert ZeroAddress(target);\\n bytes memory deployment = abi.encodePacked(\\n hex\\\"602d8060093d393df3363d3d373d3d3d363d73\\\",\\n target,\\n hex\\\"5af43d82803e903d91602b57fd5bf3\\\"\\n );\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n result := create2(0, add(deployment, 0x20), mload(deployment), salt)\\n }\\n if (result == address(0)) revert TakenAddress(result);\\n }\\n\\n function deployModule(\\n address masterCopy,\\n bytes memory initializer,\\n uint256 saltNonce\\n ) public returns (address proxy) {\\n proxy = createProxy(\\n masterCopy,\\n keccak256(abi.encodePacked(keccak256(initializer), saltNonce))\\n );\\n (bool success, ) = proxy.call(initializer);\\n if (!success) revert FailedInitialization();\\n\\n emit ModuleProxyCreation(proxy, masterCopy);\\n }\\n}\\n\",\"keccak256\":\"0x70f6f1d88cf3382748e58f85ba87279f5bb8761863c293dd8c197a71ff558761\",\"license\":\"LGPL-3.0-only\"},\"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\n\\n/// @title Zodiac Avatar - A contract that manages modules that can execute transactions via this contract.\\npragma solidity >=0.7.0 <0.9.0;\\n\\nimport \\\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\\\";\\n\\ninterface IAvatar {\\n event EnabledModule(address module);\\n event DisabledModule(address module);\\n event ExecutionFromModuleSuccess(address indexed module);\\n event ExecutionFromModuleFailure(address indexed module);\\n\\n /// @dev Enables a module on the avatar.\\n /// @notice Can only be called by the avatar.\\n /// @notice Modules should be stored as a linked list.\\n /// @notice Must emit EnabledModule(address module) if successful.\\n /// @param module Module to be enabled.\\n function enableModule(address module) external;\\n\\n /// @dev Disables a module on the avatar.\\n /// @notice Can only be called by the avatar.\\n /// @notice Must emit DisabledModule(address module) if successful.\\n /// @param prevModule Address that pointed to the module to be removed in the linked list\\n /// @param module Module to be removed.\\n function disableModule(address prevModule, address module) external;\\n\\n /// @dev Allows a Module to execute a transaction.\\n /// @notice Can only be called by an enabled module.\\n /// @notice Must emit ExecutionFromModuleSuccess(address module) if successful.\\n /// @notice Must emit ExecutionFromModuleFailure(address module) if unsuccessful.\\n /// @param to Destination address of module transaction.\\n /// @param value Ether value of module transaction.\\n /// @param data Data payload of module transaction.\\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\\n function execTransactionFromModule(\\n address to,\\n uint256 value,\\n bytes memory data,\\n Enum.Operation operation\\n ) external returns (bool success);\\n\\n /// @dev Allows a Module to execute a transaction and return data\\n /// @notice Can only be called by an enabled module.\\n /// @notice Must emit ExecutionFromModuleSuccess(address module) if successful.\\n /// @notice Must emit ExecutionFromModuleFailure(address module) if unsuccessful.\\n /// @param to Destination address of module transaction.\\n /// @param value Ether value of module transaction.\\n /// @param data Data payload of module transaction.\\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\\n function execTransactionFromModuleReturnData(\\n address to,\\n uint256 value,\\n bytes memory data,\\n Enum.Operation operation\\n ) external returns (bool success, bytes memory returnData);\\n\\n /// @dev Returns if an module is enabled\\n /// @return True if the module is enabled\\n function isModuleEnabled(address module) external view returns (bool);\\n\\n /// @dev Returns array of modules.\\n /// @param start Start of the page.\\n /// @param pageSize Maximum number of modules that should be returned.\\n /// @return array Array of modules.\\n /// @return next Start of the next page.\\n function getModulesPaginated(address start, uint256 pageSize)\\n external\\n view\\n returns (address[] memory array, address next);\\n}\\n\",\"keccak256\":\"0xcd5508ffe596eef8fbccfd5fc4f10a34397773547ce64e212d48b5212865ec1f\",\"license\":\"LGPL-3.0-only\"},\"@openzeppelin/contracts/interfaces/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/introspection/IERC165.sol\\\";\\n\",\"keccak256\":\"0xd04b0f06e0666f29cf7cccc82894de541e19bb30a765b107b1e40bb7fe5f7d7a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev 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 amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `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 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes calldata data\\n ) external;\\n\\n /**\\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 {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the caller.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool _approved) external;\\n\\n /**\\n * @dev Returns 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\",\"keccak256\":\"0xed6a749c5373af398105ce6ee3ac4763aa450ea7285d268c85d9eeca809cdb1f\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../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\",\"keccak256\":\"0x75b829ff2f26c14355d1cba20e16fe7b29ca58eb5fef665ede48bc0f9c6c74b9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _HEX_SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\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 // Inspired by OraclizeAPI's implementation - MIT licence\\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\\n\\n if (value == 0) {\\n return \\\"0\\\";\\n }\\n uint256 temp = value;\\n uint256 digits;\\n while (temp != 0) {\\n digits++;\\n temp /= 10;\\n }\\n bytes memory buffer = new bytes(digits);\\n while (value != 0) {\\n digits -= 1;\\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\\n value /= 10;\\n }\\n return string(buffer);\\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 if (value == 0) {\\n return \\\"0x00\\\";\\n }\\n uint256 temp = value;\\n uint256 length = 0;\\n while (temp != 0) {\\n length++;\\n temp >>= 8;\\n }\\n return toHexString(value, length);\\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 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_SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\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 representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n}\\n\",\"keccak256\":\"0xaf159a8b1923ad2a26d516089bceca9bdeaeacd04be50983ea00ba63070f08a3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"@prb/math/src/Common.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\n// Common.sol\\n//\\n// Common mathematical functions used in both SD59x18 and UD60x18. Note that these global functions do not\\n// always operate with SD59x18 and UD60x18 numbers.\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CUSTOM ERRORS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @notice Thrown when the resultant value in {mulDiv} overflows uint256.\\nerror PRBMath_MulDiv_Overflow(uint256 x, uint256 y, uint256 denominator);\\n\\n/// @notice Thrown when the resultant value in {mulDiv18} overflows uint256.\\nerror PRBMath_MulDiv18_Overflow(uint256 x, uint256 y);\\n\\n/// @notice Thrown when one of the inputs passed to {mulDivSigned} is `type(int256).min`.\\nerror PRBMath_MulDivSigned_InputTooSmall();\\n\\n/// @notice Thrown when the resultant value in {mulDivSigned} overflows int256.\\nerror PRBMath_MulDivSigned_Overflow(int256 x, int256 y);\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CONSTANTS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @dev The maximum value a uint128 number can have.\\nuint128 constant MAX_UINT128 = type(uint128).max;\\n\\n/// @dev The maximum value a uint40 number can have.\\nuint40 constant MAX_UINT40 = type(uint40).max;\\n\\n/// @dev The unit number, which the decimal precision of the fixed-point types.\\nuint256 constant UNIT = 1e18;\\n\\n/// @dev The unit number inverted mod 2^256.\\nuint256 constant UNIT_INVERSE = 78156646155174841979727994598816262306175212592076161876661_508869554232690281;\\n\\n/// @dev The the largest power of two that divides the decimal value of `UNIT`. The logarithm of this value is the least significant\\n/// bit in the binary representation of `UNIT`.\\nuint256 constant UNIT_LPOTD = 262144;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @notice Calculates the binary exponent of x using the binary fraction method.\\n/// @dev Has to use 192.64-bit fixed-point numbers. See https://ethereum.stackexchange.com/a/96594/24693.\\n/// @param x The exponent as an unsigned 192.64-bit fixed-point number.\\n/// @return result The result as an unsigned 60.18-decimal fixed-point number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp2(uint256 x) pure returns (uint256 result) {\\n unchecked {\\n // Start from 0.5 in the 192.64-bit fixed-point format.\\n result = 0x800000000000000000000000000000000000000000000000;\\n\\n // The following logic multiplies the result by $\\\\sqrt{2^{-i}}$ when the bit at position i is 1. Key points:\\n //\\n // 1. Intermediate results will not overflow, as the starting point is 2^191 and all magic factors are under 2^65.\\n // 2. The rationale for organizing the if statements into groups of 8 is gas savings. If the result of performing\\n // a bitwise AND operation between x and any value in the array [0x80; 0x40; 0x20; 0x10; 0x08; 0x04; 0x02; 0x01] is 1,\\n // we know that `x & 0xFF` is also 1.\\n if (x & 0xFF00000000000000 > 0) {\\n if (x & 0x8000000000000000 > 0) {\\n result = (result * 0x16A09E667F3BCC909) >> 64;\\n }\\n if (x & 0x4000000000000000 > 0) {\\n result = (result * 0x1306FE0A31B7152DF) >> 64;\\n }\\n if (x & 0x2000000000000000 > 0) {\\n result = (result * 0x1172B83C7D517ADCE) >> 64;\\n }\\n if (x & 0x1000000000000000 > 0) {\\n result = (result * 0x10B5586CF9890F62A) >> 64;\\n }\\n if (x & 0x800000000000000 > 0) {\\n result = (result * 0x1059B0D31585743AE) >> 64;\\n }\\n if (x & 0x400000000000000 > 0) {\\n result = (result * 0x102C9A3E778060EE7) >> 64;\\n }\\n if (x & 0x200000000000000 > 0) {\\n result = (result * 0x10163DA9FB33356D8) >> 64;\\n }\\n if (x & 0x100000000000000 > 0) {\\n result = (result * 0x100B1AFA5ABCBED61) >> 64;\\n }\\n }\\n\\n if (x & 0xFF000000000000 > 0) {\\n if (x & 0x80000000000000 > 0) {\\n result = (result * 0x10058C86DA1C09EA2) >> 64;\\n }\\n if (x & 0x40000000000000 > 0) {\\n result = (result * 0x1002C605E2E8CEC50) >> 64;\\n }\\n if (x & 0x20000000000000 > 0) {\\n result = (result * 0x100162F3904051FA1) >> 64;\\n }\\n if (x & 0x10000000000000 > 0) {\\n result = (result * 0x1000B175EFFDC76BA) >> 64;\\n }\\n if (x & 0x8000000000000 > 0) {\\n result = (result * 0x100058BA01FB9F96D) >> 64;\\n }\\n if (x & 0x4000000000000 > 0) {\\n result = (result * 0x10002C5CC37DA9492) >> 64;\\n }\\n if (x & 0x2000000000000 > 0) {\\n result = (result * 0x1000162E525EE0547) >> 64;\\n }\\n if (x & 0x1000000000000 > 0) {\\n result = (result * 0x10000B17255775C04) >> 64;\\n }\\n }\\n\\n if (x & 0xFF0000000000 > 0) {\\n if (x & 0x800000000000 > 0) {\\n result = (result * 0x1000058B91B5BC9AE) >> 64;\\n }\\n if (x & 0x400000000000 > 0) {\\n result = (result * 0x100002C5C89D5EC6D) >> 64;\\n }\\n if (x & 0x200000000000 > 0) {\\n result = (result * 0x10000162E43F4F831) >> 64;\\n }\\n if (x & 0x100000000000 > 0) {\\n result = (result * 0x100000B1721BCFC9A) >> 64;\\n }\\n if (x & 0x80000000000 > 0) {\\n result = (result * 0x10000058B90CF1E6E) >> 64;\\n }\\n if (x & 0x40000000000 > 0) {\\n result = (result * 0x1000002C5C863B73F) >> 64;\\n }\\n if (x & 0x20000000000 > 0) {\\n result = (result * 0x100000162E430E5A2) >> 64;\\n }\\n if (x & 0x10000000000 > 0) {\\n result = (result * 0x1000000B172183551) >> 64;\\n }\\n }\\n\\n if (x & 0xFF00000000 > 0) {\\n if (x & 0x8000000000 > 0) {\\n result = (result * 0x100000058B90C0B49) >> 64;\\n }\\n if (x & 0x4000000000 > 0) {\\n result = (result * 0x10000002C5C8601CC) >> 64;\\n }\\n if (x & 0x2000000000 > 0) {\\n result = (result * 0x1000000162E42FFF0) >> 64;\\n }\\n if (x & 0x1000000000 > 0) {\\n result = (result * 0x10000000B17217FBB) >> 64;\\n }\\n if (x & 0x800000000 > 0) {\\n result = (result * 0x1000000058B90BFCE) >> 64;\\n }\\n if (x & 0x400000000 > 0) {\\n result = (result * 0x100000002C5C85FE3) >> 64;\\n }\\n if (x & 0x200000000 > 0) {\\n result = (result * 0x10000000162E42FF1) >> 64;\\n }\\n if (x & 0x100000000 > 0) {\\n result = (result * 0x100000000B17217F8) >> 64;\\n }\\n }\\n\\n if (x & 0xFF000000 > 0) {\\n if (x & 0x80000000 > 0) {\\n result = (result * 0x10000000058B90BFC) >> 64;\\n }\\n if (x & 0x40000000 > 0) {\\n result = (result * 0x1000000002C5C85FE) >> 64;\\n }\\n if (x & 0x20000000 > 0) {\\n result = (result * 0x100000000162E42FF) >> 64;\\n }\\n if (x & 0x10000000 > 0) {\\n result = (result * 0x1000000000B17217F) >> 64;\\n }\\n if (x & 0x8000000 > 0) {\\n result = (result * 0x100000000058B90C0) >> 64;\\n }\\n if (x & 0x4000000 > 0) {\\n result = (result * 0x10000000002C5C860) >> 64;\\n }\\n if (x & 0x2000000 > 0) {\\n result = (result * 0x1000000000162E430) >> 64;\\n }\\n if (x & 0x1000000 > 0) {\\n result = (result * 0x10000000000B17218) >> 64;\\n }\\n }\\n\\n if (x & 0xFF0000 > 0) {\\n if (x & 0x800000 > 0) {\\n result = (result * 0x1000000000058B90C) >> 64;\\n }\\n if (x & 0x400000 > 0) {\\n result = (result * 0x100000000002C5C86) >> 64;\\n }\\n if (x & 0x200000 > 0) {\\n result = (result * 0x10000000000162E43) >> 64;\\n }\\n if (x & 0x100000 > 0) {\\n result = (result * 0x100000000000B1721) >> 64;\\n }\\n if (x & 0x80000 > 0) {\\n result = (result * 0x10000000000058B91) >> 64;\\n }\\n if (x & 0x40000 > 0) {\\n result = (result * 0x1000000000002C5C8) >> 64;\\n }\\n if (x & 0x20000 > 0) {\\n result = (result * 0x100000000000162E4) >> 64;\\n }\\n if (x & 0x10000 > 0) {\\n result = (result * 0x1000000000000B172) >> 64;\\n }\\n }\\n\\n if (x & 0xFF00 > 0) {\\n if (x & 0x8000 > 0) {\\n result = (result * 0x100000000000058B9) >> 64;\\n }\\n if (x & 0x4000 > 0) {\\n result = (result * 0x10000000000002C5D) >> 64;\\n }\\n if (x & 0x2000 > 0) {\\n result = (result * 0x1000000000000162E) >> 64;\\n }\\n if (x & 0x1000 > 0) {\\n result = (result * 0x10000000000000B17) >> 64;\\n }\\n if (x & 0x800 > 0) {\\n result = (result * 0x1000000000000058C) >> 64;\\n }\\n if (x & 0x400 > 0) {\\n result = (result * 0x100000000000002C6) >> 64;\\n }\\n if (x & 0x200 > 0) {\\n result = (result * 0x10000000000000163) >> 64;\\n }\\n if (x & 0x100 > 0) {\\n result = (result * 0x100000000000000B1) >> 64;\\n }\\n }\\n\\n if (x & 0xFF > 0) {\\n if (x & 0x80 > 0) {\\n result = (result * 0x10000000000000059) >> 64;\\n }\\n if (x & 0x40 > 0) {\\n result = (result * 0x1000000000000002C) >> 64;\\n }\\n if (x & 0x20 > 0) {\\n result = (result * 0x10000000000000016) >> 64;\\n }\\n if (x & 0x10 > 0) {\\n result = (result * 0x1000000000000000B) >> 64;\\n }\\n if (x & 0x8 > 0) {\\n result = (result * 0x10000000000000006) >> 64;\\n }\\n if (x & 0x4 > 0) {\\n result = (result * 0x10000000000000003) >> 64;\\n }\\n if (x & 0x2 > 0) {\\n result = (result * 0x10000000000000001) >> 64;\\n }\\n if (x & 0x1 > 0) {\\n result = (result * 0x10000000000000001) >> 64;\\n }\\n }\\n\\n // In the code snippet below, two operations are executed simultaneously:\\n //\\n // 1. The result is multiplied by $(2^n + 1)$, where $2^n$ represents the integer part, and the additional 1\\n // accounts for the initial guess of 0.5. This is achieved by subtracting from 191 instead of 192.\\n // 2. The result is then converted to an unsigned 60.18-decimal fixed-point format.\\n //\\n // The underlying logic is based on the relationship $2^{191-ip} = 2^{ip} / 2^{191}$, where $ip$ denotes the,\\n // integer part, $2^n$.\\n result *= UNIT;\\n result >>= (191 - (x >> 64));\\n }\\n}\\n\\n/// @notice Finds the zero-based index of the first 1 in the binary representation of x.\\n///\\n/// @dev See the note on \\\"msb\\\" in this Wikipedia article: https://en.wikipedia.org/wiki/Find_first_set\\n///\\n/// Each step in this implementation is equivalent to this high-level code:\\n///\\n/// ```solidity\\n/// if (x >= 2 ** 128) {\\n/// x >>= 128;\\n/// result += 128;\\n/// }\\n/// ```\\n///\\n/// Where 128 is replaced with each respective power of two factor. See the full high-level implementation here:\\n/// https://gist.github.com/PaulRBerg/f932f8693f2733e30c4d479e8e980948\\n///\\n/// The Yul instructions used below are:\\n///\\n/// - \\\"gt\\\" is \\\"greater than\\\"\\n/// - \\\"or\\\" is the OR bitwise operator\\n/// - \\\"shl\\\" is \\\"shift left\\\"\\n/// - \\\"shr\\\" is \\\"shift right\\\"\\n///\\n/// @param x The uint256 number for which to find the index of the most significant bit.\\n/// @return result The index of the most significant bit as a uint256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction msb(uint256 x) pure returns (uint256 result) {\\n // 2^128\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(7, gt(x, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^64\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(6, gt(x, 0xFFFFFFFFFFFFFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^32\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(5, gt(x, 0xFFFFFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^16\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(4, gt(x, 0xFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^8\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(3, gt(x, 0xFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^4\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(2, gt(x, 0xF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^2\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(1, gt(x, 0x3))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^1\\n // No need to shift x any more.\\n assembly (\\\"memory-safe\\\") {\\n let factor := gt(x, 0x1)\\n result := or(result, factor)\\n }\\n}\\n\\n/// @notice Calculates x*y\\u00f7denominator with 512-bit precision.\\n///\\n/// @dev Credits to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv.\\n///\\n/// Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - The denominator must not be zero.\\n/// - The result must fit in uint256.\\n///\\n/// @param x The multiplicand as a uint256.\\n/// @param y The multiplier as a uint256.\\n/// @param denominator The divisor as a uint256.\\n/// @return result The result as a uint256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mulDiv(uint256 x, uint256 y, uint256 denominator) pure returns (uint256 result) {\\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; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly (\\\"memory-safe\\\") {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\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 unchecked {\\n return prod0 / denominator;\\n }\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n if (prod1 >= denominator) {\\n revert PRBMath_MulDiv_Overflow(x, y, denominator);\\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 (\\\"memory-safe\\\") {\\n // Compute remainder using the mulmod Yul instruction.\\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 unchecked {\\n // Calculate the largest power of two divisor of the denominator using the unary operator ~. This operation cannot overflow\\n // because the denominator cannot be zero at this point in the function execution. The result is always >= 1.\\n // For more detail, see https://cs.stackexchange.com/q/138556/92363.\\n uint256 lpotdod = denominator & (~denominator + 1);\\n uint256 flippedLpotdod;\\n\\n assembly (\\\"memory-safe\\\") {\\n // Factor powers of two out of denominator.\\n denominator := div(denominator, lpotdod)\\n\\n // Divide [prod1 prod0] by lpotdod.\\n prod0 := div(prod0, lpotdod)\\n\\n // Get the flipped value `2^256 / lpotdod`. If the `lpotdod` is zero, the flipped value is one.\\n // `sub(0, lpotdod)` produces the two's complement version of `lpotdod`, which is equivalent to flipping all the bits.\\n // However, `div` interprets this value as an unsigned value: https://ethereum.stackexchange.com/q/147168/24693\\n flippedLpotdod := add(div(sub(0, lpotdod), lpotdod), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * flippedLpotdod;\\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 works\\n // 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 }\\n}\\n\\n/// @notice Calculates x*y\\u00f71e18 with 512-bit precision.\\n///\\n/// @dev A variant of {mulDiv} with constant folding, i.e. in which the denominator is hard coded to 1e18.\\n///\\n/// Notes:\\n/// - The body is purposely left uncommented; to understand how this works, see the documentation in {mulDiv}.\\n/// - The result is rounded toward zero.\\n/// - We take as an axiom that the result cannot be `MAX_UINT256` when x and y solve the following system of equations:\\n///\\n/// $$\\n/// \\\\begin{cases}\\n/// x * y = MAX\\\\_UINT256 * UNIT \\\\\\\\\\n/// (x * y) \\\\% UNIT \\\\geq \\\\frac{UNIT}{2}\\n/// \\\\end{cases}\\n/// $$\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {mulDiv}.\\n/// - The result must fit in uint256.\\n///\\n/// @param x The multiplicand as an unsigned 60.18-decimal fixed-point number.\\n/// @param y The multiplier as an unsigned 60.18-decimal fixed-point number.\\n/// @return result The result as an unsigned 60.18-decimal fixed-point number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mulDiv18(uint256 x, uint256 y) pure returns (uint256 result) {\\n uint256 prod0;\\n uint256 prod1;\\n assembly (\\\"memory-safe\\\") {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n if (prod1 == 0) {\\n unchecked {\\n return prod0 / UNIT;\\n }\\n }\\n\\n if (prod1 >= UNIT) {\\n revert PRBMath_MulDiv18_Overflow(x, y);\\n }\\n\\n uint256 remainder;\\n assembly (\\\"memory-safe\\\") {\\n remainder := mulmod(x, y, UNIT)\\n result :=\\n mul(\\n or(\\n div(sub(prod0, remainder), UNIT_LPOTD),\\n mul(sub(prod1, gt(remainder, prod0)), add(div(sub(0, UNIT_LPOTD), UNIT_LPOTD), 1))\\n ),\\n UNIT_INVERSE\\n )\\n }\\n}\\n\\n/// @notice Calculates x*y\\u00f7denominator with 512-bit precision.\\n///\\n/// @dev This is an extension of {mulDiv} for signed numbers, which works by computing the signs and the absolute values separately.\\n///\\n/// Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {mulDiv}.\\n/// - None of the inputs can be `type(int256).min`.\\n/// - The result must fit in int256.\\n///\\n/// @param x The multiplicand as an int256.\\n/// @param y The multiplier as an int256.\\n/// @param denominator The divisor as an int256.\\n/// @return result The result as an int256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mulDivSigned(int256 x, int256 y, int256 denominator) pure returns (int256 result) {\\n if (x == type(int256).min || y == type(int256).min || denominator == type(int256).min) {\\n revert PRBMath_MulDivSigned_InputTooSmall();\\n }\\n\\n // Get hold of the absolute values of x, y and the denominator.\\n uint256 xAbs;\\n uint256 yAbs;\\n uint256 dAbs;\\n unchecked {\\n xAbs = x < 0 ? uint256(-x) : uint256(x);\\n yAbs = y < 0 ? uint256(-y) : uint256(y);\\n dAbs = denominator < 0 ? uint256(-denominator) : uint256(denominator);\\n }\\n\\n // Compute the absolute value of x*y\\u00f7denominator. The result must fit in int256.\\n uint256 resultAbs = mulDiv(xAbs, yAbs, dAbs);\\n if (resultAbs > uint256(type(int256).max)) {\\n revert PRBMath_MulDivSigned_Overflow(x, y);\\n }\\n\\n // Get the signs of x, y and the denominator.\\n uint256 sx;\\n uint256 sy;\\n uint256 sd;\\n assembly (\\\"memory-safe\\\") {\\n // \\\"sgt\\\" is the \\\"signed greater than\\\" assembly instruction and \\\"sub(0,1)\\\" is -1 in two's complement.\\n sx := sgt(x, sub(0, 1))\\n sy := sgt(y, sub(0, 1))\\n sd := sgt(denominator, sub(0, 1))\\n }\\n\\n // XOR over sx, sy and sd. What this does is to check whether there are 1 or 3 negative signs in the inputs.\\n // If there are, the result should be negative. Otherwise, it should be positive.\\n unchecked {\\n result = sx ^ sy ^ sd == 0 ? -int256(resultAbs) : int256(resultAbs);\\n }\\n}\\n\\n/// @notice Calculates the square root of x using the Babylonian method.\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\\n///\\n/// Notes:\\n/// - If x is not a perfect square, the result is rounded down.\\n/// - Credits to OpenZeppelin for the explanations in comments below.\\n///\\n/// @param x The uint256 number for which to calculate the square root.\\n/// @return result The result as a uint256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction sqrt(uint256 x) pure returns (uint256 result) {\\n if (x == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we calculate the biggest power of 2 which is smaller than the square root of x.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of x is a power of 2 such that we have:\\n //\\n // $$\\n // msb(x) <= x <= 2*msb(x)$\\n // $$\\n //\\n // We write $msb(x)$ as $2^k$, and we get:\\n //\\n // $$\\n // k = log_2(x)\\n // $$\\n //\\n // Thus, we can write the initial inequality as:\\n //\\n // $$\\n // 2^{log_2(x)} <= x <= 2*2^{log_2(x)+1} \\\\\\\\\\n // sqrt(2^k) <= sqrt(x) < sqrt(2^{k+1}) \\\\\\\\\\n // 2^{k/2} <= sqrt(x) < 2^{(k+1)/2} <= 2^{(k/2)+1}\\n // $$\\n //\\n // Consequently, $2^{log_2(x) /2} is a good first approximation of sqrt(x) with at least one correct bit.\\n uint256 xAux = uint256(x);\\n result = 1;\\n if (xAux >= 2 ** 128) {\\n xAux >>= 128;\\n result <<= 64;\\n }\\n if (xAux >= 2 ** 64) {\\n xAux >>= 64;\\n result <<= 32;\\n }\\n if (xAux >= 2 ** 32) {\\n xAux >>= 32;\\n result <<= 16;\\n }\\n if (xAux >= 2 ** 16) {\\n xAux >>= 16;\\n result <<= 8;\\n }\\n if (xAux >= 2 ** 8) {\\n xAux >>= 8;\\n result <<= 4;\\n }\\n if (xAux >= 2 ** 4) {\\n xAux >>= 4;\\n result <<= 2;\\n }\\n if (xAux >= 2 ** 2) {\\n result <<= 1;\\n }\\n\\n // At this point, `result` is an estimation with at least one bit of precision. We know the true value has at\\n // most 128 bits, since it is the square root of a uint256. Newton's method converges quadratically (precision\\n // doubles at every iteration). We thus need at most 7 iteration to turn our partial result with one bit of\\n // precision into the expected uint128 result.\\n unchecked {\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n\\n // If x is not a perfect square, round the result toward zero.\\n uint256 roundedResult = x / result;\\n if (result >= roundedResult) {\\n result = roundedResult;\\n }\\n }\\n}\\n\",\"keccak256\":\"0xaa374e2c26cc93e8c22a6953804ee05f811597ef5fa82f76824378b22944778b\",\"license\":\"MIT\"},\"@prb/math/src/UD2x18.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\n/*\\n\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2550\\u2550\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2554\\u2588\\u2588\\u2588\\u2588\\u2554\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551 \\u255a\\u2550\\u255d \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\n\\n\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2550\\u2550\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d \\u255a\\u2588\\u2588\\u2588\\u2554\\u255d \\u255a\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u255d\\n\\n*/\\n\\nimport \\\"./ud2x18/Casting.sol\\\";\\nimport \\\"./ud2x18/Constants.sol\\\";\\nimport \\\"./ud2x18/Errors.sol\\\";\\nimport \\\"./ud2x18/ValueType.sol\\\";\\n\",\"keccak256\":\"0xfb624e24cd8bb790fa08e7827819de85504a86e20e961fa4ad126c65b6d90641\",\"license\":\"MIT\"},\"@prb/math/src/UD60x18.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\n/*\\n\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2550\\u2550\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2554\\u2588\\u2588\\u2588\\u2588\\u2554\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551 \\u255a\\u2550\\u255d \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\n\\n\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2550\\u2588\\u2588\\u2588\\u2588\\u2557\\u255a\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2588\\u2588\\u2551 \\u255a\\u2588\\u2588\\u2588\\u2554\\u255d \\u255a\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2554\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2554\\u255d \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u255d\\n\\n*/\\n\\nimport \\\"./ud60x18/Casting.sol\\\";\\nimport \\\"./ud60x18/Constants.sol\\\";\\nimport \\\"./ud60x18/Conversions.sol\\\";\\nimport \\\"./ud60x18/Errors.sol\\\";\\nimport \\\"./ud60x18/Helpers.sol\\\";\\nimport \\\"./ud60x18/Math.sol\\\";\\nimport \\\"./ud60x18/ValueType.sol\\\";\\n\",\"keccak256\":\"0xb98c6f74275914d279e8af6c502c2b1f50d5f6e1ed418d3b0153f5a193206c48\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as CastingErrors;\\nimport { SD59x18 } from \\\"../sd59x18/ValueType.sol\\\";\\nimport { UD2x18 } from \\\"../ud2x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"../ud60x18/ValueType.sol\\\";\\nimport { SD1x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts an SD1x18 number into SD59x18.\\n/// @dev There is no overflow check because the domain of SD1x18 is a subset of SD59x18.\\nfunction intoSD59x18(SD1x18 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(int256(SD1x18.unwrap(x)));\\n}\\n\\n/// @notice Casts an SD1x18 number into UD2x18.\\n/// - x must be positive.\\nfunction intoUD2x18(SD1x18 x) pure returns (UD2x18 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUD2x18_Underflow(x);\\n }\\n result = UD2x18.wrap(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into UD60x18.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUD60x18(SD1x18 x) pure returns (UD60x18 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUD60x18_Underflow(x);\\n }\\n result = UD60x18.wrap(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into uint256.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUint256(SD1x18 x) pure returns (uint256 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint256_Underflow(x);\\n }\\n result = uint256(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into uint128.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUint128(SD1x18 x) pure returns (uint128 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint128_Underflow(x);\\n }\\n result = uint128(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(SD1x18 x) pure returns (uint40 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint40_Underflow(x);\\n }\\n if (xInt > int64(uint64(Common.MAX_UINT40))) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint40_Overflow(x);\\n }\\n result = uint40(uint64(xInt));\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction sd1x18(int64 x) pure returns (SD1x18 result) {\\n result = SD1x18.wrap(x);\\n}\\n\\n/// @notice Unwraps an SD1x18 number into int64.\\nfunction unwrap(SD1x18 x) pure returns (int64 result) {\\n result = SD1x18.unwrap(x);\\n}\\n\\n/// @notice Wraps an int64 number into SD1x18.\\nfunction wrap(int64 x) pure returns (SD1x18 result) {\\n result = SD1x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x9e49e2b37c1bb845861740805edaaef3fe951a7b96eef16ce84fbf76e8278670\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD1x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @dev Euler's number as an SD1x18 number.\\nSD1x18 constant E = SD1x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum value an SD1x18 number can have.\\nint64 constant uMAX_SD1x18 = 9_223372036854775807;\\nSD1x18 constant MAX_SD1x18 = SD1x18.wrap(uMAX_SD1x18);\\n\\n/// @dev The maximum value an SD1x18 number can have.\\nint64 constant uMIN_SD1x18 = -9_223372036854775808;\\nSD1x18 constant MIN_SD1x18 = SD1x18.wrap(uMIN_SD1x18);\\n\\n/// @dev PI as an SD1x18 number.\\nSD1x18 constant PI = SD1x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of SD1x18.\\nSD1x18 constant UNIT = SD1x18.wrap(1e18);\\nint64 constant uUNIT = 1e18;\\n\",\"keccak256\":\"0x6496165b80552785a4b65a239b96e2a5fedf62fe54f002eeed72d75e566d7585\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD1x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in UD2x18.\\nerror PRBMath_SD1x18_ToUD2x18_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in UD60x18.\\nerror PRBMath_SD1x18_ToUD60x18_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint128.\\nerror PRBMath_SD1x18_ToUint128_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint256.\\nerror PRBMath_SD1x18_ToUint256_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint40.\\nerror PRBMath_SD1x18_ToUint40_Overflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint40.\\nerror PRBMath_SD1x18_ToUint40_Underflow(SD1x18 x);\\n\",\"keccak256\":\"0x836cb42ba619ca369fd4765bc47fefc3c3621369c5861882af14660aca5057ee\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\n\\n/// @notice The signed 1.18-decimal fixed-point number representation, which can have up to 1 digit and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\\n/// type int64. This is useful when end users want to use int64 to save gas, e.g. with tight variable packing in contract\\n/// storage.\\ntype SD1x18 is int64;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoSD59x18,\\n Casting.intoUD2x18,\\n Casting.intoUD60x18,\\n Casting.intoUint256,\\n Casting.intoUint128,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for SD1x18 global;\\n\",\"keccak256\":\"0x2f86f1aa9fca42f40808b51a879b406ac51817647bdb9642f8a79dd8fdb754a7\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Errors.sol\\\" as CastingErrors;\\nimport { MAX_UINT128, MAX_UINT40 } from \\\"../Common.sol\\\";\\nimport { uMAX_SD1x18, uMIN_SD1x18 } from \\\"../sd1x18/Constants.sol\\\";\\nimport { SD1x18 } from \\\"../sd1x18/ValueType.sol\\\";\\nimport { uMAX_UD2x18 } from \\\"../ud2x18/Constants.sol\\\";\\nimport { UD2x18 } from \\\"../ud2x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"../ud60x18/ValueType.sol\\\";\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts an SD59x18 number into int256.\\n/// @dev This is basically a functional alias for {unwrap}.\\nfunction intoInt256(SD59x18 x) pure returns (int256 result) {\\n result = SD59x18.unwrap(x);\\n}\\n\\n/// @notice Casts an SD59x18 number into SD1x18.\\n/// @dev Requirements:\\n/// - x must be greater than or equal to `uMIN_SD1x18`.\\n/// - x must be less than or equal to `uMAX_SD1x18`.\\nfunction intoSD1x18(SD59x18 x) pure returns (SD1x18 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < uMIN_SD1x18) {\\n revert CastingErrors.PRBMath_SD59x18_IntoSD1x18_Underflow(x);\\n }\\n if (xInt > uMAX_SD1x18) {\\n revert CastingErrors.PRBMath_SD59x18_IntoSD1x18_Overflow(x);\\n }\\n result = SD1x18.wrap(int64(xInt));\\n}\\n\\n/// @notice Casts an SD59x18 number into UD2x18.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `uMAX_UD2x18`.\\nfunction intoUD2x18(SD59x18 x) pure returns (UD2x18 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUD2x18_Underflow(x);\\n }\\n if (xInt > int256(uint256(uMAX_UD2x18))) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUD2x18_Overflow(x);\\n }\\n result = UD2x18.wrap(uint64(uint256(xInt)));\\n}\\n\\n/// @notice Casts an SD59x18 number into UD60x18.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUD60x18(SD59x18 x) pure returns (UD60x18 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUD60x18_Underflow(x);\\n }\\n result = UD60x18.wrap(uint256(xInt));\\n}\\n\\n/// @notice Casts an SD59x18 number into uint256.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUint256(SD59x18 x) pure returns (uint256 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint256_Underflow(x);\\n }\\n result = uint256(xInt);\\n}\\n\\n/// @notice Casts an SD59x18 number into uint128.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `uMAX_UINT128`.\\nfunction intoUint128(SD59x18 x) pure returns (uint128 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint128_Underflow(x);\\n }\\n if (xInt > int256(uint256(MAX_UINT128))) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint128_Overflow(x);\\n }\\n result = uint128(uint256(xInt));\\n}\\n\\n/// @notice Casts an SD59x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(SD59x18 x) pure returns (uint40 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint40_Underflow(x);\\n }\\n if (xInt > int256(uint256(MAX_UINT40))) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint40_Overflow(x);\\n }\\n result = uint40(uint256(xInt));\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction sd(int256 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(x);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction sd59x18(int256 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(x);\\n}\\n\\n/// @notice Unwraps an SD59x18 number into int256.\\nfunction unwrap(SD59x18 x) pure returns (int256 result) {\\n result = SD59x18.unwrap(x);\\n}\\n\\n/// @notice Wraps an int256 number into SD59x18.\\nfunction wrap(int256 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x3b21b60ec2998c3ae32f647412da51d3683b3f183a807198cc8d157499484f99\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n// NOTICE: the \\\"u\\\" prefix stands for \\\"unwrapped\\\".\\n\\n/// @dev Euler's number as an SD59x18 number.\\nSD59x18 constant E = SD59x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum input permitted in {exp}.\\nint256 constant uEXP_MAX_INPUT = 133_084258667509499440;\\nSD59x18 constant EXP_MAX_INPUT = SD59x18.wrap(uEXP_MAX_INPUT);\\n\\n/// @dev Any value less than this returns 0 in {exp}.\\nint256 constant uEXP_MIN_THRESHOLD = -41_446531673892822322;\\nSD59x18 constant EXP_MIN_THRESHOLD = SD59x18.wrap(uEXP_MIN_THRESHOLD);\\n\\n/// @dev The maximum input permitted in {exp2}.\\nint256 constant uEXP2_MAX_INPUT = 192e18 - 1;\\nSD59x18 constant EXP2_MAX_INPUT = SD59x18.wrap(uEXP2_MAX_INPUT);\\n\\n/// @dev Any value less than this returns 0 in {exp2}.\\nint256 constant uEXP2_MIN_THRESHOLD = -59_794705707972522261;\\nSD59x18 constant EXP2_MIN_THRESHOLD = SD59x18.wrap(uEXP2_MIN_THRESHOLD);\\n\\n/// @dev Half the UNIT number.\\nint256 constant uHALF_UNIT = 0.5e18;\\nSD59x18 constant HALF_UNIT = SD59x18.wrap(uHALF_UNIT);\\n\\n/// @dev $log_2(10)$ as an SD59x18 number.\\nint256 constant uLOG2_10 = 3_321928094887362347;\\nSD59x18 constant LOG2_10 = SD59x18.wrap(uLOG2_10);\\n\\n/// @dev $log_2(e)$ as an SD59x18 number.\\nint256 constant uLOG2_E = 1_442695040888963407;\\nSD59x18 constant LOG2_E = SD59x18.wrap(uLOG2_E);\\n\\n/// @dev The maximum value an SD59x18 number can have.\\nint256 constant uMAX_SD59x18 = 57896044618658097711785492504343953926634992332820282019728_792003956564819967;\\nSD59x18 constant MAX_SD59x18 = SD59x18.wrap(uMAX_SD59x18);\\n\\n/// @dev The maximum whole value an SD59x18 number can have.\\nint256 constant uMAX_WHOLE_SD59x18 = 57896044618658097711785492504343953926634992332820282019728_000000000000000000;\\nSD59x18 constant MAX_WHOLE_SD59x18 = SD59x18.wrap(uMAX_WHOLE_SD59x18);\\n\\n/// @dev The minimum value an SD59x18 number can have.\\nint256 constant uMIN_SD59x18 = -57896044618658097711785492504343953926634992332820282019728_792003956564819968;\\nSD59x18 constant MIN_SD59x18 = SD59x18.wrap(uMIN_SD59x18);\\n\\n/// @dev The minimum whole value an SD59x18 number can have.\\nint256 constant uMIN_WHOLE_SD59x18 = -57896044618658097711785492504343953926634992332820282019728_000000000000000000;\\nSD59x18 constant MIN_WHOLE_SD59x18 = SD59x18.wrap(uMIN_WHOLE_SD59x18);\\n\\n/// @dev PI as an SD59x18 number.\\nSD59x18 constant PI = SD59x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of SD59x18.\\nint256 constant uUNIT = 1e18;\\nSD59x18 constant UNIT = SD59x18.wrap(1e18);\\n\\n/// @dev The unit number squared.\\nint256 constant uUNIT_SQUARED = 1e36;\\nSD59x18 constant UNIT_SQUARED = SD59x18.wrap(uUNIT_SQUARED);\\n\\n/// @dev Zero as an SD59x18 number.\\nSD59x18 constant ZERO = SD59x18.wrap(0);\\n\",\"keccak256\":\"0x9bcb8dd6b3e886d140ad1c32747a4f6d29a492529ceb835be878ae837aa6cc3a\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when taking the absolute value of `MIN_SD59x18`.\\nerror PRBMath_SD59x18_Abs_MinSD59x18();\\n\\n/// @notice Thrown when ceiling a number overflows SD59x18.\\nerror PRBMath_SD59x18_Ceil_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when converting a basic integer to the fixed-point format overflows SD59x18.\\nerror PRBMath_SD59x18_Convert_Overflow(int256 x);\\n\\n/// @notice Thrown when converting a basic integer to the fixed-point format underflows SD59x18.\\nerror PRBMath_SD59x18_Convert_Underflow(int256 x);\\n\\n/// @notice Thrown when dividing two numbers and one of them is `MIN_SD59x18`.\\nerror PRBMath_SD59x18_Div_InputTooSmall();\\n\\n/// @notice Thrown when dividing two numbers and one of the intermediary unsigned results overflows SD59x18.\\nerror PRBMath_SD59x18_Div_Overflow(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when taking the natural exponent of a base greater than 133_084258667509499441.\\nerror PRBMath_SD59x18_Exp_InputTooBig(SD59x18 x);\\n\\n/// @notice Thrown when taking the binary exponent of a base greater than 192e18.\\nerror PRBMath_SD59x18_Exp2_InputTooBig(SD59x18 x);\\n\\n/// @notice Thrown when flooring a number underflows SD59x18.\\nerror PRBMath_SD59x18_Floor_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when taking the geometric mean of two numbers and their product is negative.\\nerror PRBMath_SD59x18_Gm_NegativeProduct(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when taking the geometric mean of two numbers and multiplying them overflows SD59x18.\\nerror PRBMath_SD59x18_Gm_Overflow(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\\nerror PRBMath_SD59x18_IntoSD1x18_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\\nerror PRBMath_SD59x18_IntoSD1x18_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\\nerror PRBMath_SD59x18_IntoUD2x18_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\\nerror PRBMath_SD59x18_IntoUD2x18_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD60x18.\\nerror PRBMath_SD59x18_IntoUD60x18_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\\nerror PRBMath_SD59x18_IntoUint128_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\\nerror PRBMath_SD59x18_IntoUint128_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint256.\\nerror PRBMath_SD59x18_IntoUint256_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\\nerror PRBMath_SD59x18_IntoUint40_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\\nerror PRBMath_SD59x18_IntoUint40_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when taking the logarithm of a number less than or equal to zero.\\nerror PRBMath_SD59x18_Log_InputTooSmall(SD59x18 x);\\n\\n/// @notice Thrown when multiplying two numbers and one of the inputs is `MIN_SD59x18`.\\nerror PRBMath_SD59x18_Mul_InputTooSmall();\\n\\n/// @notice Thrown when multiplying two numbers and the intermediary absolute result overflows SD59x18.\\nerror PRBMath_SD59x18_Mul_Overflow(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when raising a number to a power and the intermediary absolute result overflows SD59x18.\\nerror PRBMath_SD59x18_Powu_Overflow(SD59x18 x, uint256 y);\\n\\n/// @notice Thrown when taking the square root of a negative number.\\nerror PRBMath_SD59x18_Sqrt_NegativeInput(SD59x18 x);\\n\\n/// @notice Thrown when the calculating the square root overflows SD59x18.\\nerror PRBMath_SD59x18_Sqrt_Overflow(SD59x18 x);\\n\",\"keccak256\":\"0xa6d00fe5efa215ac0df25c896e3da99a12fb61e799644b2ec32da947313d3db4\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Helpers.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { wrap } from \\\"./Casting.sol\\\";\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Implements the checked addition operation (+) in the SD59x18 type.\\nfunction add(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n return wrap(x.unwrap() + y.unwrap());\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the SD59x18 type.\\nfunction and(SD59x18 x, int256 bits) pure returns (SD59x18 result) {\\n return wrap(x.unwrap() & bits);\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the SD59x18 type.\\nfunction and2(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n return wrap(x.unwrap() & y.unwrap());\\n}\\n\\n/// @notice Implements the equal (=) operation in the SD59x18 type.\\nfunction eq(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() == y.unwrap();\\n}\\n\\n/// @notice Implements the greater than operation (>) in the SD59x18 type.\\nfunction gt(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() > y.unwrap();\\n}\\n\\n/// @notice Implements the greater than or equal to operation (>=) in the SD59x18 type.\\nfunction gte(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() >= y.unwrap();\\n}\\n\\n/// @notice Implements a zero comparison check function in the SD59x18 type.\\nfunction isZero(SD59x18 x) pure returns (bool result) {\\n result = x.unwrap() == 0;\\n}\\n\\n/// @notice Implements the left shift operation (<<) in the SD59x18 type.\\nfunction lshift(SD59x18 x, uint256 bits) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() << bits);\\n}\\n\\n/// @notice Implements the lower than operation (<) in the SD59x18 type.\\nfunction lt(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() < y.unwrap();\\n}\\n\\n/// @notice Implements the lower than or equal to operation (<=) in the SD59x18 type.\\nfunction lte(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() <= y.unwrap();\\n}\\n\\n/// @notice Implements the unchecked modulo operation (%) in the SD59x18 type.\\nfunction mod(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() % y.unwrap());\\n}\\n\\n/// @notice Implements the not equal operation (!=) in the SD59x18 type.\\nfunction neq(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() != y.unwrap();\\n}\\n\\n/// @notice Implements the NOT (~) bitwise operation in the SD59x18 type.\\nfunction not(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(~x.unwrap());\\n}\\n\\n/// @notice Implements the OR (|) bitwise operation in the SD59x18 type.\\nfunction or(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() | y.unwrap());\\n}\\n\\n/// @notice Implements the right shift operation (>>) in the SD59x18 type.\\nfunction rshift(SD59x18 x, uint256 bits) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() >> bits);\\n}\\n\\n/// @notice Implements the checked subtraction operation (-) in the SD59x18 type.\\nfunction sub(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() - y.unwrap());\\n}\\n\\n/// @notice Implements the checked unary minus operation (-) in the SD59x18 type.\\nfunction unary(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(-x.unwrap());\\n}\\n\\n/// @notice Implements the unchecked addition operation (+) in the SD59x18 type.\\nfunction uncheckedAdd(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() + y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the unchecked subtraction operation (-) in the SD59x18 type.\\nfunction uncheckedSub(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() - y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the unchecked unary minus operation (-) in the SD59x18 type.\\nfunction uncheckedUnary(SD59x18 x) pure returns (SD59x18 result) {\\n unchecked {\\n result = wrap(-x.unwrap());\\n }\\n}\\n\\n/// @notice Implements the XOR (^) bitwise operation in the SD59x18 type.\\nfunction xor(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() ^ y.unwrap());\\n}\\n\",\"keccak256\":\"0x208570f1657cf730cb6c3d81aa14030e0d45cf906cdedea5059369d7df4bb716\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as Errors;\\nimport {\\n uEXP_MAX_INPUT,\\n uEXP2_MAX_INPUT,\\n uEXP_MIN_THRESHOLD,\\n uEXP2_MIN_THRESHOLD,\\n uHALF_UNIT,\\n uLOG2_10,\\n uLOG2_E,\\n uMAX_SD59x18,\\n uMAX_WHOLE_SD59x18,\\n uMIN_SD59x18,\\n uMIN_WHOLE_SD59x18,\\n UNIT,\\n uUNIT,\\n uUNIT_SQUARED,\\n ZERO\\n} from \\\"./Constants.sol\\\";\\nimport { wrap } from \\\"./Helpers.sol\\\";\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Calculates the absolute value of x.\\n///\\n/// @dev Requirements:\\n/// - x must be greater than `MIN_SD59x18`.\\n///\\n/// @param x The SD59x18 number for which to calculate the absolute value.\\n/// @param result The absolute value of x as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction abs(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt == uMIN_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Abs_MinSD59x18();\\n }\\n result = xInt < 0 ? wrap(-xInt) : x;\\n}\\n\\n/// @notice Calculates the arithmetic average of x and y.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// @param x The first operand as an SD59x18 number.\\n/// @param y The second operand as an SD59x18 number.\\n/// @return result The arithmetic average as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction avg(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n\\n unchecked {\\n // This operation is equivalent to `x / 2 + y / 2`, and it can never overflow.\\n int256 sum = (xInt >> 1) + (yInt >> 1);\\n\\n if (sum < 0) {\\n // If at least one of x and y is odd, add 1 to the result, because shifting negative numbers to the right\\n // rounds toward negative infinity. The right part is equivalent to `sum + (x % 2 == 1 || y % 2 == 1)`.\\n assembly (\\\"memory-safe\\\") {\\n result := add(sum, and(or(xInt, yInt), 1))\\n }\\n } else {\\n // Add 1 if both x and y are odd to account for the double 0.5 remainder truncated after shifting.\\n result = wrap(sum + (xInt & yInt & 1));\\n }\\n }\\n}\\n\\n/// @notice Yields the smallest whole number greater than or equal to x.\\n///\\n/// @dev Optimized for fractional value inputs, because every whole value has (1e18 - 1) fractional counterparts.\\n/// See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n///\\n/// Requirements:\\n/// - x must be less than or equal to `MAX_WHOLE_SD59x18`.\\n///\\n/// @param x The SD59x18 number to ceil.\\n/// @param result The smallest whole number greater than or equal to x, as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ceil(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt > uMAX_WHOLE_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Ceil_Overflow(x);\\n }\\n\\n int256 remainder = xInt % uUNIT;\\n if (remainder == 0) {\\n result = x;\\n } else {\\n unchecked {\\n // Solidity uses C fmod style, which returns a modulus with the same sign as x.\\n int256 resultInt = xInt - remainder;\\n if (xInt > 0) {\\n resultInt += uUNIT;\\n }\\n result = wrap(resultInt);\\n }\\n }\\n}\\n\\n/// @notice Divides two SD59x18 numbers, returning a new SD59x18 number.\\n///\\n/// @dev This is an extension of {Common.mulDiv} for signed numbers, which works by computing the signs and the absolute\\n/// values separately.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv}.\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv}.\\n/// - None of the inputs can be `MIN_SD59x18`.\\n/// - The denominator must not be zero.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The numerator as an SD59x18 number.\\n/// @param y The denominator as an SD59x18 number.\\n/// @param result The quotient as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction div(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n if (xInt == uMIN_SD59x18 || yInt == uMIN_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Div_InputTooSmall();\\n }\\n\\n // Get hold of the absolute values of x and y.\\n uint256 xAbs;\\n uint256 yAbs;\\n unchecked {\\n xAbs = xInt < 0 ? uint256(-xInt) : uint256(xInt);\\n yAbs = yInt < 0 ? uint256(-yInt) : uint256(yInt);\\n }\\n\\n // Compute the absolute value (x*UNIT\\u00f7y). The resulting value must fit in SD59x18.\\n uint256 resultAbs = Common.mulDiv(xAbs, uint256(uUNIT), yAbs);\\n if (resultAbs > uint256(uMAX_SD59x18)) {\\n revert Errors.PRBMath_SD59x18_Div_Overflow(x, y);\\n }\\n\\n // Check if x and y have the same sign using two's complement representation. The left-most bit represents the sign (1 for\\n // negative, 0 for positive or zero).\\n bool sameSign = (xInt ^ yInt) > -1;\\n\\n // If the inputs have the same sign, the result should be positive. Otherwise, it should be negative.\\n unchecked {\\n result = wrap(sameSign ? int256(resultAbs) : -int256(resultAbs));\\n }\\n}\\n\\n/// @notice Calculates the natural exponent of x using the following formula:\\n///\\n/// $$\\n/// e^x = 2^{x * log_2{e}}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {exp2}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {exp2}.\\n/// - x must be less than 133_084258667509499441.\\n///\\n/// @param x The exponent as an SD59x18 number.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n\\n // Any input less than the threshold returns zero.\\n // This check also prevents an overflow for very small numbers.\\n if (xInt < uEXP_MIN_THRESHOLD) {\\n return ZERO;\\n }\\n\\n // This check prevents values greater than 192e18 from being passed to {exp2}.\\n if (xInt > uEXP_MAX_INPUT) {\\n revert Errors.PRBMath_SD59x18_Exp_InputTooBig(x);\\n }\\n\\n unchecked {\\n // Inline the fixed-point multiplication to save gas.\\n int256 doubleUnitProduct = xInt * uLOG2_E;\\n result = exp2(wrap(doubleUnitProduct / uUNIT));\\n }\\n}\\n\\n/// @notice Calculates the binary exponent of x using the binary fraction method using the following formula:\\n///\\n/// $$\\n/// 2^{-x} = \\\\frac{1}{2^x}\\n/// $$\\n///\\n/// @dev See https://ethereum.stackexchange.com/q/79903/24693.\\n///\\n/// Notes:\\n/// - If x is less than -59_794705707972522261, the result is zero.\\n///\\n/// Requirements:\\n/// - x must be less than 192e18.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The exponent as an SD59x18 number.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp2(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < 0) {\\n // The inverse of any number less than the threshold is truncated to zero.\\n if (xInt < uEXP2_MIN_THRESHOLD) {\\n return ZERO;\\n }\\n\\n unchecked {\\n // Inline the fixed-point inversion to save gas.\\n result = wrap(uUNIT_SQUARED / exp2(wrap(-xInt)).unwrap());\\n }\\n } else {\\n // Numbers greater than or equal to 192e18 don't fit in the 192.64-bit format.\\n if (xInt > uEXP2_MAX_INPUT) {\\n revert Errors.PRBMath_SD59x18_Exp2_InputTooBig(x);\\n }\\n\\n unchecked {\\n // Convert x to the 192.64-bit fixed-point format.\\n uint256 x_192x64 = uint256((xInt << 64) / uUNIT);\\n\\n // It is safe to cast the result to int256 due to the checks above.\\n result = wrap(int256(Common.exp2(x_192x64)));\\n }\\n }\\n}\\n\\n/// @notice Yields the greatest whole number less than or equal to x.\\n///\\n/// @dev Optimized for fractional value inputs, because for every whole value there are (1e18 - 1) fractional\\n/// counterparts. See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n///\\n/// Requirements:\\n/// - x must be greater than or equal to `MIN_WHOLE_SD59x18`.\\n///\\n/// @param x The SD59x18 number to floor.\\n/// @param result The greatest whole number less than or equal to x, as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction floor(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < uMIN_WHOLE_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Floor_Underflow(x);\\n }\\n\\n int256 remainder = xInt % uUNIT;\\n if (remainder == 0) {\\n result = x;\\n } else {\\n unchecked {\\n // Solidity uses C fmod style, which returns a modulus with the same sign as x.\\n int256 resultInt = xInt - remainder;\\n if (xInt < 0) {\\n resultInt -= uUNIT;\\n }\\n result = wrap(resultInt);\\n }\\n }\\n}\\n\\n/// @notice Yields the excess beyond the floor of x for positive numbers and the part of the number to the right.\\n/// of the radix point for negative numbers.\\n/// @dev Based on the odd function definition. https://en.wikipedia.org/wiki/Fractional_part\\n/// @param x The SD59x18 number to get the fractional part of.\\n/// @param result The fractional part of x as an SD59x18 number.\\nfunction frac(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() % uUNIT);\\n}\\n\\n/// @notice Calculates the geometric mean of x and y, i.e. $\\\\sqrt{x * y}$.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x * y must fit in SD59x18.\\n/// - x * y must not be negative, since complex numbers are not supported.\\n///\\n/// @param x The first operand as an SD59x18 number.\\n/// @param y The second operand as an SD59x18 number.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction gm(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n if (xInt == 0 || yInt == 0) {\\n return ZERO;\\n }\\n\\n unchecked {\\n // Equivalent to `xy / x != y`. Checking for overflow this way is faster than letting Solidity do it.\\n int256 xyInt = xInt * yInt;\\n if (xyInt / xInt != yInt) {\\n revert Errors.PRBMath_SD59x18_Gm_Overflow(x, y);\\n }\\n\\n // The product must not be negative, since complex numbers are not supported.\\n if (xyInt < 0) {\\n revert Errors.PRBMath_SD59x18_Gm_NegativeProduct(x, y);\\n }\\n\\n // We don't need to multiply the result by `UNIT` here because the x*y product picked up a factor of `UNIT`\\n // during multiplication. See the comments in {Common.sqrt}.\\n uint256 resultUint = Common.sqrt(uint256(xyInt));\\n result = wrap(int256(resultUint));\\n }\\n}\\n\\n/// @notice Calculates the inverse of x.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x must not be zero.\\n///\\n/// @param x The SD59x18 number for which to calculate the inverse.\\n/// @return result The inverse as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction inv(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(uUNIT_SQUARED / x.unwrap());\\n}\\n\\n/// @notice Calculates the natural logarithm of x using the following formula:\\n///\\n/// $$\\n/// ln{x} = log_2{x} / log_2{e}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n/// - The precision isn't sufficiently fine-grained to return exactly `UNIT` when the input is `E`.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The SD59x18 number for which to calculate the natural logarithm.\\n/// @return result The natural logarithm as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ln(SD59x18 x) pure returns (SD59x18 result) {\\n // Inline the fixed-point multiplication to save gas. This is overflow-safe because the maximum value that\\n // {log2} can return is ~195_205294292027477728.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_E);\\n}\\n\\n/// @notice Calculates the common logarithm of x using the following formula:\\n///\\n/// $$\\n/// log_{10}{x} = log_2{x} / log_2{10}\\n/// $$\\n///\\n/// However, if x is an exact power of ten, a hard coded value is returned.\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The SD59x18 number for which to calculate the common logarithm.\\n/// @return result The common logarithm as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log10(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < 0) {\\n revert Errors.PRBMath_SD59x18_Log_InputTooSmall(x);\\n }\\n\\n // Note that the `mul` in this block is the standard multiplication operation, not {SD59x18.mul}.\\n // prettier-ignore\\n assembly (\\\"memory-safe\\\") {\\n switch x\\n case 1 { result := mul(uUNIT, sub(0, 18)) }\\n case 10 { result := mul(uUNIT, sub(1, 18)) }\\n case 100 { result := mul(uUNIT, sub(2, 18)) }\\n case 1000 { result := mul(uUNIT, sub(3, 18)) }\\n case 10000 { result := mul(uUNIT, sub(4, 18)) }\\n case 100000 { result := mul(uUNIT, sub(5, 18)) }\\n case 1000000 { result := mul(uUNIT, sub(6, 18)) }\\n case 10000000 { result := mul(uUNIT, sub(7, 18)) }\\n case 100000000 { result := mul(uUNIT, sub(8, 18)) }\\n case 1000000000 { result := mul(uUNIT, sub(9, 18)) }\\n case 10000000000 { result := mul(uUNIT, sub(10, 18)) }\\n case 100000000000 { result := mul(uUNIT, sub(11, 18)) }\\n case 1000000000000 { result := mul(uUNIT, sub(12, 18)) }\\n case 10000000000000 { result := mul(uUNIT, sub(13, 18)) }\\n case 100000000000000 { result := mul(uUNIT, sub(14, 18)) }\\n case 1000000000000000 { result := mul(uUNIT, sub(15, 18)) }\\n case 10000000000000000 { result := mul(uUNIT, sub(16, 18)) }\\n case 100000000000000000 { result := mul(uUNIT, sub(17, 18)) }\\n case 1000000000000000000 { result := 0 }\\n case 10000000000000000000 { result := uUNIT }\\n case 100000000000000000000 { result := mul(uUNIT, 2) }\\n case 1000000000000000000000 { result := mul(uUNIT, 3) }\\n case 10000000000000000000000 { result := mul(uUNIT, 4) }\\n case 100000000000000000000000 { result := mul(uUNIT, 5) }\\n case 1000000000000000000000000 { result := mul(uUNIT, 6) }\\n case 10000000000000000000000000 { result := mul(uUNIT, 7) }\\n case 100000000000000000000000000 { result := mul(uUNIT, 8) }\\n case 1000000000000000000000000000 { result := mul(uUNIT, 9) }\\n case 10000000000000000000000000000 { result := mul(uUNIT, 10) }\\n case 100000000000000000000000000000 { result := mul(uUNIT, 11) }\\n case 1000000000000000000000000000000 { result := mul(uUNIT, 12) }\\n case 10000000000000000000000000000000 { result := mul(uUNIT, 13) }\\n case 100000000000000000000000000000000 { result := mul(uUNIT, 14) }\\n case 1000000000000000000000000000000000 { result := mul(uUNIT, 15) }\\n case 10000000000000000000000000000000000 { result := mul(uUNIT, 16) }\\n case 100000000000000000000000000000000000 { result := mul(uUNIT, 17) }\\n case 1000000000000000000000000000000000000 { result := mul(uUNIT, 18) }\\n case 10000000000000000000000000000000000000 { result := mul(uUNIT, 19) }\\n case 100000000000000000000000000000000000000 { result := mul(uUNIT, 20) }\\n case 1000000000000000000000000000000000000000 { result := mul(uUNIT, 21) }\\n case 10000000000000000000000000000000000000000 { result := mul(uUNIT, 22) }\\n case 100000000000000000000000000000000000000000 { result := mul(uUNIT, 23) }\\n case 1000000000000000000000000000000000000000000 { result := mul(uUNIT, 24) }\\n case 10000000000000000000000000000000000000000000 { result := mul(uUNIT, 25) }\\n case 100000000000000000000000000000000000000000000 { result := mul(uUNIT, 26) }\\n case 1000000000000000000000000000000000000000000000 { result := mul(uUNIT, 27) }\\n case 10000000000000000000000000000000000000000000000 { result := mul(uUNIT, 28) }\\n case 100000000000000000000000000000000000000000000000 { result := mul(uUNIT, 29) }\\n case 1000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 30) }\\n case 10000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 31) }\\n case 100000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 32) }\\n case 1000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 33) }\\n case 10000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 34) }\\n case 100000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 35) }\\n case 1000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 36) }\\n case 10000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 37) }\\n case 100000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 38) }\\n case 1000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 39) }\\n case 10000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 40) }\\n case 100000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 41) }\\n case 1000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 42) }\\n case 10000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 43) }\\n case 100000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 44) }\\n case 1000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 45) }\\n case 10000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 46) }\\n case 100000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 47) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 48) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 49) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 50) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 51) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 52) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 53) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 54) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 55) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 56) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 57) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 58) }\\n default { result := uMAX_SD59x18 }\\n }\\n\\n if (result.unwrap() == uMAX_SD59x18) {\\n unchecked {\\n // Inline the fixed-point division to save gas.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_10);\\n }\\n }\\n}\\n\\n/// @notice Calculates the binary logarithm of x using the iterative approximation algorithm:\\n///\\n/// $$\\n/// log_2{x} = n + log_2{y}, \\\\text{ where } y = x*2^{-n}, \\\\ y \\\\in [1, 2)\\n/// $$\\n///\\n/// For $0 \\\\leq x \\\\lt 1$, the input is inverted:\\n///\\n/// $$\\n/// log_2{x} = -log_2{\\\\frac{1}{x}}\\n/// $$\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Binary_logarithm#Iterative_approximation.\\n///\\n/// Notes:\\n/// - Due to the lossy precision of the iterative approximation, the results are not perfectly accurate to the last decimal.\\n///\\n/// Requirements:\\n/// - x must be greater than zero.\\n///\\n/// @param x The SD59x18 number for which to calculate the binary logarithm.\\n/// @return result The binary logarithm as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log2(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt <= 0) {\\n revert Errors.PRBMath_SD59x18_Log_InputTooSmall(x);\\n }\\n\\n unchecked {\\n int256 sign;\\n if (xInt >= uUNIT) {\\n sign = 1;\\n } else {\\n sign = -1;\\n // Inline the fixed-point inversion to save gas.\\n xInt = uUNIT_SQUARED / xInt;\\n }\\n\\n // Calculate the integer part of the logarithm.\\n uint256 n = Common.msb(uint256(xInt / uUNIT));\\n\\n // This is the integer part of the logarithm as an SD59x18 number. The operation can't overflow\\n // because n is at most 255, `UNIT` is 1e18, and the sign is either 1 or -1.\\n int256 resultInt = int256(n) * uUNIT;\\n\\n // Calculate $y = x * 2^{-n}$.\\n int256 y = xInt >> n;\\n\\n // If y is the unit number, the fractional part is zero.\\n if (y == uUNIT) {\\n return wrap(resultInt * sign);\\n }\\n\\n // Calculate the fractional part via the iterative approximation.\\n // The `delta >>= 1` part is equivalent to `delta /= 2`, but shifting bits is more gas efficient.\\n int256 DOUBLE_UNIT = 2e18;\\n for (int256 delta = uHALF_UNIT; delta > 0; delta >>= 1) {\\n y = (y * y) / uUNIT;\\n\\n // Is y^2 >= 2e18 and so in the range [2e18, 4e18)?\\n if (y >= DOUBLE_UNIT) {\\n // Add the 2^{-m} factor to the logarithm.\\n resultInt = resultInt + delta;\\n\\n // Halve y, which corresponds to z/2 in the Wikipedia article.\\n y >>= 1;\\n }\\n }\\n resultInt *= sign;\\n result = wrap(resultInt);\\n }\\n}\\n\\n/// @notice Multiplies two SD59x18 numbers together, returning a new SD59x18 number.\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {Common.mulDiv18}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv18}.\\n/// - None of the inputs can be `MIN_SD59x18`.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The multiplicand as an SD59x18 number.\\n/// @param y The multiplier as an SD59x18 number.\\n/// @return result The product as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mul(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n if (xInt == uMIN_SD59x18 || yInt == uMIN_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Mul_InputTooSmall();\\n }\\n\\n // Get hold of the absolute values of x and y.\\n uint256 xAbs;\\n uint256 yAbs;\\n unchecked {\\n xAbs = xInt < 0 ? uint256(-xInt) : uint256(xInt);\\n yAbs = yInt < 0 ? uint256(-yInt) : uint256(yInt);\\n }\\n\\n // Compute the absolute value (x*y\\u00f7UNIT). The resulting value must fit in SD59x18.\\n uint256 resultAbs = Common.mulDiv18(xAbs, yAbs);\\n if (resultAbs > uint256(uMAX_SD59x18)) {\\n revert Errors.PRBMath_SD59x18_Mul_Overflow(x, y);\\n }\\n\\n // Check if x and y have the same sign using two's complement representation. The left-most bit represents the sign (1 for\\n // negative, 0 for positive or zero).\\n bool sameSign = (xInt ^ yInt) > -1;\\n\\n // If the inputs have the same sign, the result should be positive. Otherwise, it should be negative.\\n unchecked {\\n result = wrap(sameSign ? int256(resultAbs) : -int256(resultAbs));\\n }\\n}\\n\\n/// @notice Raises x to the power of y using the following formula:\\n///\\n/// $$\\n/// x^y = 2^{log_2{x} * y}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {exp2}, {log2}, and {mul}.\\n/// - Returns `UNIT` for 0^0.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {exp2}, {log2}, and {mul}.\\n///\\n/// @param x The base as an SD59x18 number.\\n/// @param y Exponent to raise x to, as an SD59x18 number\\n/// @return result x raised to power y, as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction pow(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n\\n // If both x and y are zero, the result is `UNIT`. If just x is zero, the result is always zero.\\n if (xInt == 0) {\\n return yInt == 0 ? UNIT : ZERO;\\n }\\n // If x is `UNIT`, the result is always `UNIT`.\\n else if (xInt == uUNIT) {\\n return UNIT;\\n }\\n\\n // If y is zero, the result is always `UNIT`.\\n if (yInt == 0) {\\n return UNIT;\\n }\\n // If y is `UNIT`, the result is always x.\\n else if (yInt == uUNIT) {\\n return x;\\n }\\n\\n // Calculate the result using the formula.\\n result = exp2(mul(log2(x), y));\\n}\\n\\n/// @notice Raises x (an SD59x18 number) to the power y (an unsigned basic integer) using the well-known\\n/// algorithm \\\"exponentiation by squaring\\\".\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Exponentiation_by_squaring.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv18}.\\n/// - Returns `UNIT` for 0^0.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {abs} and {Common.mulDiv18}.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The base as an SD59x18 number.\\n/// @param y The exponent as a uint256.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction powu(SD59x18 x, uint256 y) pure returns (SD59x18 result) {\\n uint256 xAbs = uint256(abs(x).unwrap());\\n\\n // Calculate the first iteration of the loop in advance.\\n uint256 resultAbs = y & 1 > 0 ? xAbs : uint256(uUNIT);\\n\\n // Equivalent to `for(y /= 2; y > 0; y /= 2)`.\\n uint256 yAux = y;\\n for (yAux >>= 1; yAux > 0; yAux >>= 1) {\\n xAbs = Common.mulDiv18(xAbs, xAbs);\\n\\n // Equivalent to `y % 2 == 1`.\\n if (yAux & 1 > 0) {\\n resultAbs = Common.mulDiv18(resultAbs, xAbs);\\n }\\n }\\n\\n // The result must fit in SD59x18.\\n if (resultAbs > uint256(uMAX_SD59x18)) {\\n revert Errors.PRBMath_SD59x18_Powu_Overflow(x, y);\\n }\\n\\n unchecked {\\n // Is the base negative and the exponent odd? If yes, the result should be negative.\\n int256 resultInt = int256(resultAbs);\\n bool isNegative = x.unwrap() < 0 && y & 1 == 1;\\n if (isNegative) {\\n resultInt = -resultInt;\\n }\\n result = wrap(resultInt);\\n }\\n}\\n\\n/// @notice Calculates the square root of x using the Babylonian method.\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\\n///\\n/// Notes:\\n/// - Only the positive root is returned.\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x cannot be negative, since complex numbers are not supported.\\n/// - x must be less than `MAX_SD59x18 / UNIT`.\\n///\\n/// @param x The SD59x18 number for which to calculate the square root.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction sqrt(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < 0) {\\n revert Errors.PRBMath_SD59x18_Sqrt_NegativeInput(x);\\n }\\n if (xInt > uMAX_SD59x18 / uUNIT) {\\n revert Errors.PRBMath_SD59x18_Sqrt_Overflow(x);\\n }\\n\\n unchecked {\\n // Multiply x by `UNIT` to account for the factor of `UNIT` picked up when multiplying two SD59x18 numbers.\\n // In this case, the two numbers are both the square root.\\n uint256 resultUint = Common.sqrt(uint256(xInt * uUNIT));\\n result = wrap(int256(resultUint));\\n }\\n}\\n\",\"keccak256\":\"0xa074831139fc89ca0e5a36086b30eb50896bb6770cd5823461b1f2769017d2f0\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\nimport \\\"./Helpers.sol\\\" as Helpers;\\nimport \\\"./Math.sol\\\" as Math;\\n\\n/// @notice The signed 59.18-decimal fixed-point number representation, which can have up to 59 digits and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\\n/// type int256.\\ntype SD59x18 is int256;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoInt256,\\n Casting.intoSD1x18,\\n Casting.intoUD2x18,\\n Casting.intoUD60x18,\\n Casting.intoUint256,\\n Casting.intoUint128,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for SD59x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n MATHEMATICAL FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Math.abs,\\n Math.avg,\\n Math.ceil,\\n Math.div,\\n Math.exp,\\n Math.exp2,\\n Math.floor,\\n Math.frac,\\n Math.gm,\\n Math.inv,\\n Math.log10,\\n Math.log2,\\n Math.ln,\\n Math.mul,\\n Math.pow,\\n Math.powu,\\n Math.sqrt\\n} for SD59x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n HELPER FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Helpers.add,\\n Helpers.and,\\n Helpers.eq,\\n Helpers.gt,\\n Helpers.gte,\\n Helpers.isZero,\\n Helpers.lshift,\\n Helpers.lt,\\n Helpers.lte,\\n Helpers.mod,\\n Helpers.neq,\\n Helpers.not,\\n Helpers.or,\\n Helpers.rshift,\\n Helpers.sub,\\n Helpers.uncheckedAdd,\\n Helpers.uncheckedSub,\\n Helpers.uncheckedUnary,\\n Helpers.xor\\n} for SD59x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n OPERATORS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes it possible to use these operators on the SD59x18 type.\\nusing {\\n Helpers.add as +,\\n Helpers.and2 as &,\\n Math.div as /,\\n Helpers.eq as ==,\\n Helpers.gt as >,\\n Helpers.gte as >=,\\n Helpers.lt as <,\\n Helpers.lte as <=,\\n Helpers.mod as %,\\n Math.mul as *,\\n Helpers.neq as !=,\\n Helpers.not as ~,\\n Helpers.or as |,\\n Helpers.sub as -,\\n Helpers.unary as -,\\n Helpers.xor as ^\\n} for SD59x18 global;\\n\",\"keccak256\":\"0xe03112d145dcd5863aff24e5f381debaae29d446acd5666f3d640e3d9af738d7\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as Errors;\\nimport { uMAX_SD1x18 } from \\\"../sd1x18/Constants.sol\\\";\\nimport { SD1x18 } from \\\"../sd1x18/ValueType.sol\\\";\\nimport { SD59x18 } from \\\"../sd59x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"../ud60x18/ValueType.sol\\\";\\nimport { UD2x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts a UD2x18 number into SD1x18.\\n/// - x must be less than or equal to `uMAX_SD1x18`.\\nfunction intoSD1x18(UD2x18 x) pure returns (SD1x18 result) {\\n uint64 xUint = UD2x18.unwrap(x);\\n if (xUint > uint64(uMAX_SD1x18)) {\\n revert Errors.PRBMath_UD2x18_IntoSD1x18_Overflow(x);\\n }\\n result = SD1x18.wrap(int64(xUint));\\n}\\n\\n/// @notice Casts a UD2x18 number into SD59x18.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of SD59x18.\\nfunction intoSD59x18(UD2x18 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(int256(uint256(UD2x18.unwrap(x))));\\n}\\n\\n/// @notice Casts a UD2x18 number into UD60x18.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of UD60x18.\\nfunction intoUD60x18(UD2x18 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(UD2x18.unwrap(x));\\n}\\n\\n/// @notice Casts a UD2x18 number into uint128.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of uint128.\\nfunction intoUint128(UD2x18 x) pure returns (uint128 result) {\\n result = uint128(UD2x18.unwrap(x));\\n}\\n\\n/// @notice Casts a UD2x18 number into uint256.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of uint256.\\nfunction intoUint256(UD2x18 x) pure returns (uint256 result) {\\n result = uint256(UD2x18.unwrap(x));\\n}\\n\\n/// @notice Casts a UD2x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(UD2x18 x) pure returns (uint40 result) {\\n uint64 xUint = UD2x18.unwrap(x);\\n if (xUint > uint64(Common.MAX_UINT40)) {\\n revert Errors.PRBMath_UD2x18_IntoUint40_Overflow(x);\\n }\\n result = uint40(xUint);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction ud2x18(uint64 x) pure returns (UD2x18 result) {\\n result = UD2x18.wrap(x);\\n}\\n\\n/// @notice Unwrap a UD2x18 number into uint64.\\nfunction unwrap(UD2x18 x) pure returns (uint64 result) {\\n result = UD2x18.unwrap(x);\\n}\\n\\n/// @notice Wraps a uint64 number into UD2x18.\\nfunction wrap(uint64 x) pure returns (UD2x18 result) {\\n result = UD2x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x9b1a35d432ef951a415fae8098b3c609a99b630a3d5464b3c8e1efa8893eea07\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD2x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @dev Euler's number as a UD2x18 number.\\nUD2x18 constant E = UD2x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum value a UD2x18 number can have.\\nuint64 constant uMAX_UD2x18 = 18_446744073709551615;\\nUD2x18 constant MAX_UD2x18 = UD2x18.wrap(uMAX_UD2x18);\\n\\n/// @dev PI as a UD2x18 number.\\nUD2x18 constant PI = UD2x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of UD2x18.\\nUD2x18 constant UNIT = UD2x18.wrap(1e18);\\nuint64 constant uUNIT = 1e18;\\n\",\"keccak256\":\"0x29b0e050c865899e1fb9022b460a7829cdee248c44c4299f068ba80695eec3fc\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD2x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when trying to cast a UD2x18 number that doesn't fit in SD1x18.\\nerror PRBMath_UD2x18_IntoSD1x18_Overflow(UD2x18 x);\\n\\n/// @notice Thrown when trying to cast a UD2x18 number that doesn't fit in uint40.\\nerror PRBMath_UD2x18_IntoUint40_Overflow(UD2x18 x);\\n\",\"keccak256\":\"0xdf1e22f0b4c8032bcc8b7f63fe3984e1387f3dc7b2e9ab381822249f75376d33\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\n\\n/// @notice The unsigned 2.18-decimal fixed-point number representation, which can have up to 2 digits and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\\n/// type uint64. This is useful when end users want to use uint64 to save gas, e.g. with tight variable packing in contract\\n/// storage.\\ntype UD2x18 is uint64;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoSD1x18,\\n Casting.intoSD59x18,\\n Casting.intoUD60x18,\\n Casting.intoUint256,\\n Casting.intoUint128,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for UD2x18 global;\\n\",\"keccak256\":\"0x2802edc9869db116a0b5c490cc5f8554742f747183fa30ac5e9c80bb967e61a1\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Errors.sol\\\" as CastingErrors;\\nimport { MAX_UINT128, MAX_UINT40 } from \\\"../Common.sol\\\";\\nimport { uMAX_SD1x18 } from \\\"../sd1x18/Constants.sol\\\";\\nimport { SD1x18 } from \\\"../sd1x18/ValueType.sol\\\";\\nimport { uMAX_SD59x18 } from \\\"../sd59x18/Constants.sol\\\";\\nimport { SD59x18 } from \\\"../sd59x18/ValueType.sol\\\";\\nimport { uMAX_UD2x18 } from \\\"../ud2x18/Constants.sol\\\";\\nimport { UD2x18 } from \\\"../ud2x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts a UD60x18 number into SD1x18.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `uMAX_SD1x18`.\\nfunction intoSD1x18(UD60x18 x) pure returns (SD1x18 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > uint256(int256(uMAX_SD1x18))) {\\n revert CastingErrors.PRBMath_UD60x18_IntoSD1x18_Overflow(x);\\n }\\n result = SD1x18.wrap(int64(uint64(xUint)));\\n}\\n\\n/// @notice Casts a UD60x18 number into UD2x18.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `uMAX_UD2x18`.\\nfunction intoUD2x18(UD60x18 x) pure returns (UD2x18 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > uMAX_UD2x18) {\\n revert CastingErrors.PRBMath_UD60x18_IntoUD2x18_Overflow(x);\\n }\\n result = UD2x18.wrap(uint64(xUint));\\n}\\n\\n/// @notice Casts a UD60x18 number into SD59x18.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `uMAX_SD59x18`.\\nfunction intoSD59x18(UD60x18 x) pure returns (SD59x18 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > uint256(uMAX_SD59x18)) {\\n revert CastingErrors.PRBMath_UD60x18_IntoSD59x18_Overflow(x);\\n }\\n result = SD59x18.wrap(int256(xUint));\\n}\\n\\n/// @notice Casts a UD60x18 number into uint128.\\n/// @dev This is basically an alias for {unwrap}.\\nfunction intoUint256(UD60x18 x) pure returns (uint256 result) {\\n result = UD60x18.unwrap(x);\\n}\\n\\n/// @notice Casts a UD60x18 number into uint128.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UINT128`.\\nfunction intoUint128(UD60x18 x) pure returns (uint128 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > MAX_UINT128) {\\n revert CastingErrors.PRBMath_UD60x18_IntoUint128_Overflow(x);\\n }\\n result = uint128(xUint);\\n}\\n\\n/// @notice Casts a UD60x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(UD60x18 x) pure returns (uint40 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > MAX_UINT40) {\\n revert CastingErrors.PRBMath_UD60x18_IntoUint40_Overflow(x);\\n }\\n result = uint40(xUint);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction ud(uint256 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(x);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction ud60x18(uint256 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(x);\\n}\\n\\n/// @notice Unwraps a UD60x18 number into uint256.\\nfunction unwrap(UD60x18 x) pure returns (uint256 result) {\\n result = UD60x18.unwrap(x);\\n}\\n\\n/// @notice Wraps a uint256 number into the UD60x18 value type.\\nfunction wrap(uint256 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x5bb532da36921cbdac64d1f16de5d366ef1f664502e3b7c07d0ad06917551f85\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n// NOTICE: the \\\"u\\\" prefix stands for \\\"unwrapped\\\".\\n\\n/// @dev Euler's number as a UD60x18 number.\\nUD60x18 constant E = UD60x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum input permitted in {exp}.\\nuint256 constant uEXP_MAX_INPUT = 133_084258667509499440;\\nUD60x18 constant EXP_MAX_INPUT = UD60x18.wrap(uEXP_MAX_INPUT);\\n\\n/// @dev The maximum input permitted in {exp2}.\\nuint256 constant uEXP2_MAX_INPUT = 192e18 - 1;\\nUD60x18 constant EXP2_MAX_INPUT = UD60x18.wrap(uEXP2_MAX_INPUT);\\n\\n/// @dev Half the UNIT number.\\nuint256 constant uHALF_UNIT = 0.5e18;\\nUD60x18 constant HALF_UNIT = UD60x18.wrap(uHALF_UNIT);\\n\\n/// @dev $log_2(10)$ as a UD60x18 number.\\nuint256 constant uLOG2_10 = 3_321928094887362347;\\nUD60x18 constant LOG2_10 = UD60x18.wrap(uLOG2_10);\\n\\n/// @dev $log_2(e)$ as a UD60x18 number.\\nuint256 constant uLOG2_E = 1_442695040888963407;\\nUD60x18 constant LOG2_E = UD60x18.wrap(uLOG2_E);\\n\\n/// @dev The maximum value a UD60x18 number can have.\\nuint256 constant uMAX_UD60x18 = 115792089237316195423570985008687907853269984665640564039457_584007913129639935;\\nUD60x18 constant MAX_UD60x18 = UD60x18.wrap(uMAX_UD60x18);\\n\\n/// @dev The maximum whole value a UD60x18 number can have.\\nuint256 constant uMAX_WHOLE_UD60x18 = 115792089237316195423570985008687907853269984665640564039457_000000000000000000;\\nUD60x18 constant MAX_WHOLE_UD60x18 = UD60x18.wrap(uMAX_WHOLE_UD60x18);\\n\\n/// @dev PI as a UD60x18 number.\\nUD60x18 constant PI = UD60x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of UD60x18.\\nuint256 constant uUNIT = 1e18;\\nUD60x18 constant UNIT = UD60x18.wrap(uUNIT);\\n\\n/// @dev The unit number squared.\\nuint256 constant uUNIT_SQUARED = 1e36;\\nUD60x18 constant UNIT_SQUARED = UD60x18.wrap(uUNIT_SQUARED);\\n\\n/// @dev Zero as a UD60x18 number.\\nUD60x18 constant ZERO = UD60x18.wrap(0);\\n\",\"keccak256\":\"0x2b80d26153d3fdcfb3a9ca772d9309d31ed1275f5b8b54c3ffb54d3652b37d90\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Conversions.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { uMAX_UD60x18, uUNIT } from \\\"./Constants.sol\\\";\\nimport { PRBMath_UD60x18_Convert_Overflow } from \\\"./Errors.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Converts a UD60x18 number to a simple integer by dividing it by `UNIT`.\\n/// @dev The result is rounded toward zero.\\n/// @param x The UD60x18 number to convert.\\n/// @return result The same number in basic integer form.\\nfunction convert(UD60x18 x) pure returns (uint256 result) {\\n result = UD60x18.unwrap(x) / uUNIT;\\n}\\n\\n/// @notice Converts a simple integer to UD60x18 by multiplying it by `UNIT`.\\n///\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UD60x18 / UNIT`.\\n///\\n/// @param x The basic integer to convert.\\n/// @param result The same number converted to UD60x18.\\nfunction convert(uint256 x) pure returns (UD60x18 result) {\\n if (x > uMAX_UD60x18 / uUNIT) {\\n revert PRBMath_UD60x18_Convert_Overflow(x);\\n }\\n unchecked {\\n result = UD60x18.wrap(x * uUNIT);\\n }\\n}\\n\",\"keccak256\":\"0xaf7fc2523413822de3b66ba339fe2884fb3b8c6f6cf38ec90a2c3e3aae71df6b\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when ceiling a number overflows UD60x18.\\nerror PRBMath_UD60x18_Ceil_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when converting a basic integer to the fixed-point format overflows UD60x18.\\nerror PRBMath_UD60x18_Convert_Overflow(uint256 x);\\n\\n/// @notice Thrown when taking the natural exponent of a base greater than 133_084258667509499441.\\nerror PRBMath_UD60x18_Exp_InputTooBig(UD60x18 x);\\n\\n/// @notice Thrown when taking the binary exponent of a base greater than 192e18.\\nerror PRBMath_UD60x18_Exp2_InputTooBig(UD60x18 x);\\n\\n/// @notice Thrown when taking the geometric mean of two numbers and multiplying them overflows UD60x18.\\nerror PRBMath_UD60x18_Gm_Overflow(UD60x18 x, UD60x18 y);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\\nerror PRBMath_UD60x18_IntoSD1x18_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD59x18.\\nerror PRBMath_UD60x18_IntoSD59x18_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\\nerror PRBMath_UD60x18_IntoUD2x18_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\\nerror PRBMath_UD60x18_IntoUint128_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\\nerror PRBMath_UD60x18_IntoUint40_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when taking the logarithm of a number less than 1.\\nerror PRBMath_UD60x18_Log_InputTooSmall(UD60x18 x);\\n\\n/// @notice Thrown when calculating the square root overflows UD60x18.\\nerror PRBMath_UD60x18_Sqrt_Overflow(UD60x18 x);\\n\",\"keccak256\":\"0xa8c60d4066248df22c49c882873efbc017344107edabc48c52209abbc39cb1e3\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Helpers.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { wrap } from \\\"./Casting.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Implements the checked addition operation (+) in the UD60x18 type.\\nfunction add(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() + y.unwrap());\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the UD60x18 type.\\nfunction and(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() & bits);\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the UD60x18 type.\\nfunction and2(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() & y.unwrap());\\n}\\n\\n/// @notice Implements the equal operation (==) in the UD60x18 type.\\nfunction eq(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() == y.unwrap();\\n}\\n\\n/// @notice Implements the greater than operation (>) in the UD60x18 type.\\nfunction gt(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() > y.unwrap();\\n}\\n\\n/// @notice Implements the greater than or equal to operation (>=) in the UD60x18 type.\\nfunction gte(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() >= y.unwrap();\\n}\\n\\n/// @notice Implements a zero comparison check function in the UD60x18 type.\\nfunction isZero(UD60x18 x) pure returns (bool result) {\\n // This wouldn't work if x could be negative.\\n result = x.unwrap() == 0;\\n}\\n\\n/// @notice Implements the left shift operation (<<) in the UD60x18 type.\\nfunction lshift(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() << bits);\\n}\\n\\n/// @notice Implements the lower than operation (<) in the UD60x18 type.\\nfunction lt(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() < y.unwrap();\\n}\\n\\n/// @notice Implements the lower than or equal to operation (<=) in the UD60x18 type.\\nfunction lte(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() <= y.unwrap();\\n}\\n\\n/// @notice Implements the checked modulo operation (%) in the UD60x18 type.\\nfunction mod(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() % y.unwrap());\\n}\\n\\n/// @notice Implements the not equal operation (!=) in the UD60x18 type.\\nfunction neq(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() != y.unwrap();\\n}\\n\\n/// @notice Implements the NOT (~) bitwise operation in the UD60x18 type.\\nfunction not(UD60x18 x) pure returns (UD60x18 result) {\\n result = wrap(~x.unwrap());\\n}\\n\\n/// @notice Implements the OR (|) bitwise operation in the UD60x18 type.\\nfunction or(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() | y.unwrap());\\n}\\n\\n/// @notice Implements the right shift operation (>>) in the UD60x18 type.\\nfunction rshift(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() >> bits);\\n}\\n\\n/// @notice Implements the checked subtraction operation (-) in the UD60x18 type.\\nfunction sub(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() - y.unwrap());\\n}\\n\\n/// @notice Implements the unchecked addition operation (+) in the UD60x18 type.\\nfunction uncheckedAdd(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() + y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the unchecked subtraction operation (-) in the UD60x18 type.\\nfunction uncheckedSub(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() - y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the XOR (^) bitwise operation in the UD60x18 type.\\nfunction xor(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() ^ y.unwrap());\\n}\\n\",\"keccak256\":\"0xf5faff881391d2c060029499a666cc5f0bea90a213150bb476fae8f02a5df268\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as Errors;\\nimport { wrap } from \\\"./Casting.sol\\\";\\nimport {\\n uEXP_MAX_INPUT,\\n uEXP2_MAX_INPUT,\\n uHALF_UNIT,\\n uLOG2_10,\\n uLOG2_E,\\n uMAX_UD60x18,\\n uMAX_WHOLE_UD60x18,\\n UNIT,\\n uUNIT,\\n uUNIT_SQUARED,\\n ZERO\\n} from \\\"./Constants.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n MATHEMATICAL FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @notice Calculates the arithmetic average of x and y using the following formula:\\n///\\n/// $$\\n/// avg(x, y) = (x & y) + ((xUint ^ yUint) / 2)\\n/// $$\\n///\\n/// In English, this is what this formula does:\\n///\\n/// 1. AND x and y.\\n/// 2. Calculate half of XOR x and y.\\n/// 3. Add the two results together.\\n///\\n/// This technique is known as SWAR, which stands for \\\"SIMD within a register\\\". You can read more about it here:\\n/// https://devblogs.microsoft.com/oldnewthing/20220207-00/?p=106223\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// @param x The first operand as a UD60x18 number.\\n/// @param y The second operand as a UD60x18 number.\\n/// @return result The arithmetic average as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction avg(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n uint256 yUint = y.unwrap();\\n unchecked {\\n result = wrap((xUint & yUint) + ((xUint ^ yUint) >> 1));\\n }\\n}\\n\\n/// @notice Yields the smallest whole number greater than or equal to x.\\n///\\n/// @dev This is optimized for fractional value inputs, because for every whole value there are (1e18 - 1) fractional\\n/// counterparts. See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n///\\n/// Requirements:\\n/// - x must be less than or equal to `MAX_WHOLE_UD60x18`.\\n///\\n/// @param x The UD60x18 number to ceil.\\n/// @param result The smallest whole number greater than or equal to x, as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ceil(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n if (xUint > uMAX_WHOLE_UD60x18) {\\n revert Errors.PRBMath_UD60x18_Ceil_Overflow(x);\\n }\\n\\n assembly (\\\"memory-safe\\\") {\\n // Equivalent to `x % UNIT`.\\n let remainder := mod(x, uUNIT)\\n\\n // Equivalent to `UNIT - remainder`.\\n let delta := sub(uUNIT, remainder)\\n\\n // Equivalent to `x + remainder > 0 ? delta : 0`.\\n result := add(x, mul(delta, gt(remainder, 0)))\\n }\\n}\\n\\n/// @notice Divides two UD60x18 numbers, returning a new UD60x18 number.\\n///\\n/// @dev Uses {Common.mulDiv} to enable overflow-safe multiplication and division.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv}.\\n///\\n/// @param x The numerator as a UD60x18 number.\\n/// @param y The denominator as a UD60x18 number.\\n/// @param result The quotient as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction div(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(Common.mulDiv(x.unwrap(), uUNIT, y.unwrap()));\\n}\\n\\n/// @notice Calculates the natural exponent of x using the following formula:\\n///\\n/// $$\\n/// e^x = 2^{x * log_2{e}}\\n/// $$\\n///\\n/// @dev Requirements:\\n/// - x must be less than 133_084258667509499441.\\n///\\n/// @param x The exponent as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n // This check prevents values greater than 192e18 from being passed to {exp2}.\\n if (xUint > uEXP_MAX_INPUT) {\\n revert Errors.PRBMath_UD60x18_Exp_InputTooBig(x);\\n }\\n\\n unchecked {\\n // Inline the fixed-point multiplication to save gas.\\n uint256 doubleUnitProduct = xUint * uLOG2_E;\\n result = exp2(wrap(doubleUnitProduct / uUNIT));\\n }\\n}\\n\\n/// @notice Calculates the binary exponent of x using the binary fraction method.\\n///\\n/// @dev See https://ethereum.stackexchange.com/q/79903/24693\\n///\\n/// Requirements:\\n/// - x must be less than 192e18.\\n/// - The result must fit in UD60x18.\\n///\\n/// @param x The exponent as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp2(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n // Numbers greater than or equal to 192e18 don't fit in the 192.64-bit format.\\n if (xUint > uEXP2_MAX_INPUT) {\\n revert Errors.PRBMath_UD60x18_Exp2_InputTooBig(x);\\n }\\n\\n // Convert x to the 192.64-bit fixed-point format.\\n uint256 x_192x64 = (xUint << 64) / uUNIT;\\n\\n // Pass x to the {Common.exp2} function, which uses the 192.64-bit fixed-point number representation.\\n result = wrap(Common.exp2(x_192x64));\\n}\\n\\n/// @notice Yields the greatest whole number less than or equal to x.\\n/// @dev Optimized for fractional value inputs, because every whole value has (1e18 - 1) fractional counterparts.\\n/// See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n/// @param x The UD60x18 number to floor.\\n/// @param result The greatest whole number less than or equal to x, as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction floor(UD60x18 x) pure returns (UD60x18 result) {\\n assembly (\\\"memory-safe\\\") {\\n // Equivalent to `x % UNIT`.\\n let remainder := mod(x, uUNIT)\\n\\n // Equivalent to `x - remainder > 0 ? remainder : 0)`.\\n result := sub(x, mul(remainder, gt(remainder, 0)))\\n }\\n}\\n\\n/// @notice Yields the excess beyond the floor of x using the odd function definition.\\n/// @dev See https://en.wikipedia.org/wiki/Fractional_part.\\n/// @param x The UD60x18 number to get the fractional part of.\\n/// @param result The fractional part of x as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction frac(UD60x18 x) pure returns (UD60x18 result) {\\n assembly (\\\"memory-safe\\\") {\\n result := mod(x, uUNIT)\\n }\\n}\\n\\n/// @notice Calculates the geometric mean of x and y, i.e. $\\\\sqrt{x * y}$, rounding down.\\n///\\n/// @dev Requirements:\\n/// - x * y must fit in UD60x18.\\n///\\n/// @param x The first operand as a UD60x18 number.\\n/// @param y The second operand as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction gm(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n uint256 yUint = y.unwrap();\\n if (xUint == 0 || yUint == 0) {\\n return ZERO;\\n }\\n\\n unchecked {\\n // Checking for overflow this way is faster than letting Solidity do it.\\n uint256 xyUint = xUint * yUint;\\n if (xyUint / xUint != yUint) {\\n revert Errors.PRBMath_UD60x18_Gm_Overflow(x, y);\\n }\\n\\n // We don't need to multiply the result by `UNIT` here because the x*y product picked up a factor of `UNIT`\\n // during multiplication. See the comments in {Common.sqrt}.\\n result = wrap(Common.sqrt(xyUint));\\n }\\n}\\n\\n/// @notice Calculates the inverse of x.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x must not be zero.\\n///\\n/// @param x The UD60x18 number for which to calculate the inverse.\\n/// @return result The inverse as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction inv(UD60x18 x) pure returns (UD60x18 result) {\\n unchecked {\\n result = wrap(uUNIT_SQUARED / x.unwrap());\\n }\\n}\\n\\n/// @notice Calculates the natural logarithm of x using the following formula:\\n///\\n/// $$\\n/// ln{x} = log_2{x} / log_2{e}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n/// - The precision isn't sufficiently fine-grained to return exactly `UNIT` when the input is `E`.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The UD60x18 number for which to calculate the natural logarithm.\\n/// @return result The natural logarithm as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ln(UD60x18 x) pure returns (UD60x18 result) {\\n unchecked {\\n // Inline the fixed-point multiplication to save gas. This is overflow-safe because the maximum value that\\n // {log2} can return is ~196_205294292027477728.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_E);\\n }\\n}\\n\\n/// @notice Calculates the common logarithm of x using the following formula:\\n///\\n/// $$\\n/// log_{10}{x} = log_2{x} / log_2{10}\\n/// $$\\n///\\n/// However, if x is an exact power of ten, a hard coded value is returned.\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The UD60x18 number for which to calculate the common logarithm.\\n/// @return result The common logarithm as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log10(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n if (xUint < uUNIT) {\\n revert Errors.PRBMath_UD60x18_Log_InputTooSmall(x);\\n }\\n\\n // Note that the `mul` in this assembly block is the standard multiplication operation, not {UD60x18.mul}.\\n // prettier-ignore\\n assembly (\\\"memory-safe\\\") {\\n switch x\\n case 1 { result := mul(uUNIT, sub(0, 18)) }\\n case 10 { result := mul(uUNIT, sub(1, 18)) }\\n case 100 { result := mul(uUNIT, sub(2, 18)) }\\n case 1000 { result := mul(uUNIT, sub(3, 18)) }\\n case 10000 { result := mul(uUNIT, sub(4, 18)) }\\n case 100000 { result := mul(uUNIT, sub(5, 18)) }\\n case 1000000 { result := mul(uUNIT, sub(6, 18)) }\\n case 10000000 { result := mul(uUNIT, sub(7, 18)) }\\n case 100000000 { result := mul(uUNIT, sub(8, 18)) }\\n case 1000000000 { result := mul(uUNIT, sub(9, 18)) }\\n case 10000000000 { result := mul(uUNIT, sub(10, 18)) }\\n case 100000000000 { result := mul(uUNIT, sub(11, 18)) }\\n case 1000000000000 { result := mul(uUNIT, sub(12, 18)) }\\n case 10000000000000 { result := mul(uUNIT, sub(13, 18)) }\\n case 100000000000000 { result := mul(uUNIT, sub(14, 18)) }\\n case 1000000000000000 { result := mul(uUNIT, sub(15, 18)) }\\n case 10000000000000000 { result := mul(uUNIT, sub(16, 18)) }\\n case 100000000000000000 { result := mul(uUNIT, sub(17, 18)) }\\n case 1000000000000000000 { result := 0 }\\n case 10000000000000000000 { result := uUNIT }\\n case 100000000000000000000 { result := mul(uUNIT, 2) }\\n case 1000000000000000000000 { result := mul(uUNIT, 3) }\\n case 10000000000000000000000 { result := mul(uUNIT, 4) }\\n case 100000000000000000000000 { result := mul(uUNIT, 5) }\\n case 1000000000000000000000000 { result := mul(uUNIT, 6) }\\n case 10000000000000000000000000 { result := mul(uUNIT, 7) }\\n case 100000000000000000000000000 { result := mul(uUNIT, 8) }\\n case 1000000000000000000000000000 { result := mul(uUNIT, 9) }\\n case 10000000000000000000000000000 { result := mul(uUNIT, 10) }\\n case 100000000000000000000000000000 { result := mul(uUNIT, 11) }\\n case 1000000000000000000000000000000 { result := mul(uUNIT, 12) }\\n case 10000000000000000000000000000000 { result := mul(uUNIT, 13) }\\n case 100000000000000000000000000000000 { result := mul(uUNIT, 14) }\\n case 1000000000000000000000000000000000 { result := mul(uUNIT, 15) }\\n case 10000000000000000000000000000000000 { result := mul(uUNIT, 16) }\\n case 100000000000000000000000000000000000 { result := mul(uUNIT, 17) }\\n case 1000000000000000000000000000000000000 { result := mul(uUNIT, 18) }\\n case 10000000000000000000000000000000000000 { result := mul(uUNIT, 19) }\\n case 100000000000000000000000000000000000000 { result := mul(uUNIT, 20) }\\n case 1000000000000000000000000000000000000000 { result := mul(uUNIT, 21) }\\n case 10000000000000000000000000000000000000000 { result := mul(uUNIT, 22) }\\n case 100000000000000000000000000000000000000000 { result := mul(uUNIT, 23) }\\n case 1000000000000000000000000000000000000000000 { result := mul(uUNIT, 24) }\\n case 10000000000000000000000000000000000000000000 { result := mul(uUNIT, 25) }\\n case 100000000000000000000000000000000000000000000 { result := mul(uUNIT, 26) }\\n case 1000000000000000000000000000000000000000000000 { result := mul(uUNIT, 27) }\\n case 10000000000000000000000000000000000000000000000 { result := mul(uUNIT, 28) }\\n case 100000000000000000000000000000000000000000000000 { result := mul(uUNIT, 29) }\\n case 1000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 30) }\\n case 10000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 31) }\\n case 100000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 32) }\\n case 1000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 33) }\\n case 10000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 34) }\\n case 100000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 35) }\\n case 1000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 36) }\\n case 10000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 37) }\\n case 100000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 38) }\\n case 1000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 39) }\\n case 10000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 40) }\\n case 100000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 41) }\\n case 1000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 42) }\\n case 10000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 43) }\\n case 100000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 44) }\\n case 1000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 45) }\\n case 10000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 46) }\\n case 100000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 47) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 48) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 49) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 50) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 51) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 52) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 53) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 54) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 55) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 56) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 57) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 58) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 59) }\\n default { result := uMAX_UD60x18 }\\n }\\n\\n if (result.unwrap() == uMAX_UD60x18) {\\n unchecked {\\n // Inline the fixed-point division to save gas.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_10);\\n }\\n }\\n}\\n\\n/// @notice Calculates the binary logarithm of x using the iterative approximation algorithm:\\n///\\n/// $$\\n/// log_2{x} = n + log_2{y}, \\\\text{ where } y = x*2^{-n}, \\\\ y \\\\in [1, 2)\\n/// $$\\n///\\n/// For $0 \\\\leq x \\\\lt 1$, the input is inverted:\\n///\\n/// $$\\n/// log_2{x} = -log_2{\\\\frac{1}{x}}\\n/// $$\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Binary_logarithm#Iterative_approximation\\n///\\n/// Notes:\\n/// - Due to the lossy precision of the iterative approximation, the results are not perfectly accurate to the last decimal.\\n///\\n/// Requirements:\\n/// - x must be greater than zero.\\n///\\n/// @param x The UD60x18 number for which to calculate the binary logarithm.\\n/// @return result The binary logarithm as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log2(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n if (xUint < uUNIT) {\\n revert Errors.PRBMath_UD60x18_Log_InputTooSmall(x);\\n }\\n\\n unchecked {\\n // Calculate the integer part of the logarithm.\\n uint256 n = Common.msb(xUint / uUNIT);\\n\\n // This is the integer part of the logarithm as a UD60x18 number. The operation can't overflow because n\\n // n is at most 255 and UNIT is 1e18.\\n uint256 resultUint = n * uUNIT;\\n\\n // Calculate $y = x * 2^{-n}$.\\n uint256 y = xUint >> n;\\n\\n // If y is the unit number, the fractional part is zero.\\n if (y == uUNIT) {\\n return wrap(resultUint);\\n }\\n\\n // Calculate the fractional part via the iterative approximation.\\n // The `delta >>= 1` part is equivalent to `delta /= 2`, but shifting bits is more gas efficient.\\n uint256 DOUBLE_UNIT = 2e18;\\n for (uint256 delta = uHALF_UNIT; delta > 0; delta >>= 1) {\\n y = (y * y) / uUNIT;\\n\\n // Is y^2 >= 2e18 and so in the range [2e18, 4e18)?\\n if (y >= DOUBLE_UNIT) {\\n // Add the 2^{-m} factor to the logarithm.\\n resultUint += delta;\\n\\n // Halve y, which corresponds to z/2 in the Wikipedia article.\\n y >>= 1;\\n }\\n }\\n result = wrap(resultUint);\\n }\\n}\\n\\n/// @notice Multiplies two UD60x18 numbers together, returning a new UD60x18 number.\\n///\\n/// @dev Uses {Common.mulDiv} to enable overflow-safe multiplication and division.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv}.\\n///\\n/// @dev See the documentation in {Common.mulDiv18}.\\n/// @param x The multiplicand as a UD60x18 number.\\n/// @param y The multiplier as a UD60x18 number.\\n/// @return result The product as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mul(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(Common.mulDiv18(x.unwrap(), y.unwrap()));\\n}\\n\\n/// @notice Raises x to the power of y.\\n///\\n/// For $1 \\\\leq x \\\\leq \\\\infty$, the following standard formula is used:\\n///\\n/// $$\\n/// x^y = 2^{log_2{x} * y}\\n/// $$\\n///\\n/// For $0 \\\\leq x \\\\lt 1$, since the unsigned {log2} is undefined, an equivalent formula is used:\\n///\\n/// $$\\n/// i = \\\\frac{1}{x}\\n/// w = 2^{log_2{i} * y}\\n/// x^y = \\\\frac{1}{w}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2} and {mul}.\\n/// - Returns `UNIT` for 0^0.\\n/// - It may not perform well with very small values of x. Consider using SD59x18 as an alternative.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {exp2}, {log2}, and {mul}.\\n///\\n/// @param x The base as a UD60x18 number.\\n/// @param y The exponent as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction pow(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n uint256 yUint = y.unwrap();\\n\\n // If both x and y are zero, the result is `UNIT`. If just x is zero, the result is always zero.\\n if (xUint == 0) {\\n return yUint == 0 ? UNIT : ZERO;\\n }\\n // If x is `UNIT`, the result is always `UNIT`.\\n else if (xUint == uUNIT) {\\n return UNIT;\\n }\\n\\n // If y is zero, the result is always `UNIT`.\\n if (yUint == 0) {\\n return UNIT;\\n }\\n // If y is `UNIT`, the result is always x.\\n else if (yUint == uUNIT) {\\n return x;\\n }\\n\\n // If x is greater than `UNIT`, use the standard formula.\\n if (xUint > uUNIT) {\\n result = exp2(mul(log2(x), y));\\n }\\n // Conversely, if x is less than `UNIT`, use the equivalent formula.\\n else {\\n UD60x18 i = wrap(uUNIT_SQUARED / xUint);\\n UD60x18 w = exp2(mul(log2(i), y));\\n result = wrap(uUNIT_SQUARED / w.unwrap());\\n }\\n}\\n\\n/// @notice Raises x (a UD60x18 number) to the power y (an unsigned basic integer) using the well-known\\n/// algorithm \\\"exponentiation by squaring\\\".\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Exponentiation_by_squaring.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv18}.\\n/// - Returns `UNIT` for 0^0.\\n///\\n/// Requirements:\\n/// - The result must fit in UD60x18.\\n///\\n/// @param x The base as a UD60x18 number.\\n/// @param y The exponent as a uint256.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction powu(UD60x18 x, uint256 y) pure returns (UD60x18 result) {\\n // Calculate the first iteration of the loop in advance.\\n uint256 xUint = x.unwrap();\\n uint256 resultUint = y & 1 > 0 ? xUint : uUNIT;\\n\\n // Equivalent to `for(y /= 2; y > 0; y /= 2)`.\\n for (y >>= 1; y > 0; y >>= 1) {\\n xUint = Common.mulDiv18(xUint, xUint);\\n\\n // Equivalent to `y % 2 == 1`.\\n if (y & 1 > 0) {\\n resultUint = Common.mulDiv18(resultUint, xUint);\\n }\\n }\\n result = wrap(resultUint);\\n}\\n\\n/// @notice Calculates the square root of x using the Babylonian method.\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\\n///\\n/// Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x must be less than `MAX_UD60x18 / UNIT`.\\n///\\n/// @param x The UD60x18 number for which to calculate the square root.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction sqrt(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n unchecked {\\n if (xUint > uMAX_UD60x18 / uUNIT) {\\n revert Errors.PRBMath_UD60x18_Sqrt_Overflow(x);\\n }\\n // Multiply x by `UNIT` to account for the factor of `UNIT` picked up when multiplying two UD60x18 numbers.\\n // In this case, the two numbers are both the square root.\\n result = wrap(Common.sqrt(xUint * uUNIT));\\n }\\n}\\n\",\"keccak256\":\"0x462144667aac3f96d5f8dba7aa68fe4c5a3f61e1d7bbbc81bee21168817f9c09\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\nimport \\\"./Helpers.sol\\\" as Helpers;\\nimport \\\"./Math.sol\\\" as Math;\\n\\n/// @notice The unsigned 60.18-decimal fixed-point number representation, which can have up to 60 digits and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the Solidity type uint256.\\n/// @dev The value type is defined here so it can be imported in all other files.\\ntype UD60x18 is uint256;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoSD1x18,\\n Casting.intoUD2x18,\\n Casting.intoSD59x18,\\n Casting.intoUint128,\\n Casting.intoUint256,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for UD60x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n MATHEMATICAL FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes the functions in this library callable on the UD60x18 type.\\nusing {\\n Math.avg,\\n Math.ceil,\\n Math.div,\\n Math.exp,\\n Math.exp2,\\n Math.floor,\\n Math.frac,\\n Math.gm,\\n Math.inv,\\n Math.ln,\\n Math.log10,\\n Math.log2,\\n Math.mul,\\n Math.pow,\\n Math.powu,\\n Math.sqrt\\n} for UD60x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n HELPER FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes the functions in this library callable on the UD60x18 type.\\nusing {\\n Helpers.add,\\n Helpers.and,\\n Helpers.eq,\\n Helpers.gt,\\n Helpers.gte,\\n Helpers.isZero,\\n Helpers.lshift,\\n Helpers.lt,\\n Helpers.lte,\\n Helpers.mod,\\n Helpers.neq,\\n Helpers.not,\\n Helpers.or,\\n Helpers.rshift,\\n Helpers.sub,\\n Helpers.uncheckedAdd,\\n Helpers.uncheckedSub,\\n Helpers.xor\\n} for UD60x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n OPERATORS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes it possible to use these operators on the UD60x18 type.\\nusing {\\n Helpers.add as +,\\n Helpers.and2 as &,\\n Math.div as /,\\n Helpers.eq as ==,\\n Helpers.gt as >,\\n Helpers.gte as >=,\\n Helpers.lt as <,\\n Helpers.lte as <=,\\n Helpers.or as |,\\n Helpers.mod as %,\\n Math.mul as *,\\n Helpers.neq as !=,\\n Helpers.not as ~,\\n Helpers.sub as -,\\n Helpers.xor as ^\\n} for UD60x18 global;\\n\",\"keccak256\":\"0xdd873b5124180d9b71498b3a7fe93b1c08c368bec741f7d5f8e17f78a0b70f31\",\"license\":\"MIT\"},\"contracts/interfaces/IERC6551Registry.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\ninterface IERC6551Registry {\\n /**\\n * @dev Creates a token bound account for a non-fungible token.\\n *\\n * If account has already been created, returns the account address without calling create2.\\n *\\n * Emits ERC6551AccountCreated event.\\n *\\n * @return account The address of the token bound account\\n */\\n function createAccount(\\n address implementation,\\n bytes32 salt,\\n uint256 chainId,\\n address tokenContract,\\n uint256 tokenId\\n ) external returns (address account);\\n}\\n\",\"keccak256\":\"0x64c52de8a8e68398e61dd8b42dda8e9af8cf6abf93bb85629c322440991ea568\",\"license\":\"MIT\"},\"contracts/interfaces/hats/HatsErrors.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface HatsErrors {\\n /// @notice Emitted when `user` is attempting to perform an action on `hatId` but is not wearing one of `hatId`'s admin hats\\n /// @dev Can be equivalent to `NotHatWearer(buildHatId(hatId))`, such as when emitted by `approveLinkTopHatToTree` or `relinkTopHatToTree`\\n error NotAdmin(address user, uint256 hatId);\\n\\n /// @notice Emitted when attempting to perform an action as or for an account that is not a wearer of a given hat\\n error NotHatWearer();\\n\\n /// @notice Emitted when attempting to perform an action that requires being either an admin or wearer of a given hat\\n error NotAdminOrWearer();\\n\\n /// @notice Emitted when attempting to mint `hatId` but `hatId`'s maxSupply has been reached\\n error AllHatsWorn(uint256 hatId);\\n\\n /// @notice Emitted when attempting to create a hat with a level 14 hat as its admin\\n error MaxLevelsReached();\\n\\n /// @notice Emitted when an attempted hat id has empty intermediate level(s)\\n error InvalidHatId();\\n\\n /// @notice Emitted when attempting to mint `hatId` to a `wearer` who is already wearing the hat\\n error AlreadyWearingHat(address wearer, uint256 hatId);\\n\\n /// @notice Emitted when attempting to mint a non-existant hat\\n error HatDoesNotExist(uint256 hatId);\\n\\n /// @notice Emmitted when attempting to mint or transfer a hat that is not active\\n error HatNotActive();\\n\\n /// @notice Emitted when attempting to mint or transfer a hat to an ineligible wearer\\n error NotEligible();\\n\\n /// @notice Emitted when attempting to check or set a hat's status from an account that is not that hat's toggle module\\n error NotHatsToggle();\\n\\n /// @notice Emitted when attempting to check or set a hat wearer's status from an account that is not that hat's eligibility module\\n error NotHatsEligibility();\\n\\n /// @notice Emitted when array arguments to a batch function have mismatching lengths\\n error BatchArrayLengthMismatch();\\n\\n /// @notice Emitted when attempting to mutate or transfer an immutable hat\\n error Immutable();\\n\\n /// @notice Emitted when attempting to change a hat's maxSupply to a value lower than its current supply\\n error NewMaxSupplyTooLow();\\n\\n /// @notice Emitted when attempting to link a tophat to a new admin for which the tophat serves as an admin\\n error CircularLinkage();\\n\\n /// @notice Emitted when attempting to link or relink a tophat to a separate tree\\n error CrossTreeLinkage();\\n\\n /// @notice Emitted when attempting to link a tophat without a request\\n error LinkageNotRequested();\\n\\n /// @notice Emitted when attempting to unlink a tophat that does not have a wearer\\n /// @dev This ensures that unlinking never results in a bricked tophat\\n error InvalidUnlink();\\n\\n /// @notice Emmited when attempting to change a hat's eligibility or toggle module to the zero address\\n error ZeroAddress();\\n\\n /// @notice Emmitted when attempting to change a hat's details or imageURI to a string with over 7000 bytes (~characters)\\n /// @dev This protects against a DOS attack where an admin iteratively extend's a hat's details or imageURI\\n /// to be so long that reading it exceeds the block gas limit, breaking `uri()` and `viewHat()`\\n error StringTooLong();\\n}\\n\",\"keccak256\":\"0x81b0056b7bed86eabc07c0e4a9655c586ddb8e6c128320593669b76efd5a08de\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/HatsEvents.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface HatsEvents {\\n /// @notice Emitted when a new hat is created\\n /// @param id The id for the new hat\\n /// @param details A description of the Hat\\n /// @param maxSupply The total instances of the Hat that can be worn at once\\n /// @param eligibility The address that can report on the Hat wearer's status\\n /// @param toggle The address that can deactivate the Hat\\n /// @param mutable_ Whether the hat's properties are changeable after creation\\n /// @param imageURI The image uri for this hat and the fallback for its\\n event HatCreated(\\n uint256 id,\\n string details,\\n uint32 maxSupply,\\n address eligibility,\\n address toggle,\\n bool mutable_,\\n string imageURI\\n );\\n\\n /// @notice Emitted when a hat wearer's standing is updated\\n /// @dev Eligibility is excluded since the source of truth for eligibility is the eligibility module and may change without a transaction\\n /// @param hatId The id of the wearer's hat\\n /// @param wearer The wearer's address\\n /// @param wearerStanding Whether the wearer is in good standing for the hat\\n event WearerStandingChanged(\\n uint256 hatId,\\n address wearer,\\n bool wearerStanding\\n );\\n\\n /// @notice Emitted when a hat's status is updated\\n /// @param hatId The id of the hat\\n /// @param newStatus Whether the hat is active\\n event HatStatusChanged(uint256 hatId, bool newStatus);\\n\\n /// @notice Emitted when a hat's details are updated\\n /// @param hatId The id of the hat\\n /// @param newDetails The updated details\\n event HatDetailsChanged(uint256 hatId, string newDetails);\\n\\n /// @notice Emitted when a hat's eligibility module is updated\\n /// @param hatId The id of the hat\\n /// @param newEligibility The updated eligibiliy module\\n event HatEligibilityChanged(uint256 hatId, address newEligibility);\\n\\n /// @notice Emitted when a hat's toggle module is updated\\n /// @param hatId The id of the hat\\n /// @param newToggle The updated toggle module\\n event HatToggleChanged(uint256 hatId, address newToggle);\\n\\n /// @notice Emitted when a hat's mutability is updated\\n /// @param hatId The id of the hat\\n event HatMutabilityChanged(uint256 hatId);\\n\\n /// @notice Emitted when a hat's maximum supply is updated\\n /// @param hatId The id of the hat\\n /// @param newMaxSupply The updated max supply\\n event HatMaxSupplyChanged(uint256 hatId, uint32 newMaxSupply);\\n\\n /// @notice Emitted when a hat's image URI is updated\\n /// @param hatId The id of the hat\\n /// @param newImageURI The updated image URI\\n event HatImageURIChanged(uint256 hatId, string newImageURI);\\n\\n /// @notice Emitted when a tophat linkage is requested by its admin\\n /// @param domain The domain of the tree tophat to link\\n /// @param newAdmin The tophat's would-be admin in the parent tree\\n event TopHatLinkRequested(uint32 domain, uint256 newAdmin);\\n\\n /// @notice Emitted when a tophat is linked to a another tree\\n /// @param domain The domain of the newly-linked tophat\\n /// @param newAdmin The tophat's new admin in the parent tree\\n event TopHatLinked(uint32 domain, uint256 newAdmin);\\n}\\n\",\"keccak256\":\"0x53413397d15e1636c3cd7bd667656b79bc2886785403b824bcd4ed122667f2c6\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/IHats.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\nimport \\\"./IHatsIdUtilities.sol\\\";\\nimport \\\"./HatsErrors.sol\\\";\\nimport \\\"./HatsEvents.sol\\\";\\n\\ninterface IHats is IHatsIdUtilities, HatsErrors, HatsEvents {\\n function mintTopHat(\\n address _target,\\n string memory _details,\\n string memory _imageURI\\n ) external returns (uint256 topHatId);\\n\\n function createHat(\\n uint256 _admin,\\n string calldata _details,\\n uint32 _maxSupply,\\n address _eligibility,\\n address _toggle,\\n bool _mutable,\\n string calldata _imageURI\\n ) external returns (uint256 newHatId);\\n\\n function batchCreateHats(\\n uint256[] calldata _admins,\\n string[] calldata _details,\\n uint32[] calldata _maxSupplies,\\n address[] memory _eligibilityModules,\\n address[] memory _toggleModules,\\n bool[] calldata _mutables,\\n string[] calldata _imageURIs\\n ) external returns (bool success);\\n\\n function getNextId(uint256 _admin) external view returns (uint256 nextId);\\n\\n function mintHat(\\n uint256 _hatId,\\n address _wearer\\n ) external returns (bool success);\\n\\n function batchMintHats(\\n uint256[] calldata _hatIds,\\n address[] calldata _wearers\\n ) external returns (bool success);\\n\\n function setHatStatus(\\n uint256 _hatId,\\n bool _newStatus\\n ) external returns (bool toggled);\\n\\n function checkHatStatus(uint256 _hatId) external returns (bool toggled);\\n\\n function setHatWearerStatus(\\n uint256 _hatId,\\n address _wearer,\\n bool _eligible,\\n bool _standing\\n ) external returns (bool updated);\\n\\n function checkHatWearerStatus(\\n uint256 _hatId,\\n address _wearer\\n ) external returns (bool updated);\\n\\n function renounceHat(uint256 _hatId) external;\\n\\n function transferHat(uint256 _hatId, address _from, address _to) external;\\n\\n /*//////////////////////////////////////////////////////////////\\n HATS ADMIN FUNCTIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n function makeHatImmutable(uint256 _hatId) external;\\n\\n function changeHatDetails(\\n uint256 _hatId,\\n string memory _newDetails\\n ) external;\\n\\n function changeHatEligibility(\\n uint256 _hatId,\\n address _newEligibility\\n ) external;\\n\\n function changeHatToggle(uint256 _hatId, address _newToggle) external;\\n\\n function changeHatImageURI(\\n uint256 _hatId,\\n string memory _newImageURI\\n ) external;\\n\\n function changeHatMaxSupply(uint256 _hatId, uint32 _newMaxSupply) external;\\n\\n function requestLinkTopHatToTree(\\n uint32 _topHatId,\\n uint256 _newAdminHat\\n ) external;\\n\\n function approveLinkTopHatToTree(\\n uint32 _topHatId,\\n uint256 _newAdminHat,\\n address _eligibility,\\n address _toggle,\\n string calldata _details,\\n string calldata _imageURI\\n ) external;\\n\\n function unlinkTopHatFromTree(uint32 _topHatId, address _wearer) external;\\n\\n function relinkTopHatWithinTree(\\n uint32 _topHatDomain,\\n uint256 _newAdminHat,\\n address _eligibility,\\n address _toggle,\\n string calldata _details,\\n string calldata _imageURI\\n ) external;\\n\\n /*//////////////////////////////////////////////////////////////\\n VIEW FUNCTIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n function viewHat(\\n uint256 _hatId\\n )\\n external\\n view\\n returns (\\n string memory details,\\n uint32 maxSupply,\\n uint32 supply,\\n address eligibility,\\n address toggle,\\n string memory imageURI,\\n uint16 lastHatId,\\n bool mutable_,\\n bool active\\n );\\n\\n function isWearerOfHat(\\n address _user,\\n uint256 _hatId\\n ) external view returns (bool isWearer);\\n\\n function isAdminOfHat(\\n address _user,\\n uint256 _hatId\\n ) external view returns (bool isAdmin);\\n\\n function isInGoodStanding(\\n address _wearer,\\n uint256 _hatId\\n ) external view returns (bool standing);\\n\\n function isEligible(\\n address _wearer,\\n uint256 _hatId\\n ) external view returns (bool eligible);\\n\\n function getHatEligibilityModule(\\n uint256 _hatId\\n ) external view returns (address eligibility);\\n\\n function getHatToggleModule(\\n uint256 _hatId\\n ) external view returns (address toggle);\\n\\n function getHatMaxSupply(\\n uint256 _hatId\\n ) external view returns (uint32 maxSupply);\\n\\n function hatSupply(uint256 _hatId) external view returns (uint32 supply);\\n\\n function getImageURIForHat(\\n uint256 _hatId\\n ) external view returns (string memory _uri);\\n\\n function balanceOf(\\n address wearer,\\n uint256 hatId\\n ) external view returns (uint256 balance);\\n\\n function balanceOfBatch(\\n address[] calldata _wearers,\\n uint256[] calldata _hatIds\\n ) external view returns (uint256[] memory);\\n\\n function uri(uint256 id) external view returns (string memory _uri);\\n}\\n\",\"keccak256\":\"0x2867004bddc5148fa1937f25c0403e5d9977583aaf50fdbdb74bd463f64f21c8\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/IHatsIdUtilities.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface IHatsIdUtilities {\\n function buildHatId(\\n uint256 _admin,\\n uint16 _newHat\\n ) external pure returns (uint256 id);\\n\\n function getHatLevel(uint256 _hatId) external view returns (uint32 level);\\n\\n function getLocalHatLevel(\\n uint256 _hatId\\n ) external pure returns (uint32 level);\\n\\n function isTopHat(uint256 _hatId) external view returns (bool _topHat);\\n\\n function isLocalTopHat(\\n uint256 _hatId\\n ) external pure returns (bool _localTopHat);\\n\\n function isValidHatId(\\n uint256 _hatId\\n ) external view returns (bool validHatId);\\n\\n function getAdminAtLevel(\\n uint256 _hatId,\\n uint32 _level\\n ) external view returns (uint256 admin);\\n\\n function getAdminAtLocalLevel(\\n uint256 _hatId,\\n uint32 _level\\n ) external pure returns (uint256 admin);\\n\\n function getTopHatDomain(\\n uint256 _hatId\\n ) external view returns (uint32 domain);\\n\\n function getTippyTopHatDomain(\\n uint32 _topHatDomain\\n ) external view returns (uint32 domain);\\n\\n function noCircularLinkage(\\n uint32 _topHatDomain,\\n uint256 _linkedAdmin\\n ) external view returns (bool notCircular);\\n\\n function sameTippyTopHatDomain(\\n uint32 _topHatDomain,\\n uint256 _newAdminHat\\n ) external view returns (bool sameDomain);\\n}\\n\",\"keccak256\":\"0x007fcc07b20bf84bacad1f9a2ddf4e30e1a8be961e144b7bef8e98a51781aee9\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/IHatsModuleFactory.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.19;\\n\\ninterface IHatsModuleFactory {\\n error HatsModuleFactory_ModuleAlreadyDeployed(\\n address implementation,\\n uint256 hatId,\\n bytes otherImmutableArgs,\\n uint256 saltNonce\\n );\\n\\n error BatchArrayLengthMismatch();\\n\\n event HatsModuleFactory_ModuleDeployed(\\n address implementation,\\n address instance,\\n uint256 hatId,\\n bytes otherImmutableArgs,\\n bytes initData,\\n uint256 saltNonce\\n );\\n\\n function HATS() external view returns (address);\\n\\n function version() external view returns (string memory);\\n\\n function createHatsModule(\\n address _implementation,\\n uint256 _hatId,\\n bytes calldata _otherImmutableArgs,\\n bytes calldata _initData,\\n uint256 _saltNonce\\n ) external returns (address _instance);\\n\\n function batchCreateHatsModule(\\n address[] calldata _implementations,\\n uint256[] calldata _hatIds,\\n bytes[] calldata _otherImmutableArgsArray,\\n bytes[] calldata _initDataArray,\\n uint256[] calldata _saltNonces\\n ) external returns (bool success);\\n\\n function getHatsModuleAddress(\\n address _implementation,\\n uint256 _hatId,\\n bytes calldata _otherImmutableArgs,\\n uint256 _saltNonce\\n ) external view returns (address);\\n\\n function deployed(\\n address _implementation,\\n uint256 _hatId,\\n bytes calldata _otherImmutableArgs,\\n uint256 _saltNonce\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x861faf40785cedb829243116d492653414a367853408a5c27d201522f6c3bfdd\",\"license\":\"MIT\"},\"contracts/interfaces/hats/modules/IHatsElectionsEligibility.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.13;\\n\\ninterface IHatsElectionsEligibility {\\n event ElectionOpened(uint128 nextTermEnd);\\n event ElectionCompleted(uint128 termEnd, address[] winners);\\n event NewTermStarted(uint128 termEnd);\\n event Recalled(uint128 termEnd, address[] accounts);\\n\\n /// @notice Returns the first second after the current term ends.\\n /// @dev Also serves as the id for the current term.\\n function currentTermEnd() external view returns (uint128);\\n\\n /// @notice Returns the first second after the next term ends.\\n /// @dev Also serves as the id for the next term.\\n function nextTermEnd() external view returns (uint128);\\n\\n /// @notice Returns the election status (open or closed) for a given term end.\\n /// @param termEnd The term end timestamp to query.\\n function electionStatus(\\n uint128 termEnd\\n ) external view returns (bool isElectionOpen);\\n\\n /// @notice Returns whether a candidate was elected in a given term.\\n /// @param termEnd The term end timestamp to query.\\n /// @param candidate The address of the candidate.\\n function electionResults(\\n uint128 termEnd,\\n address candidate\\n ) external view returns (bool elected);\\n\\n /// @notice Returns the BALLOT_BOX_HAT constant.\\n function BALLOT_BOX_HAT() external pure returns (uint256);\\n\\n /// @notice Returns the ADMIN_HAT constant.\\n function ADMIN_HAT() external pure returns (uint256);\\n\\n /**\\n * @notice Submit the results of an election for a specified term.\\n * @dev Only callable by the wearer(s) of the BALLOT_BOX_HAT.\\n * @param _termEnd The id of the term for which the election results are being submitted.\\n * @param _winners The addresses of the winners of the election.\\n */\\n function elect(uint128 _termEnd, address[] calldata _winners) external;\\n\\n /**\\n * @notice Submit the results of a recall election for a specified term.\\n * @dev Only callable by the wearer(s) of the BALLOT_BOX_HAT.\\n * @param _termEnd The id of the term for which the recall results are being submitted.\\n * @param _recallees The addresses to be recalled.\\n */\\n function recall(uint128 _termEnd, address[] calldata _recallees) external;\\n\\n /**\\n * @notice Set the next term and open the election for it.\\n * @dev Only callable by the wearer(s) of the ADMIN_HAT.\\n * @param _newTermEnd The id of the term that will be opened.\\n */\\n function setNextTerm(uint128 _newTermEnd) external;\\n\\n /**\\n * @notice Start the next term, updating the current term.\\n * @dev Can be called by anyone, but will revert if conditions are not met.\\n */\\n function startNextTerm() external;\\n\\n /**\\n * @notice Determine the eligibility and standing of a wearer for a hat.\\n * @param _wearer The address of the hat wearer.\\n * @param _hatId The ID of the hat.\\n * @return eligible True if the wearer is eligible for the hat.\\n * @return standing True if the wearer is in good standing.\\n */\\n function getWearerStatus(\\n address _wearer,\\n uint256 _hatId\\n ) external view returns (bool eligible, bool standing);\\n}\\n\",\"keccak256\":\"0x74dfc5d538d866ddb8ee2ca1b569abf62e02d848c59f308adf6075ecff175c7d\",\"license\":\"MIT\"},\"contracts/interfaces/sablier/IAdminable.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\n/// @title IAdminable\\n/// @notice Contract module that provides a basic access control mechanism, with an admin that can be\\n/// granted exclusive access to specific functions. The inheriting contract must set the initial admin\\n/// in the constructor.\\ninterface IAdminable {\\n /*//////////////////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Emitted when the admin is transferred.\\n /// @param oldAdmin The address of the old admin.\\n /// @param newAdmin The address of the new admin.\\n event TransferAdmin(address indexed oldAdmin, address indexed newAdmin);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice The address of the admin account or contract.\\n function admin() external view returns (address);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n NON-CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Transfers the contract admin to a new address.\\n ///\\n /// @dev Notes:\\n /// - Does not revert if the admin is the same.\\n /// - This function can potentially leave the contract without an admin, thereby removing any\\n /// functionality that is only available to the admin.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the contract admin.\\n ///\\n /// @param newAdmin The address of the new admin.\\n function transferAdmin(address newAdmin) external;\\n}\\n\",\"keccak256\":\"0xa279c49e51228b571329164e36250e82b2c1378e8b549194ab7dd90fca9c3b2b\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/IERC4096.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 \\\"@openzeppelin/contracts/interfaces/IERC165.sol\\\";\\nimport {IERC721} from \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\n\\n/// @title ERC-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\",\"keccak256\":\"0xa34b9c52cbe36be860244f52256f1b05badf0cb797d208664b87337610d0e82d\",\"license\":\"MIT\"},\"contracts/interfaces/sablier/ISablierV2Lockup.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC4906} from \\\"./IERC4096.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IERC721Metadata} from \\\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\\\";\\nimport {UD60x18} from \\\"@prb/math/src/UD60x18.sol\\\";\\n\\nimport {Lockup} from \\\"./types/DataTypes.sol\\\";\\nimport {IAdminable} from \\\"./IAdminable.sol\\\";\\nimport {ISablierV2NFTDescriptor} from \\\"./ISablierV2NFTDescriptor.sol\\\";\\n\\n/// @title ISablierV2Lockup\\n/// @notice Common logic between all Sablier V2 Lockup contracts.\\ninterface ISablierV2Lockup is\\n IAdminable, // 0 inherited components\\n IERC4906, // 2 inherited components\\n IERC721Metadata // 2 inherited components\\n{\\n /*//////////////////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Emitted when the admin allows a new recipient contract to hook to Sablier.\\n /// @param admin The address of the current contract admin.\\n /// @param recipient The address of the recipient contract put on the allowlist.\\n event AllowToHook(address indexed admin, address recipient);\\n\\n /// @notice Emitted when a stream is canceled.\\n /// @param streamId The ID of the stream.\\n /// @param sender The address of the stream's sender.\\n /// @param recipient The address of the stream's recipient.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param senderAmount The amount of assets refunded to the stream's sender, denoted in units of the asset's\\n /// decimals.\\n /// @param recipientAmount The amount of assets left for the stream's recipient to withdraw, denoted in units of the\\n /// asset's decimals.\\n event CancelLockupStream(\\n uint256 streamId,\\n address indexed sender,\\n address indexed recipient,\\n IERC20 indexed asset,\\n uint128 senderAmount,\\n uint128 recipientAmount\\n );\\n\\n /// @notice Emitted when a sender gives up the right to cancel a stream.\\n /// @param streamId The ID of the stream.\\n event RenounceLockupStream(uint256 indexed streamId);\\n\\n /// @notice Emitted when the admin sets a new NFT descriptor contract.\\n /// @param admin The address of the current contract admin.\\n /// @param oldNFTDescriptor The address of the old NFT descriptor contract.\\n /// @param newNFTDescriptor The address of the new NFT descriptor contract.\\n event SetNFTDescriptor(\\n address indexed admin,\\n ISablierV2NFTDescriptor oldNFTDescriptor,\\n ISablierV2NFTDescriptor newNFTDescriptor\\n );\\n\\n /// @notice Emitted when assets are withdrawn from a stream.\\n /// @param streamId The ID of the stream.\\n /// @param to The address that has received the withdrawn assets.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param amount The amount of assets withdrawn, denoted in units of the asset's decimals.\\n event WithdrawFromLockupStream(\\n uint256 indexed streamId,\\n address indexed to,\\n IERC20 indexed asset,\\n uint128 amount\\n );\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Retrieves the address of the ERC-20 asset to be distributed.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getAsset(uint256 streamId) external view returns (IERC20 asset);\\n\\n /// @notice Retrieves the amount deposited in the stream, denoted in units of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getDepositedAmount(\\n uint256 streamId\\n ) external view returns (uint128 depositedAmount);\\n\\n /// @notice Retrieves the stream's end time, which is a Unix timestamp.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getEndTime(\\n uint256 streamId\\n ) external view returns (uint40 endTime);\\n\\n /// @notice Retrieves the stream's recipient.\\n /// @dev Reverts if the NFT has been burned.\\n /// @param streamId The stream ID for the query.\\n function getRecipient(\\n uint256 streamId\\n ) external view returns (address recipient);\\n\\n /// @notice Retrieves the amount refunded to the sender after a cancellation, denoted in units of the asset's\\n /// decimals. This amount is always zero unless the stream was canceled.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getRefundedAmount(\\n uint256 streamId\\n ) external view returns (uint128 refundedAmount);\\n\\n /// @notice Retrieves the stream's sender.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getSender(uint256 streamId) external view returns (address sender);\\n\\n /// @notice Retrieves the stream's start time, which is a Unix timestamp.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getStartTime(\\n uint256 streamId\\n ) external view returns (uint40 startTime);\\n\\n /// @notice Retrieves the amount withdrawn from the stream, denoted in units of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getWithdrawnAmount(\\n uint256 streamId\\n ) external view returns (uint128 withdrawnAmount);\\n\\n /// @notice Retrieves a flag indicating whether the provided address is a contract allowed to hook to Sablier\\n /// when a stream is canceled or when assets are withdrawn.\\n /// @dev See {ISablierLockupRecipient} for more information.\\n function isAllowedToHook(\\n address recipient\\n ) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream can be canceled. When the stream is cold, this\\n /// flag is always `false`.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isCancelable(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream is cold, i.e. settled, canceled, or depleted.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isCold(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream is depleted.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isDepleted(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream exists.\\n /// @dev Does not revert if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isStream(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream NFT can be transferred.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isTransferable(\\n uint256 streamId\\n ) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream is warm, i.e. either pending or streaming.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isWarm(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves the maximum broker fee that can be charged by the broker, denoted as a fixed-point\\n /// number where 1e18 is 100%.\\n /// @dev This value is hard coded as a constant.\\n function MAX_BROKER_FEE() external view returns (UD60x18);\\n\\n /// @notice Counter for stream IDs, used in the create functions.\\n function nextStreamId() external view returns (uint256);\\n\\n /// @notice Contract that generates the non-fungible token URI.\\n function nftDescriptor() external view returns (ISablierV2NFTDescriptor);\\n\\n /// @notice Calculates the amount that the sender would be refunded if the stream were canceled, denoted in units\\n /// of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function refundableAmountOf(\\n uint256 streamId\\n ) external view returns (uint128 refundableAmount);\\n\\n /// @notice Retrieves the stream's status.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function statusOf(\\n uint256 streamId\\n ) external view returns (Lockup.Status status);\\n\\n /// @notice Calculates the amount streamed to the recipient, denoted in units of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n ///\\n /// Notes:\\n /// - Upon cancellation of the stream, the amount streamed is calculated as the difference between the deposited\\n /// amount and the refunded amount. Ultimately, when the stream becomes depleted, the streamed amount is equivalent\\n /// to the total amount withdrawn.\\n ///\\n /// @param streamId The stream ID for the query.\\n function streamedAmountOf(\\n uint256 streamId\\n ) external view returns (uint128 streamedAmount);\\n\\n /// @notice Retrieves a flag indicating whether the stream was canceled.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function wasCanceled(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Calculates the amount that the recipient can withdraw from the stream, denoted in units of the asset's\\n /// decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function withdrawableAmountOf(\\n uint256 streamId\\n ) external view returns (uint128 withdrawableAmount);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n NON-CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Allows a recipient contract to hook to Sablier when a stream is canceled or when assets are withdrawn.\\n /// Useful for implementing contracts that hold streams on behalf of users, such as vaults or staking contracts.\\n ///\\n /// @dev Emits an {AllowToHook} event.\\n ///\\n /// Notes:\\n /// - Does not revert if the contract is already on the allowlist.\\n /// - This is an irreversible operation. The contract cannot be removed from the allowlist.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the contract admin.\\n /// - `recipient` must have a non-zero code size.\\n /// - `recipient` must implement {ISablierLockupRecipient}.\\n ///\\n /// @param recipient The address of the contract to allow for hooks.\\n function allowToHook(address recipient) external;\\n\\n /// @notice Burns the NFT associated with the stream.\\n ///\\n /// @dev Emits a {Transfer} event.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `streamId` must reference a depleted stream.\\n /// - The NFT must exist.\\n /// - `msg.sender` must be either the NFT owner or an approved third party.\\n ///\\n /// @param streamId The ID of the stream NFT to burn.\\n function burn(uint256 streamId) external;\\n\\n /// @notice Cancels the stream and refunds any remaining assets to the sender.\\n ///\\n /// @dev Emits a {Transfer}, {CancelLockupStream}, and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - If there any assets left for the recipient to withdraw, the stream is marked as canceled. Otherwise, the\\n /// stream is marked as depleted.\\n /// - This function attempts to invoke a hook on the recipient, if the resolved address is a contract.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - The stream must be warm and cancelable.\\n /// - `msg.sender` must be the stream's sender.\\n ///\\n /// @param streamId The ID of the stream to cancel.\\n function cancel(uint256 streamId) external;\\n\\n /// @notice Cancels multiple streams and refunds any remaining assets to the sender.\\n ///\\n /// @dev Emits multiple {Transfer}, {CancelLockupStream}, and {MetadataUpdate} events.\\n ///\\n /// Notes:\\n /// - Refer to the notes in {cancel}.\\n ///\\n /// Requirements:\\n /// - All requirements from {cancel} must be met for each stream.\\n ///\\n /// @param streamIds The IDs of the streams to cancel.\\n function cancelMultiple(uint256[] calldata streamIds) external;\\n\\n /// @notice Removes the right of the stream's sender to cancel the stream.\\n ///\\n /// @dev Emits a {RenounceLockupStream} and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - This is an irreversible operation.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `streamId` must reference a warm stream.\\n /// - `msg.sender` must be the stream's sender.\\n /// - The stream must be cancelable.\\n ///\\n /// @param streamId The ID of the stream to renounce.\\n function renounce(uint256 streamId) external;\\n\\n /// @notice Sets a new NFT descriptor contract, which produces the URI describing the Sablier stream NFTs.\\n ///\\n /// @dev Emits a {SetNFTDescriptor} and {BatchMetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - Does not revert if the NFT descriptor is the same.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the contract admin.\\n ///\\n /// @param newNFTDescriptor The address of the new NFT descriptor contract.\\n function setNFTDescriptor(\\n ISablierV2NFTDescriptor newNFTDescriptor\\n ) external;\\n\\n /// @notice Withdraws the provided amount of assets from the stream to the `to` address.\\n ///\\n /// @dev Emits a {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - This function attempts to call a hook on the recipient of the stream, unless `msg.sender` is the recipient.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `streamId` must not reference a null or depleted stream.\\n /// - `to` must not be the zero address.\\n /// - `amount` must be greater than zero and must not exceed the withdrawable amount.\\n /// - `to` must be the recipient if `msg.sender` is not the stream's recipient or an approved third party.\\n ///\\n /// @param streamId The ID of the stream to withdraw from.\\n /// @param to The address receiving the withdrawn assets.\\n /// @param amount The amount to withdraw, denoted in units of the asset's decimals.\\n function withdraw(uint256 streamId, address to, uint128 amount) external;\\n\\n /// @notice Withdraws the maximum withdrawable amount from the stream to the provided address `to`.\\n ///\\n /// @dev Emits a {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - Refer to the notes in {withdraw}.\\n ///\\n /// Requirements:\\n /// - Refer to the requirements in {withdraw}.\\n ///\\n /// @param streamId The ID of the stream to withdraw from.\\n /// @param to The address receiving the withdrawn assets.\\n /// @return withdrawnAmount The amount withdrawn, denoted in units of the asset's decimals.\\n function withdrawMax(\\n uint256 streamId,\\n address to\\n ) external returns (uint128 withdrawnAmount);\\n\\n /// @notice Withdraws the maximum withdrawable amount from the stream to the current recipient, and transfers the\\n /// NFT to `newRecipient`.\\n ///\\n /// @dev Emits a {WithdrawFromLockupStream} and a {Transfer} event.\\n ///\\n /// Notes:\\n /// - If the withdrawable amount is zero, the withdrawal is skipped.\\n /// - Refer to the notes in {withdraw}.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the stream's recipient.\\n /// - Refer to the requirements in {withdraw}.\\n /// - Refer to the requirements in {IERC721.transferFrom}.\\n ///\\n /// @param streamId The ID of the stream NFT to transfer.\\n /// @param newRecipient The address of the new owner of the stream NFT.\\n /// @return withdrawnAmount The amount withdrawn, denoted in units of the asset's decimals.\\n function withdrawMaxAndTransfer(\\n uint256 streamId,\\n address newRecipient\\n ) external returns (uint128 withdrawnAmount);\\n\\n /// @notice Withdraws assets from streams to the recipient of each stream.\\n ///\\n /// @dev Emits multiple {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} events.\\n ///\\n /// Notes:\\n /// - This function attempts to call a hook on the recipient of each stream, unless `msg.sender` is the recipient.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - There must be an equal number of `streamIds` and `amounts`.\\n /// - Each stream ID in the array must not reference a null or depleted stream.\\n /// - Each amount in the array must be greater than zero and must not exceed the withdrawable amount.\\n ///\\n /// @param streamIds The IDs of the streams to withdraw from.\\n /// @param amounts The amounts to withdraw, denoted in units of the asset's decimals.\\n function withdrawMultiple(\\n uint256[] calldata streamIds,\\n uint128[] calldata amounts\\n ) external;\\n}\\n\",\"keccak256\":\"0x3e5541c38a901637bd310965deb5bbde73ef07fe4ee3c752cbec330c6b9d62a3\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/ISablierV2LockupLinear.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\nimport {Lockup, LockupLinear} from \\\"./types/DataTypes.sol\\\";\\nimport {ISablierV2Lockup} from \\\"./ISablierV2Lockup.sol\\\";\\n\\n/// @title ISablierV2LockupLinear\\n/// @notice Creates and manages Lockup streams with a linear distribution function.\\ninterface ISablierV2LockupLinear is ISablierV2Lockup {\\n /*//////////////////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Emitted when a stream is created.\\n /// @param streamId The ID of the newly created stream.\\n /// @param funder The address which funded the stream.\\n /// @param sender The address distributing the assets, which will have the ability to cancel the stream.\\n /// @param recipient The address receiving the assets.\\n /// @param amounts Struct encapsulating (i) the deposit amount, and (ii) the broker fee amount, both denoted\\n /// in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Boolean indicating whether the stream will be cancelable or not.\\n /// @param transferable Boolean indicating whether the stream NFT is transferable or not.\\n /// @param timestamps Struct encapsulating (i) the stream's start time, (ii) cliff time, and (iii) end time, all as\\n /// Unix timestamps.\\n /// @param broker The address of the broker who has helped create the stream, e.g. a front-end website.\\n event CreateLockupLinearStream(\\n uint256 streamId,\\n address funder,\\n address indexed sender,\\n address indexed recipient,\\n Lockup.CreateAmounts amounts,\\n IERC20 indexed asset,\\n bool cancelable,\\n bool transferable,\\n LockupLinear.Timestamps timestamps,\\n address broker\\n );\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Retrieves the stream's cliff time, which is a Unix timestamp. A value of zero means there\\n /// is no cliff.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getCliffTime(\\n uint256 streamId\\n ) external view returns (uint40 cliffTime);\\n\\n /// @notice Retrieves the full stream details.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n /// @return stream See the documentation in {DataTypes}.\\n function getStream(\\n uint256 streamId\\n ) external view returns (LockupLinear.StreamLL memory stream);\\n\\n /// @notice Retrieves the stream's start, cliff and end timestamps.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n /// @return timestamps See the documentation in {DataTypes}.\\n function getTimestamps(\\n uint256 streamId\\n ) external view returns (LockupLinear.Timestamps memory timestamps);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n NON-CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Creates a stream by setting the start time to `block.timestamp`, and the end time to\\n /// the sum of `block.timestamp` and `params.durations.total`. The stream is funded by `msg.sender` and is wrapped\\n /// in an ERC-721 NFT.\\n ///\\n /// @dev Emits a {Transfer} and {CreateLockupLinearStream} event.\\n ///\\n /// Requirements:\\n /// - All requirements in {createWithTimestamps} must be met for the calculated parameters.\\n ///\\n /// @param params Struct encapsulating the function parameters, which are documented in {DataTypes}.\\n /// @return streamId The ID of the newly created stream.\\n function createWithDurations(\\n LockupLinear.CreateWithDurations calldata params\\n ) external returns (uint256 streamId);\\n\\n /// @notice Creates a stream with the provided start time and end time. The stream is funded by `msg.sender` and is\\n /// wrapped in an ERC-721 NFT.\\n ///\\n /// @dev Emits a {Transfer} and {CreateLockupLinearStream} event.\\n ///\\n /// Notes:\\n /// - A cliff time of zero means there is no cliff.\\n /// - As long as the times are ordered, it is not an error for the start or the cliff time to be in the past.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `params.totalAmount` must be greater than zero.\\n /// - If set, `params.broker.fee` must not be greater than `MAX_BROKER_FEE`.\\n /// - `params.timestamps.start` must be greater than zero and less than `params.timestamps.end`.\\n /// - If set, `params.timestamps.cliff` must be greater than `params.timestamps.start` and less than\\n /// `params.timestamps.end`.\\n /// - `params.timestamps.end` must be in the future.\\n /// - `params.recipient` must not be the zero address.\\n /// - `msg.sender` must have allowed this contract to spend at least `params.totalAmount` assets.\\n ///\\n /// @param params Struct encapsulating the function parameters, which are documented in {DataTypes}.\\n /// @return streamId The ID of the newly created stream.\\n function createWithTimestamps(\\n LockupLinear.CreateWithTimestamps calldata params\\n ) external returns (uint256 streamId);\\n}\\n\",\"keccak256\":\"0x064264723114b1f1cf3953fd79874dfcbb42cf313857aee6d5e6b09a23e0010b\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/ISablierV2NFTDescriptor.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC721Metadata} from \\\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\\\";\\n\\n/// @title ISablierV2NFTDescriptor\\n/// @notice This contract generates the URI describing the Sablier V2 stream NFTs.\\n/// @dev Inspired by Uniswap V3 Positions NFTs.\\ninterface ISablierV2NFTDescriptor {\\n /// @notice Produces the URI describing a particular stream NFT.\\n /// @dev This is a data URI with the JSON contents directly inlined.\\n /// @param sablier The address of the Sablier contract the stream was created in.\\n /// @param streamId The ID of the stream for which to produce a description.\\n /// @return uri The URI of the ERC721-compliant metadata.\\n function tokenURI(\\n IERC721Metadata sablier,\\n uint256 streamId\\n ) external view returns (string memory uri);\\n}\\n\",\"keccak256\":\"0x4ed430e553d14161e93efdaaacd1a502f49b38969c9d714b45d2e682a74fa0bc\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/types/DataTypes.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {UD2x18} from \\\"@prb/math/src/UD2x18.sol\\\";\\nimport {UD60x18} from \\\"@prb/math/src/UD60x18.sol\\\";\\n\\n// DataTypes.sol\\n//\\n// This file defines all structs used in V2 Core, most of which are organized under three namespaces:\\n//\\n// - Lockup\\n// - LockupDynamic\\n// - LockupLinear\\n// - LockupTranched\\n//\\n// You will notice that some structs contain \\\"slot\\\" annotations - they are used to indicate the\\n// storage layout of the struct. It is more gas efficient to group small data types together so\\n// that they fit in a single 32-byte slot.\\n\\n/// @notice Struct encapsulating the broker parameters passed to the create functions. Both can be set to zero.\\n/// @param account The address receiving the broker's fee.\\n/// @param fee The broker's percentage fee from the total amount, denoted as a fixed-point number where 1e18 is 100%.\\nstruct Broker {\\n address account;\\n UD60x18 fee;\\n}\\n\\n/// @notice Namespace for the structs used in both {SablierV2LockupLinear} and {SablierV2LockupDynamic}.\\nlibrary Lockup {\\n /// @notice Struct encapsulating the deposit, withdrawn, and refunded amounts, all denoted in units of the asset's\\n /// decimals.\\n /// @dev Because the deposited and the withdrawn amount are often read together, declaring them in the same slot\\n /// saves gas.\\n /// @param deposited The initial amount deposited in the stream, net of broker fee.\\n /// @param withdrawn The cumulative amount withdrawn from the stream.\\n /// @param refunded The amount refunded to the sender. Unless the stream was canceled, this is always zero.\\n struct Amounts {\\n // slot 0\\n uint128 deposited;\\n uint128 withdrawn;\\n // slot 1\\n uint128 refunded;\\n }\\n\\n /// @notice Struct encapsulating (i) the deposit amount and (ii) the broker fee amount, both denoted in units of the\\n /// asset's decimals.\\n /// @param deposit The amount to deposit in the stream.\\n /// @param brokerFee The broker fee amount.\\n struct CreateAmounts {\\n uint128 deposit;\\n uint128 brokerFee;\\n }\\n\\n /// @notice Enum representing the different statuses of a stream.\\n /// @custom:value0 PENDING Stream created but not started; assets are in a pending state.\\n /// @custom:value1 STREAMING Active stream where assets are currently being streamed.\\n /// @custom:value2 SETTLED All assets have been streamed; recipient is due to withdraw them.\\n /// @custom:value3 CANCELED Canceled stream; remaining assets await recipient's withdrawal.\\n /// @custom:value4 DEPLETED Depleted stream; all assets have been withdrawn and/or refunded.\\n enum Status {\\n PENDING,\\n STREAMING,\\n SETTLED,\\n CANCELED,\\n DEPLETED\\n }\\n\\n /// @notice A common data structure to be stored in all {SablierV2Lockup} models.\\n /// @dev The fields are arranged like this to save gas via tight variable packing.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream.\\n /// @param startTime The Unix timestamp indicating the stream's start.\\n /// @param endTime The Unix timestamp indicating the stream's end.\\n /// @param isCancelable Boolean indicating if the stream is cancelable.\\n /// @param wasCanceled Boolean indicating if the stream was canceled.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param isDepleted Boolean indicating if the stream is depleted.\\n /// @param isStream Boolean indicating if the struct entity exists.\\n /// @param isTransferable Boolean indicating if the stream NFT is transferable.\\n /// @param amounts Struct encapsulating the deposit, withdrawn, and refunded amounts, all denoted in units of the\\n /// asset's decimals.\\n struct Stream {\\n // slot 0\\n address sender;\\n uint40 startTime;\\n uint40 endTime;\\n bool isCancelable;\\n bool wasCanceled;\\n // slot 1\\n IERC20 asset;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n // slot 2 and 3\\n Lockup.Amounts amounts;\\n }\\n}\\n\\n/// @notice Namespace for the structs used in {SablierV2LockupDynamic}.\\nlibrary LockupDynamic {\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupDynamic.createWithDurations} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param segments Segments with durations used to compose the dynamic distribution function. Timestamps are\\n /// calculated by starting from `block.timestamp` and adding each duration to the previous timestamp.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithDurations {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n SegmentWithDuration[] segments;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupDynamic.createWithTimestamps} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param startTime The Unix timestamp indicating the stream's start.\\n /// @param segments Segments used to compose the dynamic distribution function.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithTimestamps {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n uint40 startTime;\\n Segment[] segments;\\n Broker broker;\\n }\\n\\n /// @notice Segment struct used in the Lockup Dynamic stream.\\n /// @param amount The amount of assets to be streamed in the segment, denoted in units of the asset's decimals.\\n /// @param exponent The exponent of the segment, denoted as a fixed-point number.\\n /// @param timestamp The Unix timestamp indicating the segment's end.\\n struct Segment {\\n // slot 0\\n uint128 amount;\\n UD2x18 exponent;\\n uint40 timestamp;\\n }\\n\\n /// @notice Segment struct used at runtime in {SablierV2LockupDynamic.createWithDurations}.\\n /// @param amount The amount of assets to be streamed in the segment, denoted in units of the asset's decimals.\\n /// @param exponent The exponent of the segment, denoted as a fixed-point number.\\n /// @param duration The time difference in seconds between the segment and the previous one.\\n struct SegmentWithDuration {\\n uint128 amount;\\n UD2x18 exponent;\\n uint40 duration;\\n }\\n\\n /// @notice Struct encapsulating the full details of a stream.\\n /// @dev Extends `Lockup.Stream` by including the recipient and the segments.\\n struct StreamLD {\\n address sender;\\n address recipient;\\n uint40 startTime;\\n uint40 endTime;\\n bool isCancelable;\\n bool wasCanceled;\\n IERC20 asset;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n Lockup.Amounts amounts;\\n Segment[] segments;\\n }\\n\\n /// @notice Struct encapsulating the LockupDynamic timestamps.\\n /// @param start The Unix timestamp indicating the stream's start.\\n /// @param end The Unix timestamp indicating the stream's end.\\n struct Timestamps {\\n uint40 start;\\n uint40 end;\\n }\\n}\\n\\n/// @notice Namespace for the structs used in {SablierV2LockupLinear}.\\nlibrary LockupLinear {\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupLinear.createWithDurations} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param durations Struct encapsulating (i) cliff period duration and (ii) total stream duration, both in seconds.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithDurations {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n Durations durations;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupLinear.createWithTimestamps} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param timestamps Struct encapsulating (i) the stream's start time, (ii) cliff time, and (iii) end time, all as\\n /// Unix timestamps.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithTimestamps {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n Timestamps timestamps;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the cliff duration and the total duration.\\n /// @param cliff The cliff duration in seconds.\\n /// @param total The total duration in seconds.\\n struct Durations {\\n uint40 cliff;\\n uint40 total;\\n }\\n\\n /// @notice Struct encapsulating the full details of a stream.\\n /// @dev Extends `Lockup.Stream` by including the recipient and the cliff time.\\n struct StreamLL {\\n address sender;\\n address recipient;\\n uint40 startTime;\\n bool isCancelable;\\n bool wasCanceled;\\n IERC20 asset;\\n uint40 endTime;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n Lockup.Amounts amounts;\\n uint40 cliffTime;\\n }\\n\\n /// @notice Struct encapsulating the LockupLinear timestamps.\\n /// @param start The Unix timestamp for the stream's start.\\n /// @param cliff The Unix timestamp for the cliff period's end. A value of zero means there is no cliff.\\n /// @param end The Unix timestamp for the stream's end.\\n struct Timestamps {\\n uint40 start;\\n uint40 cliff;\\n uint40 end;\\n }\\n}\\n\\n/// @notice Namespace for the structs used in {SablierV2LockupTranched}.\\nlibrary LockupTranched {\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupTranched.createWithDurations} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param tranches Tranches with durations used to compose the tranched distribution function. Timestamps are\\n /// calculated by starting from `block.timestamp` and adding each duration to the previous timestamp.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithDurations {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n TrancheWithDuration[] tranches;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupTranched.createWithTimestamps} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param startTime The Unix timestamp indicating the stream's start.\\n /// @param tranches Tranches used to compose the tranched distribution function.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithTimestamps {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n uint40 startTime;\\n Tranche[] tranches;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the full details of a stream.\\n /// @dev Extends `Lockup.Stream` by including the recipient and the tranches.\\n struct StreamLT {\\n address sender;\\n address recipient;\\n uint40 startTime;\\n uint40 endTime;\\n bool isCancelable;\\n bool wasCanceled;\\n IERC20 asset;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n Lockup.Amounts amounts;\\n Tranche[] tranches;\\n }\\n\\n /// @notice Struct encapsulating the LockupTranched timestamps.\\n /// @param start The Unix timestamp indicating the stream's start.\\n /// @param end The Unix timestamp indicating the stream's end.\\n struct Timestamps {\\n uint40 start;\\n uint40 end;\\n }\\n\\n /// @notice Tranche struct used in the Lockup Tranched stream.\\n /// @param amount The amount of assets to be unlocked in the tranche, denoted in units of the asset's decimals.\\n /// @param timestamp The Unix timestamp indicating the tranche's end.\\n struct Tranche {\\n // slot 0\\n uint128 amount;\\n uint40 timestamp;\\n }\\n\\n /// @notice Tranche struct used at runtime in {SablierV2LockupTranched.createWithDurations}.\\n /// @param amount The amount of assets to be unlocked in the tranche, denoted in units of the asset's decimals.\\n /// @param duration The time difference in seconds between the tranche and the previous one.\\n struct TrancheWithDuration {\\n uint128 amount;\\n uint40 duration;\\n }\\n}\\n\",\"keccak256\":\"0x727722c0ec71a76a947b935c9dfcac8fd846d6c3547dfbc8739c7109f3b95068\",\"license\":\"GPL-3.0-or-later\"},\"contracts/modules/DecentHatsCreationModule.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.28;\\n\\nimport {Enum} from \\\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\\\";\\nimport {IAvatar} from \\\"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol\\\";\\nimport {Strings} from \\\"@openzeppelin/contracts/utils/Strings.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IERC6551Registry} from \\\"../interfaces/IERC6551Registry.sol\\\";\\nimport {IHats} from \\\"../interfaces/hats/IHats.sol\\\";\\nimport {LockupLinear, Broker} from \\\"../interfaces/sablier/types/DataTypes.sol\\\";\\nimport {IHatsModuleFactory} from \\\"../interfaces/hats/IHatsModuleFactory.sol\\\";\\nimport {IHatsElectionsEligibility} from \\\"../interfaces/hats/modules/IHatsElectionsEligibility.sol\\\";\\nimport {ModuleProxyFactory} from \\\"@gnosis.pm/zodiac/contracts/factory/ModuleProxyFactory.sol\\\";\\nimport {ISablierV2LockupLinear} from \\\"../interfaces/sablier/ISablierV2LockupLinear.sol\\\";\\nimport {DecentHatsModuleUtils} from \\\"./DecentHatsModuleUtils.sol\\\";\\n\\ncontract DecentHatsCreationModule is DecentHatsModuleUtils {\\n struct TopHatParams {\\n string details;\\n string imageURI;\\n }\\n\\n struct AdminHatParams {\\n string details;\\n string imageURI;\\n bool isMutable;\\n }\\n\\n struct CreateTreeParams {\\n IHats hatsProtocol;\\n IERC6551Registry erc6551Registry;\\n IHatsModuleFactory hatsModuleFactory;\\n ModuleProxyFactory moduleProxyFactory;\\n address keyValuePairs;\\n address decentAutonomousAdminImplementation;\\n address hatsAccountImplementation;\\n address hatsElectionsEligibilityImplementation;\\n TopHatParams topHat;\\n AdminHatParams adminHat;\\n HatParams[] hats;\\n }\\n\\n /* /////////////////////////////////////////////////////////////////////////////\\n EXTERNAL FUNCTIONS\\n ///////////////////////////////////////////////////////////////////////////// */\\n /**\\n * @notice For a safe without any roles previously created on it, this function should be called. It sets up the\\n * top hat and admin hat, as well as any other hats and their streams that are provided, then transfers the top hat\\n * to the calling safe.\\n *\\n * @notice This contract should be enabled a module on the Safe for which the role(s) are to be created, and disabled after.\\n *\\n * @dev For each hat that is included, if the hat is:\\n * - termed, its stream funds on are targeted directly at the nominated wearer. The wearer should directly call `withdraw-`\\n * on the Sablier contract.\\n * - untermed, its stream funds are targeted at the hat's smart account. In order to withdraw funds from the stream, the\\n * hat's smart account must be the one call to `withdraw-` on the Sablier contract, setting the recipient arg to its wearer.\\n *\\n * @dev In order for a Safe to seamlessly create roles even if it has never previously created a role and thus has\\n * no hat tree, we defer the creation of the hat tree and its setup to this contract. This way, in a single tx block,\\n * the resulting topHatId of the newly created hat can be used to create an admin hat and any other hats needed.\\n * We also make use of `KeyValuePairs` to associate the topHatId with the Safe.\\n *\\n * @param treeParams The parameters for creating the Hat Tree with Roles\\n */\\n function createAndDeclareTree(\\n CreateTreeParams calldata treeParams\\n ) external {\\n // Create Top Hat\\n (uint256 topHatId, address topHatAccount) = _processTopHat(\\n treeParams.hatsProtocol,\\n treeParams.erc6551Registry,\\n treeParams.hatsAccountImplementation,\\n treeParams.keyValuePairs,\\n treeParams.topHat\\n );\\n\\n // Create Admin Hat\\n uint256 adminHatId = _processAdminHat(\\n treeParams.hatsProtocol,\\n treeParams.erc6551Registry,\\n treeParams.hatsAccountImplementation,\\n topHatId,\\n topHatAccount,\\n treeParams.moduleProxyFactory,\\n treeParams.decentAutonomousAdminImplementation,\\n treeParams.adminHat\\n );\\n\\n // Create Role Hats\\n _processRoleHats(\\n CreateRoleHatsParams({\\n hatsProtocol: treeParams.hatsProtocol,\\n erc6551Registry: treeParams.erc6551Registry,\\n hatsAccountImplementation: treeParams.hatsAccountImplementation,\\n topHatId: topHatId,\\n topHatAccount: topHatAccount,\\n hatsModuleFactory: treeParams.hatsModuleFactory,\\n hatsElectionsEligibilityImplementation: treeParams\\n .hatsElectionsEligibilityImplementation,\\n adminHatId: adminHatId,\\n hats: treeParams.hats,\\n keyValuePairs: treeParams.keyValuePairs\\n })\\n );\\n }\\n\\n /* /////////////////////////////////////////////////////////////////////////////\\n INTERNAL FUNCTIONS\\n ///////////////////////////////////////////////////////////////////////////// */\\n\\n function _processTopHat(\\n IHats hatsProtocol,\\n IERC6551Registry erc6551Registry,\\n address hatsAccountImplementation,\\n address keyValuePairs,\\n TopHatParams calldata topHat\\n ) internal returns (uint256 topHatId, address topHatAccount) {\\n // Call lastTopHatId() and properly decode the response\\n (bool success, bytes memory data) = address(hatsProtocol).call(\\n abi.encodeWithSignature(\\\"lastTopHatId()\\\")\\n );\\n require(success, \\\"Failed to get lastTopHatId\\\");\\n topHatId = (abi.decode(data, (uint256)) + 1) << 224;\\n\\n // Mint Top Hat to the Safe\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"mintTopHat(address,string,string)\\\",\\n msg.sender,\\n topHat.details,\\n topHat.imageURI\\n ),\\n Enum.Operation.Call\\n );\\n\\n // Create Top Hat's ERC6551 Account\\n topHatAccount = erc6551Registry.createAccount(\\n hatsAccountImplementation,\\n SALT,\\n block.chainid,\\n address(hatsProtocol),\\n topHatId\\n );\\n\\n // Declare Top Hat ID to Safe via KeyValuePairs\\n string[] memory keys = new string[](1);\\n string[] memory values = new string[](1);\\n keys[0] = \\\"topHatId\\\";\\n values[0] = Strings.toString(topHatId);\\n IAvatar(msg.sender).execTransactionFromModule(\\n keyValuePairs,\\n 0,\\n abi.encodeWithSignature(\\n \\\"updateValues(string[],string[])\\\",\\n keys,\\n values\\n ),\\n Enum.Operation.Call\\n );\\n }\\n\\n function _processAdminHat(\\n IHats hatsProtocol,\\n IERC6551Registry erc6551Registry,\\n address hatsAccountImplementation,\\n uint256 topHatId,\\n address topHatAccount,\\n ModuleProxyFactory moduleProxyFactory,\\n address decentAutonomousAdminImplementation,\\n AdminHatParams calldata adminHat\\n ) internal returns (uint256 adminHatId) {\\n // Create Admin Hat\\n adminHatId = hatsProtocol.getNextId(topHatId);\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"createHat(uint256,string,uint32,address,address,bool,string)\\\",\\n topHatId,\\n adminHat.details,\\n 1, // only one Admin Hat\\n topHatAccount,\\n topHatAccount,\\n adminHat.isMutable,\\n adminHat.imageURI\\n ),\\n Enum.Operation.Call\\n );\\n\\n // Create Admin Hat's ERC6551 Account\\n erc6551Registry.createAccount(\\n hatsAccountImplementation,\\n SALT,\\n block.chainid,\\n address(hatsProtocol),\\n adminHatId\\n );\\n\\n // Deploy Decent Autonomous Admin Module, which will wear the Admin Hat\\n address autonomousAdmin = moduleProxyFactory.deployModule(\\n decentAutonomousAdminImplementation,\\n abi.encodeWithSignature(\\\"setUp(bytes)\\\", bytes(\\\"\\\")),\\n uint256(\\n keccak256(\\n abi.encodePacked(\\n // for the salt, we'll concatenate our static salt\\n // with the Admin Hat ID\\n SALT,\\n adminHatId\\n )\\n )\\n )\\n );\\n\\n // Mint Hat to the Decent Autonomous Admin Module\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"mintHat(uint256,address)\\\",\\n adminHatId,\\n autonomousAdmin\\n ),\\n Enum.Operation.Call\\n );\\n }\\n}\\n\",\"keccak256\":\"0x5c95f7e83ded3c184dddd6b769791c92a68794eeb49deaccec4422497935c7c2\",\"license\":\"MIT\"},\"contracts/modules/DecentHatsModuleUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.28;\\n\\nimport {Enum} from \\\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\\\";\\nimport {IAvatar} from \\\"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IERC6551Registry} from \\\"../interfaces/IERC6551Registry.sol\\\";\\nimport {IHats} from \\\"../interfaces/hats/IHats.sol\\\";\\nimport {LockupLinear, Broker} from \\\"../interfaces/sablier/types/DataTypes.sol\\\";\\nimport {IHatsModuleFactory} from \\\"../interfaces/hats/IHatsModuleFactory.sol\\\";\\nimport {ISablierV2LockupLinear} from \\\"../interfaces/sablier/ISablierV2LockupLinear.sol\\\";\\nimport {Strings} from \\\"@openzeppelin/contracts/utils/Strings.sol\\\";\\n\\nabstract contract DecentHatsModuleUtils {\\n bytes32 public constant SALT =\\n 0x5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b5072;\\n\\n struct SablierStreamParams {\\n ISablierV2LockupLinear sablier;\\n address sender;\\n address asset;\\n LockupLinear.Timestamps timestamps;\\n Broker broker;\\n uint128 totalAmount;\\n bool cancelable;\\n bool transferable;\\n }\\n\\n struct HatParams {\\n address wearer;\\n string details;\\n string imageURI;\\n SablierStreamParams[] sablierStreamsParams;\\n uint128 termEndDateTs; // If 0, this is an untermed Hat\\n uint32 maxSupply;\\n bool isMutable;\\n }\\n\\n struct CreateRoleHatsParams {\\n IHats hatsProtocol;\\n IERC6551Registry erc6551Registry;\\n address hatsAccountImplementation;\\n uint256 topHatId;\\n address topHatAccount;\\n address keyValuePairs;\\n IHatsModuleFactory hatsModuleFactory;\\n address hatsElectionsEligibilityImplementation;\\n uint256 adminHatId;\\n HatParams[] hats;\\n }\\n\\n function _processRoleHats(\\n CreateRoleHatsParams memory roleHatsParams\\n ) internal {\\n for (uint256 i = 0; i < roleHatsParams.hats.length; ) {\\n HatParams memory hatParams = roleHatsParams.hats[i];\\n\\n // Create eligibility module if needed\\n address eligibilityAddress = _createEligibilityModule(\\n roleHatsParams.hatsProtocol,\\n roleHatsParams.hatsModuleFactory,\\n roleHatsParams.hatsElectionsEligibilityImplementation,\\n roleHatsParams.topHatId,\\n roleHatsParams.topHatAccount,\\n roleHatsParams.adminHatId,\\n hatParams.termEndDateTs\\n );\\n\\n // Create and Mint the Role Hat\\n uint256 hatId = _createAndMintHat(\\n roleHatsParams.hatsProtocol,\\n roleHatsParams.adminHatId,\\n hatParams,\\n eligibilityAddress,\\n roleHatsParams.topHatAccount\\n );\\n\\n // Get the stream recipient (based on termed or not)\\n address streamRecipient = _setupStreamRecipient(\\n roleHatsParams.erc6551Registry,\\n roleHatsParams.hatsAccountImplementation,\\n address(roleHatsParams.hatsProtocol),\\n hatParams.termEndDateTs,\\n hatParams.wearer,\\n hatId\\n );\\n\\n // Create streams\\n _processSablierStreams(\\n hatParams.sablierStreamsParams,\\n streamRecipient,\\n roleHatsParams.keyValuePairs,\\n hatId\\n );\\n\\n unchecked {\\n ++i;\\n }\\n }\\n }\\n\\n function _createEligibilityModule(\\n IHats hatsProtocol,\\n IHatsModuleFactory hatsModuleFactory,\\n address hatsElectionsEligibilityImplementation,\\n uint256 topHatId,\\n address topHatAccount,\\n uint256 adminHatId,\\n uint128 termEndDateTs\\n ) private returns (address) {\\n // If the Hat is termed, create the eligibility module\\n if (termEndDateTs != 0) {\\n return\\n hatsModuleFactory.createHatsModule(\\n hatsElectionsEligibilityImplementation,\\n hatsProtocol.getNextId(adminHatId),\\n abi.encode(topHatId, uint256(0)), // [BALLOT_BOX_ID, ADMIN_HAT_ID]\\n abi.encode(termEndDateTs),\\n uint256(SALT)\\n );\\n }\\n\\n // Otherwise, return the Top Hat account\\n return topHatAccount;\\n }\\n\\n function _createAndMintHat(\\n IHats hatsProtocol,\\n uint256 adminHatId,\\n HatParams memory hat,\\n address eligibilityAddress,\\n address topHatAccount\\n ) private returns (uint256) {\\n // Grab the next Hat ID (before creating it)\\n uint256 hatId = hatsProtocol.getNextId(adminHatId);\\n\\n // Create the new Hat\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"createHat(uint256,string,uint32,address,address,bool,string)\\\",\\n adminHatId,\\n hat.details,\\n hat.maxSupply,\\n eligibilityAddress,\\n topHatAccount,\\n hat.isMutable,\\n hat.imageURI\\n ),\\n Enum.Operation.Call\\n );\\n\\n // If the Hat is termed, nominate the wearer as the eligible member\\n if (hat.termEndDateTs != 0) {\\n address[] memory nominatedWearers = new address[](1);\\n nominatedWearers[0] = hat.wearer;\\n\\n IAvatar(msg.sender).execTransactionFromModule(\\n eligibilityAddress,\\n 0,\\n abi.encodeWithSignature(\\n \\\"elect(uint128,address[])\\\",\\n hat.termEndDateTs,\\n nominatedWearers\\n ),\\n Enum.Operation.Call\\n );\\n }\\n\\n // Mint the Hat\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"mintHat(uint256,address)\\\",\\n hatId,\\n hat.wearer\\n ),\\n Enum.Operation.Call\\n );\\n return hatId;\\n }\\n\\n // Exists to avoid stack too deep errors\\n function _setupStreamRecipient(\\n IERC6551Registry erc6551Registry,\\n address hatsAccountImplementation,\\n address hatsProtocol,\\n uint128 termEndDateTs,\\n address wearer,\\n uint256 hatId\\n ) private returns (address) {\\n // If the hat is termed, the wearer is the stream recipient\\n if (termEndDateTs != 0) {\\n return wearer;\\n }\\n\\n // Otherwise, the Hat's smart account is the stream recipient\\n return\\n erc6551Registry.createAccount(\\n hatsAccountImplementation,\\n SALT,\\n block.chainid,\\n hatsProtocol,\\n hatId\\n );\\n }\\n\\n function _processSablierStreams(\\n SablierStreamParams[] memory streamParams,\\n address streamRecipient,\\n address keyValuePairs,\\n uint256 hatId\\n ) private {\\n for (uint256 i = 0; i < streamParams.length; ) {\\n SablierStreamParams memory sablierStreamParams = streamParams[i];\\n\\n // Approve tokens for Sablier\\n IAvatar(msg.sender).execTransactionFromModule(\\n sablierStreamParams.asset,\\n 0,\\n abi.encodeWithSignature(\\n \\\"approve(address,uint256)\\\",\\n sablierStreamParams.sablier,\\n sablierStreamParams.totalAmount\\n ),\\n Enum.Operation.Call\\n );\\n uint256 streamId = ISablierV2LockupLinear(\\n sablierStreamParams.sablier\\n ).nextStreamId();\\n\\n // Proxy the Sablier call through IAvatar\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(sablierStreamParams.sablier),\\n 0,\\n abi.encodeWithSignature(\\n \\\"createWithTimestamps((address,address,uint128,address,bool,bool,(uint40,uint40,uint40),(address,uint256)))\\\",\\n LockupLinear.CreateWithTimestamps({\\n sender: sablierStreamParams.sender,\\n recipient: streamRecipient,\\n totalAmount: sablierStreamParams.totalAmount,\\n asset: IERC20(sablierStreamParams.asset),\\n cancelable: sablierStreamParams.cancelable,\\n transferable: sablierStreamParams.transferable,\\n timestamps: sablierStreamParams.timestamps,\\n broker: sablierStreamParams.broker\\n })\\n ),\\n Enum.Operation.Call\\n );\\n\\n // Update KeyValuePairs with the stream ID and Hat ID\\n string[] memory keys = new string[](1);\\n string[] memory values = new string[](1);\\n keys[0] = \\\"hatIdToStreamId\\\";\\n values[0] = string(\\n abi.encodePacked(\\n Strings.toString(hatId),\\n \\\":\\\",\\n Strings.toString(streamId)\\n )\\n );\\n\\n IAvatar(msg.sender).execTransactionFromModule(\\n keyValuePairs,\\n 0,\\n abi.encodeWithSignature(\\n \\\"updateValues(string[],string[])\\\",\\n keys,\\n values\\n ),\\n Enum.Operation.Call\\n );\\n\\n unchecked {\\n ++i;\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xcf91d6de2291dd71d2491292ee2d1120c444b8f4f11b8c31429ed4c630013e69\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052348015600f57600080fd5b5061212e8061001f6000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c8063ba9a91a51461003b578063d58041b714610062575b600080fd5b6100506000805160206120d983398151915281565b60405190815260200160405180910390f35b610075610070366004611539565b610077565b005b6000806100cd61008a6020850185611593565b61009a6040860160208701611593565b6100aa60e0870160c08801611593565b6100ba60a0880160808901611593565b6100c86101008901896115c0565b61023d565b909250905060006101396100e46020860186611593565b6100f46040870160208801611593565b61010460e0880160c08901611593565b868661011660808b0160608c01611593565b61012660c08c0160a08d01611593565b6101346101208d018d6115e0565b610619565b604080516101408101909152909150610237908061015a6020880188611593565b6001600160a01b0316815260200186602001602081019061017b9190611593565b6001600160a01b0316815260200161019960e0880160c08901611593565b6001600160a01b03908116825260208201879052851660408201526060016101c760a0880160808901611593565b6001600160a01b031681526020016101e56060880160408901611593565b6001600160a01b03168152602001610204610100880160e08901611593565b6001600160a01b03168152602081018490526040016102276101408801886115f6565b61023091611997565b90526109b5565b50505050565b60408051600481526024810182526020810180516001600160e01b0316633f0f816960e21b17905290516000918291829182916001600160a01b038b169161028491611af9565b6000604051808303816000865af19150503d80600081146102c1576040519150601f19603f3d011682016040523d82523d6000602084013e6102c6565b606091505b50915091508161031c5760405162461bcd60e51b815260206004820152601a60248201527f4661696c656420746f20676574206c617374546f704861744964000000000000604482015260640160405180910390fd5b60e0818060200190518101906103329190611b0b565b61033d906001611b3a565b901b93503363468721a78a6000836103558a80611b53565b61036260208d018d611b53565b604051602401610376959493929190611bc2565b60408051601f198184030181529181526020820180516001600160e01b0316631a64dfad60e01b1790525160e085901b6001600160e01b03191681526103c493929190600090600401611c32565b6020604051808303816000875af11580156103e3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104079190611c88565b50604051638a54c52f60e01b81526001600160a01b03891690638a54c52f9061044a908a906000805160206120d98339815191529046908f908b90600401611ca5565b6020604051808303816000875af1158015610469573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061048d9190611cd8565b60408051600180825281830190925291945060009190816020015b60608152602001906001900390816104a857505060408051600180825281830190925291925060009190602082015b60608152602001906001900390816104d7579050509050604051806040016040528060088152602001671d1bdc12185d125960c21b8152508260008151811061052257610522611cf5565b602002602001018190525061053686610a84565b8160008151811061054957610549611cf5565b6020026020010181905250336001600160a01b031663468721a78960008585604051602401610579929190611d67565b60408051601f198184030181529181526020820180516001600160e01b031663579374b960e11b1790525160e085901b6001600160e01b03191681526105c793929190600090600401611c32565b6020604051808303816000875af11580156105e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061060a9190611c88565b50505050509550959350505050565b60405162460ea360e61b8152600481018690526000906001600160a01b038a1690631183a8c090602401602060405180830381865afa158015610660573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106849190611b0b565b90503363468721a78a60008961069a8780611b53565b60018c806106ae60608d0160408e01611d95565b6106bb60208e018e611b53565b6040516024016106d399989796959493929190611db2565b60408051601f198184030181529181526020820180516001600160e01b0316635829492f60e11b1790525160e085901b6001600160e01b031916815261072193929190600090600401611c32565b6020604051808303816000875af1158015610740573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107649190611c88565b50604051638a54c52f60e01b81526001600160a01b03891690638a54c52f906107a7908a906000805160206120d98339815191529046908f908890600401611ca5565b6020604051808303816000875af11580156107c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ea9190611cd8565b506000846001600160a01b031663f1ab873c856040518060200160405280600081525060405160240161081d9190611e17565b60408051601f19818403018152918152602080830180516001600160e01b031663a4f9edbf60e01b179052905161086f916000805160206120d983398151915291899101918252602082015260400190565b60408051601f198184030181529082905280516020909101206001600160e01b031960e086901b1682526108a7939291600401611e2a565b6020604051808303816000875af11580156108c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108ea9190611cd8565b604051602481018490526001600160a01b0382166044820152909150339063468721a7908c9060009060640160408051601f198184030181529181526020820180516001600160e01b031663320fbbb760e11b1790525160e085901b6001600160e01b031916815261096493929190600090600401611c32565b6020604051808303816000875af1158015610983573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109a79190611c88565b505098975050505050505050565b60005b81610120015151811015610a8057600082610120015182815181106109df576109df611cf5565b602002602001015190506000610a1784600001518560c001518660e00151876060015188608001518961010001518860800151610b8c565b90506000610a35856000015186610100015185858960800151610cf3565b90506000610a5b8660200151876040015188600001518760800151886000015187611025565b9050610a718460600151828860a00151856110cf565b846001019450505050506109b8565b5050565b606081600003610aab5750506040805180820190915260018152600360fc1b602082015290565b8160005b8115610ad55780610abf81611e5e565b9150610ace9050600a83611e8d565b9150610aaf565b6000816001600160401b03811115610aef57610aef611646565b6040519080825280601f01601f191660200182016040528015610b19576020820181803683370190505b5090505b8415610b8457610b2e600183611ea1565b9150610b3b600a86611eb4565b610b46906030611b3a565b60f81b818381518110610b5b57610b5b611cf5565b60200101906001600160f81b031916908160001a905350610b7d600a86611e8d565b9450610b1d565b949350505050565b60006001600160801b03821615610ce557866001600160a01b0316632f7fb7b6878a6001600160a01b0316631183a8c0876040518263ffffffff1660e01b8152600401610bdb91815260200190565b602060405180830381865afa158015610bf8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c1c9190611b0b565b886000604051602001610c39929190918252602082015260400190565b60408051601f198184030181528282526001600160801b0389166020840152910160408051601f19818403018152908290526001600160e01b031960e087901b168252610c9b949392916000805160206120d983398151915290600401611ec8565b6020604051808303816000875af1158015610cba573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cde9190611cd8565b9050610ce8565b50825b979650505050505050565b60405162460ea360e61b81526004810185905260009081906001600160a01b03881690631183a8c090602401602060405180830381865afa158015610d3c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d609190611b0b565b9050336001600160a01b031663468721a78860008989602001518a60a001518a8a8d60c001518e60400151604051602401610da19796959493929190611f14565b60408051601f198184030181529181526020820180516001600160e01b0316635829492f60e11b1790525160e085901b6001600160e01b0319168152610def93929190600090600401611c32565b6020604051808303816000875af1158015610e0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e329190611c88565b5060808501516001600160801b031615610f5d5760408051600180825281830190925260009160208083019080368337019050509050856000015181600081518110610e8057610e80611cf5565b60200260200101906001600160a01b031690816001600160a01b031681525050336001600160a01b031663468721a7866000896080015185604051602401610ec9929190611f78565b60408051601f198184030181529181526020820180516001600160e01b0316634a231cef60e01b1790525160e085901b6001600160e01b0319168152610f1793929190600090600401611c32565b6020604051808303816000875af1158015610f36573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f5a9190611c88565b50505b8451604051602481018390526001600160a01b039091166044820152339063468721a790899060009060640160408051601f198184030181529181526020820180516001600160e01b031663320fbbb760e11b1790525160e085901b6001600160e01b0319168152610fd793929190600090600401611c32565b6020604051808303816000875af1158015610ff6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061101a9190611c88565b509695505050505050565b60006001600160801b0384161561103d5750816110c5565b604051638a54c52f60e01b81526001600160a01b03881690638a54c52f9061107f9089906000805160206120d98339815191529046908b908990600401611ca5565b6020604051808303816000875af115801561109e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110c29190611cd8565b90505b9695505050505050565b60005b84518110156115325760008582815181106110ef576110ef611cf5565b60200260200101519050336001600160a01b031663468721a78260400151600084600001518560a001516040516024016111479291906001600160a01b039290921682526001600160801b0316602082015260400190565b60408051601f198184030181529181526020820180516001600160e01b031663095ea7b360e01b1790525160e085901b6001600160e01b031916815261119593929190600090600401611c32565b6020604051808303816000875af11580156111b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111d89190611c88565b50600081600001516001600160a01b0316631e99d5696040518163ffffffff1660e01b8152600401602060405180830381865afa15801561121d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112419190611b0b565b9050336001600160a01b031663468721a78360000151600060405180610100016040528087602001516001600160a01b031681526020018b6001600160a01b031681526020018760a001516001600160801b0316815260200187604001516001600160a01b031681526020018760c00151151581526020018760e00151151581526020018760600151815260200187608001518152506040516024016112e79190611fcd565b60408051601f198184030181529181526020820180516001600160e01b03166353b1572760e01b1790525160e085901b6001600160e01b031916815261133593929190600090600401611c32565b6020604051808303816000875af1158015611354573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113789190611c88565b50604080516001808252818301909252600091816020015b606081526020019060019003908161139057505060408051600180825281830190925291925060009190602082015b60608152602001906001900390816113bf5790505090506040518060400160405280600f81526020016e1a185d1259151bd4dd1c99585b5259608a1b8152508260008151811061141157611411611cf5565b602002602001018190525061142586610a84565b61142e84610a84565b60405160200161143f92919061209c565b6040516020818303038152906040528160008151811061146157611461611cf5565b6020026020010181905250336001600160a01b031663468721a78860008585604051602401611491929190611d67565b60408051601f198184030181529181526020820180516001600160e01b031663579374b960e11b1790525160e085901b6001600160e01b03191681526114df93929190600090600401611c32565b6020604051808303816000875af11580156114fe573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115229190611c88565b50846001019450505050506110d2565b5050505050565b60006020828403121561154b57600080fd5b81356001600160401b0381111561156157600080fd5b8201610160818503121561157457600080fd5b9392505050565b6001600160a01b038116811461159057600080fd5b50565b6000602082840312156115a557600080fd5b81356115748161157b565b80356115bb8161157b565b919050565b60008235603e198336030181126115d657600080fd5b9190910192915050565b60008235605e198336030181126115d657600080fd5b6000808335601e1984360301811261160d57600080fd5b8301803591506001600160401b0382111561162757600080fd5b6020019150600581901b360382131561163f57600080fd5b9250929050565b634e487b7160e01b600052604160045260246000fd5b60405161010081016001600160401b038111828210171561167f5761167f611646565b60405290565b60405160e081016001600160401b038111828210171561167f5761167f611646565b604051601f8201601f191681016001600160401b03811182821017156116cf576116cf611646565b604052919050565b60006001600160401b038211156116f0576116f0611646565b5060051b60200190565b600082601f83011261170b57600080fd5b81356001600160401b0381111561172457611724611646565b611737601f8201601f19166020016116a7565b81815284602083860101111561174c57600080fd5b816020850160208301376000918101602001919091529392505050565b803564ffffffffff811681146115bb57600080fd5b60006060828403121561179057600080fd5b604051606081016001600160401b03811182821017156117b2576117b2611646565b6040529050806117c183611769565b81526117cf60208401611769565b60208201526117e060408401611769565b60408201525092915050565b6000604082840312156117fe57600080fd5b604080519081016001600160401b038111828210171561182057611820611646565b60405290508082356118318161157b565b8152602092830135920191909152919050565b80356001600160801b03811681146115bb57600080fd5b801515811461159057600080fd5b80356115bb8161185b565b600082601f83011261188557600080fd5b8135611898611893826116d7565b6116a7565b80828252602082019150602061016084028601019250858311156118bb57600080fd5b602085015b838110156119795761016081880312156118d957600080fd5b6118e161165c565b6118ea826115b0565b81526118f8602083016115b0565b6020820152611909604083016115b0565b604082015261191b886060840161177e565b606082015261192d8860c084016117ec565b608082015261193f6101008301611844565b60a08201526119516101208301611869565b60c08201526119636101408301611869565b60e08201528352602090920191610160016118c0565b5095945050505050565b803563ffffffff811681146115bb57600080fd5b60006119a5611893846116d7565b8381526020810190600585901b8401368111156119c157600080fd5b845b81811015611aca5780356001600160401b038111156119e157600080fd5b860160e03682900312156119f457600080fd5b6119fc611685565b611a05826115b0565b815260208201356001600160401b03811115611a2057600080fd5b611a2c368285016116fa565b60208301525060408201356001600160401b03811115611a4b57600080fd5b611a57368285016116fa565b60408301525060608201356001600160401b03811115611a7657600080fd5b611a8236828501611874565b606083015250611a9460808301611844565b6080820152611aa560a08301611983565b60a0820152611ab660c08301611869565b60c0820152855250602093840193016119c3565b509095945050505050565b60005b83811015611af0578181015183820152602001611ad8565b50506000910152565b600082516115d6818460208701611ad5565b600060208284031215611b1d57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b80820180821115611b4d57611b4d611b24565b92915050565b6000808335601e19843603018112611b6a57600080fd5b8301803591506001600160401b03821115611b8457600080fd5b60200191503681900382131561163f57600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b0386168152606060208201819052600090611be79083018688611b99565b8281036040840152611bfa818587611b99565b98975050505050505050565b60008151808452611c1e816020860160208601611ad5565b601f01601f19169290920160200192915050565b60018060a01b0385168152836020820152608060408201526000611c596080830185611c06565b905060028310611c7957634e487b7160e01b600052602160045260246000fd5b82606083015295945050505050565b600060208284031215611c9a57600080fd5b81516115748161185b565b6001600160a01b039586168152602081019490945260408401929092529092166060820152608081019190915260a00190565b600060208284031215611cea57600080fd5b81516115748161157b565b634e487b7160e01b600052603260045260246000fd5b600082825180855260208501945060208160051b8301016020850160005b83811015611d5b57601f19858403018852611d45838351611c06565b6020988901989093509190910190600101611d29565b50909695505050505050565b604081526000611d7a6040830185611d0b565b8281036020840152611d8c8185611d0b565b95945050505050565b600060208284031215611da757600080fd5b81356115748161185b565b89815260e060208201526000611dcc60e083018a8c611b99565b60ff891660408401526001600160a01b0388811660608501528716608084015285151560a084015282810360c0840152611e07818587611b99565b9c9b505050505050505050505050565b6020815260006115746020830184611c06565b6001600160a01b0384168152606060208201819052600090611e4e90830185611c06565b9050826040830152949350505050565b600060018201611e7057611e70611b24565b5060010190565b634e487b7160e01b600052601260045260246000fd5b600082611e9c57611e9c611e77565b500490565b81810381811115611b4d57611b4d611b24565b600082611ec357611ec3611e77565b500690565b60018060a01b038616815284602082015260a060408201526000611eef60a0830186611c06565b8281036060840152611f018186611c06565b9150508260808301529695505050505050565b87815260e060208201526000611f2d60e0830189611c06565b63ffffffff881660408401526001600160a01b0387811660608501528616608084015284151560a084015282810360c0840152611f6a8185611c06565b9a9950505050505050505050565b6000604082016001600160801b03851683526040602084015280845180835260608501915060208601925060005b81811015611d5b5783516001600160a01b0316835260209384019390920191600101611fa6565b81516001600160a01b0390811682526020808401518216908301526040808401516001600160801b03169083015260608084015191821690830152610160820190506080830151612022608084018215159052565b5060a083015161203660a084018215159052565b5060c083015161207560c084018264ffffffffff815116825264ffffffffff602082015116602083015264ffffffffff60408201511660408301525050565b5060e0929092015180516001600160a01b0316610120830152602001516101409091015290565b600083516120ae818460208801611ad5565b601d60f91b90830190815283516120cc816001840160208801611ad5565b0160010194935050505056fe5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b5072a26469706673582212200934c93692d281e9d89ed2e17022e289297dd78e723d3ba32c6645f05d3b8df864736f6c634300081c0033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100365760003560e01c8063ba9a91a51461003b578063d58041b714610062575b600080fd5b6100506000805160206120d983398151915281565b60405190815260200160405180910390f35b610075610070366004611539565b610077565b005b6000806100cd61008a6020850185611593565b61009a6040860160208701611593565b6100aa60e0870160c08801611593565b6100ba60a0880160808901611593565b6100c86101008901896115c0565b61023d565b909250905060006101396100e46020860186611593565b6100f46040870160208801611593565b61010460e0880160c08901611593565b868661011660808b0160608c01611593565b61012660c08c0160a08d01611593565b6101346101208d018d6115e0565b610619565b604080516101408101909152909150610237908061015a6020880188611593565b6001600160a01b0316815260200186602001602081019061017b9190611593565b6001600160a01b0316815260200161019960e0880160c08901611593565b6001600160a01b03908116825260208201879052851660408201526060016101c760a0880160808901611593565b6001600160a01b031681526020016101e56060880160408901611593565b6001600160a01b03168152602001610204610100880160e08901611593565b6001600160a01b03168152602081018490526040016102276101408801886115f6565b61023091611997565b90526109b5565b50505050565b60408051600481526024810182526020810180516001600160e01b0316633f0f816960e21b17905290516000918291829182916001600160a01b038b169161028491611af9565b6000604051808303816000865af19150503d80600081146102c1576040519150601f19603f3d011682016040523d82523d6000602084013e6102c6565b606091505b50915091508161031c5760405162461bcd60e51b815260206004820152601a60248201527f4661696c656420746f20676574206c617374546f704861744964000000000000604482015260640160405180910390fd5b60e0818060200190518101906103329190611b0b565b61033d906001611b3a565b901b93503363468721a78a6000836103558a80611b53565b61036260208d018d611b53565b604051602401610376959493929190611bc2565b60408051601f198184030181529181526020820180516001600160e01b0316631a64dfad60e01b1790525160e085901b6001600160e01b03191681526103c493929190600090600401611c32565b6020604051808303816000875af11580156103e3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104079190611c88565b50604051638a54c52f60e01b81526001600160a01b03891690638a54c52f9061044a908a906000805160206120d98339815191529046908f908b90600401611ca5565b6020604051808303816000875af1158015610469573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061048d9190611cd8565b60408051600180825281830190925291945060009190816020015b60608152602001906001900390816104a857505060408051600180825281830190925291925060009190602082015b60608152602001906001900390816104d7579050509050604051806040016040528060088152602001671d1bdc12185d125960c21b8152508260008151811061052257610522611cf5565b602002602001018190525061053686610a84565b8160008151811061054957610549611cf5565b6020026020010181905250336001600160a01b031663468721a78960008585604051602401610579929190611d67565b60408051601f198184030181529181526020820180516001600160e01b031663579374b960e11b1790525160e085901b6001600160e01b03191681526105c793929190600090600401611c32565b6020604051808303816000875af11580156105e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061060a9190611c88565b50505050509550959350505050565b60405162460ea360e61b8152600481018690526000906001600160a01b038a1690631183a8c090602401602060405180830381865afa158015610660573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106849190611b0b565b90503363468721a78a60008961069a8780611b53565b60018c806106ae60608d0160408e01611d95565b6106bb60208e018e611b53565b6040516024016106d399989796959493929190611db2565b60408051601f198184030181529181526020820180516001600160e01b0316635829492f60e11b1790525160e085901b6001600160e01b031916815261072193929190600090600401611c32565b6020604051808303816000875af1158015610740573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107649190611c88565b50604051638a54c52f60e01b81526001600160a01b03891690638a54c52f906107a7908a906000805160206120d98339815191529046908f908890600401611ca5565b6020604051808303816000875af11580156107c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ea9190611cd8565b506000846001600160a01b031663f1ab873c856040518060200160405280600081525060405160240161081d9190611e17565b60408051601f19818403018152918152602080830180516001600160e01b031663a4f9edbf60e01b179052905161086f916000805160206120d983398151915291899101918252602082015260400190565b60408051601f198184030181529082905280516020909101206001600160e01b031960e086901b1682526108a7939291600401611e2a565b6020604051808303816000875af11580156108c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108ea9190611cd8565b604051602481018490526001600160a01b0382166044820152909150339063468721a7908c9060009060640160408051601f198184030181529181526020820180516001600160e01b031663320fbbb760e11b1790525160e085901b6001600160e01b031916815261096493929190600090600401611c32565b6020604051808303816000875af1158015610983573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109a79190611c88565b505098975050505050505050565b60005b81610120015151811015610a8057600082610120015182815181106109df576109df611cf5565b602002602001015190506000610a1784600001518560c001518660e00151876060015188608001518961010001518860800151610b8c565b90506000610a35856000015186610100015185858960800151610cf3565b90506000610a5b8660200151876040015188600001518760800151886000015187611025565b9050610a718460600151828860a00151856110cf565b846001019450505050506109b8565b5050565b606081600003610aab5750506040805180820190915260018152600360fc1b602082015290565b8160005b8115610ad55780610abf81611e5e565b9150610ace9050600a83611e8d565b9150610aaf565b6000816001600160401b03811115610aef57610aef611646565b6040519080825280601f01601f191660200182016040528015610b19576020820181803683370190505b5090505b8415610b8457610b2e600183611ea1565b9150610b3b600a86611eb4565b610b46906030611b3a565b60f81b818381518110610b5b57610b5b611cf5565b60200101906001600160f81b031916908160001a905350610b7d600a86611e8d565b9450610b1d565b949350505050565b60006001600160801b03821615610ce557866001600160a01b0316632f7fb7b6878a6001600160a01b0316631183a8c0876040518263ffffffff1660e01b8152600401610bdb91815260200190565b602060405180830381865afa158015610bf8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c1c9190611b0b565b886000604051602001610c39929190918252602082015260400190565b60408051601f198184030181528282526001600160801b0389166020840152910160408051601f19818403018152908290526001600160e01b031960e087901b168252610c9b949392916000805160206120d983398151915290600401611ec8565b6020604051808303816000875af1158015610cba573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cde9190611cd8565b9050610ce8565b50825b979650505050505050565b60405162460ea360e61b81526004810185905260009081906001600160a01b03881690631183a8c090602401602060405180830381865afa158015610d3c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d609190611b0b565b9050336001600160a01b031663468721a78860008989602001518a60a001518a8a8d60c001518e60400151604051602401610da19796959493929190611f14565b60408051601f198184030181529181526020820180516001600160e01b0316635829492f60e11b1790525160e085901b6001600160e01b0319168152610def93929190600090600401611c32565b6020604051808303816000875af1158015610e0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e329190611c88565b5060808501516001600160801b031615610f5d5760408051600180825281830190925260009160208083019080368337019050509050856000015181600081518110610e8057610e80611cf5565b60200260200101906001600160a01b031690816001600160a01b031681525050336001600160a01b031663468721a7866000896080015185604051602401610ec9929190611f78565b60408051601f198184030181529181526020820180516001600160e01b0316634a231cef60e01b1790525160e085901b6001600160e01b0319168152610f1793929190600090600401611c32565b6020604051808303816000875af1158015610f36573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f5a9190611c88565b50505b8451604051602481018390526001600160a01b039091166044820152339063468721a790899060009060640160408051601f198184030181529181526020820180516001600160e01b031663320fbbb760e11b1790525160e085901b6001600160e01b0319168152610fd793929190600090600401611c32565b6020604051808303816000875af1158015610ff6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061101a9190611c88565b509695505050505050565b60006001600160801b0384161561103d5750816110c5565b604051638a54c52f60e01b81526001600160a01b03881690638a54c52f9061107f9089906000805160206120d98339815191529046908b908990600401611ca5565b6020604051808303816000875af115801561109e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110c29190611cd8565b90505b9695505050505050565b60005b84518110156115325760008582815181106110ef576110ef611cf5565b60200260200101519050336001600160a01b031663468721a78260400151600084600001518560a001516040516024016111479291906001600160a01b039290921682526001600160801b0316602082015260400190565b60408051601f198184030181529181526020820180516001600160e01b031663095ea7b360e01b1790525160e085901b6001600160e01b031916815261119593929190600090600401611c32565b6020604051808303816000875af11580156111b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111d89190611c88565b50600081600001516001600160a01b0316631e99d5696040518163ffffffff1660e01b8152600401602060405180830381865afa15801561121d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112419190611b0b565b9050336001600160a01b031663468721a78360000151600060405180610100016040528087602001516001600160a01b031681526020018b6001600160a01b031681526020018760a001516001600160801b0316815260200187604001516001600160a01b031681526020018760c00151151581526020018760e00151151581526020018760600151815260200187608001518152506040516024016112e79190611fcd565b60408051601f198184030181529181526020820180516001600160e01b03166353b1572760e01b1790525160e085901b6001600160e01b031916815261133593929190600090600401611c32565b6020604051808303816000875af1158015611354573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113789190611c88565b50604080516001808252818301909252600091816020015b606081526020019060019003908161139057505060408051600180825281830190925291925060009190602082015b60608152602001906001900390816113bf5790505090506040518060400160405280600f81526020016e1a185d1259151bd4dd1c99585b5259608a1b8152508260008151811061141157611411611cf5565b602002602001018190525061142586610a84565b61142e84610a84565b60405160200161143f92919061209c565b6040516020818303038152906040528160008151811061146157611461611cf5565b6020026020010181905250336001600160a01b031663468721a78860008585604051602401611491929190611d67565b60408051601f198184030181529181526020820180516001600160e01b031663579374b960e11b1790525160e085901b6001600160e01b03191681526114df93929190600090600401611c32565b6020604051808303816000875af11580156114fe573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115229190611c88565b50846001019450505050506110d2565b5050505050565b60006020828403121561154b57600080fd5b81356001600160401b0381111561156157600080fd5b8201610160818503121561157457600080fd5b9392505050565b6001600160a01b038116811461159057600080fd5b50565b6000602082840312156115a557600080fd5b81356115748161157b565b80356115bb8161157b565b919050565b60008235603e198336030181126115d657600080fd5b9190910192915050565b60008235605e198336030181126115d657600080fd5b6000808335601e1984360301811261160d57600080fd5b8301803591506001600160401b0382111561162757600080fd5b6020019150600581901b360382131561163f57600080fd5b9250929050565b634e487b7160e01b600052604160045260246000fd5b60405161010081016001600160401b038111828210171561167f5761167f611646565b60405290565b60405160e081016001600160401b038111828210171561167f5761167f611646565b604051601f8201601f191681016001600160401b03811182821017156116cf576116cf611646565b604052919050565b60006001600160401b038211156116f0576116f0611646565b5060051b60200190565b600082601f83011261170b57600080fd5b81356001600160401b0381111561172457611724611646565b611737601f8201601f19166020016116a7565b81815284602083860101111561174c57600080fd5b816020850160208301376000918101602001919091529392505050565b803564ffffffffff811681146115bb57600080fd5b60006060828403121561179057600080fd5b604051606081016001600160401b03811182821017156117b2576117b2611646565b6040529050806117c183611769565b81526117cf60208401611769565b60208201526117e060408401611769565b60408201525092915050565b6000604082840312156117fe57600080fd5b604080519081016001600160401b038111828210171561182057611820611646565b60405290508082356118318161157b565b8152602092830135920191909152919050565b80356001600160801b03811681146115bb57600080fd5b801515811461159057600080fd5b80356115bb8161185b565b600082601f83011261188557600080fd5b8135611898611893826116d7565b6116a7565b80828252602082019150602061016084028601019250858311156118bb57600080fd5b602085015b838110156119795761016081880312156118d957600080fd5b6118e161165c565b6118ea826115b0565b81526118f8602083016115b0565b6020820152611909604083016115b0565b604082015261191b886060840161177e565b606082015261192d8860c084016117ec565b608082015261193f6101008301611844565b60a08201526119516101208301611869565b60c08201526119636101408301611869565b60e08201528352602090920191610160016118c0565b5095945050505050565b803563ffffffff811681146115bb57600080fd5b60006119a5611893846116d7565b8381526020810190600585901b8401368111156119c157600080fd5b845b81811015611aca5780356001600160401b038111156119e157600080fd5b860160e03682900312156119f457600080fd5b6119fc611685565b611a05826115b0565b815260208201356001600160401b03811115611a2057600080fd5b611a2c368285016116fa565b60208301525060408201356001600160401b03811115611a4b57600080fd5b611a57368285016116fa565b60408301525060608201356001600160401b03811115611a7657600080fd5b611a8236828501611874565b606083015250611a9460808301611844565b6080820152611aa560a08301611983565b60a0820152611ab660c08301611869565b60c0820152855250602093840193016119c3565b509095945050505050565b60005b83811015611af0578181015183820152602001611ad8565b50506000910152565b600082516115d6818460208701611ad5565b600060208284031215611b1d57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b80820180821115611b4d57611b4d611b24565b92915050565b6000808335601e19843603018112611b6a57600080fd5b8301803591506001600160401b03821115611b8457600080fd5b60200191503681900382131561163f57600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b0386168152606060208201819052600090611be79083018688611b99565b8281036040840152611bfa818587611b99565b98975050505050505050565b60008151808452611c1e816020860160208601611ad5565b601f01601f19169290920160200192915050565b60018060a01b0385168152836020820152608060408201526000611c596080830185611c06565b905060028310611c7957634e487b7160e01b600052602160045260246000fd5b82606083015295945050505050565b600060208284031215611c9a57600080fd5b81516115748161185b565b6001600160a01b039586168152602081019490945260408401929092529092166060820152608081019190915260a00190565b600060208284031215611cea57600080fd5b81516115748161157b565b634e487b7160e01b600052603260045260246000fd5b600082825180855260208501945060208160051b8301016020850160005b83811015611d5b57601f19858403018852611d45838351611c06565b6020988901989093509190910190600101611d29565b50909695505050505050565b604081526000611d7a6040830185611d0b565b8281036020840152611d8c8185611d0b565b95945050505050565b600060208284031215611da757600080fd5b81356115748161185b565b89815260e060208201526000611dcc60e083018a8c611b99565b60ff891660408401526001600160a01b0388811660608501528716608084015285151560a084015282810360c0840152611e07818587611b99565b9c9b505050505050505050505050565b6020815260006115746020830184611c06565b6001600160a01b0384168152606060208201819052600090611e4e90830185611c06565b9050826040830152949350505050565b600060018201611e7057611e70611b24565b5060010190565b634e487b7160e01b600052601260045260246000fd5b600082611e9c57611e9c611e77565b500490565b81810381811115611b4d57611b4d611b24565b600082611ec357611ec3611e77565b500690565b60018060a01b038616815284602082015260a060408201526000611eef60a0830186611c06565b8281036060840152611f018186611c06565b9150508260808301529695505050505050565b87815260e060208201526000611f2d60e0830189611c06565b63ffffffff881660408401526001600160a01b0387811660608501528616608084015284151560a084015282810360c0840152611f6a8185611c06565b9a9950505050505050505050565b6000604082016001600160801b03851683526040602084015280845180835260608501915060208601925060005b81811015611d5b5783516001600160a01b0316835260209384019390920191600101611fa6565b81516001600160a01b0390811682526020808401518216908301526040808401516001600160801b03169083015260608084015191821690830152610160820190506080830151612022608084018215159052565b5060a083015161203660a084018215159052565b5060c083015161207560c084018264ffffffffff815116825264ffffffffff602082015116602083015264ffffffffff60408201511660408301525050565b5060e0929092015180516001600160a01b0316610120830152602001516101409091015290565b600083516120ae818460208801611ad5565b601d60f91b90830190815283516120cc816001840160208801611ad5565b0160010194935050505056fe5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b5072a26469706673582212200934c93692d281e9d89ed2e17022e289297dd78e723d3ba32c6645f05d3b8df864736f6c634300081c0033", "devdoc": { "kind": "dev", "methods": { diff --git a/deployments/polygon/DecentHatsModificationModule.json b/deployments/polygon/DecentHatsModificationModule.json index b7c2587..885891d 100644 --- a/deployments/polygon/DecentHatsModificationModule.json +++ b/deployments/polygon/DecentHatsModificationModule.json @@ -1,5 +1,5 @@ { - "address": "0x31Bf73048056fe947B827C0Fe159ACcB5Ae30237", + "address": "0xd71e2bdC28BFa907652Cfb8BeAfdF59822B71B1B", "abi": [ { "inputs": [], @@ -43,6 +43,11 @@ "name": "topHatAccount", "type": "address" }, + { + "internalType": "address", + "name": "keyValuePairs", + "type": "address" + }, { "internalType": "contract IHatsModuleFactory", "name": "hatsModuleFactory", @@ -183,48 +188,48 @@ "type": "function" } ], - "transactionHash": "0x0c3380c56b37e2eb3ad7f9ef78cb13937b5bba2d3beb1e30978d2ddb23e14666", + "transactionHash": "0x6f19094753dd1551d62a745f7cb169a98b2b12decfff7ccd05cdbb17cf9bdb7a", "receipt": { "to": null, "from": "0xb5Ca125166C1987A35EDD550E16846Fa1e1D9bB3", - "contractAddress": "0x31Bf73048056fe947B827C0Fe159ACcB5Ae30237", - "transactionIndex": 34, - "gasUsed": "1061522", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000008000000000000000000000000000000000000000000000000000000000800000000000000000000100000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000040000000000000000200000000000004000000000000000000000000000000000100000000000004000000000000000000001000000000000000000000000000000100004000000000000000000200000000000000000000000000000000000000000000000100000", - "blockHash": "0x1505660f5b5490b8345e519974665175a09e34becda8322584fa63f586fc7ce6", - "transactionHash": "0x0c3380c56b37e2eb3ad7f9ef78cb13937b5bba2d3beb1e30978d2ddb23e14666", + "contractAddress": "0xd71e2bdC28BFa907652Cfb8BeAfdF59822B71B1B", + "transactionIndex": 55, + "gasUsed": "1316194", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000008000000000000000000000000000000000000000000000000000000000800000000000000000000100020000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000100000000000004000000000000000000001000000000000000000000000000000100004000000000000000000200000000000000000000000000000000000000000000020100000", + "blockHash": "0x197faff2a9c589ea532ad0a01bf1f2cd6df4cb71b7feac056daf80612b9485af", + "transactionHash": "0x6f19094753dd1551d62a745f7cb169a98b2b12decfff7ccd05cdbb17cf9bdb7a", "logs": [ { - "transactionIndex": 34, - "blockNumber": 63925614, - "transactionHash": "0x0c3380c56b37e2eb3ad7f9ef78cb13937b5bba2d3beb1e30978d2ddb23e14666", + "transactionIndex": 55, + "blockNumber": 64597163, + "transactionHash": "0x6f19094753dd1551d62a745f7cb169a98b2b12decfff7ccd05cdbb17cf9bdb7a", "address": "0x0000000000000000000000000000000000001010", "topics": [ "0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63", "0x0000000000000000000000000000000000000000000000000000000000001010", "0x000000000000000000000000b5ca125166c1987a35edd550e16846fa1e1d9bb3", - "0x000000000000000000000000a8b52f02108aa5f4b675bdcc973760022d7c6020" + "0x000000000000000000000000794e44d1334a56fea7f4df12633b88820d0c5888" ], - "data": "0x00000000000000000000000000000000000000000000000000b4f5452c8622d800000000000000000000000000000000000000000000000030613b84af7d6c3d0000000000000000000000000000000000000000000000bafa40246913c532510000000000000000000000000000000000000000000000002fac463f82f749650000000000000000000000000000000000000000000000bafaf519ae404b5529", - "logIndex": 225, - "blockHash": "0x1505660f5b5490b8345e519974665175a09e34becda8322584fa63f586fc7ce6" + "data": "0x00000000000000000000000000000000000000000000000000da3518f34db26e00000000000000000000000000000000000000000000000021fc65b04749d3a500000000000000000000000000000000000000000000058950a482befa9b1f020000000000000000000000000000000000000000000000002122309753fc2137000000000000000000000000000000000000000000000589517eb7d7ede8d170", + "logIndex": 374, + "blockHash": "0x197faff2a9c589ea532ad0a01bf1f2cd6df4cb71b7feac056daf80612b9485af" } ], - "blockNumber": 63925614, - "cumulativeGasUsed": "8745812", + "blockNumber": 64597163, + "cumulativeGasUsed": "11526679", "status": 1, "byzantium": true }, "args": [], - "numDeployments": 1, - "solcInputHash": "e3ec7808efccf5e6b24e16a29ead3983", - "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"SALT\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"contract IHats\",\"name\":\"hatsProtocol\",\"type\":\"address\"},{\"internalType\":\"contract IERC6551Registry\",\"name\":\"erc6551Registry\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"hatsAccountImplementation\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"topHatId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"topHatAccount\",\"type\":\"address\"},{\"internalType\":\"contract IHatsModuleFactory\",\"name\":\"hatsModuleFactory\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"hatsElectionsEligibilityImplementation\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"adminHatId\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"wearer\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"details\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"imageURI\",\"type\":\"string\"},{\"components\":[{\"internalType\":\"contract ISablierV2LockupLinear\",\"name\":\"sablier\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint40\",\"name\":\"start\",\"type\":\"uint40\"},{\"internalType\":\"uint40\",\"name\":\"cliff\",\"type\":\"uint40\"},{\"internalType\":\"uint40\",\"name\":\"end\",\"type\":\"uint40\"}],\"internalType\":\"struct LockupLinear.Timestamps\",\"name\":\"timestamps\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"UD60x18\",\"name\":\"fee\",\"type\":\"uint256\"}],\"internalType\":\"struct Broker\",\"name\":\"broker\",\"type\":\"tuple\"},{\"internalType\":\"uint128\",\"name\":\"totalAmount\",\"type\":\"uint128\"},{\"internalType\":\"bool\",\"name\":\"cancelable\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"transferable\",\"type\":\"bool\"}],\"internalType\":\"struct DecentHatsModuleUtils.SablierStreamParams[]\",\"name\":\"sablierStreamsParams\",\"type\":\"tuple[]\"},{\"internalType\":\"uint128\",\"name\":\"termEndDateTs\",\"type\":\"uint128\"},{\"internalType\":\"uint32\",\"name\":\"maxSupply\",\"type\":\"uint32\"},{\"internalType\":\"bool\",\"name\":\"isMutable\",\"type\":\"bool\"}],\"internalType\":\"struct DecentHatsModuleUtils.HatParams[]\",\"name\":\"hats\",\"type\":\"tuple[]\"}],\"internalType\":\"struct DecentHatsModuleUtils.CreateRoleHatsParams\",\"name\":\"roleHatsParams\",\"type\":\"tuple\"}],\"name\":\"createRoleHats\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"createRoleHats((address,address,address,uint256,address,address,address,uint256,(address,string,string,(address,address,address,(uint40,uint40,uint40),(address,uint256),uint128,bool,bool)[],uint128,uint32,bool)[]))\":{\"details\":\"Stream funds on untermed Roles are targeted at the hat's smart account. In order to withdraw funds from the stream, the hat's smart account must be the one call to `withdraw-` on the Sablier contract, setting the recipient arg to its wearer.Stream funds on termed Roles are targeted directly at the nominated wearer. The wearer should directly call `withdraw-` on the Sablier contract.Role hat creation, minting, smart account creation and stream creation are handled here in order to avoid a race condition where not more than one active proposal to create a new role can exist at a time. See: https://github.com/decentdao/decent-interface/issues/2402\",\"params\":{\"roleHatsParams\":\"An array of params for each role hat to be created.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"createRoleHats((address,address,address,uint256,address,address,address,uint256,(address,string,string,(address,address,address,(uint40,uint40,uint40),(address,uint256),uint128,bool,bool)[],uint128,uint32,bool)[]))\":{\"notice\":\"Creates a new termed or untermed role hat and any streams on it.This contract should be enabled a module on the Safe for which the role is to be created, and disabled after.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/modules/DecentHatsModificationModule.sol\":\"DecentHatsModificationModule\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\npragma solidity >=0.7.0 <0.9.0;\\n\\n/// @title Enum - Collection of enums\\n/// @author Richard Meissner - \\ncontract Enum {\\n enum Operation {Call, DelegateCall}\\n}\\n\",\"keccak256\":\"0x473e45b1a5cc47be494b0e123c9127f0c11c1e0992a321ae5a644c0bfdb2c14f\",\"license\":\"LGPL-3.0-only\"},\"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\n\\n/// @title Zodiac Avatar - A contract that manages modules that can execute transactions via this contract.\\npragma solidity >=0.7.0 <0.9.0;\\n\\nimport \\\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\\\";\\n\\ninterface IAvatar {\\n event EnabledModule(address module);\\n event DisabledModule(address module);\\n event ExecutionFromModuleSuccess(address indexed module);\\n event ExecutionFromModuleFailure(address indexed module);\\n\\n /// @dev Enables a module on the avatar.\\n /// @notice Can only be called by the avatar.\\n /// @notice Modules should be stored as a linked list.\\n /// @notice Must emit EnabledModule(address module) if successful.\\n /// @param module Module to be enabled.\\n function enableModule(address module) external;\\n\\n /// @dev Disables a module on the avatar.\\n /// @notice Can only be called by the avatar.\\n /// @notice Must emit DisabledModule(address module) if successful.\\n /// @param prevModule Address that pointed to the module to be removed in the linked list\\n /// @param module Module to be removed.\\n function disableModule(address prevModule, address module) external;\\n\\n /// @dev Allows a Module to execute a transaction.\\n /// @notice Can only be called by an enabled module.\\n /// @notice Must emit ExecutionFromModuleSuccess(address module) if successful.\\n /// @notice Must emit ExecutionFromModuleFailure(address module) if unsuccessful.\\n /// @param to Destination address of module transaction.\\n /// @param value Ether value of module transaction.\\n /// @param data Data payload of module transaction.\\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\\n function execTransactionFromModule(\\n address to,\\n uint256 value,\\n bytes memory data,\\n Enum.Operation operation\\n ) external returns (bool success);\\n\\n /// @dev Allows a Module to execute a transaction and return data\\n /// @notice Can only be called by an enabled module.\\n /// @notice Must emit ExecutionFromModuleSuccess(address module) if successful.\\n /// @notice Must emit ExecutionFromModuleFailure(address module) if unsuccessful.\\n /// @param to Destination address of module transaction.\\n /// @param value Ether value of module transaction.\\n /// @param data Data payload of module transaction.\\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\\n function execTransactionFromModuleReturnData(\\n address to,\\n uint256 value,\\n bytes memory data,\\n Enum.Operation operation\\n ) external returns (bool success, bytes memory returnData);\\n\\n /// @dev Returns if an module is enabled\\n /// @return True if the module is enabled\\n function isModuleEnabled(address module) external view returns (bool);\\n\\n /// @dev Returns array of modules.\\n /// @param start Start of the page.\\n /// @param pageSize Maximum number of modules that should be returned.\\n /// @return array Array of modules.\\n /// @return next Start of the next page.\\n function getModulesPaginated(address start, uint256 pageSize)\\n external\\n view\\n returns (address[] memory array, address next);\\n}\\n\",\"keccak256\":\"0xcd5508ffe596eef8fbccfd5fc4f10a34397773547ce64e212d48b5212865ec1f\",\"license\":\"LGPL-3.0-only\"},\"@openzeppelin/contracts/interfaces/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/introspection/IERC165.sol\\\";\\n\",\"keccak256\":\"0xd04b0f06e0666f29cf7cccc82894de541e19bb30a765b107b1e40bb7fe5f7d7a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev 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 amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `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 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes calldata data\\n ) external;\\n\\n /**\\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 {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the caller.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool _approved) external;\\n\\n /**\\n * @dev Returns 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\",\"keccak256\":\"0xed6a749c5373af398105ce6ee3ac4763aa450ea7285d268c85d9eeca809cdb1f\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../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\",\"keccak256\":\"0x75b829ff2f26c14355d1cba20e16fe7b29ca58eb5fef665ede48bc0f9c6c74b9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"@prb/math/src/Common.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\n// Common.sol\\n//\\n// Common mathematical functions used in both SD59x18 and UD60x18. Note that these global functions do not\\n// always operate with SD59x18 and UD60x18 numbers.\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CUSTOM ERRORS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @notice Thrown when the resultant value in {mulDiv} overflows uint256.\\nerror PRBMath_MulDiv_Overflow(uint256 x, uint256 y, uint256 denominator);\\n\\n/// @notice Thrown when the resultant value in {mulDiv18} overflows uint256.\\nerror PRBMath_MulDiv18_Overflow(uint256 x, uint256 y);\\n\\n/// @notice Thrown when one of the inputs passed to {mulDivSigned} is `type(int256).min`.\\nerror PRBMath_MulDivSigned_InputTooSmall();\\n\\n/// @notice Thrown when the resultant value in {mulDivSigned} overflows int256.\\nerror PRBMath_MulDivSigned_Overflow(int256 x, int256 y);\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CONSTANTS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @dev The maximum value a uint128 number can have.\\nuint128 constant MAX_UINT128 = type(uint128).max;\\n\\n/// @dev The maximum value a uint40 number can have.\\nuint40 constant MAX_UINT40 = type(uint40).max;\\n\\n/// @dev The unit number, which the decimal precision of the fixed-point types.\\nuint256 constant UNIT = 1e18;\\n\\n/// @dev The unit number inverted mod 2^256.\\nuint256 constant UNIT_INVERSE = 78156646155174841979727994598816262306175212592076161876661_508869554232690281;\\n\\n/// @dev The the largest power of two that divides the decimal value of `UNIT`. The logarithm of this value is the least significant\\n/// bit in the binary representation of `UNIT`.\\nuint256 constant UNIT_LPOTD = 262144;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @notice Calculates the binary exponent of x using the binary fraction method.\\n/// @dev Has to use 192.64-bit fixed-point numbers. See https://ethereum.stackexchange.com/a/96594/24693.\\n/// @param x The exponent as an unsigned 192.64-bit fixed-point number.\\n/// @return result The result as an unsigned 60.18-decimal fixed-point number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp2(uint256 x) pure returns (uint256 result) {\\n unchecked {\\n // Start from 0.5 in the 192.64-bit fixed-point format.\\n result = 0x800000000000000000000000000000000000000000000000;\\n\\n // The following logic multiplies the result by $\\\\sqrt{2^{-i}}$ when the bit at position i is 1. Key points:\\n //\\n // 1. Intermediate results will not overflow, as the starting point is 2^191 and all magic factors are under 2^65.\\n // 2. The rationale for organizing the if statements into groups of 8 is gas savings. If the result of performing\\n // a bitwise AND operation between x and any value in the array [0x80; 0x40; 0x20; 0x10; 0x08; 0x04; 0x02; 0x01] is 1,\\n // we know that `x & 0xFF` is also 1.\\n if (x & 0xFF00000000000000 > 0) {\\n if (x & 0x8000000000000000 > 0) {\\n result = (result * 0x16A09E667F3BCC909) >> 64;\\n }\\n if (x & 0x4000000000000000 > 0) {\\n result = (result * 0x1306FE0A31B7152DF) >> 64;\\n }\\n if (x & 0x2000000000000000 > 0) {\\n result = (result * 0x1172B83C7D517ADCE) >> 64;\\n }\\n if (x & 0x1000000000000000 > 0) {\\n result = (result * 0x10B5586CF9890F62A) >> 64;\\n }\\n if (x & 0x800000000000000 > 0) {\\n result = (result * 0x1059B0D31585743AE) >> 64;\\n }\\n if (x & 0x400000000000000 > 0) {\\n result = (result * 0x102C9A3E778060EE7) >> 64;\\n }\\n if (x & 0x200000000000000 > 0) {\\n result = (result * 0x10163DA9FB33356D8) >> 64;\\n }\\n if (x & 0x100000000000000 > 0) {\\n result = (result * 0x100B1AFA5ABCBED61) >> 64;\\n }\\n }\\n\\n if (x & 0xFF000000000000 > 0) {\\n if (x & 0x80000000000000 > 0) {\\n result = (result * 0x10058C86DA1C09EA2) >> 64;\\n }\\n if (x & 0x40000000000000 > 0) {\\n result = (result * 0x1002C605E2E8CEC50) >> 64;\\n }\\n if (x & 0x20000000000000 > 0) {\\n result = (result * 0x100162F3904051FA1) >> 64;\\n }\\n if (x & 0x10000000000000 > 0) {\\n result = (result * 0x1000B175EFFDC76BA) >> 64;\\n }\\n if (x & 0x8000000000000 > 0) {\\n result = (result * 0x100058BA01FB9F96D) >> 64;\\n }\\n if (x & 0x4000000000000 > 0) {\\n result = (result * 0x10002C5CC37DA9492) >> 64;\\n }\\n if (x & 0x2000000000000 > 0) {\\n result = (result * 0x1000162E525EE0547) >> 64;\\n }\\n if (x & 0x1000000000000 > 0) {\\n result = (result * 0x10000B17255775C04) >> 64;\\n }\\n }\\n\\n if (x & 0xFF0000000000 > 0) {\\n if (x & 0x800000000000 > 0) {\\n result = (result * 0x1000058B91B5BC9AE) >> 64;\\n }\\n if (x & 0x400000000000 > 0) {\\n result = (result * 0x100002C5C89D5EC6D) >> 64;\\n }\\n if (x & 0x200000000000 > 0) {\\n result = (result * 0x10000162E43F4F831) >> 64;\\n }\\n if (x & 0x100000000000 > 0) {\\n result = (result * 0x100000B1721BCFC9A) >> 64;\\n }\\n if (x & 0x80000000000 > 0) {\\n result = (result * 0x10000058B90CF1E6E) >> 64;\\n }\\n if (x & 0x40000000000 > 0) {\\n result = (result * 0x1000002C5C863B73F) >> 64;\\n }\\n if (x & 0x20000000000 > 0) {\\n result = (result * 0x100000162E430E5A2) >> 64;\\n }\\n if (x & 0x10000000000 > 0) {\\n result = (result * 0x1000000B172183551) >> 64;\\n }\\n }\\n\\n if (x & 0xFF00000000 > 0) {\\n if (x & 0x8000000000 > 0) {\\n result = (result * 0x100000058B90C0B49) >> 64;\\n }\\n if (x & 0x4000000000 > 0) {\\n result = (result * 0x10000002C5C8601CC) >> 64;\\n }\\n if (x & 0x2000000000 > 0) {\\n result = (result * 0x1000000162E42FFF0) >> 64;\\n }\\n if (x & 0x1000000000 > 0) {\\n result = (result * 0x10000000B17217FBB) >> 64;\\n }\\n if (x & 0x800000000 > 0) {\\n result = (result * 0x1000000058B90BFCE) >> 64;\\n }\\n if (x & 0x400000000 > 0) {\\n result = (result * 0x100000002C5C85FE3) >> 64;\\n }\\n if (x & 0x200000000 > 0) {\\n result = (result * 0x10000000162E42FF1) >> 64;\\n }\\n if (x & 0x100000000 > 0) {\\n result = (result * 0x100000000B17217F8) >> 64;\\n }\\n }\\n\\n if (x & 0xFF000000 > 0) {\\n if (x & 0x80000000 > 0) {\\n result = (result * 0x10000000058B90BFC) >> 64;\\n }\\n if (x & 0x40000000 > 0) {\\n result = (result * 0x1000000002C5C85FE) >> 64;\\n }\\n if (x & 0x20000000 > 0) {\\n result = (result * 0x100000000162E42FF) >> 64;\\n }\\n if (x & 0x10000000 > 0) {\\n result = (result * 0x1000000000B17217F) >> 64;\\n }\\n if (x & 0x8000000 > 0) {\\n result = (result * 0x100000000058B90C0) >> 64;\\n }\\n if (x & 0x4000000 > 0) {\\n result = (result * 0x10000000002C5C860) >> 64;\\n }\\n if (x & 0x2000000 > 0) {\\n result = (result * 0x1000000000162E430) >> 64;\\n }\\n if (x & 0x1000000 > 0) {\\n result = (result * 0x10000000000B17218) >> 64;\\n }\\n }\\n\\n if (x & 0xFF0000 > 0) {\\n if (x & 0x800000 > 0) {\\n result = (result * 0x1000000000058B90C) >> 64;\\n }\\n if (x & 0x400000 > 0) {\\n result = (result * 0x100000000002C5C86) >> 64;\\n }\\n if (x & 0x200000 > 0) {\\n result = (result * 0x10000000000162E43) >> 64;\\n }\\n if (x & 0x100000 > 0) {\\n result = (result * 0x100000000000B1721) >> 64;\\n }\\n if (x & 0x80000 > 0) {\\n result = (result * 0x10000000000058B91) >> 64;\\n }\\n if (x & 0x40000 > 0) {\\n result = (result * 0x1000000000002C5C8) >> 64;\\n }\\n if (x & 0x20000 > 0) {\\n result = (result * 0x100000000000162E4) >> 64;\\n }\\n if (x & 0x10000 > 0) {\\n result = (result * 0x1000000000000B172) >> 64;\\n }\\n }\\n\\n if (x & 0xFF00 > 0) {\\n if (x & 0x8000 > 0) {\\n result = (result * 0x100000000000058B9) >> 64;\\n }\\n if (x & 0x4000 > 0) {\\n result = (result * 0x10000000000002C5D) >> 64;\\n }\\n if (x & 0x2000 > 0) {\\n result = (result * 0x1000000000000162E) >> 64;\\n }\\n if (x & 0x1000 > 0) {\\n result = (result * 0x10000000000000B17) >> 64;\\n }\\n if (x & 0x800 > 0) {\\n result = (result * 0x1000000000000058C) >> 64;\\n }\\n if (x & 0x400 > 0) {\\n result = (result * 0x100000000000002C6) >> 64;\\n }\\n if (x & 0x200 > 0) {\\n result = (result * 0x10000000000000163) >> 64;\\n }\\n if (x & 0x100 > 0) {\\n result = (result * 0x100000000000000B1) >> 64;\\n }\\n }\\n\\n if (x & 0xFF > 0) {\\n if (x & 0x80 > 0) {\\n result = (result * 0x10000000000000059) >> 64;\\n }\\n if (x & 0x40 > 0) {\\n result = (result * 0x1000000000000002C) >> 64;\\n }\\n if (x & 0x20 > 0) {\\n result = (result * 0x10000000000000016) >> 64;\\n }\\n if (x & 0x10 > 0) {\\n result = (result * 0x1000000000000000B) >> 64;\\n }\\n if (x & 0x8 > 0) {\\n result = (result * 0x10000000000000006) >> 64;\\n }\\n if (x & 0x4 > 0) {\\n result = (result * 0x10000000000000003) >> 64;\\n }\\n if (x & 0x2 > 0) {\\n result = (result * 0x10000000000000001) >> 64;\\n }\\n if (x & 0x1 > 0) {\\n result = (result * 0x10000000000000001) >> 64;\\n }\\n }\\n\\n // In the code snippet below, two operations are executed simultaneously:\\n //\\n // 1. The result is multiplied by $(2^n + 1)$, where $2^n$ represents the integer part, and the additional 1\\n // accounts for the initial guess of 0.5. This is achieved by subtracting from 191 instead of 192.\\n // 2. The result is then converted to an unsigned 60.18-decimal fixed-point format.\\n //\\n // The underlying logic is based on the relationship $2^{191-ip} = 2^{ip} / 2^{191}$, where $ip$ denotes the,\\n // integer part, $2^n$.\\n result *= UNIT;\\n result >>= (191 - (x >> 64));\\n }\\n}\\n\\n/// @notice Finds the zero-based index of the first 1 in the binary representation of x.\\n///\\n/// @dev See the note on \\\"msb\\\" in this Wikipedia article: https://en.wikipedia.org/wiki/Find_first_set\\n///\\n/// Each step in this implementation is equivalent to this high-level code:\\n///\\n/// ```solidity\\n/// if (x >= 2 ** 128) {\\n/// x >>= 128;\\n/// result += 128;\\n/// }\\n/// ```\\n///\\n/// Where 128 is replaced with each respective power of two factor. See the full high-level implementation here:\\n/// https://gist.github.com/PaulRBerg/f932f8693f2733e30c4d479e8e980948\\n///\\n/// The Yul instructions used below are:\\n///\\n/// - \\\"gt\\\" is \\\"greater than\\\"\\n/// - \\\"or\\\" is the OR bitwise operator\\n/// - \\\"shl\\\" is \\\"shift left\\\"\\n/// - \\\"shr\\\" is \\\"shift right\\\"\\n///\\n/// @param x The uint256 number for which to find the index of the most significant bit.\\n/// @return result The index of the most significant bit as a uint256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction msb(uint256 x) pure returns (uint256 result) {\\n // 2^128\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(7, gt(x, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^64\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(6, gt(x, 0xFFFFFFFFFFFFFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^32\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(5, gt(x, 0xFFFFFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^16\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(4, gt(x, 0xFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^8\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(3, gt(x, 0xFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^4\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(2, gt(x, 0xF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^2\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(1, gt(x, 0x3))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^1\\n // No need to shift x any more.\\n assembly (\\\"memory-safe\\\") {\\n let factor := gt(x, 0x1)\\n result := or(result, factor)\\n }\\n}\\n\\n/// @notice Calculates x*y\\u00f7denominator with 512-bit precision.\\n///\\n/// @dev Credits to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv.\\n///\\n/// Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - The denominator must not be zero.\\n/// - The result must fit in uint256.\\n///\\n/// @param x The multiplicand as a uint256.\\n/// @param y The multiplier as a uint256.\\n/// @param denominator The divisor as a uint256.\\n/// @return result The result as a uint256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mulDiv(uint256 x, uint256 y, uint256 denominator) pure returns (uint256 result) {\\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; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly (\\\"memory-safe\\\") {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\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 unchecked {\\n return prod0 / denominator;\\n }\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n if (prod1 >= denominator) {\\n revert PRBMath_MulDiv_Overflow(x, y, denominator);\\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 (\\\"memory-safe\\\") {\\n // Compute remainder using the mulmod Yul instruction.\\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 unchecked {\\n // Calculate the largest power of two divisor of the denominator using the unary operator ~. This operation cannot overflow\\n // because the denominator cannot be zero at this point in the function execution. The result is always >= 1.\\n // For more detail, see https://cs.stackexchange.com/q/138556/92363.\\n uint256 lpotdod = denominator & (~denominator + 1);\\n uint256 flippedLpotdod;\\n\\n assembly (\\\"memory-safe\\\") {\\n // Factor powers of two out of denominator.\\n denominator := div(denominator, lpotdod)\\n\\n // Divide [prod1 prod0] by lpotdod.\\n prod0 := div(prod0, lpotdod)\\n\\n // Get the flipped value `2^256 / lpotdod`. If the `lpotdod` is zero, the flipped value is one.\\n // `sub(0, lpotdod)` produces the two's complement version of `lpotdod`, which is equivalent to flipping all the bits.\\n // However, `div` interprets this value as an unsigned value: https://ethereum.stackexchange.com/q/147168/24693\\n flippedLpotdod := add(div(sub(0, lpotdod), lpotdod), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * flippedLpotdod;\\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 works\\n // 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 }\\n}\\n\\n/// @notice Calculates x*y\\u00f71e18 with 512-bit precision.\\n///\\n/// @dev A variant of {mulDiv} with constant folding, i.e. in which the denominator is hard coded to 1e18.\\n///\\n/// Notes:\\n/// - The body is purposely left uncommented; to understand how this works, see the documentation in {mulDiv}.\\n/// - The result is rounded toward zero.\\n/// - We take as an axiom that the result cannot be `MAX_UINT256` when x and y solve the following system of equations:\\n///\\n/// $$\\n/// \\\\begin{cases}\\n/// x * y = MAX\\\\_UINT256 * UNIT \\\\\\\\\\n/// (x * y) \\\\% UNIT \\\\geq \\\\frac{UNIT}{2}\\n/// \\\\end{cases}\\n/// $$\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {mulDiv}.\\n/// - The result must fit in uint256.\\n///\\n/// @param x The multiplicand as an unsigned 60.18-decimal fixed-point number.\\n/// @param y The multiplier as an unsigned 60.18-decimal fixed-point number.\\n/// @return result The result as an unsigned 60.18-decimal fixed-point number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mulDiv18(uint256 x, uint256 y) pure returns (uint256 result) {\\n uint256 prod0;\\n uint256 prod1;\\n assembly (\\\"memory-safe\\\") {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n if (prod1 == 0) {\\n unchecked {\\n return prod0 / UNIT;\\n }\\n }\\n\\n if (prod1 >= UNIT) {\\n revert PRBMath_MulDiv18_Overflow(x, y);\\n }\\n\\n uint256 remainder;\\n assembly (\\\"memory-safe\\\") {\\n remainder := mulmod(x, y, UNIT)\\n result :=\\n mul(\\n or(\\n div(sub(prod0, remainder), UNIT_LPOTD),\\n mul(sub(prod1, gt(remainder, prod0)), add(div(sub(0, UNIT_LPOTD), UNIT_LPOTD), 1))\\n ),\\n UNIT_INVERSE\\n )\\n }\\n}\\n\\n/// @notice Calculates x*y\\u00f7denominator with 512-bit precision.\\n///\\n/// @dev This is an extension of {mulDiv} for signed numbers, which works by computing the signs and the absolute values separately.\\n///\\n/// Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {mulDiv}.\\n/// - None of the inputs can be `type(int256).min`.\\n/// - The result must fit in int256.\\n///\\n/// @param x The multiplicand as an int256.\\n/// @param y The multiplier as an int256.\\n/// @param denominator The divisor as an int256.\\n/// @return result The result as an int256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mulDivSigned(int256 x, int256 y, int256 denominator) pure returns (int256 result) {\\n if (x == type(int256).min || y == type(int256).min || denominator == type(int256).min) {\\n revert PRBMath_MulDivSigned_InputTooSmall();\\n }\\n\\n // Get hold of the absolute values of x, y and the denominator.\\n uint256 xAbs;\\n uint256 yAbs;\\n uint256 dAbs;\\n unchecked {\\n xAbs = x < 0 ? uint256(-x) : uint256(x);\\n yAbs = y < 0 ? uint256(-y) : uint256(y);\\n dAbs = denominator < 0 ? uint256(-denominator) : uint256(denominator);\\n }\\n\\n // Compute the absolute value of x*y\\u00f7denominator. The result must fit in int256.\\n uint256 resultAbs = mulDiv(xAbs, yAbs, dAbs);\\n if (resultAbs > uint256(type(int256).max)) {\\n revert PRBMath_MulDivSigned_Overflow(x, y);\\n }\\n\\n // Get the signs of x, y and the denominator.\\n uint256 sx;\\n uint256 sy;\\n uint256 sd;\\n assembly (\\\"memory-safe\\\") {\\n // \\\"sgt\\\" is the \\\"signed greater than\\\" assembly instruction and \\\"sub(0,1)\\\" is -1 in two's complement.\\n sx := sgt(x, sub(0, 1))\\n sy := sgt(y, sub(0, 1))\\n sd := sgt(denominator, sub(0, 1))\\n }\\n\\n // XOR over sx, sy and sd. What this does is to check whether there are 1 or 3 negative signs in the inputs.\\n // If there are, the result should be negative. Otherwise, it should be positive.\\n unchecked {\\n result = sx ^ sy ^ sd == 0 ? -int256(resultAbs) : int256(resultAbs);\\n }\\n}\\n\\n/// @notice Calculates the square root of x using the Babylonian method.\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\\n///\\n/// Notes:\\n/// - If x is not a perfect square, the result is rounded down.\\n/// - Credits to OpenZeppelin for the explanations in comments below.\\n///\\n/// @param x The uint256 number for which to calculate the square root.\\n/// @return result The result as a uint256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction sqrt(uint256 x) pure returns (uint256 result) {\\n if (x == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we calculate the biggest power of 2 which is smaller than the square root of x.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of x is a power of 2 such that we have:\\n //\\n // $$\\n // msb(x) <= x <= 2*msb(x)$\\n // $$\\n //\\n // We write $msb(x)$ as $2^k$, and we get:\\n //\\n // $$\\n // k = log_2(x)\\n // $$\\n //\\n // Thus, we can write the initial inequality as:\\n //\\n // $$\\n // 2^{log_2(x)} <= x <= 2*2^{log_2(x)+1} \\\\\\\\\\n // sqrt(2^k) <= sqrt(x) < sqrt(2^{k+1}) \\\\\\\\\\n // 2^{k/2} <= sqrt(x) < 2^{(k+1)/2} <= 2^{(k/2)+1}\\n // $$\\n //\\n // Consequently, $2^{log_2(x) /2} is a good first approximation of sqrt(x) with at least one correct bit.\\n uint256 xAux = uint256(x);\\n result = 1;\\n if (xAux >= 2 ** 128) {\\n xAux >>= 128;\\n result <<= 64;\\n }\\n if (xAux >= 2 ** 64) {\\n xAux >>= 64;\\n result <<= 32;\\n }\\n if (xAux >= 2 ** 32) {\\n xAux >>= 32;\\n result <<= 16;\\n }\\n if (xAux >= 2 ** 16) {\\n xAux >>= 16;\\n result <<= 8;\\n }\\n if (xAux >= 2 ** 8) {\\n xAux >>= 8;\\n result <<= 4;\\n }\\n if (xAux >= 2 ** 4) {\\n xAux >>= 4;\\n result <<= 2;\\n }\\n if (xAux >= 2 ** 2) {\\n result <<= 1;\\n }\\n\\n // At this point, `result` is an estimation with at least one bit of precision. We know the true value has at\\n // most 128 bits, since it is the square root of a uint256. Newton's method converges quadratically (precision\\n // doubles at every iteration). We thus need at most 7 iteration to turn our partial result with one bit of\\n // precision into the expected uint128 result.\\n unchecked {\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n\\n // If x is not a perfect square, round the result toward zero.\\n uint256 roundedResult = x / result;\\n if (result >= roundedResult) {\\n result = roundedResult;\\n }\\n }\\n}\\n\",\"keccak256\":\"0xaa374e2c26cc93e8c22a6953804ee05f811597ef5fa82f76824378b22944778b\",\"license\":\"MIT\"},\"@prb/math/src/UD2x18.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\n/*\\n\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2550\\u2550\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2554\\u2588\\u2588\\u2588\\u2588\\u2554\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551 \\u255a\\u2550\\u255d \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\n\\n\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2550\\u2550\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d \\u255a\\u2588\\u2588\\u2588\\u2554\\u255d \\u255a\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u255d\\n\\n*/\\n\\nimport \\\"./ud2x18/Casting.sol\\\";\\nimport \\\"./ud2x18/Constants.sol\\\";\\nimport \\\"./ud2x18/Errors.sol\\\";\\nimport \\\"./ud2x18/ValueType.sol\\\";\\n\",\"keccak256\":\"0xfb624e24cd8bb790fa08e7827819de85504a86e20e961fa4ad126c65b6d90641\",\"license\":\"MIT\"},\"@prb/math/src/UD60x18.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\n/*\\n\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2550\\u2550\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2554\\u2588\\u2588\\u2588\\u2588\\u2554\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551 \\u255a\\u2550\\u255d \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\n\\n\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2550\\u2588\\u2588\\u2588\\u2588\\u2557\\u255a\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2588\\u2588\\u2551 \\u255a\\u2588\\u2588\\u2588\\u2554\\u255d \\u255a\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2554\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2554\\u255d \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u255d\\n\\n*/\\n\\nimport \\\"./ud60x18/Casting.sol\\\";\\nimport \\\"./ud60x18/Constants.sol\\\";\\nimport \\\"./ud60x18/Conversions.sol\\\";\\nimport \\\"./ud60x18/Errors.sol\\\";\\nimport \\\"./ud60x18/Helpers.sol\\\";\\nimport \\\"./ud60x18/Math.sol\\\";\\nimport \\\"./ud60x18/ValueType.sol\\\";\\n\",\"keccak256\":\"0xb98c6f74275914d279e8af6c502c2b1f50d5f6e1ed418d3b0153f5a193206c48\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as CastingErrors;\\nimport { SD59x18 } from \\\"../sd59x18/ValueType.sol\\\";\\nimport { UD2x18 } from \\\"../ud2x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"../ud60x18/ValueType.sol\\\";\\nimport { SD1x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts an SD1x18 number into SD59x18.\\n/// @dev There is no overflow check because the domain of SD1x18 is a subset of SD59x18.\\nfunction intoSD59x18(SD1x18 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(int256(SD1x18.unwrap(x)));\\n}\\n\\n/// @notice Casts an SD1x18 number into UD2x18.\\n/// - x must be positive.\\nfunction intoUD2x18(SD1x18 x) pure returns (UD2x18 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUD2x18_Underflow(x);\\n }\\n result = UD2x18.wrap(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into UD60x18.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUD60x18(SD1x18 x) pure returns (UD60x18 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUD60x18_Underflow(x);\\n }\\n result = UD60x18.wrap(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into uint256.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUint256(SD1x18 x) pure returns (uint256 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint256_Underflow(x);\\n }\\n result = uint256(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into uint128.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUint128(SD1x18 x) pure returns (uint128 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint128_Underflow(x);\\n }\\n result = uint128(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(SD1x18 x) pure returns (uint40 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint40_Underflow(x);\\n }\\n if (xInt > int64(uint64(Common.MAX_UINT40))) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint40_Overflow(x);\\n }\\n result = uint40(uint64(xInt));\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction sd1x18(int64 x) pure returns (SD1x18 result) {\\n result = SD1x18.wrap(x);\\n}\\n\\n/// @notice Unwraps an SD1x18 number into int64.\\nfunction unwrap(SD1x18 x) pure returns (int64 result) {\\n result = SD1x18.unwrap(x);\\n}\\n\\n/// @notice Wraps an int64 number into SD1x18.\\nfunction wrap(int64 x) pure returns (SD1x18 result) {\\n result = SD1x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x9e49e2b37c1bb845861740805edaaef3fe951a7b96eef16ce84fbf76e8278670\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD1x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @dev Euler's number as an SD1x18 number.\\nSD1x18 constant E = SD1x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum value an SD1x18 number can have.\\nint64 constant uMAX_SD1x18 = 9_223372036854775807;\\nSD1x18 constant MAX_SD1x18 = SD1x18.wrap(uMAX_SD1x18);\\n\\n/// @dev The maximum value an SD1x18 number can have.\\nint64 constant uMIN_SD1x18 = -9_223372036854775808;\\nSD1x18 constant MIN_SD1x18 = SD1x18.wrap(uMIN_SD1x18);\\n\\n/// @dev PI as an SD1x18 number.\\nSD1x18 constant PI = SD1x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of SD1x18.\\nSD1x18 constant UNIT = SD1x18.wrap(1e18);\\nint64 constant uUNIT = 1e18;\\n\",\"keccak256\":\"0x6496165b80552785a4b65a239b96e2a5fedf62fe54f002eeed72d75e566d7585\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD1x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in UD2x18.\\nerror PRBMath_SD1x18_ToUD2x18_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in UD60x18.\\nerror PRBMath_SD1x18_ToUD60x18_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint128.\\nerror PRBMath_SD1x18_ToUint128_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint256.\\nerror PRBMath_SD1x18_ToUint256_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint40.\\nerror PRBMath_SD1x18_ToUint40_Overflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint40.\\nerror PRBMath_SD1x18_ToUint40_Underflow(SD1x18 x);\\n\",\"keccak256\":\"0x836cb42ba619ca369fd4765bc47fefc3c3621369c5861882af14660aca5057ee\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\n\\n/// @notice The signed 1.18-decimal fixed-point number representation, which can have up to 1 digit and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\\n/// type int64. This is useful when end users want to use int64 to save gas, e.g. with tight variable packing in contract\\n/// storage.\\ntype SD1x18 is int64;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoSD59x18,\\n Casting.intoUD2x18,\\n Casting.intoUD60x18,\\n Casting.intoUint256,\\n Casting.intoUint128,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for SD1x18 global;\\n\",\"keccak256\":\"0x2f86f1aa9fca42f40808b51a879b406ac51817647bdb9642f8a79dd8fdb754a7\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Errors.sol\\\" as CastingErrors;\\nimport { MAX_UINT128, MAX_UINT40 } from \\\"../Common.sol\\\";\\nimport { uMAX_SD1x18, uMIN_SD1x18 } from \\\"../sd1x18/Constants.sol\\\";\\nimport { SD1x18 } from \\\"../sd1x18/ValueType.sol\\\";\\nimport { uMAX_UD2x18 } from \\\"../ud2x18/Constants.sol\\\";\\nimport { UD2x18 } from \\\"../ud2x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"../ud60x18/ValueType.sol\\\";\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts an SD59x18 number into int256.\\n/// @dev This is basically a functional alias for {unwrap}.\\nfunction intoInt256(SD59x18 x) pure returns (int256 result) {\\n result = SD59x18.unwrap(x);\\n}\\n\\n/// @notice Casts an SD59x18 number into SD1x18.\\n/// @dev Requirements:\\n/// - x must be greater than or equal to `uMIN_SD1x18`.\\n/// - x must be less than or equal to `uMAX_SD1x18`.\\nfunction intoSD1x18(SD59x18 x) pure returns (SD1x18 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < uMIN_SD1x18) {\\n revert CastingErrors.PRBMath_SD59x18_IntoSD1x18_Underflow(x);\\n }\\n if (xInt > uMAX_SD1x18) {\\n revert CastingErrors.PRBMath_SD59x18_IntoSD1x18_Overflow(x);\\n }\\n result = SD1x18.wrap(int64(xInt));\\n}\\n\\n/// @notice Casts an SD59x18 number into UD2x18.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `uMAX_UD2x18`.\\nfunction intoUD2x18(SD59x18 x) pure returns (UD2x18 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUD2x18_Underflow(x);\\n }\\n if (xInt > int256(uint256(uMAX_UD2x18))) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUD2x18_Overflow(x);\\n }\\n result = UD2x18.wrap(uint64(uint256(xInt)));\\n}\\n\\n/// @notice Casts an SD59x18 number into UD60x18.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUD60x18(SD59x18 x) pure returns (UD60x18 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUD60x18_Underflow(x);\\n }\\n result = UD60x18.wrap(uint256(xInt));\\n}\\n\\n/// @notice Casts an SD59x18 number into uint256.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUint256(SD59x18 x) pure returns (uint256 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint256_Underflow(x);\\n }\\n result = uint256(xInt);\\n}\\n\\n/// @notice Casts an SD59x18 number into uint128.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `uMAX_UINT128`.\\nfunction intoUint128(SD59x18 x) pure returns (uint128 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint128_Underflow(x);\\n }\\n if (xInt > int256(uint256(MAX_UINT128))) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint128_Overflow(x);\\n }\\n result = uint128(uint256(xInt));\\n}\\n\\n/// @notice Casts an SD59x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(SD59x18 x) pure returns (uint40 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint40_Underflow(x);\\n }\\n if (xInt > int256(uint256(MAX_UINT40))) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint40_Overflow(x);\\n }\\n result = uint40(uint256(xInt));\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction sd(int256 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(x);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction sd59x18(int256 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(x);\\n}\\n\\n/// @notice Unwraps an SD59x18 number into int256.\\nfunction unwrap(SD59x18 x) pure returns (int256 result) {\\n result = SD59x18.unwrap(x);\\n}\\n\\n/// @notice Wraps an int256 number into SD59x18.\\nfunction wrap(int256 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x3b21b60ec2998c3ae32f647412da51d3683b3f183a807198cc8d157499484f99\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n// NOTICE: the \\\"u\\\" prefix stands for \\\"unwrapped\\\".\\n\\n/// @dev Euler's number as an SD59x18 number.\\nSD59x18 constant E = SD59x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum input permitted in {exp}.\\nint256 constant uEXP_MAX_INPUT = 133_084258667509499440;\\nSD59x18 constant EXP_MAX_INPUT = SD59x18.wrap(uEXP_MAX_INPUT);\\n\\n/// @dev Any value less than this returns 0 in {exp}.\\nint256 constant uEXP_MIN_THRESHOLD = -41_446531673892822322;\\nSD59x18 constant EXP_MIN_THRESHOLD = SD59x18.wrap(uEXP_MIN_THRESHOLD);\\n\\n/// @dev The maximum input permitted in {exp2}.\\nint256 constant uEXP2_MAX_INPUT = 192e18 - 1;\\nSD59x18 constant EXP2_MAX_INPUT = SD59x18.wrap(uEXP2_MAX_INPUT);\\n\\n/// @dev Any value less than this returns 0 in {exp2}.\\nint256 constant uEXP2_MIN_THRESHOLD = -59_794705707972522261;\\nSD59x18 constant EXP2_MIN_THRESHOLD = SD59x18.wrap(uEXP2_MIN_THRESHOLD);\\n\\n/// @dev Half the UNIT number.\\nint256 constant uHALF_UNIT = 0.5e18;\\nSD59x18 constant HALF_UNIT = SD59x18.wrap(uHALF_UNIT);\\n\\n/// @dev $log_2(10)$ as an SD59x18 number.\\nint256 constant uLOG2_10 = 3_321928094887362347;\\nSD59x18 constant LOG2_10 = SD59x18.wrap(uLOG2_10);\\n\\n/// @dev $log_2(e)$ as an SD59x18 number.\\nint256 constant uLOG2_E = 1_442695040888963407;\\nSD59x18 constant LOG2_E = SD59x18.wrap(uLOG2_E);\\n\\n/// @dev The maximum value an SD59x18 number can have.\\nint256 constant uMAX_SD59x18 = 57896044618658097711785492504343953926634992332820282019728_792003956564819967;\\nSD59x18 constant MAX_SD59x18 = SD59x18.wrap(uMAX_SD59x18);\\n\\n/// @dev The maximum whole value an SD59x18 number can have.\\nint256 constant uMAX_WHOLE_SD59x18 = 57896044618658097711785492504343953926634992332820282019728_000000000000000000;\\nSD59x18 constant MAX_WHOLE_SD59x18 = SD59x18.wrap(uMAX_WHOLE_SD59x18);\\n\\n/// @dev The minimum value an SD59x18 number can have.\\nint256 constant uMIN_SD59x18 = -57896044618658097711785492504343953926634992332820282019728_792003956564819968;\\nSD59x18 constant MIN_SD59x18 = SD59x18.wrap(uMIN_SD59x18);\\n\\n/// @dev The minimum whole value an SD59x18 number can have.\\nint256 constant uMIN_WHOLE_SD59x18 = -57896044618658097711785492504343953926634992332820282019728_000000000000000000;\\nSD59x18 constant MIN_WHOLE_SD59x18 = SD59x18.wrap(uMIN_WHOLE_SD59x18);\\n\\n/// @dev PI as an SD59x18 number.\\nSD59x18 constant PI = SD59x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of SD59x18.\\nint256 constant uUNIT = 1e18;\\nSD59x18 constant UNIT = SD59x18.wrap(1e18);\\n\\n/// @dev The unit number squared.\\nint256 constant uUNIT_SQUARED = 1e36;\\nSD59x18 constant UNIT_SQUARED = SD59x18.wrap(uUNIT_SQUARED);\\n\\n/// @dev Zero as an SD59x18 number.\\nSD59x18 constant ZERO = SD59x18.wrap(0);\\n\",\"keccak256\":\"0x9bcb8dd6b3e886d140ad1c32747a4f6d29a492529ceb835be878ae837aa6cc3a\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when taking the absolute value of `MIN_SD59x18`.\\nerror PRBMath_SD59x18_Abs_MinSD59x18();\\n\\n/// @notice Thrown when ceiling a number overflows SD59x18.\\nerror PRBMath_SD59x18_Ceil_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when converting a basic integer to the fixed-point format overflows SD59x18.\\nerror PRBMath_SD59x18_Convert_Overflow(int256 x);\\n\\n/// @notice Thrown when converting a basic integer to the fixed-point format underflows SD59x18.\\nerror PRBMath_SD59x18_Convert_Underflow(int256 x);\\n\\n/// @notice Thrown when dividing two numbers and one of them is `MIN_SD59x18`.\\nerror PRBMath_SD59x18_Div_InputTooSmall();\\n\\n/// @notice Thrown when dividing two numbers and one of the intermediary unsigned results overflows SD59x18.\\nerror PRBMath_SD59x18_Div_Overflow(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when taking the natural exponent of a base greater than 133_084258667509499441.\\nerror PRBMath_SD59x18_Exp_InputTooBig(SD59x18 x);\\n\\n/// @notice Thrown when taking the binary exponent of a base greater than 192e18.\\nerror PRBMath_SD59x18_Exp2_InputTooBig(SD59x18 x);\\n\\n/// @notice Thrown when flooring a number underflows SD59x18.\\nerror PRBMath_SD59x18_Floor_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when taking the geometric mean of two numbers and their product is negative.\\nerror PRBMath_SD59x18_Gm_NegativeProduct(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when taking the geometric mean of two numbers and multiplying them overflows SD59x18.\\nerror PRBMath_SD59x18_Gm_Overflow(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\\nerror PRBMath_SD59x18_IntoSD1x18_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\\nerror PRBMath_SD59x18_IntoSD1x18_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\\nerror PRBMath_SD59x18_IntoUD2x18_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\\nerror PRBMath_SD59x18_IntoUD2x18_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD60x18.\\nerror PRBMath_SD59x18_IntoUD60x18_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\\nerror PRBMath_SD59x18_IntoUint128_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\\nerror PRBMath_SD59x18_IntoUint128_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint256.\\nerror PRBMath_SD59x18_IntoUint256_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\\nerror PRBMath_SD59x18_IntoUint40_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\\nerror PRBMath_SD59x18_IntoUint40_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when taking the logarithm of a number less than or equal to zero.\\nerror PRBMath_SD59x18_Log_InputTooSmall(SD59x18 x);\\n\\n/// @notice Thrown when multiplying two numbers and one of the inputs is `MIN_SD59x18`.\\nerror PRBMath_SD59x18_Mul_InputTooSmall();\\n\\n/// @notice Thrown when multiplying two numbers and the intermediary absolute result overflows SD59x18.\\nerror PRBMath_SD59x18_Mul_Overflow(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when raising a number to a power and the intermediary absolute result overflows SD59x18.\\nerror PRBMath_SD59x18_Powu_Overflow(SD59x18 x, uint256 y);\\n\\n/// @notice Thrown when taking the square root of a negative number.\\nerror PRBMath_SD59x18_Sqrt_NegativeInput(SD59x18 x);\\n\\n/// @notice Thrown when the calculating the square root overflows SD59x18.\\nerror PRBMath_SD59x18_Sqrt_Overflow(SD59x18 x);\\n\",\"keccak256\":\"0xa6d00fe5efa215ac0df25c896e3da99a12fb61e799644b2ec32da947313d3db4\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Helpers.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { wrap } from \\\"./Casting.sol\\\";\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Implements the checked addition operation (+) in the SD59x18 type.\\nfunction add(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n return wrap(x.unwrap() + y.unwrap());\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the SD59x18 type.\\nfunction and(SD59x18 x, int256 bits) pure returns (SD59x18 result) {\\n return wrap(x.unwrap() & bits);\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the SD59x18 type.\\nfunction and2(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n return wrap(x.unwrap() & y.unwrap());\\n}\\n\\n/// @notice Implements the equal (=) operation in the SD59x18 type.\\nfunction eq(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() == y.unwrap();\\n}\\n\\n/// @notice Implements the greater than operation (>) in the SD59x18 type.\\nfunction gt(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() > y.unwrap();\\n}\\n\\n/// @notice Implements the greater than or equal to operation (>=) in the SD59x18 type.\\nfunction gte(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() >= y.unwrap();\\n}\\n\\n/// @notice Implements a zero comparison check function in the SD59x18 type.\\nfunction isZero(SD59x18 x) pure returns (bool result) {\\n result = x.unwrap() == 0;\\n}\\n\\n/// @notice Implements the left shift operation (<<) in the SD59x18 type.\\nfunction lshift(SD59x18 x, uint256 bits) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() << bits);\\n}\\n\\n/// @notice Implements the lower than operation (<) in the SD59x18 type.\\nfunction lt(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() < y.unwrap();\\n}\\n\\n/// @notice Implements the lower than or equal to operation (<=) in the SD59x18 type.\\nfunction lte(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() <= y.unwrap();\\n}\\n\\n/// @notice Implements the unchecked modulo operation (%) in the SD59x18 type.\\nfunction mod(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() % y.unwrap());\\n}\\n\\n/// @notice Implements the not equal operation (!=) in the SD59x18 type.\\nfunction neq(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() != y.unwrap();\\n}\\n\\n/// @notice Implements the NOT (~) bitwise operation in the SD59x18 type.\\nfunction not(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(~x.unwrap());\\n}\\n\\n/// @notice Implements the OR (|) bitwise operation in the SD59x18 type.\\nfunction or(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() | y.unwrap());\\n}\\n\\n/// @notice Implements the right shift operation (>>) in the SD59x18 type.\\nfunction rshift(SD59x18 x, uint256 bits) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() >> bits);\\n}\\n\\n/// @notice Implements the checked subtraction operation (-) in the SD59x18 type.\\nfunction sub(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() - y.unwrap());\\n}\\n\\n/// @notice Implements the checked unary minus operation (-) in the SD59x18 type.\\nfunction unary(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(-x.unwrap());\\n}\\n\\n/// @notice Implements the unchecked addition operation (+) in the SD59x18 type.\\nfunction uncheckedAdd(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() + y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the unchecked subtraction operation (-) in the SD59x18 type.\\nfunction uncheckedSub(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() - y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the unchecked unary minus operation (-) in the SD59x18 type.\\nfunction uncheckedUnary(SD59x18 x) pure returns (SD59x18 result) {\\n unchecked {\\n result = wrap(-x.unwrap());\\n }\\n}\\n\\n/// @notice Implements the XOR (^) bitwise operation in the SD59x18 type.\\nfunction xor(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() ^ y.unwrap());\\n}\\n\",\"keccak256\":\"0x208570f1657cf730cb6c3d81aa14030e0d45cf906cdedea5059369d7df4bb716\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as Errors;\\nimport {\\n uEXP_MAX_INPUT,\\n uEXP2_MAX_INPUT,\\n uEXP_MIN_THRESHOLD,\\n uEXP2_MIN_THRESHOLD,\\n uHALF_UNIT,\\n uLOG2_10,\\n uLOG2_E,\\n uMAX_SD59x18,\\n uMAX_WHOLE_SD59x18,\\n uMIN_SD59x18,\\n uMIN_WHOLE_SD59x18,\\n UNIT,\\n uUNIT,\\n uUNIT_SQUARED,\\n ZERO\\n} from \\\"./Constants.sol\\\";\\nimport { wrap } from \\\"./Helpers.sol\\\";\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Calculates the absolute value of x.\\n///\\n/// @dev Requirements:\\n/// - x must be greater than `MIN_SD59x18`.\\n///\\n/// @param x The SD59x18 number for which to calculate the absolute value.\\n/// @param result The absolute value of x as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction abs(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt == uMIN_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Abs_MinSD59x18();\\n }\\n result = xInt < 0 ? wrap(-xInt) : x;\\n}\\n\\n/// @notice Calculates the arithmetic average of x and y.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// @param x The first operand as an SD59x18 number.\\n/// @param y The second operand as an SD59x18 number.\\n/// @return result The arithmetic average as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction avg(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n\\n unchecked {\\n // This operation is equivalent to `x / 2 + y / 2`, and it can never overflow.\\n int256 sum = (xInt >> 1) + (yInt >> 1);\\n\\n if (sum < 0) {\\n // If at least one of x and y is odd, add 1 to the result, because shifting negative numbers to the right\\n // rounds toward negative infinity. The right part is equivalent to `sum + (x % 2 == 1 || y % 2 == 1)`.\\n assembly (\\\"memory-safe\\\") {\\n result := add(sum, and(or(xInt, yInt), 1))\\n }\\n } else {\\n // Add 1 if both x and y are odd to account for the double 0.5 remainder truncated after shifting.\\n result = wrap(sum + (xInt & yInt & 1));\\n }\\n }\\n}\\n\\n/// @notice Yields the smallest whole number greater than or equal to x.\\n///\\n/// @dev Optimized for fractional value inputs, because every whole value has (1e18 - 1) fractional counterparts.\\n/// See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n///\\n/// Requirements:\\n/// - x must be less than or equal to `MAX_WHOLE_SD59x18`.\\n///\\n/// @param x The SD59x18 number to ceil.\\n/// @param result The smallest whole number greater than or equal to x, as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ceil(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt > uMAX_WHOLE_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Ceil_Overflow(x);\\n }\\n\\n int256 remainder = xInt % uUNIT;\\n if (remainder == 0) {\\n result = x;\\n } else {\\n unchecked {\\n // Solidity uses C fmod style, which returns a modulus with the same sign as x.\\n int256 resultInt = xInt - remainder;\\n if (xInt > 0) {\\n resultInt += uUNIT;\\n }\\n result = wrap(resultInt);\\n }\\n }\\n}\\n\\n/// @notice Divides two SD59x18 numbers, returning a new SD59x18 number.\\n///\\n/// @dev This is an extension of {Common.mulDiv} for signed numbers, which works by computing the signs and the absolute\\n/// values separately.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv}.\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv}.\\n/// - None of the inputs can be `MIN_SD59x18`.\\n/// - The denominator must not be zero.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The numerator as an SD59x18 number.\\n/// @param y The denominator as an SD59x18 number.\\n/// @param result The quotient as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction div(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n if (xInt == uMIN_SD59x18 || yInt == uMIN_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Div_InputTooSmall();\\n }\\n\\n // Get hold of the absolute values of x and y.\\n uint256 xAbs;\\n uint256 yAbs;\\n unchecked {\\n xAbs = xInt < 0 ? uint256(-xInt) : uint256(xInt);\\n yAbs = yInt < 0 ? uint256(-yInt) : uint256(yInt);\\n }\\n\\n // Compute the absolute value (x*UNIT\\u00f7y). The resulting value must fit in SD59x18.\\n uint256 resultAbs = Common.mulDiv(xAbs, uint256(uUNIT), yAbs);\\n if (resultAbs > uint256(uMAX_SD59x18)) {\\n revert Errors.PRBMath_SD59x18_Div_Overflow(x, y);\\n }\\n\\n // Check if x and y have the same sign using two's complement representation. The left-most bit represents the sign (1 for\\n // negative, 0 for positive or zero).\\n bool sameSign = (xInt ^ yInt) > -1;\\n\\n // If the inputs have the same sign, the result should be positive. Otherwise, it should be negative.\\n unchecked {\\n result = wrap(sameSign ? int256(resultAbs) : -int256(resultAbs));\\n }\\n}\\n\\n/// @notice Calculates the natural exponent of x using the following formula:\\n///\\n/// $$\\n/// e^x = 2^{x * log_2{e}}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {exp2}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {exp2}.\\n/// - x must be less than 133_084258667509499441.\\n///\\n/// @param x The exponent as an SD59x18 number.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n\\n // Any input less than the threshold returns zero.\\n // This check also prevents an overflow for very small numbers.\\n if (xInt < uEXP_MIN_THRESHOLD) {\\n return ZERO;\\n }\\n\\n // This check prevents values greater than 192e18 from being passed to {exp2}.\\n if (xInt > uEXP_MAX_INPUT) {\\n revert Errors.PRBMath_SD59x18_Exp_InputTooBig(x);\\n }\\n\\n unchecked {\\n // Inline the fixed-point multiplication to save gas.\\n int256 doubleUnitProduct = xInt * uLOG2_E;\\n result = exp2(wrap(doubleUnitProduct / uUNIT));\\n }\\n}\\n\\n/// @notice Calculates the binary exponent of x using the binary fraction method using the following formula:\\n///\\n/// $$\\n/// 2^{-x} = \\\\frac{1}{2^x}\\n/// $$\\n///\\n/// @dev See https://ethereum.stackexchange.com/q/79903/24693.\\n///\\n/// Notes:\\n/// - If x is less than -59_794705707972522261, the result is zero.\\n///\\n/// Requirements:\\n/// - x must be less than 192e18.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The exponent as an SD59x18 number.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp2(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < 0) {\\n // The inverse of any number less than the threshold is truncated to zero.\\n if (xInt < uEXP2_MIN_THRESHOLD) {\\n return ZERO;\\n }\\n\\n unchecked {\\n // Inline the fixed-point inversion to save gas.\\n result = wrap(uUNIT_SQUARED / exp2(wrap(-xInt)).unwrap());\\n }\\n } else {\\n // Numbers greater than or equal to 192e18 don't fit in the 192.64-bit format.\\n if (xInt > uEXP2_MAX_INPUT) {\\n revert Errors.PRBMath_SD59x18_Exp2_InputTooBig(x);\\n }\\n\\n unchecked {\\n // Convert x to the 192.64-bit fixed-point format.\\n uint256 x_192x64 = uint256((xInt << 64) / uUNIT);\\n\\n // It is safe to cast the result to int256 due to the checks above.\\n result = wrap(int256(Common.exp2(x_192x64)));\\n }\\n }\\n}\\n\\n/// @notice Yields the greatest whole number less than or equal to x.\\n///\\n/// @dev Optimized for fractional value inputs, because for every whole value there are (1e18 - 1) fractional\\n/// counterparts. See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n///\\n/// Requirements:\\n/// - x must be greater than or equal to `MIN_WHOLE_SD59x18`.\\n///\\n/// @param x The SD59x18 number to floor.\\n/// @param result The greatest whole number less than or equal to x, as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction floor(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < uMIN_WHOLE_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Floor_Underflow(x);\\n }\\n\\n int256 remainder = xInt % uUNIT;\\n if (remainder == 0) {\\n result = x;\\n } else {\\n unchecked {\\n // Solidity uses C fmod style, which returns a modulus with the same sign as x.\\n int256 resultInt = xInt - remainder;\\n if (xInt < 0) {\\n resultInt -= uUNIT;\\n }\\n result = wrap(resultInt);\\n }\\n }\\n}\\n\\n/// @notice Yields the excess beyond the floor of x for positive numbers and the part of the number to the right.\\n/// of the radix point for negative numbers.\\n/// @dev Based on the odd function definition. https://en.wikipedia.org/wiki/Fractional_part\\n/// @param x The SD59x18 number to get the fractional part of.\\n/// @param result The fractional part of x as an SD59x18 number.\\nfunction frac(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() % uUNIT);\\n}\\n\\n/// @notice Calculates the geometric mean of x and y, i.e. $\\\\sqrt{x * y}$.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x * y must fit in SD59x18.\\n/// - x * y must not be negative, since complex numbers are not supported.\\n///\\n/// @param x The first operand as an SD59x18 number.\\n/// @param y The second operand as an SD59x18 number.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction gm(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n if (xInt == 0 || yInt == 0) {\\n return ZERO;\\n }\\n\\n unchecked {\\n // Equivalent to `xy / x != y`. Checking for overflow this way is faster than letting Solidity do it.\\n int256 xyInt = xInt * yInt;\\n if (xyInt / xInt != yInt) {\\n revert Errors.PRBMath_SD59x18_Gm_Overflow(x, y);\\n }\\n\\n // The product must not be negative, since complex numbers are not supported.\\n if (xyInt < 0) {\\n revert Errors.PRBMath_SD59x18_Gm_NegativeProduct(x, y);\\n }\\n\\n // We don't need to multiply the result by `UNIT` here because the x*y product picked up a factor of `UNIT`\\n // during multiplication. See the comments in {Common.sqrt}.\\n uint256 resultUint = Common.sqrt(uint256(xyInt));\\n result = wrap(int256(resultUint));\\n }\\n}\\n\\n/// @notice Calculates the inverse of x.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x must not be zero.\\n///\\n/// @param x The SD59x18 number for which to calculate the inverse.\\n/// @return result The inverse as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction inv(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(uUNIT_SQUARED / x.unwrap());\\n}\\n\\n/// @notice Calculates the natural logarithm of x using the following formula:\\n///\\n/// $$\\n/// ln{x} = log_2{x} / log_2{e}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n/// - The precision isn't sufficiently fine-grained to return exactly `UNIT` when the input is `E`.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The SD59x18 number for which to calculate the natural logarithm.\\n/// @return result The natural logarithm as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ln(SD59x18 x) pure returns (SD59x18 result) {\\n // Inline the fixed-point multiplication to save gas. This is overflow-safe because the maximum value that\\n // {log2} can return is ~195_205294292027477728.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_E);\\n}\\n\\n/// @notice Calculates the common logarithm of x using the following formula:\\n///\\n/// $$\\n/// log_{10}{x} = log_2{x} / log_2{10}\\n/// $$\\n///\\n/// However, if x is an exact power of ten, a hard coded value is returned.\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The SD59x18 number for which to calculate the common logarithm.\\n/// @return result The common logarithm as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log10(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < 0) {\\n revert Errors.PRBMath_SD59x18_Log_InputTooSmall(x);\\n }\\n\\n // Note that the `mul` in this block is the standard multiplication operation, not {SD59x18.mul}.\\n // prettier-ignore\\n assembly (\\\"memory-safe\\\") {\\n switch x\\n case 1 { result := mul(uUNIT, sub(0, 18)) }\\n case 10 { result := mul(uUNIT, sub(1, 18)) }\\n case 100 { result := mul(uUNIT, sub(2, 18)) }\\n case 1000 { result := mul(uUNIT, sub(3, 18)) }\\n case 10000 { result := mul(uUNIT, sub(4, 18)) }\\n case 100000 { result := mul(uUNIT, sub(5, 18)) }\\n case 1000000 { result := mul(uUNIT, sub(6, 18)) }\\n case 10000000 { result := mul(uUNIT, sub(7, 18)) }\\n case 100000000 { result := mul(uUNIT, sub(8, 18)) }\\n case 1000000000 { result := mul(uUNIT, sub(9, 18)) }\\n case 10000000000 { result := mul(uUNIT, sub(10, 18)) }\\n case 100000000000 { result := mul(uUNIT, sub(11, 18)) }\\n case 1000000000000 { result := mul(uUNIT, sub(12, 18)) }\\n case 10000000000000 { result := mul(uUNIT, sub(13, 18)) }\\n case 100000000000000 { result := mul(uUNIT, sub(14, 18)) }\\n case 1000000000000000 { result := mul(uUNIT, sub(15, 18)) }\\n case 10000000000000000 { result := mul(uUNIT, sub(16, 18)) }\\n case 100000000000000000 { result := mul(uUNIT, sub(17, 18)) }\\n case 1000000000000000000 { result := 0 }\\n case 10000000000000000000 { result := uUNIT }\\n case 100000000000000000000 { result := mul(uUNIT, 2) }\\n case 1000000000000000000000 { result := mul(uUNIT, 3) }\\n case 10000000000000000000000 { result := mul(uUNIT, 4) }\\n case 100000000000000000000000 { result := mul(uUNIT, 5) }\\n case 1000000000000000000000000 { result := mul(uUNIT, 6) }\\n case 10000000000000000000000000 { result := mul(uUNIT, 7) }\\n case 100000000000000000000000000 { result := mul(uUNIT, 8) }\\n case 1000000000000000000000000000 { result := mul(uUNIT, 9) }\\n case 10000000000000000000000000000 { result := mul(uUNIT, 10) }\\n case 100000000000000000000000000000 { result := mul(uUNIT, 11) }\\n case 1000000000000000000000000000000 { result := mul(uUNIT, 12) }\\n case 10000000000000000000000000000000 { result := mul(uUNIT, 13) }\\n case 100000000000000000000000000000000 { result := mul(uUNIT, 14) }\\n case 1000000000000000000000000000000000 { result := mul(uUNIT, 15) }\\n case 10000000000000000000000000000000000 { result := mul(uUNIT, 16) }\\n case 100000000000000000000000000000000000 { result := mul(uUNIT, 17) }\\n case 1000000000000000000000000000000000000 { result := mul(uUNIT, 18) }\\n case 10000000000000000000000000000000000000 { result := mul(uUNIT, 19) }\\n case 100000000000000000000000000000000000000 { result := mul(uUNIT, 20) }\\n case 1000000000000000000000000000000000000000 { result := mul(uUNIT, 21) }\\n case 10000000000000000000000000000000000000000 { result := mul(uUNIT, 22) }\\n case 100000000000000000000000000000000000000000 { result := mul(uUNIT, 23) }\\n case 1000000000000000000000000000000000000000000 { result := mul(uUNIT, 24) }\\n case 10000000000000000000000000000000000000000000 { result := mul(uUNIT, 25) }\\n case 100000000000000000000000000000000000000000000 { result := mul(uUNIT, 26) }\\n case 1000000000000000000000000000000000000000000000 { result := mul(uUNIT, 27) }\\n case 10000000000000000000000000000000000000000000000 { result := mul(uUNIT, 28) }\\n case 100000000000000000000000000000000000000000000000 { result := mul(uUNIT, 29) }\\n case 1000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 30) }\\n case 10000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 31) }\\n case 100000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 32) }\\n case 1000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 33) }\\n case 10000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 34) }\\n case 100000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 35) }\\n case 1000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 36) }\\n case 10000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 37) }\\n case 100000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 38) }\\n case 1000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 39) }\\n case 10000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 40) }\\n case 100000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 41) }\\n case 1000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 42) }\\n case 10000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 43) }\\n case 100000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 44) }\\n case 1000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 45) }\\n case 10000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 46) }\\n case 100000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 47) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 48) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 49) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 50) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 51) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 52) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 53) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 54) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 55) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 56) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 57) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 58) }\\n default { result := uMAX_SD59x18 }\\n }\\n\\n if (result.unwrap() == uMAX_SD59x18) {\\n unchecked {\\n // Inline the fixed-point division to save gas.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_10);\\n }\\n }\\n}\\n\\n/// @notice Calculates the binary logarithm of x using the iterative approximation algorithm:\\n///\\n/// $$\\n/// log_2{x} = n + log_2{y}, \\\\text{ where } y = x*2^{-n}, \\\\ y \\\\in [1, 2)\\n/// $$\\n///\\n/// For $0 \\\\leq x \\\\lt 1$, the input is inverted:\\n///\\n/// $$\\n/// log_2{x} = -log_2{\\\\frac{1}{x}}\\n/// $$\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Binary_logarithm#Iterative_approximation.\\n///\\n/// Notes:\\n/// - Due to the lossy precision of the iterative approximation, the results are not perfectly accurate to the last decimal.\\n///\\n/// Requirements:\\n/// - x must be greater than zero.\\n///\\n/// @param x The SD59x18 number for which to calculate the binary logarithm.\\n/// @return result The binary logarithm as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log2(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt <= 0) {\\n revert Errors.PRBMath_SD59x18_Log_InputTooSmall(x);\\n }\\n\\n unchecked {\\n int256 sign;\\n if (xInt >= uUNIT) {\\n sign = 1;\\n } else {\\n sign = -1;\\n // Inline the fixed-point inversion to save gas.\\n xInt = uUNIT_SQUARED / xInt;\\n }\\n\\n // Calculate the integer part of the logarithm.\\n uint256 n = Common.msb(uint256(xInt / uUNIT));\\n\\n // This is the integer part of the logarithm as an SD59x18 number. The operation can't overflow\\n // because n is at most 255, `UNIT` is 1e18, and the sign is either 1 or -1.\\n int256 resultInt = int256(n) * uUNIT;\\n\\n // Calculate $y = x * 2^{-n}$.\\n int256 y = xInt >> n;\\n\\n // If y is the unit number, the fractional part is zero.\\n if (y == uUNIT) {\\n return wrap(resultInt * sign);\\n }\\n\\n // Calculate the fractional part via the iterative approximation.\\n // The `delta >>= 1` part is equivalent to `delta /= 2`, but shifting bits is more gas efficient.\\n int256 DOUBLE_UNIT = 2e18;\\n for (int256 delta = uHALF_UNIT; delta > 0; delta >>= 1) {\\n y = (y * y) / uUNIT;\\n\\n // Is y^2 >= 2e18 and so in the range [2e18, 4e18)?\\n if (y >= DOUBLE_UNIT) {\\n // Add the 2^{-m} factor to the logarithm.\\n resultInt = resultInt + delta;\\n\\n // Halve y, which corresponds to z/2 in the Wikipedia article.\\n y >>= 1;\\n }\\n }\\n resultInt *= sign;\\n result = wrap(resultInt);\\n }\\n}\\n\\n/// @notice Multiplies two SD59x18 numbers together, returning a new SD59x18 number.\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {Common.mulDiv18}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv18}.\\n/// - None of the inputs can be `MIN_SD59x18`.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The multiplicand as an SD59x18 number.\\n/// @param y The multiplier as an SD59x18 number.\\n/// @return result The product as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mul(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n if (xInt == uMIN_SD59x18 || yInt == uMIN_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Mul_InputTooSmall();\\n }\\n\\n // Get hold of the absolute values of x and y.\\n uint256 xAbs;\\n uint256 yAbs;\\n unchecked {\\n xAbs = xInt < 0 ? uint256(-xInt) : uint256(xInt);\\n yAbs = yInt < 0 ? uint256(-yInt) : uint256(yInt);\\n }\\n\\n // Compute the absolute value (x*y\\u00f7UNIT). The resulting value must fit in SD59x18.\\n uint256 resultAbs = Common.mulDiv18(xAbs, yAbs);\\n if (resultAbs > uint256(uMAX_SD59x18)) {\\n revert Errors.PRBMath_SD59x18_Mul_Overflow(x, y);\\n }\\n\\n // Check if x and y have the same sign using two's complement representation. The left-most bit represents the sign (1 for\\n // negative, 0 for positive or zero).\\n bool sameSign = (xInt ^ yInt) > -1;\\n\\n // If the inputs have the same sign, the result should be positive. Otherwise, it should be negative.\\n unchecked {\\n result = wrap(sameSign ? int256(resultAbs) : -int256(resultAbs));\\n }\\n}\\n\\n/// @notice Raises x to the power of y using the following formula:\\n///\\n/// $$\\n/// x^y = 2^{log_2{x} * y}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {exp2}, {log2}, and {mul}.\\n/// - Returns `UNIT` for 0^0.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {exp2}, {log2}, and {mul}.\\n///\\n/// @param x The base as an SD59x18 number.\\n/// @param y Exponent to raise x to, as an SD59x18 number\\n/// @return result x raised to power y, as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction pow(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n\\n // If both x and y are zero, the result is `UNIT`. If just x is zero, the result is always zero.\\n if (xInt == 0) {\\n return yInt == 0 ? UNIT : ZERO;\\n }\\n // If x is `UNIT`, the result is always `UNIT`.\\n else if (xInt == uUNIT) {\\n return UNIT;\\n }\\n\\n // If y is zero, the result is always `UNIT`.\\n if (yInt == 0) {\\n return UNIT;\\n }\\n // If y is `UNIT`, the result is always x.\\n else if (yInt == uUNIT) {\\n return x;\\n }\\n\\n // Calculate the result using the formula.\\n result = exp2(mul(log2(x), y));\\n}\\n\\n/// @notice Raises x (an SD59x18 number) to the power y (an unsigned basic integer) using the well-known\\n/// algorithm \\\"exponentiation by squaring\\\".\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Exponentiation_by_squaring.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv18}.\\n/// - Returns `UNIT` for 0^0.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {abs} and {Common.mulDiv18}.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The base as an SD59x18 number.\\n/// @param y The exponent as a uint256.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction powu(SD59x18 x, uint256 y) pure returns (SD59x18 result) {\\n uint256 xAbs = uint256(abs(x).unwrap());\\n\\n // Calculate the first iteration of the loop in advance.\\n uint256 resultAbs = y & 1 > 0 ? xAbs : uint256(uUNIT);\\n\\n // Equivalent to `for(y /= 2; y > 0; y /= 2)`.\\n uint256 yAux = y;\\n for (yAux >>= 1; yAux > 0; yAux >>= 1) {\\n xAbs = Common.mulDiv18(xAbs, xAbs);\\n\\n // Equivalent to `y % 2 == 1`.\\n if (yAux & 1 > 0) {\\n resultAbs = Common.mulDiv18(resultAbs, xAbs);\\n }\\n }\\n\\n // The result must fit in SD59x18.\\n if (resultAbs > uint256(uMAX_SD59x18)) {\\n revert Errors.PRBMath_SD59x18_Powu_Overflow(x, y);\\n }\\n\\n unchecked {\\n // Is the base negative and the exponent odd? If yes, the result should be negative.\\n int256 resultInt = int256(resultAbs);\\n bool isNegative = x.unwrap() < 0 && y & 1 == 1;\\n if (isNegative) {\\n resultInt = -resultInt;\\n }\\n result = wrap(resultInt);\\n }\\n}\\n\\n/// @notice Calculates the square root of x using the Babylonian method.\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\\n///\\n/// Notes:\\n/// - Only the positive root is returned.\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x cannot be negative, since complex numbers are not supported.\\n/// - x must be less than `MAX_SD59x18 / UNIT`.\\n///\\n/// @param x The SD59x18 number for which to calculate the square root.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction sqrt(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < 0) {\\n revert Errors.PRBMath_SD59x18_Sqrt_NegativeInput(x);\\n }\\n if (xInt > uMAX_SD59x18 / uUNIT) {\\n revert Errors.PRBMath_SD59x18_Sqrt_Overflow(x);\\n }\\n\\n unchecked {\\n // Multiply x by `UNIT` to account for the factor of `UNIT` picked up when multiplying two SD59x18 numbers.\\n // In this case, the two numbers are both the square root.\\n uint256 resultUint = Common.sqrt(uint256(xInt * uUNIT));\\n result = wrap(int256(resultUint));\\n }\\n}\\n\",\"keccak256\":\"0xa074831139fc89ca0e5a36086b30eb50896bb6770cd5823461b1f2769017d2f0\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\nimport \\\"./Helpers.sol\\\" as Helpers;\\nimport \\\"./Math.sol\\\" as Math;\\n\\n/// @notice The signed 59.18-decimal fixed-point number representation, which can have up to 59 digits and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\\n/// type int256.\\ntype SD59x18 is int256;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoInt256,\\n Casting.intoSD1x18,\\n Casting.intoUD2x18,\\n Casting.intoUD60x18,\\n Casting.intoUint256,\\n Casting.intoUint128,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for SD59x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n MATHEMATICAL FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Math.abs,\\n Math.avg,\\n Math.ceil,\\n Math.div,\\n Math.exp,\\n Math.exp2,\\n Math.floor,\\n Math.frac,\\n Math.gm,\\n Math.inv,\\n Math.log10,\\n Math.log2,\\n Math.ln,\\n Math.mul,\\n Math.pow,\\n Math.powu,\\n Math.sqrt\\n} for SD59x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n HELPER FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Helpers.add,\\n Helpers.and,\\n Helpers.eq,\\n Helpers.gt,\\n Helpers.gte,\\n Helpers.isZero,\\n Helpers.lshift,\\n Helpers.lt,\\n Helpers.lte,\\n Helpers.mod,\\n Helpers.neq,\\n Helpers.not,\\n Helpers.or,\\n Helpers.rshift,\\n Helpers.sub,\\n Helpers.uncheckedAdd,\\n Helpers.uncheckedSub,\\n Helpers.uncheckedUnary,\\n Helpers.xor\\n} for SD59x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n OPERATORS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes it possible to use these operators on the SD59x18 type.\\nusing {\\n Helpers.add as +,\\n Helpers.and2 as &,\\n Math.div as /,\\n Helpers.eq as ==,\\n Helpers.gt as >,\\n Helpers.gte as >=,\\n Helpers.lt as <,\\n Helpers.lte as <=,\\n Helpers.mod as %,\\n Math.mul as *,\\n Helpers.neq as !=,\\n Helpers.not as ~,\\n Helpers.or as |,\\n Helpers.sub as -,\\n Helpers.unary as -,\\n Helpers.xor as ^\\n} for SD59x18 global;\\n\",\"keccak256\":\"0xe03112d145dcd5863aff24e5f381debaae29d446acd5666f3d640e3d9af738d7\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as Errors;\\nimport { uMAX_SD1x18 } from \\\"../sd1x18/Constants.sol\\\";\\nimport { SD1x18 } from \\\"../sd1x18/ValueType.sol\\\";\\nimport { SD59x18 } from \\\"../sd59x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"../ud60x18/ValueType.sol\\\";\\nimport { UD2x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts a UD2x18 number into SD1x18.\\n/// - x must be less than or equal to `uMAX_SD1x18`.\\nfunction intoSD1x18(UD2x18 x) pure returns (SD1x18 result) {\\n uint64 xUint = UD2x18.unwrap(x);\\n if (xUint > uint64(uMAX_SD1x18)) {\\n revert Errors.PRBMath_UD2x18_IntoSD1x18_Overflow(x);\\n }\\n result = SD1x18.wrap(int64(xUint));\\n}\\n\\n/// @notice Casts a UD2x18 number into SD59x18.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of SD59x18.\\nfunction intoSD59x18(UD2x18 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(int256(uint256(UD2x18.unwrap(x))));\\n}\\n\\n/// @notice Casts a UD2x18 number into UD60x18.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of UD60x18.\\nfunction intoUD60x18(UD2x18 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(UD2x18.unwrap(x));\\n}\\n\\n/// @notice Casts a UD2x18 number into uint128.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of uint128.\\nfunction intoUint128(UD2x18 x) pure returns (uint128 result) {\\n result = uint128(UD2x18.unwrap(x));\\n}\\n\\n/// @notice Casts a UD2x18 number into uint256.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of uint256.\\nfunction intoUint256(UD2x18 x) pure returns (uint256 result) {\\n result = uint256(UD2x18.unwrap(x));\\n}\\n\\n/// @notice Casts a UD2x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(UD2x18 x) pure returns (uint40 result) {\\n uint64 xUint = UD2x18.unwrap(x);\\n if (xUint > uint64(Common.MAX_UINT40)) {\\n revert Errors.PRBMath_UD2x18_IntoUint40_Overflow(x);\\n }\\n result = uint40(xUint);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction ud2x18(uint64 x) pure returns (UD2x18 result) {\\n result = UD2x18.wrap(x);\\n}\\n\\n/// @notice Unwrap a UD2x18 number into uint64.\\nfunction unwrap(UD2x18 x) pure returns (uint64 result) {\\n result = UD2x18.unwrap(x);\\n}\\n\\n/// @notice Wraps a uint64 number into UD2x18.\\nfunction wrap(uint64 x) pure returns (UD2x18 result) {\\n result = UD2x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x9b1a35d432ef951a415fae8098b3c609a99b630a3d5464b3c8e1efa8893eea07\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD2x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @dev Euler's number as a UD2x18 number.\\nUD2x18 constant E = UD2x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum value a UD2x18 number can have.\\nuint64 constant uMAX_UD2x18 = 18_446744073709551615;\\nUD2x18 constant MAX_UD2x18 = UD2x18.wrap(uMAX_UD2x18);\\n\\n/// @dev PI as a UD2x18 number.\\nUD2x18 constant PI = UD2x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of UD2x18.\\nUD2x18 constant UNIT = UD2x18.wrap(1e18);\\nuint64 constant uUNIT = 1e18;\\n\",\"keccak256\":\"0x29b0e050c865899e1fb9022b460a7829cdee248c44c4299f068ba80695eec3fc\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD2x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when trying to cast a UD2x18 number that doesn't fit in SD1x18.\\nerror PRBMath_UD2x18_IntoSD1x18_Overflow(UD2x18 x);\\n\\n/// @notice Thrown when trying to cast a UD2x18 number that doesn't fit in uint40.\\nerror PRBMath_UD2x18_IntoUint40_Overflow(UD2x18 x);\\n\",\"keccak256\":\"0xdf1e22f0b4c8032bcc8b7f63fe3984e1387f3dc7b2e9ab381822249f75376d33\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\n\\n/// @notice The unsigned 2.18-decimal fixed-point number representation, which can have up to 2 digits and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\\n/// type uint64. This is useful when end users want to use uint64 to save gas, e.g. with tight variable packing in contract\\n/// storage.\\ntype UD2x18 is uint64;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoSD1x18,\\n Casting.intoSD59x18,\\n Casting.intoUD60x18,\\n Casting.intoUint256,\\n Casting.intoUint128,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for UD2x18 global;\\n\",\"keccak256\":\"0x2802edc9869db116a0b5c490cc5f8554742f747183fa30ac5e9c80bb967e61a1\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Errors.sol\\\" as CastingErrors;\\nimport { MAX_UINT128, MAX_UINT40 } from \\\"../Common.sol\\\";\\nimport { uMAX_SD1x18 } from \\\"../sd1x18/Constants.sol\\\";\\nimport { SD1x18 } from \\\"../sd1x18/ValueType.sol\\\";\\nimport { uMAX_SD59x18 } from \\\"../sd59x18/Constants.sol\\\";\\nimport { SD59x18 } from \\\"../sd59x18/ValueType.sol\\\";\\nimport { uMAX_UD2x18 } from \\\"../ud2x18/Constants.sol\\\";\\nimport { UD2x18 } from \\\"../ud2x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts a UD60x18 number into SD1x18.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `uMAX_SD1x18`.\\nfunction intoSD1x18(UD60x18 x) pure returns (SD1x18 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > uint256(int256(uMAX_SD1x18))) {\\n revert CastingErrors.PRBMath_UD60x18_IntoSD1x18_Overflow(x);\\n }\\n result = SD1x18.wrap(int64(uint64(xUint)));\\n}\\n\\n/// @notice Casts a UD60x18 number into UD2x18.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `uMAX_UD2x18`.\\nfunction intoUD2x18(UD60x18 x) pure returns (UD2x18 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > uMAX_UD2x18) {\\n revert CastingErrors.PRBMath_UD60x18_IntoUD2x18_Overflow(x);\\n }\\n result = UD2x18.wrap(uint64(xUint));\\n}\\n\\n/// @notice Casts a UD60x18 number into SD59x18.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `uMAX_SD59x18`.\\nfunction intoSD59x18(UD60x18 x) pure returns (SD59x18 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > uint256(uMAX_SD59x18)) {\\n revert CastingErrors.PRBMath_UD60x18_IntoSD59x18_Overflow(x);\\n }\\n result = SD59x18.wrap(int256(xUint));\\n}\\n\\n/// @notice Casts a UD60x18 number into uint128.\\n/// @dev This is basically an alias for {unwrap}.\\nfunction intoUint256(UD60x18 x) pure returns (uint256 result) {\\n result = UD60x18.unwrap(x);\\n}\\n\\n/// @notice Casts a UD60x18 number into uint128.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UINT128`.\\nfunction intoUint128(UD60x18 x) pure returns (uint128 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > MAX_UINT128) {\\n revert CastingErrors.PRBMath_UD60x18_IntoUint128_Overflow(x);\\n }\\n result = uint128(xUint);\\n}\\n\\n/// @notice Casts a UD60x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(UD60x18 x) pure returns (uint40 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > MAX_UINT40) {\\n revert CastingErrors.PRBMath_UD60x18_IntoUint40_Overflow(x);\\n }\\n result = uint40(xUint);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction ud(uint256 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(x);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction ud60x18(uint256 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(x);\\n}\\n\\n/// @notice Unwraps a UD60x18 number into uint256.\\nfunction unwrap(UD60x18 x) pure returns (uint256 result) {\\n result = UD60x18.unwrap(x);\\n}\\n\\n/// @notice Wraps a uint256 number into the UD60x18 value type.\\nfunction wrap(uint256 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x5bb532da36921cbdac64d1f16de5d366ef1f664502e3b7c07d0ad06917551f85\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n// NOTICE: the \\\"u\\\" prefix stands for \\\"unwrapped\\\".\\n\\n/// @dev Euler's number as a UD60x18 number.\\nUD60x18 constant E = UD60x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum input permitted in {exp}.\\nuint256 constant uEXP_MAX_INPUT = 133_084258667509499440;\\nUD60x18 constant EXP_MAX_INPUT = UD60x18.wrap(uEXP_MAX_INPUT);\\n\\n/// @dev The maximum input permitted in {exp2}.\\nuint256 constant uEXP2_MAX_INPUT = 192e18 - 1;\\nUD60x18 constant EXP2_MAX_INPUT = UD60x18.wrap(uEXP2_MAX_INPUT);\\n\\n/// @dev Half the UNIT number.\\nuint256 constant uHALF_UNIT = 0.5e18;\\nUD60x18 constant HALF_UNIT = UD60x18.wrap(uHALF_UNIT);\\n\\n/// @dev $log_2(10)$ as a UD60x18 number.\\nuint256 constant uLOG2_10 = 3_321928094887362347;\\nUD60x18 constant LOG2_10 = UD60x18.wrap(uLOG2_10);\\n\\n/// @dev $log_2(e)$ as a UD60x18 number.\\nuint256 constant uLOG2_E = 1_442695040888963407;\\nUD60x18 constant LOG2_E = UD60x18.wrap(uLOG2_E);\\n\\n/// @dev The maximum value a UD60x18 number can have.\\nuint256 constant uMAX_UD60x18 = 115792089237316195423570985008687907853269984665640564039457_584007913129639935;\\nUD60x18 constant MAX_UD60x18 = UD60x18.wrap(uMAX_UD60x18);\\n\\n/// @dev The maximum whole value a UD60x18 number can have.\\nuint256 constant uMAX_WHOLE_UD60x18 = 115792089237316195423570985008687907853269984665640564039457_000000000000000000;\\nUD60x18 constant MAX_WHOLE_UD60x18 = UD60x18.wrap(uMAX_WHOLE_UD60x18);\\n\\n/// @dev PI as a UD60x18 number.\\nUD60x18 constant PI = UD60x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of UD60x18.\\nuint256 constant uUNIT = 1e18;\\nUD60x18 constant UNIT = UD60x18.wrap(uUNIT);\\n\\n/// @dev The unit number squared.\\nuint256 constant uUNIT_SQUARED = 1e36;\\nUD60x18 constant UNIT_SQUARED = UD60x18.wrap(uUNIT_SQUARED);\\n\\n/// @dev Zero as a UD60x18 number.\\nUD60x18 constant ZERO = UD60x18.wrap(0);\\n\",\"keccak256\":\"0x2b80d26153d3fdcfb3a9ca772d9309d31ed1275f5b8b54c3ffb54d3652b37d90\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Conversions.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { uMAX_UD60x18, uUNIT } from \\\"./Constants.sol\\\";\\nimport { PRBMath_UD60x18_Convert_Overflow } from \\\"./Errors.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Converts a UD60x18 number to a simple integer by dividing it by `UNIT`.\\n/// @dev The result is rounded toward zero.\\n/// @param x The UD60x18 number to convert.\\n/// @return result The same number in basic integer form.\\nfunction convert(UD60x18 x) pure returns (uint256 result) {\\n result = UD60x18.unwrap(x) / uUNIT;\\n}\\n\\n/// @notice Converts a simple integer to UD60x18 by multiplying it by `UNIT`.\\n///\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UD60x18 / UNIT`.\\n///\\n/// @param x The basic integer to convert.\\n/// @param result The same number converted to UD60x18.\\nfunction convert(uint256 x) pure returns (UD60x18 result) {\\n if (x > uMAX_UD60x18 / uUNIT) {\\n revert PRBMath_UD60x18_Convert_Overflow(x);\\n }\\n unchecked {\\n result = UD60x18.wrap(x * uUNIT);\\n }\\n}\\n\",\"keccak256\":\"0xaf7fc2523413822de3b66ba339fe2884fb3b8c6f6cf38ec90a2c3e3aae71df6b\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when ceiling a number overflows UD60x18.\\nerror PRBMath_UD60x18_Ceil_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when converting a basic integer to the fixed-point format overflows UD60x18.\\nerror PRBMath_UD60x18_Convert_Overflow(uint256 x);\\n\\n/// @notice Thrown when taking the natural exponent of a base greater than 133_084258667509499441.\\nerror PRBMath_UD60x18_Exp_InputTooBig(UD60x18 x);\\n\\n/// @notice Thrown when taking the binary exponent of a base greater than 192e18.\\nerror PRBMath_UD60x18_Exp2_InputTooBig(UD60x18 x);\\n\\n/// @notice Thrown when taking the geometric mean of two numbers and multiplying them overflows UD60x18.\\nerror PRBMath_UD60x18_Gm_Overflow(UD60x18 x, UD60x18 y);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\\nerror PRBMath_UD60x18_IntoSD1x18_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD59x18.\\nerror PRBMath_UD60x18_IntoSD59x18_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\\nerror PRBMath_UD60x18_IntoUD2x18_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\\nerror PRBMath_UD60x18_IntoUint128_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\\nerror PRBMath_UD60x18_IntoUint40_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when taking the logarithm of a number less than 1.\\nerror PRBMath_UD60x18_Log_InputTooSmall(UD60x18 x);\\n\\n/// @notice Thrown when calculating the square root overflows UD60x18.\\nerror PRBMath_UD60x18_Sqrt_Overflow(UD60x18 x);\\n\",\"keccak256\":\"0xa8c60d4066248df22c49c882873efbc017344107edabc48c52209abbc39cb1e3\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Helpers.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { wrap } from \\\"./Casting.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Implements the checked addition operation (+) in the UD60x18 type.\\nfunction add(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() + y.unwrap());\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the UD60x18 type.\\nfunction and(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() & bits);\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the UD60x18 type.\\nfunction and2(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() & y.unwrap());\\n}\\n\\n/// @notice Implements the equal operation (==) in the UD60x18 type.\\nfunction eq(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() == y.unwrap();\\n}\\n\\n/// @notice Implements the greater than operation (>) in the UD60x18 type.\\nfunction gt(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() > y.unwrap();\\n}\\n\\n/// @notice Implements the greater than or equal to operation (>=) in the UD60x18 type.\\nfunction gte(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() >= y.unwrap();\\n}\\n\\n/// @notice Implements a zero comparison check function in the UD60x18 type.\\nfunction isZero(UD60x18 x) pure returns (bool result) {\\n // This wouldn't work if x could be negative.\\n result = x.unwrap() == 0;\\n}\\n\\n/// @notice Implements the left shift operation (<<) in the UD60x18 type.\\nfunction lshift(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() << bits);\\n}\\n\\n/// @notice Implements the lower than operation (<) in the UD60x18 type.\\nfunction lt(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() < y.unwrap();\\n}\\n\\n/// @notice Implements the lower than or equal to operation (<=) in the UD60x18 type.\\nfunction lte(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() <= y.unwrap();\\n}\\n\\n/// @notice Implements the checked modulo operation (%) in the UD60x18 type.\\nfunction mod(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() % y.unwrap());\\n}\\n\\n/// @notice Implements the not equal operation (!=) in the UD60x18 type.\\nfunction neq(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() != y.unwrap();\\n}\\n\\n/// @notice Implements the NOT (~) bitwise operation in the UD60x18 type.\\nfunction not(UD60x18 x) pure returns (UD60x18 result) {\\n result = wrap(~x.unwrap());\\n}\\n\\n/// @notice Implements the OR (|) bitwise operation in the UD60x18 type.\\nfunction or(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() | y.unwrap());\\n}\\n\\n/// @notice Implements the right shift operation (>>) in the UD60x18 type.\\nfunction rshift(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() >> bits);\\n}\\n\\n/// @notice Implements the checked subtraction operation (-) in the UD60x18 type.\\nfunction sub(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() - y.unwrap());\\n}\\n\\n/// @notice Implements the unchecked addition operation (+) in the UD60x18 type.\\nfunction uncheckedAdd(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() + y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the unchecked subtraction operation (-) in the UD60x18 type.\\nfunction uncheckedSub(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() - y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the XOR (^) bitwise operation in the UD60x18 type.\\nfunction xor(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() ^ y.unwrap());\\n}\\n\",\"keccak256\":\"0xf5faff881391d2c060029499a666cc5f0bea90a213150bb476fae8f02a5df268\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as Errors;\\nimport { wrap } from \\\"./Casting.sol\\\";\\nimport {\\n uEXP_MAX_INPUT,\\n uEXP2_MAX_INPUT,\\n uHALF_UNIT,\\n uLOG2_10,\\n uLOG2_E,\\n uMAX_UD60x18,\\n uMAX_WHOLE_UD60x18,\\n UNIT,\\n uUNIT,\\n uUNIT_SQUARED,\\n ZERO\\n} from \\\"./Constants.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n MATHEMATICAL FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @notice Calculates the arithmetic average of x and y using the following formula:\\n///\\n/// $$\\n/// avg(x, y) = (x & y) + ((xUint ^ yUint) / 2)\\n/// $$\\n///\\n/// In English, this is what this formula does:\\n///\\n/// 1. AND x and y.\\n/// 2. Calculate half of XOR x and y.\\n/// 3. Add the two results together.\\n///\\n/// This technique is known as SWAR, which stands for \\\"SIMD within a register\\\". You can read more about it here:\\n/// https://devblogs.microsoft.com/oldnewthing/20220207-00/?p=106223\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// @param x The first operand as a UD60x18 number.\\n/// @param y The second operand as a UD60x18 number.\\n/// @return result The arithmetic average as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction avg(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n uint256 yUint = y.unwrap();\\n unchecked {\\n result = wrap((xUint & yUint) + ((xUint ^ yUint) >> 1));\\n }\\n}\\n\\n/// @notice Yields the smallest whole number greater than or equal to x.\\n///\\n/// @dev This is optimized for fractional value inputs, because for every whole value there are (1e18 - 1) fractional\\n/// counterparts. See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n///\\n/// Requirements:\\n/// - x must be less than or equal to `MAX_WHOLE_UD60x18`.\\n///\\n/// @param x The UD60x18 number to ceil.\\n/// @param result The smallest whole number greater than or equal to x, as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ceil(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n if (xUint > uMAX_WHOLE_UD60x18) {\\n revert Errors.PRBMath_UD60x18_Ceil_Overflow(x);\\n }\\n\\n assembly (\\\"memory-safe\\\") {\\n // Equivalent to `x % UNIT`.\\n let remainder := mod(x, uUNIT)\\n\\n // Equivalent to `UNIT - remainder`.\\n let delta := sub(uUNIT, remainder)\\n\\n // Equivalent to `x + remainder > 0 ? delta : 0`.\\n result := add(x, mul(delta, gt(remainder, 0)))\\n }\\n}\\n\\n/// @notice Divides two UD60x18 numbers, returning a new UD60x18 number.\\n///\\n/// @dev Uses {Common.mulDiv} to enable overflow-safe multiplication and division.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv}.\\n///\\n/// @param x The numerator as a UD60x18 number.\\n/// @param y The denominator as a UD60x18 number.\\n/// @param result The quotient as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction div(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(Common.mulDiv(x.unwrap(), uUNIT, y.unwrap()));\\n}\\n\\n/// @notice Calculates the natural exponent of x using the following formula:\\n///\\n/// $$\\n/// e^x = 2^{x * log_2{e}}\\n/// $$\\n///\\n/// @dev Requirements:\\n/// - x must be less than 133_084258667509499441.\\n///\\n/// @param x The exponent as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n // This check prevents values greater than 192e18 from being passed to {exp2}.\\n if (xUint > uEXP_MAX_INPUT) {\\n revert Errors.PRBMath_UD60x18_Exp_InputTooBig(x);\\n }\\n\\n unchecked {\\n // Inline the fixed-point multiplication to save gas.\\n uint256 doubleUnitProduct = xUint * uLOG2_E;\\n result = exp2(wrap(doubleUnitProduct / uUNIT));\\n }\\n}\\n\\n/// @notice Calculates the binary exponent of x using the binary fraction method.\\n///\\n/// @dev See https://ethereum.stackexchange.com/q/79903/24693\\n///\\n/// Requirements:\\n/// - x must be less than 192e18.\\n/// - The result must fit in UD60x18.\\n///\\n/// @param x The exponent as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp2(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n // Numbers greater than or equal to 192e18 don't fit in the 192.64-bit format.\\n if (xUint > uEXP2_MAX_INPUT) {\\n revert Errors.PRBMath_UD60x18_Exp2_InputTooBig(x);\\n }\\n\\n // Convert x to the 192.64-bit fixed-point format.\\n uint256 x_192x64 = (xUint << 64) / uUNIT;\\n\\n // Pass x to the {Common.exp2} function, which uses the 192.64-bit fixed-point number representation.\\n result = wrap(Common.exp2(x_192x64));\\n}\\n\\n/// @notice Yields the greatest whole number less than or equal to x.\\n/// @dev Optimized for fractional value inputs, because every whole value has (1e18 - 1) fractional counterparts.\\n/// See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n/// @param x The UD60x18 number to floor.\\n/// @param result The greatest whole number less than or equal to x, as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction floor(UD60x18 x) pure returns (UD60x18 result) {\\n assembly (\\\"memory-safe\\\") {\\n // Equivalent to `x % UNIT`.\\n let remainder := mod(x, uUNIT)\\n\\n // Equivalent to `x - remainder > 0 ? remainder : 0)`.\\n result := sub(x, mul(remainder, gt(remainder, 0)))\\n }\\n}\\n\\n/// @notice Yields the excess beyond the floor of x using the odd function definition.\\n/// @dev See https://en.wikipedia.org/wiki/Fractional_part.\\n/// @param x The UD60x18 number to get the fractional part of.\\n/// @param result The fractional part of x as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction frac(UD60x18 x) pure returns (UD60x18 result) {\\n assembly (\\\"memory-safe\\\") {\\n result := mod(x, uUNIT)\\n }\\n}\\n\\n/// @notice Calculates the geometric mean of x and y, i.e. $\\\\sqrt{x * y}$, rounding down.\\n///\\n/// @dev Requirements:\\n/// - x * y must fit in UD60x18.\\n///\\n/// @param x The first operand as a UD60x18 number.\\n/// @param y The second operand as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction gm(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n uint256 yUint = y.unwrap();\\n if (xUint == 0 || yUint == 0) {\\n return ZERO;\\n }\\n\\n unchecked {\\n // Checking for overflow this way is faster than letting Solidity do it.\\n uint256 xyUint = xUint * yUint;\\n if (xyUint / xUint != yUint) {\\n revert Errors.PRBMath_UD60x18_Gm_Overflow(x, y);\\n }\\n\\n // We don't need to multiply the result by `UNIT` here because the x*y product picked up a factor of `UNIT`\\n // during multiplication. See the comments in {Common.sqrt}.\\n result = wrap(Common.sqrt(xyUint));\\n }\\n}\\n\\n/// @notice Calculates the inverse of x.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x must not be zero.\\n///\\n/// @param x The UD60x18 number for which to calculate the inverse.\\n/// @return result The inverse as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction inv(UD60x18 x) pure returns (UD60x18 result) {\\n unchecked {\\n result = wrap(uUNIT_SQUARED / x.unwrap());\\n }\\n}\\n\\n/// @notice Calculates the natural logarithm of x using the following formula:\\n///\\n/// $$\\n/// ln{x} = log_2{x} / log_2{e}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n/// - The precision isn't sufficiently fine-grained to return exactly `UNIT` when the input is `E`.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The UD60x18 number for which to calculate the natural logarithm.\\n/// @return result The natural logarithm as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ln(UD60x18 x) pure returns (UD60x18 result) {\\n unchecked {\\n // Inline the fixed-point multiplication to save gas. This is overflow-safe because the maximum value that\\n // {log2} can return is ~196_205294292027477728.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_E);\\n }\\n}\\n\\n/// @notice Calculates the common logarithm of x using the following formula:\\n///\\n/// $$\\n/// log_{10}{x} = log_2{x} / log_2{10}\\n/// $$\\n///\\n/// However, if x is an exact power of ten, a hard coded value is returned.\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The UD60x18 number for which to calculate the common logarithm.\\n/// @return result The common logarithm as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log10(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n if (xUint < uUNIT) {\\n revert Errors.PRBMath_UD60x18_Log_InputTooSmall(x);\\n }\\n\\n // Note that the `mul` in this assembly block is the standard multiplication operation, not {UD60x18.mul}.\\n // prettier-ignore\\n assembly (\\\"memory-safe\\\") {\\n switch x\\n case 1 { result := mul(uUNIT, sub(0, 18)) }\\n case 10 { result := mul(uUNIT, sub(1, 18)) }\\n case 100 { result := mul(uUNIT, sub(2, 18)) }\\n case 1000 { result := mul(uUNIT, sub(3, 18)) }\\n case 10000 { result := mul(uUNIT, sub(4, 18)) }\\n case 100000 { result := mul(uUNIT, sub(5, 18)) }\\n case 1000000 { result := mul(uUNIT, sub(6, 18)) }\\n case 10000000 { result := mul(uUNIT, sub(7, 18)) }\\n case 100000000 { result := mul(uUNIT, sub(8, 18)) }\\n case 1000000000 { result := mul(uUNIT, sub(9, 18)) }\\n case 10000000000 { result := mul(uUNIT, sub(10, 18)) }\\n case 100000000000 { result := mul(uUNIT, sub(11, 18)) }\\n case 1000000000000 { result := mul(uUNIT, sub(12, 18)) }\\n case 10000000000000 { result := mul(uUNIT, sub(13, 18)) }\\n case 100000000000000 { result := mul(uUNIT, sub(14, 18)) }\\n case 1000000000000000 { result := mul(uUNIT, sub(15, 18)) }\\n case 10000000000000000 { result := mul(uUNIT, sub(16, 18)) }\\n case 100000000000000000 { result := mul(uUNIT, sub(17, 18)) }\\n case 1000000000000000000 { result := 0 }\\n case 10000000000000000000 { result := uUNIT }\\n case 100000000000000000000 { result := mul(uUNIT, 2) }\\n case 1000000000000000000000 { result := mul(uUNIT, 3) }\\n case 10000000000000000000000 { result := mul(uUNIT, 4) }\\n case 100000000000000000000000 { result := mul(uUNIT, 5) }\\n case 1000000000000000000000000 { result := mul(uUNIT, 6) }\\n case 10000000000000000000000000 { result := mul(uUNIT, 7) }\\n case 100000000000000000000000000 { result := mul(uUNIT, 8) }\\n case 1000000000000000000000000000 { result := mul(uUNIT, 9) }\\n case 10000000000000000000000000000 { result := mul(uUNIT, 10) }\\n case 100000000000000000000000000000 { result := mul(uUNIT, 11) }\\n case 1000000000000000000000000000000 { result := mul(uUNIT, 12) }\\n case 10000000000000000000000000000000 { result := mul(uUNIT, 13) }\\n case 100000000000000000000000000000000 { result := mul(uUNIT, 14) }\\n case 1000000000000000000000000000000000 { result := mul(uUNIT, 15) }\\n case 10000000000000000000000000000000000 { result := mul(uUNIT, 16) }\\n case 100000000000000000000000000000000000 { result := mul(uUNIT, 17) }\\n case 1000000000000000000000000000000000000 { result := mul(uUNIT, 18) }\\n case 10000000000000000000000000000000000000 { result := mul(uUNIT, 19) }\\n case 100000000000000000000000000000000000000 { result := mul(uUNIT, 20) }\\n case 1000000000000000000000000000000000000000 { result := mul(uUNIT, 21) }\\n case 10000000000000000000000000000000000000000 { result := mul(uUNIT, 22) }\\n case 100000000000000000000000000000000000000000 { result := mul(uUNIT, 23) }\\n case 1000000000000000000000000000000000000000000 { result := mul(uUNIT, 24) }\\n case 10000000000000000000000000000000000000000000 { result := mul(uUNIT, 25) }\\n case 100000000000000000000000000000000000000000000 { result := mul(uUNIT, 26) }\\n case 1000000000000000000000000000000000000000000000 { result := mul(uUNIT, 27) }\\n case 10000000000000000000000000000000000000000000000 { result := mul(uUNIT, 28) }\\n case 100000000000000000000000000000000000000000000000 { result := mul(uUNIT, 29) }\\n case 1000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 30) }\\n case 10000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 31) }\\n case 100000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 32) }\\n case 1000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 33) }\\n case 10000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 34) }\\n case 100000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 35) }\\n case 1000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 36) }\\n case 10000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 37) }\\n case 100000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 38) }\\n case 1000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 39) }\\n case 10000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 40) }\\n case 100000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 41) }\\n case 1000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 42) }\\n case 10000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 43) }\\n case 100000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 44) }\\n case 1000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 45) }\\n case 10000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 46) }\\n case 100000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 47) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 48) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 49) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 50) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 51) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 52) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 53) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 54) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 55) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 56) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 57) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 58) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 59) }\\n default { result := uMAX_UD60x18 }\\n }\\n\\n if (result.unwrap() == uMAX_UD60x18) {\\n unchecked {\\n // Inline the fixed-point division to save gas.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_10);\\n }\\n }\\n}\\n\\n/// @notice Calculates the binary logarithm of x using the iterative approximation algorithm:\\n///\\n/// $$\\n/// log_2{x} = n + log_2{y}, \\\\text{ where } y = x*2^{-n}, \\\\ y \\\\in [1, 2)\\n/// $$\\n///\\n/// For $0 \\\\leq x \\\\lt 1$, the input is inverted:\\n///\\n/// $$\\n/// log_2{x} = -log_2{\\\\frac{1}{x}}\\n/// $$\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Binary_logarithm#Iterative_approximation\\n///\\n/// Notes:\\n/// - Due to the lossy precision of the iterative approximation, the results are not perfectly accurate to the last decimal.\\n///\\n/// Requirements:\\n/// - x must be greater than zero.\\n///\\n/// @param x The UD60x18 number for which to calculate the binary logarithm.\\n/// @return result The binary logarithm as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log2(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n if (xUint < uUNIT) {\\n revert Errors.PRBMath_UD60x18_Log_InputTooSmall(x);\\n }\\n\\n unchecked {\\n // Calculate the integer part of the logarithm.\\n uint256 n = Common.msb(xUint / uUNIT);\\n\\n // This is the integer part of the logarithm as a UD60x18 number. The operation can't overflow because n\\n // n is at most 255 and UNIT is 1e18.\\n uint256 resultUint = n * uUNIT;\\n\\n // Calculate $y = x * 2^{-n}$.\\n uint256 y = xUint >> n;\\n\\n // If y is the unit number, the fractional part is zero.\\n if (y == uUNIT) {\\n return wrap(resultUint);\\n }\\n\\n // Calculate the fractional part via the iterative approximation.\\n // The `delta >>= 1` part is equivalent to `delta /= 2`, but shifting bits is more gas efficient.\\n uint256 DOUBLE_UNIT = 2e18;\\n for (uint256 delta = uHALF_UNIT; delta > 0; delta >>= 1) {\\n y = (y * y) / uUNIT;\\n\\n // Is y^2 >= 2e18 and so in the range [2e18, 4e18)?\\n if (y >= DOUBLE_UNIT) {\\n // Add the 2^{-m} factor to the logarithm.\\n resultUint += delta;\\n\\n // Halve y, which corresponds to z/2 in the Wikipedia article.\\n y >>= 1;\\n }\\n }\\n result = wrap(resultUint);\\n }\\n}\\n\\n/// @notice Multiplies two UD60x18 numbers together, returning a new UD60x18 number.\\n///\\n/// @dev Uses {Common.mulDiv} to enable overflow-safe multiplication and division.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv}.\\n///\\n/// @dev See the documentation in {Common.mulDiv18}.\\n/// @param x The multiplicand as a UD60x18 number.\\n/// @param y The multiplier as a UD60x18 number.\\n/// @return result The product as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mul(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(Common.mulDiv18(x.unwrap(), y.unwrap()));\\n}\\n\\n/// @notice Raises x to the power of y.\\n///\\n/// For $1 \\\\leq x \\\\leq \\\\infty$, the following standard formula is used:\\n///\\n/// $$\\n/// x^y = 2^{log_2{x} * y}\\n/// $$\\n///\\n/// For $0 \\\\leq x \\\\lt 1$, since the unsigned {log2} is undefined, an equivalent formula is used:\\n///\\n/// $$\\n/// i = \\\\frac{1}{x}\\n/// w = 2^{log_2{i} * y}\\n/// x^y = \\\\frac{1}{w}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2} and {mul}.\\n/// - Returns `UNIT` for 0^0.\\n/// - It may not perform well with very small values of x. Consider using SD59x18 as an alternative.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {exp2}, {log2}, and {mul}.\\n///\\n/// @param x The base as a UD60x18 number.\\n/// @param y The exponent as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction pow(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n uint256 yUint = y.unwrap();\\n\\n // If both x and y are zero, the result is `UNIT`. If just x is zero, the result is always zero.\\n if (xUint == 0) {\\n return yUint == 0 ? UNIT : ZERO;\\n }\\n // If x is `UNIT`, the result is always `UNIT`.\\n else if (xUint == uUNIT) {\\n return UNIT;\\n }\\n\\n // If y is zero, the result is always `UNIT`.\\n if (yUint == 0) {\\n return UNIT;\\n }\\n // If y is `UNIT`, the result is always x.\\n else if (yUint == uUNIT) {\\n return x;\\n }\\n\\n // If x is greater than `UNIT`, use the standard formula.\\n if (xUint > uUNIT) {\\n result = exp2(mul(log2(x), y));\\n }\\n // Conversely, if x is less than `UNIT`, use the equivalent formula.\\n else {\\n UD60x18 i = wrap(uUNIT_SQUARED / xUint);\\n UD60x18 w = exp2(mul(log2(i), y));\\n result = wrap(uUNIT_SQUARED / w.unwrap());\\n }\\n}\\n\\n/// @notice Raises x (a UD60x18 number) to the power y (an unsigned basic integer) using the well-known\\n/// algorithm \\\"exponentiation by squaring\\\".\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Exponentiation_by_squaring.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv18}.\\n/// - Returns `UNIT` for 0^0.\\n///\\n/// Requirements:\\n/// - The result must fit in UD60x18.\\n///\\n/// @param x The base as a UD60x18 number.\\n/// @param y The exponent as a uint256.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction powu(UD60x18 x, uint256 y) pure returns (UD60x18 result) {\\n // Calculate the first iteration of the loop in advance.\\n uint256 xUint = x.unwrap();\\n uint256 resultUint = y & 1 > 0 ? xUint : uUNIT;\\n\\n // Equivalent to `for(y /= 2; y > 0; y /= 2)`.\\n for (y >>= 1; y > 0; y >>= 1) {\\n xUint = Common.mulDiv18(xUint, xUint);\\n\\n // Equivalent to `y % 2 == 1`.\\n if (y & 1 > 0) {\\n resultUint = Common.mulDiv18(resultUint, xUint);\\n }\\n }\\n result = wrap(resultUint);\\n}\\n\\n/// @notice Calculates the square root of x using the Babylonian method.\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\\n///\\n/// Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x must be less than `MAX_UD60x18 / UNIT`.\\n///\\n/// @param x The UD60x18 number for which to calculate the square root.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction sqrt(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n unchecked {\\n if (xUint > uMAX_UD60x18 / uUNIT) {\\n revert Errors.PRBMath_UD60x18_Sqrt_Overflow(x);\\n }\\n // Multiply x by `UNIT` to account for the factor of `UNIT` picked up when multiplying two UD60x18 numbers.\\n // In this case, the two numbers are both the square root.\\n result = wrap(Common.sqrt(xUint * uUNIT));\\n }\\n}\\n\",\"keccak256\":\"0x462144667aac3f96d5f8dba7aa68fe4c5a3f61e1d7bbbc81bee21168817f9c09\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\nimport \\\"./Helpers.sol\\\" as Helpers;\\nimport \\\"./Math.sol\\\" as Math;\\n\\n/// @notice The unsigned 60.18-decimal fixed-point number representation, which can have up to 60 digits and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the Solidity type uint256.\\n/// @dev The value type is defined here so it can be imported in all other files.\\ntype UD60x18 is uint256;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoSD1x18,\\n Casting.intoUD2x18,\\n Casting.intoSD59x18,\\n Casting.intoUint128,\\n Casting.intoUint256,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for UD60x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n MATHEMATICAL FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes the functions in this library callable on the UD60x18 type.\\nusing {\\n Math.avg,\\n Math.ceil,\\n Math.div,\\n Math.exp,\\n Math.exp2,\\n Math.floor,\\n Math.frac,\\n Math.gm,\\n Math.inv,\\n Math.ln,\\n Math.log10,\\n Math.log2,\\n Math.mul,\\n Math.pow,\\n Math.powu,\\n Math.sqrt\\n} for UD60x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n HELPER FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes the functions in this library callable on the UD60x18 type.\\nusing {\\n Helpers.add,\\n Helpers.and,\\n Helpers.eq,\\n Helpers.gt,\\n Helpers.gte,\\n Helpers.isZero,\\n Helpers.lshift,\\n Helpers.lt,\\n Helpers.lte,\\n Helpers.mod,\\n Helpers.neq,\\n Helpers.not,\\n Helpers.or,\\n Helpers.rshift,\\n Helpers.sub,\\n Helpers.uncheckedAdd,\\n Helpers.uncheckedSub,\\n Helpers.xor\\n} for UD60x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n OPERATORS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes it possible to use these operators on the UD60x18 type.\\nusing {\\n Helpers.add as +,\\n Helpers.and2 as &,\\n Math.div as /,\\n Helpers.eq as ==,\\n Helpers.gt as >,\\n Helpers.gte as >=,\\n Helpers.lt as <,\\n Helpers.lte as <=,\\n Helpers.or as |,\\n Helpers.mod as %,\\n Math.mul as *,\\n Helpers.neq as !=,\\n Helpers.not as ~,\\n Helpers.sub as -,\\n Helpers.xor as ^\\n} for UD60x18 global;\\n\",\"keccak256\":\"0xdd873b5124180d9b71498b3a7fe93b1c08c368bec741f7d5f8e17f78a0b70f31\",\"license\":\"MIT\"},\"contracts/interfaces/IERC6551Registry.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\ninterface IERC6551Registry {\\n /**\\n * @dev Creates a token bound account for a non-fungible token.\\n *\\n * If account has already been created, returns the account address without calling create2.\\n *\\n * Emits ERC6551AccountCreated event.\\n *\\n * @return account The address of the token bound account\\n */\\n function createAccount(\\n address implementation,\\n bytes32 salt,\\n uint256 chainId,\\n address tokenContract,\\n uint256 tokenId\\n ) external returns (address account);\\n}\\n\",\"keccak256\":\"0x64c52de8a8e68398e61dd8b42dda8e9af8cf6abf93bb85629c322440991ea568\",\"license\":\"MIT\"},\"contracts/interfaces/hats/HatsErrors.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface HatsErrors {\\n /// @notice Emitted when `user` is attempting to perform an action on `hatId` but is not wearing one of `hatId`'s admin hats\\n /// @dev Can be equivalent to `NotHatWearer(buildHatId(hatId))`, such as when emitted by `approveLinkTopHatToTree` or `relinkTopHatToTree`\\n error NotAdmin(address user, uint256 hatId);\\n\\n /// @notice Emitted when attempting to perform an action as or for an account that is not a wearer of a given hat\\n error NotHatWearer();\\n\\n /// @notice Emitted when attempting to perform an action that requires being either an admin or wearer of a given hat\\n error NotAdminOrWearer();\\n\\n /// @notice Emitted when attempting to mint `hatId` but `hatId`'s maxSupply has been reached\\n error AllHatsWorn(uint256 hatId);\\n\\n /// @notice Emitted when attempting to create a hat with a level 14 hat as its admin\\n error MaxLevelsReached();\\n\\n /// @notice Emitted when an attempted hat id has empty intermediate level(s)\\n error InvalidHatId();\\n\\n /// @notice Emitted when attempting to mint `hatId` to a `wearer` who is already wearing the hat\\n error AlreadyWearingHat(address wearer, uint256 hatId);\\n\\n /// @notice Emitted when attempting to mint a non-existant hat\\n error HatDoesNotExist(uint256 hatId);\\n\\n /// @notice Emmitted when attempting to mint or transfer a hat that is not active\\n error HatNotActive();\\n\\n /// @notice Emitted when attempting to mint or transfer a hat to an ineligible wearer\\n error NotEligible();\\n\\n /// @notice Emitted when attempting to check or set a hat's status from an account that is not that hat's toggle module\\n error NotHatsToggle();\\n\\n /// @notice Emitted when attempting to check or set a hat wearer's status from an account that is not that hat's eligibility module\\n error NotHatsEligibility();\\n\\n /// @notice Emitted when array arguments to a batch function have mismatching lengths\\n error BatchArrayLengthMismatch();\\n\\n /// @notice Emitted when attempting to mutate or transfer an immutable hat\\n error Immutable();\\n\\n /// @notice Emitted when attempting to change a hat's maxSupply to a value lower than its current supply\\n error NewMaxSupplyTooLow();\\n\\n /// @notice Emitted when attempting to link a tophat to a new admin for which the tophat serves as an admin\\n error CircularLinkage();\\n\\n /// @notice Emitted when attempting to link or relink a tophat to a separate tree\\n error CrossTreeLinkage();\\n\\n /// @notice Emitted when attempting to link a tophat without a request\\n error LinkageNotRequested();\\n\\n /// @notice Emitted when attempting to unlink a tophat that does not have a wearer\\n /// @dev This ensures that unlinking never results in a bricked tophat\\n error InvalidUnlink();\\n\\n /// @notice Emmited when attempting to change a hat's eligibility or toggle module to the zero address\\n error ZeroAddress();\\n\\n /// @notice Emmitted when attempting to change a hat's details or imageURI to a string with over 7000 bytes (~characters)\\n /// @dev This protects against a DOS attack where an admin iteratively extend's a hat's details or imageURI\\n /// to be so long that reading it exceeds the block gas limit, breaking `uri()` and `viewHat()`\\n error StringTooLong();\\n}\\n\",\"keccak256\":\"0x81b0056b7bed86eabc07c0e4a9655c586ddb8e6c128320593669b76efd5a08de\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/HatsEvents.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface HatsEvents {\\n /// @notice Emitted when a new hat is created\\n /// @param id The id for the new hat\\n /// @param details A description of the Hat\\n /// @param maxSupply The total instances of the Hat that can be worn at once\\n /// @param eligibility The address that can report on the Hat wearer's status\\n /// @param toggle The address that can deactivate the Hat\\n /// @param mutable_ Whether the hat's properties are changeable after creation\\n /// @param imageURI The image uri for this hat and the fallback for its\\n event HatCreated(\\n uint256 id,\\n string details,\\n uint32 maxSupply,\\n address eligibility,\\n address toggle,\\n bool mutable_,\\n string imageURI\\n );\\n\\n /// @notice Emitted when a hat wearer's standing is updated\\n /// @dev Eligibility is excluded since the source of truth for eligibility is the eligibility module and may change without a transaction\\n /// @param hatId The id of the wearer's hat\\n /// @param wearer The wearer's address\\n /// @param wearerStanding Whether the wearer is in good standing for the hat\\n event WearerStandingChanged(\\n uint256 hatId,\\n address wearer,\\n bool wearerStanding\\n );\\n\\n /// @notice Emitted when a hat's status is updated\\n /// @param hatId The id of the hat\\n /// @param newStatus Whether the hat is active\\n event HatStatusChanged(uint256 hatId, bool newStatus);\\n\\n /// @notice Emitted when a hat's details are updated\\n /// @param hatId The id of the hat\\n /// @param newDetails The updated details\\n event HatDetailsChanged(uint256 hatId, string newDetails);\\n\\n /// @notice Emitted when a hat's eligibility module is updated\\n /// @param hatId The id of the hat\\n /// @param newEligibility The updated eligibiliy module\\n event HatEligibilityChanged(uint256 hatId, address newEligibility);\\n\\n /// @notice Emitted when a hat's toggle module is updated\\n /// @param hatId The id of the hat\\n /// @param newToggle The updated toggle module\\n event HatToggleChanged(uint256 hatId, address newToggle);\\n\\n /// @notice Emitted when a hat's mutability is updated\\n /// @param hatId The id of the hat\\n event HatMutabilityChanged(uint256 hatId);\\n\\n /// @notice Emitted when a hat's maximum supply is updated\\n /// @param hatId The id of the hat\\n /// @param newMaxSupply The updated max supply\\n event HatMaxSupplyChanged(uint256 hatId, uint32 newMaxSupply);\\n\\n /// @notice Emitted when a hat's image URI is updated\\n /// @param hatId The id of the hat\\n /// @param newImageURI The updated image URI\\n event HatImageURIChanged(uint256 hatId, string newImageURI);\\n\\n /// @notice Emitted when a tophat linkage is requested by its admin\\n /// @param domain The domain of the tree tophat to link\\n /// @param newAdmin The tophat's would-be admin in the parent tree\\n event TopHatLinkRequested(uint32 domain, uint256 newAdmin);\\n\\n /// @notice Emitted when a tophat is linked to a another tree\\n /// @param domain The domain of the newly-linked tophat\\n /// @param newAdmin The tophat's new admin in the parent tree\\n event TopHatLinked(uint32 domain, uint256 newAdmin);\\n}\\n\",\"keccak256\":\"0x53413397d15e1636c3cd7bd667656b79bc2886785403b824bcd4ed122667f2c6\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/IHats.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\nimport \\\"./IHatsIdUtilities.sol\\\";\\nimport \\\"./HatsErrors.sol\\\";\\nimport \\\"./HatsEvents.sol\\\";\\n\\ninterface IHats is IHatsIdUtilities, HatsErrors, HatsEvents {\\n function mintTopHat(\\n address _target,\\n string memory _details,\\n string memory _imageURI\\n ) external returns (uint256 topHatId);\\n\\n function createHat(\\n uint256 _admin,\\n string calldata _details,\\n uint32 _maxSupply,\\n address _eligibility,\\n address _toggle,\\n bool _mutable,\\n string calldata _imageURI\\n ) external returns (uint256 newHatId);\\n\\n function batchCreateHats(\\n uint256[] calldata _admins,\\n string[] calldata _details,\\n uint32[] calldata _maxSupplies,\\n address[] memory _eligibilityModules,\\n address[] memory _toggleModules,\\n bool[] calldata _mutables,\\n string[] calldata _imageURIs\\n ) external returns (bool success);\\n\\n function getNextId(uint256 _admin) external view returns (uint256 nextId);\\n\\n function mintHat(\\n uint256 _hatId,\\n address _wearer\\n ) external returns (bool success);\\n\\n function batchMintHats(\\n uint256[] calldata _hatIds,\\n address[] calldata _wearers\\n ) external returns (bool success);\\n\\n function setHatStatus(\\n uint256 _hatId,\\n bool _newStatus\\n ) external returns (bool toggled);\\n\\n function checkHatStatus(uint256 _hatId) external returns (bool toggled);\\n\\n function setHatWearerStatus(\\n uint256 _hatId,\\n address _wearer,\\n bool _eligible,\\n bool _standing\\n ) external returns (bool updated);\\n\\n function checkHatWearerStatus(\\n uint256 _hatId,\\n address _wearer\\n ) external returns (bool updated);\\n\\n function renounceHat(uint256 _hatId) external;\\n\\n function transferHat(uint256 _hatId, address _from, address _to) external;\\n\\n /*//////////////////////////////////////////////////////////////\\n HATS ADMIN FUNCTIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n function makeHatImmutable(uint256 _hatId) external;\\n\\n function changeHatDetails(\\n uint256 _hatId,\\n string memory _newDetails\\n ) external;\\n\\n function changeHatEligibility(\\n uint256 _hatId,\\n address _newEligibility\\n ) external;\\n\\n function changeHatToggle(uint256 _hatId, address _newToggle) external;\\n\\n function changeHatImageURI(\\n uint256 _hatId,\\n string memory _newImageURI\\n ) external;\\n\\n function changeHatMaxSupply(uint256 _hatId, uint32 _newMaxSupply) external;\\n\\n function requestLinkTopHatToTree(\\n uint32 _topHatId,\\n uint256 _newAdminHat\\n ) external;\\n\\n function approveLinkTopHatToTree(\\n uint32 _topHatId,\\n uint256 _newAdminHat,\\n address _eligibility,\\n address _toggle,\\n string calldata _details,\\n string calldata _imageURI\\n ) external;\\n\\n function unlinkTopHatFromTree(uint32 _topHatId, address _wearer) external;\\n\\n function relinkTopHatWithinTree(\\n uint32 _topHatDomain,\\n uint256 _newAdminHat,\\n address _eligibility,\\n address _toggle,\\n string calldata _details,\\n string calldata _imageURI\\n ) external;\\n\\n /*//////////////////////////////////////////////////////////////\\n VIEW FUNCTIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n function viewHat(\\n uint256 _hatId\\n )\\n external\\n view\\n returns (\\n string memory details,\\n uint32 maxSupply,\\n uint32 supply,\\n address eligibility,\\n address toggle,\\n string memory imageURI,\\n uint16 lastHatId,\\n bool mutable_,\\n bool active\\n );\\n\\n function isWearerOfHat(\\n address _user,\\n uint256 _hatId\\n ) external view returns (bool isWearer);\\n\\n function isAdminOfHat(\\n address _user,\\n uint256 _hatId\\n ) external view returns (bool isAdmin);\\n\\n function isInGoodStanding(\\n address _wearer,\\n uint256 _hatId\\n ) external view returns (bool standing);\\n\\n function isEligible(\\n address _wearer,\\n uint256 _hatId\\n ) external view returns (bool eligible);\\n\\n function getHatEligibilityModule(\\n uint256 _hatId\\n ) external view returns (address eligibility);\\n\\n function getHatToggleModule(\\n uint256 _hatId\\n ) external view returns (address toggle);\\n\\n function getHatMaxSupply(\\n uint256 _hatId\\n ) external view returns (uint32 maxSupply);\\n\\n function hatSupply(uint256 _hatId) external view returns (uint32 supply);\\n\\n function getImageURIForHat(\\n uint256 _hatId\\n ) external view returns (string memory _uri);\\n\\n function balanceOf(\\n address wearer,\\n uint256 hatId\\n ) external view returns (uint256 balance);\\n\\n function balanceOfBatch(\\n address[] calldata _wearers,\\n uint256[] calldata _hatIds\\n ) external view returns (uint256[] memory);\\n\\n function uri(uint256 id) external view returns (string memory _uri);\\n}\\n\",\"keccak256\":\"0x2867004bddc5148fa1937f25c0403e5d9977583aaf50fdbdb74bd463f64f21c8\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/IHatsIdUtilities.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface IHatsIdUtilities {\\n function buildHatId(\\n uint256 _admin,\\n uint16 _newHat\\n ) external pure returns (uint256 id);\\n\\n function getHatLevel(uint256 _hatId) external view returns (uint32 level);\\n\\n function getLocalHatLevel(\\n uint256 _hatId\\n ) external pure returns (uint32 level);\\n\\n function isTopHat(uint256 _hatId) external view returns (bool _topHat);\\n\\n function isLocalTopHat(\\n uint256 _hatId\\n ) external pure returns (bool _localTopHat);\\n\\n function isValidHatId(\\n uint256 _hatId\\n ) external view returns (bool validHatId);\\n\\n function getAdminAtLevel(\\n uint256 _hatId,\\n uint32 _level\\n ) external view returns (uint256 admin);\\n\\n function getAdminAtLocalLevel(\\n uint256 _hatId,\\n uint32 _level\\n ) external pure returns (uint256 admin);\\n\\n function getTopHatDomain(\\n uint256 _hatId\\n ) external view returns (uint32 domain);\\n\\n function getTippyTopHatDomain(\\n uint32 _topHatDomain\\n ) external view returns (uint32 domain);\\n\\n function noCircularLinkage(\\n uint32 _topHatDomain,\\n uint256 _linkedAdmin\\n ) external view returns (bool notCircular);\\n\\n function sameTippyTopHatDomain(\\n uint32 _topHatDomain,\\n uint256 _newAdminHat\\n ) external view returns (bool sameDomain);\\n}\\n\",\"keccak256\":\"0x007fcc07b20bf84bacad1f9a2ddf4e30e1a8be961e144b7bef8e98a51781aee9\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/IHatsModuleFactory.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.19;\\n\\ninterface IHatsModuleFactory {\\n error HatsModuleFactory_ModuleAlreadyDeployed(\\n address implementation,\\n uint256 hatId,\\n bytes otherImmutableArgs,\\n uint256 saltNonce\\n );\\n\\n error BatchArrayLengthMismatch();\\n\\n event HatsModuleFactory_ModuleDeployed(\\n address implementation,\\n address instance,\\n uint256 hatId,\\n bytes otherImmutableArgs,\\n bytes initData,\\n uint256 saltNonce\\n );\\n\\n function HATS() external view returns (address);\\n\\n function version() external view returns (string memory);\\n\\n function createHatsModule(\\n address _implementation,\\n uint256 _hatId,\\n bytes calldata _otherImmutableArgs,\\n bytes calldata _initData,\\n uint256 _saltNonce\\n ) external returns (address _instance);\\n\\n function batchCreateHatsModule(\\n address[] calldata _implementations,\\n uint256[] calldata _hatIds,\\n bytes[] calldata _otherImmutableArgsArray,\\n bytes[] calldata _initDataArray,\\n uint256[] calldata _saltNonces\\n ) external returns (bool success);\\n\\n function getHatsModuleAddress(\\n address _implementation,\\n uint256 _hatId,\\n bytes calldata _otherImmutableArgs,\\n uint256 _saltNonce\\n ) external view returns (address);\\n\\n function deployed(\\n address _implementation,\\n uint256 _hatId,\\n bytes calldata _otherImmutableArgs,\\n uint256 _saltNonce\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x861faf40785cedb829243116d492653414a367853408a5c27d201522f6c3bfdd\",\"license\":\"MIT\"},\"contracts/interfaces/sablier/IAdminable.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\n/// @title IAdminable\\n/// @notice Contract module that provides a basic access control mechanism, with an admin that can be\\n/// granted exclusive access to specific functions. The inheriting contract must set the initial admin\\n/// in the constructor.\\ninterface IAdminable {\\n /*//////////////////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Emitted when the admin is transferred.\\n /// @param oldAdmin The address of the old admin.\\n /// @param newAdmin The address of the new admin.\\n event TransferAdmin(address indexed oldAdmin, address indexed newAdmin);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice The address of the admin account or contract.\\n function admin() external view returns (address);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n NON-CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Transfers the contract admin to a new address.\\n ///\\n /// @dev Notes:\\n /// - Does not revert if the admin is the same.\\n /// - This function can potentially leave the contract without an admin, thereby removing any\\n /// functionality that is only available to the admin.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the contract admin.\\n ///\\n /// @param newAdmin The address of the new admin.\\n function transferAdmin(address newAdmin) external;\\n}\\n\",\"keccak256\":\"0xa279c49e51228b571329164e36250e82b2c1378e8b549194ab7dd90fca9c3b2b\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/IERC4096.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 \\\"@openzeppelin/contracts/interfaces/IERC165.sol\\\";\\nimport {IERC721} from \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\n\\n/// @title ERC-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\",\"keccak256\":\"0xa34b9c52cbe36be860244f52256f1b05badf0cb797d208664b87337610d0e82d\",\"license\":\"MIT\"},\"contracts/interfaces/sablier/ISablierV2Lockup.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC4906} from \\\"./IERC4096.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IERC721Metadata} from \\\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\\\";\\nimport {UD60x18} from \\\"@prb/math/src/UD60x18.sol\\\";\\n\\nimport {Lockup} from \\\"./types/DataTypes.sol\\\";\\nimport {IAdminable} from \\\"./IAdminable.sol\\\";\\nimport {ISablierV2NFTDescriptor} from \\\"./ISablierV2NFTDescriptor.sol\\\";\\n\\n/// @title ISablierV2Lockup\\n/// @notice Common logic between all Sablier V2 Lockup contracts.\\ninterface ISablierV2Lockup is\\n IAdminable, // 0 inherited components\\n IERC4906, // 2 inherited components\\n IERC721Metadata // 2 inherited components\\n{\\n /*//////////////////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Emitted when the admin allows a new recipient contract to hook to Sablier.\\n /// @param admin The address of the current contract admin.\\n /// @param recipient The address of the recipient contract put on the allowlist.\\n event AllowToHook(address indexed admin, address recipient);\\n\\n /// @notice Emitted when a stream is canceled.\\n /// @param streamId The ID of the stream.\\n /// @param sender The address of the stream's sender.\\n /// @param recipient The address of the stream's recipient.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param senderAmount The amount of assets refunded to the stream's sender, denoted in units of the asset's\\n /// decimals.\\n /// @param recipientAmount The amount of assets left for the stream's recipient to withdraw, denoted in units of the\\n /// asset's decimals.\\n event CancelLockupStream(\\n uint256 streamId,\\n address indexed sender,\\n address indexed recipient,\\n IERC20 indexed asset,\\n uint128 senderAmount,\\n uint128 recipientAmount\\n );\\n\\n /// @notice Emitted when a sender gives up the right to cancel a stream.\\n /// @param streamId The ID of the stream.\\n event RenounceLockupStream(uint256 indexed streamId);\\n\\n /// @notice Emitted when the admin sets a new NFT descriptor contract.\\n /// @param admin The address of the current contract admin.\\n /// @param oldNFTDescriptor The address of the old NFT descriptor contract.\\n /// @param newNFTDescriptor The address of the new NFT descriptor contract.\\n event SetNFTDescriptor(\\n address indexed admin,\\n ISablierV2NFTDescriptor oldNFTDescriptor,\\n ISablierV2NFTDescriptor newNFTDescriptor\\n );\\n\\n /// @notice Emitted when assets are withdrawn from a stream.\\n /// @param streamId The ID of the stream.\\n /// @param to The address that has received the withdrawn assets.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param amount The amount of assets withdrawn, denoted in units of the asset's decimals.\\n event WithdrawFromLockupStream(\\n uint256 indexed streamId,\\n address indexed to,\\n IERC20 indexed asset,\\n uint128 amount\\n );\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Retrieves the address of the ERC-20 asset to be distributed.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getAsset(uint256 streamId) external view returns (IERC20 asset);\\n\\n /// @notice Retrieves the amount deposited in the stream, denoted in units of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getDepositedAmount(\\n uint256 streamId\\n ) external view returns (uint128 depositedAmount);\\n\\n /// @notice Retrieves the stream's end time, which is a Unix timestamp.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getEndTime(\\n uint256 streamId\\n ) external view returns (uint40 endTime);\\n\\n /// @notice Retrieves the stream's recipient.\\n /// @dev Reverts if the NFT has been burned.\\n /// @param streamId The stream ID for the query.\\n function getRecipient(\\n uint256 streamId\\n ) external view returns (address recipient);\\n\\n /// @notice Retrieves the amount refunded to the sender after a cancellation, denoted in units of the asset's\\n /// decimals. This amount is always zero unless the stream was canceled.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getRefundedAmount(\\n uint256 streamId\\n ) external view returns (uint128 refundedAmount);\\n\\n /// @notice Retrieves the stream's sender.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getSender(uint256 streamId) external view returns (address sender);\\n\\n /// @notice Retrieves the stream's start time, which is a Unix timestamp.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getStartTime(\\n uint256 streamId\\n ) external view returns (uint40 startTime);\\n\\n /// @notice Retrieves the amount withdrawn from the stream, denoted in units of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getWithdrawnAmount(\\n uint256 streamId\\n ) external view returns (uint128 withdrawnAmount);\\n\\n /// @notice Retrieves a flag indicating whether the provided address is a contract allowed to hook to Sablier\\n /// when a stream is canceled or when assets are withdrawn.\\n /// @dev See {ISablierLockupRecipient} for more information.\\n function isAllowedToHook(\\n address recipient\\n ) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream can be canceled. When the stream is cold, this\\n /// flag is always `false`.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isCancelable(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream is cold, i.e. settled, canceled, or depleted.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isCold(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream is depleted.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isDepleted(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream exists.\\n /// @dev Does not revert if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isStream(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream NFT can be transferred.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isTransferable(\\n uint256 streamId\\n ) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream is warm, i.e. either pending or streaming.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isWarm(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves the maximum broker fee that can be charged by the broker, denoted as a fixed-point\\n /// number where 1e18 is 100%.\\n /// @dev This value is hard coded as a constant.\\n function MAX_BROKER_FEE() external view returns (UD60x18);\\n\\n /// @notice Counter for stream IDs, used in the create functions.\\n function nextStreamId() external view returns (uint256);\\n\\n /// @notice Contract that generates the non-fungible token URI.\\n function nftDescriptor() external view returns (ISablierV2NFTDescriptor);\\n\\n /// @notice Calculates the amount that the sender would be refunded if the stream were canceled, denoted in units\\n /// of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function refundableAmountOf(\\n uint256 streamId\\n ) external view returns (uint128 refundableAmount);\\n\\n /// @notice Retrieves the stream's status.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function statusOf(\\n uint256 streamId\\n ) external view returns (Lockup.Status status);\\n\\n /// @notice Calculates the amount streamed to the recipient, denoted in units of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n ///\\n /// Notes:\\n /// - Upon cancellation of the stream, the amount streamed is calculated as the difference between the deposited\\n /// amount and the refunded amount. Ultimately, when the stream becomes depleted, the streamed amount is equivalent\\n /// to the total amount withdrawn.\\n ///\\n /// @param streamId The stream ID for the query.\\n function streamedAmountOf(\\n uint256 streamId\\n ) external view returns (uint128 streamedAmount);\\n\\n /// @notice Retrieves a flag indicating whether the stream was canceled.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function wasCanceled(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Calculates the amount that the recipient can withdraw from the stream, denoted in units of the asset's\\n /// decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function withdrawableAmountOf(\\n uint256 streamId\\n ) external view returns (uint128 withdrawableAmount);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n NON-CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Allows a recipient contract to hook to Sablier when a stream is canceled or when assets are withdrawn.\\n /// Useful for implementing contracts that hold streams on behalf of users, such as vaults or staking contracts.\\n ///\\n /// @dev Emits an {AllowToHook} event.\\n ///\\n /// Notes:\\n /// - Does not revert if the contract is already on the allowlist.\\n /// - This is an irreversible operation. The contract cannot be removed from the allowlist.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the contract admin.\\n /// - `recipient` must have a non-zero code size.\\n /// - `recipient` must implement {ISablierLockupRecipient}.\\n ///\\n /// @param recipient The address of the contract to allow for hooks.\\n function allowToHook(address recipient) external;\\n\\n /// @notice Burns the NFT associated with the stream.\\n ///\\n /// @dev Emits a {Transfer} event.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `streamId` must reference a depleted stream.\\n /// - The NFT must exist.\\n /// - `msg.sender` must be either the NFT owner or an approved third party.\\n ///\\n /// @param streamId The ID of the stream NFT to burn.\\n function burn(uint256 streamId) external;\\n\\n /// @notice Cancels the stream and refunds any remaining assets to the sender.\\n ///\\n /// @dev Emits a {Transfer}, {CancelLockupStream}, and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - If there any assets left for the recipient to withdraw, the stream is marked as canceled. Otherwise, the\\n /// stream is marked as depleted.\\n /// - This function attempts to invoke a hook on the recipient, if the resolved address is a contract.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - The stream must be warm and cancelable.\\n /// - `msg.sender` must be the stream's sender.\\n ///\\n /// @param streamId The ID of the stream to cancel.\\n function cancel(uint256 streamId) external;\\n\\n /// @notice Cancels multiple streams and refunds any remaining assets to the sender.\\n ///\\n /// @dev Emits multiple {Transfer}, {CancelLockupStream}, and {MetadataUpdate} events.\\n ///\\n /// Notes:\\n /// - Refer to the notes in {cancel}.\\n ///\\n /// Requirements:\\n /// - All requirements from {cancel} must be met for each stream.\\n ///\\n /// @param streamIds The IDs of the streams to cancel.\\n function cancelMultiple(uint256[] calldata streamIds) external;\\n\\n /// @notice Removes the right of the stream's sender to cancel the stream.\\n ///\\n /// @dev Emits a {RenounceLockupStream} and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - This is an irreversible operation.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `streamId` must reference a warm stream.\\n /// - `msg.sender` must be the stream's sender.\\n /// - The stream must be cancelable.\\n ///\\n /// @param streamId The ID of the stream to renounce.\\n function renounce(uint256 streamId) external;\\n\\n /// @notice Sets a new NFT descriptor contract, which produces the URI describing the Sablier stream NFTs.\\n ///\\n /// @dev Emits a {SetNFTDescriptor} and {BatchMetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - Does not revert if the NFT descriptor is the same.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the contract admin.\\n ///\\n /// @param newNFTDescriptor The address of the new NFT descriptor contract.\\n function setNFTDescriptor(\\n ISablierV2NFTDescriptor newNFTDescriptor\\n ) external;\\n\\n /// @notice Withdraws the provided amount of assets from the stream to the `to` address.\\n ///\\n /// @dev Emits a {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - This function attempts to call a hook on the recipient of the stream, unless `msg.sender` is the recipient.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `streamId` must not reference a null or depleted stream.\\n /// - `to` must not be the zero address.\\n /// - `amount` must be greater than zero and must not exceed the withdrawable amount.\\n /// - `to` must be the recipient if `msg.sender` is not the stream's recipient or an approved third party.\\n ///\\n /// @param streamId The ID of the stream to withdraw from.\\n /// @param to The address receiving the withdrawn assets.\\n /// @param amount The amount to withdraw, denoted in units of the asset's decimals.\\n function withdraw(uint256 streamId, address to, uint128 amount) external;\\n\\n /// @notice Withdraws the maximum withdrawable amount from the stream to the provided address `to`.\\n ///\\n /// @dev Emits a {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - Refer to the notes in {withdraw}.\\n ///\\n /// Requirements:\\n /// - Refer to the requirements in {withdraw}.\\n ///\\n /// @param streamId The ID of the stream to withdraw from.\\n /// @param to The address receiving the withdrawn assets.\\n /// @return withdrawnAmount The amount withdrawn, denoted in units of the asset's decimals.\\n function withdrawMax(\\n uint256 streamId,\\n address to\\n ) external returns (uint128 withdrawnAmount);\\n\\n /// @notice Withdraws the maximum withdrawable amount from the stream to the current recipient, and transfers the\\n /// NFT to `newRecipient`.\\n ///\\n /// @dev Emits a {WithdrawFromLockupStream} and a {Transfer} event.\\n ///\\n /// Notes:\\n /// - If the withdrawable amount is zero, the withdrawal is skipped.\\n /// - Refer to the notes in {withdraw}.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the stream's recipient.\\n /// - Refer to the requirements in {withdraw}.\\n /// - Refer to the requirements in {IERC721.transferFrom}.\\n ///\\n /// @param streamId The ID of the stream NFT to transfer.\\n /// @param newRecipient The address of the new owner of the stream NFT.\\n /// @return withdrawnAmount The amount withdrawn, denoted in units of the asset's decimals.\\n function withdrawMaxAndTransfer(\\n uint256 streamId,\\n address newRecipient\\n ) external returns (uint128 withdrawnAmount);\\n\\n /// @notice Withdraws assets from streams to the recipient of each stream.\\n ///\\n /// @dev Emits multiple {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} events.\\n ///\\n /// Notes:\\n /// - This function attempts to call a hook on the recipient of each stream, unless `msg.sender` is the recipient.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - There must be an equal number of `streamIds` and `amounts`.\\n /// - Each stream ID in the array must not reference a null or depleted stream.\\n /// - Each amount in the array must be greater than zero and must not exceed the withdrawable amount.\\n ///\\n /// @param streamIds The IDs of the streams to withdraw from.\\n /// @param amounts The amounts to withdraw, denoted in units of the asset's decimals.\\n function withdrawMultiple(\\n uint256[] calldata streamIds,\\n uint128[] calldata amounts\\n ) external;\\n}\\n\",\"keccak256\":\"0x3e5541c38a901637bd310965deb5bbde73ef07fe4ee3c752cbec330c6b9d62a3\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/ISablierV2LockupLinear.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\nimport {Lockup, LockupLinear} from \\\"./types/DataTypes.sol\\\";\\nimport {ISablierV2Lockup} from \\\"./ISablierV2Lockup.sol\\\";\\n\\n/// @title ISablierV2LockupLinear\\n/// @notice Creates and manages Lockup streams with a linear distribution function.\\ninterface ISablierV2LockupLinear is ISablierV2Lockup {\\n /*//////////////////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Emitted when a stream is created.\\n /// @param streamId The ID of the newly created stream.\\n /// @param funder The address which funded the stream.\\n /// @param sender The address distributing the assets, which will have the ability to cancel the stream.\\n /// @param recipient The address receiving the assets.\\n /// @param amounts Struct encapsulating (i) the deposit amount, and (ii) the broker fee amount, both denoted\\n /// in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Boolean indicating whether the stream will be cancelable or not.\\n /// @param transferable Boolean indicating whether the stream NFT is transferable or not.\\n /// @param timestamps Struct encapsulating (i) the stream's start time, (ii) cliff time, and (iii) end time, all as\\n /// Unix timestamps.\\n /// @param broker The address of the broker who has helped create the stream, e.g. a front-end website.\\n event CreateLockupLinearStream(\\n uint256 streamId,\\n address funder,\\n address indexed sender,\\n address indexed recipient,\\n Lockup.CreateAmounts amounts,\\n IERC20 indexed asset,\\n bool cancelable,\\n bool transferable,\\n LockupLinear.Timestamps timestamps,\\n address broker\\n );\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Retrieves the stream's cliff time, which is a Unix timestamp. A value of zero means there\\n /// is no cliff.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getCliffTime(\\n uint256 streamId\\n ) external view returns (uint40 cliffTime);\\n\\n /// @notice Retrieves the full stream details.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n /// @return stream See the documentation in {DataTypes}.\\n function getStream(\\n uint256 streamId\\n ) external view returns (LockupLinear.StreamLL memory stream);\\n\\n /// @notice Retrieves the stream's start, cliff and end timestamps.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n /// @return timestamps See the documentation in {DataTypes}.\\n function getTimestamps(\\n uint256 streamId\\n ) external view returns (LockupLinear.Timestamps memory timestamps);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n NON-CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Creates a stream by setting the start time to `block.timestamp`, and the end time to\\n /// the sum of `block.timestamp` and `params.durations.total`. The stream is funded by `msg.sender` and is wrapped\\n /// in an ERC-721 NFT.\\n ///\\n /// @dev Emits a {Transfer} and {CreateLockupLinearStream} event.\\n ///\\n /// Requirements:\\n /// - All requirements in {createWithTimestamps} must be met for the calculated parameters.\\n ///\\n /// @param params Struct encapsulating the function parameters, which are documented in {DataTypes}.\\n /// @return streamId The ID of the newly created stream.\\n function createWithDurations(\\n LockupLinear.CreateWithDurations calldata params\\n ) external returns (uint256 streamId);\\n\\n /// @notice Creates a stream with the provided start time and end time. The stream is funded by `msg.sender` and is\\n /// wrapped in an ERC-721 NFT.\\n ///\\n /// @dev Emits a {Transfer} and {CreateLockupLinearStream} event.\\n ///\\n /// Notes:\\n /// - A cliff time of zero means there is no cliff.\\n /// - As long as the times are ordered, it is not an error for the start or the cliff time to be in the past.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `params.totalAmount` must be greater than zero.\\n /// - If set, `params.broker.fee` must not be greater than `MAX_BROKER_FEE`.\\n /// - `params.timestamps.start` must be greater than zero and less than `params.timestamps.end`.\\n /// - If set, `params.timestamps.cliff` must be greater than `params.timestamps.start` and less than\\n /// `params.timestamps.end`.\\n /// - `params.timestamps.end` must be in the future.\\n /// - `params.recipient` must not be the zero address.\\n /// - `msg.sender` must have allowed this contract to spend at least `params.totalAmount` assets.\\n ///\\n /// @param params Struct encapsulating the function parameters, which are documented in {DataTypes}.\\n /// @return streamId The ID of the newly created stream.\\n function createWithTimestamps(\\n LockupLinear.CreateWithTimestamps calldata params\\n ) external returns (uint256 streamId);\\n}\\n\",\"keccak256\":\"0x064264723114b1f1cf3953fd79874dfcbb42cf313857aee6d5e6b09a23e0010b\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/ISablierV2NFTDescriptor.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC721Metadata} from \\\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\\\";\\n\\n/// @title ISablierV2NFTDescriptor\\n/// @notice This contract generates the URI describing the Sablier V2 stream NFTs.\\n/// @dev Inspired by Uniswap V3 Positions NFTs.\\ninterface ISablierV2NFTDescriptor {\\n /// @notice Produces the URI describing a particular stream NFT.\\n /// @dev This is a data URI with the JSON contents directly inlined.\\n /// @param sablier The address of the Sablier contract the stream was created in.\\n /// @param streamId The ID of the stream for which to produce a description.\\n /// @return uri The URI of the ERC721-compliant metadata.\\n function tokenURI(\\n IERC721Metadata sablier,\\n uint256 streamId\\n ) external view returns (string memory uri);\\n}\\n\",\"keccak256\":\"0x4ed430e553d14161e93efdaaacd1a502f49b38969c9d714b45d2e682a74fa0bc\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/types/DataTypes.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {UD2x18} from \\\"@prb/math/src/UD2x18.sol\\\";\\nimport {UD60x18} from \\\"@prb/math/src/UD60x18.sol\\\";\\n\\n// DataTypes.sol\\n//\\n// This file defines all structs used in V2 Core, most of which are organized under three namespaces:\\n//\\n// - Lockup\\n// - LockupDynamic\\n// - LockupLinear\\n// - LockupTranched\\n//\\n// You will notice that some structs contain \\\"slot\\\" annotations - they are used to indicate the\\n// storage layout of the struct. It is more gas efficient to group small data types together so\\n// that they fit in a single 32-byte slot.\\n\\n/// @notice Struct encapsulating the broker parameters passed to the create functions. Both can be set to zero.\\n/// @param account The address receiving the broker's fee.\\n/// @param fee The broker's percentage fee from the total amount, denoted as a fixed-point number where 1e18 is 100%.\\nstruct Broker {\\n address account;\\n UD60x18 fee;\\n}\\n\\n/// @notice Namespace for the structs used in both {SablierV2LockupLinear} and {SablierV2LockupDynamic}.\\nlibrary Lockup {\\n /// @notice Struct encapsulating the deposit, withdrawn, and refunded amounts, all denoted in units of the asset's\\n /// decimals.\\n /// @dev Because the deposited and the withdrawn amount are often read together, declaring them in the same slot\\n /// saves gas.\\n /// @param deposited The initial amount deposited in the stream, net of broker fee.\\n /// @param withdrawn The cumulative amount withdrawn from the stream.\\n /// @param refunded The amount refunded to the sender. Unless the stream was canceled, this is always zero.\\n struct Amounts {\\n // slot 0\\n uint128 deposited;\\n uint128 withdrawn;\\n // slot 1\\n uint128 refunded;\\n }\\n\\n /// @notice Struct encapsulating (i) the deposit amount and (ii) the broker fee amount, both denoted in units of the\\n /// asset's decimals.\\n /// @param deposit The amount to deposit in the stream.\\n /// @param brokerFee The broker fee amount.\\n struct CreateAmounts {\\n uint128 deposit;\\n uint128 brokerFee;\\n }\\n\\n /// @notice Enum representing the different statuses of a stream.\\n /// @custom:value0 PENDING Stream created but not started; assets are in a pending state.\\n /// @custom:value1 STREAMING Active stream where assets are currently being streamed.\\n /// @custom:value2 SETTLED All assets have been streamed; recipient is due to withdraw them.\\n /// @custom:value3 CANCELED Canceled stream; remaining assets await recipient's withdrawal.\\n /// @custom:value4 DEPLETED Depleted stream; all assets have been withdrawn and/or refunded.\\n enum Status {\\n PENDING,\\n STREAMING,\\n SETTLED,\\n CANCELED,\\n DEPLETED\\n }\\n\\n /// @notice A common data structure to be stored in all {SablierV2Lockup} models.\\n /// @dev The fields are arranged like this to save gas via tight variable packing.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream.\\n /// @param startTime The Unix timestamp indicating the stream's start.\\n /// @param endTime The Unix timestamp indicating the stream's end.\\n /// @param isCancelable Boolean indicating if the stream is cancelable.\\n /// @param wasCanceled Boolean indicating if the stream was canceled.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param isDepleted Boolean indicating if the stream is depleted.\\n /// @param isStream Boolean indicating if the struct entity exists.\\n /// @param isTransferable Boolean indicating if the stream NFT is transferable.\\n /// @param amounts Struct encapsulating the deposit, withdrawn, and refunded amounts, all denoted in units of the\\n /// asset's decimals.\\n struct Stream {\\n // slot 0\\n address sender;\\n uint40 startTime;\\n uint40 endTime;\\n bool isCancelable;\\n bool wasCanceled;\\n // slot 1\\n IERC20 asset;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n // slot 2 and 3\\n Lockup.Amounts amounts;\\n }\\n}\\n\\n/// @notice Namespace for the structs used in {SablierV2LockupDynamic}.\\nlibrary LockupDynamic {\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupDynamic.createWithDurations} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param segments Segments with durations used to compose the dynamic distribution function. Timestamps are\\n /// calculated by starting from `block.timestamp` and adding each duration to the previous timestamp.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithDurations {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n SegmentWithDuration[] segments;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupDynamic.createWithTimestamps} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param startTime The Unix timestamp indicating the stream's start.\\n /// @param segments Segments used to compose the dynamic distribution function.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithTimestamps {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n uint40 startTime;\\n Segment[] segments;\\n Broker broker;\\n }\\n\\n /// @notice Segment struct used in the Lockup Dynamic stream.\\n /// @param amount The amount of assets to be streamed in the segment, denoted in units of the asset's decimals.\\n /// @param exponent The exponent of the segment, denoted as a fixed-point number.\\n /// @param timestamp The Unix timestamp indicating the segment's end.\\n struct Segment {\\n // slot 0\\n uint128 amount;\\n UD2x18 exponent;\\n uint40 timestamp;\\n }\\n\\n /// @notice Segment struct used at runtime in {SablierV2LockupDynamic.createWithDurations}.\\n /// @param amount The amount of assets to be streamed in the segment, denoted in units of the asset's decimals.\\n /// @param exponent The exponent of the segment, denoted as a fixed-point number.\\n /// @param duration The time difference in seconds between the segment and the previous one.\\n struct SegmentWithDuration {\\n uint128 amount;\\n UD2x18 exponent;\\n uint40 duration;\\n }\\n\\n /// @notice Struct encapsulating the full details of a stream.\\n /// @dev Extends `Lockup.Stream` by including the recipient and the segments.\\n struct StreamLD {\\n address sender;\\n address recipient;\\n uint40 startTime;\\n uint40 endTime;\\n bool isCancelable;\\n bool wasCanceled;\\n IERC20 asset;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n Lockup.Amounts amounts;\\n Segment[] segments;\\n }\\n\\n /// @notice Struct encapsulating the LockupDynamic timestamps.\\n /// @param start The Unix timestamp indicating the stream's start.\\n /// @param end The Unix timestamp indicating the stream's end.\\n struct Timestamps {\\n uint40 start;\\n uint40 end;\\n }\\n}\\n\\n/// @notice Namespace for the structs used in {SablierV2LockupLinear}.\\nlibrary LockupLinear {\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupLinear.createWithDurations} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param durations Struct encapsulating (i) cliff period duration and (ii) total stream duration, both in seconds.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithDurations {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n Durations durations;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupLinear.createWithTimestamps} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param timestamps Struct encapsulating (i) the stream's start time, (ii) cliff time, and (iii) end time, all as\\n /// Unix timestamps.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithTimestamps {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n Timestamps timestamps;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the cliff duration and the total duration.\\n /// @param cliff The cliff duration in seconds.\\n /// @param total The total duration in seconds.\\n struct Durations {\\n uint40 cliff;\\n uint40 total;\\n }\\n\\n /// @notice Struct encapsulating the full details of a stream.\\n /// @dev Extends `Lockup.Stream` by including the recipient and the cliff time.\\n struct StreamLL {\\n address sender;\\n address recipient;\\n uint40 startTime;\\n bool isCancelable;\\n bool wasCanceled;\\n IERC20 asset;\\n uint40 endTime;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n Lockup.Amounts amounts;\\n uint40 cliffTime;\\n }\\n\\n /// @notice Struct encapsulating the LockupLinear timestamps.\\n /// @param start The Unix timestamp for the stream's start.\\n /// @param cliff The Unix timestamp for the cliff period's end. A value of zero means there is no cliff.\\n /// @param end The Unix timestamp for the stream's end.\\n struct Timestamps {\\n uint40 start;\\n uint40 cliff;\\n uint40 end;\\n }\\n}\\n\\n/// @notice Namespace for the structs used in {SablierV2LockupTranched}.\\nlibrary LockupTranched {\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupTranched.createWithDurations} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param tranches Tranches with durations used to compose the tranched distribution function. Timestamps are\\n /// calculated by starting from `block.timestamp` and adding each duration to the previous timestamp.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithDurations {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n TrancheWithDuration[] tranches;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupTranched.createWithTimestamps} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param startTime The Unix timestamp indicating the stream's start.\\n /// @param tranches Tranches used to compose the tranched distribution function.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithTimestamps {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n uint40 startTime;\\n Tranche[] tranches;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the full details of a stream.\\n /// @dev Extends `Lockup.Stream` by including the recipient and the tranches.\\n struct StreamLT {\\n address sender;\\n address recipient;\\n uint40 startTime;\\n uint40 endTime;\\n bool isCancelable;\\n bool wasCanceled;\\n IERC20 asset;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n Lockup.Amounts amounts;\\n Tranche[] tranches;\\n }\\n\\n /// @notice Struct encapsulating the LockupTranched timestamps.\\n /// @param start The Unix timestamp indicating the stream's start.\\n /// @param end The Unix timestamp indicating the stream's end.\\n struct Timestamps {\\n uint40 start;\\n uint40 end;\\n }\\n\\n /// @notice Tranche struct used in the Lockup Tranched stream.\\n /// @param amount The amount of assets to be unlocked in the tranche, denoted in units of the asset's decimals.\\n /// @param timestamp The Unix timestamp indicating the tranche's end.\\n struct Tranche {\\n // slot 0\\n uint128 amount;\\n uint40 timestamp;\\n }\\n\\n /// @notice Tranche struct used at runtime in {SablierV2LockupTranched.createWithDurations}.\\n /// @param amount The amount of assets to be unlocked in the tranche, denoted in units of the asset's decimals.\\n /// @param duration The time difference in seconds between the tranche and the previous one.\\n struct TrancheWithDuration {\\n uint128 amount;\\n uint40 duration;\\n }\\n}\\n\",\"keccak256\":\"0x727722c0ec71a76a947b935c9dfcac8fd846d6c3547dfbc8739c7109f3b95068\",\"license\":\"GPL-3.0-or-later\"},\"contracts/modules/DecentHatsModificationModule.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.28;\\n\\nimport {DecentHatsModuleUtils} from \\\"./DecentHatsModuleUtils.sol\\\";\\n\\ncontract DecentHatsModificationModule is DecentHatsModuleUtils {\\n /**\\n * @notice Creates a new termed or untermed role hat and any streams on it.\\n *\\n * @notice This contract should be enabled a module on the Safe for which the role is to be created, and disabled after.\\n *\\n * @dev Stream funds on untermed Roles are targeted at the hat's smart account. In order to withdraw funds from the stream, the\\n * hat's smart account must be the one call to `withdraw-` on the Sablier contract, setting the recipient arg to its wearer.\\n *\\n * @dev Stream funds on termed Roles are targeted directly at the nominated wearer.\\n * The wearer should directly call `withdraw-` on the Sablier contract.\\n *\\n * @dev Role hat creation, minting, smart account creation and stream creation are handled here in order\\n * to avoid a race condition where not more than one active proposal to create a new role can exist at a time.\\n * See: https://github.com/decentdao/decent-interface/issues/2402\\n *\\n * @param roleHatsParams An array of params for each role hat to be created.\\n */\\n function createRoleHats(\\n CreateRoleHatsParams calldata roleHatsParams\\n ) external {\\n _processRoleHats(roleHatsParams);\\n }\\n}\\n\",\"keccak256\":\"0x45b9470e000a416382deebea44a8c8734a2d6b453e8c7fbba5ea9bc6fdd4917c\",\"license\":\"MIT\"},\"contracts/modules/DecentHatsModuleUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.28;\\n\\nimport {Enum} from \\\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\\\";\\nimport {IAvatar} from \\\"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IERC6551Registry} from \\\"../interfaces/IERC6551Registry.sol\\\";\\nimport {IHats} from \\\"../interfaces/hats/IHats.sol\\\";\\nimport {LockupLinear, Broker} from \\\"../interfaces/sablier/types/DataTypes.sol\\\";\\nimport {IHatsModuleFactory} from \\\"../interfaces/hats/IHatsModuleFactory.sol\\\";\\nimport {ISablierV2LockupLinear} from \\\"../interfaces/sablier/ISablierV2LockupLinear.sol\\\";\\n\\nabstract contract DecentHatsModuleUtils {\\n bytes32 public constant SALT =\\n 0x5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b5072;\\n\\n struct SablierStreamParams {\\n ISablierV2LockupLinear sablier;\\n address sender;\\n address asset;\\n LockupLinear.Timestamps timestamps;\\n Broker broker;\\n uint128 totalAmount;\\n bool cancelable;\\n bool transferable;\\n }\\n\\n struct HatParams {\\n address wearer;\\n string details;\\n string imageURI;\\n SablierStreamParams[] sablierStreamsParams;\\n uint128 termEndDateTs; // If 0, this is an untermed Hat\\n uint32 maxSupply;\\n bool isMutable;\\n }\\n\\n struct CreateRoleHatsParams {\\n IHats hatsProtocol;\\n IERC6551Registry erc6551Registry;\\n address hatsAccountImplementation;\\n uint256 topHatId;\\n address topHatAccount;\\n IHatsModuleFactory hatsModuleFactory;\\n address hatsElectionsEligibilityImplementation;\\n uint256 adminHatId;\\n HatParams[] hats;\\n }\\n\\n function _processRoleHats(\\n CreateRoleHatsParams memory roleHatsParams\\n ) internal {\\n for (uint256 i = 0; i < roleHatsParams.hats.length; ) {\\n HatParams memory hatParams = roleHatsParams.hats[i];\\n\\n // Create eligibility module if needed\\n address eligibilityAddress = _createEligibilityModule(\\n roleHatsParams.hatsProtocol,\\n roleHatsParams.hatsModuleFactory,\\n roleHatsParams.hatsElectionsEligibilityImplementation,\\n roleHatsParams.topHatId,\\n roleHatsParams.topHatAccount,\\n roleHatsParams.adminHatId,\\n hatParams.termEndDateTs\\n );\\n\\n // Create and Mint the Role Hat\\n uint256 hatId = _createAndMintHat(\\n roleHatsParams.hatsProtocol,\\n roleHatsParams.adminHatId,\\n hatParams,\\n eligibilityAddress,\\n roleHatsParams.topHatAccount\\n );\\n\\n // Get the stream recipient (based on termed or not)\\n address streamRecipient = _setupStreamRecipient(\\n roleHatsParams.erc6551Registry,\\n roleHatsParams.hatsAccountImplementation,\\n address(roleHatsParams.hatsProtocol),\\n hatParams.termEndDateTs,\\n hatParams.wearer,\\n hatId\\n );\\n\\n // Create streams\\n _processSablierStreams(\\n hatParams.sablierStreamsParams,\\n streamRecipient\\n );\\n\\n unchecked {\\n ++i;\\n }\\n }\\n }\\n\\n function _createEligibilityModule(\\n IHats hatsProtocol,\\n IHatsModuleFactory hatsModuleFactory,\\n address hatsElectionsEligibilityImplementation,\\n uint256 topHatId,\\n address topHatAccount,\\n uint256 adminHatId,\\n uint128 termEndDateTs\\n ) private returns (address) {\\n // If the Hat is termed, create the eligibility module\\n if (termEndDateTs != 0) {\\n return\\n hatsModuleFactory.createHatsModule(\\n hatsElectionsEligibilityImplementation,\\n hatsProtocol.getNextId(adminHatId),\\n abi.encode(topHatId, uint256(0)), // [BALLOT_BOX_ID, ADMIN_HAT_ID]\\n abi.encode(termEndDateTs),\\n uint256(SALT)\\n );\\n }\\n\\n // Otherwise, return the Top Hat account\\n return topHatAccount;\\n }\\n\\n function _createAndMintHat(\\n IHats hatsProtocol,\\n uint256 adminHatId,\\n HatParams memory hat,\\n address eligibilityAddress,\\n address topHatAccount\\n ) private returns (uint256) {\\n // Grab the next Hat ID (before creating it)\\n uint256 hatId = hatsProtocol.getNextId(adminHatId);\\n\\n // Create the new Hat\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"createHat(uint256,string,uint32,address,address,bool,string)\\\",\\n adminHatId,\\n hat.details,\\n hat.maxSupply,\\n eligibilityAddress,\\n topHatAccount,\\n hat.isMutable,\\n hat.imageURI\\n ),\\n Enum.Operation.Call\\n );\\n\\n // If the Hat is termed, nominate the wearer as the eligible member\\n if (hat.termEndDateTs != 0) {\\n address[] memory nominatedWearers = new address[](1);\\n nominatedWearers[0] = hat.wearer;\\n\\n IAvatar(msg.sender).execTransactionFromModule(\\n eligibilityAddress,\\n 0,\\n abi.encodeWithSignature(\\n \\\"elect(uint128,address[])\\\",\\n hat.termEndDateTs,\\n nominatedWearers\\n ),\\n Enum.Operation.Call\\n );\\n }\\n\\n // Mint the Hat\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"mintHat(uint256,address)\\\",\\n hatId,\\n hat.wearer\\n ),\\n Enum.Operation.Call\\n );\\n return hatId;\\n }\\n\\n // Exists to avoid stack too deep errors\\n function _setupStreamRecipient(\\n IERC6551Registry erc6551Registry,\\n address hatsAccountImplementation,\\n address hatsProtocol,\\n uint128 termEndDateTs,\\n address wearer,\\n uint256 hatId\\n ) private returns (address) {\\n // If the hat is termed, the wearer is the stream recipient\\n if (termEndDateTs != 0) {\\n return wearer;\\n }\\n\\n // Otherwise, the Hat's smart account is the stream recipient\\n return\\n erc6551Registry.createAccount(\\n hatsAccountImplementation,\\n SALT,\\n block.chainid,\\n hatsProtocol,\\n hatId\\n );\\n }\\n\\n function _processSablierStreams(\\n SablierStreamParams[] memory streamParams,\\n address streamRecipient\\n ) private {\\n for (uint256 i = 0; i < streamParams.length; ) {\\n SablierStreamParams memory sablierStreamParams = streamParams[i];\\n\\n // Approve tokens for Sablier\\n IAvatar(msg.sender).execTransactionFromModule(\\n sablierStreamParams.asset,\\n 0,\\n abi.encodeWithSignature(\\n \\\"approve(address,uint256)\\\",\\n sablierStreamParams.sablier,\\n sablierStreamParams.totalAmount\\n ),\\n Enum.Operation.Call\\n );\\n\\n // Proxy the Sablier call through IAvatar\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(sablierStreamParams.sablier),\\n 0,\\n abi.encodeWithSignature(\\n \\\"createWithTimestamps((address,address,uint128,address,bool,bool,(uint40,uint40,uint40),(address,uint256)))\\\",\\n LockupLinear.CreateWithTimestamps({\\n sender: sablierStreamParams.sender,\\n recipient: streamRecipient,\\n totalAmount: sablierStreamParams.totalAmount,\\n asset: IERC20(sablierStreamParams.asset),\\n cancelable: sablierStreamParams.cancelable,\\n transferable: sablierStreamParams.transferable,\\n timestamps: sablierStreamParams.timestamps,\\n broker: sablierStreamParams.broker\\n })\\n ),\\n Enum.Operation.Call\\n );\\n\\n unchecked {\\n ++i;\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x357c5264ecb63f8f15f67ffb7498c7fb55d9efe8d46358790933b4892bd38cde\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x6080604052348015600f57600080fd5b5061123d8061001f6000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80633dac44e81461003b578063ba9a91a514610050575b600080fd5b61004e610049366004610929565b610089565b005b6100777f5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b507281565b60405190815260200160405180910390f35b61009a61009582610e60565b61009d565b50565b60005b8161010001515181101561016057600082610100015182815181106100c7576100c7610f22565b6020026020010151905060006100fe84600001518560a001518660c00151876060015188608001518960e001518860800151610164565b9050600061011b85600001518660e00151858589608001516102dd565b90506000610141866020015187604001518860000151876080015188600001518761060f565b90506101518460600151826106db565b846001019450505050506100a0565b5050565b60006001600160801b038216156102cf57866001600160a01b0316632f7fb7b6878a6001600160a01b0316631183a8c0876040518263ffffffff1660e01b81526004016101b391815260200190565b602060405180830381865afa1580156101d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101f49190610f38565b886000604051602001610211929190918252602082015260400190565b60408051601f198184030181528282526001600160801b0389166020840152910160408051601f19818403018152908290526001600160e01b031960e087901b168252610285949392917f5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b507290600401610f97565b6020604051808303816000875af11580156102a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102c89190610fe3565b90506102d2565b50825b979650505050505050565b60405162460ea360e61b81526004810185905260009081906001600160a01b03881690631183a8c090602401602060405180830381865afa158015610326573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061034a9190610f38565b9050336001600160a01b031663468721a78860008989602001518a60a001518a8a8d60c001518e6040015160405160240161038b9796959493929190611000565b60408051601f198184030181529181526020820180516001600160e01b0316635829492f60e11b1790525160e085901b6001600160e01b03191681526103d993929190600090600401611064565b6020604051808303816000875af11580156103f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061041c91906110ba565b5060808501516001600160801b031615610547576040805160018082528183019092526000916020808301908036833701905050905085600001518160008151811061046a5761046a610f22565b60200260200101906001600160a01b031690816001600160a01b031681525050336001600160a01b031663468721a78660008960800151856040516024016104b39291906110d7565b60408051601f198184030181529181526020820180516001600160e01b0316634a231cef60e01b1790525160e085901b6001600160e01b031916815261050193929190600090600401611064565b6020604051808303816000875af1158015610520573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061054491906110ba565b50505b8451604051602481018390526001600160a01b039091166044820152339063468721a790899060009060640160408051601f198184030181529181526020820180516001600160e01b031663320fbbb760e11b1790525160e085901b6001600160e01b03191681526105c193929190600090600401611064565b6020604051808303816000875af11580156105e0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061060491906110ba565b509695505050505050565b60006001600160801b038416156106275750816106d1565b604051638a54c52f60e01b81526001600160a01b0387811660048301527f5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b50726024830152466044830152868116606483015260848201849052881690638a54c52f9060a4016020604051808303816000875af11580156106aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106ce9190610fe3565b90505b9695505050505050565b60005b82518110156109245760008382815181106106fb576106fb610f22565b60200260200101519050336001600160a01b031663468721a78260400151600084600001518560a001516040516024016107539291906001600160a01b039290921682526001600160801b0316602082015260400190565b60408051601f198184030181529181526020820180516001600160e01b031663095ea7b360e01b1790525160e085901b6001600160e01b03191681526107a193929190600090600401611064565b6020604051808303816000875af11580156107c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107e491906110ba565b50336001600160a01b031663468721a78260000151600060405180610100016040528086602001516001600160a01b03168152602001886001600160a01b031681526020018660a001516001600160801b0316815260200186604001516001600160a01b031681526020018660c00151151581526020018660e00151151581526020018660600151815260200186608001518152506040516024016108899190611138565b60408051601f198184030181529181526020820180516001600160e01b03166353b1572760e01b1790525160e085901b6001600160e01b03191681526108d793929190600090600401611064565b6020604051808303816000875af11580156108f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061091a91906110ba565b50506001016106de565b505050565b60006020828403121561093b57600080fd5b81356001600160401b0381111561095157600080fd5b8201610120818503121561096457600080fd5b9392505050565b634e487b7160e01b600052604160045260246000fd5b60405161010081016001600160401b03811182821017156109a4576109a461096b565b60405290565b60405160e081016001600160401b03811182821017156109a4576109a461096b565b60405161012081016001600160401b03811182821017156109a4576109a461096b565b604051601f8201601f191681016001600160401b0381118282101715610a1757610a1761096b565b604052919050565b6001600160a01b038116811461009a57600080fd5b8035610a3f81610a1f565b919050565b60006001600160401b03821115610a5d57610a5d61096b565b5060051b60200190565b600082601f830112610a7857600080fd5b81356001600160401b03811115610a9157610a9161096b565b610aa4601f8201601f19166020016109ef565b818152846020838601011115610ab957600080fd5b816020850160208301376000918101602001919091529392505050565b803564ffffffffff81168114610a3f57600080fd5b600060608284031215610afd57600080fd5b604051606081016001600160401b0381118282101715610b1f57610b1f61096b565b604052905080610b2e83610ad6565b8152610b3c60208401610ad6565b6020820152610b4d60408401610ad6565b60408201525092915050565b600060408284031215610b6b57600080fd5b604080519081016001600160401b0381118282101715610b8d57610b8d61096b565b6040529050808235610b9e81610a1f565b8152602092830135920191909152919050565b80356001600160801b0381168114610a3f57600080fd5b801515811461009a57600080fd5b8035610a3f81610bc8565b600082601f830112610bf257600080fd5b8135610c05610c0082610a44565b6109ef565b8082825260208201915060206101608402860101925085831115610c2857600080fd5b602085015b83811015610ce6576101608188031215610c4657600080fd5b610c4e610981565b610c5782610a34565b8152610c6560208301610a34565b6020820152610c7660408301610a34565b6040820152610c888860608401610aeb565b6060820152610c9a8860c08401610b59565b6080820152610cac6101008301610bb1565b60a0820152610cbe6101208301610bd6565b60c0820152610cd06101408301610bd6565b60e0820152835260209092019161016001610c2d565b5095945050505050565b803563ffffffff81168114610a3f57600080fd5b600082601f830112610d1557600080fd5b8135610d23610c0082610a44565b8082825260208201915060208360051b860101925085831115610d4557600080fd5b602085015b83811015610ce65780356001600160401b03811115610d6857600080fd5b860160e0818903601f19011215610d7e57600080fd5b610d866109aa565b610d9260208301610a34565b815260408201356001600160401b03811115610dad57600080fd5b610dbc8a602083860101610a67565b60208301525060608201356001600160401b03811115610ddb57600080fd5b610dea8a602083860101610a67565b60408301525060808201356001600160401b03811115610e0957600080fd5b610e188a602083860101610be1565b606083015250610e2a60a08301610bb1565b6080820152610e3b60c08301610cf0565b60a0820152610e4c60e08301610bd6565b60c082015284525060209283019201610d4a565b60006101208236031215610e7357600080fd5b610e7b6109cc565b610e8483610a34565b8152610e9260208401610a34565b6020820152610ea360408401610a34565b604082015260608381013590820152610ebe60808401610a34565b6080820152610ecf60a08401610a34565b60a0820152610ee060c08401610a34565b60c082015260e083810135908201526101008301356001600160401b03811115610f0957600080fd5b610f1536828601610d04565b6101008301525092915050565b634e487b7160e01b600052603260045260246000fd5b600060208284031215610f4a57600080fd5b5051919050565b6000815180845260005b81811015610f7757602081850181015186830182015201610f5b565b506000602082860101526020601f19601f83011685010191505092915050565b60018060a01b038616815284602082015260a060408201526000610fbe60a0830186610f51565b8281036060840152610fd08186610f51565b9150508260808301529695505050505050565b600060208284031215610ff557600080fd5b815161096481610a1f565b87815260e06020820152600061101960e0830189610f51565b63ffffffff881660408401526001600160a01b0387811660608501528616608084015284151560a084015282810360c08401526110568185610f51565b9a9950505050505050505050565b60018060a01b038516815283602082015260806040820152600061108b6080830185610f51565b9050600283106110ab57634e487b7160e01b600052602160045260246000fd5b82606083015295945050505050565b6000602082840312156110cc57600080fd5b815161096481610bc8565b6000604082016001600160801b03851683526040602084015280845180835260608501915060208601925060005b8181101561112c5783516001600160a01b0316835260209384019390920191600101611105565b50909695505050505050565b81516001600160a01b0390811682526020808401518216908301526040808401516001600160801b0316908301526060808401519182169083015261016082019050608083015161118d608084018215159052565b5060a08301516111a160a084018215159052565b5060c08301516111e060c084018264ffffffffff815116825264ffffffffff602082015116602083015264ffffffffff60408201511660408301525050565b5060e0929092015180516001600160a01b031661012083015260200151610140909101529056fea26469706673582212208ecde80de6a92bc6f34289d7626d01b9bebb41eb9991597e67fb6a0be17a938664736f6c634300081c0033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100365760003560e01c80633dac44e81461003b578063ba9a91a514610050575b600080fd5b61004e610049366004610929565b610089565b005b6100777f5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b507281565b60405190815260200160405180910390f35b61009a61009582610e60565b61009d565b50565b60005b8161010001515181101561016057600082610100015182815181106100c7576100c7610f22565b6020026020010151905060006100fe84600001518560a001518660c00151876060015188608001518960e001518860800151610164565b9050600061011b85600001518660e00151858589608001516102dd565b90506000610141866020015187604001518860000151876080015188600001518761060f565b90506101518460600151826106db565b846001019450505050506100a0565b5050565b60006001600160801b038216156102cf57866001600160a01b0316632f7fb7b6878a6001600160a01b0316631183a8c0876040518263ffffffff1660e01b81526004016101b391815260200190565b602060405180830381865afa1580156101d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101f49190610f38565b886000604051602001610211929190918252602082015260400190565b60408051601f198184030181528282526001600160801b0389166020840152910160408051601f19818403018152908290526001600160e01b031960e087901b168252610285949392917f5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b507290600401610f97565b6020604051808303816000875af11580156102a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102c89190610fe3565b90506102d2565b50825b979650505050505050565b60405162460ea360e61b81526004810185905260009081906001600160a01b03881690631183a8c090602401602060405180830381865afa158015610326573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061034a9190610f38565b9050336001600160a01b031663468721a78860008989602001518a60a001518a8a8d60c001518e6040015160405160240161038b9796959493929190611000565b60408051601f198184030181529181526020820180516001600160e01b0316635829492f60e11b1790525160e085901b6001600160e01b03191681526103d993929190600090600401611064565b6020604051808303816000875af11580156103f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061041c91906110ba565b5060808501516001600160801b031615610547576040805160018082528183019092526000916020808301908036833701905050905085600001518160008151811061046a5761046a610f22565b60200260200101906001600160a01b031690816001600160a01b031681525050336001600160a01b031663468721a78660008960800151856040516024016104b39291906110d7565b60408051601f198184030181529181526020820180516001600160e01b0316634a231cef60e01b1790525160e085901b6001600160e01b031916815261050193929190600090600401611064565b6020604051808303816000875af1158015610520573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061054491906110ba565b50505b8451604051602481018390526001600160a01b039091166044820152339063468721a790899060009060640160408051601f198184030181529181526020820180516001600160e01b031663320fbbb760e11b1790525160e085901b6001600160e01b03191681526105c193929190600090600401611064565b6020604051808303816000875af11580156105e0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061060491906110ba565b509695505050505050565b60006001600160801b038416156106275750816106d1565b604051638a54c52f60e01b81526001600160a01b0387811660048301527f5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b50726024830152466044830152868116606483015260848201849052881690638a54c52f9060a4016020604051808303816000875af11580156106aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106ce9190610fe3565b90505b9695505050505050565b60005b82518110156109245760008382815181106106fb576106fb610f22565b60200260200101519050336001600160a01b031663468721a78260400151600084600001518560a001516040516024016107539291906001600160a01b039290921682526001600160801b0316602082015260400190565b60408051601f198184030181529181526020820180516001600160e01b031663095ea7b360e01b1790525160e085901b6001600160e01b03191681526107a193929190600090600401611064565b6020604051808303816000875af11580156107c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107e491906110ba565b50336001600160a01b031663468721a78260000151600060405180610100016040528086602001516001600160a01b03168152602001886001600160a01b031681526020018660a001516001600160801b0316815260200186604001516001600160a01b031681526020018660c00151151581526020018660e00151151581526020018660600151815260200186608001518152506040516024016108899190611138565b60408051601f198184030181529181526020820180516001600160e01b03166353b1572760e01b1790525160e085901b6001600160e01b03191681526108d793929190600090600401611064565b6020604051808303816000875af11580156108f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061091a91906110ba565b50506001016106de565b505050565b60006020828403121561093b57600080fd5b81356001600160401b0381111561095157600080fd5b8201610120818503121561096457600080fd5b9392505050565b634e487b7160e01b600052604160045260246000fd5b60405161010081016001600160401b03811182821017156109a4576109a461096b565b60405290565b60405160e081016001600160401b03811182821017156109a4576109a461096b565b60405161012081016001600160401b03811182821017156109a4576109a461096b565b604051601f8201601f191681016001600160401b0381118282101715610a1757610a1761096b565b604052919050565b6001600160a01b038116811461009a57600080fd5b8035610a3f81610a1f565b919050565b60006001600160401b03821115610a5d57610a5d61096b565b5060051b60200190565b600082601f830112610a7857600080fd5b81356001600160401b03811115610a9157610a9161096b565b610aa4601f8201601f19166020016109ef565b818152846020838601011115610ab957600080fd5b816020850160208301376000918101602001919091529392505050565b803564ffffffffff81168114610a3f57600080fd5b600060608284031215610afd57600080fd5b604051606081016001600160401b0381118282101715610b1f57610b1f61096b565b604052905080610b2e83610ad6565b8152610b3c60208401610ad6565b6020820152610b4d60408401610ad6565b60408201525092915050565b600060408284031215610b6b57600080fd5b604080519081016001600160401b0381118282101715610b8d57610b8d61096b565b6040529050808235610b9e81610a1f565b8152602092830135920191909152919050565b80356001600160801b0381168114610a3f57600080fd5b801515811461009a57600080fd5b8035610a3f81610bc8565b600082601f830112610bf257600080fd5b8135610c05610c0082610a44565b6109ef565b8082825260208201915060206101608402860101925085831115610c2857600080fd5b602085015b83811015610ce6576101608188031215610c4657600080fd5b610c4e610981565b610c5782610a34565b8152610c6560208301610a34565b6020820152610c7660408301610a34565b6040820152610c888860608401610aeb565b6060820152610c9a8860c08401610b59565b6080820152610cac6101008301610bb1565b60a0820152610cbe6101208301610bd6565b60c0820152610cd06101408301610bd6565b60e0820152835260209092019161016001610c2d565b5095945050505050565b803563ffffffff81168114610a3f57600080fd5b600082601f830112610d1557600080fd5b8135610d23610c0082610a44565b8082825260208201915060208360051b860101925085831115610d4557600080fd5b602085015b83811015610ce65780356001600160401b03811115610d6857600080fd5b860160e0818903601f19011215610d7e57600080fd5b610d866109aa565b610d9260208301610a34565b815260408201356001600160401b03811115610dad57600080fd5b610dbc8a602083860101610a67565b60208301525060608201356001600160401b03811115610ddb57600080fd5b610dea8a602083860101610a67565b60408301525060808201356001600160401b03811115610e0957600080fd5b610e188a602083860101610be1565b606083015250610e2a60a08301610bb1565b6080820152610e3b60c08301610cf0565b60a0820152610e4c60e08301610bd6565b60c082015284525060209283019201610d4a565b60006101208236031215610e7357600080fd5b610e7b6109cc565b610e8483610a34565b8152610e9260208401610a34565b6020820152610ea360408401610a34565b604082015260608381013590820152610ebe60808401610a34565b6080820152610ecf60a08401610a34565b60a0820152610ee060c08401610a34565b60c082015260e083810135908201526101008301356001600160401b03811115610f0957600080fd5b610f1536828601610d04565b6101008301525092915050565b634e487b7160e01b600052603260045260246000fd5b600060208284031215610f4a57600080fd5b5051919050565b6000815180845260005b81811015610f7757602081850181015186830182015201610f5b565b506000602082860101526020601f19601f83011685010191505092915050565b60018060a01b038616815284602082015260a060408201526000610fbe60a0830186610f51565b8281036060840152610fd08186610f51565b9150508260808301529695505050505050565b600060208284031215610ff557600080fd5b815161096481610a1f565b87815260e06020820152600061101960e0830189610f51565b63ffffffff881660408401526001600160a01b0387811660608501528616608084015284151560a084015282810360c08401526110568185610f51565b9a9950505050505050505050565b60018060a01b038516815283602082015260806040820152600061108b6080830185610f51565b9050600283106110ab57634e487b7160e01b600052602160045260246000fd5b82606083015295945050505050565b6000602082840312156110cc57600080fd5b815161096481610bc8565b6000604082016001600160801b03851683526040602084015280845180835260608501915060208601925060005b8181101561112c5783516001600160a01b0316835260209384019390920191600101611105565b50909695505050505050565b81516001600160a01b0390811682526020808401518216908301526040808401516001600160801b0316908301526060808401519182169083015261016082019050608083015161118d608084018215159052565b5060a08301516111a160a084018215159052565b5060c08301516111e060c084018264ffffffffff815116825264ffffffffff602082015116602083015264ffffffffff60408201511660408301525050565b5060e0929092015180516001600160a01b031661012083015260200151610140909101529056fea26469706673582212208ecde80de6a92bc6f34289d7626d01b9bebb41eb9991597e67fb6a0be17a938664736f6c634300081c0033", + "numDeployments": 2, + "solcInputHash": "f1fca9a70591742a2aedd10e2fd7e744", + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"SALT\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"contract IHats\",\"name\":\"hatsProtocol\",\"type\":\"address\"},{\"internalType\":\"contract IERC6551Registry\",\"name\":\"erc6551Registry\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"hatsAccountImplementation\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"topHatId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"topHatAccount\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"keyValuePairs\",\"type\":\"address\"},{\"internalType\":\"contract IHatsModuleFactory\",\"name\":\"hatsModuleFactory\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"hatsElectionsEligibilityImplementation\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"adminHatId\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"wearer\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"details\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"imageURI\",\"type\":\"string\"},{\"components\":[{\"internalType\":\"contract ISablierV2LockupLinear\",\"name\":\"sablier\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint40\",\"name\":\"start\",\"type\":\"uint40\"},{\"internalType\":\"uint40\",\"name\":\"cliff\",\"type\":\"uint40\"},{\"internalType\":\"uint40\",\"name\":\"end\",\"type\":\"uint40\"}],\"internalType\":\"struct LockupLinear.Timestamps\",\"name\":\"timestamps\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"UD60x18\",\"name\":\"fee\",\"type\":\"uint256\"}],\"internalType\":\"struct Broker\",\"name\":\"broker\",\"type\":\"tuple\"},{\"internalType\":\"uint128\",\"name\":\"totalAmount\",\"type\":\"uint128\"},{\"internalType\":\"bool\",\"name\":\"cancelable\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"transferable\",\"type\":\"bool\"}],\"internalType\":\"struct DecentHatsModuleUtils.SablierStreamParams[]\",\"name\":\"sablierStreamsParams\",\"type\":\"tuple[]\"},{\"internalType\":\"uint128\",\"name\":\"termEndDateTs\",\"type\":\"uint128\"},{\"internalType\":\"uint32\",\"name\":\"maxSupply\",\"type\":\"uint32\"},{\"internalType\":\"bool\",\"name\":\"isMutable\",\"type\":\"bool\"}],\"internalType\":\"struct DecentHatsModuleUtils.HatParams[]\",\"name\":\"hats\",\"type\":\"tuple[]\"}],\"internalType\":\"struct DecentHatsModuleUtils.CreateRoleHatsParams\",\"name\":\"roleHatsParams\",\"type\":\"tuple\"}],\"name\":\"createRoleHats\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"createRoleHats((address,address,address,uint256,address,address,address,address,uint256,(address,string,string,(address,address,address,(uint40,uint40,uint40),(address,uint256),uint128,bool,bool)[],uint128,uint32,bool)[]))\":{\"details\":\"Stream funds on untermed Roles are targeted at the hat's smart account. In order to withdraw funds from the stream, the hat's smart account must be the one call to `withdraw-` on the Sablier contract, setting the recipient arg to its wearer.Stream funds on termed Roles are targeted directly at the nominated wearer. The wearer should directly call `withdraw-` on the Sablier contract.Role hat creation, minting, smart account creation and stream creation are handled here in order to avoid a race condition where not more than one active proposal to create a new role can exist at a time. See: https://github.com/decentdao/decent-interface/issues/2402\",\"params\":{\"roleHatsParams\":\"An array of params for each role hat to be created.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"createRoleHats((address,address,address,uint256,address,address,address,address,uint256,(address,string,string,(address,address,address,(uint40,uint40,uint40),(address,uint256),uint128,bool,bool)[],uint128,uint32,bool)[]))\":{\"notice\":\"Creates a new termed or untermed role hat and any streams on it.This contract should be enabled a module on the Safe for which the role is to be created, and disabled after.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/modules/DecentHatsModificationModule.sol\":\"DecentHatsModificationModule\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\npragma solidity >=0.7.0 <0.9.0;\\n\\n/// @title Enum - Collection of enums\\n/// @author Richard Meissner - \\ncontract Enum {\\n enum Operation {Call, DelegateCall}\\n}\\n\",\"keccak256\":\"0x473e45b1a5cc47be494b0e123c9127f0c11c1e0992a321ae5a644c0bfdb2c14f\",\"license\":\"LGPL-3.0-only\"},\"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\n\\n/// @title Zodiac Avatar - A contract that manages modules that can execute transactions via this contract.\\npragma solidity >=0.7.0 <0.9.0;\\n\\nimport \\\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\\\";\\n\\ninterface IAvatar {\\n event EnabledModule(address module);\\n event DisabledModule(address module);\\n event ExecutionFromModuleSuccess(address indexed module);\\n event ExecutionFromModuleFailure(address indexed module);\\n\\n /// @dev Enables a module on the avatar.\\n /// @notice Can only be called by the avatar.\\n /// @notice Modules should be stored as a linked list.\\n /// @notice Must emit EnabledModule(address module) if successful.\\n /// @param module Module to be enabled.\\n function enableModule(address module) external;\\n\\n /// @dev Disables a module on the avatar.\\n /// @notice Can only be called by the avatar.\\n /// @notice Must emit DisabledModule(address module) if successful.\\n /// @param prevModule Address that pointed to the module to be removed in the linked list\\n /// @param module Module to be removed.\\n function disableModule(address prevModule, address module) external;\\n\\n /// @dev Allows a Module to execute a transaction.\\n /// @notice Can only be called by an enabled module.\\n /// @notice Must emit ExecutionFromModuleSuccess(address module) if successful.\\n /// @notice Must emit ExecutionFromModuleFailure(address module) if unsuccessful.\\n /// @param to Destination address of module transaction.\\n /// @param value Ether value of module transaction.\\n /// @param data Data payload of module transaction.\\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\\n function execTransactionFromModule(\\n address to,\\n uint256 value,\\n bytes memory data,\\n Enum.Operation operation\\n ) external returns (bool success);\\n\\n /// @dev Allows a Module to execute a transaction and return data\\n /// @notice Can only be called by an enabled module.\\n /// @notice Must emit ExecutionFromModuleSuccess(address module) if successful.\\n /// @notice Must emit ExecutionFromModuleFailure(address module) if unsuccessful.\\n /// @param to Destination address of module transaction.\\n /// @param value Ether value of module transaction.\\n /// @param data Data payload of module transaction.\\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\\n function execTransactionFromModuleReturnData(\\n address to,\\n uint256 value,\\n bytes memory data,\\n Enum.Operation operation\\n ) external returns (bool success, bytes memory returnData);\\n\\n /// @dev Returns if an module is enabled\\n /// @return True if the module is enabled\\n function isModuleEnabled(address module) external view returns (bool);\\n\\n /// @dev Returns array of modules.\\n /// @param start Start of the page.\\n /// @param pageSize Maximum number of modules that should be returned.\\n /// @return array Array of modules.\\n /// @return next Start of the next page.\\n function getModulesPaginated(address start, uint256 pageSize)\\n external\\n view\\n returns (address[] memory array, address next);\\n}\\n\",\"keccak256\":\"0xcd5508ffe596eef8fbccfd5fc4f10a34397773547ce64e212d48b5212865ec1f\",\"license\":\"LGPL-3.0-only\"},\"@openzeppelin/contracts/interfaces/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/introspection/IERC165.sol\\\";\\n\",\"keccak256\":\"0xd04b0f06e0666f29cf7cccc82894de541e19bb30a765b107b1e40bb7fe5f7d7a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev 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 amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `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 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes calldata data\\n ) external;\\n\\n /**\\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 {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the caller.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool _approved) external;\\n\\n /**\\n * @dev Returns 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\",\"keccak256\":\"0xed6a749c5373af398105ce6ee3ac4763aa450ea7285d268c85d9eeca809cdb1f\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../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\",\"keccak256\":\"0x75b829ff2f26c14355d1cba20e16fe7b29ca58eb5fef665ede48bc0f9c6c74b9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _HEX_SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\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 // Inspired by OraclizeAPI's implementation - MIT licence\\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\\n\\n if (value == 0) {\\n return \\\"0\\\";\\n }\\n uint256 temp = value;\\n uint256 digits;\\n while (temp != 0) {\\n digits++;\\n temp /= 10;\\n }\\n bytes memory buffer = new bytes(digits);\\n while (value != 0) {\\n digits -= 1;\\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\\n value /= 10;\\n }\\n return string(buffer);\\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 if (value == 0) {\\n return \\\"0x00\\\";\\n }\\n uint256 temp = value;\\n uint256 length = 0;\\n while (temp != 0) {\\n length++;\\n temp >>= 8;\\n }\\n return toHexString(value, length);\\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 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_SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\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 representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n}\\n\",\"keccak256\":\"0xaf159a8b1923ad2a26d516089bceca9bdeaeacd04be50983ea00ba63070f08a3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"@prb/math/src/Common.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\n// Common.sol\\n//\\n// Common mathematical functions used in both SD59x18 and UD60x18. Note that these global functions do not\\n// always operate with SD59x18 and UD60x18 numbers.\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CUSTOM ERRORS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @notice Thrown when the resultant value in {mulDiv} overflows uint256.\\nerror PRBMath_MulDiv_Overflow(uint256 x, uint256 y, uint256 denominator);\\n\\n/// @notice Thrown when the resultant value in {mulDiv18} overflows uint256.\\nerror PRBMath_MulDiv18_Overflow(uint256 x, uint256 y);\\n\\n/// @notice Thrown when one of the inputs passed to {mulDivSigned} is `type(int256).min`.\\nerror PRBMath_MulDivSigned_InputTooSmall();\\n\\n/// @notice Thrown when the resultant value in {mulDivSigned} overflows int256.\\nerror PRBMath_MulDivSigned_Overflow(int256 x, int256 y);\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CONSTANTS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @dev The maximum value a uint128 number can have.\\nuint128 constant MAX_UINT128 = type(uint128).max;\\n\\n/// @dev The maximum value a uint40 number can have.\\nuint40 constant MAX_UINT40 = type(uint40).max;\\n\\n/// @dev The unit number, which the decimal precision of the fixed-point types.\\nuint256 constant UNIT = 1e18;\\n\\n/// @dev The unit number inverted mod 2^256.\\nuint256 constant UNIT_INVERSE = 78156646155174841979727994598816262306175212592076161876661_508869554232690281;\\n\\n/// @dev The the largest power of two that divides the decimal value of `UNIT`. The logarithm of this value is the least significant\\n/// bit in the binary representation of `UNIT`.\\nuint256 constant UNIT_LPOTD = 262144;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @notice Calculates the binary exponent of x using the binary fraction method.\\n/// @dev Has to use 192.64-bit fixed-point numbers. See https://ethereum.stackexchange.com/a/96594/24693.\\n/// @param x The exponent as an unsigned 192.64-bit fixed-point number.\\n/// @return result The result as an unsigned 60.18-decimal fixed-point number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp2(uint256 x) pure returns (uint256 result) {\\n unchecked {\\n // Start from 0.5 in the 192.64-bit fixed-point format.\\n result = 0x800000000000000000000000000000000000000000000000;\\n\\n // The following logic multiplies the result by $\\\\sqrt{2^{-i}}$ when the bit at position i is 1. Key points:\\n //\\n // 1. Intermediate results will not overflow, as the starting point is 2^191 and all magic factors are under 2^65.\\n // 2. The rationale for organizing the if statements into groups of 8 is gas savings. If the result of performing\\n // a bitwise AND operation between x and any value in the array [0x80; 0x40; 0x20; 0x10; 0x08; 0x04; 0x02; 0x01] is 1,\\n // we know that `x & 0xFF` is also 1.\\n if (x & 0xFF00000000000000 > 0) {\\n if (x & 0x8000000000000000 > 0) {\\n result = (result * 0x16A09E667F3BCC909) >> 64;\\n }\\n if (x & 0x4000000000000000 > 0) {\\n result = (result * 0x1306FE0A31B7152DF) >> 64;\\n }\\n if (x & 0x2000000000000000 > 0) {\\n result = (result * 0x1172B83C7D517ADCE) >> 64;\\n }\\n if (x & 0x1000000000000000 > 0) {\\n result = (result * 0x10B5586CF9890F62A) >> 64;\\n }\\n if (x & 0x800000000000000 > 0) {\\n result = (result * 0x1059B0D31585743AE) >> 64;\\n }\\n if (x & 0x400000000000000 > 0) {\\n result = (result * 0x102C9A3E778060EE7) >> 64;\\n }\\n if (x & 0x200000000000000 > 0) {\\n result = (result * 0x10163DA9FB33356D8) >> 64;\\n }\\n if (x & 0x100000000000000 > 0) {\\n result = (result * 0x100B1AFA5ABCBED61) >> 64;\\n }\\n }\\n\\n if (x & 0xFF000000000000 > 0) {\\n if (x & 0x80000000000000 > 0) {\\n result = (result * 0x10058C86DA1C09EA2) >> 64;\\n }\\n if (x & 0x40000000000000 > 0) {\\n result = (result * 0x1002C605E2E8CEC50) >> 64;\\n }\\n if (x & 0x20000000000000 > 0) {\\n result = (result * 0x100162F3904051FA1) >> 64;\\n }\\n if (x & 0x10000000000000 > 0) {\\n result = (result * 0x1000B175EFFDC76BA) >> 64;\\n }\\n if (x & 0x8000000000000 > 0) {\\n result = (result * 0x100058BA01FB9F96D) >> 64;\\n }\\n if (x & 0x4000000000000 > 0) {\\n result = (result * 0x10002C5CC37DA9492) >> 64;\\n }\\n if (x & 0x2000000000000 > 0) {\\n result = (result * 0x1000162E525EE0547) >> 64;\\n }\\n if (x & 0x1000000000000 > 0) {\\n result = (result * 0x10000B17255775C04) >> 64;\\n }\\n }\\n\\n if (x & 0xFF0000000000 > 0) {\\n if (x & 0x800000000000 > 0) {\\n result = (result * 0x1000058B91B5BC9AE) >> 64;\\n }\\n if (x & 0x400000000000 > 0) {\\n result = (result * 0x100002C5C89D5EC6D) >> 64;\\n }\\n if (x & 0x200000000000 > 0) {\\n result = (result * 0x10000162E43F4F831) >> 64;\\n }\\n if (x & 0x100000000000 > 0) {\\n result = (result * 0x100000B1721BCFC9A) >> 64;\\n }\\n if (x & 0x80000000000 > 0) {\\n result = (result * 0x10000058B90CF1E6E) >> 64;\\n }\\n if (x & 0x40000000000 > 0) {\\n result = (result * 0x1000002C5C863B73F) >> 64;\\n }\\n if (x & 0x20000000000 > 0) {\\n result = (result * 0x100000162E430E5A2) >> 64;\\n }\\n if (x & 0x10000000000 > 0) {\\n result = (result * 0x1000000B172183551) >> 64;\\n }\\n }\\n\\n if (x & 0xFF00000000 > 0) {\\n if (x & 0x8000000000 > 0) {\\n result = (result * 0x100000058B90C0B49) >> 64;\\n }\\n if (x & 0x4000000000 > 0) {\\n result = (result * 0x10000002C5C8601CC) >> 64;\\n }\\n if (x & 0x2000000000 > 0) {\\n result = (result * 0x1000000162E42FFF0) >> 64;\\n }\\n if (x & 0x1000000000 > 0) {\\n result = (result * 0x10000000B17217FBB) >> 64;\\n }\\n if (x & 0x800000000 > 0) {\\n result = (result * 0x1000000058B90BFCE) >> 64;\\n }\\n if (x & 0x400000000 > 0) {\\n result = (result * 0x100000002C5C85FE3) >> 64;\\n }\\n if (x & 0x200000000 > 0) {\\n result = (result * 0x10000000162E42FF1) >> 64;\\n }\\n if (x & 0x100000000 > 0) {\\n result = (result * 0x100000000B17217F8) >> 64;\\n }\\n }\\n\\n if (x & 0xFF000000 > 0) {\\n if (x & 0x80000000 > 0) {\\n result = (result * 0x10000000058B90BFC) >> 64;\\n }\\n if (x & 0x40000000 > 0) {\\n result = (result * 0x1000000002C5C85FE) >> 64;\\n }\\n if (x & 0x20000000 > 0) {\\n result = (result * 0x100000000162E42FF) >> 64;\\n }\\n if (x & 0x10000000 > 0) {\\n result = (result * 0x1000000000B17217F) >> 64;\\n }\\n if (x & 0x8000000 > 0) {\\n result = (result * 0x100000000058B90C0) >> 64;\\n }\\n if (x & 0x4000000 > 0) {\\n result = (result * 0x10000000002C5C860) >> 64;\\n }\\n if (x & 0x2000000 > 0) {\\n result = (result * 0x1000000000162E430) >> 64;\\n }\\n if (x & 0x1000000 > 0) {\\n result = (result * 0x10000000000B17218) >> 64;\\n }\\n }\\n\\n if (x & 0xFF0000 > 0) {\\n if (x & 0x800000 > 0) {\\n result = (result * 0x1000000000058B90C) >> 64;\\n }\\n if (x & 0x400000 > 0) {\\n result = (result * 0x100000000002C5C86) >> 64;\\n }\\n if (x & 0x200000 > 0) {\\n result = (result * 0x10000000000162E43) >> 64;\\n }\\n if (x & 0x100000 > 0) {\\n result = (result * 0x100000000000B1721) >> 64;\\n }\\n if (x & 0x80000 > 0) {\\n result = (result * 0x10000000000058B91) >> 64;\\n }\\n if (x & 0x40000 > 0) {\\n result = (result * 0x1000000000002C5C8) >> 64;\\n }\\n if (x & 0x20000 > 0) {\\n result = (result * 0x100000000000162E4) >> 64;\\n }\\n if (x & 0x10000 > 0) {\\n result = (result * 0x1000000000000B172) >> 64;\\n }\\n }\\n\\n if (x & 0xFF00 > 0) {\\n if (x & 0x8000 > 0) {\\n result = (result * 0x100000000000058B9) >> 64;\\n }\\n if (x & 0x4000 > 0) {\\n result = (result * 0x10000000000002C5D) >> 64;\\n }\\n if (x & 0x2000 > 0) {\\n result = (result * 0x1000000000000162E) >> 64;\\n }\\n if (x & 0x1000 > 0) {\\n result = (result * 0x10000000000000B17) >> 64;\\n }\\n if (x & 0x800 > 0) {\\n result = (result * 0x1000000000000058C) >> 64;\\n }\\n if (x & 0x400 > 0) {\\n result = (result * 0x100000000000002C6) >> 64;\\n }\\n if (x & 0x200 > 0) {\\n result = (result * 0x10000000000000163) >> 64;\\n }\\n if (x & 0x100 > 0) {\\n result = (result * 0x100000000000000B1) >> 64;\\n }\\n }\\n\\n if (x & 0xFF > 0) {\\n if (x & 0x80 > 0) {\\n result = (result * 0x10000000000000059) >> 64;\\n }\\n if (x & 0x40 > 0) {\\n result = (result * 0x1000000000000002C) >> 64;\\n }\\n if (x & 0x20 > 0) {\\n result = (result * 0x10000000000000016) >> 64;\\n }\\n if (x & 0x10 > 0) {\\n result = (result * 0x1000000000000000B) >> 64;\\n }\\n if (x & 0x8 > 0) {\\n result = (result * 0x10000000000000006) >> 64;\\n }\\n if (x & 0x4 > 0) {\\n result = (result * 0x10000000000000003) >> 64;\\n }\\n if (x & 0x2 > 0) {\\n result = (result * 0x10000000000000001) >> 64;\\n }\\n if (x & 0x1 > 0) {\\n result = (result * 0x10000000000000001) >> 64;\\n }\\n }\\n\\n // In the code snippet below, two operations are executed simultaneously:\\n //\\n // 1. The result is multiplied by $(2^n + 1)$, where $2^n$ represents the integer part, and the additional 1\\n // accounts for the initial guess of 0.5. This is achieved by subtracting from 191 instead of 192.\\n // 2. The result is then converted to an unsigned 60.18-decimal fixed-point format.\\n //\\n // The underlying logic is based on the relationship $2^{191-ip} = 2^{ip} / 2^{191}$, where $ip$ denotes the,\\n // integer part, $2^n$.\\n result *= UNIT;\\n result >>= (191 - (x >> 64));\\n }\\n}\\n\\n/// @notice Finds the zero-based index of the first 1 in the binary representation of x.\\n///\\n/// @dev See the note on \\\"msb\\\" in this Wikipedia article: https://en.wikipedia.org/wiki/Find_first_set\\n///\\n/// Each step in this implementation is equivalent to this high-level code:\\n///\\n/// ```solidity\\n/// if (x >= 2 ** 128) {\\n/// x >>= 128;\\n/// result += 128;\\n/// }\\n/// ```\\n///\\n/// Where 128 is replaced with each respective power of two factor. See the full high-level implementation here:\\n/// https://gist.github.com/PaulRBerg/f932f8693f2733e30c4d479e8e980948\\n///\\n/// The Yul instructions used below are:\\n///\\n/// - \\\"gt\\\" is \\\"greater than\\\"\\n/// - \\\"or\\\" is the OR bitwise operator\\n/// - \\\"shl\\\" is \\\"shift left\\\"\\n/// - \\\"shr\\\" is \\\"shift right\\\"\\n///\\n/// @param x The uint256 number for which to find the index of the most significant bit.\\n/// @return result The index of the most significant bit as a uint256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction msb(uint256 x) pure returns (uint256 result) {\\n // 2^128\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(7, gt(x, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^64\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(6, gt(x, 0xFFFFFFFFFFFFFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^32\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(5, gt(x, 0xFFFFFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^16\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(4, gt(x, 0xFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^8\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(3, gt(x, 0xFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^4\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(2, gt(x, 0xF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^2\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(1, gt(x, 0x3))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^1\\n // No need to shift x any more.\\n assembly (\\\"memory-safe\\\") {\\n let factor := gt(x, 0x1)\\n result := or(result, factor)\\n }\\n}\\n\\n/// @notice Calculates x*y\\u00f7denominator with 512-bit precision.\\n///\\n/// @dev Credits to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv.\\n///\\n/// Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - The denominator must not be zero.\\n/// - The result must fit in uint256.\\n///\\n/// @param x The multiplicand as a uint256.\\n/// @param y The multiplier as a uint256.\\n/// @param denominator The divisor as a uint256.\\n/// @return result The result as a uint256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mulDiv(uint256 x, uint256 y, uint256 denominator) pure returns (uint256 result) {\\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; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly (\\\"memory-safe\\\") {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\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 unchecked {\\n return prod0 / denominator;\\n }\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n if (prod1 >= denominator) {\\n revert PRBMath_MulDiv_Overflow(x, y, denominator);\\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 (\\\"memory-safe\\\") {\\n // Compute remainder using the mulmod Yul instruction.\\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 unchecked {\\n // Calculate the largest power of two divisor of the denominator using the unary operator ~. This operation cannot overflow\\n // because the denominator cannot be zero at this point in the function execution. The result is always >= 1.\\n // For more detail, see https://cs.stackexchange.com/q/138556/92363.\\n uint256 lpotdod = denominator & (~denominator + 1);\\n uint256 flippedLpotdod;\\n\\n assembly (\\\"memory-safe\\\") {\\n // Factor powers of two out of denominator.\\n denominator := div(denominator, lpotdod)\\n\\n // Divide [prod1 prod0] by lpotdod.\\n prod0 := div(prod0, lpotdod)\\n\\n // Get the flipped value `2^256 / lpotdod`. If the `lpotdod` is zero, the flipped value is one.\\n // `sub(0, lpotdod)` produces the two's complement version of `lpotdod`, which is equivalent to flipping all the bits.\\n // However, `div` interprets this value as an unsigned value: https://ethereum.stackexchange.com/q/147168/24693\\n flippedLpotdod := add(div(sub(0, lpotdod), lpotdod), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * flippedLpotdod;\\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 works\\n // 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 }\\n}\\n\\n/// @notice Calculates x*y\\u00f71e18 with 512-bit precision.\\n///\\n/// @dev A variant of {mulDiv} with constant folding, i.e. in which the denominator is hard coded to 1e18.\\n///\\n/// Notes:\\n/// - The body is purposely left uncommented; to understand how this works, see the documentation in {mulDiv}.\\n/// - The result is rounded toward zero.\\n/// - We take as an axiom that the result cannot be `MAX_UINT256` when x and y solve the following system of equations:\\n///\\n/// $$\\n/// \\\\begin{cases}\\n/// x * y = MAX\\\\_UINT256 * UNIT \\\\\\\\\\n/// (x * y) \\\\% UNIT \\\\geq \\\\frac{UNIT}{2}\\n/// \\\\end{cases}\\n/// $$\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {mulDiv}.\\n/// - The result must fit in uint256.\\n///\\n/// @param x The multiplicand as an unsigned 60.18-decimal fixed-point number.\\n/// @param y The multiplier as an unsigned 60.18-decimal fixed-point number.\\n/// @return result The result as an unsigned 60.18-decimal fixed-point number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mulDiv18(uint256 x, uint256 y) pure returns (uint256 result) {\\n uint256 prod0;\\n uint256 prod1;\\n assembly (\\\"memory-safe\\\") {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n if (prod1 == 0) {\\n unchecked {\\n return prod0 / UNIT;\\n }\\n }\\n\\n if (prod1 >= UNIT) {\\n revert PRBMath_MulDiv18_Overflow(x, y);\\n }\\n\\n uint256 remainder;\\n assembly (\\\"memory-safe\\\") {\\n remainder := mulmod(x, y, UNIT)\\n result :=\\n mul(\\n or(\\n div(sub(prod0, remainder), UNIT_LPOTD),\\n mul(sub(prod1, gt(remainder, prod0)), add(div(sub(0, UNIT_LPOTD), UNIT_LPOTD), 1))\\n ),\\n UNIT_INVERSE\\n )\\n }\\n}\\n\\n/// @notice Calculates x*y\\u00f7denominator with 512-bit precision.\\n///\\n/// @dev This is an extension of {mulDiv} for signed numbers, which works by computing the signs and the absolute values separately.\\n///\\n/// Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {mulDiv}.\\n/// - None of the inputs can be `type(int256).min`.\\n/// - The result must fit in int256.\\n///\\n/// @param x The multiplicand as an int256.\\n/// @param y The multiplier as an int256.\\n/// @param denominator The divisor as an int256.\\n/// @return result The result as an int256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mulDivSigned(int256 x, int256 y, int256 denominator) pure returns (int256 result) {\\n if (x == type(int256).min || y == type(int256).min || denominator == type(int256).min) {\\n revert PRBMath_MulDivSigned_InputTooSmall();\\n }\\n\\n // Get hold of the absolute values of x, y and the denominator.\\n uint256 xAbs;\\n uint256 yAbs;\\n uint256 dAbs;\\n unchecked {\\n xAbs = x < 0 ? uint256(-x) : uint256(x);\\n yAbs = y < 0 ? uint256(-y) : uint256(y);\\n dAbs = denominator < 0 ? uint256(-denominator) : uint256(denominator);\\n }\\n\\n // Compute the absolute value of x*y\\u00f7denominator. The result must fit in int256.\\n uint256 resultAbs = mulDiv(xAbs, yAbs, dAbs);\\n if (resultAbs > uint256(type(int256).max)) {\\n revert PRBMath_MulDivSigned_Overflow(x, y);\\n }\\n\\n // Get the signs of x, y and the denominator.\\n uint256 sx;\\n uint256 sy;\\n uint256 sd;\\n assembly (\\\"memory-safe\\\") {\\n // \\\"sgt\\\" is the \\\"signed greater than\\\" assembly instruction and \\\"sub(0,1)\\\" is -1 in two's complement.\\n sx := sgt(x, sub(0, 1))\\n sy := sgt(y, sub(0, 1))\\n sd := sgt(denominator, sub(0, 1))\\n }\\n\\n // XOR over sx, sy and sd. What this does is to check whether there are 1 or 3 negative signs in the inputs.\\n // If there are, the result should be negative. Otherwise, it should be positive.\\n unchecked {\\n result = sx ^ sy ^ sd == 0 ? -int256(resultAbs) : int256(resultAbs);\\n }\\n}\\n\\n/// @notice Calculates the square root of x using the Babylonian method.\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\\n///\\n/// Notes:\\n/// - If x is not a perfect square, the result is rounded down.\\n/// - Credits to OpenZeppelin for the explanations in comments below.\\n///\\n/// @param x The uint256 number for which to calculate the square root.\\n/// @return result The result as a uint256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction sqrt(uint256 x) pure returns (uint256 result) {\\n if (x == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we calculate the biggest power of 2 which is smaller than the square root of x.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of x is a power of 2 such that we have:\\n //\\n // $$\\n // msb(x) <= x <= 2*msb(x)$\\n // $$\\n //\\n // We write $msb(x)$ as $2^k$, and we get:\\n //\\n // $$\\n // k = log_2(x)\\n // $$\\n //\\n // Thus, we can write the initial inequality as:\\n //\\n // $$\\n // 2^{log_2(x)} <= x <= 2*2^{log_2(x)+1} \\\\\\\\\\n // sqrt(2^k) <= sqrt(x) < sqrt(2^{k+1}) \\\\\\\\\\n // 2^{k/2} <= sqrt(x) < 2^{(k+1)/2} <= 2^{(k/2)+1}\\n // $$\\n //\\n // Consequently, $2^{log_2(x) /2} is a good first approximation of sqrt(x) with at least one correct bit.\\n uint256 xAux = uint256(x);\\n result = 1;\\n if (xAux >= 2 ** 128) {\\n xAux >>= 128;\\n result <<= 64;\\n }\\n if (xAux >= 2 ** 64) {\\n xAux >>= 64;\\n result <<= 32;\\n }\\n if (xAux >= 2 ** 32) {\\n xAux >>= 32;\\n result <<= 16;\\n }\\n if (xAux >= 2 ** 16) {\\n xAux >>= 16;\\n result <<= 8;\\n }\\n if (xAux >= 2 ** 8) {\\n xAux >>= 8;\\n result <<= 4;\\n }\\n if (xAux >= 2 ** 4) {\\n xAux >>= 4;\\n result <<= 2;\\n }\\n if (xAux >= 2 ** 2) {\\n result <<= 1;\\n }\\n\\n // At this point, `result` is an estimation with at least one bit of precision. We know the true value has at\\n // most 128 bits, since it is the square root of a uint256. Newton's method converges quadratically (precision\\n // doubles at every iteration). We thus need at most 7 iteration to turn our partial result with one bit of\\n // precision into the expected uint128 result.\\n unchecked {\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n\\n // If x is not a perfect square, round the result toward zero.\\n uint256 roundedResult = x / result;\\n if (result >= roundedResult) {\\n result = roundedResult;\\n }\\n }\\n}\\n\",\"keccak256\":\"0xaa374e2c26cc93e8c22a6953804ee05f811597ef5fa82f76824378b22944778b\",\"license\":\"MIT\"},\"@prb/math/src/UD2x18.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\n/*\\n\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2550\\u2550\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2554\\u2588\\u2588\\u2588\\u2588\\u2554\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551 \\u255a\\u2550\\u255d \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\n\\n\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2550\\u2550\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d \\u255a\\u2588\\u2588\\u2588\\u2554\\u255d \\u255a\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u255d\\n\\n*/\\n\\nimport \\\"./ud2x18/Casting.sol\\\";\\nimport \\\"./ud2x18/Constants.sol\\\";\\nimport \\\"./ud2x18/Errors.sol\\\";\\nimport \\\"./ud2x18/ValueType.sol\\\";\\n\",\"keccak256\":\"0xfb624e24cd8bb790fa08e7827819de85504a86e20e961fa4ad126c65b6d90641\",\"license\":\"MIT\"},\"@prb/math/src/UD60x18.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\n/*\\n\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2550\\u2550\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2554\\u2588\\u2588\\u2588\\u2588\\u2554\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551 \\u255a\\u2550\\u255d \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\n\\n\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2550\\u2588\\u2588\\u2588\\u2588\\u2557\\u255a\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2588\\u2588\\u2551 \\u255a\\u2588\\u2588\\u2588\\u2554\\u255d \\u255a\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2554\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2554\\u255d \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u255d\\n\\n*/\\n\\nimport \\\"./ud60x18/Casting.sol\\\";\\nimport \\\"./ud60x18/Constants.sol\\\";\\nimport \\\"./ud60x18/Conversions.sol\\\";\\nimport \\\"./ud60x18/Errors.sol\\\";\\nimport \\\"./ud60x18/Helpers.sol\\\";\\nimport \\\"./ud60x18/Math.sol\\\";\\nimport \\\"./ud60x18/ValueType.sol\\\";\\n\",\"keccak256\":\"0xb98c6f74275914d279e8af6c502c2b1f50d5f6e1ed418d3b0153f5a193206c48\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as CastingErrors;\\nimport { SD59x18 } from \\\"../sd59x18/ValueType.sol\\\";\\nimport { UD2x18 } from \\\"../ud2x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"../ud60x18/ValueType.sol\\\";\\nimport { SD1x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts an SD1x18 number into SD59x18.\\n/// @dev There is no overflow check because the domain of SD1x18 is a subset of SD59x18.\\nfunction intoSD59x18(SD1x18 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(int256(SD1x18.unwrap(x)));\\n}\\n\\n/// @notice Casts an SD1x18 number into UD2x18.\\n/// - x must be positive.\\nfunction intoUD2x18(SD1x18 x) pure returns (UD2x18 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUD2x18_Underflow(x);\\n }\\n result = UD2x18.wrap(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into UD60x18.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUD60x18(SD1x18 x) pure returns (UD60x18 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUD60x18_Underflow(x);\\n }\\n result = UD60x18.wrap(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into uint256.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUint256(SD1x18 x) pure returns (uint256 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint256_Underflow(x);\\n }\\n result = uint256(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into uint128.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUint128(SD1x18 x) pure returns (uint128 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint128_Underflow(x);\\n }\\n result = uint128(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(SD1x18 x) pure returns (uint40 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint40_Underflow(x);\\n }\\n if (xInt > int64(uint64(Common.MAX_UINT40))) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint40_Overflow(x);\\n }\\n result = uint40(uint64(xInt));\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction sd1x18(int64 x) pure returns (SD1x18 result) {\\n result = SD1x18.wrap(x);\\n}\\n\\n/// @notice Unwraps an SD1x18 number into int64.\\nfunction unwrap(SD1x18 x) pure returns (int64 result) {\\n result = SD1x18.unwrap(x);\\n}\\n\\n/// @notice Wraps an int64 number into SD1x18.\\nfunction wrap(int64 x) pure returns (SD1x18 result) {\\n result = SD1x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x9e49e2b37c1bb845861740805edaaef3fe951a7b96eef16ce84fbf76e8278670\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD1x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @dev Euler's number as an SD1x18 number.\\nSD1x18 constant E = SD1x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum value an SD1x18 number can have.\\nint64 constant uMAX_SD1x18 = 9_223372036854775807;\\nSD1x18 constant MAX_SD1x18 = SD1x18.wrap(uMAX_SD1x18);\\n\\n/// @dev The maximum value an SD1x18 number can have.\\nint64 constant uMIN_SD1x18 = -9_223372036854775808;\\nSD1x18 constant MIN_SD1x18 = SD1x18.wrap(uMIN_SD1x18);\\n\\n/// @dev PI as an SD1x18 number.\\nSD1x18 constant PI = SD1x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of SD1x18.\\nSD1x18 constant UNIT = SD1x18.wrap(1e18);\\nint64 constant uUNIT = 1e18;\\n\",\"keccak256\":\"0x6496165b80552785a4b65a239b96e2a5fedf62fe54f002eeed72d75e566d7585\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD1x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in UD2x18.\\nerror PRBMath_SD1x18_ToUD2x18_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in UD60x18.\\nerror PRBMath_SD1x18_ToUD60x18_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint128.\\nerror PRBMath_SD1x18_ToUint128_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint256.\\nerror PRBMath_SD1x18_ToUint256_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint40.\\nerror PRBMath_SD1x18_ToUint40_Overflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint40.\\nerror PRBMath_SD1x18_ToUint40_Underflow(SD1x18 x);\\n\",\"keccak256\":\"0x836cb42ba619ca369fd4765bc47fefc3c3621369c5861882af14660aca5057ee\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\n\\n/// @notice The signed 1.18-decimal fixed-point number representation, which can have up to 1 digit and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\\n/// type int64. This is useful when end users want to use int64 to save gas, e.g. with tight variable packing in contract\\n/// storage.\\ntype SD1x18 is int64;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoSD59x18,\\n Casting.intoUD2x18,\\n Casting.intoUD60x18,\\n Casting.intoUint256,\\n Casting.intoUint128,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for SD1x18 global;\\n\",\"keccak256\":\"0x2f86f1aa9fca42f40808b51a879b406ac51817647bdb9642f8a79dd8fdb754a7\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Errors.sol\\\" as CastingErrors;\\nimport { MAX_UINT128, MAX_UINT40 } from \\\"../Common.sol\\\";\\nimport { uMAX_SD1x18, uMIN_SD1x18 } from \\\"../sd1x18/Constants.sol\\\";\\nimport { SD1x18 } from \\\"../sd1x18/ValueType.sol\\\";\\nimport { uMAX_UD2x18 } from \\\"../ud2x18/Constants.sol\\\";\\nimport { UD2x18 } from \\\"../ud2x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"../ud60x18/ValueType.sol\\\";\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts an SD59x18 number into int256.\\n/// @dev This is basically a functional alias for {unwrap}.\\nfunction intoInt256(SD59x18 x) pure returns (int256 result) {\\n result = SD59x18.unwrap(x);\\n}\\n\\n/// @notice Casts an SD59x18 number into SD1x18.\\n/// @dev Requirements:\\n/// - x must be greater than or equal to `uMIN_SD1x18`.\\n/// - x must be less than or equal to `uMAX_SD1x18`.\\nfunction intoSD1x18(SD59x18 x) pure returns (SD1x18 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < uMIN_SD1x18) {\\n revert CastingErrors.PRBMath_SD59x18_IntoSD1x18_Underflow(x);\\n }\\n if (xInt > uMAX_SD1x18) {\\n revert CastingErrors.PRBMath_SD59x18_IntoSD1x18_Overflow(x);\\n }\\n result = SD1x18.wrap(int64(xInt));\\n}\\n\\n/// @notice Casts an SD59x18 number into UD2x18.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `uMAX_UD2x18`.\\nfunction intoUD2x18(SD59x18 x) pure returns (UD2x18 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUD2x18_Underflow(x);\\n }\\n if (xInt > int256(uint256(uMAX_UD2x18))) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUD2x18_Overflow(x);\\n }\\n result = UD2x18.wrap(uint64(uint256(xInt)));\\n}\\n\\n/// @notice Casts an SD59x18 number into UD60x18.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUD60x18(SD59x18 x) pure returns (UD60x18 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUD60x18_Underflow(x);\\n }\\n result = UD60x18.wrap(uint256(xInt));\\n}\\n\\n/// @notice Casts an SD59x18 number into uint256.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUint256(SD59x18 x) pure returns (uint256 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint256_Underflow(x);\\n }\\n result = uint256(xInt);\\n}\\n\\n/// @notice Casts an SD59x18 number into uint128.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `uMAX_UINT128`.\\nfunction intoUint128(SD59x18 x) pure returns (uint128 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint128_Underflow(x);\\n }\\n if (xInt > int256(uint256(MAX_UINT128))) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint128_Overflow(x);\\n }\\n result = uint128(uint256(xInt));\\n}\\n\\n/// @notice Casts an SD59x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(SD59x18 x) pure returns (uint40 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint40_Underflow(x);\\n }\\n if (xInt > int256(uint256(MAX_UINT40))) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint40_Overflow(x);\\n }\\n result = uint40(uint256(xInt));\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction sd(int256 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(x);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction sd59x18(int256 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(x);\\n}\\n\\n/// @notice Unwraps an SD59x18 number into int256.\\nfunction unwrap(SD59x18 x) pure returns (int256 result) {\\n result = SD59x18.unwrap(x);\\n}\\n\\n/// @notice Wraps an int256 number into SD59x18.\\nfunction wrap(int256 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x3b21b60ec2998c3ae32f647412da51d3683b3f183a807198cc8d157499484f99\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n// NOTICE: the \\\"u\\\" prefix stands for \\\"unwrapped\\\".\\n\\n/// @dev Euler's number as an SD59x18 number.\\nSD59x18 constant E = SD59x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum input permitted in {exp}.\\nint256 constant uEXP_MAX_INPUT = 133_084258667509499440;\\nSD59x18 constant EXP_MAX_INPUT = SD59x18.wrap(uEXP_MAX_INPUT);\\n\\n/// @dev Any value less than this returns 0 in {exp}.\\nint256 constant uEXP_MIN_THRESHOLD = -41_446531673892822322;\\nSD59x18 constant EXP_MIN_THRESHOLD = SD59x18.wrap(uEXP_MIN_THRESHOLD);\\n\\n/// @dev The maximum input permitted in {exp2}.\\nint256 constant uEXP2_MAX_INPUT = 192e18 - 1;\\nSD59x18 constant EXP2_MAX_INPUT = SD59x18.wrap(uEXP2_MAX_INPUT);\\n\\n/// @dev Any value less than this returns 0 in {exp2}.\\nint256 constant uEXP2_MIN_THRESHOLD = -59_794705707972522261;\\nSD59x18 constant EXP2_MIN_THRESHOLD = SD59x18.wrap(uEXP2_MIN_THRESHOLD);\\n\\n/// @dev Half the UNIT number.\\nint256 constant uHALF_UNIT = 0.5e18;\\nSD59x18 constant HALF_UNIT = SD59x18.wrap(uHALF_UNIT);\\n\\n/// @dev $log_2(10)$ as an SD59x18 number.\\nint256 constant uLOG2_10 = 3_321928094887362347;\\nSD59x18 constant LOG2_10 = SD59x18.wrap(uLOG2_10);\\n\\n/// @dev $log_2(e)$ as an SD59x18 number.\\nint256 constant uLOG2_E = 1_442695040888963407;\\nSD59x18 constant LOG2_E = SD59x18.wrap(uLOG2_E);\\n\\n/// @dev The maximum value an SD59x18 number can have.\\nint256 constant uMAX_SD59x18 = 57896044618658097711785492504343953926634992332820282019728_792003956564819967;\\nSD59x18 constant MAX_SD59x18 = SD59x18.wrap(uMAX_SD59x18);\\n\\n/// @dev The maximum whole value an SD59x18 number can have.\\nint256 constant uMAX_WHOLE_SD59x18 = 57896044618658097711785492504343953926634992332820282019728_000000000000000000;\\nSD59x18 constant MAX_WHOLE_SD59x18 = SD59x18.wrap(uMAX_WHOLE_SD59x18);\\n\\n/// @dev The minimum value an SD59x18 number can have.\\nint256 constant uMIN_SD59x18 = -57896044618658097711785492504343953926634992332820282019728_792003956564819968;\\nSD59x18 constant MIN_SD59x18 = SD59x18.wrap(uMIN_SD59x18);\\n\\n/// @dev The minimum whole value an SD59x18 number can have.\\nint256 constant uMIN_WHOLE_SD59x18 = -57896044618658097711785492504343953926634992332820282019728_000000000000000000;\\nSD59x18 constant MIN_WHOLE_SD59x18 = SD59x18.wrap(uMIN_WHOLE_SD59x18);\\n\\n/// @dev PI as an SD59x18 number.\\nSD59x18 constant PI = SD59x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of SD59x18.\\nint256 constant uUNIT = 1e18;\\nSD59x18 constant UNIT = SD59x18.wrap(1e18);\\n\\n/// @dev The unit number squared.\\nint256 constant uUNIT_SQUARED = 1e36;\\nSD59x18 constant UNIT_SQUARED = SD59x18.wrap(uUNIT_SQUARED);\\n\\n/// @dev Zero as an SD59x18 number.\\nSD59x18 constant ZERO = SD59x18.wrap(0);\\n\",\"keccak256\":\"0x9bcb8dd6b3e886d140ad1c32747a4f6d29a492529ceb835be878ae837aa6cc3a\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when taking the absolute value of `MIN_SD59x18`.\\nerror PRBMath_SD59x18_Abs_MinSD59x18();\\n\\n/// @notice Thrown when ceiling a number overflows SD59x18.\\nerror PRBMath_SD59x18_Ceil_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when converting a basic integer to the fixed-point format overflows SD59x18.\\nerror PRBMath_SD59x18_Convert_Overflow(int256 x);\\n\\n/// @notice Thrown when converting a basic integer to the fixed-point format underflows SD59x18.\\nerror PRBMath_SD59x18_Convert_Underflow(int256 x);\\n\\n/// @notice Thrown when dividing two numbers and one of them is `MIN_SD59x18`.\\nerror PRBMath_SD59x18_Div_InputTooSmall();\\n\\n/// @notice Thrown when dividing two numbers and one of the intermediary unsigned results overflows SD59x18.\\nerror PRBMath_SD59x18_Div_Overflow(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when taking the natural exponent of a base greater than 133_084258667509499441.\\nerror PRBMath_SD59x18_Exp_InputTooBig(SD59x18 x);\\n\\n/// @notice Thrown when taking the binary exponent of a base greater than 192e18.\\nerror PRBMath_SD59x18_Exp2_InputTooBig(SD59x18 x);\\n\\n/// @notice Thrown when flooring a number underflows SD59x18.\\nerror PRBMath_SD59x18_Floor_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when taking the geometric mean of two numbers and their product is negative.\\nerror PRBMath_SD59x18_Gm_NegativeProduct(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when taking the geometric mean of two numbers and multiplying them overflows SD59x18.\\nerror PRBMath_SD59x18_Gm_Overflow(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\\nerror PRBMath_SD59x18_IntoSD1x18_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\\nerror PRBMath_SD59x18_IntoSD1x18_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\\nerror PRBMath_SD59x18_IntoUD2x18_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\\nerror PRBMath_SD59x18_IntoUD2x18_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD60x18.\\nerror PRBMath_SD59x18_IntoUD60x18_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\\nerror PRBMath_SD59x18_IntoUint128_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\\nerror PRBMath_SD59x18_IntoUint128_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint256.\\nerror PRBMath_SD59x18_IntoUint256_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\\nerror PRBMath_SD59x18_IntoUint40_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\\nerror PRBMath_SD59x18_IntoUint40_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when taking the logarithm of a number less than or equal to zero.\\nerror PRBMath_SD59x18_Log_InputTooSmall(SD59x18 x);\\n\\n/// @notice Thrown when multiplying two numbers and one of the inputs is `MIN_SD59x18`.\\nerror PRBMath_SD59x18_Mul_InputTooSmall();\\n\\n/// @notice Thrown when multiplying two numbers and the intermediary absolute result overflows SD59x18.\\nerror PRBMath_SD59x18_Mul_Overflow(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when raising a number to a power and the intermediary absolute result overflows SD59x18.\\nerror PRBMath_SD59x18_Powu_Overflow(SD59x18 x, uint256 y);\\n\\n/// @notice Thrown when taking the square root of a negative number.\\nerror PRBMath_SD59x18_Sqrt_NegativeInput(SD59x18 x);\\n\\n/// @notice Thrown when the calculating the square root overflows SD59x18.\\nerror PRBMath_SD59x18_Sqrt_Overflow(SD59x18 x);\\n\",\"keccak256\":\"0xa6d00fe5efa215ac0df25c896e3da99a12fb61e799644b2ec32da947313d3db4\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Helpers.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { wrap } from \\\"./Casting.sol\\\";\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Implements the checked addition operation (+) in the SD59x18 type.\\nfunction add(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n return wrap(x.unwrap() + y.unwrap());\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the SD59x18 type.\\nfunction and(SD59x18 x, int256 bits) pure returns (SD59x18 result) {\\n return wrap(x.unwrap() & bits);\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the SD59x18 type.\\nfunction and2(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n return wrap(x.unwrap() & y.unwrap());\\n}\\n\\n/// @notice Implements the equal (=) operation in the SD59x18 type.\\nfunction eq(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() == y.unwrap();\\n}\\n\\n/// @notice Implements the greater than operation (>) in the SD59x18 type.\\nfunction gt(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() > y.unwrap();\\n}\\n\\n/// @notice Implements the greater than or equal to operation (>=) in the SD59x18 type.\\nfunction gte(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() >= y.unwrap();\\n}\\n\\n/// @notice Implements a zero comparison check function in the SD59x18 type.\\nfunction isZero(SD59x18 x) pure returns (bool result) {\\n result = x.unwrap() == 0;\\n}\\n\\n/// @notice Implements the left shift operation (<<) in the SD59x18 type.\\nfunction lshift(SD59x18 x, uint256 bits) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() << bits);\\n}\\n\\n/// @notice Implements the lower than operation (<) in the SD59x18 type.\\nfunction lt(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() < y.unwrap();\\n}\\n\\n/// @notice Implements the lower than or equal to operation (<=) in the SD59x18 type.\\nfunction lte(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() <= y.unwrap();\\n}\\n\\n/// @notice Implements the unchecked modulo operation (%) in the SD59x18 type.\\nfunction mod(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() % y.unwrap());\\n}\\n\\n/// @notice Implements the not equal operation (!=) in the SD59x18 type.\\nfunction neq(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() != y.unwrap();\\n}\\n\\n/// @notice Implements the NOT (~) bitwise operation in the SD59x18 type.\\nfunction not(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(~x.unwrap());\\n}\\n\\n/// @notice Implements the OR (|) bitwise operation in the SD59x18 type.\\nfunction or(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() | y.unwrap());\\n}\\n\\n/// @notice Implements the right shift operation (>>) in the SD59x18 type.\\nfunction rshift(SD59x18 x, uint256 bits) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() >> bits);\\n}\\n\\n/// @notice Implements the checked subtraction operation (-) in the SD59x18 type.\\nfunction sub(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() - y.unwrap());\\n}\\n\\n/// @notice Implements the checked unary minus operation (-) in the SD59x18 type.\\nfunction unary(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(-x.unwrap());\\n}\\n\\n/// @notice Implements the unchecked addition operation (+) in the SD59x18 type.\\nfunction uncheckedAdd(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() + y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the unchecked subtraction operation (-) in the SD59x18 type.\\nfunction uncheckedSub(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() - y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the unchecked unary minus operation (-) in the SD59x18 type.\\nfunction uncheckedUnary(SD59x18 x) pure returns (SD59x18 result) {\\n unchecked {\\n result = wrap(-x.unwrap());\\n }\\n}\\n\\n/// @notice Implements the XOR (^) bitwise operation in the SD59x18 type.\\nfunction xor(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() ^ y.unwrap());\\n}\\n\",\"keccak256\":\"0x208570f1657cf730cb6c3d81aa14030e0d45cf906cdedea5059369d7df4bb716\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as Errors;\\nimport {\\n uEXP_MAX_INPUT,\\n uEXP2_MAX_INPUT,\\n uEXP_MIN_THRESHOLD,\\n uEXP2_MIN_THRESHOLD,\\n uHALF_UNIT,\\n uLOG2_10,\\n uLOG2_E,\\n uMAX_SD59x18,\\n uMAX_WHOLE_SD59x18,\\n uMIN_SD59x18,\\n uMIN_WHOLE_SD59x18,\\n UNIT,\\n uUNIT,\\n uUNIT_SQUARED,\\n ZERO\\n} from \\\"./Constants.sol\\\";\\nimport { wrap } from \\\"./Helpers.sol\\\";\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Calculates the absolute value of x.\\n///\\n/// @dev Requirements:\\n/// - x must be greater than `MIN_SD59x18`.\\n///\\n/// @param x The SD59x18 number for which to calculate the absolute value.\\n/// @param result The absolute value of x as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction abs(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt == uMIN_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Abs_MinSD59x18();\\n }\\n result = xInt < 0 ? wrap(-xInt) : x;\\n}\\n\\n/// @notice Calculates the arithmetic average of x and y.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// @param x The first operand as an SD59x18 number.\\n/// @param y The second operand as an SD59x18 number.\\n/// @return result The arithmetic average as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction avg(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n\\n unchecked {\\n // This operation is equivalent to `x / 2 + y / 2`, and it can never overflow.\\n int256 sum = (xInt >> 1) + (yInt >> 1);\\n\\n if (sum < 0) {\\n // If at least one of x and y is odd, add 1 to the result, because shifting negative numbers to the right\\n // rounds toward negative infinity. The right part is equivalent to `sum + (x % 2 == 1 || y % 2 == 1)`.\\n assembly (\\\"memory-safe\\\") {\\n result := add(sum, and(or(xInt, yInt), 1))\\n }\\n } else {\\n // Add 1 if both x and y are odd to account for the double 0.5 remainder truncated after shifting.\\n result = wrap(sum + (xInt & yInt & 1));\\n }\\n }\\n}\\n\\n/// @notice Yields the smallest whole number greater than or equal to x.\\n///\\n/// @dev Optimized for fractional value inputs, because every whole value has (1e18 - 1) fractional counterparts.\\n/// See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n///\\n/// Requirements:\\n/// - x must be less than or equal to `MAX_WHOLE_SD59x18`.\\n///\\n/// @param x The SD59x18 number to ceil.\\n/// @param result The smallest whole number greater than or equal to x, as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ceil(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt > uMAX_WHOLE_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Ceil_Overflow(x);\\n }\\n\\n int256 remainder = xInt % uUNIT;\\n if (remainder == 0) {\\n result = x;\\n } else {\\n unchecked {\\n // Solidity uses C fmod style, which returns a modulus with the same sign as x.\\n int256 resultInt = xInt - remainder;\\n if (xInt > 0) {\\n resultInt += uUNIT;\\n }\\n result = wrap(resultInt);\\n }\\n }\\n}\\n\\n/// @notice Divides two SD59x18 numbers, returning a new SD59x18 number.\\n///\\n/// @dev This is an extension of {Common.mulDiv} for signed numbers, which works by computing the signs and the absolute\\n/// values separately.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv}.\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv}.\\n/// - None of the inputs can be `MIN_SD59x18`.\\n/// - The denominator must not be zero.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The numerator as an SD59x18 number.\\n/// @param y The denominator as an SD59x18 number.\\n/// @param result The quotient as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction div(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n if (xInt == uMIN_SD59x18 || yInt == uMIN_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Div_InputTooSmall();\\n }\\n\\n // Get hold of the absolute values of x and y.\\n uint256 xAbs;\\n uint256 yAbs;\\n unchecked {\\n xAbs = xInt < 0 ? uint256(-xInt) : uint256(xInt);\\n yAbs = yInt < 0 ? uint256(-yInt) : uint256(yInt);\\n }\\n\\n // Compute the absolute value (x*UNIT\\u00f7y). The resulting value must fit in SD59x18.\\n uint256 resultAbs = Common.mulDiv(xAbs, uint256(uUNIT), yAbs);\\n if (resultAbs > uint256(uMAX_SD59x18)) {\\n revert Errors.PRBMath_SD59x18_Div_Overflow(x, y);\\n }\\n\\n // Check if x and y have the same sign using two's complement representation. The left-most bit represents the sign (1 for\\n // negative, 0 for positive or zero).\\n bool sameSign = (xInt ^ yInt) > -1;\\n\\n // If the inputs have the same sign, the result should be positive. Otherwise, it should be negative.\\n unchecked {\\n result = wrap(sameSign ? int256(resultAbs) : -int256(resultAbs));\\n }\\n}\\n\\n/// @notice Calculates the natural exponent of x using the following formula:\\n///\\n/// $$\\n/// e^x = 2^{x * log_2{e}}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {exp2}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {exp2}.\\n/// - x must be less than 133_084258667509499441.\\n///\\n/// @param x The exponent as an SD59x18 number.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n\\n // Any input less than the threshold returns zero.\\n // This check also prevents an overflow for very small numbers.\\n if (xInt < uEXP_MIN_THRESHOLD) {\\n return ZERO;\\n }\\n\\n // This check prevents values greater than 192e18 from being passed to {exp2}.\\n if (xInt > uEXP_MAX_INPUT) {\\n revert Errors.PRBMath_SD59x18_Exp_InputTooBig(x);\\n }\\n\\n unchecked {\\n // Inline the fixed-point multiplication to save gas.\\n int256 doubleUnitProduct = xInt * uLOG2_E;\\n result = exp2(wrap(doubleUnitProduct / uUNIT));\\n }\\n}\\n\\n/// @notice Calculates the binary exponent of x using the binary fraction method using the following formula:\\n///\\n/// $$\\n/// 2^{-x} = \\\\frac{1}{2^x}\\n/// $$\\n///\\n/// @dev See https://ethereum.stackexchange.com/q/79903/24693.\\n///\\n/// Notes:\\n/// - If x is less than -59_794705707972522261, the result is zero.\\n///\\n/// Requirements:\\n/// - x must be less than 192e18.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The exponent as an SD59x18 number.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp2(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < 0) {\\n // The inverse of any number less than the threshold is truncated to zero.\\n if (xInt < uEXP2_MIN_THRESHOLD) {\\n return ZERO;\\n }\\n\\n unchecked {\\n // Inline the fixed-point inversion to save gas.\\n result = wrap(uUNIT_SQUARED / exp2(wrap(-xInt)).unwrap());\\n }\\n } else {\\n // Numbers greater than or equal to 192e18 don't fit in the 192.64-bit format.\\n if (xInt > uEXP2_MAX_INPUT) {\\n revert Errors.PRBMath_SD59x18_Exp2_InputTooBig(x);\\n }\\n\\n unchecked {\\n // Convert x to the 192.64-bit fixed-point format.\\n uint256 x_192x64 = uint256((xInt << 64) / uUNIT);\\n\\n // It is safe to cast the result to int256 due to the checks above.\\n result = wrap(int256(Common.exp2(x_192x64)));\\n }\\n }\\n}\\n\\n/// @notice Yields the greatest whole number less than or equal to x.\\n///\\n/// @dev Optimized for fractional value inputs, because for every whole value there are (1e18 - 1) fractional\\n/// counterparts. See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n///\\n/// Requirements:\\n/// - x must be greater than or equal to `MIN_WHOLE_SD59x18`.\\n///\\n/// @param x The SD59x18 number to floor.\\n/// @param result The greatest whole number less than or equal to x, as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction floor(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < uMIN_WHOLE_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Floor_Underflow(x);\\n }\\n\\n int256 remainder = xInt % uUNIT;\\n if (remainder == 0) {\\n result = x;\\n } else {\\n unchecked {\\n // Solidity uses C fmod style, which returns a modulus with the same sign as x.\\n int256 resultInt = xInt - remainder;\\n if (xInt < 0) {\\n resultInt -= uUNIT;\\n }\\n result = wrap(resultInt);\\n }\\n }\\n}\\n\\n/// @notice Yields the excess beyond the floor of x for positive numbers and the part of the number to the right.\\n/// of the radix point for negative numbers.\\n/// @dev Based on the odd function definition. https://en.wikipedia.org/wiki/Fractional_part\\n/// @param x The SD59x18 number to get the fractional part of.\\n/// @param result The fractional part of x as an SD59x18 number.\\nfunction frac(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() % uUNIT);\\n}\\n\\n/// @notice Calculates the geometric mean of x and y, i.e. $\\\\sqrt{x * y}$.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x * y must fit in SD59x18.\\n/// - x * y must not be negative, since complex numbers are not supported.\\n///\\n/// @param x The first operand as an SD59x18 number.\\n/// @param y The second operand as an SD59x18 number.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction gm(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n if (xInt == 0 || yInt == 0) {\\n return ZERO;\\n }\\n\\n unchecked {\\n // Equivalent to `xy / x != y`. Checking for overflow this way is faster than letting Solidity do it.\\n int256 xyInt = xInt * yInt;\\n if (xyInt / xInt != yInt) {\\n revert Errors.PRBMath_SD59x18_Gm_Overflow(x, y);\\n }\\n\\n // The product must not be negative, since complex numbers are not supported.\\n if (xyInt < 0) {\\n revert Errors.PRBMath_SD59x18_Gm_NegativeProduct(x, y);\\n }\\n\\n // We don't need to multiply the result by `UNIT` here because the x*y product picked up a factor of `UNIT`\\n // during multiplication. See the comments in {Common.sqrt}.\\n uint256 resultUint = Common.sqrt(uint256(xyInt));\\n result = wrap(int256(resultUint));\\n }\\n}\\n\\n/// @notice Calculates the inverse of x.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x must not be zero.\\n///\\n/// @param x The SD59x18 number for which to calculate the inverse.\\n/// @return result The inverse as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction inv(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(uUNIT_SQUARED / x.unwrap());\\n}\\n\\n/// @notice Calculates the natural logarithm of x using the following formula:\\n///\\n/// $$\\n/// ln{x} = log_2{x} / log_2{e}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n/// - The precision isn't sufficiently fine-grained to return exactly `UNIT` when the input is `E`.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The SD59x18 number for which to calculate the natural logarithm.\\n/// @return result The natural logarithm as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ln(SD59x18 x) pure returns (SD59x18 result) {\\n // Inline the fixed-point multiplication to save gas. This is overflow-safe because the maximum value that\\n // {log2} can return is ~195_205294292027477728.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_E);\\n}\\n\\n/// @notice Calculates the common logarithm of x using the following formula:\\n///\\n/// $$\\n/// log_{10}{x} = log_2{x} / log_2{10}\\n/// $$\\n///\\n/// However, if x is an exact power of ten, a hard coded value is returned.\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The SD59x18 number for which to calculate the common logarithm.\\n/// @return result The common logarithm as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log10(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < 0) {\\n revert Errors.PRBMath_SD59x18_Log_InputTooSmall(x);\\n }\\n\\n // Note that the `mul` in this block is the standard multiplication operation, not {SD59x18.mul}.\\n // prettier-ignore\\n assembly (\\\"memory-safe\\\") {\\n switch x\\n case 1 { result := mul(uUNIT, sub(0, 18)) }\\n case 10 { result := mul(uUNIT, sub(1, 18)) }\\n case 100 { result := mul(uUNIT, sub(2, 18)) }\\n case 1000 { result := mul(uUNIT, sub(3, 18)) }\\n case 10000 { result := mul(uUNIT, sub(4, 18)) }\\n case 100000 { result := mul(uUNIT, sub(5, 18)) }\\n case 1000000 { result := mul(uUNIT, sub(6, 18)) }\\n case 10000000 { result := mul(uUNIT, sub(7, 18)) }\\n case 100000000 { result := mul(uUNIT, sub(8, 18)) }\\n case 1000000000 { result := mul(uUNIT, sub(9, 18)) }\\n case 10000000000 { result := mul(uUNIT, sub(10, 18)) }\\n case 100000000000 { result := mul(uUNIT, sub(11, 18)) }\\n case 1000000000000 { result := mul(uUNIT, sub(12, 18)) }\\n case 10000000000000 { result := mul(uUNIT, sub(13, 18)) }\\n case 100000000000000 { result := mul(uUNIT, sub(14, 18)) }\\n case 1000000000000000 { result := mul(uUNIT, sub(15, 18)) }\\n case 10000000000000000 { result := mul(uUNIT, sub(16, 18)) }\\n case 100000000000000000 { result := mul(uUNIT, sub(17, 18)) }\\n case 1000000000000000000 { result := 0 }\\n case 10000000000000000000 { result := uUNIT }\\n case 100000000000000000000 { result := mul(uUNIT, 2) }\\n case 1000000000000000000000 { result := mul(uUNIT, 3) }\\n case 10000000000000000000000 { result := mul(uUNIT, 4) }\\n case 100000000000000000000000 { result := mul(uUNIT, 5) }\\n case 1000000000000000000000000 { result := mul(uUNIT, 6) }\\n case 10000000000000000000000000 { result := mul(uUNIT, 7) }\\n case 100000000000000000000000000 { result := mul(uUNIT, 8) }\\n case 1000000000000000000000000000 { result := mul(uUNIT, 9) }\\n case 10000000000000000000000000000 { result := mul(uUNIT, 10) }\\n case 100000000000000000000000000000 { result := mul(uUNIT, 11) }\\n case 1000000000000000000000000000000 { result := mul(uUNIT, 12) }\\n case 10000000000000000000000000000000 { result := mul(uUNIT, 13) }\\n case 100000000000000000000000000000000 { result := mul(uUNIT, 14) }\\n case 1000000000000000000000000000000000 { result := mul(uUNIT, 15) }\\n case 10000000000000000000000000000000000 { result := mul(uUNIT, 16) }\\n case 100000000000000000000000000000000000 { result := mul(uUNIT, 17) }\\n case 1000000000000000000000000000000000000 { result := mul(uUNIT, 18) }\\n case 10000000000000000000000000000000000000 { result := mul(uUNIT, 19) }\\n case 100000000000000000000000000000000000000 { result := mul(uUNIT, 20) }\\n case 1000000000000000000000000000000000000000 { result := mul(uUNIT, 21) }\\n case 10000000000000000000000000000000000000000 { result := mul(uUNIT, 22) }\\n case 100000000000000000000000000000000000000000 { result := mul(uUNIT, 23) }\\n case 1000000000000000000000000000000000000000000 { result := mul(uUNIT, 24) }\\n case 10000000000000000000000000000000000000000000 { result := mul(uUNIT, 25) }\\n case 100000000000000000000000000000000000000000000 { result := mul(uUNIT, 26) }\\n case 1000000000000000000000000000000000000000000000 { result := mul(uUNIT, 27) }\\n case 10000000000000000000000000000000000000000000000 { result := mul(uUNIT, 28) }\\n case 100000000000000000000000000000000000000000000000 { result := mul(uUNIT, 29) }\\n case 1000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 30) }\\n case 10000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 31) }\\n case 100000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 32) }\\n case 1000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 33) }\\n case 10000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 34) }\\n case 100000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 35) }\\n case 1000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 36) }\\n case 10000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 37) }\\n case 100000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 38) }\\n case 1000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 39) }\\n case 10000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 40) }\\n case 100000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 41) }\\n case 1000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 42) }\\n case 10000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 43) }\\n case 100000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 44) }\\n case 1000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 45) }\\n case 10000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 46) }\\n case 100000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 47) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 48) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 49) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 50) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 51) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 52) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 53) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 54) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 55) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 56) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 57) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 58) }\\n default { result := uMAX_SD59x18 }\\n }\\n\\n if (result.unwrap() == uMAX_SD59x18) {\\n unchecked {\\n // Inline the fixed-point division to save gas.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_10);\\n }\\n }\\n}\\n\\n/// @notice Calculates the binary logarithm of x using the iterative approximation algorithm:\\n///\\n/// $$\\n/// log_2{x} = n + log_2{y}, \\\\text{ where } y = x*2^{-n}, \\\\ y \\\\in [1, 2)\\n/// $$\\n///\\n/// For $0 \\\\leq x \\\\lt 1$, the input is inverted:\\n///\\n/// $$\\n/// log_2{x} = -log_2{\\\\frac{1}{x}}\\n/// $$\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Binary_logarithm#Iterative_approximation.\\n///\\n/// Notes:\\n/// - Due to the lossy precision of the iterative approximation, the results are not perfectly accurate to the last decimal.\\n///\\n/// Requirements:\\n/// - x must be greater than zero.\\n///\\n/// @param x The SD59x18 number for which to calculate the binary logarithm.\\n/// @return result The binary logarithm as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log2(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt <= 0) {\\n revert Errors.PRBMath_SD59x18_Log_InputTooSmall(x);\\n }\\n\\n unchecked {\\n int256 sign;\\n if (xInt >= uUNIT) {\\n sign = 1;\\n } else {\\n sign = -1;\\n // Inline the fixed-point inversion to save gas.\\n xInt = uUNIT_SQUARED / xInt;\\n }\\n\\n // Calculate the integer part of the logarithm.\\n uint256 n = Common.msb(uint256(xInt / uUNIT));\\n\\n // This is the integer part of the logarithm as an SD59x18 number. The operation can't overflow\\n // because n is at most 255, `UNIT` is 1e18, and the sign is either 1 or -1.\\n int256 resultInt = int256(n) * uUNIT;\\n\\n // Calculate $y = x * 2^{-n}$.\\n int256 y = xInt >> n;\\n\\n // If y is the unit number, the fractional part is zero.\\n if (y == uUNIT) {\\n return wrap(resultInt * sign);\\n }\\n\\n // Calculate the fractional part via the iterative approximation.\\n // The `delta >>= 1` part is equivalent to `delta /= 2`, but shifting bits is more gas efficient.\\n int256 DOUBLE_UNIT = 2e18;\\n for (int256 delta = uHALF_UNIT; delta > 0; delta >>= 1) {\\n y = (y * y) / uUNIT;\\n\\n // Is y^2 >= 2e18 and so in the range [2e18, 4e18)?\\n if (y >= DOUBLE_UNIT) {\\n // Add the 2^{-m} factor to the logarithm.\\n resultInt = resultInt + delta;\\n\\n // Halve y, which corresponds to z/2 in the Wikipedia article.\\n y >>= 1;\\n }\\n }\\n resultInt *= sign;\\n result = wrap(resultInt);\\n }\\n}\\n\\n/// @notice Multiplies two SD59x18 numbers together, returning a new SD59x18 number.\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {Common.mulDiv18}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv18}.\\n/// - None of the inputs can be `MIN_SD59x18`.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The multiplicand as an SD59x18 number.\\n/// @param y The multiplier as an SD59x18 number.\\n/// @return result The product as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mul(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n if (xInt == uMIN_SD59x18 || yInt == uMIN_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Mul_InputTooSmall();\\n }\\n\\n // Get hold of the absolute values of x and y.\\n uint256 xAbs;\\n uint256 yAbs;\\n unchecked {\\n xAbs = xInt < 0 ? uint256(-xInt) : uint256(xInt);\\n yAbs = yInt < 0 ? uint256(-yInt) : uint256(yInt);\\n }\\n\\n // Compute the absolute value (x*y\\u00f7UNIT). The resulting value must fit in SD59x18.\\n uint256 resultAbs = Common.mulDiv18(xAbs, yAbs);\\n if (resultAbs > uint256(uMAX_SD59x18)) {\\n revert Errors.PRBMath_SD59x18_Mul_Overflow(x, y);\\n }\\n\\n // Check if x and y have the same sign using two's complement representation. The left-most bit represents the sign (1 for\\n // negative, 0 for positive or zero).\\n bool sameSign = (xInt ^ yInt) > -1;\\n\\n // If the inputs have the same sign, the result should be positive. Otherwise, it should be negative.\\n unchecked {\\n result = wrap(sameSign ? int256(resultAbs) : -int256(resultAbs));\\n }\\n}\\n\\n/// @notice Raises x to the power of y using the following formula:\\n///\\n/// $$\\n/// x^y = 2^{log_2{x} * y}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {exp2}, {log2}, and {mul}.\\n/// - Returns `UNIT` for 0^0.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {exp2}, {log2}, and {mul}.\\n///\\n/// @param x The base as an SD59x18 number.\\n/// @param y Exponent to raise x to, as an SD59x18 number\\n/// @return result x raised to power y, as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction pow(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n\\n // If both x and y are zero, the result is `UNIT`. If just x is zero, the result is always zero.\\n if (xInt == 0) {\\n return yInt == 0 ? UNIT : ZERO;\\n }\\n // If x is `UNIT`, the result is always `UNIT`.\\n else if (xInt == uUNIT) {\\n return UNIT;\\n }\\n\\n // If y is zero, the result is always `UNIT`.\\n if (yInt == 0) {\\n return UNIT;\\n }\\n // If y is `UNIT`, the result is always x.\\n else if (yInt == uUNIT) {\\n return x;\\n }\\n\\n // Calculate the result using the formula.\\n result = exp2(mul(log2(x), y));\\n}\\n\\n/// @notice Raises x (an SD59x18 number) to the power y (an unsigned basic integer) using the well-known\\n/// algorithm \\\"exponentiation by squaring\\\".\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Exponentiation_by_squaring.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv18}.\\n/// - Returns `UNIT` for 0^0.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {abs} and {Common.mulDiv18}.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The base as an SD59x18 number.\\n/// @param y The exponent as a uint256.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction powu(SD59x18 x, uint256 y) pure returns (SD59x18 result) {\\n uint256 xAbs = uint256(abs(x).unwrap());\\n\\n // Calculate the first iteration of the loop in advance.\\n uint256 resultAbs = y & 1 > 0 ? xAbs : uint256(uUNIT);\\n\\n // Equivalent to `for(y /= 2; y > 0; y /= 2)`.\\n uint256 yAux = y;\\n for (yAux >>= 1; yAux > 0; yAux >>= 1) {\\n xAbs = Common.mulDiv18(xAbs, xAbs);\\n\\n // Equivalent to `y % 2 == 1`.\\n if (yAux & 1 > 0) {\\n resultAbs = Common.mulDiv18(resultAbs, xAbs);\\n }\\n }\\n\\n // The result must fit in SD59x18.\\n if (resultAbs > uint256(uMAX_SD59x18)) {\\n revert Errors.PRBMath_SD59x18_Powu_Overflow(x, y);\\n }\\n\\n unchecked {\\n // Is the base negative and the exponent odd? If yes, the result should be negative.\\n int256 resultInt = int256(resultAbs);\\n bool isNegative = x.unwrap() < 0 && y & 1 == 1;\\n if (isNegative) {\\n resultInt = -resultInt;\\n }\\n result = wrap(resultInt);\\n }\\n}\\n\\n/// @notice Calculates the square root of x using the Babylonian method.\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\\n///\\n/// Notes:\\n/// - Only the positive root is returned.\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x cannot be negative, since complex numbers are not supported.\\n/// - x must be less than `MAX_SD59x18 / UNIT`.\\n///\\n/// @param x The SD59x18 number for which to calculate the square root.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction sqrt(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < 0) {\\n revert Errors.PRBMath_SD59x18_Sqrt_NegativeInput(x);\\n }\\n if (xInt > uMAX_SD59x18 / uUNIT) {\\n revert Errors.PRBMath_SD59x18_Sqrt_Overflow(x);\\n }\\n\\n unchecked {\\n // Multiply x by `UNIT` to account for the factor of `UNIT` picked up when multiplying two SD59x18 numbers.\\n // In this case, the two numbers are both the square root.\\n uint256 resultUint = Common.sqrt(uint256(xInt * uUNIT));\\n result = wrap(int256(resultUint));\\n }\\n}\\n\",\"keccak256\":\"0xa074831139fc89ca0e5a36086b30eb50896bb6770cd5823461b1f2769017d2f0\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\nimport \\\"./Helpers.sol\\\" as Helpers;\\nimport \\\"./Math.sol\\\" as Math;\\n\\n/// @notice The signed 59.18-decimal fixed-point number representation, which can have up to 59 digits and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\\n/// type int256.\\ntype SD59x18 is int256;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoInt256,\\n Casting.intoSD1x18,\\n Casting.intoUD2x18,\\n Casting.intoUD60x18,\\n Casting.intoUint256,\\n Casting.intoUint128,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for SD59x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n MATHEMATICAL FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Math.abs,\\n Math.avg,\\n Math.ceil,\\n Math.div,\\n Math.exp,\\n Math.exp2,\\n Math.floor,\\n Math.frac,\\n Math.gm,\\n Math.inv,\\n Math.log10,\\n Math.log2,\\n Math.ln,\\n Math.mul,\\n Math.pow,\\n Math.powu,\\n Math.sqrt\\n} for SD59x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n HELPER FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Helpers.add,\\n Helpers.and,\\n Helpers.eq,\\n Helpers.gt,\\n Helpers.gte,\\n Helpers.isZero,\\n Helpers.lshift,\\n Helpers.lt,\\n Helpers.lte,\\n Helpers.mod,\\n Helpers.neq,\\n Helpers.not,\\n Helpers.or,\\n Helpers.rshift,\\n Helpers.sub,\\n Helpers.uncheckedAdd,\\n Helpers.uncheckedSub,\\n Helpers.uncheckedUnary,\\n Helpers.xor\\n} for SD59x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n OPERATORS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes it possible to use these operators on the SD59x18 type.\\nusing {\\n Helpers.add as +,\\n Helpers.and2 as &,\\n Math.div as /,\\n Helpers.eq as ==,\\n Helpers.gt as >,\\n Helpers.gte as >=,\\n Helpers.lt as <,\\n Helpers.lte as <=,\\n Helpers.mod as %,\\n Math.mul as *,\\n Helpers.neq as !=,\\n Helpers.not as ~,\\n Helpers.or as |,\\n Helpers.sub as -,\\n Helpers.unary as -,\\n Helpers.xor as ^\\n} for SD59x18 global;\\n\",\"keccak256\":\"0xe03112d145dcd5863aff24e5f381debaae29d446acd5666f3d640e3d9af738d7\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as Errors;\\nimport { uMAX_SD1x18 } from \\\"../sd1x18/Constants.sol\\\";\\nimport { SD1x18 } from \\\"../sd1x18/ValueType.sol\\\";\\nimport { SD59x18 } from \\\"../sd59x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"../ud60x18/ValueType.sol\\\";\\nimport { UD2x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts a UD2x18 number into SD1x18.\\n/// - x must be less than or equal to `uMAX_SD1x18`.\\nfunction intoSD1x18(UD2x18 x) pure returns (SD1x18 result) {\\n uint64 xUint = UD2x18.unwrap(x);\\n if (xUint > uint64(uMAX_SD1x18)) {\\n revert Errors.PRBMath_UD2x18_IntoSD1x18_Overflow(x);\\n }\\n result = SD1x18.wrap(int64(xUint));\\n}\\n\\n/// @notice Casts a UD2x18 number into SD59x18.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of SD59x18.\\nfunction intoSD59x18(UD2x18 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(int256(uint256(UD2x18.unwrap(x))));\\n}\\n\\n/// @notice Casts a UD2x18 number into UD60x18.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of UD60x18.\\nfunction intoUD60x18(UD2x18 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(UD2x18.unwrap(x));\\n}\\n\\n/// @notice Casts a UD2x18 number into uint128.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of uint128.\\nfunction intoUint128(UD2x18 x) pure returns (uint128 result) {\\n result = uint128(UD2x18.unwrap(x));\\n}\\n\\n/// @notice Casts a UD2x18 number into uint256.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of uint256.\\nfunction intoUint256(UD2x18 x) pure returns (uint256 result) {\\n result = uint256(UD2x18.unwrap(x));\\n}\\n\\n/// @notice Casts a UD2x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(UD2x18 x) pure returns (uint40 result) {\\n uint64 xUint = UD2x18.unwrap(x);\\n if (xUint > uint64(Common.MAX_UINT40)) {\\n revert Errors.PRBMath_UD2x18_IntoUint40_Overflow(x);\\n }\\n result = uint40(xUint);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction ud2x18(uint64 x) pure returns (UD2x18 result) {\\n result = UD2x18.wrap(x);\\n}\\n\\n/// @notice Unwrap a UD2x18 number into uint64.\\nfunction unwrap(UD2x18 x) pure returns (uint64 result) {\\n result = UD2x18.unwrap(x);\\n}\\n\\n/// @notice Wraps a uint64 number into UD2x18.\\nfunction wrap(uint64 x) pure returns (UD2x18 result) {\\n result = UD2x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x9b1a35d432ef951a415fae8098b3c609a99b630a3d5464b3c8e1efa8893eea07\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD2x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @dev Euler's number as a UD2x18 number.\\nUD2x18 constant E = UD2x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum value a UD2x18 number can have.\\nuint64 constant uMAX_UD2x18 = 18_446744073709551615;\\nUD2x18 constant MAX_UD2x18 = UD2x18.wrap(uMAX_UD2x18);\\n\\n/// @dev PI as a UD2x18 number.\\nUD2x18 constant PI = UD2x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of UD2x18.\\nUD2x18 constant UNIT = UD2x18.wrap(1e18);\\nuint64 constant uUNIT = 1e18;\\n\",\"keccak256\":\"0x29b0e050c865899e1fb9022b460a7829cdee248c44c4299f068ba80695eec3fc\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD2x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when trying to cast a UD2x18 number that doesn't fit in SD1x18.\\nerror PRBMath_UD2x18_IntoSD1x18_Overflow(UD2x18 x);\\n\\n/// @notice Thrown when trying to cast a UD2x18 number that doesn't fit in uint40.\\nerror PRBMath_UD2x18_IntoUint40_Overflow(UD2x18 x);\\n\",\"keccak256\":\"0xdf1e22f0b4c8032bcc8b7f63fe3984e1387f3dc7b2e9ab381822249f75376d33\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\n\\n/// @notice The unsigned 2.18-decimal fixed-point number representation, which can have up to 2 digits and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\\n/// type uint64. This is useful when end users want to use uint64 to save gas, e.g. with tight variable packing in contract\\n/// storage.\\ntype UD2x18 is uint64;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoSD1x18,\\n Casting.intoSD59x18,\\n Casting.intoUD60x18,\\n Casting.intoUint256,\\n Casting.intoUint128,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for UD2x18 global;\\n\",\"keccak256\":\"0x2802edc9869db116a0b5c490cc5f8554742f747183fa30ac5e9c80bb967e61a1\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Errors.sol\\\" as CastingErrors;\\nimport { MAX_UINT128, MAX_UINT40 } from \\\"../Common.sol\\\";\\nimport { uMAX_SD1x18 } from \\\"../sd1x18/Constants.sol\\\";\\nimport { SD1x18 } from \\\"../sd1x18/ValueType.sol\\\";\\nimport { uMAX_SD59x18 } from \\\"../sd59x18/Constants.sol\\\";\\nimport { SD59x18 } from \\\"../sd59x18/ValueType.sol\\\";\\nimport { uMAX_UD2x18 } from \\\"../ud2x18/Constants.sol\\\";\\nimport { UD2x18 } from \\\"../ud2x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts a UD60x18 number into SD1x18.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `uMAX_SD1x18`.\\nfunction intoSD1x18(UD60x18 x) pure returns (SD1x18 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > uint256(int256(uMAX_SD1x18))) {\\n revert CastingErrors.PRBMath_UD60x18_IntoSD1x18_Overflow(x);\\n }\\n result = SD1x18.wrap(int64(uint64(xUint)));\\n}\\n\\n/// @notice Casts a UD60x18 number into UD2x18.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `uMAX_UD2x18`.\\nfunction intoUD2x18(UD60x18 x) pure returns (UD2x18 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > uMAX_UD2x18) {\\n revert CastingErrors.PRBMath_UD60x18_IntoUD2x18_Overflow(x);\\n }\\n result = UD2x18.wrap(uint64(xUint));\\n}\\n\\n/// @notice Casts a UD60x18 number into SD59x18.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `uMAX_SD59x18`.\\nfunction intoSD59x18(UD60x18 x) pure returns (SD59x18 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > uint256(uMAX_SD59x18)) {\\n revert CastingErrors.PRBMath_UD60x18_IntoSD59x18_Overflow(x);\\n }\\n result = SD59x18.wrap(int256(xUint));\\n}\\n\\n/// @notice Casts a UD60x18 number into uint128.\\n/// @dev This is basically an alias for {unwrap}.\\nfunction intoUint256(UD60x18 x) pure returns (uint256 result) {\\n result = UD60x18.unwrap(x);\\n}\\n\\n/// @notice Casts a UD60x18 number into uint128.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UINT128`.\\nfunction intoUint128(UD60x18 x) pure returns (uint128 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > MAX_UINT128) {\\n revert CastingErrors.PRBMath_UD60x18_IntoUint128_Overflow(x);\\n }\\n result = uint128(xUint);\\n}\\n\\n/// @notice Casts a UD60x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(UD60x18 x) pure returns (uint40 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > MAX_UINT40) {\\n revert CastingErrors.PRBMath_UD60x18_IntoUint40_Overflow(x);\\n }\\n result = uint40(xUint);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction ud(uint256 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(x);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction ud60x18(uint256 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(x);\\n}\\n\\n/// @notice Unwraps a UD60x18 number into uint256.\\nfunction unwrap(UD60x18 x) pure returns (uint256 result) {\\n result = UD60x18.unwrap(x);\\n}\\n\\n/// @notice Wraps a uint256 number into the UD60x18 value type.\\nfunction wrap(uint256 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x5bb532da36921cbdac64d1f16de5d366ef1f664502e3b7c07d0ad06917551f85\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n// NOTICE: the \\\"u\\\" prefix stands for \\\"unwrapped\\\".\\n\\n/// @dev Euler's number as a UD60x18 number.\\nUD60x18 constant E = UD60x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum input permitted in {exp}.\\nuint256 constant uEXP_MAX_INPUT = 133_084258667509499440;\\nUD60x18 constant EXP_MAX_INPUT = UD60x18.wrap(uEXP_MAX_INPUT);\\n\\n/// @dev The maximum input permitted in {exp2}.\\nuint256 constant uEXP2_MAX_INPUT = 192e18 - 1;\\nUD60x18 constant EXP2_MAX_INPUT = UD60x18.wrap(uEXP2_MAX_INPUT);\\n\\n/// @dev Half the UNIT number.\\nuint256 constant uHALF_UNIT = 0.5e18;\\nUD60x18 constant HALF_UNIT = UD60x18.wrap(uHALF_UNIT);\\n\\n/// @dev $log_2(10)$ as a UD60x18 number.\\nuint256 constant uLOG2_10 = 3_321928094887362347;\\nUD60x18 constant LOG2_10 = UD60x18.wrap(uLOG2_10);\\n\\n/// @dev $log_2(e)$ as a UD60x18 number.\\nuint256 constant uLOG2_E = 1_442695040888963407;\\nUD60x18 constant LOG2_E = UD60x18.wrap(uLOG2_E);\\n\\n/// @dev The maximum value a UD60x18 number can have.\\nuint256 constant uMAX_UD60x18 = 115792089237316195423570985008687907853269984665640564039457_584007913129639935;\\nUD60x18 constant MAX_UD60x18 = UD60x18.wrap(uMAX_UD60x18);\\n\\n/// @dev The maximum whole value a UD60x18 number can have.\\nuint256 constant uMAX_WHOLE_UD60x18 = 115792089237316195423570985008687907853269984665640564039457_000000000000000000;\\nUD60x18 constant MAX_WHOLE_UD60x18 = UD60x18.wrap(uMAX_WHOLE_UD60x18);\\n\\n/// @dev PI as a UD60x18 number.\\nUD60x18 constant PI = UD60x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of UD60x18.\\nuint256 constant uUNIT = 1e18;\\nUD60x18 constant UNIT = UD60x18.wrap(uUNIT);\\n\\n/// @dev The unit number squared.\\nuint256 constant uUNIT_SQUARED = 1e36;\\nUD60x18 constant UNIT_SQUARED = UD60x18.wrap(uUNIT_SQUARED);\\n\\n/// @dev Zero as a UD60x18 number.\\nUD60x18 constant ZERO = UD60x18.wrap(0);\\n\",\"keccak256\":\"0x2b80d26153d3fdcfb3a9ca772d9309d31ed1275f5b8b54c3ffb54d3652b37d90\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Conversions.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { uMAX_UD60x18, uUNIT } from \\\"./Constants.sol\\\";\\nimport { PRBMath_UD60x18_Convert_Overflow } from \\\"./Errors.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Converts a UD60x18 number to a simple integer by dividing it by `UNIT`.\\n/// @dev The result is rounded toward zero.\\n/// @param x The UD60x18 number to convert.\\n/// @return result The same number in basic integer form.\\nfunction convert(UD60x18 x) pure returns (uint256 result) {\\n result = UD60x18.unwrap(x) / uUNIT;\\n}\\n\\n/// @notice Converts a simple integer to UD60x18 by multiplying it by `UNIT`.\\n///\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UD60x18 / UNIT`.\\n///\\n/// @param x The basic integer to convert.\\n/// @param result The same number converted to UD60x18.\\nfunction convert(uint256 x) pure returns (UD60x18 result) {\\n if (x > uMAX_UD60x18 / uUNIT) {\\n revert PRBMath_UD60x18_Convert_Overflow(x);\\n }\\n unchecked {\\n result = UD60x18.wrap(x * uUNIT);\\n }\\n}\\n\",\"keccak256\":\"0xaf7fc2523413822de3b66ba339fe2884fb3b8c6f6cf38ec90a2c3e3aae71df6b\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when ceiling a number overflows UD60x18.\\nerror PRBMath_UD60x18_Ceil_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when converting a basic integer to the fixed-point format overflows UD60x18.\\nerror PRBMath_UD60x18_Convert_Overflow(uint256 x);\\n\\n/// @notice Thrown when taking the natural exponent of a base greater than 133_084258667509499441.\\nerror PRBMath_UD60x18_Exp_InputTooBig(UD60x18 x);\\n\\n/// @notice Thrown when taking the binary exponent of a base greater than 192e18.\\nerror PRBMath_UD60x18_Exp2_InputTooBig(UD60x18 x);\\n\\n/// @notice Thrown when taking the geometric mean of two numbers and multiplying them overflows UD60x18.\\nerror PRBMath_UD60x18_Gm_Overflow(UD60x18 x, UD60x18 y);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\\nerror PRBMath_UD60x18_IntoSD1x18_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD59x18.\\nerror PRBMath_UD60x18_IntoSD59x18_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\\nerror PRBMath_UD60x18_IntoUD2x18_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\\nerror PRBMath_UD60x18_IntoUint128_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\\nerror PRBMath_UD60x18_IntoUint40_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when taking the logarithm of a number less than 1.\\nerror PRBMath_UD60x18_Log_InputTooSmall(UD60x18 x);\\n\\n/// @notice Thrown when calculating the square root overflows UD60x18.\\nerror PRBMath_UD60x18_Sqrt_Overflow(UD60x18 x);\\n\",\"keccak256\":\"0xa8c60d4066248df22c49c882873efbc017344107edabc48c52209abbc39cb1e3\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Helpers.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { wrap } from \\\"./Casting.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Implements the checked addition operation (+) in the UD60x18 type.\\nfunction add(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() + y.unwrap());\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the UD60x18 type.\\nfunction and(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() & bits);\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the UD60x18 type.\\nfunction and2(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() & y.unwrap());\\n}\\n\\n/// @notice Implements the equal operation (==) in the UD60x18 type.\\nfunction eq(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() == y.unwrap();\\n}\\n\\n/// @notice Implements the greater than operation (>) in the UD60x18 type.\\nfunction gt(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() > y.unwrap();\\n}\\n\\n/// @notice Implements the greater than or equal to operation (>=) in the UD60x18 type.\\nfunction gte(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() >= y.unwrap();\\n}\\n\\n/// @notice Implements a zero comparison check function in the UD60x18 type.\\nfunction isZero(UD60x18 x) pure returns (bool result) {\\n // This wouldn't work if x could be negative.\\n result = x.unwrap() == 0;\\n}\\n\\n/// @notice Implements the left shift operation (<<) in the UD60x18 type.\\nfunction lshift(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() << bits);\\n}\\n\\n/// @notice Implements the lower than operation (<) in the UD60x18 type.\\nfunction lt(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() < y.unwrap();\\n}\\n\\n/// @notice Implements the lower than or equal to operation (<=) in the UD60x18 type.\\nfunction lte(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() <= y.unwrap();\\n}\\n\\n/// @notice Implements the checked modulo operation (%) in the UD60x18 type.\\nfunction mod(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() % y.unwrap());\\n}\\n\\n/// @notice Implements the not equal operation (!=) in the UD60x18 type.\\nfunction neq(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() != y.unwrap();\\n}\\n\\n/// @notice Implements the NOT (~) bitwise operation in the UD60x18 type.\\nfunction not(UD60x18 x) pure returns (UD60x18 result) {\\n result = wrap(~x.unwrap());\\n}\\n\\n/// @notice Implements the OR (|) bitwise operation in the UD60x18 type.\\nfunction or(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() | y.unwrap());\\n}\\n\\n/// @notice Implements the right shift operation (>>) in the UD60x18 type.\\nfunction rshift(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() >> bits);\\n}\\n\\n/// @notice Implements the checked subtraction operation (-) in the UD60x18 type.\\nfunction sub(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() - y.unwrap());\\n}\\n\\n/// @notice Implements the unchecked addition operation (+) in the UD60x18 type.\\nfunction uncheckedAdd(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() + y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the unchecked subtraction operation (-) in the UD60x18 type.\\nfunction uncheckedSub(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() - y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the XOR (^) bitwise operation in the UD60x18 type.\\nfunction xor(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() ^ y.unwrap());\\n}\\n\",\"keccak256\":\"0xf5faff881391d2c060029499a666cc5f0bea90a213150bb476fae8f02a5df268\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as Errors;\\nimport { wrap } from \\\"./Casting.sol\\\";\\nimport {\\n uEXP_MAX_INPUT,\\n uEXP2_MAX_INPUT,\\n uHALF_UNIT,\\n uLOG2_10,\\n uLOG2_E,\\n uMAX_UD60x18,\\n uMAX_WHOLE_UD60x18,\\n UNIT,\\n uUNIT,\\n uUNIT_SQUARED,\\n ZERO\\n} from \\\"./Constants.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n MATHEMATICAL FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @notice Calculates the arithmetic average of x and y using the following formula:\\n///\\n/// $$\\n/// avg(x, y) = (x & y) + ((xUint ^ yUint) / 2)\\n/// $$\\n///\\n/// In English, this is what this formula does:\\n///\\n/// 1. AND x and y.\\n/// 2. Calculate half of XOR x and y.\\n/// 3. Add the two results together.\\n///\\n/// This technique is known as SWAR, which stands for \\\"SIMD within a register\\\". You can read more about it here:\\n/// https://devblogs.microsoft.com/oldnewthing/20220207-00/?p=106223\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// @param x The first operand as a UD60x18 number.\\n/// @param y The second operand as a UD60x18 number.\\n/// @return result The arithmetic average as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction avg(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n uint256 yUint = y.unwrap();\\n unchecked {\\n result = wrap((xUint & yUint) + ((xUint ^ yUint) >> 1));\\n }\\n}\\n\\n/// @notice Yields the smallest whole number greater than or equal to x.\\n///\\n/// @dev This is optimized for fractional value inputs, because for every whole value there are (1e18 - 1) fractional\\n/// counterparts. See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n///\\n/// Requirements:\\n/// - x must be less than or equal to `MAX_WHOLE_UD60x18`.\\n///\\n/// @param x The UD60x18 number to ceil.\\n/// @param result The smallest whole number greater than or equal to x, as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ceil(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n if (xUint > uMAX_WHOLE_UD60x18) {\\n revert Errors.PRBMath_UD60x18_Ceil_Overflow(x);\\n }\\n\\n assembly (\\\"memory-safe\\\") {\\n // Equivalent to `x % UNIT`.\\n let remainder := mod(x, uUNIT)\\n\\n // Equivalent to `UNIT - remainder`.\\n let delta := sub(uUNIT, remainder)\\n\\n // Equivalent to `x + remainder > 0 ? delta : 0`.\\n result := add(x, mul(delta, gt(remainder, 0)))\\n }\\n}\\n\\n/// @notice Divides two UD60x18 numbers, returning a new UD60x18 number.\\n///\\n/// @dev Uses {Common.mulDiv} to enable overflow-safe multiplication and division.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv}.\\n///\\n/// @param x The numerator as a UD60x18 number.\\n/// @param y The denominator as a UD60x18 number.\\n/// @param result The quotient as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction div(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(Common.mulDiv(x.unwrap(), uUNIT, y.unwrap()));\\n}\\n\\n/// @notice Calculates the natural exponent of x using the following formula:\\n///\\n/// $$\\n/// e^x = 2^{x * log_2{e}}\\n/// $$\\n///\\n/// @dev Requirements:\\n/// - x must be less than 133_084258667509499441.\\n///\\n/// @param x The exponent as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n // This check prevents values greater than 192e18 from being passed to {exp2}.\\n if (xUint > uEXP_MAX_INPUT) {\\n revert Errors.PRBMath_UD60x18_Exp_InputTooBig(x);\\n }\\n\\n unchecked {\\n // Inline the fixed-point multiplication to save gas.\\n uint256 doubleUnitProduct = xUint * uLOG2_E;\\n result = exp2(wrap(doubleUnitProduct / uUNIT));\\n }\\n}\\n\\n/// @notice Calculates the binary exponent of x using the binary fraction method.\\n///\\n/// @dev See https://ethereum.stackexchange.com/q/79903/24693\\n///\\n/// Requirements:\\n/// - x must be less than 192e18.\\n/// - The result must fit in UD60x18.\\n///\\n/// @param x The exponent as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp2(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n // Numbers greater than or equal to 192e18 don't fit in the 192.64-bit format.\\n if (xUint > uEXP2_MAX_INPUT) {\\n revert Errors.PRBMath_UD60x18_Exp2_InputTooBig(x);\\n }\\n\\n // Convert x to the 192.64-bit fixed-point format.\\n uint256 x_192x64 = (xUint << 64) / uUNIT;\\n\\n // Pass x to the {Common.exp2} function, which uses the 192.64-bit fixed-point number representation.\\n result = wrap(Common.exp2(x_192x64));\\n}\\n\\n/// @notice Yields the greatest whole number less than or equal to x.\\n/// @dev Optimized for fractional value inputs, because every whole value has (1e18 - 1) fractional counterparts.\\n/// See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n/// @param x The UD60x18 number to floor.\\n/// @param result The greatest whole number less than or equal to x, as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction floor(UD60x18 x) pure returns (UD60x18 result) {\\n assembly (\\\"memory-safe\\\") {\\n // Equivalent to `x % UNIT`.\\n let remainder := mod(x, uUNIT)\\n\\n // Equivalent to `x - remainder > 0 ? remainder : 0)`.\\n result := sub(x, mul(remainder, gt(remainder, 0)))\\n }\\n}\\n\\n/// @notice Yields the excess beyond the floor of x using the odd function definition.\\n/// @dev See https://en.wikipedia.org/wiki/Fractional_part.\\n/// @param x The UD60x18 number to get the fractional part of.\\n/// @param result The fractional part of x as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction frac(UD60x18 x) pure returns (UD60x18 result) {\\n assembly (\\\"memory-safe\\\") {\\n result := mod(x, uUNIT)\\n }\\n}\\n\\n/// @notice Calculates the geometric mean of x and y, i.e. $\\\\sqrt{x * y}$, rounding down.\\n///\\n/// @dev Requirements:\\n/// - x * y must fit in UD60x18.\\n///\\n/// @param x The first operand as a UD60x18 number.\\n/// @param y The second operand as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction gm(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n uint256 yUint = y.unwrap();\\n if (xUint == 0 || yUint == 0) {\\n return ZERO;\\n }\\n\\n unchecked {\\n // Checking for overflow this way is faster than letting Solidity do it.\\n uint256 xyUint = xUint * yUint;\\n if (xyUint / xUint != yUint) {\\n revert Errors.PRBMath_UD60x18_Gm_Overflow(x, y);\\n }\\n\\n // We don't need to multiply the result by `UNIT` here because the x*y product picked up a factor of `UNIT`\\n // during multiplication. See the comments in {Common.sqrt}.\\n result = wrap(Common.sqrt(xyUint));\\n }\\n}\\n\\n/// @notice Calculates the inverse of x.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x must not be zero.\\n///\\n/// @param x The UD60x18 number for which to calculate the inverse.\\n/// @return result The inverse as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction inv(UD60x18 x) pure returns (UD60x18 result) {\\n unchecked {\\n result = wrap(uUNIT_SQUARED / x.unwrap());\\n }\\n}\\n\\n/// @notice Calculates the natural logarithm of x using the following formula:\\n///\\n/// $$\\n/// ln{x} = log_2{x} / log_2{e}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n/// - The precision isn't sufficiently fine-grained to return exactly `UNIT` when the input is `E`.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The UD60x18 number for which to calculate the natural logarithm.\\n/// @return result The natural logarithm as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ln(UD60x18 x) pure returns (UD60x18 result) {\\n unchecked {\\n // Inline the fixed-point multiplication to save gas. This is overflow-safe because the maximum value that\\n // {log2} can return is ~196_205294292027477728.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_E);\\n }\\n}\\n\\n/// @notice Calculates the common logarithm of x using the following formula:\\n///\\n/// $$\\n/// log_{10}{x} = log_2{x} / log_2{10}\\n/// $$\\n///\\n/// However, if x is an exact power of ten, a hard coded value is returned.\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The UD60x18 number for which to calculate the common logarithm.\\n/// @return result The common logarithm as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log10(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n if (xUint < uUNIT) {\\n revert Errors.PRBMath_UD60x18_Log_InputTooSmall(x);\\n }\\n\\n // Note that the `mul` in this assembly block is the standard multiplication operation, not {UD60x18.mul}.\\n // prettier-ignore\\n assembly (\\\"memory-safe\\\") {\\n switch x\\n case 1 { result := mul(uUNIT, sub(0, 18)) }\\n case 10 { result := mul(uUNIT, sub(1, 18)) }\\n case 100 { result := mul(uUNIT, sub(2, 18)) }\\n case 1000 { result := mul(uUNIT, sub(3, 18)) }\\n case 10000 { result := mul(uUNIT, sub(4, 18)) }\\n case 100000 { result := mul(uUNIT, sub(5, 18)) }\\n case 1000000 { result := mul(uUNIT, sub(6, 18)) }\\n case 10000000 { result := mul(uUNIT, sub(7, 18)) }\\n case 100000000 { result := mul(uUNIT, sub(8, 18)) }\\n case 1000000000 { result := mul(uUNIT, sub(9, 18)) }\\n case 10000000000 { result := mul(uUNIT, sub(10, 18)) }\\n case 100000000000 { result := mul(uUNIT, sub(11, 18)) }\\n case 1000000000000 { result := mul(uUNIT, sub(12, 18)) }\\n case 10000000000000 { result := mul(uUNIT, sub(13, 18)) }\\n case 100000000000000 { result := mul(uUNIT, sub(14, 18)) }\\n case 1000000000000000 { result := mul(uUNIT, sub(15, 18)) }\\n case 10000000000000000 { result := mul(uUNIT, sub(16, 18)) }\\n case 100000000000000000 { result := mul(uUNIT, sub(17, 18)) }\\n case 1000000000000000000 { result := 0 }\\n case 10000000000000000000 { result := uUNIT }\\n case 100000000000000000000 { result := mul(uUNIT, 2) }\\n case 1000000000000000000000 { result := mul(uUNIT, 3) }\\n case 10000000000000000000000 { result := mul(uUNIT, 4) }\\n case 100000000000000000000000 { result := mul(uUNIT, 5) }\\n case 1000000000000000000000000 { result := mul(uUNIT, 6) }\\n case 10000000000000000000000000 { result := mul(uUNIT, 7) }\\n case 100000000000000000000000000 { result := mul(uUNIT, 8) }\\n case 1000000000000000000000000000 { result := mul(uUNIT, 9) }\\n case 10000000000000000000000000000 { result := mul(uUNIT, 10) }\\n case 100000000000000000000000000000 { result := mul(uUNIT, 11) }\\n case 1000000000000000000000000000000 { result := mul(uUNIT, 12) }\\n case 10000000000000000000000000000000 { result := mul(uUNIT, 13) }\\n case 100000000000000000000000000000000 { result := mul(uUNIT, 14) }\\n case 1000000000000000000000000000000000 { result := mul(uUNIT, 15) }\\n case 10000000000000000000000000000000000 { result := mul(uUNIT, 16) }\\n case 100000000000000000000000000000000000 { result := mul(uUNIT, 17) }\\n case 1000000000000000000000000000000000000 { result := mul(uUNIT, 18) }\\n case 10000000000000000000000000000000000000 { result := mul(uUNIT, 19) }\\n case 100000000000000000000000000000000000000 { result := mul(uUNIT, 20) }\\n case 1000000000000000000000000000000000000000 { result := mul(uUNIT, 21) }\\n case 10000000000000000000000000000000000000000 { result := mul(uUNIT, 22) }\\n case 100000000000000000000000000000000000000000 { result := mul(uUNIT, 23) }\\n case 1000000000000000000000000000000000000000000 { result := mul(uUNIT, 24) }\\n case 10000000000000000000000000000000000000000000 { result := mul(uUNIT, 25) }\\n case 100000000000000000000000000000000000000000000 { result := mul(uUNIT, 26) }\\n case 1000000000000000000000000000000000000000000000 { result := mul(uUNIT, 27) }\\n case 10000000000000000000000000000000000000000000000 { result := mul(uUNIT, 28) }\\n case 100000000000000000000000000000000000000000000000 { result := mul(uUNIT, 29) }\\n case 1000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 30) }\\n case 10000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 31) }\\n case 100000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 32) }\\n case 1000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 33) }\\n case 10000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 34) }\\n case 100000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 35) }\\n case 1000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 36) }\\n case 10000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 37) }\\n case 100000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 38) }\\n case 1000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 39) }\\n case 10000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 40) }\\n case 100000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 41) }\\n case 1000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 42) }\\n case 10000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 43) }\\n case 100000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 44) }\\n case 1000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 45) }\\n case 10000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 46) }\\n case 100000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 47) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 48) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 49) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 50) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 51) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 52) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 53) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 54) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 55) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 56) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 57) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 58) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 59) }\\n default { result := uMAX_UD60x18 }\\n }\\n\\n if (result.unwrap() == uMAX_UD60x18) {\\n unchecked {\\n // Inline the fixed-point division to save gas.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_10);\\n }\\n }\\n}\\n\\n/// @notice Calculates the binary logarithm of x using the iterative approximation algorithm:\\n///\\n/// $$\\n/// log_2{x} = n + log_2{y}, \\\\text{ where } y = x*2^{-n}, \\\\ y \\\\in [1, 2)\\n/// $$\\n///\\n/// For $0 \\\\leq x \\\\lt 1$, the input is inverted:\\n///\\n/// $$\\n/// log_2{x} = -log_2{\\\\frac{1}{x}}\\n/// $$\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Binary_logarithm#Iterative_approximation\\n///\\n/// Notes:\\n/// - Due to the lossy precision of the iterative approximation, the results are not perfectly accurate to the last decimal.\\n///\\n/// Requirements:\\n/// - x must be greater than zero.\\n///\\n/// @param x The UD60x18 number for which to calculate the binary logarithm.\\n/// @return result The binary logarithm as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log2(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n if (xUint < uUNIT) {\\n revert Errors.PRBMath_UD60x18_Log_InputTooSmall(x);\\n }\\n\\n unchecked {\\n // Calculate the integer part of the logarithm.\\n uint256 n = Common.msb(xUint / uUNIT);\\n\\n // This is the integer part of the logarithm as a UD60x18 number. The operation can't overflow because n\\n // n is at most 255 and UNIT is 1e18.\\n uint256 resultUint = n * uUNIT;\\n\\n // Calculate $y = x * 2^{-n}$.\\n uint256 y = xUint >> n;\\n\\n // If y is the unit number, the fractional part is zero.\\n if (y == uUNIT) {\\n return wrap(resultUint);\\n }\\n\\n // Calculate the fractional part via the iterative approximation.\\n // The `delta >>= 1` part is equivalent to `delta /= 2`, but shifting bits is more gas efficient.\\n uint256 DOUBLE_UNIT = 2e18;\\n for (uint256 delta = uHALF_UNIT; delta > 0; delta >>= 1) {\\n y = (y * y) / uUNIT;\\n\\n // Is y^2 >= 2e18 and so in the range [2e18, 4e18)?\\n if (y >= DOUBLE_UNIT) {\\n // Add the 2^{-m} factor to the logarithm.\\n resultUint += delta;\\n\\n // Halve y, which corresponds to z/2 in the Wikipedia article.\\n y >>= 1;\\n }\\n }\\n result = wrap(resultUint);\\n }\\n}\\n\\n/// @notice Multiplies two UD60x18 numbers together, returning a new UD60x18 number.\\n///\\n/// @dev Uses {Common.mulDiv} to enable overflow-safe multiplication and division.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv}.\\n///\\n/// @dev See the documentation in {Common.mulDiv18}.\\n/// @param x The multiplicand as a UD60x18 number.\\n/// @param y The multiplier as a UD60x18 number.\\n/// @return result The product as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mul(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(Common.mulDiv18(x.unwrap(), y.unwrap()));\\n}\\n\\n/// @notice Raises x to the power of y.\\n///\\n/// For $1 \\\\leq x \\\\leq \\\\infty$, the following standard formula is used:\\n///\\n/// $$\\n/// x^y = 2^{log_2{x} * y}\\n/// $$\\n///\\n/// For $0 \\\\leq x \\\\lt 1$, since the unsigned {log2} is undefined, an equivalent formula is used:\\n///\\n/// $$\\n/// i = \\\\frac{1}{x}\\n/// w = 2^{log_2{i} * y}\\n/// x^y = \\\\frac{1}{w}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2} and {mul}.\\n/// - Returns `UNIT` for 0^0.\\n/// - It may not perform well with very small values of x. Consider using SD59x18 as an alternative.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {exp2}, {log2}, and {mul}.\\n///\\n/// @param x The base as a UD60x18 number.\\n/// @param y The exponent as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction pow(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n uint256 yUint = y.unwrap();\\n\\n // If both x and y are zero, the result is `UNIT`. If just x is zero, the result is always zero.\\n if (xUint == 0) {\\n return yUint == 0 ? UNIT : ZERO;\\n }\\n // If x is `UNIT`, the result is always `UNIT`.\\n else if (xUint == uUNIT) {\\n return UNIT;\\n }\\n\\n // If y is zero, the result is always `UNIT`.\\n if (yUint == 0) {\\n return UNIT;\\n }\\n // If y is `UNIT`, the result is always x.\\n else if (yUint == uUNIT) {\\n return x;\\n }\\n\\n // If x is greater than `UNIT`, use the standard formula.\\n if (xUint > uUNIT) {\\n result = exp2(mul(log2(x), y));\\n }\\n // Conversely, if x is less than `UNIT`, use the equivalent formula.\\n else {\\n UD60x18 i = wrap(uUNIT_SQUARED / xUint);\\n UD60x18 w = exp2(mul(log2(i), y));\\n result = wrap(uUNIT_SQUARED / w.unwrap());\\n }\\n}\\n\\n/// @notice Raises x (a UD60x18 number) to the power y (an unsigned basic integer) using the well-known\\n/// algorithm \\\"exponentiation by squaring\\\".\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Exponentiation_by_squaring.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv18}.\\n/// - Returns `UNIT` for 0^0.\\n///\\n/// Requirements:\\n/// - The result must fit in UD60x18.\\n///\\n/// @param x The base as a UD60x18 number.\\n/// @param y The exponent as a uint256.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction powu(UD60x18 x, uint256 y) pure returns (UD60x18 result) {\\n // Calculate the first iteration of the loop in advance.\\n uint256 xUint = x.unwrap();\\n uint256 resultUint = y & 1 > 0 ? xUint : uUNIT;\\n\\n // Equivalent to `for(y /= 2; y > 0; y /= 2)`.\\n for (y >>= 1; y > 0; y >>= 1) {\\n xUint = Common.mulDiv18(xUint, xUint);\\n\\n // Equivalent to `y % 2 == 1`.\\n if (y & 1 > 0) {\\n resultUint = Common.mulDiv18(resultUint, xUint);\\n }\\n }\\n result = wrap(resultUint);\\n}\\n\\n/// @notice Calculates the square root of x using the Babylonian method.\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\\n///\\n/// Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x must be less than `MAX_UD60x18 / UNIT`.\\n///\\n/// @param x The UD60x18 number for which to calculate the square root.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction sqrt(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n unchecked {\\n if (xUint > uMAX_UD60x18 / uUNIT) {\\n revert Errors.PRBMath_UD60x18_Sqrt_Overflow(x);\\n }\\n // Multiply x by `UNIT` to account for the factor of `UNIT` picked up when multiplying two UD60x18 numbers.\\n // In this case, the two numbers are both the square root.\\n result = wrap(Common.sqrt(xUint * uUNIT));\\n }\\n}\\n\",\"keccak256\":\"0x462144667aac3f96d5f8dba7aa68fe4c5a3f61e1d7bbbc81bee21168817f9c09\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\nimport \\\"./Helpers.sol\\\" as Helpers;\\nimport \\\"./Math.sol\\\" as Math;\\n\\n/// @notice The unsigned 60.18-decimal fixed-point number representation, which can have up to 60 digits and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the Solidity type uint256.\\n/// @dev The value type is defined here so it can be imported in all other files.\\ntype UD60x18 is uint256;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoSD1x18,\\n Casting.intoUD2x18,\\n Casting.intoSD59x18,\\n Casting.intoUint128,\\n Casting.intoUint256,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for UD60x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n MATHEMATICAL FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes the functions in this library callable on the UD60x18 type.\\nusing {\\n Math.avg,\\n Math.ceil,\\n Math.div,\\n Math.exp,\\n Math.exp2,\\n Math.floor,\\n Math.frac,\\n Math.gm,\\n Math.inv,\\n Math.ln,\\n Math.log10,\\n Math.log2,\\n Math.mul,\\n Math.pow,\\n Math.powu,\\n Math.sqrt\\n} for UD60x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n HELPER FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes the functions in this library callable on the UD60x18 type.\\nusing {\\n Helpers.add,\\n Helpers.and,\\n Helpers.eq,\\n Helpers.gt,\\n Helpers.gte,\\n Helpers.isZero,\\n Helpers.lshift,\\n Helpers.lt,\\n Helpers.lte,\\n Helpers.mod,\\n Helpers.neq,\\n Helpers.not,\\n Helpers.or,\\n Helpers.rshift,\\n Helpers.sub,\\n Helpers.uncheckedAdd,\\n Helpers.uncheckedSub,\\n Helpers.xor\\n} for UD60x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n OPERATORS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes it possible to use these operators on the UD60x18 type.\\nusing {\\n Helpers.add as +,\\n Helpers.and2 as &,\\n Math.div as /,\\n Helpers.eq as ==,\\n Helpers.gt as >,\\n Helpers.gte as >=,\\n Helpers.lt as <,\\n Helpers.lte as <=,\\n Helpers.or as |,\\n Helpers.mod as %,\\n Math.mul as *,\\n Helpers.neq as !=,\\n Helpers.not as ~,\\n Helpers.sub as -,\\n Helpers.xor as ^\\n} for UD60x18 global;\\n\",\"keccak256\":\"0xdd873b5124180d9b71498b3a7fe93b1c08c368bec741f7d5f8e17f78a0b70f31\",\"license\":\"MIT\"},\"contracts/interfaces/IERC6551Registry.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\ninterface IERC6551Registry {\\n /**\\n * @dev Creates a token bound account for a non-fungible token.\\n *\\n * If account has already been created, returns the account address without calling create2.\\n *\\n * Emits ERC6551AccountCreated event.\\n *\\n * @return account The address of the token bound account\\n */\\n function createAccount(\\n address implementation,\\n bytes32 salt,\\n uint256 chainId,\\n address tokenContract,\\n uint256 tokenId\\n ) external returns (address account);\\n}\\n\",\"keccak256\":\"0x64c52de8a8e68398e61dd8b42dda8e9af8cf6abf93bb85629c322440991ea568\",\"license\":\"MIT\"},\"contracts/interfaces/hats/HatsErrors.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface HatsErrors {\\n /// @notice Emitted when `user` is attempting to perform an action on `hatId` but is not wearing one of `hatId`'s admin hats\\n /// @dev Can be equivalent to `NotHatWearer(buildHatId(hatId))`, such as when emitted by `approveLinkTopHatToTree` or `relinkTopHatToTree`\\n error NotAdmin(address user, uint256 hatId);\\n\\n /// @notice Emitted when attempting to perform an action as or for an account that is not a wearer of a given hat\\n error NotHatWearer();\\n\\n /// @notice Emitted when attempting to perform an action that requires being either an admin or wearer of a given hat\\n error NotAdminOrWearer();\\n\\n /// @notice Emitted when attempting to mint `hatId` but `hatId`'s maxSupply has been reached\\n error AllHatsWorn(uint256 hatId);\\n\\n /// @notice Emitted when attempting to create a hat with a level 14 hat as its admin\\n error MaxLevelsReached();\\n\\n /// @notice Emitted when an attempted hat id has empty intermediate level(s)\\n error InvalidHatId();\\n\\n /// @notice Emitted when attempting to mint `hatId` to a `wearer` who is already wearing the hat\\n error AlreadyWearingHat(address wearer, uint256 hatId);\\n\\n /// @notice Emitted when attempting to mint a non-existant hat\\n error HatDoesNotExist(uint256 hatId);\\n\\n /// @notice Emmitted when attempting to mint or transfer a hat that is not active\\n error HatNotActive();\\n\\n /// @notice Emitted when attempting to mint or transfer a hat to an ineligible wearer\\n error NotEligible();\\n\\n /// @notice Emitted when attempting to check or set a hat's status from an account that is not that hat's toggle module\\n error NotHatsToggle();\\n\\n /// @notice Emitted when attempting to check or set a hat wearer's status from an account that is not that hat's eligibility module\\n error NotHatsEligibility();\\n\\n /// @notice Emitted when array arguments to a batch function have mismatching lengths\\n error BatchArrayLengthMismatch();\\n\\n /// @notice Emitted when attempting to mutate or transfer an immutable hat\\n error Immutable();\\n\\n /// @notice Emitted when attempting to change a hat's maxSupply to a value lower than its current supply\\n error NewMaxSupplyTooLow();\\n\\n /// @notice Emitted when attempting to link a tophat to a new admin for which the tophat serves as an admin\\n error CircularLinkage();\\n\\n /// @notice Emitted when attempting to link or relink a tophat to a separate tree\\n error CrossTreeLinkage();\\n\\n /// @notice Emitted when attempting to link a tophat without a request\\n error LinkageNotRequested();\\n\\n /// @notice Emitted when attempting to unlink a tophat that does not have a wearer\\n /// @dev This ensures that unlinking never results in a bricked tophat\\n error InvalidUnlink();\\n\\n /// @notice Emmited when attempting to change a hat's eligibility or toggle module to the zero address\\n error ZeroAddress();\\n\\n /// @notice Emmitted when attempting to change a hat's details or imageURI to a string with over 7000 bytes (~characters)\\n /// @dev This protects against a DOS attack where an admin iteratively extend's a hat's details or imageURI\\n /// to be so long that reading it exceeds the block gas limit, breaking `uri()` and `viewHat()`\\n error StringTooLong();\\n}\\n\",\"keccak256\":\"0x81b0056b7bed86eabc07c0e4a9655c586ddb8e6c128320593669b76efd5a08de\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/HatsEvents.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface HatsEvents {\\n /// @notice Emitted when a new hat is created\\n /// @param id The id for the new hat\\n /// @param details A description of the Hat\\n /// @param maxSupply The total instances of the Hat that can be worn at once\\n /// @param eligibility The address that can report on the Hat wearer's status\\n /// @param toggle The address that can deactivate the Hat\\n /// @param mutable_ Whether the hat's properties are changeable after creation\\n /// @param imageURI The image uri for this hat and the fallback for its\\n event HatCreated(\\n uint256 id,\\n string details,\\n uint32 maxSupply,\\n address eligibility,\\n address toggle,\\n bool mutable_,\\n string imageURI\\n );\\n\\n /// @notice Emitted when a hat wearer's standing is updated\\n /// @dev Eligibility is excluded since the source of truth for eligibility is the eligibility module and may change without a transaction\\n /// @param hatId The id of the wearer's hat\\n /// @param wearer The wearer's address\\n /// @param wearerStanding Whether the wearer is in good standing for the hat\\n event WearerStandingChanged(\\n uint256 hatId,\\n address wearer,\\n bool wearerStanding\\n );\\n\\n /// @notice Emitted when a hat's status is updated\\n /// @param hatId The id of the hat\\n /// @param newStatus Whether the hat is active\\n event HatStatusChanged(uint256 hatId, bool newStatus);\\n\\n /// @notice Emitted when a hat's details are updated\\n /// @param hatId The id of the hat\\n /// @param newDetails The updated details\\n event HatDetailsChanged(uint256 hatId, string newDetails);\\n\\n /// @notice Emitted when a hat's eligibility module is updated\\n /// @param hatId The id of the hat\\n /// @param newEligibility The updated eligibiliy module\\n event HatEligibilityChanged(uint256 hatId, address newEligibility);\\n\\n /// @notice Emitted when a hat's toggle module is updated\\n /// @param hatId The id of the hat\\n /// @param newToggle The updated toggle module\\n event HatToggleChanged(uint256 hatId, address newToggle);\\n\\n /// @notice Emitted when a hat's mutability is updated\\n /// @param hatId The id of the hat\\n event HatMutabilityChanged(uint256 hatId);\\n\\n /// @notice Emitted when a hat's maximum supply is updated\\n /// @param hatId The id of the hat\\n /// @param newMaxSupply The updated max supply\\n event HatMaxSupplyChanged(uint256 hatId, uint32 newMaxSupply);\\n\\n /// @notice Emitted when a hat's image URI is updated\\n /// @param hatId The id of the hat\\n /// @param newImageURI The updated image URI\\n event HatImageURIChanged(uint256 hatId, string newImageURI);\\n\\n /// @notice Emitted when a tophat linkage is requested by its admin\\n /// @param domain The domain of the tree tophat to link\\n /// @param newAdmin The tophat's would-be admin in the parent tree\\n event TopHatLinkRequested(uint32 domain, uint256 newAdmin);\\n\\n /// @notice Emitted when a tophat is linked to a another tree\\n /// @param domain The domain of the newly-linked tophat\\n /// @param newAdmin The tophat's new admin in the parent tree\\n event TopHatLinked(uint32 domain, uint256 newAdmin);\\n}\\n\",\"keccak256\":\"0x53413397d15e1636c3cd7bd667656b79bc2886785403b824bcd4ed122667f2c6\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/IHats.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\nimport \\\"./IHatsIdUtilities.sol\\\";\\nimport \\\"./HatsErrors.sol\\\";\\nimport \\\"./HatsEvents.sol\\\";\\n\\ninterface IHats is IHatsIdUtilities, HatsErrors, HatsEvents {\\n function mintTopHat(\\n address _target,\\n string memory _details,\\n string memory _imageURI\\n ) external returns (uint256 topHatId);\\n\\n function createHat(\\n uint256 _admin,\\n string calldata _details,\\n uint32 _maxSupply,\\n address _eligibility,\\n address _toggle,\\n bool _mutable,\\n string calldata _imageURI\\n ) external returns (uint256 newHatId);\\n\\n function batchCreateHats(\\n uint256[] calldata _admins,\\n string[] calldata _details,\\n uint32[] calldata _maxSupplies,\\n address[] memory _eligibilityModules,\\n address[] memory _toggleModules,\\n bool[] calldata _mutables,\\n string[] calldata _imageURIs\\n ) external returns (bool success);\\n\\n function getNextId(uint256 _admin) external view returns (uint256 nextId);\\n\\n function mintHat(\\n uint256 _hatId,\\n address _wearer\\n ) external returns (bool success);\\n\\n function batchMintHats(\\n uint256[] calldata _hatIds,\\n address[] calldata _wearers\\n ) external returns (bool success);\\n\\n function setHatStatus(\\n uint256 _hatId,\\n bool _newStatus\\n ) external returns (bool toggled);\\n\\n function checkHatStatus(uint256 _hatId) external returns (bool toggled);\\n\\n function setHatWearerStatus(\\n uint256 _hatId,\\n address _wearer,\\n bool _eligible,\\n bool _standing\\n ) external returns (bool updated);\\n\\n function checkHatWearerStatus(\\n uint256 _hatId,\\n address _wearer\\n ) external returns (bool updated);\\n\\n function renounceHat(uint256 _hatId) external;\\n\\n function transferHat(uint256 _hatId, address _from, address _to) external;\\n\\n /*//////////////////////////////////////////////////////////////\\n HATS ADMIN FUNCTIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n function makeHatImmutable(uint256 _hatId) external;\\n\\n function changeHatDetails(\\n uint256 _hatId,\\n string memory _newDetails\\n ) external;\\n\\n function changeHatEligibility(\\n uint256 _hatId,\\n address _newEligibility\\n ) external;\\n\\n function changeHatToggle(uint256 _hatId, address _newToggle) external;\\n\\n function changeHatImageURI(\\n uint256 _hatId,\\n string memory _newImageURI\\n ) external;\\n\\n function changeHatMaxSupply(uint256 _hatId, uint32 _newMaxSupply) external;\\n\\n function requestLinkTopHatToTree(\\n uint32 _topHatId,\\n uint256 _newAdminHat\\n ) external;\\n\\n function approveLinkTopHatToTree(\\n uint32 _topHatId,\\n uint256 _newAdminHat,\\n address _eligibility,\\n address _toggle,\\n string calldata _details,\\n string calldata _imageURI\\n ) external;\\n\\n function unlinkTopHatFromTree(uint32 _topHatId, address _wearer) external;\\n\\n function relinkTopHatWithinTree(\\n uint32 _topHatDomain,\\n uint256 _newAdminHat,\\n address _eligibility,\\n address _toggle,\\n string calldata _details,\\n string calldata _imageURI\\n ) external;\\n\\n /*//////////////////////////////////////////////////////////////\\n VIEW FUNCTIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n function viewHat(\\n uint256 _hatId\\n )\\n external\\n view\\n returns (\\n string memory details,\\n uint32 maxSupply,\\n uint32 supply,\\n address eligibility,\\n address toggle,\\n string memory imageURI,\\n uint16 lastHatId,\\n bool mutable_,\\n bool active\\n );\\n\\n function isWearerOfHat(\\n address _user,\\n uint256 _hatId\\n ) external view returns (bool isWearer);\\n\\n function isAdminOfHat(\\n address _user,\\n uint256 _hatId\\n ) external view returns (bool isAdmin);\\n\\n function isInGoodStanding(\\n address _wearer,\\n uint256 _hatId\\n ) external view returns (bool standing);\\n\\n function isEligible(\\n address _wearer,\\n uint256 _hatId\\n ) external view returns (bool eligible);\\n\\n function getHatEligibilityModule(\\n uint256 _hatId\\n ) external view returns (address eligibility);\\n\\n function getHatToggleModule(\\n uint256 _hatId\\n ) external view returns (address toggle);\\n\\n function getHatMaxSupply(\\n uint256 _hatId\\n ) external view returns (uint32 maxSupply);\\n\\n function hatSupply(uint256 _hatId) external view returns (uint32 supply);\\n\\n function getImageURIForHat(\\n uint256 _hatId\\n ) external view returns (string memory _uri);\\n\\n function balanceOf(\\n address wearer,\\n uint256 hatId\\n ) external view returns (uint256 balance);\\n\\n function balanceOfBatch(\\n address[] calldata _wearers,\\n uint256[] calldata _hatIds\\n ) external view returns (uint256[] memory);\\n\\n function uri(uint256 id) external view returns (string memory _uri);\\n}\\n\",\"keccak256\":\"0x2867004bddc5148fa1937f25c0403e5d9977583aaf50fdbdb74bd463f64f21c8\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/IHatsIdUtilities.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface IHatsIdUtilities {\\n function buildHatId(\\n uint256 _admin,\\n uint16 _newHat\\n ) external pure returns (uint256 id);\\n\\n function getHatLevel(uint256 _hatId) external view returns (uint32 level);\\n\\n function getLocalHatLevel(\\n uint256 _hatId\\n ) external pure returns (uint32 level);\\n\\n function isTopHat(uint256 _hatId) external view returns (bool _topHat);\\n\\n function isLocalTopHat(\\n uint256 _hatId\\n ) external pure returns (bool _localTopHat);\\n\\n function isValidHatId(\\n uint256 _hatId\\n ) external view returns (bool validHatId);\\n\\n function getAdminAtLevel(\\n uint256 _hatId,\\n uint32 _level\\n ) external view returns (uint256 admin);\\n\\n function getAdminAtLocalLevel(\\n uint256 _hatId,\\n uint32 _level\\n ) external pure returns (uint256 admin);\\n\\n function getTopHatDomain(\\n uint256 _hatId\\n ) external view returns (uint32 domain);\\n\\n function getTippyTopHatDomain(\\n uint32 _topHatDomain\\n ) external view returns (uint32 domain);\\n\\n function noCircularLinkage(\\n uint32 _topHatDomain,\\n uint256 _linkedAdmin\\n ) external view returns (bool notCircular);\\n\\n function sameTippyTopHatDomain(\\n uint32 _topHatDomain,\\n uint256 _newAdminHat\\n ) external view returns (bool sameDomain);\\n}\\n\",\"keccak256\":\"0x007fcc07b20bf84bacad1f9a2ddf4e30e1a8be961e144b7bef8e98a51781aee9\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/IHatsModuleFactory.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.19;\\n\\ninterface IHatsModuleFactory {\\n error HatsModuleFactory_ModuleAlreadyDeployed(\\n address implementation,\\n uint256 hatId,\\n bytes otherImmutableArgs,\\n uint256 saltNonce\\n );\\n\\n error BatchArrayLengthMismatch();\\n\\n event HatsModuleFactory_ModuleDeployed(\\n address implementation,\\n address instance,\\n uint256 hatId,\\n bytes otherImmutableArgs,\\n bytes initData,\\n uint256 saltNonce\\n );\\n\\n function HATS() external view returns (address);\\n\\n function version() external view returns (string memory);\\n\\n function createHatsModule(\\n address _implementation,\\n uint256 _hatId,\\n bytes calldata _otherImmutableArgs,\\n bytes calldata _initData,\\n uint256 _saltNonce\\n ) external returns (address _instance);\\n\\n function batchCreateHatsModule(\\n address[] calldata _implementations,\\n uint256[] calldata _hatIds,\\n bytes[] calldata _otherImmutableArgsArray,\\n bytes[] calldata _initDataArray,\\n uint256[] calldata _saltNonces\\n ) external returns (bool success);\\n\\n function getHatsModuleAddress(\\n address _implementation,\\n uint256 _hatId,\\n bytes calldata _otherImmutableArgs,\\n uint256 _saltNonce\\n ) external view returns (address);\\n\\n function deployed(\\n address _implementation,\\n uint256 _hatId,\\n bytes calldata _otherImmutableArgs,\\n uint256 _saltNonce\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x861faf40785cedb829243116d492653414a367853408a5c27d201522f6c3bfdd\",\"license\":\"MIT\"},\"contracts/interfaces/sablier/IAdminable.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\n/// @title IAdminable\\n/// @notice Contract module that provides a basic access control mechanism, with an admin that can be\\n/// granted exclusive access to specific functions. The inheriting contract must set the initial admin\\n/// in the constructor.\\ninterface IAdminable {\\n /*//////////////////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Emitted when the admin is transferred.\\n /// @param oldAdmin The address of the old admin.\\n /// @param newAdmin The address of the new admin.\\n event TransferAdmin(address indexed oldAdmin, address indexed newAdmin);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice The address of the admin account or contract.\\n function admin() external view returns (address);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n NON-CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Transfers the contract admin to a new address.\\n ///\\n /// @dev Notes:\\n /// - Does not revert if the admin is the same.\\n /// - This function can potentially leave the contract without an admin, thereby removing any\\n /// functionality that is only available to the admin.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the contract admin.\\n ///\\n /// @param newAdmin The address of the new admin.\\n function transferAdmin(address newAdmin) external;\\n}\\n\",\"keccak256\":\"0xa279c49e51228b571329164e36250e82b2c1378e8b549194ab7dd90fca9c3b2b\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/IERC4096.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 \\\"@openzeppelin/contracts/interfaces/IERC165.sol\\\";\\nimport {IERC721} from \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\n\\n/// @title ERC-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\",\"keccak256\":\"0xa34b9c52cbe36be860244f52256f1b05badf0cb797d208664b87337610d0e82d\",\"license\":\"MIT\"},\"contracts/interfaces/sablier/ISablierV2Lockup.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC4906} from \\\"./IERC4096.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IERC721Metadata} from \\\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\\\";\\nimport {UD60x18} from \\\"@prb/math/src/UD60x18.sol\\\";\\n\\nimport {Lockup} from \\\"./types/DataTypes.sol\\\";\\nimport {IAdminable} from \\\"./IAdminable.sol\\\";\\nimport {ISablierV2NFTDescriptor} from \\\"./ISablierV2NFTDescriptor.sol\\\";\\n\\n/// @title ISablierV2Lockup\\n/// @notice Common logic between all Sablier V2 Lockup contracts.\\ninterface ISablierV2Lockup is\\n IAdminable, // 0 inherited components\\n IERC4906, // 2 inherited components\\n IERC721Metadata // 2 inherited components\\n{\\n /*//////////////////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Emitted when the admin allows a new recipient contract to hook to Sablier.\\n /// @param admin The address of the current contract admin.\\n /// @param recipient The address of the recipient contract put on the allowlist.\\n event AllowToHook(address indexed admin, address recipient);\\n\\n /// @notice Emitted when a stream is canceled.\\n /// @param streamId The ID of the stream.\\n /// @param sender The address of the stream's sender.\\n /// @param recipient The address of the stream's recipient.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param senderAmount The amount of assets refunded to the stream's sender, denoted in units of the asset's\\n /// decimals.\\n /// @param recipientAmount The amount of assets left for the stream's recipient to withdraw, denoted in units of the\\n /// asset's decimals.\\n event CancelLockupStream(\\n uint256 streamId,\\n address indexed sender,\\n address indexed recipient,\\n IERC20 indexed asset,\\n uint128 senderAmount,\\n uint128 recipientAmount\\n );\\n\\n /// @notice Emitted when a sender gives up the right to cancel a stream.\\n /// @param streamId The ID of the stream.\\n event RenounceLockupStream(uint256 indexed streamId);\\n\\n /// @notice Emitted when the admin sets a new NFT descriptor contract.\\n /// @param admin The address of the current contract admin.\\n /// @param oldNFTDescriptor The address of the old NFT descriptor contract.\\n /// @param newNFTDescriptor The address of the new NFT descriptor contract.\\n event SetNFTDescriptor(\\n address indexed admin,\\n ISablierV2NFTDescriptor oldNFTDescriptor,\\n ISablierV2NFTDescriptor newNFTDescriptor\\n );\\n\\n /// @notice Emitted when assets are withdrawn from a stream.\\n /// @param streamId The ID of the stream.\\n /// @param to The address that has received the withdrawn assets.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param amount The amount of assets withdrawn, denoted in units of the asset's decimals.\\n event WithdrawFromLockupStream(\\n uint256 indexed streamId,\\n address indexed to,\\n IERC20 indexed asset,\\n uint128 amount\\n );\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Retrieves the address of the ERC-20 asset to be distributed.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getAsset(uint256 streamId) external view returns (IERC20 asset);\\n\\n /// @notice Retrieves the amount deposited in the stream, denoted in units of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getDepositedAmount(\\n uint256 streamId\\n ) external view returns (uint128 depositedAmount);\\n\\n /// @notice Retrieves the stream's end time, which is a Unix timestamp.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getEndTime(\\n uint256 streamId\\n ) external view returns (uint40 endTime);\\n\\n /// @notice Retrieves the stream's recipient.\\n /// @dev Reverts if the NFT has been burned.\\n /// @param streamId The stream ID for the query.\\n function getRecipient(\\n uint256 streamId\\n ) external view returns (address recipient);\\n\\n /// @notice Retrieves the amount refunded to the sender after a cancellation, denoted in units of the asset's\\n /// decimals. This amount is always zero unless the stream was canceled.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getRefundedAmount(\\n uint256 streamId\\n ) external view returns (uint128 refundedAmount);\\n\\n /// @notice Retrieves the stream's sender.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getSender(uint256 streamId) external view returns (address sender);\\n\\n /// @notice Retrieves the stream's start time, which is a Unix timestamp.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getStartTime(\\n uint256 streamId\\n ) external view returns (uint40 startTime);\\n\\n /// @notice Retrieves the amount withdrawn from the stream, denoted in units of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getWithdrawnAmount(\\n uint256 streamId\\n ) external view returns (uint128 withdrawnAmount);\\n\\n /// @notice Retrieves a flag indicating whether the provided address is a contract allowed to hook to Sablier\\n /// when a stream is canceled or when assets are withdrawn.\\n /// @dev See {ISablierLockupRecipient} for more information.\\n function isAllowedToHook(\\n address recipient\\n ) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream can be canceled. When the stream is cold, this\\n /// flag is always `false`.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isCancelable(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream is cold, i.e. settled, canceled, or depleted.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isCold(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream is depleted.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isDepleted(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream exists.\\n /// @dev Does not revert if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isStream(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream NFT can be transferred.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isTransferable(\\n uint256 streamId\\n ) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream is warm, i.e. either pending or streaming.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isWarm(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves the maximum broker fee that can be charged by the broker, denoted as a fixed-point\\n /// number where 1e18 is 100%.\\n /// @dev This value is hard coded as a constant.\\n function MAX_BROKER_FEE() external view returns (UD60x18);\\n\\n /// @notice Counter for stream IDs, used in the create functions.\\n function nextStreamId() external view returns (uint256);\\n\\n /// @notice Contract that generates the non-fungible token URI.\\n function nftDescriptor() external view returns (ISablierV2NFTDescriptor);\\n\\n /// @notice Calculates the amount that the sender would be refunded if the stream were canceled, denoted in units\\n /// of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function refundableAmountOf(\\n uint256 streamId\\n ) external view returns (uint128 refundableAmount);\\n\\n /// @notice Retrieves the stream's status.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function statusOf(\\n uint256 streamId\\n ) external view returns (Lockup.Status status);\\n\\n /// @notice Calculates the amount streamed to the recipient, denoted in units of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n ///\\n /// Notes:\\n /// - Upon cancellation of the stream, the amount streamed is calculated as the difference between the deposited\\n /// amount and the refunded amount. Ultimately, when the stream becomes depleted, the streamed amount is equivalent\\n /// to the total amount withdrawn.\\n ///\\n /// @param streamId The stream ID for the query.\\n function streamedAmountOf(\\n uint256 streamId\\n ) external view returns (uint128 streamedAmount);\\n\\n /// @notice Retrieves a flag indicating whether the stream was canceled.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function wasCanceled(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Calculates the amount that the recipient can withdraw from the stream, denoted in units of the asset's\\n /// decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function withdrawableAmountOf(\\n uint256 streamId\\n ) external view returns (uint128 withdrawableAmount);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n NON-CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Allows a recipient contract to hook to Sablier when a stream is canceled or when assets are withdrawn.\\n /// Useful for implementing contracts that hold streams on behalf of users, such as vaults or staking contracts.\\n ///\\n /// @dev Emits an {AllowToHook} event.\\n ///\\n /// Notes:\\n /// - Does not revert if the contract is already on the allowlist.\\n /// - This is an irreversible operation. The contract cannot be removed from the allowlist.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the contract admin.\\n /// - `recipient` must have a non-zero code size.\\n /// - `recipient` must implement {ISablierLockupRecipient}.\\n ///\\n /// @param recipient The address of the contract to allow for hooks.\\n function allowToHook(address recipient) external;\\n\\n /// @notice Burns the NFT associated with the stream.\\n ///\\n /// @dev Emits a {Transfer} event.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `streamId` must reference a depleted stream.\\n /// - The NFT must exist.\\n /// - `msg.sender` must be either the NFT owner or an approved third party.\\n ///\\n /// @param streamId The ID of the stream NFT to burn.\\n function burn(uint256 streamId) external;\\n\\n /// @notice Cancels the stream and refunds any remaining assets to the sender.\\n ///\\n /// @dev Emits a {Transfer}, {CancelLockupStream}, and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - If there any assets left for the recipient to withdraw, the stream is marked as canceled. Otherwise, the\\n /// stream is marked as depleted.\\n /// - This function attempts to invoke a hook on the recipient, if the resolved address is a contract.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - The stream must be warm and cancelable.\\n /// - `msg.sender` must be the stream's sender.\\n ///\\n /// @param streamId The ID of the stream to cancel.\\n function cancel(uint256 streamId) external;\\n\\n /// @notice Cancels multiple streams and refunds any remaining assets to the sender.\\n ///\\n /// @dev Emits multiple {Transfer}, {CancelLockupStream}, and {MetadataUpdate} events.\\n ///\\n /// Notes:\\n /// - Refer to the notes in {cancel}.\\n ///\\n /// Requirements:\\n /// - All requirements from {cancel} must be met for each stream.\\n ///\\n /// @param streamIds The IDs of the streams to cancel.\\n function cancelMultiple(uint256[] calldata streamIds) external;\\n\\n /// @notice Removes the right of the stream's sender to cancel the stream.\\n ///\\n /// @dev Emits a {RenounceLockupStream} and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - This is an irreversible operation.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `streamId` must reference a warm stream.\\n /// - `msg.sender` must be the stream's sender.\\n /// - The stream must be cancelable.\\n ///\\n /// @param streamId The ID of the stream to renounce.\\n function renounce(uint256 streamId) external;\\n\\n /// @notice Sets a new NFT descriptor contract, which produces the URI describing the Sablier stream NFTs.\\n ///\\n /// @dev Emits a {SetNFTDescriptor} and {BatchMetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - Does not revert if the NFT descriptor is the same.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the contract admin.\\n ///\\n /// @param newNFTDescriptor The address of the new NFT descriptor contract.\\n function setNFTDescriptor(\\n ISablierV2NFTDescriptor newNFTDescriptor\\n ) external;\\n\\n /// @notice Withdraws the provided amount of assets from the stream to the `to` address.\\n ///\\n /// @dev Emits a {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - This function attempts to call a hook on the recipient of the stream, unless `msg.sender` is the recipient.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `streamId` must not reference a null or depleted stream.\\n /// - `to` must not be the zero address.\\n /// - `amount` must be greater than zero and must not exceed the withdrawable amount.\\n /// - `to` must be the recipient if `msg.sender` is not the stream's recipient or an approved third party.\\n ///\\n /// @param streamId The ID of the stream to withdraw from.\\n /// @param to The address receiving the withdrawn assets.\\n /// @param amount The amount to withdraw, denoted in units of the asset's decimals.\\n function withdraw(uint256 streamId, address to, uint128 amount) external;\\n\\n /// @notice Withdraws the maximum withdrawable amount from the stream to the provided address `to`.\\n ///\\n /// @dev Emits a {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - Refer to the notes in {withdraw}.\\n ///\\n /// Requirements:\\n /// - Refer to the requirements in {withdraw}.\\n ///\\n /// @param streamId The ID of the stream to withdraw from.\\n /// @param to The address receiving the withdrawn assets.\\n /// @return withdrawnAmount The amount withdrawn, denoted in units of the asset's decimals.\\n function withdrawMax(\\n uint256 streamId,\\n address to\\n ) external returns (uint128 withdrawnAmount);\\n\\n /// @notice Withdraws the maximum withdrawable amount from the stream to the current recipient, and transfers the\\n /// NFT to `newRecipient`.\\n ///\\n /// @dev Emits a {WithdrawFromLockupStream} and a {Transfer} event.\\n ///\\n /// Notes:\\n /// - If the withdrawable amount is zero, the withdrawal is skipped.\\n /// - Refer to the notes in {withdraw}.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the stream's recipient.\\n /// - Refer to the requirements in {withdraw}.\\n /// - Refer to the requirements in {IERC721.transferFrom}.\\n ///\\n /// @param streamId The ID of the stream NFT to transfer.\\n /// @param newRecipient The address of the new owner of the stream NFT.\\n /// @return withdrawnAmount The amount withdrawn, denoted in units of the asset's decimals.\\n function withdrawMaxAndTransfer(\\n uint256 streamId,\\n address newRecipient\\n ) external returns (uint128 withdrawnAmount);\\n\\n /// @notice Withdraws assets from streams to the recipient of each stream.\\n ///\\n /// @dev Emits multiple {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} events.\\n ///\\n /// Notes:\\n /// - This function attempts to call a hook on the recipient of each stream, unless `msg.sender` is the recipient.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - There must be an equal number of `streamIds` and `amounts`.\\n /// - Each stream ID in the array must not reference a null or depleted stream.\\n /// - Each amount in the array must be greater than zero and must not exceed the withdrawable amount.\\n ///\\n /// @param streamIds The IDs of the streams to withdraw from.\\n /// @param amounts The amounts to withdraw, denoted in units of the asset's decimals.\\n function withdrawMultiple(\\n uint256[] calldata streamIds,\\n uint128[] calldata amounts\\n ) external;\\n}\\n\",\"keccak256\":\"0x3e5541c38a901637bd310965deb5bbde73ef07fe4ee3c752cbec330c6b9d62a3\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/ISablierV2LockupLinear.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\nimport {Lockup, LockupLinear} from \\\"./types/DataTypes.sol\\\";\\nimport {ISablierV2Lockup} from \\\"./ISablierV2Lockup.sol\\\";\\n\\n/// @title ISablierV2LockupLinear\\n/// @notice Creates and manages Lockup streams with a linear distribution function.\\ninterface ISablierV2LockupLinear is ISablierV2Lockup {\\n /*//////////////////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Emitted when a stream is created.\\n /// @param streamId The ID of the newly created stream.\\n /// @param funder The address which funded the stream.\\n /// @param sender The address distributing the assets, which will have the ability to cancel the stream.\\n /// @param recipient The address receiving the assets.\\n /// @param amounts Struct encapsulating (i) the deposit amount, and (ii) the broker fee amount, both denoted\\n /// in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Boolean indicating whether the stream will be cancelable or not.\\n /// @param transferable Boolean indicating whether the stream NFT is transferable or not.\\n /// @param timestamps Struct encapsulating (i) the stream's start time, (ii) cliff time, and (iii) end time, all as\\n /// Unix timestamps.\\n /// @param broker The address of the broker who has helped create the stream, e.g. a front-end website.\\n event CreateLockupLinearStream(\\n uint256 streamId,\\n address funder,\\n address indexed sender,\\n address indexed recipient,\\n Lockup.CreateAmounts amounts,\\n IERC20 indexed asset,\\n bool cancelable,\\n bool transferable,\\n LockupLinear.Timestamps timestamps,\\n address broker\\n );\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Retrieves the stream's cliff time, which is a Unix timestamp. A value of zero means there\\n /// is no cliff.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getCliffTime(\\n uint256 streamId\\n ) external view returns (uint40 cliffTime);\\n\\n /// @notice Retrieves the full stream details.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n /// @return stream See the documentation in {DataTypes}.\\n function getStream(\\n uint256 streamId\\n ) external view returns (LockupLinear.StreamLL memory stream);\\n\\n /// @notice Retrieves the stream's start, cliff and end timestamps.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n /// @return timestamps See the documentation in {DataTypes}.\\n function getTimestamps(\\n uint256 streamId\\n ) external view returns (LockupLinear.Timestamps memory timestamps);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n NON-CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Creates a stream by setting the start time to `block.timestamp`, and the end time to\\n /// the sum of `block.timestamp` and `params.durations.total`. The stream is funded by `msg.sender` and is wrapped\\n /// in an ERC-721 NFT.\\n ///\\n /// @dev Emits a {Transfer} and {CreateLockupLinearStream} event.\\n ///\\n /// Requirements:\\n /// - All requirements in {createWithTimestamps} must be met for the calculated parameters.\\n ///\\n /// @param params Struct encapsulating the function parameters, which are documented in {DataTypes}.\\n /// @return streamId The ID of the newly created stream.\\n function createWithDurations(\\n LockupLinear.CreateWithDurations calldata params\\n ) external returns (uint256 streamId);\\n\\n /// @notice Creates a stream with the provided start time and end time. The stream is funded by `msg.sender` and is\\n /// wrapped in an ERC-721 NFT.\\n ///\\n /// @dev Emits a {Transfer} and {CreateLockupLinearStream} event.\\n ///\\n /// Notes:\\n /// - A cliff time of zero means there is no cliff.\\n /// - As long as the times are ordered, it is not an error for the start or the cliff time to be in the past.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `params.totalAmount` must be greater than zero.\\n /// - If set, `params.broker.fee` must not be greater than `MAX_BROKER_FEE`.\\n /// - `params.timestamps.start` must be greater than zero and less than `params.timestamps.end`.\\n /// - If set, `params.timestamps.cliff` must be greater than `params.timestamps.start` and less than\\n /// `params.timestamps.end`.\\n /// - `params.timestamps.end` must be in the future.\\n /// - `params.recipient` must not be the zero address.\\n /// - `msg.sender` must have allowed this contract to spend at least `params.totalAmount` assets.\\n ///\\n /// @param params Struct encapsulating the function parameters, which are documented in {DataTypes}.\\n /// @return streamId The ID of the newly created stream.\\n function createWithTimestamps(\\n LockupLinear.CreateWithTimestamps calldata params\\n ) external returns (uint256 streamId);\\n}\\n\",\"keccak256\":\"0x064264723114b1f1cf3953fd79874dfcbb42cf313857aee6d5e6b09a23e0010b\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/ISablierV2NFTDescriptor.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC721Metadata} from \\\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\\\";\\n\\n/// @title ISablierV2NFTDescriptor\\n/// @notice This contract generates the URI describing the Sablier V2 stream NFTs.\\n/// @dev Inspired by Uniswap V3 Positions NFTs.\\ninterface ISablierV2NFTDescriptor {\\n /// @notice Produces the URI describing a particular stream NFT.\\n /// @dev This is a data URI with the JSON contents directly inlined.\\n /// @param sablier The address of the Sablier contract the stream was created in.\\n /// @param streamId The ID of the stream for which to produce a description.\\n /// @return uri The URI of the ERC721-compliant metadata.\\n function tokenURI(\\n IERC721Metadata sablier,\\n uint256 streamId\\n ) external view returns (string memory uri);\\n}\\n\",\"keccak256\":\"0x4ed430e553d14161e93efdaaacd1a502f49b38969c9d714b45d2e682a74fa0bc\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/types/DataTypes.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {UD2x18} from \\\"@prb/math/src/UD2x18.sol\\\";\\nimport {UD60x18} from \\\"@prb/math/src/UD60x18.sol\\\";\\n\\n// DataTypes.sol\\n//\\n// This file defines all structs used in V2 Core, most of which are organized under three namespaces:\\n//\\n// - Lockup\\n// - LockupDynamic\\n// - LockupLinear\\n// - LockupTranched\\n//\\n// You will notice that some structs contain \\\"slot\\\" annotations - they are used to indicate the\\n// storage layout of the struct. It is more gas efficient to group small data types together so\\n// that they fit in a single 32-byte slot.\\n\\n/// @notice Struct encapsulating the broker parameters passed to the create functions. Both can be set to zero.\\n/// @param account The address receiving the broker's fee.\\n/// @param fee The broker's percentage fee from the total amount, denoted as a fixed-point number where 1e18 is 100%.\\nstruct Broker {\\n address account;\\n UD60x18 fee;\\n}\\n\\n/// @notice Namespace for the structs used in both {SablierV2LockupLinear} and {SablierV2LockupDynamic}.\\nlibrary Lockup {\\n /// @notice Struct encapsulating the deposit, withdrawn, and refunded amounts, all denoted in units of the asset's\\n /// decimals.\\n /// @dev Because the deposited and the withdrawn amount are often read together, declaring them in the same slot\\n /// saves gas.\\n /// @param deposited The initial amount deposited in the stream, net of broker fee.\\n /// @param withdrawn The cumulative amount withdrawn from the stream.\\n /// @param refunded The amount refunded to the sender. Unless the stream was canceled, this is always zero.\\n struct Amounts {\\n // slot 0\\n uint128 deposited;\\n uint128 withdrawn;\\n // slot 1\\n uint128 refunded;\\n }\\n\\n /// @notice Struct encapsulating (i) the deposit amount and (ii) the broker fee amount, both denoted in units of the\\n /// asset's decimals.\\n /// @param deposit The amount to deposit in the stream.\\n /// @param brokerFee The broker fee amount.\\n struct CreateAmounts {\\n uint128 deposit;\\n uint128 brokerFee;\\n }\\n\\n /// @notice Enum representing the different statuses of a stream.\\n /// @custom:value0 PENDING Stream created but not started; assets are in a pending state.\\n /// @custom:value1 STREAMING Active stream where assets are currently being streamed.\\n /// @custom:value2 SETTLED All assets have been streamed; recipient is due to withdraw them.\\n /// @custom:value3 CANCELED Canceled stream; remaining assets await recipient's withdrawal.\\n /// @custom:value4 DEPLETED Depleted stream; all assets have been withdrawn and/or refunded.\\n enum Status {\\n PENDING,\\n STREAMING,\\n SETTLED,\\n CANCELED,\\n DEPLETED\\n }\\n\\n /// @notice A common data structure to be stored in all {SablierV2Lockup} models.\\n /// @dev The fields are arranged like this to save gas via tight variable packing.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream.\\n /// @param startTime The Unix timestamp indicating the stream's start.\\n /// @param endTime The Unix timestamp indicating the stream's end.\\n /// @param isCancelable Boolean indicating if the stream is cancelable.\\n /// @param wasCanceled Boolean indicating if the stream was canceled.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param isDepleted Boolean indicating if the stream is depleted.\\n /// @param isStream Boolean indicating if the struct entity exists.\\n /// @param isTransferable Boolean indicating if the stream NFT is transferable.\\n /// @param amounts Struct encapsulating the deposit, withdrawn, and refunded amounts, all denoted in units of the\\n /// asset's decimals.\\n struct Stream {\\n // slot 0\\n address sender;\\n uint40 startTime;\\n uint40 endTime;\\n bool isCancelable;\\n bool wasCanceled;\\n // slot 1\\n IERC20 asset;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n // slot 2 and 3\\n Lockup.Amounts amounts;\\n }\\n}\\n\\n/// @notice Namespace for the structs used in {SablierV2LockupDynamic}.\\nlibrary LockupDynamic {\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupDynamic.createWithDurations} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param segments Segments with durations used to compose the dynamic distribution function. Timestamps are\\n /// calculated by starting from `block.timestamp` and adding each duration to the previous timestamp.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithDurations {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n SegmentWithDuration[] segments;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupDynamic.createWithTimestamps} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param startTime The Unix timestamp indicating the stream's start.\\n /// @param segments Segments used to compose the dynamic distribution function.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithTimestamps {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n uint40 startTime;\\n Segment[] segments;\\n Broker broker;\\n }\\n\\n /// @notice Segment struct used in the Lockup Dynamic stream.\\n /// @param amount The amount of assets to be streamed in the segment, denoted in units of the asset's decimals.\\n /// @param exponent The exponent of the segment, denoted as a fixed-point number.\\n /// @param timestamp The Unix timestamp indicating the segment's end.\\n struct Segment {\\n // slot 0\\n uint128 amount;\\n UD2x18 exponent;\\n uint40 timestamp;\\n }\\n\\n /// @notice Segment struct used at runtime in {SablierV2LockupDynamic.createWithDurations}.\\n /// @param amount The amount of assets to be streamed in the segment, denoted in units of the asset's decimals.\\n /// @param exponent The exponent of the segment, denoted as a fixed-point number.\\n /// @param duration The time difference in seconds between the segment and the previous one.\\n struct SegmentWithDuration {\\n uint128 amount;\\n UD2x18 exponent;\\n uint40 duration;\\n }\\n\\n /// @notice Struct encapsulating the full details of a stream.\\n /// @dev Extends `Lockup.Stream` by including the recipient and the segments.\\n struct StreamLD {\\n address sender;\\n address recipient;\\n uint40 startTime;\\n uint40 endTime;\\n bool isCancelable;\\n bool wasCanceled;\\n IERC20 asset;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n Lockup.Amounts amounts;\\n Segment[] segments;\\n }\\n\\n /// @notice Struct encapsulating the LockupDynamic timestamps.\\n /// @param start The Unix timestamp indicating the stream's start.\\n /// @param end The Unix timestamp indicating the stream's end.\\n struct Timestamps {\\n uint40 start;\\n uint40 end;\\n }\\n}\\n\\n/// @notice Namespace for the structs used in {SablierV2LockupLinear}.\\nlibrary LockupLinear {\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupLinear.createWithDurations} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param durations Struct encapsulating (i) cliff period duration and (ii) total stream duration, both in seconds.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithDurations {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n Durations durations;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupLinear.createWithTimestamps} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param timestamps Struct encapsulating (i) the stream's start time, (ii) cliff time, and (iii) end time, all as\\n /// Unix timestamps.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithTimestamps {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n Timestamps timestamps;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the cliff duration and the total duration.\\n /// @param cliff The cliff duration in seconds.\\n /// @param total The total duration in seconds.\\n struct Durations {\\n uint40 cliff;\\n uint40 total;\\n }\\n\\n /// @notice Struct encapsulating the full details of a stream.\\n /// @dev Extends `Lockup.Stream` by including the recipient and the cliff time.\\n struct StreamLL {\\n address sender;\\n address recipient;\\n uint40 startTime;\\n bool isCancelable;\\n bool wasCanceled;\\n IERC20 asset;\\n uint40 endTime;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n Lockup.Amounts amounts;\\n uint40 cliffTime;\\n }\\n\\n /// @notice Struct encapsulating the LockupLinear timestamps.\\n /// @param start The Unix timestamp for the stream's start.\\n /// @param cliff The Unix timestamp for the cliff period's end. A value of zero means there is no cliff.\\n /// @param end The Unix timestamp for the stream's end.\\n struct Timestamps {\\n uint40 start;\\n uint40 cliff;\\n uint40 end;\\n }\\n}\\n\\n/// @notice Namespace for the structs used in {SablierV2LockupTranched}.\\nlibrary LockupTranched {\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupTranched.createWithDurations} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param tranches Tranches with durations used to compose the tranched distribution function. Timestamps are\\n /// calculated by starting from `block.timestamp` and adding each duration to the previous timestamp.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithDurations {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n TrancheWithDuration[] tranches;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupTranched.createWithTimestamps} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param startTime The Unix timestamp indicating the stream's start.\\n /// @param tranches Tranches used to compose the tranched distribution function.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithTimestamps {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n uint40 startTime;\\n Tranche[] tranches;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the full details of a stream.\\n /// @dev Extends `Lockup.Stream` by including the recipient and the tranches.\\n struct StreamLT {\\n address sender;\\n address recipient;\\n uint40 startTime;\\n uint40 endTime;\\n bool isCancelable;\\n bool wasCanceled;\\n IERC20 asset;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n Lockup.Amounts amounts;\\n Tranche[] tranches;\\n }\\n\\n /// @notice Struct encapsulating the LockupTranched timestamps.\\n /// @param start The Unix timestamp indicating the stream's start.\\n /// @param end The Unix timestamp indicating the stream's end.\\n struct Timestamps {\\n uint40 start;\\n uint40 end;\\n }\\n\\n /// @notice Tranche struct used in the Lockup Tranched stream.\\n /// @param amount The amount of assets to be unlocked in the tranche, denoted in units of the asset's decimals.\\n /// @param timestamp The Unix timestamp indicating the tranche's end.\\n struct Tranche {\\n // slot 0\\n uint128 amount;\\n uint40 timestamp;\\n }\\n\\n /// @notice Tranche struct used at runtime in {SablierV2LockupTranched.createWithDurations}.\\n /// @param amount The amount of assets to be unlocked in the tranche, denoted in units of the asset's decimals.\\n /// @param duration The time difference in seconds between the tranche and the previous one.\\n struct TrancheWithDuration {\\n uint128 amount;\\n uint40 duration;\\n }\\n}\\n\",\"keccak256\":\"0x727722c0ec71a76a947b935c9dfcac8fd846d6c3547dfbc8739c7109f3b95068\",\"license\":\"GPL-3.0-or-later\"},\"contracts/modules/DecentHatsModificationModule.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.28;\\n\\nimport {DecentHatsModuleUtils} from \\\"./DecentHatsModuleUtils.sol\\\";\\n\\ncontract DecentHatsModificationModule is DecentHatsModuleUtils {\\n /**\\n * @notice Creates a new termed or untermed role hat and any streams on it.\\n *\\n * @notice This contract should be enabled a module on the Safe for which the role is to be created, and disabled after.\\n *\\n * @dev Stream funds on untermed Roles are targeted at the hat's smart account. In order to withdraw funds from the stream, the\\n * hat's smart account must be the one call to `withdraw-` on the Sablier contract, setting the recipient arg to its wearer.\\n *\\n * @dev Stream funds on termed Roles are targeted directly at the nominated wearer.\\n * The wearer should directly call `withdraw-` on the Sablier contract.\\n *\\n * @dev Role hat creation, minting, smart account creation and stream creation are handled here in order\\n * to avoid a race condition where not more than one active proposal to create a new role can exist at a time.\\n * See: https://github.com/decentdao/decent-interface/issues/2402\\n *\\n * @param roleHatsParams An array of params for each role hat to be created.\\n */\\n function createRoleHats(\\n CreateRoleHatsParams calldata roleHatsParams\\n ) external {\\n _processRoleHats(roleHatsParams);\\n }\\n}\\n\",\"keccak256\":\"0x45b9470e000a416382deebea44a8c8734a2d6b453e8c7fbba5ea9bc6fdd4917c\",\"license\":\"MIT\"},\"contracts/modules/DecentHatsModuleUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.28;\\n\\nimport {Enum} from \\\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\\\";\\nimport {IAvatar} from \\\"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IERC6551Registry} from \\\"../interfaces/IERC6551Registry.sol\\\";\\nimport {IHats} from \\\"../interfaces/hats/IHats.sol\\\";\\nimport {LockupLinear, Broker} from \\\"../interfaces/sablier/types/DataTypes.sol\\\";\\nimport {IHatsModuleFactory} from \\\"../interfaces/hats/IHatsModuleFactory.sol\\\";\\nimport {ISablierV2LockupLinear} from \\\"../interfaces/sablier/ISablierV2LockupLinear.sol\\\";\\nimport {Strings} from \\\"@openzeppelin/contracts/utils/Strings.sol\\\";\\n\\nabstract contract DecentHatsModuleUtils {\\n bytes32 public constant SALT =\\n 0x5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b5072;\\n\\n struct SablierStreamParams {\\n ISablierV2LockupLinear sablier;\\n address sender;\\n address asset;\\n LockupLinear.Timestamps timestamps;\\n Broker broker;\\n uint128 totalAmount;\\n bool cancelable;\\n bool transferable;\\n }\\n\\n struct HatParams {\\n address wearer;\\n string details;\\n string imageURI;\\n SablierStreamParams[] sablierStreamsParams;\\n uint128 termEndDateTs; // If 0, this is an untermed Hat\\n uint32 maxSupply;\\n bool isMutable;\\n }\\n\\n struct CreateRoleHatsParams {\\n IHats hatsProtocol;\\n IERC6551Registry erc6551Registry;\\n address hatsAccountImplementation;\\n uint256 topHatId;\\n address topHatAccount;\\n address keyValuePairs;\\n IHatsModuleFactory hatsModuleFactory;\\n address hatsElectionsEligibilityImplementation;\\n uint256 adminHatId;\\n HatParams[] hats;\\n }\\n\\n function _processRoleHats(\\n CreateRoleHatsParams memory roleHatsParams\\n ) internal {\\n for (uint256 i = 0; i < roleHatsParams.hats.length; ) {\\n HatParams memory hatParams = roleHatsParams.hats[i];\\n\\n // Create eligibility module if needed\\n address eligibilityAddress = _createEligibilityModule(\\n roleHatsParams.hatsProtocol,\\n roleHatsParams.hatsModuleFactory,\\n roleHatsParams.hatsElectionsEligibilityImplementation,\\n roleHatsParams.topHatId,\\n roleHatsParams.topHatAccount,\\n roleHatsParams.adminHatId,\\n hatParams.termEndDateTs\\n );\\n\\n // Create and Mint the Role Hat\\n uint256 hatId = _createAndMintHat(\\n roleHatsParams.hatsProtocol,\\n roleHatsParams.adminHatId,\\n hatParams,\\n eligibilityAddress,\\n roleHatsParams.topHatAccount\\n );\\n\\n // Get the stream recipient (based on termed or not)\\n address streamRecipient = _setupStreamRecipient(\\n roleHatsParams.erc6551Registry,\\n roleHatsParams.hatsAccountImplementation,\\n address(roleHatsParams.hatsProtocol),\\n hatParams.termEndDateTs,\\n hatParams.wearer,\\n hatId\\n );\\n\\n // Create streams\\n _processSablierStreams(\\n hatParams.sablierStreamsParams,\\n streamRecipient,\\n roleHatsParams.keyValuePairs,\\n hatId\\n );\\n\\n unchecked {\\n ++i;\\n }\\n }\\n }\\n\\n function _createEligibilityModule(\\n IHats hatsProtocol,\\n IHatsModuleFactory hatsModuleFactory,\\n address hatsElectionsEligibilityImplementation,\\n uint256 topHatId,\\n address topHatAccount,\\n uint256 adminHatId,\\n uint128 termEndDateTs\\n ) private returns (address) {\\n // If the Hat is termed, create the eligibility module\\n if (termEndDateTs != 0) {\\n return\\n hatsModuleFactory.createHatsModule(\\n hatsElectionsEligibilityImplementation,\\n hatsProtocol.getNextId(adminHatId),\\n abi.encode(topHatId, uint256(0)), // [BALLOT_BOX_ID, ADMIN_HAT_ID]\\n abi.encode(termEndDateTs),\\n uint256(SALT)\\n );\\n }\\n\\n // Otherwise, return the Top Hat account\\n return topHatAccount;\\n }\\n\\n function _createAndMintHat(\\n IHats hatsProtocol,\\n uint256 adminHatId,\\n HatParams memory hat,\\n address eligibilityAddress,\\n address topHatAccount\\n ) private returns (uint256) {\\n // Grab the next Hat ID (before creating it)\\n uint256 hatId = hatsProtocol.getNextId(adminHatId);\\n\\n // Create the new Hat\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"createHat(uint256,string,uint32,address,address,bool,string)\\\",\\n adminHatId,\\n hat.details,\\n hat.maxSupply,\\n eligibilityAddress,\\n topHatAccount,\\n hat.isMutable,\\n hat.imageURI\\n ),\\n Enum.Operation.Call\\n );\\n\\n // If the Hat is termed, nominate the wearer as the eligible member\\n if (hat.termEndDateTs != 0) {\\n address[] memory nominatedWearers = new address[](1);\\n nominatedWearers[0] = hat.wearer;\\n\\n IAvatar(msg.sender).execTransactionFromModule(\\n eligibilityAddress,\\n 0,\\n abi.encodeWithSignature(\\n \\\"elect(uint128,address[])\\\",\\n hat.termEndDateTs,\\n nominatedWearers\\n ),\\n Enum.Operation.Call\\n );\\n }\\n\\n // Mint the Hat\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"mintHat(uint256,address)\\\",\\n hatId,\\n hat.wearer\\n ),\\n Enum.Operation.Call\\n );\\n return hatId;\\n }\\n\\n // Exists to avoid stack too deep errors\\n function _setupStreamRecipient(\\n IERC6551Registry erc6551Registry,\\n address hatsAccountImplementation,\\n address hatsProtocol,\\n uint128 termEndDateTs,\\n address wearer,\\n uint256 hatId\\n ) private returns (address) {\\n // If the hat is termed, the wearer is the stream recipient\\n if (termEndDateTs != 0) {\\n return wearer;\\n }\\n\\n // Otherwise, the Hat's smart account is the stream recipient\\n return\\n erc6551Registry.createAccount(\\n hatsAccountImplementation,\\n SALT,\\n block.chainid,\\n hatsProtocol,\\n hatId\\n );\\n }\\n\\n function _processSablierStreams(\\n SablierStreamParams[] memory streamParams,\\n address streamRecipient,\\n address keyValuePairs,\\n uint256 hatId\\n ) private {\\n for (uint256 i = 0; i < streamParams.length; ) {\\n SablierStreamParams memory sablierStreamParams = streamParams[i];\\n\\n // Approve tokens for Sablier\\n IAvatar(msg.sender).execTransactionFromModule(\\n sablierStreamParams.asset,\\n 0,\\n abi.encodeWithSignature(\\n \\\"approve(address,uint256)\\\",\\n sablierStreamParams.sablier,\\n sablierStreamParams.totalAmount\\n ),\\n Enum.Operation.Call\\n );\\n uint256 streamId = ISablierV2LockupLinear(\\n sablierStreamParams.sablier\\n ).nextStreamId();\\n\\n // Proxy the Sablier call through IAvatar\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(sablierStreamParams.sablier),\\n 0,\\n abi.encodeWithSignature(\\n \\\"createWithTimestamps((address,address,uint128,address,bool,bool,(uint40,uint40,uint40),(address,uint256)))\\\",\\n LockupLinear.CreateWithTimestamps({\\n sender: sablierStreamParams.sender,\\n recipient: streamRecipient,\\n totalAmount: sablierStreamParams.totalAmount,\\n asset: IERC20(sablierStreamParams.asset),\\n cancelable: sablierStreamParams.cancelable,\\n transferable: sablierStreamParams.transferable,\\n timestamps: sablierStreamParams.timestamps,\\n broker: sablierStreamParams.broker\\n })\\n ),\\n Enum.Operation.Call\\n );\\n\\n // Update KeyValuePairs with the stream ID and Hat ID\\n string[] memory keys = new string[](1);\\n string[] memory values = new string[](1);\\n keys[0] = \\\"hatIdToStreamId\\\";\\n values[0] = string(\\n abi.encodePacked(\\n Strings.toString(hatId),\\n \\\":\\\",\\n Strings.toString(streamId)\\n )\\n );\\n\\n IAvatar(msg.sender).execTransactionFromModule(\\n keyValuePairs,\\n 0,\\n abi.encodeWithSignature(\\n \\\"updateValues(string[],string[])\\\",\\n keys,\\n values\\n ),\\n Enum.Operation.Call\\n );\\n\\n unchecked {\\n ++i;\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xcf91d6de2291dd71d2491292ee2d1120c444b8f4f11b8c31429ed4c630013e69\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052348015600f57600080fd5b506116d88061001f6000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80630ad5e4271461003b578063ba9a91a514610050575b600080fd5b61004e610049366004610c55565b610089565b005b6100777f5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b507281565b60405190815260200160405180910390f35b61009a6100958261118c565b61009d565b50565b60005b8161012001515181101561016857600082610120015182815181106100c7576100c7611260565b6020026020010151905060006100ff84600001518560c001518660e0015187606001518860800151896101000151886080015161016c565b9050600061011d8560000151866101000151858589608001516102e5565b905060006101438660200151876040015188600001518760800151886000015187610617565b90506101598460600151828860a00151856106e3565b846001019450505050506100a0565b5050565b60006001600160801b038216156102d757866001600160a01b0316632f7fb7b6878a6001600160a01b0316631183a8c0876040518263ffffffff1660e01b81526004016101bb91815260200190565b602060405180830381865afa1580156101d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101fc9190611276565b886000604051602001610219929190918252602082015260400190565b60408051601f198184030181528282526001600160801b0389166020840152910160408051601f19818403018152908290526001600160e01b031960e087901b16825261028d949392917f5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b5072906004016112df565b6020604051808303816000875af11580156102ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102d0919061132b565b90506102da565b50825b979650505050505050565b60405162460ea360e61b81526004810185905260009081906001600160a01b03881690631183a8c090602401602060405180830381865afa15801561032e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103529190611276565b9050336001600160a01b031663468721a78860008989602001518a60a001518a8a8d60c001518e604001516040516024016103939796959493929190611348565b60408051601f198184030181529181526020820180516001600160e01b0316635829492f60e11b1790525160e085901b6001600160e01b03191681526103e1939291906000906004016113ac565b6020604051808303816000875af1158015610400573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104249190611402565b5060808501516001600160801b03161561054f576040805160018082528183019092526000916020808301908036833701905050905085600001518160008151811061047257610472611260565b60200260200101906001600160a01b031690816001600160a01b031681525050336001600160a01b031663468721a78660008960800151856040516024016104bb92919061141f565b60408051601f198184030181529181526020820180516001600160e01b0316634a231cef60e01b1790525160e085901b6001600160e01b0319168152610509939291906000906004016113ac565b6020604051808303816000875af1158015610528573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061054c9190611402565b50505b8451604051602481018390526001600160a01b039091166044820152339063468721a790899060009060640160408051601f198184030181529181526020820180516001600160e01b031663320fbbb760e11b1790525160e085901b6001600160e01b03191681526105c9939291906000906004016113ac565b6020604051808303816000875af11580156105e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061060c9190611402565b509695505050505050565b60006001600160801b0384161561062f5750816106d9565b604051638a54c52f60e01b81526001600160a01b0387811660048301527f5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b50726024830152466044830152868116606483015260848201849052881690638a54c52f9060a4016020604051808303816000875af11580156106b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106d6919061132b565b90505b9695505050505050565b60005b8451811015610b4657600085828151811061070357610703611260565b60200260200101519050336001600160a01b031663468721a78260400151600084600001518560a0015160405160240161075b9291906001600160a01b039290921682526001600160801b0316602082015260400190565b60408051601f198184030181529181526020820180516001600160e01b031663095ea7b360e01b1790525160e085901b6001600160e01b03191681526107a9939291906000906004016113ac565b6020604051808303816000875af11580156107c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ec9190611402565b50600081600001516001600160a01b0316631e99d5696040518163ffffffff1660e01b8152600401602060405180830381865afa158015610831573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108559190611276565b9050336001600160a01b031663468721a78360000151600060405180610100016040528087602001516001600160a01b031681526020018b6001600160a01b031681526020018760a001516001600160801b0316815260200187604001516001600160a01b031681526020018760c00151151581526020018760e00151151581526020018760600151815260200187608001518152506040516024016108fb9190611480565b60408051601f198184030181529181526020820180516001600160e01b03166353b1572760e01b1790525160e085901b6001600160e01b0319168152610949939291906000906004016113ac565b6020604051808303816000875af1158015610968573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061098c9190611402565b50604080516001808252818301909252600091816020015b60608152602001906001900390816109a457505060408051600180825281830190925291925060009190602082015b60608152602001906001900390816109d35790505090506040518060400160405280600f81526020016e1a185d1259151bd4dd1c99585b5259608a1b81525082600081518110610a2557610a25611260565b6020026020010181905250610a3986610b4d565b610a4284610b4d565b604051602001610a5392919061154f565b60405160208183030381529060405281600081518110610a7557610a75611260565b6020026020010181905250336001600160a01b031663468721a78860008585604051602401610aa59291906115db565b60408051601f198184030181529181526020820180516001600160e01b031663579374b960e11b1790525160e085901b6001600160e01b0319168152610af3939291906000906004016113ac565b6020604051808303816000875af1158015610b12573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b369190611402565b50846001019450505050506106e6565b5050505050565b606081600003610b745750506040805180820190915260018152600360fc1b602082015290565b8160005b8115610b9e5780610b888161161f565b9150610b979050600a8361164e565b9150610b78565b6000816001600160401b03811115610bb857610bb8610c97565b6040519080825280601f01601f191660200182016040528015610be2576020820181803683370190505b5090505b8415610c4d57610bf7600183611662565b9150610c04600a8661167b565b610c0f90603061168f565b60f81b818381518110610c2457610c24611260565b60200101906001600160f81b031916908160001a905350610c46600a8661164e565b9450610be6565b949350505050565b600060208284031215610c6757600080fd5b81356001600160401b03811115610c7d57600080fd5b82016101408185031215610c9057600080fd5b9392505050565b634e487b7160e01b600052604160045260246000fd5b60405161010081016001600160401b0381118282101715610cd057610cd0610c97565b60405290565b60405160e081016001600160401b0381118282101715610cd057610cd0610c97565b60405161014081016001600160401b0381118282101715610cd057610cd0610c97565b604051601f8201601f191681016001600160401b0381118282101715610d4357610d43610c97565b604052919050565b6001600160a01b038116811461009a57600080fd5b8035610d6b81610d4b565b919050565b60006001600160401b03821115610d8957610d89610c97565b5060051b60200190565b600082601f830112610da457600080fd5b81356001600160401b03811115610dbd57610dbd610c97565b610dd0601f8201601f1916602001610d1b565b818152846020838601011115610de557600080fd5b816020850160208301376000918101602001919091529392505050565b803564ffffffffff81168114610d6b57600080fd5b600060608284031215610e2957600080fd5b604051606081016001600160401b0381118282101715610e4b57610e4b610c97565b604052905080610e5a83610e02565b8152610e6860208401610e02565b6020820152610e7960408401610e02565b60408201525092915050565b600060408284031215610e9757600080fd5b604080519081016001600160401b0381118282101715610eb957610eb9610c97565b6040529050808235610eca81610d4b565b8152602092830135920191909152919050565b80356001600160801b0381168114610d6b57600080fd5b801515811461009a57600080fd5b8035610d6b81610ef4565b600082601f830112610f1e57600080fd5b8135610f31610f2c82610d70565b610d1b565b8082825260208201915060206101608402860101925085831115610f5457600080fd5b602085015b83811015611012576101608188031215610f7257600080fd5b610f7a610cad565b610f8382610d60565b8152610f9160208301610d60565b6020820152610fa260408301610d60565b6040820152610fb48860608401610e17565b6060820152610fc68860c08401610e85565b6080820152610fd86101008301610edd565b60a0820152610fea6101208301610f02565b60c0820152610ffc6101408301610f02565b60e0820152835260209092019161016001610f59565b5095945050505050565b803563ffffffff81168114610d6b57600080fd5b600082601f83011261104157600080fd5b813561104f610f2c82610d70565b8082825260208201915060208360051b86010192508583111561107157600080fd5b602085015b838110156110125780356001600160401b0381111561109457600080fd5b860160e0818903601f190112156110aa57600080fd5b6110b2610cd6565b6110be60208301610d60565b815260408201356001600160401b038111156110d957600080fd5b6110e88a602083860101610d93565b60208301525060608201356001600160401b0381111561110757600080fd5b6111168a602083860101610d93565b60408301525060808201356001600160401b0381111561113557600080fd5b6111448a602083860101610f0d565b60608301525061115660a08301610edd565b608082015261116760c0830161101c565b60a082015261117860e08301610f02565b60c082015284525060209283019201611076565b6000610140823603121561119f57600080fd5b6111a7610cf8565b6111b083610d60565b81526111be60208401610d60565b60208201526111cf60408401610d60565b6040820152606083810135908201526111ea60808401610d60565b60808201526111fb60a08401610d60565b60a082015261120c60c08401610d60565b60c082015261121d60e08401610d60565b60e082015261010083810135908201526101208301356001600160401b0381111561124757600080fd5b61125336828601611030565b6101208301525092915050565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561128857600080fd5b5051919050565b60005b838110156112aa578181015183820152602001611292565b50506000910152565b600081518084526112cb81602086016020860161128f565b601f01601f19169290920160200192915050565b60018060a01b038616815284602082015260a06040820152600061130660a08301866112b3565b828103606084015261131881866112b3565b9150508260808301529695505050505050565b60006020828403121561133d57600080fd5b8151610c9081610d4b565b87815260e06020820152600061136160e08301896112b3565b63ffffffff881660408401526001600160a01b0387811660608501528616608084015284151560a084015282810360c084015261139e81856112b3565b9a9950505050505050505050565b60018060a01b03851681528360208201526080604082015260006113d360808301856112b3565b9050600283106113f357634e487b7160e01b600052602160045260246000fd5b82606083015295945050505050565b60006020828403121561141457600080fd5b8151610c9081610ef4565b6000604082016001600160801b03851683526040602084015280845180835260608501915060208601925060005b818110156114745783516001600160a01b031683526020938401939092019160010161144d565b50909695505050505050565b81516001600160a01b0390811682526020808401518216908301526040808401516001600160801b031690830152606080840151918216908301526101608201905060808301516114d5608084018215159052565b5060a08301516114e960a084018215159052565b5060c083015161152860c084018264ffffffffff815116825264ffffffffff602082015116602083015264ffffffffff60408201511660408301525050565b5060e0929092015180516001600160a01b0316610120830152602001516101409091015290565b6000835161156181846020880161128f565b601d60f91b908301908152835161157f81600184016020880161128f565b01600101949350505050565b600082825180855260208501945060208160051b8301016020850160005b8381101561147457601f198584030188526115c58383516112b3565b60209889019890935091909101906001016115a9565b6040815260006115ee604083018561158b565b8281036020840152611600818561158b565b95945050505050565b634e487b7160e01b600052601160045260246000fd5b60006001820161163157611631611609565b5060010190565b634e487b7160e01b600052601260045260246000fd5b60008261165d5761165d611638565b500490565b8181038181111561167557611675611609565b92915050565b60008261168a5761168a611638565b500690565b808201808211156116755761167561160956fea2646970667358221220cbb4b307eab1d5ffde2b7ecaf86a40052d6217b110fff2ecda840a0a4b601bdc64736f6c634300081c0033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100365760003560e01c80630ad5e4271461003b578063ba9a91a514610050575b600080fd5b61004e610049366004610c55565b610089565b005b6100777f5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b507281565b60405190815260200160405180910390f35b61009a6100958261118c565b61009d565b50565b60005b8161012001515181101561016857600082610120015182815181106100c7576100c7611260565b6020026020010151905060006100ff84600001518560c001518660e0015187606001518860800151896101000151886080015161016c565b9050600061011d8560000151866101000151858589608001516102e5565b905060006101438660200151876040015188600001518760800151886000015187610617565b90506101598460600151828860a00151856106e3565b846001019450505050506100a0565b5050565b60006001600160801b038216156102d757866001600160a01b0316632f7fb7b6878a6001600160a01b0316631183a8c0876040518263ffffffff1660e01b81526004016101bb91815260200190565b602060405180830381865afa1580156101d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101fc9190611276565b886000604051602001610219929190918252602082015260400190565b60408051601f198184030181528282526001600160801b0389166020840152910160408051601f19818403018152908290526001600160e01b031960e087901b16825261028d949392917f5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b5072906004016112df565b6020604051808303816000875af11580156102ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102d0919061132b565b90506102da565b50825b979650505050505050565b60405162460ea360e61b81526004810185905260009081906001600160a01b03881690631183a8c090602401602060405180830381865afa15801561032e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103529190611276565b9050336001600160a01b031663468721a78860008989602001518a60a001518a8a8d60c001518e604001516040516024016103939796959493929190611348565b60408051601f198184030181529181526020820180516001600160e01b0316635829492f60e11b1790525160e085901b6001600160e01b03191681526103e1939291906000906004016113ac565b6020604051808303816000875af1158015610400573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104249190611402565b5060808501516001600160801b03161561054f576040805160018082528183019092526000916020808301908036833701905050905085600001518160008151811061047257610472611260565b60200260200101906001600160a01b031690816001600160a01b031681525050336001600160a01b031663468721a78660008960800151856040516024016104bb92919061141f565b60408051601f198184030181529181526020820180516001600160e01b0316634a231cef60e01b1790525160e085901b6001600160e01b0319168152610509939291906000906004016113ac565b6020604051808303816000875af1158015610528573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061054c9190611402565b50505b8451604051602481018390526001600160a01b039091166044820152339063468721a790899060009060640160408051601f198184030181529181526020820180516001600160e01b031663320fbbb760e11b1790525160e085901b6001600160e01b03191681526105c9939291906000906004016113ac565b6020604051808303816000875af11580156105e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061060c9190611402565b509695505050505050565b60006001600160801b0384161561062f5750816106d9565b604051638a54c52f60e01b81526001600160a01b0387811660048301527f5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b50726024830152466044830152868116606483015260848201849052881690638a54c52f9060a4016020604051808303816000875af11580156106b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106d6919061132b565b90505b9695505050505050565b60005b8451811015610b4657600085828151811061070357610703611260565b60200260200101519050336001600160a01b031663468721a78260400151600084600001518560a0015160405160240161075b9291906001600160a01b039290921682526001600160801b0316602082015260400190565b60408051601f198184030181529181526020820180516001600160e01b031663095ea7b360e01b1790525160e085901b6001600160e01b03191681526107a9939291906000906004016113ac565b6020604051808303816000875af11580156107c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ec9190611402565b50600081600001516001600160a01b0316631e99d5696040518163ffffffff1660e01b8152600401602060405180830381865afa158015610831573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108559190611276565b9050336001600160a01b031663468721a78360000151600060405180610100016040528087602001516001600160a01b031681526020018b6001600160a01b031681526020018760a001516001600160801b0316815260200187604001516001600160a01b031681526020018760c00151151581526020018760e00151151581526020018760600151815260200187608001518152506040516024016108fb9190611480565b60408051601f198184030181529181526020820180516001600160e01b03166353b1572760e01b1790525160e085901b6001600160e01b0319168152610949939291906000906004016113ac565b6020604051808303816000875af1158015610968573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061098c9190611402565b50604080516001808252818301909252600091816020015b60608152602001906001900390816109a457505060408051600180825281830190925291925060009190602082015b60608152602001906001900390816109d35790505090506040518060400160405280600f81526020016e1a185d1259151bd4dd1c99585b5259608a1b81525082600081518110610a2557610a25611260565b6020026020010181905250610a3986610b4d565b610a4284610b4d565b604051602001610a5392919061154f565b60405160208183030381529060405281600081518110610a7557610a75611260565b6020026020010181905250336001600160a01b031663468721a78860008585604051602401610aa59291906115db565b60408051601f198184030181529181526020820180516001600160e01b031663579374b960e11b1790525160e085901b6001600160e01b0319168152610af3939291906000906004016113ac565b6020604051808303816000875af1158015610b12573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b369190611402565b50846001019450505050506106e6565b5050505050565b606081600003610b745750506040805180820190915260018152600360fc1b602082015290565b8160005b8115610b9e5780610b888161161f565b9150610b979050600a8361164e565b9150610b78565b6000816001600160401b03811115610bb857610bb8610c97565b6040519080825280601f01601f191660200182016040528015610be2576020820181803683370190505b5090505b8415610c4d57610bf7600183611662565b9150610c04600a8661167b565b610c0f90603061168f565b60f81b818381518110610c2457610c24611260565b60200101906001600160f81b031916908160001a905350610c46600a8661164e565b9450610be6565b949350505050565b600060208284031215610c6757600080fd5b81356001600160401b03811115610c7d57600080fd5b82016101408185031215610c9057600080fd5b9392505050565b634e487b7160e01b600052604160045260246000fd5b60405161010081016001600160401b0381118282101715610cd057610cd0610c97565b60405290565b60405160e081016001600160401b0381118282101715610cd057610cd0610c97565b60405161014081016001600160401b0381118282101715610cd057610cd0610c97565b604051601f8201601f191681016001600160401b0381118282101715610d4357610d43610c97565b604052919050565b6001600160a01b038116811461009a57600080fd5b8035610d6b81610d4b565b919050565b60006001600160401b03821115610d8957610d89610c97565b5060051b60200190565b600082601f830112610da457600080fd5b81356001600160401b03811115610dbd57610dbd610c97565b610dd0601f8201601f1916602001610d1b565b818152846020838601011115610de557600080fd5b816020850160208301376000918101602001919091529392505050565b803564ffffffffff81168114610d6b57600080fd5b600060608284031215610e2957600080fd5b604051606081016001600160401b0381118282101715610e4b57610e4b610c97565b604052905080610e5a83610e02565b8152610e6860208401610e02565b6020820152610e7960408401610e02565b60408201525092915050565b600060408284031215610e9757600080fd5b604080519081016001600160401b0381118282101715610eb957610eb9610c97565b6040529050808235610eca81610d4b565b8152602092830135920191909152919050565b80356001600160801b0381168114610d6b57600080fd5b801515811461009a57600080fd5b8035610d6b81610ef4565b600082601f830112610f1e57600080fd5b8135610f31610f2c82610d70565b610d1b565b8082825260208201915060206101608402860101925085831115610f5457600080fd5b602085015b83811015611012576101608188031215610f7257600080fd5b610f7a610cad565b610f8382610d60565b8152610f9160208301610d60565b6020820152610fa260408301610d60565b6040820152610fb48860608401610e17565b6060820152610fc68860c08401610e85565b6080820152610fd86101008301610edd565b60a0820152610fea6101208301610f02565b60c0820152610ffc6101408301610f02565b60e0820152835260209092019161016001610f59565b5095945050505050565b803563ffffffff81168114610d6b57600080fd5b600082601f83011261104157600080fd5b813561104f610f2c82610d70565b8082825260208201915060208360051b86010192508583111561107157600080fd5b602085015b838110156110125780356001600160401b0381111561109457600080fd5b860160e0818903601f190112156110aa57600080fd5b6110b2610cd6565b6110be60208301610d60565b815260408201356001600160401b038111156110d957600080fd5b6110e88a602083860101610d93565b60208301525060608201356001600160401b0381111561110757600080fd5b6111168a602083860101610d93565b60408301525060808201356001600160401b0381111561113557600080fd5b6111448a602083860101610f0d565b60608301525061115660a08301610edd565b608082015261116760c0830161101c565b60a082015261117860e08301610f02565b60c082015284525060209283019201611076565b6000610140823603121561119f57600080fd5b6111a7610cf8565b6111b083610d60565b81526111be60208401610d60565b60208201526111cf60408401610d60565b6040820152606083810135908201526111ea60808401610d60565b60808201526111fb60a08401610d60565b60a082015261120c60c08401610d60565b60c082015261121d60e08401610d60565b60e082015261010083810135908201526101208301356001600160401b0381111561124757600080fd5b61125336828601611030565b6101208301525092915050565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561128857600080fd5b5051919050565b60005b838110156112aa578181015183820152602001611292565b50506000910152565b600081518084526112cb81602086016020860161128f565b601f01601f19169290920160200192915050565b60018060a01b038616815284602082015260a06040820152600061130660a08301866112b3565b828103606084015261131881866112b3565b9150508260808301529695505050505050565b60006020828403121561133d57600080fd5b8151610c9081610d4b565b87815260e06020820152600061136160e08301896112b3565b63ffffffff881660408401526001600160a01b0387811660608501528616608084015284151560a084015282810360c084015261139e81856112b3565b9a9950505050505050505050565b60018060a01b03851681528360208201526080604082015260006113d360808301856112b3565b9050600283106113f357634e487b7160e01b600052602160045260246000fd5b82606083015295945050505050565b60006020828403121561141457600080fd5b8151610c9081610ef4565b6000604082016001600160801b03851683526040602084015280845180835260608501915060208601925060005b818110156114745783516001600160a01b031683526020938401939092019160010161144d565b50909695505050505050565b81516001600160a01b0390811682526020808401518216908301526040808401516001600160801b031690830152606080840151918216908301526101608201905060808301516114d5608084018215159052565b5060a08301516114e960a084018215159052565b5060c083015161152860c084018264ffffffffff815116825264ffffffffff602082015116602083015264ffffffffff60408201511660408301525050565b5060e0929092015180516001600160a01b0316610120830152602001516101409091015290565b6000835161156181846020880161128f565b601d60f91b908301908152835161157f81600184016020880161128f565b01600101949350505050565b600082825180855260208501945060208160051b8301016020850160005b8381101561147457601f198584030188526115c58383516112b3565b60209889019890935091909101906001016115a9565b6040815260006115ee604083018561158b565b8281036020840152611600818561158b565b95945050505050565b634e487b7160e01b600052601160045260246000fd5b60006001820161163157611631611609565b5060010190565b634e487b7160e01b600052601260045260246000fd5b60008261165d5761165d611638565b500490565b8181038181111561167557611675611609565b92915050565b60008261168a5761168a611638565b500690565b808201808211156116755761167561160956fea2646970667358221220cbb4b307eab1d5ffde2b7ecaf86a40052d6217b110fff2ecda840a0a4b601bdc64736f6c634300081c0033", "devdoc": { "kind": "dev", "methods": { - "createRoleHats((address,address,address,uint256,address,address,address,uint256,(address,string,string,(address,address,address,(uint40,uint40,uint40),(address,uint256),uint128,bool,bool)[],uint128,uint32,bool)[]))": { + "createRoleHats((address,address,address,uint256,address,address,address,address,uint256,(address,string,string,(address,address,address,(uint40,uint40,uint40),(address,uint256),uint128,bool,bool)[],uint128,uint32,bool)[]))": { "details": "Stream funds on untermed Roles are targeted at the hat's smart account. In order to withdraw funds from the stream, the hat's smart account must be the one call to `withdraw-` on the Sablier contract, setting the recipient arg to its wearer.Stream funds on termed Roles are targeted directly at the nominated wearer. The wearer should directly call `withdraw-` on the Sablier contract.Role hat creation, minting, smart account creation and stream creation are handled here in order to avoid a race condition where not more than one active proposal to create a new role can exist at a time. See: https://github.com/decentdao/decent-interface/issues/2402", "params": { "roleHatsParams": "An array of params for each role hat to be created." @@ -236,7 +241,7 @@ "userdoc": { "kind": "user", "methods": { - "createRoleHats((address,address,address,uint256,address,address,address,uint256,(address,string,string,(address,address,address,(uint40,uint40,uint40),(address,uint256),uint128,bool,bool)[],uint128,uint32,bool)[]))": { + "createRoleHats((address,address,address,uint256,address,address,address,address,uint256,(address,string,string,(address,address,address,(uint40,uint40,uint40),(address,uint256),uint128,bool,bool)[],uint128,uint32,bool)[]))": { "notice": "Creates a new termed or untermed role hat and any streams on it.This contract should be enabled a module on the Safe for which the role is to be created, and disabled after." } }, diff --git a/deployments/polygon/solcInputs/f1fca9a70591742a2aedd10e2fd7e744.json b/deployments/polygon/solcInputs/f1fca9a70591742a2aedd10e2fd7e744.json new file mode 100644 index 0000000..14e45d1 --- /dev/null +++ b/deployments/polygon/solcInputs/f1fca9a70591742a2aedd10e2fd7e744.json @@ -0,0 +1,387 @@ +{ + "language": "Solidity", + "sources": { + "@gnosis.pm/safe-contracts/contracts/base/Executor.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\nimport \"../common/Enum.sol\";\n\n/// @title Executor - A contract that can execute transactions\n/// @author Richard Meissner - \ncontract Executor {\n function execute(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation,\n uint256 txGas\n ) internal returns (bool success) {\n if (operation == Enum.Operation.DelegateCall) {\n // solhint-disable-next-line no-inline-assembly\n assembly {\n success := delegatecall(txGas, to, add(data, 0x20), mload(data), 0, 0)\n }\n } else {\n // solhint-disable-next-line no-inline-assembly\n assembly {\n success := call(txGas, to, value, add(data, 0x20), mload(data), 0, 0)\n }\n }\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/base/FallbackManager.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"../common/SelfAuthorized.sol\";\n\n/// @title Fallback Manager - A contract that manages fallback calls made to this contract\n/// @author Richard Meissner - \ncontract FallbackManager is SelfAuthorized {\n event ChangedFallbackHandler(address handler);\n\n // keccak256(\"fallback_manager.handler.address\")\n bytes32 internal constant FALLBACK_HANDLER_STORAGE_SLOT = 0x6c9a6c4a39284e37ed1cf53d337577d14212a4870fb976a4366c693b939918d5;\n\n function internalSetFallbackHandler(address handler) internal {\n bytes32 slot = FALLBACK_HANDLER_STORAGE_SLOT;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n sstore(slot, handler)\n }\n }\n\n /// @dev Allows to add a contract to handle fallback calls.\n /// Only fallback calls without value and with data will be forwarded.\n /// This can only be done via a Safe transaction.\n /// @param handler contract to handle fallbacks calls.\n function setFallbackHandler(address handler) public authorized {\n internalSetFallbackHandler(handler);\n emit ChangedFallbackHandler(handler);\n }\n\n // solhint-disable-next-line payable-fallback,no-complex-fallback\n fallback() external {\n bytes32 slot = FALLBACK_HANDLER_STORAGE_SLOT;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let handler := sload(slot)\n if iszero(handler) {\n return(0, 0)\n }\n calldatacopy(0, 0, calldatasize())\n // The msg.sender address is shifted to the left by 12 bytes to remove the padding\n // Then the address without padding is stored right after the calldata\n mstore(calldatasize(), shl(96, caller()))\n // Add 20 bytes for the address appended add the end\n let success := call(gas(), handler, 0, 0, add(calldatasize(), 20), 0, 0)\n returndatacopy(0, 0, returndatasize())\n if iszero(success) {\n revert(0, returndatasize())\n }\n return(0, returndatasize())\n }\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/base/GuardManager.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"../common/Enum.sol\";\nimport \"../common/SelfAuthorized.sol\";\n\ninterface Guard {\n function checkTransaction(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation,\n uint256 safeTxGas,\n uint256 baseGas,\n uint256 gasPrice,\n address gasToken,\n address payable refundReceiver,\n bytes memory signatures,\n address msgSender\n ) external;\n\n function checkAfterExecution(bytes32 txHash, bool success) external;\n}\n\n/// @title Fallback Manager - A contract that manages fallback calls made to this contract\n/// @author Richard Meissner - \ncontract GuardManager is SelfAuthorized {\n event ChangedGuard(address guard);\n // keccak256(\"guard_manager.guard.address\")\n bytes32 internal constant GUARD_STORAGE_SLOT = 0x4a204f620c8c5ccdca3fd54d003badd85ba500436a431f0cbda4f558c93c34c8;\n\n /// @dev Set a guard that checks transactions before execution\n /// @param guard The address of the guard to be used or the 0 address to disable the guard\n function setGuard(address guard) external authorized {\n bytes32 slot = GUARD_STORAGE_SLOT;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n sstore(slot, guard)\n }\n emit ChangedGuard(guard);\n }\n\n function getGuard() internal view returns (address guard) {\n bytes32 slot = GUARD_STORAGE_SLOT;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n guard := sload(slot)\n }\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/base/ModuleManager.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\nimport \"../common/Enum.sol\";\nimport \"../common/SelfAuthorized.sol\";\nimport \"./Executor.sol\";\n\n/// @title Module Manager - A contract that manages modules that can execute transactions via this contract\n/// @author Stefan George - \n/// @author Richard Meissner - \ncontract ModuleManager is SelfAuthorized, Executor {\n event EnabledModule(address module);\n event DisabledModule(address module);\n event ExecutionFromModuleSuccess(address indexed module);\n event ExecutionFromModuleFailure(address indexed module);\n\n address internal constant SENTINEL_MODULES = address(0x1);\n\n mapping(address => address) internal modules;\n\n function setupModules(address to, bytes memory data) internal {\n require(modules[SENTINEL_MODULES] == address(0), \"GS100\");\n modules[SENTINEL_MODULES] = SENTINEL_MODULES;\n if (to != address(0))\n // Setup has to complete successfully or transaction fails.\n require(execute(to, 0, data, Enum.Operation.DelegateCall, gasleft()), \"GS000\");\n }\n\n /// @dev Allows to add a module to the whitelist.\n /// This can only be done via a Safe transaction.\n /// @notice Enables the module `module` for the Safe.\n /// @param module Module to be whitelisted.\n function enableModule(address module) public authorized {\n // Module address cannot be null or sentinel.\n require(module != address(0) && module != SENTINEL_MODULES, \"GS101\");\n // Module cannot be added twice.\n require(modules[module] == address(0), \"GS102\");\n modules[module] = modules[SENTINEL_MODULES];\n modules[SENTINEL_MODULES] = module;\n emit EnabledModule(module);\n }\n\n /// @dev Allows to remove a module from the whitelist.\n /// This can only be done via a Safe transaction.\n /// @notice Disables the module `module` for the Safe.\n /// @param prevModule Module that pointed to the module to be removed in the linked list\n /// @param module Module to be removed.\n function disableModule(address prevModule, address module) public authorized {\n // Validate module address and check that it corresponds to module index.\n require(module != address(0) && module != SENTINEL_MODULES, \"GS101\");\n require(modules[prevModule] == module, \"GS103\");\n modules[prevModule] = modules[module];\n modules[module] = address(0);\n emit DisabledModule(module);\n }\n\n /// @dev Allows a Module to execute a Safe transaction without any further confirmations.\n /// @param to Destination address of module transaction.\n /// @param value Ether value of module transaction.\n /// @param data Data payload of module transaction.\n /// @param operation Operation type of module transaction.\n function execTransactionFromModule(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation\n ) public virtual returns (bool success) {\n // Only whitelisted modules are allowed.\n require(msg.sender != SENTINEL_MODULES && modules[msg.sender] != address(0), \"GS104\");\n // Execute transaction without further confirmations.\n success = execute(to, value, data, operation, gasleft());\n if (success) emit ExecutionFromModuleSuccess(msg.sender);\n else emit ExecutionFromModuleFailure(msg.sender);\n }\n\n /// @dev Allows a Module to execute a Safe transaction without any further confirmations and return data\n /// @param to Destination address of module transaction.\n /// @param value Ether value of module transaction.\n /// @param data Data payload of module transaction.\n /// @param operation Operation type of module transaction.\n function execTransactionFromModuleReturnData(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation\n ) public returns (bool success, bytes memory returnData) {\n success = execTransactionFromModule(to, value, data, operation);\n // solhint-disable-next-line no-inline-assembly\n assembly {\n // Load free memory location\n let ptr := mload(0x40)\n // We allocate memory for the return data by setting the free memory location to\n // current free memory location + data size + 32 bytes for data size value\n mstore(0x40, add(ptr, add(returndatasize(), 0x20)))\n // Store the size\n mstore(ptr, returndatasize())\n // Store the data\n returndatacopy(add(ptr, 0x20), 0, returndatasize())\n // Point the return data to the correct memory location\n returnData := ptr\n }\n }\n\n /// @dev Returns if an module is enabled\n /// @return True if the module is enabled\n function isModuleEnabled(address module) public view returns (bool) {\n return SENTINEL_MODULES != module && modules[module] != address(0);\n }\n\n /// @dev Returns array of modules.\n /// @param start Start of the page.\n /// @param pageSize Maximum number of modules that should be returned.\n /// @return array Array of modules.\n /// @return next Start of the next page.\n function getModulesPaginated(address start, uint256 pageSize) external view returns (address[] memory array, address next) {\n // Init array with max page size\n array = new address[](pageSize);\n\n // Populate return array\n uint256 moduleCount = 0;\n address currentModule = modules[start];\n while (currentModule != address(0x0) && currentModule != SENTINEL_MODULES && moduleCount < pageSize) {\n array[moduleCount] = currentModule;\n currentModule = modules[currentModule];\n moduleCount++;\n }\n next = currentModule;\n // Set correct size of returned array\n // solhint-disable-next-line no-inline-assembly\n assembly {\n mstore(array, moduleCount)\n }\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/base/OwnerManager.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\nimport \"../common/SelfAuthorized.sol\";\n\n/// @title OwnerManager - Manages a set of owners and a threshold to perform actions.\n/// @author Stefan George - \n/// @author Richard Meissner - \ncontract OwnerManager is SelfAuthorized {\n event AddedOwner(address owner);\n event RemovedOwner(address owner);\n event ChangedThreshold(uint256 threshold);\n\n address internal constant SENTINEL_OWNERS = address(0x1);\n\n mapping(address => address) internal owners;\n uint256 internal ownerCount;\n uint256 internal threshold;\n\n /// @dev Setup function sets initial storage of contract.\n /// @param _owners List of Safe owners.\n /// @param _threshold Number of required confirmations for a Safe transaction.\n function setupOwners(address[] memory _owners, uint256 _threshold) internal {\n // Threshold can only be 0 at initialization.\n // Check ensures that setup function can only be called once.\n require(threshold == 0, \"GS200\");\n // Validate that threshold is smaller than number of added owners.\n require(_threshold <= _owners.length, \"GS201\");\n // There has to be at least one Safe owner.\n require(_threshold >= 1, \"GS202\");\n // Initializing Safe owners.\n address currentOwner = SENTINEL_OWNERS;\n for (uint256 i = 0; i < _owners.length; i++) {\n // Owner address cannot be null.\n address owner = _owners[i];\n require(owner != address(0) && owner != SENTINEL_OWNERS && owner != address(this) && currentOwner != owner, \"GS203\");\n // No duplicate owners allowed.\n require(owners[owner] == address(0), \"GS204\");\n owners[currentOwner] = owner;\n currentOwner = owner;\n }\n owners[currentOwner] = SENTINEL_OWNERS;\n ownerCount = _owners.length;\n threshold = _threshold;\n }\n\n /// @dev Allows to add a new owner to the Safe and update the threshold at the same time.\n /// This can only be done via a Safe transaction.\n /// @notice Adds the owner `owner` to the Safe and updates the threshold to `_threshold`.\n /// @param owner New owner address.\n /// @param _threshold New threshold.\n function addOwnerWithThreshold(address owner, uint256 _threshold) public authorized {\n // Owner address cannot be null, the sentinel or the Safe itself.\n require(owner != address(0) && owner != SENTINEL_OWNERS && owner != address(this), \"GS203\");\n // No duplicate owners allowed.\n require(owners[owner] == address(0), \"GS204\");\n owners[owner] = owners[SENTINEL_OWNERS];\n owners[SENTINEL_OWNERS] = owner;\n ownerCount++;\n emit AddedOwner(owner);\n // Change threshold if threshold was changed.\n if (threshold != _threshold) changeThreshold(_threshold);\n }\n\n /// @dev Allows to remove an owner from the Safe and update the threshold at the same time.\n /// This can only be done via a Safe transaction.\n /// @notice Removes the owner `owner` from the Safe and updates the threshold to `_threshold`.\n /// @param prevOwner Owner that pointed to the owner to be removed in the linked list\n /// @param owner Owner address to be removed.\n /// @param _threshold New threshold.\n function removeOwner(\n address prevOwner,\n address owner,\n uint256 _threshold\n ) public authorized {\n // Only allow to remove an owner, if threshold can still be reached.\n require(ownerCount - 1 >= _threshold, \"GS201\");\n // Validate owner address and check that it corresponds to owner index.\n require(owner != address(0) && owner != SENTINEL_OWNERS, \"GS203\");\n require(owners[prevOwner] == owner, \"GS205\");\n owners[prevOwner] = owners[owner];\n owners[owner] = address(0);\n ownerCount--;\n emit RemovedOwner(owner);\n // Change threshold if threshold was changed.\n if (threshold != _threshold) changeThreshold(_threshold);\n }\n\n /// @dev Allows to swap/replace an owner from the Safe with another address.\n /// This can only be done via a Safe transaction.\n /// @notice Replaces the owner `oldOwner` in the Safe with `newOwner`.\n /// @param prevOwner Owner that pointed to the owner to be replaced in the linked list\n /// @param oldOwner Owner address to be replaced.\n /// @param newOwner New owner address.\n function swapOwner(\n address prevOwner,\n address oldOwner,\n address newOwner\n ) public authorized {\n // Owner address cannot be null, the sentinel or the Safe itself.\n require(newOwner != address(0) && newOwner != SENTINEL_OWNERS && newOwner != address(this), \"GS203\");\n // No duplicate owners allowed.\n require(owners[newOwner] == address(0), \"GS204\");\n // Validate oldOwner address and check that it corresponds to owner index.\n require(oldOwner != address(0) && oldOwner != SENTINEL_OWNERS, \"GS203\");\n require(owners[prevOwner] == oldOwner, \"GS205\");\n owners[newOwner] = owners[oldOwner];\n owners[prevOwner] = newOwner;\n owners[oldOwner] = address(0);\n emit RemovedOwner(oldOwner);\n emit AddedOwner(newOwner);\n }\n\n /// @dev Allows to update the number of required confirmations by Safe owners.\n /// This can only be done via a Safe transaction.\n /// @notice Changes the threshold of the Safe to `_threshold`.\n /// @param _threshold New threshold.\n function changeThreshold(uint256 _threshold) public authorized {\n // Validate that threshold is smaller than number of owners.\n require(_threshold <= ownerCount, \"GS201\");\n // There has to be at least one Safe owner.\n require(_threshold >= 1, \"GS202\");\n threshold = _threshold;\n emit ChangedThreshold(threshold);\n }\n\n function getThreshold() public view returns (uint256) {\n return threshold;\n }\n\n function isOwner(address owner) public view returns (bool) {\n return owner != SENTINEL_OWNERS && owners[owner] != address(0);\n }\n\n /// @dev Returns array of owners.\n /// @return Array of Safe owners.\n function getOwners() public view returns (address[] memory) {\n address[] memory array = new address[](ownerCount);\n\n // populate return array\n uint256 index = 0;\n address currentOwner = owners[SENTINEL_OWNERS];\n while (currentOwner != SENTINEL_OWNERS) {\n array[index] = currentOwner;\n currentOwner = owners[currentOwner];\n index++;\n }\n return array;\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/common/Enum.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\n/// @title Enum - Collection of enums\n/// @author Richard Meissner - \ncontract Enum {\n enum Operation {Call, DelegateCall}\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/common/EtherPaymentFallback.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\n/// @title EtherPaymentFallback - A contract that has a fallback to accept ether payments\n/// @author Richard Meissner - \ncontract EtherPaymentFallback {\n event SafeReceived(address indexed sender, uint256 value);\n\n /// @dev Fallback function accepts Ether transactions.\n receive() external payable {\n emit SafeReceived(msg.sender, msg.value);\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/common/SecuredTokenTransfer.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\n/// @title SecuredTokenTransfer - Secure token transfer\n/// @author Richard Meissner - \ncontract SecuredTokenTransfer {\n /// @dev Transfers a token and returns if it was a success\n /// @param token Token that should be transferred\n /// @param receiver Receiver to whom the token should be transferred\n /// @param amount The amount of tokens that should be transferred\n function transferToken(\n address token,\n address receiver,\n uint256 amount\n ) internal returns (bool transferred) {\n // 0xa9059cbb - keccack(\"transfer(address,uint256)\")\n bytes memory data = abi.encodeWithSelector(0xa9059cbb, receiver, amount);\n // solhint-disable-next-line no-inline-assembly\n assembly {\n // We write the return value to scratch space.\n // See https://docs.soliditylang.org/en/v0.7.6/internals/layout_in_memory.html#layout-in-memory\n let success := call(sub(gas(), 10000), token, 0, add(data, 0x20), mload(data), 0, 0x20)\n switch returndatasize()\n case 0 {\n transferred := success\n }\n case 0x20 {\n transferred := iszero(or(iszero(success), iszero(mload(0))))\n }\n default {\n transferred := 0\n }\n }\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/common/SelfAuthorized.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\n/// @title SelfAuthorized - authorizes current contract to perform actions\n/// @author Richard Meissner - \ncontract SelfAuthorized {\n function requireSelfCall() private view {\n require(msg.sender == address(this), \"GS031\");\n }\n\n modifier authorized() {\n // This is a function call as it minimized the bytecode size\n requireSelfCall();\n _;\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/common/SignatureDecoder.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\n/// @title SignatureDecoder - Decodes signatures that a encoded as bytes\n/// @author Richard Meissner - \ncontract SignatureDecoder {\n /// @dev divides bytes signature into `uint8 v, bytes32 r, bytes32 s`.\n /// @notice Make sure to peform a bounds check for @param pos, to avoid out of bounds access on @param signatures\n /// @param pos which signature to read. A prior bounds check of this parameter should be performed, to avoid out of bounds access\n /// @param signatures concatenated rsv signatures\n function signatureSplit(bytes memory signatures, uint256 pos)\n internal\n pure\n returns (\n uint8 v,\n bytes32 r,\n bytes32 s\n )\n {\n // The signature format is a compact form of:\n // {bytes32 r}{bytes32 s}{uint8 v}\n // Compact means, uint8 is not padded to 32 bytes.\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let signaturePos := mul(0x41, pos)\n r := mload(add(signatures, add(signaturePos, 0x20)))\n s := mload(add(signatures, add(signaturePos, 0x40)))\n // Here we are loading the last 32 bytes, including 31 bytes\n // of 's'. There is no 'mload8' to do this.\n //\n // 'byte' is not working due to the Solidity parser, so lets\n // use the second best option, 'and'\n v := and(mload(add(signatures, add(signaturePos, 0x41))), 0xff)\n }\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/common/Singleton.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\n/// @title Singleton - Base for singleton contracts (should always be first super contract)\n/// This contract is tightly coupled to our proxy contract (see `proxies/GnosisSafeProxy.sol`)\n/// @author Richard Meissner - \ncontract Singleton {\n // singleton always needs to be first declared variable, to ensure that it is at the same location as in the Proxy contract.\n // It should also always be ensured that the address is stored alone (uses a full word)\n address private singleton;\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/common/StorageAccessible.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\n/// @title StorageAccessible - generic base contract that allows callers to access all internal storage.\n/// @notice See https://github.com/gnosis/util-contracts/blob/bb5fe5fb5df6d8400998094fb1b32a178a47c3a1/contracts/StorageAccessible.sol\ncontract StorageAccessible {\n /**\n * @dev Reads `length` bytes of storage in the currents contract\n * @param offset - the offset in the current contract's storage in words to start reading from\n * @param length - the number of words (32 bytes) of data to read\n * @return the bytes that were read.\n */\n function getStorageAt(uint256 offset, uint256 length) public view returns (bytes memory) {\n bytes memory result = new bytes(length * 32);\n for (uint256 index = 0; index < length; index++) {\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let word := sload(add(offset, index))\n mstore(add(add(result, 0x20), mul(index, 0x20)), word)\n }\n }\n return result;\n }\n\n /**\n * @dev Performs a delegetecall on a targetContract in the context of self.\n * Internally reverts execution to avoid side effects (making it static).\n *\n * This method reverts with data equal to `abi.encode(bool(success), bytes(response))`.\n * Specifically, the `returndata` after a call to this method will be:\n * `success:bool || response.length:uint256 || response:bytes`.\n *\n * @param targetContract Address of the contract containing the code to execute.\n * @param calldataPayload Calldata that should be sent to the target contract (encoded method name and arguments).\n */\n function simulateAndRevert(address targetContract, bytes memory calldataPayload) external {\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let success := delegatecall(gas(), targetContract, add(calldataPayload, 0x20), mload(calldataPayload), 0, 0)\n\n mstore(0x00, success)\n mstore(0x20, returndatasize())\n returndatacopy(0x40, 0, returndatasize())\n revert(0, add(returndatasize(), 0x40))\n }\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/external/GnosisSafeMath.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\n/**\n * @title GnosisSafeMath\n * @dev Math operations with safety checks that revert on error\n * Renamed from SafeMath to GnosisSafeMath to avoid conflicts\n * TODO: remove once open zeppelin update to solc 0.5.0\n */\nlibrary GnosisSafeMath {\n /**\n * @dev Multiplies two numbers, reverts on overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\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-solidity/pull/522\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n require(c / a == b);\n\n return c;\n }\n\n /**\n * @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b <= a);\n uint256 c = a - b;\n\n return c;\n }\n\n /**\n * @dev Adds two numbers, reverts on overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a);\n\n return c;\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" + }, + "@gnosis.pm/safe-contracts/contracts/GnosisSafe.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"./base/ModuleManager.sol\";\nimport \"./base/OwnerManager.sol\";\nimport \"./base/FallbackManager.sol\";\nimport \"./base/GuardManager.sol\";\nimport \"./common/EtherPaymentFallback.sol\";\nimport \"./common/Singleton.sol\";\nimport \"./common/SignatureDecoder.sol\";\nimport \"./common/SecuredTokenTransfer.sol\";\nimport \"./common/StorageAccessible.sol\";\nimport \"./interfaces/ISignatureValidator.sol\";\nimport \"./external/GnosisSafeMath.sol\";\n\n/// @title Gnosis Safe - A multisignature wallet with support for confirmations using signed messages based on ERC191.\n/// @author Stefan George - \n/// @author Richard Meissner - \ncontract GnosisSafe is\n EtherPaymentFallback,\n Singleton,\n ModuleManager,\n OwnerManager,\n SignatureDecoder,\n SecuredTokenTransfer,\n ISignatureValidatorConstants,\n FallbackManager,\n StorageAccessible,\n GuardManager\n{\n using GnosisSafeMath for uint256;\n\n string public constant VERSION = \"1.3.0\";\n\n // keccak256(\n // \"EIP712Domain(uint256 chainId,address verifyingContract)\"\n // );\n bytes32 private constant DOMAIN_SEPARATOR_TYPEHASH = 0x47e79534a245952e8b16893a336b85a3d9ea9fa8c573f3d803afb92a79469218;\n\n // keccak256(\n // \"SafeTx(address to,uint256 value,bytes data,uint8 operation,uint256 safeTxGas,uint256 baseGas,uint256 gasPrice,address gasToken,address refundReceiver,uint256 nonce)\"\n // );\n bytes32 private constant SAFE_TX_TYPEHASH = 0xbb8310d486368db6bd6f849402fdd73ad53d316b5a4b2644ad6efe0f941286d8;\n\n event SafeSetup(address indexed initiator, address[] owners, uint256 threshold, address initializer, address fallbackHandler);\n event ApproveHash(bytes32 indexed approvedHash, address indexed owner);\n event SignMsg(bytes32 indexed msgHash);\n event ExecutionFailure(bytes32 txHash, uint256 payment);\n event ExecutionSuccess(bytes32 txHash, uint256 payment);\n\n uint256 public nonce;\n bytes32 private _deprecatedDomainSeparator;\n // Mapping to keep track of all message hashes that have been approve by ALL REQUIRED owners\n mapping(bytes32 => uint256) public signedMessages;\n // Mapping to keep track of all hashes (message or transaction) that have been approve by ANY owners\n mapping(address => mapping(bytes32 => uint256)) public approvedHashes;\n\n // This constructor ensures that this contract can only be used as a master copy for Proxy contracts\n constructor() {\n // By setting the threshold it is not possible to call setup anymore,\n // so we create a Safe with 0 owners and threshold 1.\n // This is an unusable Safe, perfect for the singleton\n threshold = 1;\n }\n\n /// @dev Setup function sets initial storage of contract.\n /// @param _owners List of Safe owners.\n /// @param _threshold Number of required confirmations for a Safe transaction.\n /// @param to Contract address for optional delegate call.\n /// @param data Data payload for optional delegate call.\n /// @param fallbackHandler Handler for fallback calls to this contract\n /// @param paymentToken Token that should be used for the payment (0 is ETH)\n /// @param payment Value that should be paid\n /// @param paymentReceiver Adddress that should receive the payment (or 0 if tx.origin)\n function setup(\n address[] calldata _owners,\n uint256 _threshold,\n address to,\n bytes calldata data,\n address fallbackHandler,\n address paymentToken,\n uint256 payment,\n address payable paymentReceiver\n ) external {\n // setupOwners checks if the Threshold is already set, therefore preventing that this method is called twice\n setupOwners(_owners, _threshold);\n if (fallbackHandler != address(0)) internalSetFallbackHandler(fallbackHandler);\n // As setupOwners can only be called if the contract has not been initialized we don't need a check for setupModules\n setupModules(to, data);\n\n if (payment > 0) {\n // To avoid running into issues with EIP-170 we reuse the handlePayment function (to avoid adjusting code of that has been verified we do not adjust the method itself)\n // baseGas = 0, gasPrice = 1 and gas = payment => amount = (payment + 0) * 1 = payment\n handlePayment(payment, 0, 1, paymentToken, paymentReceiver);\n }\n emit SafeSetup(msg.sender, _owners, _threshold, to, fallbackHandler);\n }\n\n /// @dev Allows to execute a Safe transaction confirmed by required number of owners and then pays the account that submitted the transaction.\n /// Note: The fees are always transferred, even if the user transaction fails.\n /// @param to Destination address of Safe transaction.\n /// @param value Ether value of Safe transaction.\n /// @param data Data payload of Safe transaction.\n /// @param operation Operation type of Safe transaction.\n /// @param safeTxGas Gas that should be used for the Safe transaction.\n /// @param baseGas Gas costs that are independent of the transaction execution(e.g. base transaction fee, signature check, payment of the refund)\n /// @param gasPrice Gas price that should be used for the payment calculation.\n /// @param gasToken Token address (or 0 if ETH) that is used for the payment.\n /// @param refundReceiver Address of receiver of gas payment (or 0 if tx.origin).\n /// @param signatures Packed signature data ({bytes32 r}{bytes32 s}{uint8 v})\n function execTransaction(\n address to,\n uint256 value,\n bytes calldata data,\n Enum.Operation operation,\n uint256 safeTxGas,\n uint256 baseGas,\n uint256 gasPrice,\n address gasToken,\n address payable refundReceiver,\n bytes memory signatures\n ) public payable virtual returns (bool success) {\n bytes32 txHash;\n // Use scope here to limit variable lifetime and prevent `stack too deep` errors\n {\n bytes memory txHashData =\n encodeTransactionData(\n // Transaction info\n to,\n value,\n data,\n operation,\n safeTxGas,\n // Payment info\n baseGas,\n gasPrice,\n gasToken,\n refundReceiver,\n // Signature info\n nonce\n );\n // Increase nonce and execute transaction.\n nonce++;\n txHash = keccak256(txHashData);\n checkSignatures(txHash, txHashData, signatures);\n }\n address guard = getGuard();\n {\n if (guard != address(0)) {\n Guard(guard).checkTransaction(\n // Transaction info\n to,\n value,\n data,\n operation,\n safeTxGas,\n // Payment info\n baseGas,\n gasPrice,\n gasToken,\n refundReceiver,\n // Signature info\n signatures,\n msg.sender\n );\n }\n }\n // We require some gas to emit the events (at least 2500) after the execution and some to perform code until the execution (500)\n // We also include the 1/64 in the check that is not send along with a call to counteract potential shortings because of EIP-150\n require(gasleft() >= ((safeTxGas * 64) / 63).max(safeTxGas + 2500) + 500, \"GS010\");\n // Use scope here to limit variable lifetime and prevent `stack too deep` errors\n {\n uint256 gasUsed = gasleft();\n // If the gasPrice is 0 we assume that nearly all available gas can be used (it is always more than safeTxGas)\n // We only substract 2500 (compared to the 3000 before) to ensure that the amount passed is still higher than safeTxGas\n success = execute(to, value, data, operation, gasPrice == 0 ? (gasleft() - 2500) : safeTxGas);\n gasUsed = gasUsed.sub(gasleft());\n // If no safeTxGas and no gasPrice was set (e.g. both are 0), then the internal tx is required to be successful\n // This makes it possible to use `estimateGas` without issues, as it searches for the minimum gas where the tx doesn't revert\n require(success || safeTxGas != 0 || gasPrice != 0, \"GS013\");\n // We transfer the calculated tx costs to the tx.origin to avoid sending it to intermediate contracts that have made calls\n uint256 payment = 0;\n if (gasPrice > 0) {\n payment = handlePayment(gasUsed, baseGas, gasPrice, gasToken, refundReceiver);\n }\n if (success) emit ExecutionSuccess(txHash, payment);\n else emit ExecutionFailure(txHash, payment);\n }\n {\n if (guard != address(0)) {\n Guard(guard).checkAfterExecution(txHash, success);\n }\n }\n }\n\n function handlePayment(\n uint256 gasUsed,\n uint256 baseGas,\n uint256 gasPrice,\n address gasToken,\n address payable refundReceiver\n ) private returns (uint256 payment) {\n // solhint-disable-next-line avoid-tx-origin\n address payable receiver = refundReceiver == address(0) ? payable(tx.origin) : refundReceiver;\n if (gasToken == address(0)) {\n // For ETH we will only adjust the gas price to not be higher than the actual used gas price\n payment = gasUsed.add(baseGas).mul(gasPrice < tx.gasprice ? gasPrice : tx.gasprice);\n require(receiver.send(payment), \"GS011\");\n } else {\n payment = gasUsed.add(baseGas).mul(gasPrice);\n require(transferToken(gasToken, receiver, payment), \"GS012\");\n }\n }\n\n /**\n * @dev Checks whether the signature provided is valid for the provided data, hash. Will revert otherwise.\n * @param dataHash Hash of the data (could be either a message hash or transaction hash)\n * @param data That should be signed (this is passed to an external validator contract)\n * @param signatures Signature data that should be verified. Can be ECDSA signature, contract signature (EIP-1271) or approved hash.\n */\n function checkSignatures(\n bytes32 dataHash,\n bytes memory data,\n bytes memory signatures\n ) public view {\n // Load threshold to avoid multiple storage loads\n uint256 _threshold = threshold;\n // Check that a threshold is set\n require(_threshold > 0, \"GS001\");\n checkNSignatures(dataHash, data, signatures, _threshold);\n }\n\n /**\n * @dev Checks whether the signature provided is valid for the provided data, hash. Will revert otherwise.\n * @param dataHash Hash of the data (could be either a message hash or transaction hash)\n * @param data That should be signed (this is passed to an external validator contract)\n * @param signatures Signature data that should be verified. Can be ECDSA signature, contract signature (EIP-1271) or approved hash.\n * @param requiredSignatures Amount of required valid signatures.\n */\n function checkNSignatures(\n bytes32 dataHash,\n bytes memory data,\n bytes memory signatures,\n uint256 requiredSignatures\n ) public view {\n // Check that the provided signature data is not too short\n require(signatures.length >= requiredSignatures.mul(65), \"GS020\");\n // There cannot be an owner with address 0.\n address lastOwner = address(0);\n address currentOwner;\n uint8 v;\n bytes32 r;\n bytes32 s;\n uint256 i;\n for (i = 0; i < requiredSignatures; i++) {\n (v, r, s) = signatureSplit(signatures, i);\n if (v == 0) {\n // If v is 0 then it is a contract signature\n // When handling contract signatures the address of the contract is encoded into r\n currentOwner = address(uint160(uint256(r)));\n\n // Check that signature data pointer (s) is not pointing inside the static part of the signatures bytes\n // This check is not completely accurate, since it is possible that more signatures than the threshold are send.\n // Here we only check that the pointer is not pointing inside the part that is being processed\n require(uint256(s) >= requiredSignatures.mul(65), \"GS021\");\n\n // Check that signature data pointer (s) is in bounds (points to the length of data -> 32 bytes)\n require(uint256(s).add(32) <= signatures.length, \"GS022\");\n\n // Check if the contract signature is in bounds: start of data is s + 32 and end is start + signature length\n uint256 contractSignatureLen;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n contractSignatureLen := mload(add(add(signatures, s), 0x20))\n }\n require(uint256(s).add(32).add(contractSignatureLen) <= signatures.length, \"GS023\");\n\n // Check signature\n bytes memory contractSignature;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n // The signature data for contract signatures is appended to the concatenated signatures and the offset is stored in s\n contractSignature := add(add(signatures, s), 0x20)\n }\n require(ISignatureValidator(currentOwner).isValidSignature(data, contractSignature) == EIP1271_MAGIC_VALUE, \"GS024\");\n } else if (v == 1) {\n // If v is 1 then it is an approved hash\n // When handling approved hashes the address of the approver is encoded into r\n currentOwner = address(uint160(uint256(r)));\n // Hashes are automatically approved by the sender of the message or when they have been pre-approved via a separate transaction\n require(msg.sender == currentOwner || approvedHashes[currentOwner][dataHash] != 0, \"GS025\");\n } else if (v > 30) {\n // If v > 30 then default va (27,28) has been adjusted for eth_sign flow\n // To support eth_sign and similar we adjust v and hash the messageHash with the Ethereum message prefix before applying ecrecover\n currentOwner = ecrecover(keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", dataHash)), v - 4, r, s);\n } else {\n // Default is the ecrecover flow with the provided data hash\n // Use ecrecover with the messageHash for EOA signatures\n currentOwner = ecrecover(dataHash, v, r, s);\n }\n require(currentOwner > lastOwner && owners[currentOwner] != address(0) && currentOwner != SENTINEL_OWNERS, \"GS026\");\n lastOwner = currentOwner;\n }\n }\n\n /// @dev Allows to estimate a Safe transaction.\n /// This method is only meant for estimation purpose, therefore the call will always revert and encode the result in the revert data.\n /// Since the `estimateGas` function includes refunds, call this method to get an estimated of the costs that are deducted from the safe with `execTransaction`\n /// @param to Destination address of Safe transaction.\n /// @param value Ether value of Safe transaction.\n /// @param data Data payload of Safe transaction.\n /// @param operation Operation type of Safe transaction.\n /// @return Estimate without refunds and overhead fees (base transaction and payload data gas costs).\n /// @notice Deprecated in favor of common/StorageAccessible.sol and will be removed in next version.\n function requiredTxGas(\n address to,\n uint256 value,\n bytes calldata data,\n Enum.Operation operation\n ) external returns (uint256) {\n uint256 startGas = gasleft();\n // We don't provide an error message here, as we use it to return the estimate\n require(execute(to, value, data, operation, gasleft()));\n uint256 requiredGas = startGas - gasleft();\n // Convert response to string and return via error message\n revert(string(abi.encodePacked(requiredGas)));\n }\n\n /**\n * @dev Marks a hash as approved. This can be used to validate a hash that is used by a signature.\n * @param hashToApprove The hash that should be marked as approved for signatures that are verified by this contract.\n */\n function approveHash(bytes32 hashToApprove) external {\n require(owners[msg.sender] != address(0), \"GS030\");\n approvedHashes[msg.sender][hashToApprove] = 1;\n emit ApproveHash(hashToApprove, msg.sender);\n }\n\n /// @dev Returns the chain id used by this contract.\n function getChainId() public view returns (uint256) {\n uint256 id;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n id := chainid()\n }\n return id;\n }\n\n function domainSeparator() public view returns (bytes32) {\n return keccak256(abi.encode(DOMAIN_SEPARATOR_TYPEHASH, getChainId(), this));\n }\n\n /// @dev Returns the bytes that are hashed to be signed by owners.\n /// @param to Destination address.\n /// @param value Ether value.\n /// @param data Data payload.\n /// @param operation Operation type.\n /// @param safeTxGas Gas that should be used for the safe transaction.\n /// @param baseGas Gas costs for that are independent of the transaction execution(e.g. base transaction fee, signature check, payment of the refund)\n /// @param gasPrice Maximum gas price that should be used for this transaction.\n /// @param gasToken Token address (or 0 if ETH) that is used for the payment.\n /// @param refundReceiver Address of receiver of gas payment (or 0 if tx.origin).\n /// @param _nonce Transaction nonce.\n /// @return Transaction hash bytes.\n function encodeTransactionData(\n address to,\n uint256 value,\n bytes calldata data,\n Enum.Operation operation,\n uint256 safeTxGas,\n uint256 baseGas,\n uint256 gasPrice,\n address gasToken,\n address refundReceiver,\n uint256 _nonce\n ) public view returns (bytes memory) {\n bytes32 safeTxHash =\n keccak256(\n abi.encode(\n SAFE_TX_TYPEHASH,\n to,\n value,\n keccak256(data),\n operation,\n safeTxGas,\n baseGas,\n gasPrice,\n gasToken,\n refundReceiver,\n _nonce\n )\n );\n return abi.encodePacked(bytes1(0x19), bytes1(0x01), domainSeparator(), safeTxHash);\n }\n\n /// @dev Returns hash to be signed by owners.\n /// @param to Destination address.\n /// @param value Ether value.\n /// @param data Data payload.\n /// @param operation Operation type.\n /// @param safeTxGas Fas that should be used for the safe transaction.\n /// @param baseGas Gas costs for data used to trigger the safe transaction.\n /// @param gasPrice Maximum gas price that should be used for this transaction.\n /// @param gasToken Token address (or 0 if ETH) that is used for the payment.\n /// @param refundReceiver Address of receiver of gas payment (or 0 if tx.origin).\n /// @param _nonce Transaction nonce.\n /// @return Transaction hash.\n function getTransactionHash(\n address to,\n uint256 value,\n bytes calldata data,\n Enum.Operation operation,\n uint256 safeTxGas,\n uint256 baseGas,\n uint256 gasPrice,\n address gasToken,\n address refundReceiver,\n uint256 _nonce\n ) public view returns (bytes32) {\n return keccak256(encodeTransactionData(to, value, data, operation, safeTxGas, baseGas, gasPrice, gasToken, refundReceiver, _nonce));\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/GnosisSafeL2.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"./GnosisSafe.sol\";\n\n/// @title Gnosis Safe - A multisignature wallet with support for confirmations using signed messages based on ERC191.\n/// @author Stefan George - \n/// @author Richard Meissner - \ncontract GnosisSafeL2 is GnosisSafe {\n event SafeMultiSigTransaction(\n address to,\n uint256 value,\n bytes data,\n Enum.Operation operation,\n uint256 safeTxGas,\n uint256 baseGas,\n uint256 gasPrice,\n address gasToken,\n address payable refundReceiver,\n bytes signatures,\n // We combine nonce, sender and threshold into one to avoid stack too deep\n // Dev note: additionalInfo should not contain `bytes`, as this complicates decoding\n bytes additionalInfo\n );\n\n event SafeModuleTransaction(address module, address to, uint256 value, bytes data, Enum.Operation operation);\n\n /// @dev Allows to execute a Safe transaction confirmed by required number of owners and then pays the account that submitted the transaction.\n /// Note: The fees are always transferred, even if the user transaction fails.\n /// @param to Destination address of Safe transaction.\n /// @param value Ether value of Safe transaction.\n /// @param data Data payload of Safe transaction.\n /// @param operation Operation type of Safe transaction.\n /// @param safeTxGas Gas that should be used for the Safe transaction.\n /// @param baseGas Gas costs that are independent of the transaction execution(e.g. base transaction fee, signature check, payment of the refund)\n /// @param gasPrice Gas price that should be used for the payment calculation.\n /// @param gasToken Token address (or 0 if ETH) that is used for the payment.\n /// @param refundReceiver Address of receiver of gas payment (or 0 if tx.origin).\n /// @param signatures Packed signature data ({bytes32 r}{bytes32 s}{uint8 v})\n function execTransaction(\n address to,\n uint256 value,\n bytes calldata data,\n Enum.Operation operation,\n uint256 safeTxGas,\n uint256 baseGas,\n uint256 gasPrice,\n address gasToken,\n address payable refundReceiver,\n bytes memory signatures\n ) public payable override returns (bool) {\n bytes memory additionalInfo;\n {\n additionalInfo = abi.encode(nonce, msg.sender, threshold);\n }\n emit SafeMultiSigTransaction(\n to,\n value,\n data,\n operation,\n safeTxGas,\n baseGas,\n gasPrice,\n gasToken,\n refundReceiver,\n signatures,\n additionalInfo\n );\n return super.execTransaction(to, value, data, operation, safeTxGas, baseGas, gasPrice, gasToken, refundReceiver, signatures);\n }\n\n /// @dev Allows a Module to execute a Safe transaction without any further confirmations.\n /// @param to Destination address of module transaction.\n /// @param value Ether value of module transaction.\n /// @param data Data payload of module transaction.\n /// @param operation Operation type of module transaction.\n function execTransactionFromModule(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation\n ) public override returns (bool success) {\n emit SafeModuleTransaction(msg.sender, to, value, data, operation);\n success = super.execTransactionFromModule(to, value, data, operation);\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/interfaces/ISignatureValidator.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\ncontract ISignatureValidatorConstants {\n // bytes4(keccak256(\"isValidSignature(bytes,bytes)\")\n bytes4 internal constant EIP1271_MAGIC_VALUE = 0x20c13b0b;\n}\n\nabstract contract ISignatureValidator is ISignatureValidatorConstants {\n /**\n * @dev Should return whether the signature provided is valid for the provided data\n * @param _data Arbitrary length data signed on the behalf of address(this)\n * @param _signature Signature byte array associated with _data\n *\n * MUST return the bytes4 magic value 0x20c13b0b when function passes.\n * MUST NOT modify state (using STATICCALL for solc < 0.5, view modifier for solc > 0.5)\n * MUST allow external calls\n */\n function isValidSignature(bytes memory _data, bytes memory _signature) public view virtual returns (bytes4);\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/libraries/MultiSendCallOnly.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\n/// @title Multi Send Call Only - Allows to batch multiple transactions into one, but only calls\n/// @author Stefan George - \n/// @author Richard Meissner - \n/// @notice The guard logic is not required here as this contract doesn't support nested delegate calls\ncontract MultiSendCallOnly {\n /// @dev Sends multiple transactions and reverts all if one fails.\n /// @param transactions Encoded transactions. Each transaction is encoded as a packed bytes of\n /// operation has to be uint8(0) in this version (=> 1 byte),\n /// to as a address (=> 20 bytes),\n /// value as a uint256 (=> 32 bytes),\n /// data length as a uint256 (=> 32 bytes),\n /// data as bytes.\n /// see abi.encodePacked for more information on packed encoding\n /// @notice The code is for most part the same as the normal MultiSend (to keep compatibility),\n /// but reverts if a transaction tries to use a delegatecall.\n /// @notice This method is payable as delegatecalls keep the msg.value from the previous call\n /// If the calling method (e.g. execTransaction) received ETH this would revert otherwise\n function multiSend(bytes memory transactions) public payable {\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let length := mload(transactions)\n let i := 0x20\n for {\n // Pre block is not used in \"while mode\"\n } lt(i, length) {\n // Post block is not used in \"while mode\"\n } {\n // First byte of the data is the operation.\n // We shift by 248 bits (256 - 8 [operation byte]) it right since mload will always load 32 bytes (a word).\n // This will also zero out unused data.\n let operation := shr(0xf8, mload(add(transactions, i)))\n // We offset the load address by 1 byte (operation byte)\n // We shift it right by 96 bits (256 - 160 [20 address bytes]) to right-align the data and zero out unused data.\n let to := shr(0x60, mload(add(transactions, add(i, 0x01))))\n // We offset the load address by 21 byte (operation byte + 20 address bytes)\n let value := mload(add(transactions, add(i, 0x15)))\n // We offset the load address by 53 byte (operation byte + 20 address bytes + 32 value bytes)\n let dataLength := mload(add(transactions, add(i, 0x35)))\n // We offset the load address by 85 byte (operation byte + 20 address bytes + 32 value bytes + 32 data length bytes)\n let data := add(transactions, add(i, 0x55))\n let success := 0\n switch operation\n case 0 {\n success := call(gas(), to, value, data, dataLength, 0, 0)\n }\n // This version does not allow delegatecalls\n case 1 {\n revert(0, 0)\n }\n if eq(success, 0) {\n revert(0, 0)\n }\n // Next entry starts at 85 byte + data length\n i := add(i, add(0x55, dataLength))\n }\n }\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/proxies/GnosisSafeProxy.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\n/// @title IProxy - Helper interface to access masterCopy of the Proxy on-chain\n/// @author Richard Meissner - \ninterface IProxy {\n function masterCopy() external view returns (address);\n}\n\n/// @title GnosisSafeProxy - Generic proxy contract allows to execute all transactions applying the code of a master contract.\n/// @author Stefan George - \n/// @author Richard Meissner - \ncontract GnosisSafeProxy {\n // 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.\n // To reduce deployment costs this variable is internal and needs to be retrieved via `getStorageAt`\n address internal singleton;\n\n /// @dev Constructor function sets address of singleton contract.\n /// @param _singleton Singleton address.\n constructor(address _singleton) {\n require(_singleton != address(0), \"Invalid singleton address provided\");\n singleton = _singleton;\n }\n\n /// @dev Fallback function forwards all transactions and returns all received return data.\n fallback() external payable {\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let _singleton := and(sload(0), 0xffffffffffffffffffffffffffffffffffffffff)\n // 0xa619486e == keccak(\"masterCopy()\"). The value is right padded to 32-bytes with 0s\n if eq(calldataload(0), 0xa619486e00000000000000000000000000000000000000000000000000000000) {\n mstore(0, _singleton)\n return(0, 0x20)\n }\n calldatacopy(0, 0, calldatasize())\n let success := delegatecall(gas(), _singleton, 0, calldatasize(), 0, 0)\n returndatacopy(0, 0, returndatasize())\n if eq(success, 0) {\n revert(0, returndatasize())\n }\n return(0, returndatasize())\n }\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/proxies/GnosisSafeProxyFactory.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"./GnosisSafeProxy.sol\";\nimport \"./IProxyCreationCallback.sol\";\n\n/// @title Proxy Factory - Allows to create new proxy contact and execute a message call to the new proxy within one transaction.\n/// @author Stefan George - \ncontract GnosisSafeProxyFactory {\n event ProxyCreation(GnosisSafeProxy proxy, address singleton);\n\n /// @dev Allows to create new proxy contact and execute a message call to the new proxy within one transaction.\n /// @param singleton Address of singleton contract.\n /// @param data Payload for message call sent to new proxy contract.\n function createProxy(address singleton, bytes memory data) public returns (GnosisSafeProxy proxy) {\n proxy = new GnosisSafeProxy(singleton);\n if (data.length > 0)\n // solhint-disable-next-line no-inline-assembly\n assembly {\n if eq(call(gas(), proxy, 0, add(data, 0x20), mload(data), 0, 0), 0) {\n revert(0, 0)\n }\n }\n emit ProxyCreation(proxy, singleton);\n }\n\n /// @dev Allows to retrieve the runtime code of a deployed Proxy. This can be used to check that the expected Proxy was deployed.\n function proxyRuntimeCode() public pure returns (bytes memory) {\n return type(GnosisSafeProxy).runtimeCode;\n }\n\n /// @dev Allows to retrieve the creation code used for the Proxy deployment. With this it is easily possible to calculate predicted address.\n function proxyCreationCode() public pure returns (bytes memory) {\n return type(GnosisSafeProxy).creationCode;\n }\n\n /// @dev Allows to create new proxy contact using CREATE2 but it doesn't run the initializer.\n /// This method is only meant as an utility to be called from other methods\n /// @param _singleton Address of singleton contract.\n /// @param initializer Payload for message call sent to new proxy contract.\n /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract.\n function deployProxyWithNonce(\n address _singleton,\n bytes memory initializer,\n uint256 saltNonce\n ) internal returns (GnosisSafeProxy proxy) {\n // If the initializer changes the proxy address should change too. Hashing the initializer data is cheaper than just concatinating it\n bytes32 salt = keccak256(abi.encodePacked(keccak256(initializer), saltNonce));\n bytes memory deploymentData = abi.encodePacked(type(GnosisSafeProxy).creationCode, uint256(uint160(_singleton)));\n // solhint-disable-next-line no-inline-assembly\n assembly {\n proxy := create2(0x0, add(0x20, deploymentData), mload(deploymentData), salt)\n }\n require(address(proxy) != address(0), \"Create2 call failed\");\n }\n\n /// @dev Allows to create new proxy contact and execute a message call to the new proxy within one transaction.\n /// @param _singleton Address of singleton contract.\n /// @param initializer Payload for message call sent to new proxy contract.\n /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract.\n function createProxyWithNonce(\n address _singleton,\n bytes memory initializer,\n uint256 saltNonce\n ) public returns (GnosisSafeProxy proxy) {\n proxy = deployProxyWithNonce(_singleton, initializer, saltNonce);\n if (initializer.length > 0)\n // solhint-disable-next-line no-inline-assembly\n assembly {\n if eq(call(gas(), proxy, 0, add(initializer, 0x20), mload(initializer), 0, 0), 0) {\n revert(0, 0)\n }\n }\n emit ProxyCreation(proxy, _singleton);\n }\n\n /// @dev Allows to create new proxy contact, execute a message call to the new proxy and call a specified callback within one transaction\n /// @param _singleton Address of singleton contract.\n /// @param initializer Payload for message call sent to new proxy contract.\n /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract.\n /// @param callback Callback that will be invoced after the new proxy contract has been successfully deployed and initialized.\n function createProxyWithCallback(\n address _singleton,\n bytes memory initializer,\n uint256 saltNonce,\n IProxyCreationCallback callback\n ) public returns (GnosisSafeProxy proxy) {\n uint256 saltNonceWithCallback = uint256(keccak256(abi.encodePacked(saltNonce, callback)));\n proxy = createProxyWithNonce(_singleton, initializer, saltNonceWithCallback);\n if (address(callback) != address(0)) callback.proxyCreated(proxy, _singleton, initializer, saltNonce);\n }\n\n /// @dev Allows to get the address for a new proxy contact created via `createProxyWithNonce`\n /// This method is only meant for address calculation purpose when you use an initializer that would revert,\n /// therefore the response is returned with a revert. When calling this method set `from` to the address of the proxy factory.\n /// @param _singleton Address of singleton contract.\n /// @param initializer Payload for message call sent to new proxy contract.\n /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract.\n function calculateCreateProxyWithNonceAddress(\n address _singleton,\n bytes calldata initializer,\n uint256 saltNonce\n ) external returns (GnosisSafeProxy proxy) {\n proxy = deployProxyWithNonce(_singleton, initializer, saltNonce);\n revert(string(abi.encodePacked(proxy)));\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/proxies/IProxyCreationCallback.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\nimport \"./GnosisSafeProxy.sol\";\n\ninterface IProxyCreationCallback {\n function proxyCreated(\n GnosisSafeProxy proxy,\n address _singleton,\n bytes calldata initializer,\n uint256 saltNonce\n ) external;\n}\n" + }, + "@gnosis.pm/zodiac/contracts/core/Module.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\n\n/// @title Module Interface - A contract that can pass messages to a Module Manager contract if enabled by that contract.\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"../interfaces/IAvatar.sol\";\nimport \"../factory/FactoryFriendly.sol\";\nimport \"../guard/Guardable.sol\";\n\nabstract contract Module is FactoryFriendly, Guardable {\n /// @dev Address that will ultimately execute function calls.\n address public avatar;\n /// @dev Address that this module will pass transactions to.\n address public target;\n\n /// @dev Emitted each time the avatar is set.\n event AvatarSet(address indexed previousAvatar, address indexed newAvatar);\n /// @dev Emitted each time the Target is set.\n event TargetSet(address indexed previousTarget, address indexed newTarget);\n\n /// @dev Sets the avatar to a new avatar (`newAvatar`).\n /// @notice Can only be called by the current owner.\n function setAvatar(address _avatar) public onlyOwner {\n address previousAvatar = avatar;\n avatar = _avatar;\n emit AvatarSet(previousAvatar, _avatar);\n }\n\n /// @dev Sets the target to a new target (`newTarget`).\n /// @notice Can only be called by the current owner.\n function setTarget(address _target) public onlyOwner {\n address previousTarget = target;\n target = _target;\n emit TargetSet(previousTarget, _target);\n }\n\n /// @dev Passes a transaction to be executed by the avatar.\n /// @notice Can only be called by this contract.\n /// @param to Destination address of module transaction.\n /// @param value Ether value of module transaction.\n /// @param data Data payload of module transaction.\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\n function exec(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation\n ) internal returns (bool success) {\n /// Check if a transactioon guard is enabled.\n if (guard != address(0)) {\n IGuard(guard).checkTransaction(\n /// Transaction info used by module transactions.\n to,\n value,\n data,\n operation,\n /// Zero out the redundant transaction information only used for Safe multisig transctions.\n 0,\n 0,\n 0,\n address(0),\n payable(0),\n bytes(\"0x\"),\n msg.sender\n );\n }\n success = IAvatar(target).execTransactionFromModule(\n to,\n value,\n data,\n operation\n );\n if (guard != address(0)) {\n IGuard(guard).checkAfterExecution(bytes32(\"0x\"), success);\n }\n return success;\n }\n\n /// @dev Passes a transaction to be executed by the target and returns data.\n /// @notice Can only be called by this contract.\n /// @param to Destination address of module transaction.\n /// @param value Ether value of module transaction.\n /// @param data Data payload of module transaction.\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\n function execAndReturnData(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation\n ) internal returns (bool success, bytes memory returnData) {\n /// Check if a transactioon guard is enabled.\n if (guard != address(0)) {\n IGuard(guard).checkTransaction(\n /// Transaction info used by module transactions.\n to,\n value,\n data,\n operation,\n /// Zero out the redundant transaction information only used for Safe multisig transctions.\n 0,\n 0,\n 0,\n address(0),\n payable(0),\n bytes(\"0x\"),\n msg.sender\n );\n }\n (success, returnData) = IAvatar(target)\n .execTransactionFromModuleReturnData(to, value, data, operation);\n if (guard != address(0)) {\n IGuard(guard).checkAfterExecution(bytes32(\"0x\"), success);\n }\n return (success, returnData);\n }\n}\n" + }, + "@gnosis.pm/zodiac/contracts/factory/FactoryFriendly.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\n\n/// @title Zodiac FactoryFriendly - A contract that allows other contracts to be initializable and pass bytes as arguments to define contract state\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\n\nabstract contract FactoryFriendly is OwnableUpgradeable {\n function setUp(bytes memory initializeParams) public virtual;\n}\n" + }, + "@gnosis.pm/zodiac/contracts/factory/ModuleProxyFactory.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.8.0;\n\ncontract ModuleProxyFactory {\n event ModuleProxyCreation(\n address indexed proxy,\n address indexed masterCopy\n );\n\n /// `target` can not be zero.\n error ZeroAddress(address target);\n\n /// `address_` is already taken.\n error TakenAddress(address address_);\n\n /// @notice Initialization failed.\n error FailedInitialization();\n\n function createProxy(address target, bytes32 salt)\n internal\n returns (address result)\n {\n if (address(target) == address(0)) revert ZeroAddress(target);\n bytes memory deployment = abi.encodePacked(\n hex\"602d8060093d393df3363d3d373d3d3d363d73\",\n target,\n hex\"5af43d82803e903d91602b57fd5bf3\"\n );\n // solhint-disable-next-line no-inline-assembly\n assembly {\n result := create2(0, add(deployment, 0x20), mload(deployment), salt)\n }\n if (result == address(0)) revert TakenAddress(result);\n }\n\n function deployModule(\n address masterCopy,\n bytes memory initializer,\n uint256 saltNonce\n ) public returns (address proxy) {\n proxy = createProxy(\n masterCopy,\n keccak256(abi.encodePacked(keccak256(initializer), saltNonce))\n );\n (bool success, ) = proxy.call(initializer);\n if (!success) revert FailedInitialization();\n\n emit ModuleProxyCreation(proxy, masterCopy);\n }\n}\n" + }, + "@gnosis.pm/zodiac/contracts/guard/BaseGuard.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"../interfaces/IGuard.sol\";\n\nabstract contract BaseGuard is IERC165 {\n function supportsInterface(bytes4 interfaceId)\n external\n pure\n override\n returns (bool)\n {\n return\n interfaceId == type(IGuard).interfaceId || // 0xe6d7a83a\n interfaceId == type(IERC165).interfaceId; // 0x01ffc9a7\n }\n\n /// @dev Module transactions only use the first four parameters: to, value, data, and operation.\n /// Module.sol hardcodes the remaining parameters as 0 since they are not used for module transactions.\n /// @notice This interface is used to maintain compatibilty with Gnosis Safe transaction guards.\n function checkTransaction(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation,\n uint256 safeTxGas,\n uint256 baseGas,\n uint256 gasPrice,\n address gasToken,\n address payable refundReceiver,\n bytes memory signatures,\n address msgSender\n ) external virtual;\n\n function checkAfterExecution(bytes32 txHash, bool success) external virtual;\n}\n" + }, + "@gnosis.pm/zodiac/contracts/guard/Guardable.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\";\nimport \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport \"./BaseGuard.sol\";\n\n/// @title Guardable - A contract that manages fallback calls made to this contract\ncontract Guardable is OwnableUpgradeable {\n address public guard;\n\n event ChangedGuard(address guard);\n\n /// `guard_` does not implement IERC165.\n error NotIERC165Compliant(address guard_);\n\n /// @dev Set a guard that checks transactions before execution.\n /// @param _guard The address of the guard to be used or the 0 address to disable the guard.\n function setGuard(address _guard) external onlyOwner {\n if (_guard != address(0)) {\n if (!BaseGuard(_guard).supportsInterface(type(IGuard).interfaceId))\n revert NotIERC165Compliant(_guard);\n }\n guard = _guard;\n emit ChangedGuard(guard);\n }\n\n function getGuard() external view returns (address _guard) {\n return guard;\n }\n}\n" + }, + "@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\n\n/// @title Zodiac Avatar - A contract that manages modules that can execute transactions via this contract.\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\";\n\ninterface IAvatar {\n event EnabledModule(address module);\n event DisabledModule(address module);\n event ExecutionFromModuleSuccess(address indexed module);\n event ExecutionFromModuleFailure(address indexed module);\n\n /// @dev Enables a module on the avatar.\n /// @notice Can only be called by the avatar.\n /// @notice Modules should be stored as a linked list.\n /// @notice Must emit EnabledModule(address module) if successful.\n /// @param module Module to be enabled.\n function enableModule(address module) external;\n\n /// @dev Disables a module on the avatar.\n /// @notice Can only be called by the avatar.\n /// @notice Must emit DisabledModule(address module) if successful.\n /// @param prevModule Address that pointed to the module to be removed in the linked list\n /// @param module Module to be removed.\n function disableModule(address prevModule, address module) external;\n\n /// @dev Allows a Module to execute a transaction.\n /// @notice Can only be called by an enabled module.\n /// @notice Must emit ExecutionFromModuleSuccess(address module) if successful.\n /// @notice Must emit ExecutionFromModuleFailure(address module) if unsuccessful.\n /// @param to Destination address of module transaction.\n /// @param value Ether value of module transaction.\n /// @param data Data payload of module transaction.\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\n function execTransactionFromModule(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation\n ) external returns (bool success);\n\n /// @dev Allows a Module to execute a transaction and return data\n /// @notice Can only be called by an enabled module.\n /// @notice Must emit ExecutionFromModuleSuccess(address module) if successful.\n /// @notice Must emit ExecutionFromModuleFailure(address module) if unsuccessful.\n /// @param to Destination address of module transaction.\n /// @param value Ether value of module transaction.\n /// @param data Data payload of module transaction.\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\n function execTransactionFromModuleReturnData(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation\n ) external returns (bool success, bytes memory returnData);\n\n /// @dev Returns if an module is enabled\n /// @return True if the module is enabled\n function isModuleEnabled(address module) external view returns (bool);\n\n /// @dev Returns array of modules.\n /// @param start Start of the page.\n /// @param pageSize Maximum number of modules that should be returned.\n /// @return array Array of modules.\n /// @return next Start of the next page.\n function getModulesPaginated(address start, uint256 pageSize)\n external\n view\n returns (address[] memory array, address next);\n}\n" + }, + "@gnosis.pm/zodiac/contracts/interfaces/IGuard.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\";\n\ninterface IGuard {\n function checkTransaction(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation,\n uint256 safeTxGas,\n uint256 baseGas,\n uint256 gasPrice,\n address gasToken,\n address payable refundReceiver,\n bytes memory signatures,\n address msgSender\n ) external;\n\n function checkAfterExecution(bytes32 txHash, bool success) external;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../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 * 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 OwnableUpgradeable is Initializable, ContextUpgradeable {\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 function __Ownable_init() internal onlyInitializing {\n __Ownable_init_unchained();\n }\n\n function __Ownable_init_unchained() internal onlyInitializing {\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 anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing 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 /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/governance/utils/IVotesUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (governance/utils/IVotes.sol)\npragma solidity ^0.8.0;\n\n/**\n * @dev Common interface for {ERC20Votes}, {ERC721Votes}, and other {Votes}-enabled contracts.\n *\n * _Available since v4.5._\n */\ninterface IVotesUpgradeable {\n /**\n * @dev Emitted when an account changes their delegate.\n */\n event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);\n\n /**\n * @dev Emitted when a token transfer or delegate change results in changes to a delegate's number of votes.\n */\n event DelegateVotesChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance);\n\n /**\n * @dev Returns the current amount of votes that `account` has.\n */\n function getVotes(address account) external view returns (uint256);\n\n /**\n * @dev Returns the amount of votes that `account` had at the end of a past block (`blockNumber`).\n */\n function getPastVotes(address account, uint256 blockNumber) external view returns (uint256);\n\n /**\n * @dev Returns the total supply of votes available at the end of a past block (`blockNumber`).\n *\n * NOTE: This value is the sum of all available votes, which is not necessarily the sum of all delegated votes.\n * Votes that have not been delegated are still part of total supply, even though they would not participate in a\n * vote.\n */\n function getPastTotalSupply(uint256 blockNumber) external view returns (uint256);\n\n /**\n * @dev Returns the delegate that `account` has chosen.\n */\n function delegates(address account) external view returns (address);\n\n /**\n * @dev Delegates votes from the sender to `delegatee`.\n */\n function delegate(address delegatee) external;\n\n /**\n * @dev Delegates votes from signer to `delegatee`.\n */\n function delegateBySig(\n address delegatee,\n uint256 nonce,\n uint256 expiry,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\n * initialization step. This is essential to configure modules that are added through upgrades and that require\n * initialization.\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 modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized < type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20Upgradeable.sol\";\nimport \"./extensions/IERC20MetadataUpgradeable.sol\";\nimport \"../../utils/ContextUpgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20Upgradeable, IERC20MetadataUpgradeable {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n function __ERC20_init(string memory name_, string memory symbol_) internal onlyInitializing {\n __ERC20_init_unchained(name_, symbol_);\n }\n\n function __ERC20_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n }\n _balances[to] += amount;\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n _balances[account] += amount;\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n }\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[45] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-ERC20PermitUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/extensions/draft-ERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./draft-IERC20PermitUpgradeable.sol\";\nimport \"../ERC20Upgradeable.sol\";\nimport \"../../../utils/cryptography/draft-EIP712Upgradeable.sol\";\nimport \"../../../utils/cryptography/ECDSAUpgradeable.sol\";\nimport \"../../../utils/CountersUpgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation 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 * _Available since v3.4._\n *\n * @custom:storage-size 51\n */\nabstract contract ERC20PermitUpgradeable is Initializable, ERC20Upgradeable, IERC20PermitUpgradeable, EIP712Upgradeable {\n using CountersUpgradeable for CountersUpgradeable.Counter;\n\n mapping(address => CountersUpgradeable.Counter) private _nonces;\n\n // solhint-disable-next-line var-name-mixedcase\n bytes32 private constant _PERMIT_TYPEHASH =\n keccak256(\"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\");\n /**\n * @dev In previous versions `_PERMIT_TYPEHASH` was declared as `immutable`.\n * However, to ensure consistency with the upgradeable transpiler, we will continue\n * to reserve a slot.\n * @custom:oz-renamed-from _PERMIT_TYPEHASH\n */\n // solhint-disable-next-line var-name-mixedcase\n bytes32 private _PERMIT_TYPEHASH_DEPRECATED_SLOT;\n\n /**\n * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `\"1\"`.\n *\n * It's a good idea to use the same `name` that is defined as the ERC20 token name.\n */\n function __ERC20Permit_init(string memory name) internal onlyInitializing {\n __EIP712_init_unchained(name, \"1\");\n }\n\n function __ERC20Permit_init_unchained(string memory) internal onlyInitializing {}\n\n /**\n * @dev See {IERC20Permit-permit}.\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 ) public virtual override {\n require(block.timestamp <= deadline, \"ERC20Permit: expired deadline\");\n\n bytes32 structHash = keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline));\n\n bytes32 hash = _hashTypedDataV4(structHash);\n\n address signer = ECDSAUpgradeable.recover(hash, v, r, s);\n require(signer == owner, \"ERC20Permit: invalid signature\");\n\n _approve(owner, spender, value);\n }\n\n /**\n * @dev See {IERC20Permit-nonces}.\n */\n function nonces(address owner) public view virtual override returns (uint256) {\n return _nonces[owner].current();\n }\n\n /**\n * @dev See {IERC20Permit-DOMAIN_SEPARATOR}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view override returns (bytes32) {\n return _domainSeparatorV4();\n }\n\n /**\n * @dev \"Consume a nonce\": return the current value and increment.\n *\n * _Available since v4.1._\n */\n function _useNonce(address owner) internal virtual returns (uint256 current) {\n CountersUpgradeable.Counter storage nonce = _nonces[owner];\n current = nonce.current();\n nonce.increment();\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\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 */\ninterface IERC20PermitUpgradeable {\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 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-upgradeable/token/ERC20/extensions/ERC20SnapshotUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/extensions/ERC20Snapshot.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC20Upgradeable.sol\";\nimport \"../../../utils/ArraysUpgradeable.sol\";\nimport \"../../../utils/CountersUpgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev This contract extends an ERC20 token with a snapshot mechanism. When a snapshot is created, the balances and\n * total supply at the time are recorded for later access.\n *\n * This can be used to safely create mechanisms based on token balances such as trustless dividends or weighted voting.\n * In naive implementations it's possible to perform a \"double spend\" attack by reusing the same balance from different\n * accounts. By using snapshots to calculate dividends or voting power, those attacks no longer apply. It can also be\n * used to create an efficient ERC20 forking mechanism.\n *\n * Snapshots are created by the internal {_snapshot} function, which will emit the {Snapshot} event and return a\n * snapshot id. To get the total supply at the time of a snapshot, call the function {totalSupplyAt} with the snapshot\n * id. To get the balance of an account at the time of a snapshot, call the {balanceOfAt} function with the snapshot id\n * and the account address.\n *\n * NOTE: Snapshot policy can be customized by overriding the {_getCurrentSnapshotId} method. For example, having it\n * return `block.number` will trigger the creation of snapshot at the beginning of each new block. When overriding this\n * function, be careful about the monotonicity of its result. Non-monotonic snapshot ids will break the contract.\n *\n * Implementing snapshots for every block using this method will incur significant gas costs. For a gas-efficient\n * alternative consider {ERC20Votes}.\n *\n * ==== Gas Costs\n *\n * Snapshots are efficient. Snapshot creation is _O(1)_. Retrieval of balances or total supply from a snapshot is _O(log\n * n)_ in the number of snapshots that have been created, although _n_ for a specific account will generally be much\n * smaller since identical balances in subsequent snapshots are stored as a single entry.\n *\n * There is a constant overhead for normal ERC20 transfers due to the additional snapshot bookkeeping. This overhead is\n * only significant for the first transfer that immediately follows a snapshot for a particular account. Subsequent\n * transfers will have normal cost until the next snapshot, and so on.\n */\n\nabstract contract ERC20SnapshotUpgradeable is Initializable, ERC20Upgradeable {\n function __ERC20Snapshot_init() internal onlyInitializing {\n }\n\n function __ERC20Snapshot_init_unchained() internal onlyInitializing {\n }\n // Inspired by Jordi Baylina's MiniMeToken to record historical balances:\n // https://github.com/Giveth/minime/blob/ea04d950eea153a04c51fa510b068b9dded390cb/contracts/MiniMeToken.sol\n\n using ArraysUpgradeable for uint256[];\n using CountersUpgradeable for CountersUpgradeable.Counter;\n\n // Snapshotted values have arrays of ids and the value corresponding to that id. These could be an array of a\n // Snapshot struct, but that would impede usage of functions that work on an array.\n struct Snapshots {\n uint256[] ids;\n uint256[] values;\n }\n\n mapping(address => Snapshots) private _accountBalanceSnapshots;\n Snapshots private _totalSupplySnapshots;\n\n // Snapshot ids increase monotonically, with the first value being 1. An id of 0 is invalid.\n CountersUpgradeable.Counter private _currentSnapshotId;\n\n /**\n * @dev Emitted by {_snapshot} when a snapshot identified by `id` is created.\n */\n event Snapshot(uint256 id);\n\n /**\n * @dev Creates a new snapshot and returns its snapshot id.\n *\n * Emits a {Snapshot} event that contains the same id.\n *\n * {_snapshot} is `internal` and you have to decide how to expose it externally. Its usage may be restricted to a\n * set of accounts, for example using {AccessControl}, or it may be open to the public.\n *\n * [WARNING]\n * ====\n * While an open way of calling {_snapshot} is required for certain trust minimization mechanisms such as forking,\n * you must consider that it can potentially be used by attackers in two ways.\n *\n * First, it can be used to increase the cost of retrieval of values from snapshots, although it will grow\n * logarithmically thus rendering this attack ineffective in the long term. Second, it can be used to target\n * specific accounts and increase the cost of ERC20 transfers for them, in the ways specified in the Gas Costs\n * section above.\n *\n * We haven't measured the actual numbers; if this is something you're interested in please reach out to us.\n * ====\n */\n function _snapshot() internal virtual returns (uint256) {\n _currentSnapshotId.increment();\n\n uint256 currentId = _getCurrentSnapshotId();\n emit Snapshot(currentId);\n return currentId;\n }\n\n /**\n * @dev Get the current snapshotId\n */\n function _getCurrentSnapshotId() internal view virtual returns (uint256) {\n return _currentSnapshotId.current();\n }\n\n /**\n * @dev Retrieves the balance of `account` at the time `snapshotId` was created.\n */\n function balanceOfAt(address account, uint256 snapshotId) public view virtual returns (uint256) {\n (bool snapshotted, uint256 value) = _valueAt(snapshotId, _accountBalanceSnapshots[account]);\n\n return snapshotted ? value : balanceOf(account);\n }\n\n /**\n * @dev Retrieves the total supply at the time `snapshotId` was created.\n */\n function totalSupplyAt(uint256 snapshotId) public view virtual returns (uint256) {\n (bool snapshotted, uint256 value) = _valueAt(snapshotId, _totalSupplySnapshots);\n\n return snapshotted ? value : totalSupply();\n }\n\n // Update balance and/or total supply snapshots before the values are modified. This is implemented\n // in the _beforeTokenTransfer hook, which is executed for _mint, _burn, and _transfer operations.\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual override {\n super._beforeTokenTransfer(from, to, amount);\n\n if (from == address(0)) {\n // mint\n _updateAccountSnapshot(to);\n _updateTotalSupplySnapshot();\n } else if (to == address(0)) {\n // burn\n _updateAccountSnapshot(from);\n _updateTotalSupplySnapshot();\n } else {\n // transfer\n _updateAccountSnapshot(from);\n _updateAccountSnapshot(to);\n }\n }\n\n function _valueAt(uint256 snapshotId, Snapshots storage snapshots) private view returns (bool, uint256) {\n require(snapshotId > 0, \"ERC20Snapshot: id is 0\");\n require(snapshotId <= _getCurrentSnapshotId(), \"ERC20Snapshot: nonexistent id\");\n\n // When a valid snapshot is queried, there are three possibilities:\n // a) The queried value was not modified after the snapshot was taken. Therefore, a snapshot entry was never\n // created for this id, and all stored snapshot ids are smaller than the requested one. The value that corresponds\n // to this id is the current one.\n // b) The queried value was modified after the snapshot was taken. Therefore, there will be an entry with the\n // requested id, and its value is the one to return.\n // c) More snapshots were created after the requested one, and the queried value was later modified. There will be\n // no entry for the requested id: the value that corresponds to it is that of the smallest snapshot id that is\n // larger than the requested one.\n //\n // In summary, we need to find an element in an array, returning the index of the smallest value that is larger if\n // it is not found, unless said value doesn't exist (e.g. when all values are smaller). Arrays.findUpperBound does\n // exactly this.\n\n uint256 index = snapshots.ids.findUpperBound(snapshotId);\n\n if (index == snapshots.ids.length) {\n return (false, 0);\n } else {\n return (true, snapshots.values[index]);\n }\n }\n\n function _updateAccountSnapshot(address account) private {\n _updateSnapshot(_accountBalanceSnapshots[account], balanceOf(account));\n }\n\n function _updateTotalSupplySnapshot() private {\n _updateSnapshot(_totalSupplySnapshots, totalSupply());\n }\n\n function _updateSnapshot(Snapshots storage snapshots, uint256 currentValue) private {\n uint256 currentId = _getCurrentSnapshotId();\n if (_lastSnapshotId(snapshots.ids) < currentId) {\n snapshots.ids.push(currentId);\n snapshots.values.push(currentValue);\n }\n }\n\n function _lastSnapshotId(uint256[] storage ids) private view returns (uint256) {\n if (ids.length == 0) {\n return 0;\n } else {\n return ids[ids.length - 1];\n }\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[46] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20VotesUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/extensions/ERC20Votes.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./draft-ERC20PermitUpgradeable.sol\";\nimport \"../../../utils/math/MathUpgradeable.sol\";\nimport \"../../../governance/utils/IVotesUpgradeable.sol\";\nimport \"../../../utils/math/SafeCastUpgradeable.sol\";\nimport \"../../../utils/cryptography/ECDSAUpgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Extension of ERC20 to support Compound-like voting and delegation. This version is more generic than Compound's,\n * and supports token supply up to 2^224^ - 1, while COMP is limited to 2^96^ - 1.\n *\n * NOTE: If exact COMP compatibility is required, use the {ERC20VotesComp} variant of this module.\n *\n * This extension keeps a history (checkpoints) of each account's vote power. Vote power can be delegated either\n * by calling the {delegate} function directly, or by providing a signature to be used with {delegateBySig}. Voting\n * power can be queried through the public accessors {getVotes} and {getPastVotes}.\n *\n * By default, token balance does not account for voting power. This makes transfers cheaper. The downside is that it\n * requires users to delegate to themselves in order to activate checkpoints and have their voting power tracked.\n *\n * _Available since v4.2._\n */\nabstract contract ERC20VotesUpgradeable is Initializable, IVotesUpgradeable, ERC20PermitUpgradeable {\n function __ERC20Votes_init() internal onlyInitializing {\n }\n\n function __ERC20Votes_init_unchained() internal onlyInitializing {\n }\n struct Checkpoint {\n uint32 fromBlock;\n uint224 votes;\n }\n\n bytes32 private constant _DELEGATION_TYPEHASH =\n keccak256(\"Delegation(address delegatee,uint256 nonce,uint256 expiry)\");\n\n mapping(address => address) private _delegates;\n mapping(address => Checkpoint[]) private _checkpoints;\n Checkpoint[] private _totalSupplyCheckpoints;\n\n /**\n * @dev Get the `pos`-th checkpoint for `account`.\n */\n function checkpoints(address account, uint32 pos) public view virtual returns (Checkpoint memory) {\n return _checkpoints[account][pos];\n }\n\n /**\n * @dev Get number of checkpoints for `account`.\n */\n function numCheckpoints(address account) public view virtual returns (uint32) {\n return SafeCastUpgradeable.toUint32(_checkpoints[account].length);\n }\n\n /**\n * @dev Get the address `account` is currently delegating to.\n */\n function delegates(address account) public view virtual override returns (address) {\n return _delegates[account];\n }\n\n /**\n * @dev Gets the current votes balance for `account`\n */\n function getVotes(address account) public view virtual override returns (uint256) {\n uint256 pos = _checkpoints[account].length;\n return pos == 0 ? 0 : _checkpoints[account][pos - 1].votes;\n }\n\n /**\n * @dev Retrieve the number of votes for `account` at the end of `blockNumber`.\n *\n * Requirements:\n *\n * - `blockNumber` must have been already mined\n */\n function getPastVotes(address account, uint256 blockNumber) public view virtual override returns (uint256) {\n require(blockNumber < block.number, \"ERC20Votes: block not yet mined\");\n return _checkpointsLookup(_checkpoints[account], blockNumber);\n }\n\n /**\n * @dev Retrieve the `totalSupply` at the end of `blockNumber`. Note, this value is the sum of all balances.\n * It is but NOT the sum of all the delegated votes!\n *\n * Requirements:\n *\n * - `blockNumber` must have been already mined\n */\n function getPastTotalSupply(uint256 blockNumber) public view virtual override returns (uint256) {\n require(blockNumber < block.number, \"ERC20Votes: block not yet mined\");\n return _checkpointsLookup(_totalSupplyCheckpoints, blockNumber);\n }\n\n /**\n * @dev Lookup a value in a list of (sorted) checkpoints.\n */\n function _checkpointsLookup(Checkpoint[] storage ckpts, uint256 blockNumber) private view returns (uint256) {\n // We run a binary search to look for the earliest checkpoint taken after `blockNumber`.\n //\n // During the loop, the index of the wanted checkpoint remains in the range [low-1, high).\n // With each iteration, either `low` or `high` is moved towards the middle of the range to maintain the invariant.\n // - If the middle checkpoint is after `blockNumber`, we look in [low, mid)\n // - If the middle checkpoint is before or equal to `blockNumber`, we look in [mid+1, high)\n // Once we reach a single value (when low == high), we've found the right checkpoint at the index high-1, if not\n // out of bounds (in which case we're looking too far in the past and the result is 0).\n // Note that if the latest checkpoint available is exactly for `blockNumber`, we end up with an index that is\n // past the end of the array, so we technically don't find a checkpoint after `blockNumber`, but it works out\n // the same.\n uint256 high = ckpts.length;\n uint256 low = 0;\n while (low < high) {\n uint256 mid = MathUpgradeable.average(low, high);\n if (ckpts[mid].fromBlock > blockNumber) {\n high = mid;\n } else {\n low = mid + 1;\n }\n }\n\n return high == 0 ? 0 : ckpts[high - 1].votes;\n }\n\n /**\n * @dev Delegate votes from the sender to `delegatee`.\n */\n function delegate(address delegatee) public virtual override {\n _delegate(_msgSender(), delegatee);\n }\n\n /**\n * @dev Delegates votes from signer to `delegatee`\n */\n function delegateBySig(\n address delegatee,\n uint256 nonce,\n uint256 expiry,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) public virtual override {\n require(block.timestamp <= expiry, \"ERC20Votes: signature expired\");\n address signer = ECDSAUpgradeable.recover(\n _hashTypedDataV4(keccak256(abi.encode(_DELEGATION_TYPEHASH, delegatee, nonce, expiry))),\n v,\n r,\n s\n );\n require(nonce == _useNonce(signer), \"ERC20Votes: invalid nonce\");\n _delegate(signer, delegatee);\n }\n\n /**\n * @dev Maximum token supply. Defaults to `type(uint224).max` (2^224^ - 1).\n */\n function _maxSupply() internal view virtual returns (uint224) {\n return type(uint224).max;\n }\n\n /**\n * @dev Snapshots the totalSupply after it has been increased.\n */\n function _mint(address account, uint256 amount) internal virtual override {\n super._mint(account, amount);\n require(totalSupply() <= _maxSupply(), \"ERC20Votes: total supply risks overflowing votes\");\n\n _writeCheckpoint(_totalSupplyCheckpoints, _add, amount);\n }\n\n /**\n * @dev Snapshots the totalSupply after it has been decreased.\n */\n function _burn(address account, uint256 amount) internal virtual override {\n super._burn(account, amount);\n\n _writeCheckpoint(_totalSupplyCheckpoints, _subtract, amount);\n }\n\n /**\n * @dev Move voting power when tokens are transferred.\n *\n * Emits a {DelegateVotesChanged} event.\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual override {\n super._afterTokenTransfer(from, to, amount);\n\n _moveVotingPower(delegates(from), delegates(to), amount);\n }\n\n /**\n * @dev Change delegation for `delegator` to `delegatee`.\n *\n * Emits events {DelegateChanged} and {DelegateVotesChanged}.\n */\n function _delegate(address delegator, address delegatee) internal virtual {\n address currentDelegate = delegates(delegator);\n uint256 delegatorBalance = balanceOf(delegator);\n _delegates[delegator] = delegatee;\n\n emit DelegateChanged(delegator, currentDelegate, delegatee);\n\n _moveVotingPower(currentDelegate, delegatee, delegatorBalance);\n }\n\n function _moveVotingPower(\n address src,\n address dst,\n uint256 amount\n ) private {\n if (src != dst && amount > 0) {\n if (src != address(0)) {\n (uint256 oldWeight, uint256 newWeight) = _writeCheckpoint(_checkpoints[src], _subtract, amount);\n emit DelegateVotesChanged(src, oldWeight, newWeight);\n }\n\n if (dst != address(0)) {\n (uint256 oldWeight, uint256 newWeight) = _writeCheckpoint(_checkpoints[dst], _add, amount);\n emit DelegateVotesChanged(dst, oldWeight, newWeight);\n }\n }\n }\n\n function _writeCheckpoint(\n Checkpoint[] storage ckpts,\n function(uint256, uint256) view returns (uint256) op,\n uint256 delta\n ) private returns (uint256 oldWeight, uint256 newWeight) {\n uint256 pos = ckpts.length;\n oldWeight = pos == 0 ? 0 : ckpts[pos - 1].votes;\n newWeight = op(oldWeight, delta);\n\n if (pos > 0 && ckpts[pos - 1].fromBlock == block.number) {\n ckpts[pos - 1].votes = SafeCastUpgradeable.toUint224(newWeight);\n } else {\n ckpts.push(Checkpoint({fromBlock: SafeCastUpgradeable.toUint32(block.number), votes: SafeCastUpgradeable.toUint224(newWeight)}));\n }\n }\n\n function _add(uint256 a, uint256 b) private pure returns (uint256) {\n return a + b;\n }\n\n function _subtract(uint256 a, uint256 b) private pure returns (uint256) {\n return a - b;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[47] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20WrapperUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/extensions/ERC20Wrapper.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC20Upgradeable.sol\";\nimport \"../utils/SafeERC20Upgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Extension of the ERC20 token contract to support token wrapping.\n *\n * Users can deposit and withdraw \"underlying tokens\" and receive a matching number of \"wrapped tokens\". This is useful\n * in conjunction with other modules. For example, combining this wrapping mechanism with {ERC20Votes} will allow the\n * wrapping of an existing \"basic\" ERC20 into a governance token.\n *\n * _Available since v4.2._\n *\n * @custom:storage-size 51\n */\nabstract contract ERC20WrapperUpgradeable is Initializable, ERC20Upgradeable {\n IERC20Upgradeable public underlying;\n\n function __ERC20Wrapper_init(IERC20Upgradeable underlyingToken) internal onlyInitializing {\n __ERC20Wrapper_init_unchained(underlyingToken);\n }\n\n function __ERC20Wrapper_init_unchained(IERC20Upgradeable underlyingToken) internal onlyInitializing {\n underlying = underlyingToken;\n }\n\n /**\n * @dev See {ERC20-decimals}.\n */\n function decimals() public view virtual override returns (uint8) {\n try IERC20MetadataUpgradeable(address(underlying)).decimals() returns (uint8 value) {\n return value;\n } catch {\n return super.decimals();\n }\n }\n\n /**\n * @dev Allow a user to deposit underlying tokens and mint the corresponding number of wrapped tokens.\n */\n function depositFor(address account, uint256 amount) public virtual returns (bool) {\n SafeERC20Upgradeable.safeTransferFrom(underlying, _msgSender(), address(this), amount);\n _mint(account, amount);\n return true;\n }\n\n /**\n * @dev Allow a user to burn a number of wrapped tokens and withdraw the corresponding number of underlying tokens.\n */\n function withdrawTo(address account, uint256 amount) public virtual returns (bool) {\n _burn(_msgSender(), amount);\n SafeERC20Upgradeable.safeTransfer(underlying, account, amount);\n return true;\n }\n\n /**\n * @dev Mint wrapped token to cover any underlyingTokens that would have been transferred by mistake. Internal\n * function that can be exposed with access control if desired.\n */\n function _recover(address account) internal virtual returns (uint256) {\n uint256 value = underlying.balanceOf(address(this)) - totalSupply();\n _mint(account, value);\n return value;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20Upgradeable.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20MetadataUpgradeable is IERC20Upgradeable {\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-upgradeable/token/ERC20/IERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\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 amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `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 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20Upgradeable.sol\";\nimport \"../extensions/draft-IERC20PermitUpgradeable.sol\";\nimport \"../../../utils/AddressUpgradeable.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 SafeERC20Upgradeable {\n using AddressUpgradeable for address;\n\n function safeTransfer(\n IERC20Upgradeable token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20Upgradeable token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20Upgradeable token,\n address spender,\n uint256 value\n ) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20Upgradeable token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20Upgradeable token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n function safePermit(\n IERC20PermitUpgradeable token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\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(IERC20Upgradeable token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.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 *\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://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @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}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/ArraysUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Arrays.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/MathUpgradeable.sol\";\n\n/**\n * @dev Collection of functions related to array types.\n */\nlibrary ArraysUpgradeable {\n /**\n * @dev Searches a sorted `array` and returns the first index that contains\n * a value greater or equal to `element`. If no such index exists (i.e. all\n * values in the array are strictly less than `element`), the array length is\n * returned. Time complexity O(log n).\n *\n * `array` is expected to be sorted in ascending order, and to contain no\n * repeated elements.\n */\n function findUpperBound(uint256[] storage array, uint256 element) internal view returns (uint256) {\n if (array.length == 0) {\n return 0;\n }\n\n uint256 low = 0;\n uint256 high = array.length;\n\n while (low < high) {\n uint256 mid = MathUpgradeable.average(low, high);\n\n // Note that mid will always be strictly less than high (i.e. it will be a valid array index)\n // because Math.average rounds down (it does integer division with truncation).\n if (array[mid] > element) {\n high = mid;\n } else {\n low = mid + 1;\n }\n }\n\n // At this point `low` is the exclusive upper bound. We will return the inclusive upper bound.\n if (low > 0 && array[low - 1] == element) {\n return low - 1;\n } else {\n return low;\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\nimport \"../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 /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title Counters\n * @author Matt Condon (@shrugs)\n * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number\n * of elements in a mapping, issuing ERC721 ids, or counting request ids.\n *\n * Include with `using Counters for Counters.Counter;`\n */\nlibrary CountersUpgradeable {\n struct Counter {\n // This variable should never be directly accessed by users of the library: interactions must be restricted to\n // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add\n // this feature: see https://github.com/ethereum/solidity/issues/4637\n uint256 _value; // default: 0\n }\n\n function current(Counter storage counter) internal view returns (uint256) {\n return counter._value;\n }\n\n function increment(Counter storage counter) internal {\n unchecked {\n counter._value += 1;\n }\n }\n\n function decrement(Counter storage counter) internal {\n uint256 value = counter._value;\n require(value > 0, \"Counter: decrement overflow\");\n unchecked {\n counter._value = value - 1;\n }\n }\n\n function reset(Counter storage counter) internal {\n counter._value = 0;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/cryptography/draft-EIP712Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/cryptography/draft-EIP712.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./ECDSAUpgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.\n *\n * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,\n * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding\n * they need in their contracts using a combination of `abi.encode` and `keccak256`.\n *\n * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding\n * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA\n * ({_hashTypedDataV4}).\n *\n * The implementation of the domain separator was designed to be as efficient as possible while still properly updating\n * the chain id to protect against replay attacks on an eventual fork of the chain.\n *\n * NOTE: This contract implements the version of the encoding known as \"v4\", as implemented by the JSON RPC method\n * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].\n *\n * _Available since v3.4._\n *\n * @custom:storage-size 52\n */\nabstract contract EIP712Upgradeable is Initializable {\n /* solhint-disable var-name-mixedcase */\n bytes32 private _HASHED_NAME;\n bytes32 private _HASHED_VERSION;\n bytes32 private constant _TYPE_HASH = keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\");\n\n /* solhint-enable var-name-mixedcase */\n\n /**\n * @dev Initializes the domain separator and parameter caches.\n *\n * The meaning of `name` and `version` is specified in\n * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:\n *\n * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.\n * - `version`: the current major version of the signing domain.\n *\n * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart\n * contract upgrade].\n */\n function __EIP712_init(string memory name, string memory version) internal onlyInitializing {\n __EIP712_init_unchained(name, version);\n }\n\n function __EIP712_init_unchained(string memory name, string memory version) internal onlyInitializing {\n bytes32 hashedName = keccak256(bytes(name));\n bytes32 hashedVersion = keccak256(bytes(version));\n _HASHED_NAME = hashedName;\n _HASHED_VERSION = hashedVersion;\n }\n\n /**\n * @dev Returns the domain separator for the current chain.\n */\n function _domainSeparatorV4() internal view returns (bytes32) {\n return _buildDomainSeparator(_TYPE_HASH, _EIP712NameHash(), _EIP712VersionHash());\n }\n\n function _buildDomainSeparator(\n bytes32 typeHash,\n bytes32 nameHash,\n bytes32 versionHash\n ) private view returns (bytes32) {\n return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this)));\n }\n\n /**\n * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this\n * function returns the hash of the fully encoded EIP712 message for this domain.\n *\n * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:\n *\n * ```solidity\n * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(\n * keccak256(\"Mail(address to,string contents)\"),\n * mailTo,\n * keccak256(bytes(mailContents))\n * )));\n * address signer = ECDSA.recover(digest, signature);\n * ```\n */\n function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {\n return ECDSAUpgradeable.toTypedDataHash(_domainSeparatorV4(), structHash);\n }\n\n /**\n * @dev The hash of the name parameter for the EIP712 domain.\n *\n * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs\n * are a concern.\n */\n function _EIP712NameHash() internal virtual view returns (bytes32) {\n return _HASHED_NAME;\n }\n\n /**\n * @dev The hash of the version parameter for the EIP712 domain.\n *\n * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs\n * are a concern.\n */\n function _EIP712VersionHash() internal virtual view returns (bytes32) {\n return _HASHED_VERSION;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.3) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../StringsUpgradeable.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSAUpgradeable {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS,\n InvalidSignatureV\n }\n\n function _throwError(RecoverError error) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert(\"ECDSA: invalid signature\");\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert(\"ECDSA: invalid signature length\");\n } else if (error == RecoverError.InvalidSignatureS) {\n revert(\"ECDSA: invalid signature 's' value\");\n } else if (error == RecoverError.InvalidSignatureV) {\n revert(\"ECDSA: invalid signature 'v' value\");\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature` or error string. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n /// @solidity memory-safe-assembly\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength);\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, signature);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n *\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address, RecoverError) {\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n uint8 v = uint8((uint256(vs) >> 255) + 27);\n return tryRecover(hash, v, r, s);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n *\n * _Available since v4.2._\n */\n function recover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n * `r` and `s` signature fields separately.\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address, RecoverError) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS);\n }\n if (v != 27 && v != 28) {\n return (address(0), RecoverError.InvalidSignatureV);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature);\n }\n\n return (signer, RecoverError.NoError);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", hash));\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from `s`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", StringsUpgradeable.toString(s.length), s));\n }\n\n /**\n * @dev Returns an Ethereum Signed Typed Data, created from a\n * `domainSeparator` and a `structHash`. This produces hash corresponding\n * to the one signed with the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n * JSON-RPC method as part of EIP-712.\n *\n * See {recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x01\", domainSeparator, structHash));\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary MathUpgradeable {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\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 up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 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 denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) 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; // 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 prod0 := mul(x, y)\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 return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n 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. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\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 works\n // 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(\n uint256 x,\n uint256 y,\n uint256 denominator,\n Rounding rounding\n ) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. It the number is not a perfect square, the value is rounded down.\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 // 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)`.\n // We also know that `k`, the position of the most significant bit, is such that `msb(a) = 2**k`.\n // This gives `2**k < a <= 2**(k+1)` → `2**(k/2) <= sqrt(a) < 2 ** (k/2+1)`.\n // Using an algorithm similar to the msb conmputation, we are able to compute `result = 2**(k/2)` which is a\n // good first aproximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1;\n uint256 x = a;\n if (x >> 128 > 0) {\n x >>= 128;\n result <<= 64;\n }\n if (x >> 64 > 0) {\n x >>= 64;\n result <<= 32;\n }\n if (x >> 32 > 0) {\n x >>= 32;\n result <<= 16;\n }\n if (x >> 16 > 0) {\n x >>= 16;\n result <<= 8;\n }\n if (x >> 8 > 0) {\n x >>= 8;\n result <<= 4;\n }\n if (x >> 4 > 0) {\n x >>= 4;\n result <<= 2;\n }\n if (x >> 2 > 0) {\n result <<= 1;\n }\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 uint256 result = sqrt(a);\n if (rounding == Rounding.Up && result * result < a) {\n result += 1;\n }\n return result;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/math/SafeCastUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/math/SafeCast.sol)\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 SafeCastUpgradeable {\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) {\n require(value >= type(int248).min && value <= type(int248).max, \"SafeCast: value doesn't fit in 248 bits\");\n return int248(value);\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) {\n require(value >= type(int240).min && value <= type(int240).max, \"SafeCast: value doesn't fit in 240 bits\");\n return int240(value);\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) {\n require(value >= type(int232).min && value <= type(int232).max, \"SafeCast: value doesn't fit in 232 bits\");\n return int232(value);\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) {\n require(value >= type(int224).min && value <= type(int224).max, \"SafeCast: value doesn't fit in 224 bits\");\n return int224(value);\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) {\n require(value >= type(int216).min && value <= type(int216).max, \"SafeCast: value doesn't fit in 216 bits\");\n return int216(value);\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) {\n require(value >= type(int208).min && value <= type(int208).max, \"SafeCast: value doesn't fit in 208 bits\");\n return int208(value);\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) {\n require(value >= type(int200).min && value <= type(int200).max, \"SafeCast: value doesn't fit in 200 bits\");\n return int200(value);\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) {\n require(value >= type(int192).min && value <= type(int192).max, \"SafeCast: value doesn't fit in 192 bits\");\n return int192(value);\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) {\n require(value >= type(int184).min && value <= type(int184).max, \"SafeCast: value doesn't fit in 184 bits\");\n return int184(value);\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) {\n require(value >= type(int176).min && value <= type(int176).max, \"SafeCast: value doesn't fit in 176 bits\");\n return int176(value);\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) {\n require(value >= type(int168).min && value <= type(int168).max, \"SafeCast: value doesn't fit in 168 bits\");\n return int168(value);\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) {\n require(value >= type(int160).min && value <= type(int160).max, \"SafeCast: value doesn't fit in 160 bits\");\n return int160(value);\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) {\n require(value >= type(int152).min && value <= type(int152).max, \"SafeCast: value doesn't fit in 152 bits\");\n return int152(value);\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) {\n require(value >= type(int144).min && value <= type(int144).max, \"SafeCast: value doesn't fit in 144 bits\");\n return int144(value);\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) {\n require(value >= type(int136).min && value <= type(int136).max, \"SafeCast: value doesn't fit in 136 bits\");\n return int136(value);\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) {\n require(value >= type(int128).min && value <= type(int128).max, \"SafeCast: value doesn't fit in 128 bits\");\n return int128(value);\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) {\n require(value >= type(int120).min && value <= type(int120).max, \"SafeCast: value doesn't fit in 120 bits\");\n return int120(value);\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) {\n require(value >= type(int112).min && value <= type(int112).max, \"SafeCast: value doesn't fit in 112 bits\");\n return int112(value);\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) {\n require(value >= type(int104).min && value <= type(int104).max, \"SafeCast: value doesn't fit in 104 bits\");\n return int104(value);\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) {\n require(value >= type(int96).min && value <= type(int96).max, \"SafeCast: value doesn't fit in 96 bits\");\n return int96(value);\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) {\n require(value >= type(int88).min && value <= type(int88).max, \"SafeCast: value doesn't fit in 88 bits\");\n return int88(value);\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) {\n require(value >= type(int80).min && value <= type(int80).max, \"SafeCast: value doesn't fit in 80 bits\");\n return int80(value);\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) {\n require(value >= type(int72).min && value <= type(int72).max, \"SafeCast: value doesn't fit in 72 bits\");\n return int72(value);\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) {\n require(value >= type(int64).min && value <= type(int64).max, \"SafeCast: value doesn't fit in 64 bits\");\n return int64(value);\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) {\n require(value >= type(int56).min && value <= type(int56).max, \"SafeCast: value doesn't fit in 56 bits\");\n return int56(value);\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) {\n require(value >= type(int48).min && value <= type(int48).max, \"SafeCast: value doesn't fit in 48 bits\");\n return int48(value);\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) {\n require(value >= type(int40).min && value <= type(int40).max, \"SafeCast: value doesn't fit in 40 bits\");\n return int40(value);\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) {\n require(value >= type(int32).min && value <= type(int32).max, \"SafeCast: value doesn't fit in 32 bits\");\n return int32(value);\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) {\n require(value >= type(int24).min && value <= type(int24).max, \"SafeCast: value doesn't fit in 24 bits\");\n return int24(value);\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) {\n require(value >= type(int16).min && value <= type(int16).max, \"SafeCast: value doesn't fit in 16 bits\");\n return int16(value);\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) {\n require(value >= type(int8).min && value <= type(int8).max, \"SafeCast: value doesn't fit in 8 bits\");\n return int8(value);\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" + }, + "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev String operations.\n */\nlibrary StringsUpgradeable {\n bytes16 private constant _HEX_SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\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 // Inspired by OraclizeAPI's implementation - MIT licence\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\n\n if (value == 0) {\n return \"0\";\n }\n uint256 temp = value;\n uint256 digits;\n while (temp != 0) {\n digits++;\n temp /= 10;\n }\n bytes memory buffer = new bytes(digits);\n while (value != 0) {\n digits -= 1;\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\n value /= 10;\n }\n return string(buffer);\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 if (value == 0) {\n return \"0x00\";\n }\n uint256 temp = value;\n uint256 length = 0;\n while (temp != 0) {\n length++;\n temp >>= 8;\n }\n return toHexString(value, length);\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 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_SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\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 representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "@openzeppelin/contracts/governance/utils/IVotes.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (governance/utils/IVotes.sol)\npragma solidity ^0.8.0;\n\n/**\n * @dev Common interface for {ERC20Votes}, {ERC721Votes}, and other {Votes}-enabled contracts.\n *\n * _Available since v4.5._\n */\ninterface IVotes {\n /**\n * @dev Emitted when an account changes their delegate.\n */\n event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);\n\n /**\n * @dev Emitted when a token transfer or delegate change results in changes to a delegate's number of votes.\n */\n event DelegateVotesChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance);\n\n /**\n * @dev Returns the current amount of votes that `account` has.\n */\n function getVotes(address account) external view returns (uint256);\n\n /**\n * @dev Returns the amount of votes that `account` had at the end of a past block (`blockNumber`).\n */\n function getPastVotes(address account, uint256 blockNumber) external view returns (uint256);\n\n /**\n * @dev Returns the total supply of votes available at the end of a past block (`blockNumber`).\n *\n * NOTE: This value is the sum of all available votes, which is not necessarily the sum of all delegated votes.\n * Votes that have not been delegated are still part of total supply, even though they would not participate in a\n * vote.\n */\n function getPastTotalSupply(uint256 blockNumber) external view returns (uint256);\n\n /**\n * @dev Returns the delegate that `account` has chosen.\n */\n function delegates(address account) external view returns (address);\n\n /**\n * @dev Delegates votes from the sender to `delegatee`.\n */\n function delegate(address delegatee) external;\n\n /**\n * @dev Delegates votes from signer to `delegatee`.\n */\n function delegateBySig(\n address delegatee,\n uint256 nonce,\n uint256 expiry,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n}\n" + }, + "@openzeppelin/contracts/interfaces/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/introspection/IERC165.sol\";\n" + }, + "@openzeppelin/contracts/token/ERC20/ERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n }\n _balances[to] += amount;\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n _balances[account] += amount;\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n }\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\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 */\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 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/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\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 v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev 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 amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `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 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../extensions/draft-IERC20Permit.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n function safePermit(\n IERC20Permit token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/ERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721.sol\";\nimport \"./IERC721Receiver.sol\";\nimport \"./extensions/IERC721Metadata.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/Context.sol\";\nimport \"../../utils/Strings.sol\";\nimport \"../../utils/introspection/ERC165.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 */\ncontract ERC721 is Context, ERC165, IERC721, IERC721Metadata {\n using Address for address;\n using Strings for uint256;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to owner address\n mapping(uint256 => address) private _owners;\n\n // Mapping owner address to token count\n mapping(address => uint256) private _balances;\n\n // Mapping from token ID to approved address\n mapping(uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, 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 override returns (uint256) {\n require(owner != address(0), \"ERC721: address zero is not a valid owner\");\n return _balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n address owner = _owners[tokenId];\n require(owner != address(0), \"ERC721: invalid token ID\");\n return owner;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(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 override {\n address owner = ERC721.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not token owner nor approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n _requireMinted(tokenId);\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner nor approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner nor approved\");\n _safeTransfer(from, to, tokenId, data);\n }\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 * `data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\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 `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(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _transfer(from, to, tokenId);\n require(_checkOnERC721Received(from, to, tokenId, data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n * and stop existing when they are burned (`_burn`).\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _owners[tokenId] != address(0);\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n address owner = ERC721.ownerOf(tokenId);\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\n }\n\n /**\n * @dev Safely mints `tokenId` and transfers it to `to`.\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 virtual {\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(\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _mint(to, tokenId);\n require(\n _checkOnERC721Received(address(0), to, tokenId, data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\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 virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId);\n\n _balances[to] += 1;\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId);\n\n // Clear approvals\n _approve(address(0), tokenId);\n\n _balances[owner] -= 1;\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId);\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(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId);\n\n // Clear approvals from the previous owner\n _approve(address(0), tokenId);\n\n _balances[from] -= 1;\n _balances[to] += 1;\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ERC721.ownerOf(tokenId), to, tokenId);\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(\n address owner,\n address operator,\n bool approved\n ) internal virtual {\n require(owner != operator, \"ERC721: approve to caller\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Reverts if the `tokenId` has not been minted yet.\n */\n function _requireMinted(uint256 tokenId) internal view virtual {\n require(_exists(tokenId), \"ERC721: invalid token ID\");\n }\n\n /**\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n * 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 * @return bool whether the call correctly returned the expected magic value\n */\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) private returns (bool) {\n if (to.isContract()) {\n try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n return retval == IERC721Receiver.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\"ERC721: transfer to non ERC721Receiver implementer\");\n } else {\n /// @solidity memory-safe-assembly\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting\n * and burning.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be\n * transferred to `to`.\n * - When `from` is zero, `tokenId` will be minted for `to`.\n * - When `to` is zero, ``from``'s `tokenId` will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../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 v4.7.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n\n /**\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 {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns 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 v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `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/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.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 *\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://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @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}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165Storage.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165Storage.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./ERC165.sol\";\n\n/**\n * @dev Storage based implementation of the {IERC165} interface.\n *\n * Contracts may inherit from this and call {_registerInterface} to declare\n * their support of an interface.\n */\nabstract contract ERC165Storage is ERC165 {\n /**\n * @dev Mapping of interface ids to whether or not it's supported.\n */\n mapping(bytes4 => bool) private _supportedInterfaces;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return super.supportsInterface(interfaceId) || _supportedInterfaces[interfaceId];\n }\n\n /**\n * @dev Registers the contract as an implementer of the interface defined by\n * `interfaceId`. Support of the actual ERC165 interface is automatic and\n * registering its interface id is not required.\n *\n * See {IERC165-supportsInterface}.\n *\n * Requirements:\n *\n * - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`).\n */\n function _registerInterface(bytes4 interfaceId) internal virtual {\n require(interfaceId != 0xffffffff, \"ERC165: invalid interface id\");\n _supportedInterfaces[interfaceId] = true;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _HEX_SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\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 // Inspired by OraclizeAPI's implementation - MIT licence\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\n\n if (value == 0) {\n return \"0\";\n }\n uint256 temp = value;\n uint256 digits;\n while (temp != 0) {\n digits++;\n temp /= 10;\n }\n bytes memory buffer = new bytes(digits);\n while (value != 0) {\n digits -= 1;\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\n value /= 10;\n }\n return string(buffer);\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 if (value == 0) {\n return \"0x00\";\n }\n uint256 temp = value;\n uint256 length = 0;\n while (temp != 0) {\n length++;\n temp >>= 8;\n }\n return toHexString(value, length);\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 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_SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\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 representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "@prb/math/src/Common.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\n// Common.sol\n//\n// Common mathematical functions used in both SD59x18 and UD60x18. Note that these global functions do not\n// always operate with SD59x18 and UD60x18 numbers.\n\n/*//////////////////////////////////////////////////////////////////////////\n CUSTOM ERRORS\n//////////////////////////////////////////////////////////////////////////*/\n\n/// @notice Thrown when the resultant value in {mulDiv} overflows uint256.\nerror PRBMath_MulDiv_Overflow(uint256 x, uint256 y, uint256 denominator);\n\n/// @notice Thrown when the resultant value in {mulDiv18} overflows uint256.\nerror PRBMath_MulDiv18_Overflow(uint256 x, uint256 y);\n\n/// @notice Thrown when one of the inputs passed to {mulDivSigned} is `type(int256).min`.\nerror PRBMath_MulDivSigned_InputTooSmall();\n\n/// @notice Thrown when the resultant value in {mulDivSigned} overflows int256.\nerror PRBMath_MulDivSigned_Overflow(int256 x, int256 y);\n\n/*//////////////////////////////////////////////////////////////////////////\n CONSTANTS\n//////////////////////////////////////////////////////////////////////////*/\n\n/// @dev The maximum value a uint128 number can have.\nuint128 constant MAX_UINT128 = type(uint128).max;\n\n/// @dev The maximum value a uint40 number can have.\nuint40 constant MAX_UINT40 = type(uint40).max;\n\n/// @dev The unit number, which the decimal precision of the fixed-point types.\nuint256 constant UNIT = 1e18;\n\n/// @dev The unit number inverted mod 2^256.\nuint256 constant UNIT_INVERSE = 78156646155174841979727994598816262306175212592076161876661_508869554232690281;\n\n/// @dev The the largest power of two that divides the decimal value of `UNIT`. The logarithm of this value is the least significant\n/// bit in the binary representation of `UNIT`.\nuint256 constant UNIT_LPOTD = 262144;\n\n/*//////////////////////////////////////////////////////////////////////////\n FUNCTIONS\n//////////////////////////////////////////////////////////////////////////*/\n\n/// @notice Calculates the binary exponent of x using the binary fraction method.\n/// @dev Has to use 192.64-bit fixed-point numbers. See https://ethereum.stackexchange.com/a/96594/24693.\n/// @param x The exponent as an unsigned 192.64-bit fixed-point number.\n/// @return result The result as an unsigned 60.18-decimal fixed-point number.\n/// @custom:smtchecker abstract-function-nondet\nfunction exp2(uint256 x) pure returns (uint256 result) {\n unchecked {\n // Start from 0.5 in the 192.64-bit fixed-point format.\n result = 0x800000000000000000000000000000000000000000000000;\n\n // The following logic multiplies the result by $\\sqrt{2^{-i}}$ when the bit at position i is 1. Key points:\n //\n // 1. Intermediate results will not overflow, as the starting point is 2^191 and all magic factors are under 2^65.\n // 2. The rationale for organizing the if statements into groups of 8 is gas savings. If the result of performing\n // a bitwise AND operation between x and any value in the array [0x80; 0x40; 0x20; 0x10; 0x08; 0x04; 0x02; 0x01] is 1,\n // we know that `x & 0xFF` is also 1.\n if (x & 0xFF00000000000000 > 0) {\n if (x & 0x8000000000000000 > 0) {\n result = (result * 0x16A09E667F3BCC909) >> 64;\n }\n if (x & 0x4000000000000000 > 0) {\n result = (result * 0x1306FE0A31B7152DF) >> 64;\n }\n if (x & 0x2000000000000000 > 0) {\n result = (result * 0x1172B83C7D517ADCE) >> 64;\n }\n if (x & 0x1000000000000000 > 0) {\n result = (result * 0x10B5586CF9890F62A) >> 64;\n }\n if (x & 0x800000000000000 > 0) {\n result = (result * 0x1059B0D31585743AE) >> 64;\n }\n if (x & 0x400000000000000 > 0) {\n result = (result * 0x102C9A3E778060EE7) >> 64;\n }\n if (x & 0x200000000000000 > 0) {\n result = (result * 0x10163DA9FB33356D8) >> 64;\n }\n if (x & 0x100000000000000 > 0) {\n result = (result * 0x100B1AFA5ABCBED61) >> 64;\n }\n }\n\n if (x & 0xFF000000000000 > 0) {\n if (x & 0x80000000000000 > 0) {\n result = (result * 0x10058C86DA1C09EA2) >> 64;\n }\n if (x & 0x40000000000000 > 0) {\n result = (result * 0x1002C605E2E8CEC50) >> 64;\n }\n if (x & 0x20000000000000 > 0) {\n result = (result * 0x100162F3904051FA1) >> 64;\n }\n if (x & 0x10000000000000 > 0) {\n result = (result * 0x1000B175EFFDC76BA) >> 64;\n }\n if (x & 0x8000000000000 > 0) {\n result = (result * 0x100058BA01FB9F96D) >> 64;\n }\n if (x & 0x4000000000000 > 0) {\n result = (result * 0x10002C5CC37DA9492) >> 64;\n }\n if (x & 0x2000000000000 > 0) {\n result = (result * 0x1000162E525EE0547) >> 64;\n }\n if (x & 0x1000000000000 > 0) {\n result = (result * 0x10000B17255775C04) >> 64;\n }\n }\n\n if (x & 0xFF0000000000 > 0) {\n if (x & 0x800000000000 > 0) {\n result = (result * 0x1000058B91B5BC9AE) >> 64;\n }\n if (x & 0x400000000000 > 0) {\n result = (result * 0x100002C5C89D5EC6D) >> 64;\n }\n if (x & 0x200000000000 > 0) {\n result = (result * 0x10000162E43F4F831) >> 64;\n }\n if (x & 0x100000000000 > 0) {\n result = (result * 0x100000B1721BCFC9A) >> 64;\n }\n if (x & 0x80000000000 > 0) {\n result = (result * 0x10000058B90CF1E6E) >> 64;\n }\n if (x & 0x40000000000 > 0) {\n result = (result * 0x1000002C5C863B73F) >> 64;\n }\n if (x & 0x20000000000 > 0) {\n result = (result * 0x100000162E430E5A2) >> 64;\n }\n if (x & 0x10000000000 > 0) {\n result = (result * 0x1000000B172183551) >> 64;\n }\n }\n\n if (x & 0xFF00000000 > 0) {\n if (x & 0x8000000000 > 0) {\n result = (result * 0x100000058B90C0B49) >> 64;\n }\n if (x & 0x4000000000 > 0) {\n result = (result * 0x10000002C5C8601CC) >> 64;\n }\n if (x & 0x2000000000 > 0) {\n result = (result * 0x1000000162E42FFF0) >> 64;\n }\n if (x & 0x1000000000 > 0) {\n result = (result * 0x10000000B17217FBB) >> 64;\n }\n if (x & 0x800000000 > 0) {\n result = (result * 0x1000000058B90BFCE) >> 64;\n }\n if (x & 0x400000000 > 0) {\n result = (result * 0x100000002C5C85FE3) >> 64;\n }\n if (x & 0x200000000 > 0) {\n result = (result * 0x10000000162E42FF1) >> 64;\n }\n if (x & 0x100000000 > 0) {\n result = (result * 0x100000000B17217F8) >> 64;\n }\n }\n\n if (x & 0xFF000000 > 0) {\n if (x & 0x80000000 > 0) {\n result = (result * 0x10000000058B90BFC) >> 64;\n }\n if (x & 0x40000000 > 0) {\n result = (result * 0x1000000002C5C85FE) >> 64;\n }\n if (x & 0x20000000 > 0) {\n result = (result * 0x100000000162E42FF) >> 64;\n }\n if (x & 0x10000000 > 0) {\n result = (result * 0x1000000000B17217F) >> 64;\n }\n if (x & 0x8000000 > 0) {\n result = (result * 0x100000000058B90C0) >> 64;\n }\n if (x & 0x4000000 > 0) {\n result = (result * 0x10000000002C5C860) >> 64;\n }\n if (x & 0x2000000 > 0) {\n result = (result * 0x1000000000162E430) >> 64;\n }\n if (x & 0x1000000 > 0) {\n result = (result * 0x10000000000B17218) >> 64;\n }\n }\n\n if (x & 0xFF0000 > 0) {\n if (x & 0x800000 > 0) {\n result = (result * 0x1000000000058B90C) >> 64;\n }\n if (x & 0x400000 > 0) {\n result = (result * 0x100000000002C5C86) >> 64;\n }\n if (x & 0x200000 > 0) {\n result = (result * 0x10000000000162E43) >> 64;\n }\n if (x & 0x100000 > 0) {\n result = (result * 0x100000000000B1721) >> 64;\n }\n if (x & 0x80000 > 0) {\n result = (result * 0x10000000000058B91) >> 64;\n }\n if (x & 0x40000 > 0) {\n result = (result * 0x1000000000002C5C8) >> 64;\n }\n if (x & 0x20000 > 0) {\n result = (result * 0x100000000000162E4) >> 64;\n }\n if (x & 0x10000 > 0) {\n result = (result * 0x1000000000000B172) >> 64;\n }\n }\n\n if (x & 0xFF00 > 0) {\n if (x & 0x8000 > 0) {\n result = (result * 0x100000000000058B9) >> 64;\n }\n if (x & 0x4000 > 0) {\n result = (result * 0x10000000000002C5D) >> 64;\n }\n if (x & 0x2000 > 0) {\n result = (result * 0x1000000000000162E) >> 64;\n }\n if (x & 0x1000 > 0) {\n result = (result * 0x10000000000000B17) >> 64;\n }\n if (x & 0x800 > 0) {\n result = (result * 0x1000000000000058C) >> 64;\n }\n if (x & 0x400 > 0) {\n result = (result * 0x100000000000002C6) >> 64;\n }\n if (x & 0x200 > 0) {\n result = (result * 0x10000000000000163) >> 64;\n }\n if (x & 0x100 > 0) {\n result = (result * 0x100000000000000B1) >> 64;\n }\n }\n\n if (x & 0xFF > 0) {\n if (x & 0x80 > 0) {\n result = (result * 0x10000000000000059) >> 64;\n }\n if (x & 0x40 > 0) {\n result = (result * 0x1000000000000002C) >> 64;\n }\n if (x & 0x20 > 0) {\n result = (result * 0x10000000000000016) >> 64;\n }\n if (x & 0x10 > 0) {\n result = (result * 0x1000000000000000B) >> 64;\n }\n if (x & 0x8 > 0) {\n result = (result * 0x10000000000000006) >> 64;\n }\n if (x & 0x4 > 0) {\n result = (result * 0x10000000000000003) >> 64;\n }\n if (x & 0x2 > 0) {\n result = (result * 0x10000000000000001) >> 64;\n }\n if (x & 0x1 > 0) {\n result = (result * 0x10000000000000001) >> 64;\n }\n }\n\n // In the code snippet below, two operations are executed simultaneously:\n //\n // 1. The result is multiplied by $(2^n + 1)$, where $2^n$ represents the integer part, and the additional 1\n // accounts for the initial guess of 0.5. This is achieved by subtracting from 191 instead of 192.\n // 2. The result is then converted to an unsigned 60.18-decimal fixed-point format.\n //\n // The underlying logic is based on the relationship $2^{191-ip} = 2^{ip} / 2^{191}$, where $ip$ denotes the,\n // integer part, $2^n$.\n result *= UNIT;\n result >>= (191 - (x >> 64));\n }\n}\n\n/// @notice Finds the zero-based index of the first 1 in the binary representation of x.\n///\n/// @dev See the note on \"msb\" in this Wikipedia article: https://en.wikipedia.org/wiki/Find_first_set\n///\n/// Each step in this implementation is equivalent to this high-level code:\n///\n/// ```solidity\n/// if (x >= 2 ** 128) {\n/// x >>= 128;\n/// result += 128;\n/// }\n/// ```\n///\n/// Where 128 is replaced with each respective power of two factor. See the full high-level implementation here:\n/// https://gist.github.com/PaulRBerg/f932f8693f2733e30c4d479e8e980948\n///\n/// The Yul instructions used below are:\n///\n/// - \"gt\" is \"greater than\"\n/// - \"or\" is the OR bitwise operator\n/// - \"shl\" is \"shift left\"\n/// - \"shr\" is \"shift right\"\n///\n/// @param x The uint256 number for which to find the index of the most significant bit.\n/// @return result The index of the most significant bit as a uint256.\n/// @custom:smtchecker abstract-function-nondet\nfunction msb(uint256 x) pure returns (uint256 result) {\n // 2^128\n assembly (\"memory-safe\") {\n let factor := shl(7, gt(x, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))\n x := shr(factor, x)\n result := or(result, factor)\n }\n // 2^64\n assembly (\"memory-safe\") {\n let factor := shl(6, gt(x, 0xFFFFFFFFFFFFFFFF))\n x := shr(factor, x)\n result := or(result, factor)\n }\n // 2^32\n assembly (\"memory-safe\") {\n let factor := shl(5, gt(x, 0xFFFFFFFF))\n x := shr(factor, x)\n result := or(result, factor)\n }\n // 2^16\n assembly (\"memory-safe\") {\n let factor := shl(4, gt(x, 0xFFFF))\n x := shr(factor, x)\n result := or(result, factor)\n }\n // 2^8\n assembly (\"memory-safe\") {\n let factor := shl(3, gt(x, 0xFF))\n x := shr(factor, x)\n result := or(result, factor)\n }\n // 2^4\n assembly (\"memory-safe\") {\n let factor := shl(2, gt(x, 0xF))\n x := shr(factor, x)\n result := or(result, factor)\n }\n // 2^2\n assembly (\"memory-safe\") {\n let factor := shl(1, gt(x, 0x3))\n x := shr(factor, x)\n result := or(result, factor)\n }\n // 2^1\n // No need to shift x any more.\n assembly (\"memory-safe\") {\n let factor := gt(x, 0x1)\n result := or(result, factor)\n }\n}\n\n/// @notice Calculates x*y÷denominator with 512-bit precision.\n///\n/// @dev Credits to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv.\n///\n/// Notes:\n/// - The result is rounded toward zero.\n///\n/// Requirements:\n/// - The denominator must not be zero.\n/// - The result must fit in uint256.\n///\n/// @param x The multiplicand as a uint256.\n/// @param y The multiplier as a uint256.\n/// @param denominator The divisor as a uint256.\n/// @return result The result as a uint256.\n/// @custom:smtchecker abstract-function-nondet\nfunction mulDiv(uint256 x, uint256 y, uint256 denominator) pure returns (uint256 result) {\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; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly (\"memory-safe\") {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\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 unchecked {\n return prod0 / denominator;\n }\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n if (prod1 >= denominator) {\n revert PRBMath_MulDiv_Overflow(x, y, denominator);\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 (\"memory-safe\") {\n // Compute remainder using the mulmod Yul instruction.\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 unchecked {\n // Calculate the largest power of two divisor of the denominator using the unary operator ~. This operation cannot overflow\n // because the denominator cannot be zero at this point in the function execution. The result is always >= 1.\n // For more detail, see https://cs.stackexchange.com/q/138556/92363.\n uint256 lpotdod = denominator & (~denominator + 1);\n uint256 flippedLpotdod;\n\n assembly (\"memory-safe\") {\n // Factor powers of two out of denominator.\n denominator := div(denominator, lpotdod)\n\n // Divide [prod1 prod0] by lpotdod.\n prod0 := div(prod0, lpotdod)\n\n // Get the flipped value `2^256 / lpotdod`. If the `lpotdod` is zero, the flipped value is one.\n // `sub(0, lpotdod)` produces the two's complement version of `lpotdod`, which is equivalent to flipping all the bits.\n // However, `div` interprets this value as an unsigned value: https://ethereum.stackexchange.com/q/147168/24693\n flippedLpotdod := add(div(sub(0, lpotdod), lpotdod), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * flippedLpotdod;\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 works\n // 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 }\n}\n\n/// @notice Calculates x*y÷1e18 with 512-bit precision.\n///\n/// @dev A variant of {mulDiv} with constant folding, i.e. in which the denominator is hard coded to 1e18.\n///\n/// Notes:\n/// - The body is purposely left uncommented; to understand how this works, see the documentation in {mulDiv}.\n/// - The result is rounded toward zero.\n/// - We take as an axiom that the result cannot be `MAX_UINT256` when x and y solve the following system of equations:\n///\n/// $$\n/// \\begin{cases}\n/// x * y = MAX\\_UINT256 * UNIT \\\\\n/// (x * y) \\% UNIT \\geq \\frac{UNIT}{2}\n/// \\end{cases}\n/// $$\n///\n/// Requirements:\n/// - Refer to the requirements in {mulDiv}.\n/// - The result must fit in uint256.\n///\n/// @param x The multiplicand as an unsigned 60.18-decimal fixed-point number.\n/// @param y The multiplier as an unsigned 60.18-decimal fixed-point number.\n/// @return result The result as an unsigned 60.18-decimal fixed-point number.\n/// @custom:smtchecker abstract-function-nondet\nfunction mulDiv18(uint256 x, uint256 y) pure returns (uint256 result) {\n uint256 prod0;\n uint256 prod1;\n assembly (\"memory-safe\") {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n if (prod1 == 0) {\n unchecked {\n return prod0 / UNIT;\n }\n }\n\n if (prod1 >= UNIT) {\n revert PRBMath_MulDiv18_Overflow(x, y);\n }\n\n uint256 remainder;\n assembly (\"memory-safe\") {\n remainder := mulmod(x, y, UNIT)\n result :=\n mul(\n or(\n div(sub(prod0, remainder), UNIT_LPOTD),\n mul(sub(prod1, gt(remainder, prod0)), add(div(sub(0, UNIT_LPOTD), UNIT_LPOTD), 1))\n ),\n UNIT_INVERSE\n )\n }\n}\n\n/// @notice Calculates x*y÷denominator with 512-bit precision.\n///\n/// @dev This is an extension of {mulDiv} for signed numbers, which works by computing the signs and the absolute values separately.\n///\n/// Notes:\n/// - The result is rounded toward zero.\n///\n/// Requirements:\n/// - Refer to the requirements in {mulDiv}.\n/// - None of the inputs can be `type(int256).min`.\n/// - The result must fit in int256.\n///\n/// @param x The multiplicand as an int256.\n/// @param y The multiplier as an int256.\n/// @param denominator The divisor as an int256.\n/// @return result The result as an int256.\n/// @custom:smtchecker abstract-function-nondet\nfunction mulDivSigned(int256 x, int256 y, int256 denominator) pure returns (int256 result) {\n if (x == type(int256).min || y == type(int256).min || denominator == type(int256).min) {\n revert PRBMath_MulDivSigned_InputTooSmall();\n }\n\n // Get hold of the absolute values of x, y and the denominator.\n uint256 xAbs;\n uint256 yAbs;\n uint256 dAbs;\n unchecked {\n xAbs = x < 0 ? uint256(-x) : uint256(x);\n yAbs = y < 0 ? uint256(-y) : uint256(y);\n dAbs = denominator < 0 ? uint256(-denominator) : uint256(denominator);\n }\n\n // Compute the absolute value of x*y÷denominator. The result must fit in int256.\n uint256 resultAbs = mulDiv(xAbs, yAbs, dAbs);\n if (resultAbs > uint256(type(int256).max)) {\n revert PRBMath_MulDivSigned_Overflow(x, y);\n }\n\n // Get the signs of x, y and the denominator.\n uint256 sx;\n uint256 sy;\n uint256 sd;\n assembly (\"memory-safe\") {\n // \"sgt\" is the \"signed greater than\" assembly instruction and \"sub(0,1)\" is -1 in two's complement.\n sx := sgt(x, sub(0, 1))\n sy := sgt(y, sub(0, 1))\n sd := sgt(denominator, sub(0, 1))\n }\n\n // XOR over sx, sy and sd. What this does is to check whether there are 1 or 3 negative signs in the inputs.\n // If there are, the result should be negative. Otherwise, it should be positive.\n unchecked {\n result = sx ^ sy ^ sd == 0 ? -int256(resultAbs) : int256(resultAbs);\n }\n}\n\n/// @notice Calculates the square root of x using the Babylonian method.\n///\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\n///\n/// Notes:\n/// - If x is not a perfect square, the result is rounded down.\n/// - Credits to OpenZeppelin for the explanations in comments below.\n///\n/// @param x The uint256 number for which to calculate the square root.\n/// @return result The result as a uint256.\n/// @custom:smtchecker abstract-function-nondet\nfunction sqrt(uint256 x) pure returns (uint256 result) {\n if (x == 0) {\n return 0;\n }\n\n // For our first guess, we calculate the biggest power of 2 which is smaller than the square root of x.\n //\n // We know that the \"msb\" (most significant bit) of x is a power of 2 such that we have:\n //\n // $$\n // msb(x) <= x <= 2*msb(x)$\n // $$\n //\n // We write $msb(x)$ as $2^k$, and we get:\n //\n // $$\n // k = log_2(x)\n // $$\n //\n // Thus, we can write the initial inequality as:\n //\n // $$\n // 2^{log_2(x)} <= x <= 2*2^{log_2(x)+1} \\\\\n // sqrt(2^k) <= sqrt(x) < sqrt(2^{k+1}) \\\\\n // 2^{k/2} <= sqrt(x) < 2^{(k+1)/2} <= 2^{(k/2)+1}\n // $$\n //\n // Consequently, $2^{log_2(x) /2} is a good first approximation of sqrt(x) with at least one correct bit.\n uint256 xAux = uint256(x);\n result = 1;\n if (xAux >= 2 ** 128) {\n xAux >>= 128;\n result <<= 64;\n }\n if (xAux >= 2 ** 64) {\n xAux >>= 64;\n result <<= 32;\n }\n if (xAux >= 2 ** 32) {\n xAux >>= 32;\n result <<= 16;\n }\n if (xAux >= 2 ** 16) {\n xAux >>= 16;\n result <<= 8;\n }\n if (xAux >= 2 ** 8) {\n xAux >>= 8;\n result <<= 4;\n }\n if (xAux >= 2 ** 4) {\n xAux >>= 4;\n result <<= 2;\n }\n if (xAux >= 2 ** 2) {\n result <<= 1;\n }\n\n // At this point, `result` is an estimation with at least one bit of precision. We know the true value has at\n // most 128 bits, since it is the square root of a uint256. Newton's method converges quadratically (precision\n // doubles at every iteration). We thus need at most 7 iteration to turn our partial result with one bit of\n // precision into the expected uint128 result.\n unchecked {\n result = (result + x / result) >> 1;\n result = (result + x / result) >> 1;\n result = (result + x / result) >> 1;\n result = (result + x / result) >> 1;\n result = (result + x / result) >> 1;\n result = (result + x / result) >> 1;\n result = (result + x / result) >> 1;\n\n // If x is not a perfect square, round the result toward zero.\n uint256 roundedResult = x / result;\n if (result >= roundedResult) {\n result = roundedResult;\n }\n }\n}\n" + }, + "@prb/math/src/sd1x18/Casting.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport \"../Common.sol\" as Common;\nimport \"./Errors.sol\" as CastingErrors;\nimport { SD59x18 } from \"../sd59x18/ValueType.sol\";\nimport { UD2x18 } from \"../ud2x18/ValueType.sol\";\nimport { UD60x18 } from \"../ud60x18/ValueType.sol\";\nimport { SD1x18 } from \"./ValueType.sol\";\n\n/// @notice Casts an SD1x18 number into SD59x18.\n/// @dev There is no overflow check because the domain of SD1x18 is a subset of SD59x18.\nfunction intoSD59x18(SD1x18 x) pure returns (SD59x18 result) {\n result = SD59x18.wrap(int256(SD1x18.unwrap(x)));\n}\n\n/// @notice Casts an SD1x18 number into UD2x18.\n/// - x must be positive.\nfunction intoUD2x18(SD1x18 x) pure returns (UD2x18 result) {\n int64 xInt = SD1x18.unwrap(x);\n if (xInt < 0) {\n revert CastingErrors.PRBMath_SD1x18_ToUD2x18_Underflow(x);\n }\n result = UD2x18.wrap(uint64(xInt));\n}\n\n/// @notice Casts an SD1x18 number into UD60x18.\n/// @dev Requirements:\n/// - x must be positive.\nfunction intoUD60x18(SD1x18 x) pure returns (UD60x18 result) {\n int64 xInt = SD1x18.unwrap(x);\n if (xInt < 0) {\n revert CastingErrors.PRBMath_SD1x18_ToUD60x18_Underflow(x);\n }\n result = UD60x18.wrap(uint64(xInt));\n}\n\n/// @notice Casts an SD1x18 number into uint256.\n/// @dev Requirements:\n/// - x must be positive.\nfunction intoUint256(SD1x18 x) pure returns (uint256 result) {\n int64 xInt = SD1x18.unwrap(x);\n if (xInt < 0) {\n revert CastingErrors.PRBMath_SD1x18_ToUint256_Underflow(x);\n }\n result = uint256(uint64(xInt));\n}\n\n/// @notice Casts an SD1x18 number into uint128.\n/// @dev Requirements:\n/// - x must be positive.\nfunction intoUint128(SD1x18 x) pure returns (uint128 result) {\n int64 xInt = SD1x18.unwrap(x);\n if (xInt < 0) {\n revert CastingErrors.PRBMath_SD1x18_ToUint128_Underflow(x);\n }\n result = uint128(uint64(xInt));\n}\n\n/// @notice Casts an SD1x18 number into uint40.\n/// @dev Requirements:\n/// - x must be positive.\n/// - x must be less than or equal to `MAX_UINT40`.\nfunction intoUint40(SD1x18 x) pure returns (uint40 result) {\n int64 xInt = SD1x18.unwrap(x);\n if (xInt < 0) {\n revert CastingErrors.PRBMath_SD1x18_ToUint40_Underflow(x);\n }\n if (xInt > int64(uint64(Common.MAX_UINT40))) {\n revert CastingErrors.PRBMath_SD1x18_ToUint40_Overflow(x);\n }\n result = uint40(uint64(xInt));\n}\n\n/// @notice Alias for {wrap}.\nfunction sd1x18(int64 x) pure returns (SD1x18 result) {\n result = SD1x18.wrap(x);\n}\n\n/// @notice Unwraps an SD1x18 number into int64.\nfunction unwrap(SD1x18 x) pure returns (int64 result) {\n result = SD1x18.unwrap(x);\n}\n\n/// @notice Wraps an int64 number into SD1x18.\nfunction wrap(int64 x) pure returns (SD1x18 result) {\n result = SD1x18.wrap(x);\n}\n" + }, + "@prb/math/src/sd1x18/Constants.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport { SD1x18 } from \"./ValueType.sol\";\n\n/// @dev Euler's number as an SD1x18 number.\nSD1x18 constant E = SD1x18.wrap(2_718281828459045235);\n\n/// @dev The maximum value an SD1x18 number can have.\nint64 constant uMAX_SD1x18 = 9_223372036854775807;\nSD1x18 constant MAX_SD1x18 = SD1x18.wrap(uMAX_SD1x18);\n\n/// @dev The maximum value an SD1x18 number can have.\nint64 constant uMIN_SD1x18 = -9_223372036854775808;\nSD1x18 constant MIN_SD1x18 = SD1x18.wrap(uMIN_SD1x18);\n\n/// @dev PI as an SD1x18 number.\nSD1x18 constant PI = SD1x18.wrap(3_141592653589793238);\n\n/// @dev The unit number, which gives the decimal precision of SD1x18.\nSD1x18 constant UNIT = SD1x18.wrap(1e18);\nint64 constant uUNIT = 1e18;\n" + }, + "@prb/math/src/sd1x18/Errors.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport { SD1x18 } from \"./ValueType.sol\";\n\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in UD2x18.\nerror PRBMath_SD1x18_ToUD2x18_Underflow(SD1x18 x);\n\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in UD60x18.\nerror PRBMath_SD1x18_ToUD60x18_Underflow(SD1x18 x);\n\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint128.\nerror PRBMath_SD1x18_ToUint128_Underflow(SD1x18 x);\n\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint256.\nerror PRBMath_SD1x18_ToUint256_Underflow(SD1x18 x);\n\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint40.\nerror PRBMath_SD1x18_ToUint40_Overflow(SD1x18 x);\n\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint40.\nerror PRBMath_SD1x18_ToUint40_Underflow(SD1x18 x);\n" + }, + "@prb/math/src/sd1x18/ValueType.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport \"./Casting.sol\" as Casting;\n\n/// @notice The signed 1.18-decimal fixed-point number representation, which can have up to 1 digit and up to 18\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\n/// type int64. This is useful when end users want to use int64 to save gas, e.g. with tight variable packing in contract\n/// storage.\ntype SD1x18 is int64;\n\n/*//////////////////////////////////////////////////////////////////////////\n CASTING\n//////////////////////////////////////////////////////////////////////////*/\n\nusing {\n Casting.intoSD59x18,\n Casting.intoUD2x18,\n Casting.intoUD60x18,\n Casting.intoUint256,\n Casting.intoUint128,\n Casting.intoUint40,\n Casting.unwrap\n} for SD1x18 global;\n" + }, + "@prb/math/src/sd59x18/Casting.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport \"./Errors.sol\" as CastingErrors;\nimport { MAX_UINT128, MAX_UINT40 } from \"../Common.sol\";\nimport { uMAX_SD1x18, uMIN_SD1x18 } from \"../sd1x18/Constants.sol\";\nimport { SD1x18 } from \"../sd1x18/ValueType.sol\";\nimport { uMAX_UD2x18 } from \"../ud2x18/Constants.sol\";\nimport { UD2x18 } from \"../ud2x18/ValueType.sol\";\nimport { UD60x18 } from \"../ud60x18/ValueType.sol\";\nimport { SD59x18 } from \"./ValueType.sol\";\n\n/// @notice Casts an SD59x18 number into int256.\n/// @dev This is basically a functional alias for {unwrap}.\nfunction intoInt256(SD59x18 x) pure returns (int256 result) {\n result = SD59x18.unwrap(x);\n}\n\n/// @notice Casts an SD59x18 number into SD1x18.\n/// @dev Requirements:\n/// - x must be greater than or equal to `uMIN_SD1x18`.\n/// - x must be less than or equal to `uMAX_SD1x18`.\nfunction intoSD1x18(SD59x18 x) pure returns (SD1x18 result) {\n int256 xInt = SD59x18.unwrap(x);\n if (xInt < uMIN_SD1x18) {\n revert CastingErrors.PRBMath_SD59x18_IntoSD1x18_Underflow(x);\n }\n if (xInt > uMAX_SD1x18) {\n revert CastingErrors.PRBMath_SD59x18_IntoSD1x18_Overflow(x);\n }\n result = SD1x18.wrap(int64(xInt));\n}\n\n/// @notice Casts an SD59x18 number into UD2x18.\n/// @dev Requirements:\n/// - x must be positive.\n/// - x must be less than or equal to `uMAX_UD2x18`.\nfunction intoUD2x18(SD59x18 x) pure returns (UD2x18 result) {\n int256 xInt = SD59x18.unwrap(x);\n if (xInt < 0) {\n revert CastingErrors.PRBMath_SD59x18_IntoUD2x18_Underflow(x);\n }\n if (xInt > int256(uint256(uMAX_UD2x18))) {\n revert CastingErrors.PRBMath_SD59x18_IntoUD2x18_Overflow(x);\n }\n result = UD2x18.wrap(uint64(uint256(xInt)));\n}\n\n/// @notice Casts an SD59x18 number into UD60x18.\n/// @dev Requirements:\n/// - x must be positive.\nfunction intoUD60x18(SD59x18 x) pure returns (UD60x18 result) {\n int256 xInt = SD59x18.unwrap(x);\n if (xInt < 0) {\n revert CastingErrors.PRBMath_SD59x18_IntoUD60x18_Underflow(x);\n }\n result = UD60x18.wrap(uint256(xInt));\n}\n\n/// @notice Casts an SD59x18 number into uint256.\n/// @dev Requirements:\n/// - x must be positive.\nfunction intoUint256(SD59x18 x) pure returns (uint256 result) {\n int256 xInt = SD59x18.unwrap(x);\n if (xInt < 0) {\n revert CastingErrors.PRBMath_SD59x18_IntoUint256_Underflow(x);\n }\n result = uint256(xInt);\n}\n\n/// @notice Casts an SD59x18 number into uint128.\n/// @dev Requirements:\n/// - x must be positive.\n/// - x must be less than or equal to `uMAX_UINT128`.\nfunction intoUint128(SD59x18 x) pure returns (uint128 result) {\n int256 xInt = SD59x18.unwrap(x);\n if (xInt < 0) {\n revert CastingErrors.PRBMath_SD59x18_IntoUint128_Underflow(x);\n }\n if (xInt > int256(uint256(MAX_UINT128))) {\n revert CastingErrors.PRBMath_SD59x18_IntoUint128_Overflow(x);\n }\n result = uint128(uint256(xInt));\n}\n\n/// @notice Casts an SD59x18 number into uint40.\n/// @dev Requirements:\n/// - x must be positive.\n/// - x must be less than or equal to `MAX_UINT40`.\nfunction intoUint40(SD59x18 x) pure returns (uint40 result) {\n int256 xInt = SD59x18.unwrap(x);\n if (xInt < 0) {\n revert CastingErrors.PRBMath_SD59x18_IntoUint40_Underflow(x);\n }\n if (xInt > int256(uint256(MAX_UINT40))) {\n revert CastingErrors.PRBMath_SD59x18_IntoUint40_Overflow(x);\n }\n result = uint40(uint256(xInt));\n}\n\n/// @notice Alias for {wrap}.\nfunction sd(int256 x) pure returns (SD59x18 result) {\n result = SD59x18.wrap(x);\n}\n\n/// @notice Alias for {wrap}.\nfunction sd59x18(int256 x) pure returns (SD59x18 result) {\n result = SD59x18.wrap(x);\n}\n\n/// @notice Unwraps an SD59x18 number into int256.\nfunction unwrap(SD59x18 x) pure returns (int256 result) {\n result = SD59x18.unwrap(x);\n}\n\n/// @notice Wraps an int256 number into SD59x18.\nfunction wrap(int256 x) pure returns (SD59x18 result) {\n result = SD59x18.wrap(x);\n}\n" + }, + "@prb/math/src/sd59x18/Constants.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport { SD59x18 } from \"./ValueType.sol\";\n\n// NOTICE: the \"u\" prefix stands for \"unwrapped\".\n\n/// @dev Euler's number as an SD59x18 number.\nSD59x18 constant E = SD59x18.wrap(2_718281828459045235);\n\n/// @dev The maximum input permitted in {exp}.\nint256 constant uEXP_MAX_INPUT = 133_084258667509499440;\nSD59x18 constant EXP_MAX_INPUT = SD59x18.wrap(uEXP_MAX_INPUT);\n\n/// @dev Any value less than this returns 0 in {exp}.\nint256 constant uEXP_MIN_THRESHOLD = -41_446531673892822322;\nSD59x18 constant EXP_MIN_THRESHOLD = SD59x18.wrap(uEXP_MIN_THRESHOLD);\n\n/// @dev The maximum input permitted in {exp2}.\nint256 constant uEXP2_MAX_INPUT = 192e18 - 1;\nSD59x18 constant EXP2_MAX_INPUT = SD59x18.wrap(uEXP2_MAX_INPUT);\n\n/// @dev Any value less than this returns 0 in {exp2}.\nint256 constant uEXP2_MIN_THRESHOLD = -59_794705707972522261;\nSD59x18 constant EXP2_MIN_THRESHOLD = SD59x18.wrap(uEXP2_MIN_THRESHOLD);\n\n/// @dev Half the UNIT number.\nint256 constant uHALF_UNIT = 0.5e18;\nSD59x18 constant HALF_UNIT = SD59x18.wrap(uHALF_UNIT);\n\n/// @dev $log_2(10)$ as an SD59x18 number.\nint256 constant uLOG2_10 = 3_321928094887362347;\nSD59x18 constant LOG2_10 = SD59x18.wrap(uLOG2_10);\n\n/// @dev $log_2(e)$ as an SD59x18 number.\nint256 constant uLOG2_E = 1_442695040888963407;\nSD59x18 constant LOG2_E = SD59x18.wrap(uLOG2_E);\n\n/// @dev The maximum value an SD59x18 number can have.\nint256 constant uMAX_SD59x18 = 57896044618658097711785492504343953926634992332820282019728_792003956564819967;\nSD59x18 constant MAX_SD59x18 = SD59x18.wrap(uMAX_SD59x18);\n\n/// @dev The maximum whole value an SD59x18 number can have.\nint256 constant uMAX_WHOLE_SD59x18 = 57896044618658097711785492504343953926634992332820282019728_000000000000000000;\nSD59x18 constant MAX_WHOLE_SD59x18 = SD59x18.wrap(uMAX_WHOLE_SD59x18);\n\n/// @dev The minimum value an SD59x18 number can have.\nint256 constant uMIN_SD59x18 = -57896044618658097711785492504343953926634992332820282019728_792003956564819968;\nSD59x18 constant MIN_SD59x18 = SD59x18.wrap(uMIN_SD59x18);\n\n/// @dev The minimum whole value an SD59x18 number can have.\nint256 constant uMIN_WHOLE_SD59x18 = -57896044618658097711785492504343953926634992332820282019728_000000000000000000;\nSD59x18 constant MIN_WHOLE_SD59x18 = SD59x18.wrap(uMIN_WHOLE_SD59x18);\n\n/// @dev PI as an SD59x18 number.\nSD59x18 constant PI = SD59x18.wrap(3_141592653589793238);\n\n/// @dev The unit number, which gives the decimal precision of SD59x18.\nint256 constant uUNIT = 1e18;\nSD59x18 constant UNIT = SD59x18.wrap(1e18);\n\n/// @dev The unit number squared.\nint256 constant uUNIT_SQUARED = 1e36;\nSD59x18 constant UNIT_SQUARED = SD59x18.wrap(uUNIT_SQUARED);\n\n/// @dev Zero as an SD59x18 number.\nSD59x18 constant ZERO = SD59x18.wrap(0);\n" + }, + "@prb/math/src/sd59x18/Errors.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport { SD59x18 } from \"./ValueType.sol\";\n\n/// @notice Thrown when taking the absolute value of `MIN_SD59x18`.\nerror PRBMath_SD59x18_Abs_MinSD59x18();\n\n/// @notice Thrown when ceiling a number overflows SD59x18.\nerror PRBMath_SD59x18_Ceil_Overflow(SD59x18 x);\n\n/// @notice Thrown when converting a basic integer to the fixed-point format overflows SD59x18.\nerror PRBMath_SD59x18_Convert_Overflow(int256 x);\n\n/// @notice Thrown when converting a basic integer to the fixed-point format underflows SD59x18.\nerror PRBMath_SD59x18_Convert_Underflow(int256 x);\n\n/// @notice Thrown when dividing two numbers and one of them is `MIN_SD59x18`.\nerror PRBMath_SD59x18_Div_InputTooSmall();\n\n/// @notice Thrown when dividing two numbers and one of the intermediary unsigned results overflows SD59x18.\nerror PRBMath_SD59x18_Div_Overflow(SD59x18 x, SD59x18 y);\n\n/// @notice Thrown when taking the natural exponent of a base greater than 133_084258667509499441.\nerror PRBMath_SD59x18_Exp_InputTooBig(SD59x18 x);\n\n/// @notice Thrown when taking the binary exponent of a base greater than 192e18.\nerror PRBMath_SD59x18_Exp2_InputTooBig(SD59x18 x);\n\n/// @notice Thrown when flooring a number underflows SD59x18.\nerror PRBMath_SD59x18_Floor_Underflow(SD59x18 x);\n\n/// @notice Thrown when taking the geometric mean of two numbers and their product is negative.\nerror PRBMath_SD59x18_Gm_NegativeProduct(SD59x18 x, SD59x18 y);\n\n/// @notice Thrown when taking the geometric mean of two numbers and multiplying them overflows SD59x18.\nerror PRBMath_SD59x18_Gm_Overflow(SD59x18 x, SD59x18 y);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\nerror PRBMath_SD59x18_IntoSD1x18_Overflow(SD59x18 x);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\nerror PRBMath_SD59x18_IntoSD1x18_Underflow(SD59x18 x);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\nerror PRBMath_SD59x18_IntoUD2x18_Overflow(SD59x18 x);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\nerror PRBMath_SD59x18_IntoUD2x18_Underflow(SD59x18 x);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD60x18.\nerror PRBMath_SD59x18_IntoUD60x18_Underflow(SD59x18 x);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\nerror PRBMath_SD59x18_IntoUint128_Overflow(SD59x18 x);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\nerror PRBMath_SD59x18_IntoUint128_Underflow(SD59x18 x);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint256.\nerror PRBMath_SD59x18_IntoUint256_Underflow(SD59x18 x);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\nerror PRBMath_SD59x18_IntoUint40_Overflow(SD59x18 x);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\nerror PRBMath_SD59x18_IntoUint40_Underflow(SD59x18 x);\n\n/// @notice Thrown when taking the logarithm of a number less than or equal to zero.\nerror PRBMath_SD59x18_Log_InputTooSmall(SD59x18 x);\n\n/// @notice Thrown when multiplying two numbers and one of the inputs is `MIN_SD59x18`.\nerror PRBMath_SD59x18_Mul_InputTooSmall();\n\n/// @notice Thrown when multiplying two numbers and the intermediary absolute result overflows SD59x18.\nerror PRBMath_SD59x18_Mul_Overflow(SD59x18 x, SD59x18 y);\n\n/// @notice Thrown when raising a number to a power and the intermediary absolute result overflows SD59x18.\nerror PRBMath_SD59x18_Powu_Overflow(SD59x18 x, uint256 y);\n\n/// @notice Thrown when taking the square root of a negative number.\nerror PRBMath_SD59x18_Sqrt_NegativeInput(SD59x18 x);\n\n/// @notice Thrown when the calculating the square root overflows SD59x18.\nerror PRBMath_SD59x18_Sqrt_Overflow(SD59x18 x);\n" + }, + "@prb/math/src/sd59x18/Helpers.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport { wrap } from \"./Casting.sol\";\nimport { SD59x18 } from \"./ValueType.sol\";\n\n/// @notice Implements the checked addition operation (+) in the SD59x18 type.\nfunction add(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\n return wrap(x.unwrap() + y.unwrap());\n}\n\n/// @notice Implements the AND (&) bitwise operation in the SD59x18 type.\nfunction and(SD59x18 x, int256 bits) pure returns (SD59x18 result) {\n return wrap(x.unwrap() & bits);\n}\n\n/// @notice Implements the AND (&) bitwise operation in the SD59x18 type.\nfunction and2(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\n return wrap(x.unwrap() & y.unwrap());\n}\n\n/// @notice Implements the equal (=) operation in the SD59x18 type.\nfunction eq(SD59x18 x, SD59x18 y) pure returns (bool result) {\n result = x.unwrap() == y.unwrap();\n}\n\n/// @notice Implements the greater than operation (>) in the SD59x18 type.\nfunction gt(SD59x18 x, SD59x18 y) pure returns (bool result) {\n result = x.unwrap() > y.unwrap();\n}\n\n/// @notice Implements the greater than or equal to operation (>=) in the SD59x18 type.\nfunction gte(SD59x18 x, SD59x18 y) pure returns (bool result) {\n result = x.unwrap() >= y.unwrap();\n}\n\n/// @notice Implements a zero comparison check function in the SD59x18 type.\nfunction isZero(SD59x18 x) pure returns (bool result) {\n result = x.unwrap() == 0;\n}\n\n/// @notice Implements the left shift operation (<<) in the SD59x18 type.\nfunction lshift(SD59x18 x, uint256 bits) pure returns (SD59x18 result) {\n result = wrap(x.unwrap() << bits);\n}\n\n/// @notice Implements the lower than operation (<) in the SD59x18 type.\nfunction lt(SD59x18 x, SD59x18 y) pure returns (bool result) {\n result = x.unwrap() < y.unwrap();\n}\n\n/// @notice Implements the lower than or equal to operation (<=) in the SD59x18 type.\nfunction lte(SD59x18 x, SD59x18 y) pure returns (bool result) {\n result = x.unwrap() <= y.unwrap();\n}\n\n/// @notice Implements the unchecked modulo operation (%) in the SD59x18 type.\nfunction mod(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\n result = wrap(x.unwrap() % y.unwrap());\n}\n\n/// @notice Implements the not equal operation (!=) in the SD59x18 type.\nfunction neq(SD59x18 x, SD59x18 y) pure returns (bool result) {\n result = x.unwrap() != y.unwrap();\n}\n\n/// @notice Implements the NOT (~) bitwise operation in the SD59x18 type.\nfunction not(SD59x18 x) pure returns (SD59x18 result) {\n result = wrap(~x.unwrap());\n}\n\n/// @notice Implements the OR (|) bitwise operation in the SD59x18 type.\nfunction or(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\n result = wrap(x.unwrap() | y.unwrap());\n}\n\n/// @notice Implements the right shift operation (>>) in the SD59x18 type.\nfunction rshift(SD59x18 x, uint256 bits) pure returns (SD59x18 result) {\n result = wrap(x.unwrap() >> bits);\n}\n\n/// @notice Implements the checked subtraction operation (-) in the SD59x18 type.\nfunction sub(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\n result = wrap(x.unwrap() - y.unwrap());\n}\n\n/// @notice Implements the checked unary minus operation (-) in the SD59x18 type.\nfunction unary(SD59x18 x) pure returns (SD59x18 result) {\n result = wrap(-x.unwrap());\n}\n\n/// @notice Implements the unchecked addition operation (+) in the SD59x18 type.\nfunction uncheckedAdd(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\n unchecked {\n result = wrap(x.unwrap() + y.unwrap());\n }\n}\n\n/// @notice Implements the unchecked subtraction operation (-) in the SD59x18 type.\nfunction uncheckedSub(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\n unchecked {\n result = wrap(x.unwrap() - y.unwrap());\n }\n}\n\n/// @notice Implements the unchecked unary minus operation (-) in the SD59x18 type.\nfunction uncheckedUnary(SD59x18 x) pure returns (SD59x18 result) {\n unchecked {\n result = wrap(-x.unwrap());\n }\n}\n\n/// @notice Implements the XOR (^) bitwise operation in the SD59x18 type.\nfunction xor(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\n result = wrap(x.unwrap() ^ y.unwrap());\n}\n" + }, + "@prb/math/src/sd59x18/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport \"../Common.sol\" as Common;\nimport \"./Errors.sol\" as Errors;\nimport {\n uEXP_MAX_INPUT,\n uEXP2_MAX_INPUT,\n uEXP_MIN_THRESHOLD,\n uEXP2_MIN_THRESHOLD,\n uHALF_UNIT,\n uLOG2_10,\n uLOG2_E,\n uMAX_SD59x18,\n uMAX_WHOLE_SD59x18,\n uMIN_SD59x18,\n uMIN_WHOLE_SD59x18,\n UNIT,\n uUNIT,\n uUNIT_SQUARED,\n ZERO\n} from \"./Constants.sol\";\nimport { wrap } from \"./Helpers.sol\";\nimport { SD59x18 } from \"./ValueType.sol\";\n\n/// @notice Calculates the absolute value of x.\n///\n/// @dev Requirements:\n/// - x must be greater than `MIN_SD59x18`.\n///\n/// @param x The SD59x18 number for which to calculate the absolute value.\n/// @param result The absolute value of x as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction abs(SD59x18 x) pure returns (SD59x18 result) {\n int256 xInt = x.unwrap();\n if (xInt == uMIN_SD59x18) {\n revert Errors.PRBMath_SD59x18_Abs_MinSD59x18();\n }\n result = xInt < 0 ? wrap(-xInt) : x;\n}\n\n/// @notice Calculates the arithmetic average of x and y.\n///\n/// @dev Notes:\n/// - The result is rounded toward zero.\n///\n/// @param x The first operand as an SD59x18 number.\n/// @param y The second operand as an SD59x18 number.\n/// @return result The arithmetic average as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction avg(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\n int256 xInt = x.unwrap();\n int256 yInt = y.unwrap();\n\n unchecked {\n // This operation is equivalent to `x / 2 + y / 2`, and it can never overflow.\n int256 sum = (xInt >> 1) + (yInt >> 1);\n\n if (sum < 0) {\n // If at least one of x and y is odd, add 1 to the result, because shifting negative numbers to the right\n // rounds toward negative infinity. The right part is equivalent to `sum + (x % 2 == 1 || y % 2 == 1)`.\n assembly (\"memory-safe\") {\n result := add(sum, and(or(xInt, yInt), 1))\n }\n } else {\n // Add 1 if both x and y are odd to account for the double 0.5 remainder truncated after shifting.\n result = wrap(sum + (xInt & yInt & 1));\n }\n }\n}\n\n/// @notice Yields the smallest whole number greater than or equal to x.\n///\n/// @dev Optimized for fractional value inputs, because every whole value has (1e18 - 1) fractional counterparts.\n/// See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\n///\n/// Requirements:\n/// - x must be less than or equal to `MAX_WHOLE_SD59x18`.\n///\n/// @param x The SD59x18 number to ceil.\n/// @param result The smallest whole number greater than or equal to x, as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction ceil(SD59x18 x) pure returns (SD59x18 result) {\n int256 xInt = x.unwrap();\n if (xInt > uMAX_WHOLE_SD59x18) {\n revert Errors.PRBMath_SD59x18_Ceil_Overflow(x);\n }\n\n int256 remainder = xInt % uUNIT;\n if (remainder == 0) {\n result = x;\n } else {\n unchecked {\n // Solidity uses C fmod style, which returns a modulus with the same sign as x.\n int256 resultInt = xInt - remainder;\n if (xInt > 0) {\n resultInt += uUNIT;\n }\n result = wrap(resultInt);\n }\n }\n}\n\n/// @notice Divides two SD59x18 numbers, returning a new SD59x18 number.\n///\n/// @dev This is an extension of {Common.mulDiv} for signed numbers, which works by computing the signs and the absolute\n/// values separately.\n///\n/// Notes:\n/// - Refer to the notes in {Common.mulDiv}.\n/// - The result is rounded toward zero.\n///\n/// Requirements:\n/// - Refer to the requirements in {Common.mulDiv}.\n/// - None of the inputs can be `MIN_SD59x18`.\n/// - The denominator must not be zero.\n/// - The result must fit in SD59x18.\n///\n/// @param x The numerator as an SD59x18 number.\n/// @param y The denominator as an SD59x18 number.\n/// @param result The quotient as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction div(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\n int256 xInt = x.unwrap();\n int256 yInt = y.unwrap();\n if (xInt == uMIN_SD59x18 || yInt == uMIN_SD59x18) {\n revert Errors.PRBMath_SD59x18_Div_InputTooSmall();\n }\n\n // Get hold of the absolute values of x and y.\n uint256 xAbs;\n uint256 yAbs;\n unchecked {\n xAbs = xInt < 0 ? uint256(-xInt) : uint256(xInt);\n yAbs = yInt < 0 ? uint256(-yInt) : uint256(yInt);\n }\n\n // Compute the absolute value (x*UNIT÷y). The resulting value must fit in SD59x18.\n uint256 resultAbs = Common.mulDiv(xAbs, uint256(uUNIT), yAbs);\n if (resultAbs > uint256(uMAX_SD59x18)) {\n revert Errors.PRBMath_SD59x18_Div_Overflow(x, y);\n }\n\n // Check if x and y have the same sign using two's complement representation. The left-most bit represents the sign (1 for\n // negative, 0 for positive or zero).\n bool sameSign = (xInt ^ yInt) > -1;\n\n // If the inputs have the same sign, the result should be positive. Otherwise, it should be negative.\n unchecked {\n result = wrap(sameSign ? int256(resultAbs) : -int256(resultAbs));\n }\n}\n\n/// @notice Calculates the natural exponent of x using the following formula:\n///\n/// $$\n/// e^x = 2^{x * log_2{e}}\n/// $$\n///\n/// @dev Notes:\n/// - Refer to the notes in {exp2}.\n///\n/// Requirements:\n/// - Refer to the requirements in {exp2}.\n/// - x must be less than 133_084258667509499441.\n///\n/// @param x The exponent as an SD59x18 number.\n/// @return result The result as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction exp(SD59x18 x) pure returns (SD59x18 result) {\n int256 xInt = x.unwrap();\n\n // Any input less than the threshold returns zero.\n // This check also prevents an overflow for very small numbers.\n if (xInt < uEXP_MIN_THRESHOLD) {\n return ZERO;\n }\n\n // This check prevents values greater than 192e18 from being passed to {exp2}.\n if (xInt > uEXP_MAX_INPUT) {\n revert Errors.PRBMath_SD59x18_Exp_InputTooBig(x);\n }\n\n unchecked {\n // Inline the fixed-point multiplication to save gas.\n int256 doubleUnitProduct = xInt * uLOG2_E;\n result = exp2(wrap(doubleUnitProduct / uUNIT));\n }\n}\n\n/// @notice Calculates the binary exponent of x using the binary fraction method using the following formula:\n///\n/// $$\n/// 2^{-x} = \\frac{1}{2^x}\n/// $$\n///\n/// @dev See https://ethereum.stackexchange.com/q/79903/24693.\n///\n/// Notes:\n/// - If x is less than -59_794705707972522261, the result is zero.\n///\n/// Requirements:\n/// - x must be less than 192e18.\n/// - The result must fit in SD59x18.\n///\n/// @param x The exponent as an SD59x18 number.\n/// @return result The result as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction exp2(SD59x18 x) pure returns (SD59x18 result) {\n int256 xInt = x.unwrap();\n if (xInt < 0) {\n // The inverse of any number less than the threshold is truncated to zero.\n if (xInt < uEXP2_MIN_THRESHOLD) {\n return ZERO;\n }\n\n unchecked {\n // Inline the fixed-point inversion to save gas.\n result = wrap(uUNIT_SQUARED / exp2(wrap(-xInt)).unwrap());\n }\n } else {\n // Numbers greater than or equal to 192e18 don't fit in the 192.64-bit format.\n if (xInt > uEXP2_MAX_INPUT) {\n revert Errors.PRBMath_SD59x18_Exp2_InputTooBig(x);\n }\n\n unchecked {\n // Convert x to the 192.64-bit fixed-point format.\n uint256 x_192x64 = uint256((xInt << 64) / uUNIT);\n\n // It is safe to cast the result to int256 due to the checks above.\n result = wrap(int256(Common.exp2(x_192x64)));\n }\n }\n}\n\n/// @notice Yields the greatest whole number less than or equal to x.\n///\n/// @dev Optimized for fractional value inputs, because for every whole value there are (1e18 - 1) fractional\n/// counterparts. See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\n///\n/// Requirements:\n/// - x must be greater than or equal to `MIN_WHOLE_SD59x18`.\n///\n/// @param x The SD59x18 number to floor.\n/// @param result The greatest whole number less than or equal to x, as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction floor(SD59x18 x) pure returns (SD59x18 result) {\n int256 xInt = x.unwrap();\n if (xInt < uMIN_WHOLE_SD59x18) {\n revert Errors.PRBMath_SD59x18_Floor_Underflow(x);\n }\n\n int256 remainder = xInt % uUNIT;\n if (remainder == 0) {\n result = x;\n } else {\n unchecked {\n // Solidity uses C fmod style, which returns a modulus with the same sign as x.\n int256 resultInt = xInt - remainder;\n if (xInt < 0) {\n resultInt -= uUNIT;\n }\n result = wrap(resultInt);\n }\n }\n}\n\n/// @notice Yields the excess beyond the floor of x for positive numbers and the part of the number to the right.\n/// of the radix point for negative numbers.\n/// @dev Based on the odd function definition. https://en.wikipedia.org/wiki/Fractional_part\n/// @param x The SD59x18 number to get the fractional part of.\n/// @param result The fractional part of x as an SD59x18 number.\nfunction frac(SD59x18 x) pure returns (SD59x18 result) {\n result = wrap(x.unwrap() % uUNIT);\n}\n\n/// @notice Calculates the geometric mean of x and y, i.e. $\\sqrt{x * y}$.\n///\n/// @dev Notes:\n/// - The result is rounded toward zero.\n///\n/// Requirements:\n/// - x * y must fit in SD59x18.\n/// - x * y must not be negative, since complex numbers are not supported.\n///\n/// @param x The first operand as an SD59x18 number.\n/// @param y The second operand as an SD59x18 number.\n/// @return result The result as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction gm(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\n int256 xInt = x.unwrap();\n int256 yInt = y.unwrap();\n if (xInt == 0 || yInt == 0) {\n return ZERO;\n }\n\n unchecked {\n // Equivalent to `xy / x != y`. Checking for overflow this way is faster than letting Solidity do it.\n int256 xyInt = xInt * yInt;\n if (xyInt / xInt != yInt) {\n revert Errors.PRBMath_SD59x18_Gm_Overflow(x, y);\n }\n\n // The product must not be negative, since complex numbers are not supported.\n if (xyInt < 0) {\n revert Errors.PRBMath_SD59x18_Gm_NegativeProduct(x, y);\n }\n\n // We don't need to multiply the result by `UNIT` here because the x*y product picked up a factor of `UNIT`\n // during multiplication. See the comments in {Common.sqrt}.\n uint256 resultUint = Common.sqrt(uint256(xyInt));\n result = wrap(int256(resultUint));\n }\n}\n\n/// @notice Calculates the inverse of x.\n///\n/// @dev Notes:\n/// - The result is rounded toward zero.\n///\n/// Requirements:\n/// - x must not be zero.\n///\n/// @param x The SD59x18 number for which to calculate the inverse.\n/// @return result The inverse as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction inv(SD59x18 x) pure returns (SD59x18 result) {\n result = wrap(uUNIT_SQUARED / x.unwrap());\n}\n\n/// @notice Calculates the natural logarithm of x using the following formula:\n///\n/// $$\n/// ln{x} = log_2{x} / log_2{e}\n/// $$\n///\n/// @dev Notes:\n/// - Refer to the notes in {log2}.\n/// - The precision isn't sufficiently fine-grained to return exactly `UNIT` when the input is `E`.\n///\n/// Requirements:\n/// - Refer to the requirements in {log2}.\n///\n/// @param x The SD59x18 number for which to calculate the natural logarithm.\n/// @return result The natural logarithm as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction ln(SD59x18 x) pure returns (SD59x18 result) {\n // Inline the fixed-point multiplication to save gas. This is overflow-safe because the maximum value that\n // {log2} can return is ~195_205294292027477728.\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_E);\n}\n\n/// @notice Calculates the common logarithm of x using the following formula:\n///\n/// $$\n/// log_{10}{x} = log_2{x} / log_2{10}\n/// $$\n///\n/// However, if x is an exact power of ten, a hard coded value is returned.\n///\n/// @dev Notes:\n/// - Refer to the notes in {log2}.\n///\n/// Requirements:\n/// - Refer to the requirements in {log2}.\n///\n/// @param x The SD59x18 number for which to calculate the common logarithm.\n/// @return result The common logarithm as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction log10(SD59x18 x) pure returns (SD59x18 result) {\n int256 xInt = x.unwrap();\n if (xInt < 0) {\n revert Errors.PRBMath_SD59x18_Log_InputTooSmall(x);\n }\n\n // Note that the `mul` in this block is the standard multiplication operation, not {SD59x18.mul}.\n // prettier-ignore\n assembly (\"memory-safe\") {\n switch x\n case 1 { result := mul(uUNIT, sub(0, 18)) }\n case 10 { result := mul(uUNIT, sub(1, 18)) }\n case 100 { result := mul(uUNIT, sub(2, 18)) }\n case 1000 { result := mul(uUNIT, sub(3, 18)) }\n case 10000 { result := mul(uUNIT, sub(4, 18)) }\n case 100000 { result := mul(uUNIT, sub(5, 18)) }\n case 1000000 { result := mul(uUNIT, sub(6, 18)) }\n case 10000000 { result := mul(uUNIT, sub(7, 18)) }\n case 100000000 { result := mul(uUNIT, sub(8, 18)) }\n case 1000000000 { result := mul(uUNIT, sub(9, 18)) }\n case 10000000000 { result := mul(uUNIT, sub(10, 18)) }\n case 100000000000 { result := mul(uUNIT, sub(11, 18)) }\n case 1000000000000 { result := mul(uUNIT, sub(12, 18)) }\n case 10000000000000 { result := mul(uUNIT, sub(13, 18)) }\n case 100000000000000 { result := mul(uUNIT, sub(14, 18)) }\n case 1000000000000000 { result := mul(uUNIT, sub(15, 18)) }\n case 10000000000000000 { result := mul(uUNIT, sub(16, 18)) }\n case 100000000000000000 { result := mul(uUNIT, sub(17, 18)) }\n case 1000000000000000000 { result := 0 }\n case 10000000000000000000 { result := uUNIT }\n case 100000000000000000000 { result := mul(uUNIT, 2) }\n case 1000000000000000000000 { result := mul(uUNIT, 3) }\n case 10000000000000000000000 { result := mul(uUNIT, 4) }\n case 100000000000000000000000 { result := mul(uUNIT, 5) }\n case 1000000000000000000000000 { result := mul(uUNIT, 6) }\n case 10000000000000000000000000 { result := mul(uUNIT, 7) }\n case 100000000000000000000000000 { result := mul(uUNIT, 8) }\n case 1000000000000000000000000000 { result := mul(uUNIT, 9) }\n case 10000000000000000000000000000 { result := mul(uUNIT, 10) }\n case 100000000000000000000000000000 { result := mul(uUNIT, 11) }\n case 1000000000000000000000000000000 { result := mul(uUNIT, 12) }\n case 10000000000000000000000000000000 { result := mul(uUNIT, 13) }\n case 100000000000000000000000000000000 { result := mul(uUNIT, 14) }\n case 1000000000000000000000000000000000 { result := mul(uUNIT, 15) }\n case 10000000000000000000000000000000000 { result := mul(uUNIT, 16) }\n case 100000000000000000000000000000000000 { result := mul(uUNIT, 17) }\n case 1000000000000000000000000000000000000 { result := mul(uUNIT, 18) }\n case 10000000000000000000000000000000000000 { result := mul(uUNIT, 19) }\n case 100000000000000000000000000000000000000 { result := mul(uUNIT, 20) }\n case 1000000000000000000000000000000000000000 { result := mul(uUNIT, 21) }\n case 10000000000000000000000000000000000000000 { result := mul(uUNIT, 22) }\n case 100000000000000000000000000000000000000000 { result := mul(uUNIT, 23) }\n case 1000000000000000000000000000000000000000000 { result := mul(uUNIT, 24) }\n case 10000000000000000000000000000000000000000000 { result := mul(uUNIT, 25) }\n case 100000000000000000000000000000000000000000000 { result := mul(uUNIT, 26) }\n case 1000000000000000000000000000000000000000000000 { result := mul(uUNIT, 27) }\n case 10000000000000000000000000000000000000000000000 { result := mul(uUNIT, 28) }\n case 100000000000000000000000000000000000000000000000 { result := mul(uUNIT, 29) }\n case 1000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 30) }\n case 10000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 31) }\n case 100000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 32) }\n case 1000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 33) }\n case 10000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 34) }\n case 100000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 35) }\n case 1000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 36) }\n case 10000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 37) }\n case 100000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 38) }\n case 1000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 39) }\n case 10000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 40) }\n case 100000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 41) }\n case 1000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 42) }\n case 10000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 43) }\n case 100000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 44) }\n case 1000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 45) }\n case 10000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 46) }\n case 100000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 47) }\n case 1000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 48) }\n case 10000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 49) }\n case 100000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 50) }\n case 1000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 51) }\n case 10000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 52) }\n case 100000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 53) }\n case 1000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 54) }\n case 10000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 55) }\n case 100000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 56) }\n case 1000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 57) }\n case 10000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 58) }\n default { result := uMAX_SD59x18 }\n }\n\n if (result.unwrap() == uMAX_SD59x18) {\n unchecked {\n // Inline the fixed-point division to save gas.\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_10);\n }\n }\n}\n\n/// @notice Calculates the binary logarithm of x using the iterative approximation algorithm:\n///\n/// $$\n/// log_2{x} = n + log_2{y}, \\text{ where } y = x*2^{-n}, \\ y \\in [1, 2)\n/// $$\n///\n/// For $0 \\leq x \\lt 1$, the input is inverted:\n///\n/// $$\n/// log_2{x} = -log_2{\\frac{1}{x}}\n/// $$\n///\n/// @dev See https://en.wikipedia.org/wiki/Binary_logarithm#Iterative_approximation.\n///\n/// Notes:\n/// - Due to the lossy precision of the iterative approximation, the results are not perfectly accurate to the last decimal.\n///\n/// Requirements:\n/// - x must be greater than zero.\n///\n/// @param x The SD59x18 number for which to calculate the binary logarithm.\n/// @return result The binary logarithm as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction log2(SD59x18 x) pure returns (SD59x18 result) {\n int256 xInt = x.unwrap();\n if (xInt <= 0) {\n revert Errors.PRBMath_SD59x18_Log_InputTooSmall(x);\n }\n\n unchecked {\n int256 sign;\n if (xInt >= uUNIT) {\n sign = 1;\n } else {\n sign = -1;\n // Inline the fixed-point inversion to save gas.\n xInt = uUNIT_SQUARED / xInt;\n }\n\n // Calculate the integer part of the logarithm.\n uint256 n = Common.msb(uint256(xInt / uUNIT));\n\n // This is the integer part of the logarithm as an SD59x18 number. The operation can't overflow\n // because n is at most 255, `UNIT` is 1e18, and the sign is either 1 or -1.\n int256 resultInt = int256(n) * uUNIT;\n\n // Calculate $y = x * 2^{-n}$.\n int256 y = xInt >> n;\n\n // If y is the unit number, the fractional part is zero.\n if (y == uUNIT) {\n return wrap(resultInt * sign);\n }\n\n // Calculate the fractional part via the iterative approximation.\n // The `delta >>= 1` part is equivalent to `delta /= 2`, but shifting bits is more gas efficient.\n int256 DOUBLE_UNIT = 2e18;\n for (int256 delta = uHALF_UNIT; delta > 0; delta >>= 1) {\n y = (y * y) / uUNIT;\n\n // Is y^2 >= 2e18 and so in the range [2e18, 4e18)?\n if (y >= DOUBLE_UNIT) {\n // Add the 2^{-m} factor to the logarithm.\n resultInt = resultInt + delta;\n\n // Halve y, which corresponds to z/2 in the Wikipedia article.\n y >>= 1;\n }\n }\n resultInt *= sign;\n result = wrap(resultInt);\n }\n}\n\n/// @notice Multiplies two SD59x18 numbers together, returning a new SD59x18 number.\n///\n/// @dev Notes:\n/// - Refer to the notes in {Common.mulDiv18}.\n///\n/// Requirements:\n/// - Refer to the requirements in {Common.mulDiv18}.\n/// - None of the inputs can be `MIN_SD59x18`.\n/// - The result must fit in SD59x18.\n///\n/// @param x The multiplicand as an SD59x18 number.\n/// @param y The multiplier as an SD59x18 number.\n/// @return result The product as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction mul(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\n int256 xInt = x.unwrap();\n int256 yInt = y.unwrap();\n if (xInt == uMIN_SD59x18 || yInt == uMIN_SD59x18) {\n revert Errors.PRBMath_SD59x18_Mul_InputTooSmall();\n }\n\n // Get hold of the absolute values of x and y.\n uint256 xAbs;\n uint256 yAbs;\n unchecked {\n xAbs = xInt < 0 ? uint256(-xInt) : uint256(xInt);\n yAbs = yInt < 0 ? uint256(-yInt) : uint256(yInt);\n }\n\n // Compute the absolute value (x*y÷UNIT). The resulting value must fit in SD59x18.\n uint256 resultAbs = Common.mulDiv18(xAbs, yAbs);\n if (resultAbs > uint256(uMAX_SD59x18)) {\n revert Errors.PRBMath_SD59x18_Mul_Overflow(x, y);\n }\n\n // Check if x and y have the same sign using two's complement representation. The left-most bit represents the sign (1 for\n // negative, 0 for positive or zero).\n bool sameSign = (xInt ^ yInt) > -1;\n\n // If the inputs have the same sign, the result should be positive. Otherwise, it should be negative.\n unchecked {\n result = wrap(sameSign ? int256(resultAbs) : -int256(resultAbs));\n }\n}\n\n/// @notice Raises x to the power of y using the following formula:\n///\n/// $$\n/// x^y = 2^{log_2{x} * y}\n/// $$\n///\n/// @dev Notes:\n/// - Refer to the notes in {exp2}, {log2}, and {mul}.\n/// - Returns `UNIT` for 0^0.\n///\n/// Requirements:\n/// - Refer to the requirements in {exp2}, {log2}, and {mul}.\n///\n/// @param x The base as an SD59x18 number.\n/// @param y Exponent to raise x to, as an SD59x18 number\n/// @return result x raised to power y, as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction pow(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\n int256 xInt = x.unwrap();\n int256 yInt = y.unwrap();\n\n // If both x and y are zero, the result is `UNIT`. If just x is zero, the result is always zero.\n if (xInt == 0) {\n return yInt == 0 ? UNIT : ZERO;\n }\n // If x is `UNIT`, the result is always `UNIT`.\n else if (xInt == uUNIT) {\n return UNIT;\n }\n\n // If y is zero, the result is always `UNIT`.\n if (yInt == 0) {\n return UNIT;\n }\n // If y is `UNIT`, the result is always x.\n else if (yInt == uUNIT) {\n return x;\n }\n\n // Calculate the result using the formula.\n result = exp2(mul(log2(x), y));\n}\n\n/// @notice Raises x (an SD59x18 number) to the power y (an unsigned basic integer) using the well-known\n/// algorithm \"exponentiation by squaring\".\n///\n/// @dev See https://en.wikipedia.org/wiki/Exponentiation_by_squaring.\n///\n/// Notes:\n/// - Refer to the notes in {Common.mulDiv18}.\n/// - Returns `UNIT` for 0^0.\n///\n/// Requirements:\n/// - Refer to the requirements in {abs} and {Common.mulDiv18}.\n/// - The result must fit in SD59x18.\n///\n/// @param x The base as an SD59x18 number.\n/// @param y The exponent as a uint256.\n/// @return result The result as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction powu(SD59x18 x, uint256 y) pure returns (SD59x18 result) {\n uint256 xAbs = uint256(abs(x).unwrap());\n\n // Calculate the first iteration of the loop in advance.\n uint256 resultAbs = y & 1 > 0 ? xAbs : uint256(uUNIT);\n\n // Equivalent to `for(y /= 2; y > 0; y /= 2)`.\n uint256 yAux = y;\n for (yAux >>= 1; yAux > 0; yAux >>= 1) {\n xAbs = Common.mulDiv18(xAbs, xAbs);\n\n // Equivalent to `y % 2 == 1`.\n if (yAux & 1 > 0) {\n resultAbs = Common.mulDiv18(resultAbs, xAbs);\n }\n }\n\n // The result must fit in SD59x18.\n if (resultAbs > uint256(uMAX_SD59x18)) {\n revert Errors.PRBMath_SD59x18_Powu_Overflow(x, y);\n }\n\n unchecked {\n // Is the base negative and the exponent odd? If yes, the result should be negative.\n int256 resultInt = int256(resultAbs);\n bool isNegative = x.unwrap() < 0 && y & 1 == 1;\n if (isNegative) {\n resultInt = -resultInt;\n }\n result = wrap(resultInt);\n }\n}\n\n/// @notice Calculates the square root of x using the Babylonian method.\n///\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\n///\n/// Notes:\n/// - Only the positive root is returned.\n/// - The result is rounded toward zero.\n///\n/// Requirements:\n/// - x cannot be negative, since complex numbers are not supported.\n/// - x must be less than `MAX_SD59x18 / UNIT`.\n///\n/// @param x The SD59x18 number for which to calculate the square root.\n/// @return result The result as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction sqrt(SD59x18 x) pure returns (SD59x18 result) {\n int256 xInt = x.unwrap();\n if (xInt < 0) {\n revert Errors.PRBMath_SD59x18_Sqrt_NegativeInput(x);\n }\n if (xInt > uMAX_SD59x18 / uUNIT) {\n revert Errors.PRBMath_SD59x18_Sqrt_Overflow(x);\n }\n\n unchecked {\n // Multiply x by `UNIT` to account for the factor of `UNIT` picked up when multiplying two SD59x18 numbers.\n // In this case, the two numbers are both the square root.\n uint256 resultUint = Common.sqrt(uint256(xInt * uUNIT));\n result = wrap(int256(resultUint));\n }\n}\n" + }, + "@prb/math/src/sd59x18/ValueType.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport \"./Casting.sol\" as Casting;\nimport \"./Helpers.sol\" as Helpers;\nimport \"./Math.sol\" as Math;\n\n/// @notice The signed 59.18-decimal fixed-point number representation, which can have up to 59 digits and up to 18\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\n/// type int256.\ntype SD59x18 is int256;\n\n/*//////////////////////////////////////////////////////////////////////////\n CASTING\n//////////////////////////////////////////////////////////////////////////*/\n\nusing {\n Casting.intoInt256,\n Casting.intoSD1x18,\n Casting.intoUD2x18,\n Casting.intoUD60x18,\n Casting.intoUint256,\n Casting.intoUint128,\n Casting.intoUint40,\n Casting.unwrap\n} for SD59x18 global;\n\n/*//////////////////////////////////////////////////////////////////////////\n MATHEMATICAL FUNCTIONS\n//////////////////////////////////////////////////////////////////////////*/\n\nusing {\n Math.abs,\n Math.avg,\n Math.ceil,\n Math.div,\n Math.exp,\n Math.exp2,\n Math.floor,\n Math.frac,\n Math.gm,\n Math.inv,\n Math.log10,\n Math.log2,\n Math.ln,\n Math.mul,\n Math.pow,\n Math.powu,\n Math.sqrt\n} for SD59x18 global;\n\n/*//////////////////////////////////////////////////////////////////////////\n HELPER FUNCTIONS\n//////////////////////////////////////////////////////////////////////////*/\n\nusing {\n Helpers.add,\n Helpers.and,\n Helpers.eq,\n Helpers.gt,\n Helpers.gte,\n Helpers.isZero,\n Helpers.lshift,\n Helpers.lt,\n Helpers.lte,\n Helpers.mod,\n Helpers.neq,\n Helpers.not,\n Helpers.or,\n Helpers.rshift,\n Helpers.sub,\n Helpers.uncheckedAdd,\n Helpers.uncheckedSub,\n Helpers.uncheckedUnary,\n Helpers.xor\n} for SD59x18 global;\n\n/*//////////////////////////////////////////////////////////////////////////\n OPERATORS\n//////////////////////////////////////////////////////////////////////////*/\n\n// The global \"using for\" directive makes it possible to use these operators on the SD59x18 type.\nusing {\n Helpers.add as +,\n Helpers.and2 as &,\n Math.div as /,\n Helpers.eq as ==,\n Helpers.gt as >,\n Helpers.gte as >=,\n Helpers.lt as <,\n Helpers.lte as <=,\n Helpers.mod as %,\n Math.mul as *,\n Helpers.neq as !=,\n Helpers.not as ~,\n Helpers.or as |,\n Helpers.sub as -,\n Helpers.unary as -,\n Helpers.xor as ^\n} for SD59x18 global;\n" + }, + "@prb/math/src/UD2x18.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\n/*\n\n██████╗ ██████╗ ██████╗ ███╗ ███╗ █████╗ ████████╗██╗ ██╗\n██╔══██╗██╔══██╗██╔══██╗████╗ ████║██╔══██╗╚══██╔══╝██║ ██║\n██████╔╝██████╔╝██████╔╝██╔████╔██║███████║ ██║ ███████║\n██╔═══╝ ██╔══██╗██╔══██╗██║╚██╔╝██║██╔══██║ ██║ ██╔══██║\n██║ ██║ ██║██████╔╝██║ ╚═╝ ██║██║ ██║ ██║ ██║ ██║\n╚═╝ ╚═╝ ╚═╝╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝\n\n██╗ ██╗██████╗ ██████╗ ██╗ ██╗ ██╗ █████╗\n██║ ██║██╔══██╗╚════██╗╚██╗██╔╝███║██╔══██╗\n██║ ██║██║ ██║ █████╔╝ ╚███╔╝ ╚██║╚█████╔╝\n██║ ██║██║ ██║██╔═══╝ ██╔██╗ ██║██╔══██╗\n╚██████╔╝██████╔╝███████╗██╔╝ ██╗ ██║╚█████╔╝\n ╚═════╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝ ╚═╝ ╚════╝\n\n*/\n\nimport \"./ud2x18/Casting.sol\";\nimport \"./ud2x18/Constants.sol\";\nimport \"./ud2x18/Errors.sol\";\nimport \"./ud2x18/ValueType.sol\";\n" + }, + "@prb/math/src/ud2x18/Casting.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport \"../Common.sol\" as Common;\nimport \"./Errors.sol\" as Errors;\nimport { uMAX_SD1x18 } from \"../sd1x18/Constants.sol\";\nimport { SD1x18 } from \"../sd1x18/ValueType.sol\";\nimport { SD59x18 } from \"../sd59x18/ValueType.sol\";\nimport { UD60x18 } from \"../ud60x18/ValueType.sol\";\nimport { UD2x18 } from \"./ValueType.sol\";\n\n/// @notice Casts a UD2x18 number into SD1x18.\n/// - x must be less than or equal to `uMAX_SD1x18`.\nfunction intoSD1x18(UD2x18 x) pure returns (SD1x18 result) {\n uint64 xUint = UD2x18.unwrap(x);\n if (xUint > uint64(uMAX_SD1x18)) {\n revert Errors.PRBMath_UD2x18_IntoSD1x18_Overflow(x);\n }\n result = SD1x18.wrap(int64(xUint));\n}\n\n/// @notice Casts a UD2x18 number into SD59x18.\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of SD59x18.\nfunction intoSD59x18(UD2x18 x) pure returns (SD59x18 result) {\n result = SD59x18.wrap(int256(uint256(UD2x18.unwrap(x))));\n}\n\n/// @notice Casts a UD2x18 number into UD60x18.\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of UD60x18.\nfunction intoUD60x18(UD2x18 x) pure returns (UD60x18 result) {\n result = UD60x18.wrap(UD2x18.unwrap(x));\n}\n\n/// @notice Casts a UD2x18 number into uint128.\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of uint128.\nfunction intoUint128(UD2x18 x) pure returns (uint128 result) {\n result = uint128(UD2x18.unwrap(x));\n}\n\n/// @notice Casts a UD2x18 number into uint256.\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of uint256.\nfunction intoUint256(UD2x18 x) pure returns (uint256 result) {\n result = uint256(UD2x18.unwrap(x));\n}\n\n/// @notice Casts a UD2x18 number into uint40.\n/// @dev Requirements:\n/// - x must be less than or equal to `MAX_UINT40`.\nfunction intoUint40(UD2x18 x) pure returns (uint40 result) {\n uint64 xUint = UD2x18.unwrap(x);\n if (xUint > uint64(Common.MAX_UINT40)) {\n revert Errors.PRBMath_UD2x18_IntoUint40_Overflow(x);\n }\n result = uint40(xUint);\n}\n\n/// @notice Alias for {wrap}.\nfunction ud2x18(uint64 x) pure returns (UD2x18 result) {\n result = UD2x18.wrap(x);\n}\n\n/// @notice Unwrap a UD2x18 number into uint64.\nfunction unwrap(UD2x18 x) pure returns (uint64 result) {\n result = UD2x18.unwrap(x);\n}\n\n/// @notice Wraps a uint64 number into UD2x18.\nfunction wrap(uint64 x) pure returns (UD2x18 result) {\n result = UD2x18.wrap(x);\n}\n" + }, + "@prb/math/src/ud2x18/Constants.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport { UD2x18 } from \"./ValueType.sol\";\n\n/// @dev Euler's number as a UD2x18 number.\nUD2x18 constant E = UD2x18.wrap(2_718281828459045235);\n\n/// @dev The maximum value a UD2x18 number can have.\nuint64 constant uMAX_UD2x18 = 18_446744073709551615;\nUD2x18 constant MAX_UD2x18 = UD2x18.wrap(uMAX_UD2x18);\n\n/// @dev PI as a UD2x18 number.\nUD2x18 constant PI = UD2x18.wrap(3_141592653589793238);\n\n/// @dev The unit number, which gives the decimal precision of UD2x18.\nUD2x18 constant UNIT = UD2x18.wrap(1e18);\nuint64 constant uUNIT = 1e18;\n" + }, + "@prb/math/src/ud2x18/Errors.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport { UD2x18 } from \"./ValueType.sol\";\n\n/// @notice Thrown when trying to cast a UD2x18 number that doesn't fit in SD1x18.\nerror PRBMath_UD2x18_IntoSD1x18_Overflow(UD2x18 x);\n\n/// @notice Thrown when trying to cast a UD2x18 number that doesn't fit in uint40.\nerror PRBMath_UD2x18_IntoUint40_Overflow(UD2x18 x);\n" + }, + "@prb/math/src/ud2x18/ValueType.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport \"./Casting.sol\" as Casting;\n\n/// @notice The unsigned 2.18-decimal fixed-point number representation, which can have up to 2 digits and up to 18\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\n/// type uint64. This is useful when end users want to use uint64 to save gas, e.g. with tight variable packing in contract\n/// storage.\ntype UD2x18 is uint64;\n\n/*//////////////////////////////////////////////////////////////////////////\n CASTING\n//////////////////////////////////////////////////////////////////////////*/\n\nusing {\n Casting.intoSD1x18,\n Casting.intoSD59x18,\n Casting.intoUD60x18,\n Casting.intoUint256,\n Casting.intoUint128,\n Casting.intoUint40,\n Casting.unwrap\n} for UD2x18 global;\n" + }, + "@prb/math/src/UD60x18.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\n/*\n\n██████╗ ██████╗ ██████╗ ███╗ ███╗ █████╗ ████████╗██╗ ██╗\n██╔══██╗██╔══██╗██╔══██╗████╗ ████║██╔══██╗╚══██╔══╝██║ ██║\n██████╔╝██████╔╝██████╔╝██╔████╔██║███████║ ██║ ███████║\n██╔═══╝ ██╔══██╗██╔══██╗██║╚██╔╝██║██╔══██║ ██║ ██╔══██║\n██║ ██║ ██║██████╔╝██║ ╚═╝ ██║██║ ██║ ██║ ██║ ██║\n╚═╝ ╚═╝ ╚═╝╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝\n\n██╗ ██╗██████╗ ██████╗ ██████╗ ██╗ ██╗ ██╗ █████╗\n██║ ██║██╔══██╗██╔════╝ ██╔═████╗╚██╗██╔╝███║██╔══██╗\n██║ ██║██║ ██║███████╗ ██║██╔██║ ╚███╔╝ ╚██║╚█████╔╝\n██║ ██║██║ ██║██╔═══██╗████╔╝██║ ██╔██╗ ██║██╔══██╗\n╚██████╔╝██████╔╝╚██████╔╝╚██████╔╝██╔╝ ██╗ ██║╚█████╔╝\n ╚═════╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚════╝\n\n*/\n\nimport \"./ud60x18/Casting.sol\";\nimport \"./ud60x18/Constants.sol\";\nimport \"./ud60x18/Conversions.sol\";\nimport \"./ud60x18/Errors.sol\";\nimport \"./ud60x18/Helpers.sol\";\nimport \"./ud60x18/Math.sol\";\nimport \"./ud60x18/ValueType.sol\";\n" + }, + "@prb/math/src/ud60x18/Casting.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport \"./Errors.sol\" as CastingErrors;\nimport { MAX_UINT128, MAX_UINT40 } from \"../Common.sol\";\nimport { uMAX_SD1x18 } from \"../sd1x18/Constants.sol\";\nimport { SD1x18 } from \"../sd1x18/ValueType.sol\";\nimport { uMAX_SD59x18 } from \"../sd59x18/Constants.sol\";\nimport { SD59x18 } from \"../sd59x18/ValueType.sol\";\nimport { uMAX_UD2x18 } from \"../ud2x18/Constants.sol\";\nimport { UD2x18 } from \"../ud2x18/ValueType.sol\";\nimport { UD60x18 } from \"./ValueType.sol\";\n\n/// @notice Casts a UD60x18 number into SD1x18.\n/// @dev Requirements:\n/// - x must be less than or equal to `uMAX_SD1x18`.\nfunction intoSD1x18(UD60x18 x) pure returns (SD1x18 result) {\n uint256 xUint = UD60x18.unwrap(x);\n if (xUint > uint256(int256(uMAX_SD1x18))) {\n revert CastingErrors.PRBMath_UD60x18_IntoSD1x18_Overflow(x);\n }\n result = SD1x18.wrap(int64(uint64(xUint)));\n}\n\n/// @notice Casts a UD60x18 number into UD2x18.\n/// @dev Requirements:\n/// - x must be less than or equal to `uMAX_UD2x18`.\nfunction intoUD2x18(UD60x18 x) pure returns (UD2x18 result) {\n uint256 xUint = UD60x18.unwrap(x);\n if (xUint > uMAX_UD2x18) {\n revert CastingErrors.PRBMath_UD60x18_IntoUD2x18_Overflow(x);\n }\n result = UD2x18.wrap(uint64(xUint));\n}\n\n/// @notice Casts a UD60x18 number into SD59x18.\n/// @dev Requirements:\n/// - x must be less than or equal to `uMAX_SD59x18`.\nfunction intoSD59x18(UD60x18 x) pure returns (SD59x18 result) {\n uint256 xUint = UD60x18.unwrap(x);\n if (xUint > uint256(uMAX_SD59x18)) {\n revert CastingErrors.PRBMath_UD60x18_IntoSD59x18_Overflow(x);\n }\n result = SD59x18.wrap(int256(xUint));\n}\n\n/// @notice Casts a UD60x18 number into uint128.\n/// @dev This is basically an alias for {unwrap}.\nfunction intoUint256(UD60x18 x) pure returns (uint256 result) {\n result = UD60x18.unwrap(x);\n}\n\n/// @notice Casts a UD60x18 number into uint128.\n/// @dev Requirements:\n/// - x must be less than or equal to `MAX_UINT128`.\nfunction intoUint128(UD60x18 x) pure returns (uint128 result) {\n uint256 xUint = UD60x18.unwrap(x);\n if (xUint > MAX_UINT128) {\n revert CastingErrors.PRBMath_UD60x18_IntoUint128_Overflow(x);\n }\n result = uint128(xUint);\n}\n\n/// @notice Casts a UD60x18 number into uint40.\n/// @dev Requirements:\n/// - x must be less than or equal to `MAX_UINT40`.\nfunction intoUint40(UD60x18 x) pure returns (uint40 result) {\n uint256 xUint = UD60x18.unwrap(x);\n if (xUint > MAX_UINT40) {\n revert CastingErrors.PRBMath_UD60x18_IntoUint40_Overflow(x);\n }\n result = uint40(xUint);\n}\n\n/// @notice Alias for {wrap}.\nfunction ud(uint256 x) pure returns (UD60x18 result) {\n result = UD60x18.wrap(x);\n}\n\n/// @notice Alias for {wrap}.\nfunction ud60x18(uint256 x) pure returns (UD60x18 result) {\n result = UD60x18.wrap(x);\n}\n\n/// @notice Unwraps a UD60x18 number into uint256.\nfunction unwrap(UD60x18 x) pure returns (uint256 result) {\n result = UD60x18.unwrap(x);\n}\n\n/// @notice Wraps a uint256 number into the UD60x18 value type.\nfunction wrap(uint256 x) pure returns (UD60x18 result) {\n result = UD60x18.wrap(x);\n}\n" + }, + "@prb/math/src/ud60x18/Constants.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport { UD60x18 } from \"./ValueType.sol\";\n\n// NOTICE: the \"u\" prefix stands for \"unwrapped\".\n\n/// @dev Euler's number as a UD60x18 number.\nUD60x18 constant E = UD60x18.wrap(2_718281828459045235);\n\n/// @dev The maximum input permitted in {exp}.\nuint256 constant uEXP_MAX_INPUT = 133_084258667509499440;\nUD60x18 constant EXP_MAX_INPUT = UD60x18.wrap(uEXP_MAX_INPUT);\n\n/// @dev The maximum input permitted in {exp2}.\nuint256 constant uEXP2_MAX_INPUT = 192e18 - 1;\nUD60x18 constant EXP2_MAX_INPUT = UD60x18.wrap(uEXP2_MAX_INPUT);\n\n/// @dev Half the UNIT number.\nuint256 constant uHALF_UNIT = 0.5e18;\nUD60x18 constant HALF_UNIT = UD60x18.wrap(uHALF_UNIT);\n\n/// @dev $log_2(10)$ as a UD60x18 number.\nuint256 constant uLOG2_10 = 3_321928094887362347;\nUD60x18 constant LOG2_10 = UD60x18.wrap(uLOG2_10);\n\n/// @dev $log_2(e)$ as a UD60x18 number.\nuint256 constant uLOG2_E = 1_442695040888963407;\nUD60x18 constant LOG2_E = UD60x18.wrap(uLOG2_E);\n\n/// @dev The maximum value a UD60x18 number can have.\nuint256 constant uMAX_UD60x18 = 115792089237316195423570985008687907853269984665640564039457_584007913129639935;\nUD60x18 constant MAX_UD60x18 = UD60x18.wrap(uMAX_UD60x18);\n\n/// @dev The maximum whole value a UD60x18 number can have.\nuint256 constant uMAX_WHOLE_UD60x18 = 115792089237316195423570985008687907853269984665640564039457_000000000000000000;\nUD60x18 constant MAX_WHOLE_UD60x18 = UD60x18.wrap(uMAX_WHOLE_UD60x18);\n\n/// @dev PI as a UD60x18 number.\nUD60x18 constant PI = UD60x18.wrap(3_141592653589793238);\n\n/// @dev The unit number, which gives the decimal precision of UD60x18.\nuint256 constant uUNIT = 1e18;\nUD60x18 constant UNIT = UD60x18.wrap(uUNIT);\n\n/// @dev The unit number squared.\nuint256 constant uUNIT_SQUARED = 1e36;\nUD60x18 constant UNIT_SQUARED = UD60x18.wrap(uUNIT_SQUARED);\n\n/// @dev Zero as a UD60x18 number.\nUD60x18 constant ZERO = UD60x18.wrap(0);\n" + }, + "@prb/math/src/ud60x18/Conversions.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport { uMAX_UD60x18, uUNIT } from \"./Constants.sol\";\nimport { PRBMath_UD60x18_Convert_Overflow } from \"./Errors.sol\";\nimport { UD60x18 } from \"./ValueType.sol\";\n\n/// @notice Converts a UD60x18 number to a simple integer by dividing it by `UNIT`.\n/// @dev The result is rounded toward zero.\n/// @param x The UD60x18 number to convert.\n/// @return result The same number in basic integer form.\nfunction convert(UD60x18 x) pure returns (uint256 result) {\n result = UD60x18.unwrap(x) / uUNIT;\n}\n\n/// @notice Converts a simple integer to UD60x18 by multiplying it by `UNIT`.\n///\n/// @dev Requirements:\n/// - x must be less than or equal to `MAX_UD60x18 / UNIT`.\n///\n/// @param x The basic integer to convert.\n/// @param result The same number converted to UD60x18.\nfunction convert(uint256 x) pure returns (UD60x18 result) {\n if (x > uMAX_UD60x18 / uUNIT) {\n revert PRBMath_UD60x18_Convert_Overflow(x);\n }\n unchecked {\n result = UD60x18.wrap(x * uUNIT);\n }\n}\n" + }, + "@prb/math/src/ud60x18/Errors.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport { UD60x18 } from \"./ValueType.sol\";\n\n/// @notice Thrown when ceiling a number overflows UD60x18.\nerror PRBMath_UD60x18_Ceil_Overflow(UD60x18 x);\n\n/// @notice Thrown when converting a basic integer to the fixed-point format overflows UD60x18.\nerror PRBMath_UD60x18_Convert_Overflow(uint256 x);\n\n/// @notice Thrown when taking the natural exponent of a base greater than 133_084258667509499441.\nerror PRBMath_UD60x18_Exp_InputTooBig(UD60x18 x);\n\n/// @notice Thrown when taking the binary exponent of a base greater than 192e18.\nerror PRBMath_UD60x18_Exp2_InputTooBig(UD60x18 x);\n\n/// @notice Thrown when taking the geometric mean of two numbers and multiplying them overflows UD60x18.\nerror PRBMath_UD60x18_Gm_Overflow(UD60x18 x, UD60x18 y);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\nerror PRBMath_UD60x18_IntoSD1x18_Overflow(UD60x18 x);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD59x18.\nerror PRBMath_UD60x18_IntoSD59x18_Overflow(UD60x18 x);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\nerror PRBMath_UD60x18_IntoUD2x18_Overflow(UD60x18 x);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\nerror PRBMath_UD60x18_IntoUint128_Overflow(UD60x18 x);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\nerror PRBMath_UD60x18_IntoUint40_Overflow(UD60x18 x);\n\n/// @notice Thrown when taking the logarithm of a number less than 1.\nerror PRBMath_UD60x18_Log_InputTooSmall(UD60x18 x);\n\n/// @notice Thrown when calculating the square root overflows UD60x18.\nerror PRBMath_UD60x18_Sqrt_Overflow(UD60x18 x);\n" + }, + "@prb/math/src/ud60x18/Helpers.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport { wrap } from \"./Casting.sol\";\nimport { UD60x18 } from \"./ValueType.sol\";\n\n/// @notice Implements the checked addition operation (+) in the UD60x18 type.\nfunction add(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\n result = wrap(x.unwrap() + y.unwrap());\n}\n\n/// @notice Implements the AND (&) bitwise operation in the UD60x18 type.\nfunction and(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\n result = wrap(x.unwrap() & bits);\n}\n\n/// @notice Implements the AND (&) bitwise operation in the UD60x18 type.\nfunction and2(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\n result = wrap(x.unwrap() & y.unwrap());\n}\n\n/// @notice Implements the equal operation (==) in the UD60x18 type.\nfunction eq(UD60x18 x, UD60x18 y) pure returns (bool result) {\n result = x.unwrap() == y.unwrap();\n}\n\n/// @notice Implements the greater than operation (>) in the UD60x18 type.\nfunction gt(UD60x18 x, UD60x18 y) pure returns (bool result) {\n result = x.unwrap() > y.unwrap();\n}\n\n/// @notice Implements the greater than or equal to operation (>=) in the UD60x18 type.\nfunction gte(UD60x18 x, UD60x18 y) pure returns (bool result) {\n result = x.unwrap() >= y.unwrap();\n}\n\n/// @notice Implements a zero comparison check function in the UD60x18 type.\nfunction isZero(UD60x18 x) pure returns (bool result) {\n // This wouldn't work if x could be negative.\n result = x.unwrap() == 0;\n}\n\n/// @notice Implements the left shift operation (<<) in the UD60x18 type.\nfunction lshift(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\n result = wrap(x.unwrap() << bits);\n}\n\n/// @notice Implements the lower than operation (<) in the UD60x18 type.\nfunction lt(UD60x18 x, UD60x18 y) pure returns (bool result) {\n result = x.unwrap() < y.unwrap();\n}\n\n/// @notice Implements the lower than or equal to operation (<=) in the UD60x18 type.\nfunction lte(UD60x18 x, UD60x18 y) pure returns (bool result) {\n result = x.unwrap() <= y.unwrap();\n}\n\n/// @notice Implements the checked modulo operation (%) in the UD60x18 type.\nfunction mod(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\n result = wrap(x.unwrap() % y.unwrap());\n}\n\n/// @notice Implements the not equal operation (!=) in the UD60x18 type.\nfunction neq(UD60x18 x, UD60x18 y) pure returns (bool result) {\n result = x.unwrap() != y.unwrap();\n}\n\n/// @notice Implements the NOT (~) bitwise operation in the UD60x18 type.\nfunction not(UD60x18 x) pure returns (UD60x18 result) {\n result = wrap(~x.unwrap());\n}\n\n/// @notice Implements the OR (|) bitwise operation in the UD60x18 type.\nfunction or(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\n result = wrap(x.unwrap() | y.unwrap());\n}\n\n/// @notice Implements the right shift operation (>>) in the UD60x18 type.\nfunction rshift(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\n result = wrap(x.unwrap() >> bits);\n}\n\n/// @notice Implements the checked subtraction operation (-) in the UD60x18 type.\nfunction sub(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\n result = wrap(x.unwrap() - y.unwrap());\n}\n\n/// @notice Implements the unchecked addition operation (+) in the UD60x18 type.\nfunction uncheckedAdd(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\n unchecked {\n result = wrap(x.unwrap() + y.unwrap());\n }\n}\n\n/// @notice Implements the unchecked subtraction operation (-) in the UD60x18 type.\nfunction uncheckedSub(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\n unchecked {\n result = wrap(x.unwrap() - y.unwrap());\n }\n}\n\n/// @notice Implements the XOR (^) bitwise operation in the UD60x18 type.\nfunction xor(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\n result = wrap(x.unwrap() ^ y.unwrap());\n}\n" + }, + "@prb/math/src/ud60x18/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport \"../Common.sol\" as Common;\nimport \"./Errors.sol\" as Errors;\nimport { wrap } from \"./Casting.sol\";\nimport {\n uEXP_MAX_INPUT,\n uEXP2_MAX_INPUT,\n uHALF_UNIT,\n uLOG2_10,\n uLOG2_E,\n uMAX_UD60x18,\n uMAX_WHOLE_UD60x18,\n UNIT,\n uUNIT,\n uUNIT_SQUARED,\n ZERO\n} from \"./Constants.sol\";\nimport { UD60x18 } from \"./ValueType.sol\";\n\n/*//////////////////////////////////////////////////////////////////////////\n MATHEMATICAL FUNCTIONS\n//////////////////////////////////////////////////////////////////////////*/\n\n/// @notice Calculates the arithmetic average of x and y using the following formula:\n///\n/// $$\n/// avg(x, y) = (x & y) + ((xUint ^ yUint) / 2)\n/// $$\n///\n/// In English, this is what this formula does:\n///\n/// 1. AND x and y.\n/// 2. Calculate half of XOR x and y.\n/// 3. Add the two results together.\n///\n/// This technique is known as SWAR, which stands for \"SIMD within a register\". You can read more about it here:\n/// https://devblogs.microsoft.com/oldnewthing/20220207-00/?p=106223\n///\n/// @dev Notes:\n/// - The result is rounded toward zero.\n///\n/// @param x The first operand as a UD60x18 number.\n/// @param y The second operand as a UD60x18 number.\n/// @return result The arithmetic average as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction avg(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\n uint256 xUint = x.unwrap();\n uint256 yUint = y.unwrap();\n unchecked {\n result = wrap((xUint & yUint) + ((xUint ^ yUint) >> 1));\n }\n}\n\n/// @notice Yields the smallest whole number greater than or equal to x.\n///\n/// @dev This is optimized for fractional value inputs, because for every whole value there are (1e18 - 1) fractional\n/// counterparts. See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\n///\n/// Requirements:\n/// - x must be less than or equal to `MAX_WHOLE_UD60x18`.\n///\n/// @param x The UD60x18 number to ceil.\n/// @param result The smallest whole number greater than or equal to x, as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction ceil(UD60x18 x) pure returns (UD60x18 result) {\n uint256 xUint = x.unwrap();\n if (xUint > uMAX_WHOLE_UD60x18) {\n revert Errors.PRBMath_UD60x18_Ceil_Overflow(x);\n }\n\n assembly (\"memory-safe\") {\n // Equivalent to `x % UNIT`.\n let remainder := mod(x, uUNIT)\n\n // Equivalent to `UNIT - remainder`.\n let delta := sub(uUNIT, remainder)\n\n // Equivalent to `x + remainder > 0 ? delta : 0`.\n result := add(x, mul(delta, gt(remainder, 0)))\n }\n}\n\n/// @notice Divides two UD60x18 numbers, returning a new UD60x18 number.\n///\n/// @dev Uses {Common.mulDiv} to enable overflow-safe multiplication and division.\n///\n/// Notes:\n/// - Refer to the notes in {Common.mulDiv}.\n///\n/// Requirements:\n/// - Refer to the requirements in {Common.mulDiv}.\n///\n/// @param x The numerator as a UD60x18 number.\n/// @param y The denominator as a UD60x18 number.\n/// @param result The quotient as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction div(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\n result = wrap(Common.mulDiv(x.unwrap(), uUNIT, y.unwrap()));\n}\n\n/// @notice Calculates the natural exponent of x using the following formula:\n///\n/// $$\n/// e^x = 2^{x * log_2{e}}\n/// $$\n///\n/// @dev Requirements:\n/// - x must be less than 133_084258667509499441.\n///\n/// @param x The exponent as a UD60x18 number.\n/// @return result The result as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction exp(UD60x18 x) pure returns (UD60x18 result) {\n uint256 xUint = x.unwrap();\n\n // This check prevents values greater than 192e18 from being passed to {exp2}.\n if (xUint > uEXP_MAX_INPUT) {\n revert Errors.PRBMath_UD60x18_Exp_InputTooBig(x);\n }\n\n unchecked {\n // Inline the fixed-point multiplication to save gas.\n uint256 doubleUnitProduct = xUint * uLOG2_E;\n result = exp2(wrap(doubleUnitProduct / uUNIT));\n }\n}\n\n/// @notice Calculates the binary exponent of x using the binary fraction method.\n///\n/// @dev See https://ethereum.stackexchange.com/q/79903/24693\n///\n/// Requirements:\n/// - x must be less than 192e18.\n/// - The result must fit in UD60x18.\n///\n/// @param x The exponent as a UD60x18 number.\n/// @return result The result as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction exp2(UD60x18 x) pure returns (UD60x18 result) {\n uint256 xUint = x.unwrap();\n\n // Numbers greater than or equal to 192e18 don't fit in the 192.64-bit format.\n if (xUint > uEXP2_MAX_INPUT) {\n revert Errors.PRBMath_UD60x18_Exp2_InputTooBig(x);\n }\n\n // Convert x to the 192.64-bit fixed-point format.\n uint256 x_192x64 = (xUint << 64) / uUNIT;\n\n // Pass x to the {Common.exp2} function, which uses the 192.64-bit fixed-point number representation.\n result = wrap(Common.exp2(x_192x64));\n}\n\n/// @notice Yields the greatest whole number less than or equal to x.\n/// @dev Optimized for fractional value inputs, because every whole value has (1e18 - 1) fractional counterparts.\n/// See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\n/// @param x The UD60x18 number to floor.\n/// @param result The greatest whole number less than or equal to x, as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction floor(UD60x18 x) pure returns (UD60x18 result) {\n assembly (\"memory-safe\") {\n // Equivalent to `x % UNIT`.\n let remainder := mod(x, uUNIT)\n\n // Equivalent to `x - remainder > 0 ? remainder : 0)`.\n result := sub(x, mul(remainder, gt(remainder, 0)))\n }\n}\n\n/// @notice Yields the excess beyond the floor of x using the odd function definition.\n/// @dev See https://en.wikipedia.org/wiki/Fractional_part.\n/// @param x The UD60x18 number to get the fractional part of.\n/// @param result The fractional part of x as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction frac(UD60x18 x) pure returns (UD60x18 result) {\n assembly (\"memory-safe\") {\n result := mod(x, uUNIT)\n }\n}\n\n/// @notice Calculates the geometric mean of x and y, i.e. $\\sqrt{x * y}$, rounding down.\n///\n/// @dev Requirements:\n/// - x * y must fit in UD60x18.\n///\n/// @param x The first operand as a UD60x18 number.\n/// @param y The second operand as a UD60x18 number.\n/// @return result The result as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction gm(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\n uint256 xUint = x.unwrap();\n uint256 yUint = y.unwrap();\n if (xUint == 0 || yUint == 0) {\n return ZERO;\n }\n\n unchecked {\n // Checking for overflow this way is faster than letting Solidity do it.\n uint256 xyUint = xUint * yUint;\n if (xyUint / xUint != yUint) {\n revert Errors.PRBMath_UD60x18_Gm_Overflow(x, y);\n }\n\n // We don't need to multiply the result by `UNIT` here because the x*y product picked up a factor of `UNIT`\n // during multiplication. See the comments in {Common.sqrt}.\n result = wrap(Common.sqrt(xyUint));\n }\n}\n\n/// @notice Calculates the inverse of x.\n///\n/// @dev Notes:\n/// - The result is rounded toward zero.\n///\n/// Requirements:\n/// - x must not be zero.\n///\n/// @param x The UD60x18 number for which to calculate the inverse.\n/// @return result The inverse as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction inv(UD60x18 x) pure returns (UD60x18 result) {\n unchecked {\n result = wrap(uUNIT_SQUARED / x.unwrap());\n }\n}\n\n/// @notice Calculates the natural logarithm of x using the following formula:\n///\n/// $$\n/// ln{x} = log_2{x} / log_2{e}\n/// $$\n///\n/// @dev Notes:\n/// - Refer to the notes in {log2}.\n/// - The precision isn't sufficiently fine-grained to return exactly `UNIT` when the input is `E`.\n///\n/// Requirements:\n/// - Refer to the requirements in {log2}.\n///\n/// @param x The UD60x18 number for which to calculate the natural logarithm.\n/// @return result The natural logarithm as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction ln(UD60x18 x) pure returns (UD60x18 result) {\n unchecked {\n // Inline the fixed-point multiplication to save gas. This is overflow-safe because the maximum value that\n // {log2} can return is ~196_205294292027477728.\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_E);\n }\n}\n\n/// @notice Calculates the common logarithm of x using the following formula:\n///\n/// $$\n/// log_{10}{x} = log_2{x} / log_2{10}\n/// $$\n///\n/// However, if x is an exact power of ten, a hard coded value is returned.\n///\n/// @dev Notes:\n/// - Refer to the notes in {log2}.\n///\n/// Requirements:\n/// - Refer to the requirements in {log2}.\n///\n/// @param x The UD60x18 number for which to calculate the common logarithm.\n/// @return result The common logarithm as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction log10(UD60x18 x) pure returns (UD60x18 result) {\n uint256 xUint = x.unwrap();\n if (xUint < uUNIT) {\n revert Errors.PRBMath_UD60x18_Log_InputTooSmall(x);\n }\n\n // Note that the `mul` in this assembly block is the standard multiplication operation, not {UD60x18.mul}.\n // prettier-ignore\n assembly (\"memory-safe\") {\n switch x\n case 1 { result := mul(uUNIT, sub(0, 18)) }\n case 10 { result := mul(uUNIT, sub(1, 18)) }\n case 100 { result := mul(uUNIT, sub(2, 18)) }\n case 1000 { result := mul(uUNIT, sub(3, 18)) }\n case 10000 { result := mul(uUNIT, sub(4, 18)) }\n case 100000 { result := mul(uUNIT, sub(5, 18)) }\n case 1000000 { result := mul(uUNIT, sub(6, 18)) }\n case 10000000 { result := mul(uUNIT, sub(7, 18)) }\n case 100000000 { result := mul(uUNIT, sub(8, 18)) }\n case 1000000000 { result := mul(uUNIT, sub(9, 18)) }\n case 10000000000 { result := mul(uUNIT, sub(10, 18)) }\n case 100000000000 { result := mul(uUNIT, sub(11, 18)) }\n case 1000000000000 { result := mul(uUNIT, sub(12, 18)) }\n case 10000000000000 { result := mul(uUNIT, sub(13, 18)) }\n case 100000000000000 { result := mul(uUNIT, sub(14, 18)) }\n case 1000000000000000 { result := mul(uUNIT, sub(15, 18)) }\n case 10000000000000000 { result := mul(uUNIT, sub(16, 18)) }\n case 100000000000000000 { result := mul(uUNIT, sub(17, 18)) }\n case 1000000000000000000 { result := 0 }\n case 10000000000000000000 { result := uUNIT }\n case 100000000000000000000 { result := mul(uUNIT, 2) }\n case 1000000000000000000000 { result := mul(uUNIT, 3) }\n case 10000000000000000000000 { result := mul(uUNIT, 4) }\n case 100000000000000000000000 { result := mul(uUNIT, 5) }\n case 1000000000000000000000000 { result := mul(uUNIT, 6) }\n case 10000000000000000000000000 { result := mul(uUNIT, 7) }\n case 100000000000000000000000000 { result := mul(uUNIT, 8) }\n case 1000000000000000000000000000 { result := mul(uUNIT, 9) }\n case 10000000000000000000000000000 { result := mul(uUNIT, 10) }\n case 100000000000000000000000000000 { result := mul(uUNIT, 11) }\n case 1000000000000000000000000000000 { result := mul(uUNIT, 12) }\n case 10000000000000000000000000000000 { result := mul(uUNIT, 13) }\n case 100000000000000000000000000000000 { result := mul(uUNIT, 14) }\n case 1000000000000000000000000000000000 { result := mul(uUNIT, 15) }\n case 10000000000000000000000000000000000 { result := mul(uUNIT, 16) }\n case 100000000000000000000000000000000000 { result := mul(uUNIT, 17) }\n case 1000000000000000000000000000000000000 { result := mul(uUNIT, 18) }\n case 10000000000000000000000000000000000000 { result := mul(uUNIT, 19) }\n case 100000000000000000000000000000000000000 { result := mul(uUNIT, 20) }\n case 1000000000000000000000000000000000000000 { result := mul(uUNIT, 21) }\n case 10000000000000000000000000000000000000000 { result := mul(uUNIT, 22) }\n case 100000000000000000000000000000000000000000 { result := mul(uUNIT, 23) }\n case 1000000000000000000000000000000000000000000 { result := mul(uUNIT, 24) }\n case 10000000000000000000000000000000000000000000 { result := mul(uUNIT, 25) }\n case 100000000000000000000000000000000000000000000 { result := mul(uUNIT, 26) }\n case 1000000000000000000000000000000000000000000000 { result := mul(uUNIT, 27) }\n case 10000000000000000000000000000000000000000000000 { result := mul(uUNIT, 28) }\n case 100000000000000000000000000000000000000000000000 { result := mul(uUNIT, 29) }\n case 1000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 30) }\n case 10000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 31) }\n case 100000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 32) }\n case 1000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 33) }\n case 10000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 34) }\n case 100000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 35) }\n case 1000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 36) }\n case 10000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 37) }\n case 100000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 38) }\n case 1000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 39) }\n case 10000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 40) }\n case 100000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 41) }\n case 1000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 42) }\n case 10000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 43) }\n case 100000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 44) }\n case 1000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 45) }\n case 10000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 46) }\n case 100000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 47) }\n case 1000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 48) }\n case 10000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 49) }\n case 100000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 50) }\n case 1000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 51) }\n case 10000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 52) }\n case 100000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 53) }\n case 1000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 54) }\n case 10000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 55) }\n case 100000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 56) }\n case 1000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 57) }\n case 10000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 58) }\n case 100000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 59) }\n default { result := uMAX_UD60x18 }\n }\n\n if (result.unwrap() == uMAX_UD60x18) {\n unchecked {\n // Inline the fixed-point division to save gas.\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_10);\n }\n }\n}\n\n/// @notice Calculates the binary logarithm of x using the iterative approximation algorithm:\n///\n/// $$\n/// log_2{x} = n + log_2{y}, \\text{ where } y = x*2^{-n}, \\ y \\in [1, 2)\n/// $$\n///\n/// For $0 \\leq x \\lt 1$, the input is inverted:\n///\n/// $$\n/// log_2{x} = -log_2{\\frac{1}{x}}\n/// $$\n///\n/// @dev See https://en.wikipedia.org/wiki/Binary_logarithm#Iterative_approximation\n///\n/// Notes:\n/// - Due to the lossy precision of the iterative approximation, the results are not perfectly accurate to the last decimal.\n///\n/// Requirements:\n/// - x must be greater than zero.\n///\n/// @param x The UD60x18 number for which to calculate the binary logarithm.\n/// @return result The binary logarithm as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction log2(UD60x18 x) pure returns (UD60x18 result) {\n uint256 xUint = x.unwrap();\n\n if (xUint < uUNIT) {\n revert Errors.PRBMath_UD60x18_Log_InputTooSmall(x);\n }\n\n unchecked {\n // Calculate the integer part of the logarithm.\n uint256 n = Common.msb(xUint / uUNIT);\n\n // This is the integer part of the logarithm as a UD60x18 number. The operation can't overflow because n\n // n is at most 255 and UNIT is 1e18.\n uint256 resultUint = n * uUNIT;\n\n // Calculate $y = x * 2^{-n}$.\n uint256 y = xUint >> n;\n\n // If y is the unit number, the fractional part is zero.\n if (y == uUNIT) {\n return wrap(resultUint);\n }\n\n // Calculate the fractional part via the iterative approximation.\n // The `delta >>= 1` part is equivalent to `delta /= 2`, but shifting bits is more gas efficient.\n uint256 DOUBLE_UNIT = 2e18;\n for (uint256 delta = uHALF_UNIT; delta > 0; delta >>= 1) {\n y = (y * y) / uUNIT;\n\n // Is y^2 >= 2e18 and so in the range [2e18, 4e18)?\n if (y >= DOUBLE_UNIT) {\n // Add the 2^{-m} factor to the logarithm.\n resultUint += delta;\n\n // Halve y, which corresponds to z/2 in the Wikipedia article.\n y >>= 1;\n }\n }\n result = wrap(resultUint);\n }\n}\n\n/// @notice Multiplies two UD60x18 numbers together, returning a new UD60x18 number.\n///\n/// @dev Uses {Common.mulDiv} to enable overflow-safe multiplication and division.\n///\n/// Notes:\n/// - Refer to the notes in {Common.mulDiv}.\n///\n/// Requirements:\n/// - Refer to the requirements in {Common.mulDiv}.\n///\n/// @dev See the documentation in {Common.mulDiv18}.\n/// @param x The multiplicand as a UD60x18 number.\n/// @param y The multiplier as a UD60x18 number.\n/// @return result The product as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction mul(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\n result = wrap(Common.mulDiv18(x.unwrap(), y.unwrap()));\n}\n\n/// @notice Raises x to the power of y.\n///\n/// For $1 \\leq x \\leq \\infty$, the following standard formula is used:\n///\n/// $$\n/// x^y = 2^{log_2{x} * y}\n/// $$\n///\n/// For $0 \\leq x \\lt 1$, since the unsigned {log2} is undefined, an equivalent formula is used:\n///\n/// $$\n/// i = \\frac{1}{x}\n/// w = 2^{log_2{i} * y}\n/// x^y = \\frac{1}{w}\n/// $$\n///\n/// @dev Notes:\n/// - Refer to the notes in {log2} and {mul}.\n/// - Returns `UNIT` for 0^0.\n/// - It may not perform well with very small values of x. Consider using SD59x18 as an alternative.\n///\n/// Requirements:\n/// - Refer to the requirements in {exp2}, {log2}, and {mul}.\n///\n/// @param x The base as a UD60x18 number.\n/// @param y The exponent as a UD60x18 number.\n/// @return result The result as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction pow(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\n uint256 xUint = x.unwrap();\n uint256 yUint = y.unwrap();\n\n // If both x and y are zero, the result is `UNIT`. If just x is zero, the result is always zero.\n if (xUint == 0) {\n return yUint == 0 ? UNIT : ZERO;\n }\n // If x is `UNIT`, the result is always `UNIT`.\n else if (xUint == uUNIT) {\n return UNIT;\n }\n\n // If y is zero, the result is always `UNIT`.\n if (yUint == 0) {\n return UNIT;\n }\n // If y is `UNIT`, the result is always x.\n else if (yUint == uUNIT) {\n return x;\n }\n\n // If x is greater than `UNIT`, use the standard formula.\n if (xUint > uUNIT) {\n result = exp2(mul(log2(x), y));\n }\n // Conversely, if x is less than `UNIT`, use the equivalent formula.\n else {\n UD60x18 i = wrap(uUNIT_SQUARED / xUint);\n UD60x18 w = exp2(mul(log2(i), y));\n result = wrap(uUNIT_SQUARED / w.unwrap());\n }\n}\n\n/// @notice Raises x (a UD60x18 number) to the power y (an unsigned basic integer) using the well-known\n/// algorithm \"exponentiation by squaring\".\n///\n/// @dev See https://en.wikipedia.org/wiki/Exponentiation_by_squaring.\n///\n/// Notes:\n/// - Refer to the notes in {Common.mulDiv18}.\n/// - Returns `UNIT` for 0^0.\n///\n/// Requirements:\n/// - The result must fit in UD60x18.\n///\n/// @param x The base as a UD60x18 number.\n/// @param y The exponent as a uint256.\n/// @return result The result as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction powu(UD60x18 x, uint256 y) pure returns (UD60x18 result) {\n // Calculate the first iteration of the loop in advance.\n uint256 xUint = x.unwrap();\n uint256 resultUint = y & 1 > 0 ? xUint : uUNIT;\n\n // Equivalent to `for(y /= 2; y > 0; y /= 2)`.\n for (y >>= 1; y > 0; y >>= 1) {\n xUint = Common.mulDiv18(xUint, xUint);\n\n // Equivalent to `y % 2 == 1`.\n if (y & 1 > 0) {\n resultUint = Common.mulDiv18(resultUint, xUint);\n }\n }\n result = wrap(resultUint);\n}\n\n/// @notice Calculates the square root of x using the Babylonian method.\n///\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\n///\n/// Notes:\n/// - The result is rounded toward zero.\n///\n/// Requirements:\n/// - x must be less than `MAX_UD60x18 / UNIT`.\n///\n/// @param x The UD60x18 number for which to calculate the square root.\n/// @return result The result as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction sqrt(UD60x18 x) pure returns (UD60x18 result) {\n uint256 xUint = x.unwrap();\n\n unchecked {\n if (xUint > uMAX_UD60x18 / uUNIT) {\n revert Errors.PRBMath_UD60x18_Sqrt_Overflow(x);\n }\n // Multiply x by `UNIT` to account for the factor of `UNIT` picked up when multiplying two UD60x18 numbers.\n // In this case, the two numbers are both the square root.\n result = wrap(Common.sqrt(xUint * uUNIT));\n }\n}\n" + }, + "@prb/math/src/ud60x18/ValueType.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport \"./Casting.sol\" as Casting;\nimport \"./Helpers.sol\" as Helpers;\nimport \"./Math.sol\" as Math;\n\n/// @notice The unsigned 60.18-decimal fixed-point number representation, which can have up to 60 digits and up to 18\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the Solidity type uint256.\n/// @dev The value type is defined here so it can be imported in all other files.\ntype UD60x18 is uint256;\n\n/*//////////////////////////////////////////////////////////////////////////\n CASTING\n//////////////////////////////////////////////////////////////////////////*/\n\nusing {\n Casting.intoSD1x18,\n Casting.intoUD2x18,\n Casting.intoSD59x18,\n Casting.intoUint128,\n Casting.intoUint256,\n Casting.intoUint40,\n Casting.unwrap\n} for UD60x18 global;\n\n/*//////////////////////////////////////////////////////////////////////////\n MATHEMATICAL FUNCTIONS\n//////////////////////////////////////////////////////////////////////////*/\n\n// The global \"using for\" directive makes the functions in this library callable on the UD60x18 type.\nusing {\n Math.avg,\n Math.ceil,\n Math.div,\n Math.exp,\n Math.exp2,\n Math.floor,\n Math.frac,\n Math.gm,\n Math.inv,\n Math.ln,\n Math.log10,\n Math.log2,\n Math.mul,\n Math.pow,\n Math.powu,\n Math.sqrt\n} for UD60x18 global;\n\n/*//////////////////////////////////////////////////////////////////////////\n HELPER FUNCTIONS\n//////////////////////////////////////////////////////////////////////////*/\n\n// The global \"using for\" directive makes the functions in this library callable on the UD60x18 type.\nusing {\n Helpers.add,\n Helpers.and,\n Helpers.eq,\n Helpers.gt,\n Helpers.gte,\n Helpers.isZero,\n Helpers.lshift,\n Helpers.lt,\n Helpers.lte,\n Helpers.mod,\n Helpers.neq,\n Helpers.not,\n Helpers.or,\n Helpers.rshift,\n Helpers.sub,\n Helpers.uncheckedAdd,\n Helpers.uncheckedSub,\n Helpers.xor\n} for UD60x18 global;\n\n/*//////////////////////////////////////////////////////////////////////////\n OPERATORS\n//////////////////////////////////////////////////////////////////////////*/\n\n// The global \"using for\" directive makes it possible to use these operators on the UD60x18 type.\nusing {\n Helpers.add as +,\n Helpers.and2 as &,\n Math.div as /,\n Helpers.eq as ==,\n Helpers.gt as >,\n Helpers.gte as >=,\n Helpers.lt as <,\n Helpers.lte as <=,\n Helpers.or as |,\n Helpers.mod as %,\n Math.mul as *,\n Helpers.neq as !=,\n Helpers.not as ~,\n Helpers.sub as -,\n Helpers.xor as ^\n} for UD60x18 global;\n" + }, + "contracts/autonomous-admin/DecentAutonomousAdminV1.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.28;\n\nimport {IHats} from \"../interfaces/hats/IHats.sol\";\nimport {IHatsElectionsEligibility} from \"../interfaces/hats/modules/IHatsElectionsEligibility.sol\";\nimport {FactoryFriendly} from \"@gnosis.pm/zodiac/contracts/factory/FactoryFriendly.sol\";\nimport {ERC165} from \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport {IDecentAutonomousAdminV1} from \"../interfaces/autonomous-admin/IDecentAutonomousAdminV1.sol\";\n\ncontract DecentAutonomousAdminV1 is\n IDecentAutonomousAdminV1,\n ERC165,\n FactoryFriendly\n{\n // //////////////////////////////////////////////////////////////\n // initializer\n // //////////////////////////////////////////////////////////////\n function setUp(bytes memory initializeParams) public override initializer {}\n\n // //////////////////////////////////////////////////////////////\n // Public Functions\n // //////////////////////////////////////////////////////////////\n function triggerStartNextTerm(TriggerStartArgs calldata args) public {\n IHatsElectionsEligibility hatsElectionModule = IHatsElectionsEligibility(\n args.hatsProtocol.getHatEligibilityModule(args.hatId)\n );\n\n hatsElectionModule.startNextTerm();\n\n // This will burn the hat if wearer is no longer eligible\n args.hatsProtocol.checkHatWearerStatus(args.hatId, args.currentWearer);\n\n // This will mint the hat to the nominated wearer, if necessary\n if (args.nominatedWearer != args.currentWearer) {\n args.hatsProtocol.mintHat(args.hatId, args.nominatedWearer);\n }\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view override returns (bool) {\n return\n interfaceId == type(IDecentAutonomousAdminV1).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n}\n" + }, + "contracts/hardhat-dependency-compiler/@gnosis.pm/safe-contracts/contracts/GnosisSafeL2.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >0.0.0;\nimport '@gnosis.pm/safe-contracts/contracts/GnosisSafeL2.sol';\n" + }, + "contracts/hardhat-dependency-compiler/@gnosis.pm/safe-contracts/contracts/libraries/MultiSendCallOnly.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >0.0.0;\nimport '@gnosis.pm/safe-contracts/contracts/libraries/MultiSendCallOnly.sol';\n" + }, + "contracts/hardhat-dependency-compiler/@gnosis.pm/safe-contracts/contracts/proxies/GnosisSafeProxyFactory.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >0.0.0;\nimport '@gnosis.pm/safe-contracts/contracts/proxies/GnosisSafeProxyFactory.sol';\n" + }, + "contracts/interfaces/autonomous-admin/IDecentAutonomousAdminV1.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.28;\n\nimport {IHats} from \"../hats/IHats.sol\";\n\ninterface IDecentAutonomousAdminV1 {\n error NotCurrentWearer();\n\n struct TriggerStartArgs {\n address currentWearer;\n IHats hatsProtocol;\n uint256 hatId;\n address nominatedWearer;\n }\n\n function triggerStartNextTerm(TriggerStartArgs calldata args) external;\n}\n" + }, + "contracts/interfaces/hats/HatsErrors.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\n// Copyright (C) 2023 Haberdasher Labs\n//\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU Affero General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU Affero General Public License for more details.\n//\n// You should have received a copy of the GNU Affero General Public License\n// along with this program. If not, see .\n\npragma solidity >=0.8.13;\n\ninterface HatsErrors {\n /// @notice Emitted when `user` is attempting to perform an action on `hatId` but is not wearing one of `hatId`'s admin hats\n /// @dev Can be equivalent to `NotHatWearer(buildHatId(hatId))`, such as when emitted by `approveLinkTopHatToTree` or `relinkTopHatToTree`\n error NotAdmin(address user, uint256 hatId);\n\n /// @notice Emitted when attempting to perform an action as or for an account that is not a wearer of a given hat\n error NotHatWearer();\n\n /// @notice Emitted when attempting to perform an action that requires being either an admin or wearer of a given hat\n error NotAdminOrWearer();\n\n /// @notice Emitted when attempting to mint `hatId` but `hatId`'s maxSupply has been reached\n error AllHatsWorn(uint256 hatId);\n\n /// @notice Emitted when attempting to create a hat with a level 14 hat as its admin\n error MaxLevelsReached();\n\n /// @notice Emitted when an attempted hat id has empty intermediate level(s)\n error InvalidHatId();\n\n /// @notice Emitted when attempting to mint `hatId` to a `wearer` who is already wearing the hat\n error AlreadyWearingHat(address wearer, uint256 hatId);\n\n /// @notice Emitted when attempting to mint a non-existant hat\n error HatDoesNotExist(uint256 hatId);\n\n /// @notice Emmitted when attempting to mint or transfer a hat that is not active\n error HatNotActive();\n\n /// @notice Emitted when attempting to mint or transfer a hat to an ineligible wearer\n error NotEligible();\n\n /// @notice Emitted when attempting to check or set a hat's status from an account that is not that hat's toggle module\n error NotHatsToggle();\n\n /// @notice Emitted when attempting to check or set a hat wearer's status from an account that is not that hat's eligibility module\n error NotHatsEligibility();\n\n /// @notice Emitted when array arguments to a batch function have mismatching lengths\n error BatchArrayLengthMismatch();\n\n /// @notice Emitted when attempting to mutate or transfer an immutable hat\n error Immutable();\n\n /// @notice Emitted when attempting to change a hat's maxSupply to a value lower than its current supply\n error NewMaxSupplyTooLow();\n\n /// @notice Emitted when attempting to link a tophat to a new admin for which the tophat serves as an admin\n error CircularLinkage();\n\n /// @notice Emitted when attempting to link or relink a tophat to a separate tree\n error CrossTreeLinkage();\n\n /// @notice Emitted when attempting to link a tophat without a request\n error LinkageNotRequested();\n\n /// @notice Emitted when attempting to unlink a tophat that does not have a wearer\n /// @dev This ensures that unlinking never results in a bricked tophat\n error InvalidUnlink();\n\n /// @notice Emmited when attempting to change a hat's eligibility or toggle module to the zero address\n error ZeroAddress();\n\n /// @notice Emmitted when attempting to change a hat's details or imageURI to a string with over 7000 bytes (~characters)\n /// @dev This protects against a DOS attack where an admin iteratively extend's a hat's details or imageURI\n /// to be so long that reading it exceeds the block gas limit, breaking `uri()` and `viewHat()`\n error StringTooLong();\n}\n" + }, + "contracts/interfaces/hats/HatsEvents.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\n// Copyright (C) 2023 Haberdasher Labs\n//\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU Affero General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU Affero General Public License for more details.\n//\n// You should have received a copy of the GNU Affero General Public License\n// along with this program. If not, see .\n\npragma solidity >=0.8.13;\n\ninterface HatsEvents {\n /// @notice Emitted when a new hat is created\n /// @param id The id for the new hat\n /// @param details A description of the Hat\n /// @param maxSupply The total instances of the Hat that can be worn at once\n /// @param eligibility The address that can report on the Hat wearer's status\n /// @param toggle The address that can deactivate the Hat\n /// @param mutable_ Whether the hat's properties are changeable after creation\n /// @param imageURI The image uri for this hat and the fallback for its\n event HatCreated(\n uint256 id,\n string details,\n uint32 maxSupply,\n address eligibility,\n address toggle,\n bool mutable_,\n string imageURI\n );\n\n /// @notice Emitted when a hat wearer's standing is updated\n /// @dev Eligibility is excluded since the source of truth for eligibility is the eligibility module and may change without a transaction\n /// @param hatId The id of the wearer's hat\n /// @param wearer The wearer's address\n /// @param wearerStanding Whether the wearer is in good standing for the hat\n event WearerStandingChanged(\n uint256 hatId,\n address wearer,\n bool wearerStanding\n );\n\n /// @notice Emitted when a hat's status is updated\n /// @param hatId The id of the hat\n /// @param newStatus Whether the hat is active\n event HatStatusChanged(uint256 hatId, bool newStatus);\n\n /// @notice Emitted when a hat's details are updated\n /// @param hatId The id of the hat\n /// @param newDetails The updated details\n event HatDetailsChanged(uint256 hatId, string newDetails);\n\n /// @notice Emitted when a hat's eligibility module is updated\n /// @param hatId The id of the hat\n /// @param newEligibility The updated eligibiliy module\n event HatEligibilityChanged(uint256 hatId, address newEligibility);\n\n /// @notice Emitted when a hat's toggle module is updated\n /// @param hatId The id of the hat\n /// @param newToggle The updated toggle module\n event HatToggleChanged(uint256 hatId, address newToggle);\n\n /// @notice Emitted when a hat's mutability is updated\n /// @param hatId The id of the hat\n event HatMutabilityChanged(uint256 hatId);\n\n /// @notice Emitted when a hat's maximum supply is updated\n /// @param hatId The id of the hat\n /// @param newMaxSupply The updated max supply\n event HatMaxSupplyChanged(uint256 hatId, uint32 newMaxSupply);\n\n /// @notice Emitted when a hat's image URI is updated\n /// @param hatId The id of the hat\n /// @param newImageURI The updated image URI\n event HatImageURIChanged(uint256 hatId, string newImageURI);\n\n /// @notice Emitted when a tophat linkage is requested by its admin\n /// @param domain The domain of the tree tophat to link\n /// @param newAdmin The tophat's would-be admin in the parent tree\n event TopHatLinkRequested(uint32 domain, uint256 newAdmin);\n\n /// @notice Emitted when a tophat is linked to a another tree\n /// @param domain The domain of the newly-linked tophat\n /// @param newAdmin The tophat's new admin in the parent tree\n event TopHatLinked(uint32 domain, uint256 newAdmin);\n}\n" + }, + "contracts/interfaces/hats/IHats.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\n// Copyright (C) 2023 Haberdasher Labs\n//\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU Affero General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU Affero General Public License for more details.\n//\n// You should have received a copy of the GNU Affero General Public License\n// along with this program. If not, see .\n\npragma solidity >=0.8.13;\n\nimport \"./IHatsIdUtilities.sol\";\nimport \"./HatsErrors.sol\";\nimport \"./HatsEvents.sol\";\n\ninterface IHats is IHatsIdUtilities, HatsErrors, HatsEvents {\n function mintTopHat(\n address _target,\n string memory _details,\n string memory _imageURI\n ) external returns (uint256 topHatId);\n\n function createHat(\n uint256 _admin,\n string calldata _details,\n uint32 _maxSupply,\n address _eligibility,\n address _toggle,\n bool _mutable,\n string calldata _imageURI\n ) external returns (uint256 newHatId);\n\n function batchCreateHats(\n uint256[] calldata _admins,\n string[] calldata _details,\n uint32[] calldata _maxSupplies,\n address[] memory _eligibilityModules,\n address[] memory _toggleModules,\n bool[] calldata _mutables,\n string[] calldata _imageURIs\n ) external returns (bool success);\n\n function getNextId(uint256 _admin) external view returns (uint256 nextId);\n\n function mintHat(\n uint256 _hatId,\n address _wearer\n ) external returns (bool success);\n\n function batchMintHats(\n uint256[] calldata _hatIds,\n address[] calldata _wearers\n ) external returns (bool success);\n\n function setHatStatus(\n uint256 _hatId,\n bool _newStatus\n ) external returns (bool toggled);\n\n function checkHatStatus(uint256 _hatId) external returns (bool toggled);\n\n function setHatWearerStatus(\n uint256 _hatId,\n address _wearer,\n bool _eligible,\n bool _standing\n ) external returns (bool updated);\n\n function checkHatWearerStatus(\n uint256 _hatId,\n address _wearer\n ) external returns (bool updated);\n\n function renounceHat(uint256 _hatId) external;\n\n function transferHat(uint256 _hatId, address _from, address _to) external;\n\n /*//////////////////////////////////////////////////////////////\n HATS ADMIN FUNCTIONS\n //////////////////////////////////////////////////////////////*/\n\n function makeHatImmutable(uint256 _hatId) external;\n\n function changeHatDetails(\n uint256 _hatId,\n string memory _newDetails\n ) external;\n\n function changeHatEligibility(\n uint256 _hatId,\n address _newEligibility\n ) external;\n\n function changeHatToggle(uint256 _hatId, address _newToggle) external;\n\n function changeHatImageURI(\n uint256 _hatId,\n string memory _newImageURI\n ) external;\n\n function changeHatMaxSupply(uint256 _hatId, uint32 _newMaxSupply) external;\n\n function requestLinkTopHatToTree(\n uint32 _topHatId,\n uint256 _newAdminHat\n ) external;\n\n function approveLinkTopHatToTree(\n uint32 _topHatId,\n uint256 _newAdminHat,\n address _eligibility,\n address _toggle,\n string calldata _details,\n string calldata _imageURI\n ) external;\n\n function unlinkTopHatFromTree(uint32 _topHatId, address _wearer) external;\n\n function relinkTopHatWithinTree(\n uint32 _topHatDomain,\n uint256 _newAdminHat,\n address _eligibility,\n address _toggle,\n string calldata _details,\n string calldata _imageURI\n ) external;\n\n /*//////////////////////////////////////////////////////////////\n VIEW FUNCTIONS\n //////////////////////////////////////////////////////////////*/\n\n function viewHat(\n uint256 _hatId\n )\n external\n view\n returns (\n string memory details,\n uint32 maxSupply,\n uint32 supply,\n address eligibility,\n address toggle,\n string memory imageURI,\n uint16 lastHatId,\n bool mutable_,\n bool active\n );\n\n function isWearerOfHat(\n address _user,\n uint256 _hatId\n ) external view returns (bool isWearer);\n\n function isAdminOfHat(\n address _user,\n uint256 _hatId\n ) external view returns (bool isAdmin);\n\n function isInGoodStanding(\n address _wearer,\n uint256 _hatId\n ) external view returns (bool standing);\n\n function isEligible(\n address _wearer,\n uint256 _hatId\n ) external view returns (bool eligible);\n\n function getHatEligibilityModule(\n uint256 _hatId\n ) external view returns (address eligibility);\n\n function getHatToggleModule(\n uint256 _hatId\n ) external view returns (address toggle);\n\n function getHatMaxSupply(\n uint256 _hatId\n ) external view returns (uint32 maxSupply);\n\n function hatSupply(uint256 _hatId) external view returns (uint32 supply);\n\n function getImageURIForHat(\n uint256 _hatId\n ) external view returns (string memory _uri);\n\n function balanceOf(\n address wearer,\n uint256 hatId\n ) external view returns (uint256 balance);\n\n function balanceOfBatch(\n address[] calldata _wearers,\n uint256[] calldata _hatIds\n ) external view returns (uint256[] memory);\n\n function uri(uint256 id) external view returns (string memory _uri);\n}\n" + }, + "contracts/interfaces/hats/IHatsIdUtilities.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\n// Copyright (C) 2023 Haberdasher Labs\n//\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU Affero General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU Affero General Public License for more details.\n//\n// You should have received a copy of the GNU Affero General Public License\n// along with this program. If not, see .\n\npragma solidity >=0.8.13;\n\ninterface IHatsIdUtilities {\n function buildHatId(\n uint256 _admin,\n uint16 _newHat\n ) external pure returns (uint256 id);\n\n function getHatLevel(uint256 _hatId) external view returns (uint32 level);\n\n function getLocalHatLevel(\n uint256 _hatId\n ) external pure returns (uint32 level);\n\n function isTopHat(uint256 _hatId) external view returns (bool _topHat);\n\n function isLocalTopHat(\n uint256 _hatId\n ) external pure returns (bool _localTopHat);\n\n function isValidHatId(\n uint256 _hatId\n ) external view returns (bool validHatId);\n\n function getAdminAtLevel(\n uint256 _hatId,\n uint32 _level\n ) external view returns (uint256 admin);\n\n function getAdminAtLocalLevel(\n uint256 _hatId,\n uint32 _level\n ) external pure returns (uint256 admin);\n\n function getTopHatDomain(\n uint256 _hatId\n ) external view returns (uint32 domain);\n\n function getTippyTopHatDomain(\n uint32 _topHatDomain\n ) external view returns (uint32 domain);\n\n function noCircularLinkage(\n uint32 _topHatDomain,\n uint256 _linkedAdmin\n ) external view returns (bool notCircular);\n\n function sameTippyTopHatDomain(\n uint32 _topHatDomain,\n uint256 _newAdminHat\n ) external view returns (bool sameDomain);\n}\n" + }, + "contracts/interfaces/hats/IHatsModuleFactory.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\ninterface IHatsModuleFactory {\n error HatsModuleFactory_ModuleAlreadyDeployed(\n address implementation,\n uint256 hatId,\n bytes otherImmutableArgs,\n uint256 saltNonce\n );\n\n error BatchArrayLengthMismatch();\n\n event HatsModuleFactory_ModuleDeployed(\n address implementation,\n address instance,\n uint256 hatId,\n bytes otherImmutableArgs,\n bytes initData,\n uint256 saltNonce\n );\n\n function HATS() external view returns (address);\n\n function version() external view returns (string memory);\n\n function createHatsModule(\n address _implementation,\n uint256 _hatId,\n bytes calldata _otherImmutableArgs,\n bytes calldata _initData,\n uint256 _saltNonce\n ) external returns (address _instance);\n\n function batchCreateHatsModule(\n address[] calldata _implementations,\n uint256[] calldata _hatIds,\n bytes[] calldata _otherImmutableArgsArray,\n bytes[] calldata _initDataArray,\n uint256[] calldata _saltNonces\n ) external returns (bool success);\n\n function getHatsModuleAddress(\n address _implementation,\n uint256 _hatId,\n bytes calldata _otherImmutableArgs,\n uint256 _saltNonce\n ) external view returns (address);\n\n function deployed(\n address _implementation,\n uint256 _hatId,\n bytes calldata _otherImmutableArgs,\n uint256 _saltNonce\n ) external view returns (bool);\n}\n" + }, + "contracts/interfaces/hats/modules/IHatsElectionsEligibility.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.13;\n\ninterface IHatsElectionsEligibility {\n event ElectionOpened(uint128 nextTermEnd);\n event ElectionCompleted(uint128 termEnd, address[] winners);\n event NewTermStarted(uint128 termEnd);\n event Recalled(uint128 termEnd, address[] accounts);\n\n /// @notice Returns the first second after the current term ends.\n /// @dev Also serves as the id for the current term.\n function currentTermEnd() external view returns (uint128);\n\n /// @notice Returns the first second after the next term ends.\n /// @dev Also serves as the id for the next term.\n function nextTermEnd() external view returns (uint128);\n\n /// @notice Returns the election status (open or closed) for a given term end.\n /// @param termEnd The term end timestamp to query.\n function electionStatus(\n uint128 termEnd\n ) external view returns (bool isElectionOpen);\n\n /// @notice Returns whether a candidate was elected in a given term.\n /// @param termEnd The term end timestamp to query.\n /// @param candidate The address of the candidate.\n function electionResults(\n uint128 termEnd,\n address candidate\n ) external view returns (bool elected);\n\n /// @notice Returns the BALLOT_BOX_HAT constant.\n function BALLOT_BOX_HAT() external pure returns (uint256);\n\n /// @notice Returns the ADMIN_HAT constant.\n function ADMIN_HAT() external pure returns (uint256);\n\n /**\n * @notice Submit the results of an election for a specified term.\n * @dev Only callable by the wearer(s) of the BALLOT_BOX_HAT.\n * @param _termEnd The id of the term for which the election results are being submitted.\n * @param _winners The addresses of the winners of the election.\n */\n function elect(uint128 _termEnd, address[] calldata _winners) external;\n\n /**\n * @notice Submit the results of a recall election for a specified term.\n * @dev Only callable by the wearer(s) of the BALLOT_BOX_HAT.\n * @param _termEnd The id of the term for which the recall results are being submitted.\n * @param _recallees The addresses to be recalled.\n */\n function recall(uint128 _termEnd, address[] calldata _recallees) external;\n\n /**\n * @notice Set the next term and open the election for it.\n * @dev Only callable by the wearer(s) of the ADMIN_HAT.\n * @param _newTermEnd The id of the term that will be opened.\n */\n function setNextTerm(uint128 _newTermEnd) external;\n\n /**\n * @notice Start the next term, updating the current term.\n * @dev Can be called by anyone, but will revert if conditions are not met.\n */\n function startNextTerm() external;\n\n /**\n * @notice Determine the eligibility and standing of a wearer for a hat.\n * @param _wearer The address of the hat wearer.\n * @param _hatId The ID of the hat.\n * @return eligible True if the wearer is eligible for the hat.\n * @return standing True if the wearer is in good standing.\n */\n function getWearerStatus(\n address _wearer,\n uint256 _hatId\n ) external view returns (bool eligible, bool standing);\n}\n" + }, + "contracts/interfaces/IERC6551Registry.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IERC6551Registry {\n /**\n * @dev Creates a token bound account for a non-fungible token.\n *\n * If account has already been created, returns the account address without calling create2.\n *\n * Emits ERC6551AccountCreated event.\n *\n * @return account The address of the token bound account\n */\n function createAccount(\n address implementation,\n bytes32 salt,\n uint256 chainId,\n address tokenContract,\n uint256 tokenId\n ) external returns (address account);\n}\n" + }, + "contracts/interfaces/sablier/IAdminable.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\npragma solidity >=0.8.22;\n\n/// @title IAdminable\n/// @notice Contract module that provides a basic access control mechanism, with an admin that can be\n/// granted exclusive access to specific functions. The inheriting contract must set the initial admin\n/// in the constructor.\ninterface IAdminable {\n /*//////////////////////////////////////////////////////////////////////////\n EVENTS\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @notice Emitted when the admin is transferred.\n /// @param oldAdmin The address of the old admin.\n /// @param newAdmin The address of the new admin.\n event TransferAdmin(address indexed oldAdmin, address indexed newAdmin);\n\n /*//////////////////////////////////////////////////////////////////////////\n CONSTANT FUNCTIONS\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @notice The address of the admin account or contract.\n function admin() external view returns (address);\n\n /*//////////////////////////////////////////////////////////////////////////\n NON-CONSTANT FUNCTIONS\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @notice Transfers the contract admin to a new address.\n ///\n /// @dev Notes:\n /// - Does not revert if the admin is the same.\n /// - This function can potentially leave the contract without an admin, thereby removing any\n /// functionality that is only available to the admin.\n ///\n /// Requirements:\n /// - `msg.sender` must be the contract admin.\n ///\n /// @param newAdmin The address of the new admin.\n function transferAdmin(address newAdmin) external;\n}\n" + }, + "contracts/interfaces/sablier/IERC4096.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 \"@openzeppelin/contracts/interfaces/IERC165.sol\";\nimport {IERC721} from \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\n\n/// @title ERC-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" + }, + "contracts/interfaces/sablier/ISablierV2Lockup.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\npragma solidity >=0.8.22;\n\nimport {IERC4906} from \"./IERC4096.sol\";\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {IERC721Metadata} from \"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\";\nimport {UD60x18} from \"@prb/math/src/UD60x18.sol\";\n\nimport {Lockup} from \"./types/DataTypes.sol\";\nimport {IAdminable} from \"./IAdminable.sol\";\nimport {ISablierV2NFTDescriptor} from \"./ISablierV2NFTDescriptor.sol\";\n\n/// @title ISablierV2Lockup\n/// @notice Common logic between all Sablier V2 Lockup contracts.\ninterface ISablierV2Lockup is\n IAdminable, // 0 inherited components\n IERC4906, // 2 inherited components\n IERC721Metadata // 2 inherited components\n{\n /*//////////////////////////////////////////////////////////////////////////\n EVENTS\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @notice Emitted when the admin allows a new recipient contract to hook to Sablier.\n /// @param admin The address of the current contract admin.\n /// @param recipient The address of the recipient contract put on the allowlist.\n event AllowToHook(address indexed admin, address recipient);\n\n /// @notice Emitted when a stream is canceled.\n /// @param streamId The ID of the stream.\n /// @param sender The address of the stream's sender.\n /// @param recipient The address of the stream's recipient.\n /// @param asset The contract address of the ERC-20 asset to be distributed.\n /// @param senderAmount The amount of assets refunded to the stream's sender, denoted in units of the asset's\n /// decimals.\n /// @param recipientAmount The amount of assets left for the stream's recipient to withdraw, denoted in units of the\n /// asset's decimals.\n event CancelLockupStream(\n uint256 streamId,\n address indexed sender,\n address indexed recipient,\n IERC20 indexed asset,\n uint128 senderAmount,\n uint128 recipientAmount\n );\n\n /// @notice Emitted when a sender gives up the right to cancel a stream.\n /// @param streamId The ID of the stream.\n event RenounceLockupStream(uint256 indexed streamId);\n\n /// @notice Emitted when the admin sets a new NFT descriptor contract.\n /// @param admin The address of the current contract admin.\n /// @param oldNFTDescriptor The address of the old NFT descriptor contract.\n /// @param newNFTDescriptor The address of the new NFT descriptor contract.\n event SetNFTDescriptor(\n address indexed admin,\n ISablierV2NFTDescriptor oldNFTDescriptor,\n ISablierV2NFTDescriptor newNFTDescriptor\n );\n\n /// @notice Emitted when assets are withdrawn from a stream.\n /// @param streamId The ID of the stream.\n /// @param to The address that has received the withdrawn assets.\n /// @param asset The contract address of the ERC-20 asset to be distributed.\n /// @param amount The amount of assets withdrawn, denoted in units of the asset's decimals.\n event WithdrawFromLockupStream(\n uint256 indexed streamId,\n address indexed to,\n IERC20 indexed asset,\n uint128 amount\n );\n\n /*//////////////////////////////////////////////////////////////////////////\n CONSTANT FUNCTIONS\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @notice Retrieves the address of the ERC-20 asset to be distributed.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function getAsset(uint256 streamId) external view returns (IERC20 asset);\n\n /// @notice Retrieves the amount deposited in the stream, denoted in units of the asset's decimals.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function getDepositedAmount(\n uint256 streamId\n ) external view returns (uint128 depositedAmount);\n\n /// @notice Retrieves the stream's end time, which is a Unix timestamp.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function getEndTime(\n uint256 streamId\n ) external view returns (uint40 endTime);\n\n /// @notice Retrieves the stream's recipient.\n /// @dev Reverts if the NFT has been burned.\n /// @param streamId The stream ID for the query.\n function getRecipient(\n uint256 streamId\n ) external view returns (address recipient);\n\n /// @notice Retrieves the amount refunded to the sender after a cancellation, denoted in units of the asset's\n /// decimals. This amount is always zero unless the stream was canceled.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function getRefundedAmount(\n uint256 streamId\n ) external view returns (uint128 refundedAmount);\n\n /// @notice Retrieves the stream's sender.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function getSender(uint256 streamId) external view returns (address sender);\n\n /// @notice Retrieves the stream's start time, which is a Unix timestamp.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function getStartTime(\n uint256 streamId\n ) external view returns (uint40 startTime);\n\n /// @notice Retrieves the amount withdrawn from the stream, denoted in units of the asset's decimals.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function getWithdrawnAmount(\n uint256 streamId\n ) external view returns (uint128 withdrawnAmount);\n\n /// @notice Retrieves a flag indicating whether the provided address is a contract allowed to hook to Sablier\n /// when a stream is canceled or when assets are withdrawn.\n /// @dev See {ISablierLockupRecipient} for more information.\n function isAllowedToHook(\n address recipient\n ) external view returns (bool result);\n\n /// @notice Retrieves a flag indicating whether the stream can be canceled. When the stream is cold, this\n /// flag is always `false`.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function isCancelable(uint256 streamId) external view returns (bool result);\n\n /// @notice Retrieves a flag indicating whether the stream is cold, i.e. settled, canceled, or depleted.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function isCold(uint256 streamId) external view returns (bool result);\n\n /// @notice Retrieves a flag indicating whether the stream is depleted.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function isDepleted(uint256 streamId) external view returns (bool result);\n\n /// @notice Retrieves a flag indicating whether the stream exists.\n /// @dev Does not revert if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function isStream(uint256 streamId) external view returns (bool result);\n\n /// @notice Retrieves a flag indicating whether the stream NFT can be transferred.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function isTransferable(\n uint256 streamId\n ) external view returns (bool result);\n\n /// @notice Retrieves a flag indicating whether the stream is warm, i.e. either pending or streaming.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function isWarm(uint256 streamId) external view returns (bool result);\n\n /// @notice Retrieves the maximum broker fee that can be charged by the broker, denoted as a fixed-point\n /// number where 1e18 is 100%.\n /// @dev This value is hard coded as a constant.\n function MAX_BROKER_FEE() external view returns (UD60x18);\n\n /// @notice Counter for stream IDs, used in the create functions.\n function nextStreamId() external view returns (uint256);\n\n /// @notice Contract that generates the non-fungible token URI.\n function nftDescriptor() external view returns (ISablierV2NFTDescriptor);\n\n /// @notice Calculates the amount that the sender would be refunded if the stream were canceled, denoted in units\n /// of the asset's decimals.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function refundableAmountOf(\n uint256 streamId\n ) external view returns (uint128 refundableAmount);\n\n /// @notice Retrieves the stream's status.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function statusOf(\n uint256 streamId\n ) external view returns (Lockup.Status status);\n\n /// @notice Calculates the amount streamed to the recipient, denoted in units of the asset's decimals.\n /// @dev Reverts if `streamId` references a null stream.\n ///\n /// Notes:\n /// - Upon cancellation of the stream, the amount streamed is calculated as the difference between the deposited\n /// amount and the refunded amount. Ultimately, when the stream becomes depleted, the streamed amount is equivalent\n /// to the total amount withdrawn.\n ///\n /// @param streamId The stream ID for the query.\n function streamedAmountOf(\n uint256 streamId\n ) external view returns (uint128 streamedAmount);\n\n /// @notice Retrieves a flag indicating whether the stream was canceled.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function wasCanceled(uint256 streamId) external view returns (bool result);\n\n /// @notice Calculates the amount that the recipient can withdraw from the stream, denoted in units of the asset's\n /// decimals.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function withdrawableAmountOf(\n uint256 streamId\n ) external view returns (uint128 withdrawableAmount);\n\n /*//////////////////////////////////////////////////////////////////////////\n NON-CONSTANT FUNCTIONS\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @notice Allows a recipient contract to hook to Sablier when a stream is canceled or when assets are withdrawn.\n /// Useful for implementing contracts that hold streams on behalf of users, such as vaults or staking contracts.\n ///\n /// @dev Emits an {AllowToHook} event.\n ///\n /// Notes:\n /// - Does not revert if the contract is already on the allowlist.\n /// - This is an irreversible operation. The contract cannot be removed from the allowlist.\n ///\n /// Requirements:\n /// - `msg.sender` must be the contract admin.\n /// - `recipient` must have a non-zero code size.\n /// - `recipient` must implement {ISablierLockupRecipient}.\n ///\n /// @param recipient The address of the contract to allow for hooks.\n function allowToHook(address recipient) external;\n\n /// @notice Burns the NFT associated with the stream.\n ///\n /// @dev Emits a {Transfer} event.\n ///\n /// Requirements:\n /// - Must not be delegate called.\n /// - `streamId` must reference a depleted stream.\n /// - The NFT must exist.\n /// - `msg.sender` must be either the NFT owner or an approved third party.\n ///\n /// @param streamId The ID of the stream NFT to burn.\n function burn(uint256 streamId) external;\n\n /// @notice Cancels the stream and refunds any remaining assets to the sender.\n ///\n /// @dev Emits a {Transfer}, {CancelLockupStream}, and {MetadataUpdate} event.\n ///\n /// Notes:\n /// - If there any assets left for the recipient to withdraw, the stream is marked as canceled. Otherwise, the\n /// stream is marked as depleted.\n /// - This function attempts to invoke a hook on the recipient, if the resolved address is a contract.\n ///\n /// Requirements:\n /// - Must not be delegate called.\n /// - The stream must be warm and cancelable.\n /// - `msg.sender` must be the stream's sender.\n ///\n /// @param streamId The ID of the stream to cancel.\n function cancel(uint256 streamId) external;\n\n /// @notice Cancels multiple streams and refunds any remaining assets to the sender.\n ///\n /// @dev Emits multiple {Transfer}, {CancelLockupStream}, and {MetadataUpdate} events.\n ///\n /// Notes:\n /// - Refer to the notes in {cancel}.\n ///\n /// Requirements:\n /// - All requirements from {cancel} must be met for each stream.\n ///\n /// @param streamIds The IDs of the streams to cancel.\n function cancelMultiple(uint256[] calldata streamIds) external;\n\n /// @notice Removes the right of the stream's sender to cancel the stream.\n ///\n /// @dev Emits a {RenounceLockupStream} and {MetadataUpdate} event.\n ///\n /// Notes:\n /// - This is an irreversible operation.\n ///\n /// Requirements:\n /// - Must not be delegate called.\n /// - `streamId` must reference a warm stream.\n /// - `msg.sender` must be the stream's sender.\n /// - The stream must be cancelable.\n ///\n /// @param streamId The ID of the stream to renounce.\n function renounce(uint256 streamId) external;\n\n /// @notice Sets a new NFT descriptor contract, which produces the URI describing the Sablier stream NFTs.\n ///\n /// @dev Emits a {SetNFTDescriptor} and {BatchMetadataUpdate} event.\n ///\n /// Notes:\n /// - Does not revert if the NFT descriptor is the same.\n ///\n /// Requirements:\n /// - `msg.sender` must be the contract admin.\n ///\n /// @param newNFTDescriptor The address of the new NFT descriptor contract.\n function setNFTDescriptor(\n ISablierV2NFTDescriptor newNFTDescriptor\n ) external;\n\n /// @notice Withdraws the provided amount of assets from the stream to the `to` address.\n ///\n /// @dev Emits a {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} event.\n ///\n /// Notes:\n /// - This function attempts to call a hook on the recipient of the stream, unless `msg.sender` is the recipient.\n ///\n /// Requirements:\n /// - Must not be delegate called.\n /// - `streamId` must not reference a null or depleted stream.\n /// - `to` must not be the zero address.\n /// - `amount` must be greater than zero and must not exceed the withdrawable amount.\n /// - `to` must be the recipient if `msg.sender` is not the stream's recipient or an approved third party.\n ///\n /// @param streamId The ID of the stream to withdraw from.\n /// @param to The address receiving the withdrawn assets.\n /// @param amount The amount to withdraw, denoted in units of the asset's decimals.\n function withdraw(uint256 streamId, address to, uint128 amount) external;\n\n /// @notice Withdraws the maximum withdrawable amount from the stream to the provided address `to`.\n ///\n /// @dev Emits a {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} event.\n ///\n /// Notes:\n /// - Refer to the notes in {withdraw}.\n ///\n /// Requirements:\n /// - Refer to the requirements in {withdraw}.\n ///\n /// @param streamId The ID of the stream to withdraw from.\n /// @param to The address receiving the withdrawn assets.\n /// @return withdrawnAmount The amount withdrawn, denoted in units of the asset's decimals.\n function withdrawMax(\n uint256 streamId,\n address to\n ) external returns (uint128 withdrawnAmount);\n\n /// @notice Withdraws the maximum withdrawable amount from the stream to the current recipient, and transfers the\n /// NFT to `newRecipient`.\n ///\n /// @dev Emits a {WithdrawFromLockupStream} and a {Transfer} event.\n ///\n /// Notes:\n /// - If the withdrawable amount is zero, the withdrawal is skipped.\n /// - Refer to the notes in {withdraw}.\n ///\n /// Requirements:\n /// - `msg.sender` must be the stream's recipient.\n /// - Refer to the requirements in {withdraw}.\n /// - Refer to the requirements in {IERC721.transferFrom}.\n ///\n /// @param streamId The ID of the stream NFT to transfer.\n /// @param newRecipient The address of the new owner of the stream NFT.\n /// @return withdrawnAmount The amount withdrawn, denoted in units of the asset's decimals.\n function withdrawMaxAndTransfer(\n uint256 streamId,\n address newRecipient\n ) external returns (uint128 withdrawnAmount);\n\n /// @notice Withdraws assets from streams to the recipient of each stream.\n ///\n /// @dev Emits multiple {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} events.\n ///\n /// Notes:\n /// - This function attempts to call a hook on the recipient of each stream, unless `msg.sender` is the recipient.\n ///\n /// Requirements:\n /// - Must not be delegate called.\n /// - There must be an equal number of `streamIds` and `amounts`.\n /// - Each stream ID in the array must not reference a null or depleted stream.\n /// - Each amount in the array must be greater than zero and must not exceed the withdrawable amount.\n ///\n /// @param streamIds The IDs of the streams to withdraw from.\n /// @param amounts The amounts to withdraw, denoted in units of the asset's decimals.\n function withdrawMultiple(\n uint256[] calldata streamIds,\n uint128[] calldata amounts\n ) external;\n}\n" + }, + "contracts/interfaces/sablier/ISablierV2LockupLinear.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\npragma solidity >=0.8.22;\n\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\nimport {Lockup, LockupLinear} from \"./types/DataTypes.sol\";\nimport {ISablierV2Lockup} from \"./ISablierV2Lockup.sol\";\n\n/// @title ISablierV2LockupLinear\n/// @notice Creates and manages Lockup streams with a linear distribution function.\ninterface ISablierV2LockupLinear is ISablierV2Lockup {\n /*//////////////////////////////////////////////////////////////////////////\n EVENTS\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @notice Emitted when a stream is created.\n /// @param streamId The ID of the newly created stream.\n /// @param funder The address which funded the stream.\n /// @param sender The address distributing the assets, which will have the ability to cancel the stream.\n /// @param recipient The address receiving the assets.\n /// @param amounts Struct encapsulating (i) the deposit amount, and (ii) the broker fee amount, both denoted\n /// in units of the asset's decimals.\n /// @param asset The contract address of the ERC-20 asset to be distributed.\n /// @param cancelable Boolean indicating whether the stream will be cancelable or not.\n /// @param transferable Boolean indicating whether the stream NFT is transferable or not.\n /// @param timestamps Struct encapsulating (i) the stream's start time, (ii) cliff time, and (iii) end time, all as\n /// Unix timestamps.\n /// @param broker The address of the broker who has helped create the stream, e.g. a front-end website.\n event CreateLockupLinearStream(\n uint256 streamId,\n address funder,\n address indexed sender,\n address indexed recipient,\n Lockup.CreateAmounts amounts,\n IERC20 indexed asset,\n bool cancelable,\n bool transferable,\n LockupLinear.Timestamps timestamps,\n address broker\n );\n\n /*//////////////////////////////////////////////////////////////////////////\n CONSTANT FUNCTIONS\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @notice Retrieves the stream's cliff time, which is a Unix timestamp. A value of zero means there\n /// is no cliff.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function getCliffTime(\n uint256 streamId\n ) external view returns (uint40 cliffTime);\n\n /// @notice Retrieves the full stream details.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n /// @return stream See the documentation in {DataTypes}.\n function getStream(\n uint256 streamId\n ) external view returns (LockupLinear.StreamLL memory stream);\n\n /// @notice Retrieves the stream's start, cliff and end timestamps.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n /// @return timestamps See the documentation in {DataTypes}.\n function getTimestamps(\n uint256 streamId\n ) external view returns (LockupLinear.Timestamps memory timestamps);\n\n /*//////////////////////////////////////////////////////////////////////////\n NON-CONSTANT FUNCTIONS\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @notice Creates a stream by setting the start time to `block.timestamp`, and the end time to\n /// the sum of `block.timestamp` and `params.durations.total`. The stream is funded by `msg.sender` and is wrapped\n /// in an ERC-721 NFT.\n ///\n /// @dev Emits a {Transfer} and {CreateLockupLinearStream} event.\n ///\n /// Requirements:\n /// - All requirements in {createWithTimestamps} must be met for the calculated parameters.\n ///\n /// @param params Struct encapsulating the function parameters, which are documented in {DataTypes}.\n /// @return streamId The ID of the newly created stream.\n function createWithDurations(\n LockupLinear.CreateWithDurations calldata params\n ) external returns (uint256 streamId);\n\n /// @notice Creates a stream with the provided start time and end time. The stream is funded by `msg.sender` and is\n /// wrapped in an ERC-721 NFT.\n ///\n /// @dev Emits a {Transfer} and {CreateLockupLinearStream} event.\n ///\n /// Notes:\n /// - A cliff time of zero means there is no cliff.\n /// - As long as the times are ordered, it is not an error for the start or the cliff time to be in the past.\n ///\n /// Requirements:\n /// - Must not be delegate called.\n /// - `params.totalAmount` must be greater than zero.\n /// - If set, `params.broker.fee` must not be greater than `MAX_BROKER_FEE`.\n /// - `params.timestamps.start` must be greater than zero and less than `params.timestamps.end`.\n /// - If set, `params.timestamps.cliff` must be greater than `params.timestamps.start` and less than\n /// `params.timestamps.end`.\n /// - `params.timestamps.end` must be in the future.\n /// - `params.recipient` must not be the zero address.\n /// - `msg.sender` must have allowed this contract to spend at least `params.totalAmount` assets.\n ///\n /// @param params Struct encapsulating the function parameters, which are documented in {DataTypes}.\n /// @return streamId The ID of the newly created stream.\n function createWithTimestamps(\n LockupLinear.CreateWithTimestamps calldata params\n ) external returns (uint256 streamId);\n}\n" + }, + "contracts/interfaces/sablier/ISablierV2NFTDescriptor.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\npragma solidity >=0.8.22;\n\nimport {IERC721Metadata} from \"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\";\n\n/// @title ISablierV2NFTDescriptor\n/// @notice This contract generates the URI describing the Sablier V2 stream NFTs.\n/// @dev Inspired by Uniswap V3 Positions NFTs.\ninterface ISablierV2NFTDescriptor {\n /// @notice Produces the URI describing a particular stream NFT.\n /// @dev This is a data URI with the JSON contents directly inlined.\n /// @param sablier The address of the Sablier contract the stream was created in.\n /// @param streamId The ID of the stream for which to produce a description.\n /// @return uri The URI of the ERC721-compliant metadata.\n function tokenURI(\n IERC721Metadata sablier,\n uint256 streamId\n ) external view returns (string memory uri);\n}\n" + }, + "contracts/interfaces/sablier/types/DataTypes.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\npragma solidity >=0.8.22;\n\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {UD2x18} from \"@prb/math/src/UD2x18.sol\";\nimport {UD60x18} from \"@prb/math/src/UD60x18.sol\";\n\n// DataTypes.sol\n//\n// This file defines all structs used in V2 Core, most of which are organized under three namespaces:\n//\n// - Lockup\n// - LockupDynamic\n// - LockupLinear\n// - LockupTranched\n//\n// You will notice that some structs contain \"slot\" annotations - they are used to indicate the\n// storage layout of the struct. It is more gas efficient to group small data types together so\n// that they fit in a single 32-byte slot.\n\n/// @notice Struct encapsulating the broker parameters passed to the create functions. Both can be set to zero.\n/// @param account The address receiving the broker's fee.\n/// @param fee The broker's percentage fee from the total amount, denoted as a fixed-point number where 1e18 is 100%.\nstruct Broker {\n address account;\n UD60x18 fee;\n}\n\n/// @notice Namespace for the structs used in both {SablierV2LockupLinear} and {SablierV2LockupDynamic}.\nlibrary Lockup {\n /// @notice Struct encapsulating the deposit, withdrawn, and refunded amounts, all denoted in units of the asset's\n /// decimals.\n /// @dev Because the deposited and the withdrawn amount are often read together, declaring them in the same slot\n /// saves gas.\n /// @param deposited The initial amount deposited in the stream, net of broker fee.\n /// @param withdrawn The cumulative amount withdrawn from the stream.\n /// @param refunded The amount refunded to the sender. Unless the stream was canceled, this is always zero.\n struct Amounts {\n // slot 0\n uint128 deposited;\n uint128 withdrawn;\n // slot 1\n uint128 refunded;\n }\n\n /// @notice Struct encapsulating (i) the deposit amount and (ii) the broker fee amount, both denoted in units of the\n /// asset's decimals.\n /// @param deposit The amount to deposit in the stream.\n /// @param brokerFee The broker fee amount.\n struct CreateAmounts {\n uint128 deposit;\n uint128 brokerFee;\n }\n\n /// @notice Enum representing the different statuses of a stream.\n /// @custom:value0 PENDING Stream created but not started; assets are in a pending state.\n /// @custom:value1 STREAMING Active stream where assets are currently being streamed.\n /// @custom:value2 SETTLED All assets have been streamed; recipient is due to withdraw them.\n /// @custom:value3 CANCELED Canceled stream; remaining assets await recipient's withdrawal.\n /// @custom:value4 DEPLETED Depleted stream; all assets have been withdrawn and/or refunded.\n enum Status {\n PENDING,\n STREAMING,\n SETTLED,\n CANCELED,\n DEPLETED\n }\n\n /// @notice A common data structure to be stored in all {SablierV2Lockup} models.\n /// @dev The fields are arranged like this to save gas via tight variable packing.\n /// @param sender The address distributing the assets, with the ability to cancel the stream.\n /// @param startTime The Unix timestamp indicating the stream's start.\n /// @param endTime The Unix timestamp indicating the stream's end.\n /// @param isCancelable Boolean indicating if the stream is cancelable.\n /// @param wasCanceled Boolean indicating if the stream was canceled.\n /// @param asset The contract address of the ERC-20 asset to be distributed.\n /// @param isDepleted Boolean indicating if the stream is depleted.\n /// @param isStream Boolean indicating if the struct entity exists.\n /// @param isTransferable Boolean indicating if the stream NFT is transferable.\n /// @param amounts Struct encapsulating the deposit, withdrawn, and refunded amounts, all denoted in units of the\n /// asset's decimals.\n struct Stream {\n // slot 0\n address sender;\n uint40 startTime;\n uint40 endTime;\n bool isCancelable;\n bool wasCanceled;\n // slot 1\n IERC20 asset;\n bool isDepleted;\n bool isStream;\n bool isTransferable;\n // slot 2 and 3\n Lockup.Amounts amounts;\n }\n}\n\n/// @notice Namespace for the structs used in {SablierV2LockupDynamic}.\nlibrary LockupDynamic {\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupDynamic.createWithDurations} function.\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\n /// the same as `msg.sender`.\n /// @param recipient The address receiving the assets.\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\n /// broker fee, denoted in units of the asset's decimals.\n /// @param asset The contract address of the ERC-20 asset to be distributed.\n /// @param cancelable Indicates if the stream is cancelable.\n /// @param transferable Indicates if the stream NFT is transferable.\n /// @param segments Segments with durations used to compose the dynamic distribution function. Timestamps are\n /// calculated by starting from `block.timestamp` and adding each duration to the previous timestamp.\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\n struct CreateWithDurations {\n address sender;\n address recipient;\n uint128 totalAmount;\n IERC20 asset;\n bool cancelable;\n bool transferable;\n SegmentWithDuration[] segments;\n Broker broker;\n }\n\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupDynamic.createWithTimestamps} function.\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\n /// the same as `msg.sender`.\n /// @param recipient The address receiving the assets.\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\n /// broker fee, denoted in units of the asset's decimals.\n /// @param asset The contract address of the ERC-20 asset to be distributed.\n /// @param cancelable Indicates if the stream is cancelable.\n /// @param transferable Indicates if the stream NFT is transferable.\n /// @param startTime The Unix timestamp indicating the stream's start.\n /// @param segments Segments used to compose the dynamic distribution function.\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\n struct CreateWithTimestamps {\n address sender;\n address recipient;\n uint128 totalAmount;\n IERC20 asset;\n bool cancelable;\n bool transferable;\n uint40 startTime;\n Segment[] segments;\n Broker broker;\n }\n\n /// @notice Segment struct used in the Lockup Dynamic stream.\n /// @param amount The amount of assets to be streamed in the segment, denoted in units of the asset's decimals.\n /// @param exponent The exponent of the segment, denoted as a fixed-point number.\n /// @param timestamp The Unix timestamp indicating the segment's end.\n struct Segment {\n // slot 0\n uint128 amount;\n UD2x18 exponent;\n uint40 timestamp;\n }\n\n /// @notice Segment struct used at runtime in {SablierV2LockupDynamic.createWithDurations}.\n /// @param amount The amount of assets to be streamed in the segment, denoted in units of the asset's decimals.\n /// @param exponent The exponent of the segment, denoted as a fixed-point number.\n /// @param duration The time difference in seconds between the segment and the previous one.\n struct SegmentWithDuration {\n uint128 amount;\n UD2x18 exponent;\n uint40 duration;\n }\n\n /// @notice Struct encapsulating the full details of a stream.\n /// @dev Extends `Lockup.Stream` by including the recipient and the segments.\n struct StreamLD {\n address sender;\n address recipient;\n uint40 startTime;\n uint40 endTime;\n bool isCancelable;\n bool wasCanceled;\n IERC20 asset;\n bool isDepleted;\n bool isStream;\n bool isTransferable;\n Lockup.Amounts amounts;\n Segment[] segments;\n }\n\n /// @notice Struct encapsulating the LockupDynamic timestamps.\n /// @param start The Unix timestamp indicating the stream's start.\n /// @param end The Unix timestamp indicating the stream's end.\n struct Timestamps {\n uint40 start;\n uint40 end;\n }\n}\n\n/// @notice Namespace for the structs used in {SablierV2LockupLinear}.\nlibrary LockupLinear {\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupLinear.createWithDurations} function.\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\n /// the same as `msg.sender`.\n /// @param recipient The address receiving the assets.\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\n /// broker fee, denoted in units of the asset's decimals.\n /// @param asset The contract address of the ERC-20 asset to be distributed.\n /// @param cancelable Indicates if the stream is cancelable.\n /// @param transferable Indicates if the stream NFT is transferable.\n /// @param durations Struct encapsulating (i) cliff period duration and (ii) total stream duration, both in seconds.\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\n struct CreateWithDurations {\n address sender;\n address recipient;\n uint128 totalAmount;\n IERC20 asset;\n bool cancelable;\n bool transferable;\n Durations durations;\n Broker broker;\n }\n\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupLinear.createWithTimestamps} function.\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\n /// the same as `msg.sender`.\n /// @param recipient The address receiving the assets.\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\n /// broker fee, denoted in units of the asset's decimals.\n /// @param asset The contract address of the ERC-20 asset to be distributed.\n /// @param cancelable Indicates if the stream is cancelable.\n /// @param transferable Indicates if the stream NFT is transferable.\n /// @param timestamps Struct encapsulating (i) the stream's start time, (ii) cliff time, and (iii) end time, all as\n /// Unix timestamps.\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\n struct CreateWithTimestamps {\n address sender;\n address recipient;\n uint128 totalAmount;\n IERC20 asset;\n bool cancelable;\n bool transferable;\n Timestamps timestamps;\n Broker broker;\n }\n\n /// @notice Struct encapsulating the cliff duration and the total duration.\n /// @param cliff The cliff duration in seconds.\n /// @param total The total duration in seconds.\n struct Durations {\n uint40 cliff;\n uint40 total;\n }\n\n /// @notice Struct encapsulating the full details of a stream.\n /// @dev Extends `Lockup.Stream` by including the recipient and the cliff time.\n struct StreamLL {\n address sender;\n address recipient;\n uint40 startTime;\n bool isCancelable;\n bool wasCanceled;\n IERC20 asset;\n uint40 endTime;\n bool isDepleted;\n bool isStream;\n bool isTransferable;\n Lockup.Amounts amounts;\n uint40 cliffTime;\n }\n\n /// @notice Struct encapsulating the LockupLinear timestamps.\n /// @param start The Unix timestamp for the stream's start.\n /// @param cliff The Unix timestamp for the cliff period's end. A value of zero means there is no cliff.\n /// @param end The Unix timestamp for the stream's end.\n struct Timestamps {\n uint40 start;\n uint40 cliff;\n uint40 end;\n }\n}\n\n/// @notice Namespace for the structs used in {SablierV2LockupTranched}.\nlibrary LockupTranched {\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupTranched.createWithDurations} function.\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\n /// the same as `msg.sender`.\n /// @param recipient The address receiving the assets.\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\n /// broker fee, denoted in units of the asset's decimals.\n /// @param asset The contract address of the ERC-20 asset to be distributed.\n /// @param cancelable Indicates if the stream is cancelable.\n /// @param transferable Indicates if the stream NFT is transferable.\n /// @param tranches Tranches with durations used to compose the tranched distribution function. Timestamps are\n /// calculated by starting from `block.timestamp` and adding each duration to the previous timestamp.\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\n struct CreateWithDurations {\n address sender;\n address recipient;\n uint128 totalAmount;\n IERC20 asset;\n bool cancelable;\n bool transferable;\n TrancheWithDuration[] tranches;\n Broker broker;\n }\n\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupTranched.createWithTimestamps} function.\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\n /// the same as `msg.sender`.\n /// @param recipient The address receiving the assets.\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\n /// broker fee, denoted in units of the asset's decimals.\n /// @param asset The contract address of the ERC-20 asset to be distributed.\n /// @param cancelable Indicates if the stream is cancelable.\n /// @param transferable Indicates if the stream NFT is transferable.\n /// @param startTime The Unix timestamp indicating the stream's start.\n /// @param tranches Tranches used to compose the tranched distribution function.\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\n struct CreateWithTimestamps {\n address sender;\n address recipient;\n uint128 totalAmount;\n IERC20 asset;\n bool cancelable;\n bool transferable;\n uint40 startTime;\n Tranche[] tranches;\n Broker broker;\n }\n\n /// @notice Struct encapsulating the full details of a stream.\n /// @dev Extends `Lockup.Stream` by including the recipient and the tranches.\n struct StreamLT {\n address sender;\n address recipient;\n uint40 startTime;\n uint40 endTime;\n bool isCancelable;\n bool wasCanceled;\n IERC20 asset;\n bool isDepleted;\n bool isStream;\n bool isTransferable;\n Lockup.Amounts amounts;\n Tranche[] tranches;\n }\n\n /// @notice Struct encapsulating the LockupTranched timestamps.\n /// @param start The Unix timestamp indicating the stream's start.\n /// @param end The Unix timestamp indicating the stream's end.\n struct Timestamps {\n uint40 start;\n uint40 end;\n }\n\n /// @notice Tranche struct used in the Lockup Tranched stream.\n /// @param amount The amount of assets to be unlocked in the tranche, denoted in units of the asset's decimals.\n /// @param timestamp The Unix timestamp indicating the tranche's end.\n struct Tranche {\n // slot 0\n uint128 amount;\n uint40 timestamp;\n }\n\n /// @notice Tranche struct used at runtime in {SablierV2LockupTranched.createWithDurations}.\n /// @param amount The amount of assets to be unlocked in the tranche, denoted in units of the asset's decimals.\n /// @param duration The time difference in seconds between the tranche and the previous one.\n struct TrancheWithDuration {\n uint128 amount;\n uint40 duration;\n }\n}\n" + }, + "contracts/mocks/ERC6551Registry.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IERC6551Registry {\n /**\n * @dev The registry MUST emit the ERC6551AccountCreated event upon successful account creation.\n */\n event ERC6551AccountCreated(\n address account,\n address indexed implementation,\n bytes32 salt,\n uint256 chainId,\n address indexed tokenContract,\n uint256 indexed tokenId\n );\n\n /**\n * @dev The registry MUST revert with AccountCreationFailed error if the create2 operation fails.\n */\n error AccountCreationFailed();\n\n /**\n * @dev Creates a token bound account for a non-fungible token.\n *\n * If account has already been created, returns the account address without calling create2.\n *\n * Emits ERC6551AccountCreated event.\n *\n * @return account The address of the token bound account\n */\n function createAccount(\n address implementation,\n bytes32 salt,\n uint256 chainId,\n address tokenContract,\n uint256 tokenId\n ) external returns (address account);\n\n /**\n * @dev Returns the computed token bound account address for a non-fungible token.\n *\n * @return account The address of the token bound account\n */\n function account(\n address implementation,\n bytes32 salt,\n uint256 chainId,\n address tokenContract,\n uint256 tokenId\n ) external view returns (address account);\n}\n\ncontract ERC6551Registry is IERC6551Registry {\n function createAccount(\n address implementation,\n bytes32 salt,\n uint256 chainId,\n address tokenContract,\n uint256 tokenId\n ) external returns (address) {\n assembly {\n // Memory Layout:\n // ----\n // 0x00 0xff (1 byte)\n // 0x01 registry (address) (20 bytes)\n // 0x15 salt (bytes32) (32 bytes)\n // 0x35 Bytecode Hash (bytes32) (32 bytes)\n // ----\n // 0x55 ERC-1167 Constructor + Header (20 bytes)\n // 0x69 implementation (address) (20 bytes)\n // 0x5D ERC-1167 Footer (15 bytes)\n // 0x8C salt (uint256) (32 bytes)\n // 0xAC chainId (uint256) (32 bytes)\n // 0xCC tokenContract (address) (32 bytes)\n // 0xEC tokenId (uint256) (32 bytes)\n\n // Silence unused variable warnings\n pop(chainId)\n\n // Copy bytecode + constant data to memory\n calldatacopy(0x8c, 0x24, 0x80) // salt, chainId, tokenContract, tokenId\n mstore(0x6c, 0x5af43d82803e903d91602b57fd5bf3) // ERC-1167 footer\n mstore(0x5d, implementation) // implementation\n mstore(0x49, 0x3d60ad80600a3d3981f3363d3d373d3d3d363d73) // ERC-1167 constructor + header\n\n // Copy create2 computation data to memory\n mstore8(0x00, 0xff) // 0xFF\n mstore(0x35, keccak256(0x55, 0xb7)) // keccak256(bytecode)\n mstore(0x01, shl(96, address())) // registry address\n mstore(0x15, salt) // salt\n\n // Compute account address\n let computed := keccak256(0x00, 0x55)\n\n // If the account has not yet been deployed\n if iszero(extcodesize(computed)) {\n // Deploy account contract\n let deployed := create2(0, 0x55, 0xb7, salt)\n\n // Revert if the deployment fails\n if iszero(deployed) {\n mstore(0x00, 0x20188a59) // `AccountCreationFailed()`\n revert(0x1c, 0x04)\n }\n\n // Store account address in memory before salt and chainId\n mstore(0x6c, deployed)\n\n // Emit the ERC6551AccountCreated event\n log4(\n 0x6c,\n 0x60,\n // `ERC6551AccountCreated(address,address,bytes32,uint256,address,uint256)`\n 0x79f19b3655ee38b1ce526556b7731a20c8f218fbda4a3990b6cc4172fdf88722,\n implementation,\n tokenContract,\n tokenId\n )\n\n // Return the account address\n return(0x6c, 0x20)\n }\n\n // Otherwise, return the computed account address\n mstore(0x00, shr(96, shl(96, computed)))\n return(0x00, 0x20)\n }\n }\n\n function account(\n address implementation,\n bytes32 salt,\n uint256 chainId,\n address tokenContract,\n uint256 tokenId\n ) external view returns (address) {\n assembly {\n // Silence unused variable warnings\n pop(chainId)\n pop(tokenContract)\n pop(tokenId)\n\n // Copy bytecode + constant data to memory\n calldatacopy(0x8c, 0x24, 0x80) // salt, chainId, tokenContract, tokenId\n mstore(0x6c, 0x5af43d82803e903d91602b57fd5bf3) // ERC-1167 footer\n mstore(0x5d, implementation) // implementation\n mstore(0x49, 0x3d60ad80600a3d3981f3363d3d373d3d3d363d73) // ERC-1167 constructor + header\n\n // Copy create2 computation data to memory\n mstore8(0x00, 0xff) // 0xFF\n mstore(0x35, keccak256(0x55, 0xb7)) // keccak256(bytecode)\n mstore(0x01, shl(96, address())) // registry address\n mstore(0x15, salt) // salt\n\n // Store computed account address in memory\n mstore(0x00, shr(96, shl(96, keccak256(0x00, 0x55))))\n\n // Return computed account address\n return(0x00, 0x20)\n }\n }\n}\n" + }, + "contracts/mocks/MockContract.sol": { + "content": "//SPDX-License-Identifier: Unlicense\n\npragma solidity ^0.8.19;\n\n/**\n * Mock contract for testing\n */\ncontract MockContract {\n event DidSomething(string message);\n\n error Reverting();\n\n function doSomething() public {\n doSomethingWithParam(\"doSomething()\");\n }\n\n function doSomethingWithParam(string memory _message) public {\n emit DidSomething(_message);\n }\n\n function returnSomething(string memory _s)\n external\n pure\n returns (string memory)\n {\n return _s;\n }\n\n function revertSomething() external pure {\n revert Reverting();\n }\n}\n" + }, + "contracts/mocks/MockDecentHatsUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.28;\n\nimport {DecentHatsModuleUtils} from \"../modules/DecentHatsModuleUtils.sol\";\n\ncontract MockDecentHatsModuleUtils is DecentHatsModuleUtils {\n // Expose the internal _processHat function for testing\n function processRoleHats(CreateRoleHatsParams calldata params) external {\n _processRoleHats(params);\n }\n}\n" + }, + "contracts/mocks/MockHatsElectionsEligibility.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\nimport {IHatsElectionsEligibility} from \"../interfaces/hats/modules/IHatsElectionsEligibility.sol\";\n\ncontract MockHatsElectionsEligibility is IHatsElectionsEligibility {\n // Storage\n mapping(uint128 termEnd => mapping(address candidates => bool elected))\n public electionResults;\n mapping(uint128 termEnd => bool isElectionOpen) public electionStatus;\n uint128 public currentTermEnd;\n uint128 public nextTermEnd;\n\n // Errors\n error AlreadySetup();\n error ElectionNotOpen();\n error InvalidTermEnd();\n error NoActiveElection();\n error ElectionClosed(uint128 termEnd);\n error TermNotEnded();\n error NextTermNotReady();\n error TooManyWinners();\n\n modifier onlyOnce() {\n if (currentTermEnd != 0) revert AlreadySetup();\n _;\n }\n\n function _setUp(bytes calldata _initData) external onlyOnce {\n // decode init data\n uint128 _firstTermEnd = abi.decode(_initData, (uint128));\n require(\n _firstTermEnd > block.timestamp,\n \"First term must end in the future\"\n );\n\n currentTermEnd = _firstTermEnd;\n\n // open the first election\n electionStatus[_firstTermEnd] = true;\n\n // log the first term\n emit ElectionOpened(_firstTermEnd);\n }\n\n function elect(uint128 _termEnd, address[] calldata _winners) external {\n // results can only be submitted for open elections\n if (!electionStatus[_termEnd]) revert ElectionClosed(_termEnd);\n\n // close the election\n electionStatus[_termEnd] = false;\n\n // set the election results\n for (uint256 i; i < _winners.length; ) {\n electionResults[_termEnd][_winners[i]] = true;\n\n unchecked {\n ++i;\n }\n }\n\n // log the election results\n emit ElectionCompleted(_termEnd, _winners);\n }\n\n function recall(uint128 _termEnd, address[] calldata _recallees) external {\n // loop through the accounts and set their election status to false\n for (uint256 i; i < _recallees.length; ) {\n electionResults[_termEnd][_recallees[i]] = false;\n\n unchecked {\n ++i;\n }\n }\n\n emit Recalled(_termEnd, _recallees);\n }\n\n function setNextTerm(uint128 _newTermEnd) external {\n // new term must end after current term\n if (_newTermEnd <= currentTermEnd) revert InvalidTermEnd();\n\n // if next term is already set, its election must still be open\n uint128 next = nextTermEnd;\n if (next > 0 && !electionStatus[next]) revert ElectionClosed(next);\n\n // set the next term\n nextTermEnd = _newTermEnd;\n\n // open the next election\n electionStatus[_newTermEnd] = true;\n\n // log the new term\n emit ElectionOpened(_newTermEnd);\n }\n\n function startNextTerm() external {\n // current term must be over\n if (block.timestamp < currentTermEnd) revert TermNotEnded();\n\n uint128 next = nextTermEnd; // save SLOADs\n\n // next term must be set and its election must be closed\n if (next == 0 || electionStatus[next]) revert NextTermNotReady();\n\n // set the current term to the next term\n currentTermEnd = next;\n\n // clear the next term\n nextTermEnd = 0;\n\n // log the change\n emit NewTermStarted(next);\n }\n\n function getWearerStatus(\n address _wearer,\n uint256 /* _hatId */\n ) public view override returns (bool eligible, bool standing) {\n /// @dev This eligibility module is not concerned with standing, so we default it to good standing\n standing = true;\n\n uint128 current = currentTermEnd; // save SLOAD\n\n if (block.timestamp < current) {\n // if the current term is still open, the wearer is eligible if they have been elected for the current term\n eligible = electionResults[current][_wearer];\n }\n // if the current term is closed, the wearer is not eligible\n }\n\n // // Test helper functions\n // function setWearerStatus(address wearer, bool eligible) external {\n // electionResults[currentTermEnd][wearer] = eligible;\n // }\n\n function BALLOT_BOX_HAT() external pure override returns (uint256) {}\n\n function ADMIN_HAT() external pure override returns (uint256) {}\n}\n" + }, + "contracts/mocks/MockHatsModuleFactory.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport {IHatsModuleFactory} from \"../interfaces/hats/IHatsModuleFactory.sol\";\nimport {MockHatsElectionsEligibility} from \"./MockHatsElectionsEligibility.sol\";\n\ncontract MockHatsModuleFactory is IHatsModuleFactory {\n function createHatsModule(\n address,\n uint256,\n bytes calldata,\n bytes calldata _initData,\n uint256\n ) external override returns (address _instance) {\n // Deploy a new instance of MockHatsElectionsEligibility\n MockHatsElectionsEligibility newModule = new MockHatsElectionsEligibility();\n newModule._setUp(_initData);\n _instance = address(newModule);\n }\n\n function getHatsModuleAddress(\n address _implementation,\n uint256 _hatId,\n bytes calldata _otherImmutableArgs,\n uint256 _saltNonce\n ) external view returns (address) {}\n\n function HATS() external view override returns (address) {}\n\n function version() external view override returns (string memory) {}\n\n function batchCreateHatsModule(\n address[] calldata _implementations,\n uint256[] calldata _hatIds,\n bytes[] calldata _otherImmutableArgsArray,\n bytes[] calldata _initDataArray,\n uint256[] calldata _saltNonces\n ) external override returns (bool success) {}\n\n function deployed(\n address _implementation,\n uint256 _hatId,\n bytes calldata _otherImmutableArgs,\n uint256 _saltNonce\n ) external view override returns (bool) {}\n}\n" + }, + "contracts/mocks/MockLockupLinear.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\nlibrary MockLockupLinear {\n struct CreateWithTimestamps {\n address sender;\n address recipient;\n uint128 totalAmount;\n IERC20 asset;\n bool cancelable;\n bool transferable;\n Timestamps timestamps;\n Broker broker;\n }\n\n struct Timestamps {\n uint40 start;\n uint40 cliff;\n uint40 end;\n }\n\n struct Broker {\n address account;\n uint256 fee;\n }\n\n struct Stream {\n address sender;\n uint40 startTime;\n uint40 endTime;\n uint40 cliffTime;\n bool cancelable;\n bool wasCanceled;\n address asset;\n bool transferable;\n uint128 totalAmount;\n address recipient;\n }\n\n /// @notice Enum representing the different statuses of a stream.\n /// @custom:value0 PENDING Stream created but not started; assets are in a pending state.\n /// @custom:value1 STREAMING Active stream where assets are currently being streamed.\n /// @custom:value2 SETTLED All assets have been streamed; recipient is due to withdraw them.\n /// @custom:value3 CANCELED Canceled stream; remaining assets await recipient's withdrawal.\n /// @custom:value4 DEPLETED Depleted stream; all assets have been withdrawn and/or refunded.\n enum Status {\n PENDING,\n STREAMING,\n SETTLED,\n CANCELED,\n DEPLETED\n }\n}\n" + }, + "contracts/mocks/MockSablierV2LockupLinear.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.22;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {ISablierV2LockupLinear} from \"../interfaces/sablier/ISablierV2LockupLinear.sol\";\nimport {MockLockupLinear} from \"./MockLockupLinear.sol\";\n\ncontract MockSablierV2LockupLinear {\n mapping(uint256 => MockLockupLinear.Stream) public streams;\n uint256 public nextStreamId = 1;\n\n // Add this event declaration at the contract level\n event StreamCreated(\n uint256 streamId,\n address indexed sender,\n address indexed recipient,\n uint128 totalAmount,\n address indexed asset,\n bool cancelable,\n bool transferable,\n uint40 startTime,\n uint40 cliffTime,\n uint40 endTime\n );\n\n function createWithTimestamps(\n MockLockupLinear.CreateWithTimestamps calldata params\n ) external returns (uint256 streamId) {\n require(\n params.asset.transferFrom(\n msg.sender,\n address(this),\n params.totalAmount\n ),\n \"Token transfer failed\"\n );\n\n streamId = nextStreamId++;\n streams[streamId] = MockLockupLinear.Stream({\n sender: params.sender,\n recipient: params.recipient,\n totalAmount: params.totalAmount,\n asset: address(params.asset),\n cancelable: params.cancelable,\n wasCanceled: false,\n transferable: params.transferable,\n startTime: params.timestamps.start,\n cliffTime: params.timestamps.cliff,\n endTime: params.timestamps.end\n });\n\n // Emit the StreamCreated event\n emit StreamCreated(\n streamId,\n params.sender,\n params.recipient,\n params.totalAmount,\n address(params.asset),\n params.cancelable,\n params.transferable,\n params.timestamps.start,\n params.timestamps.cliff,\n params.timestamps.end\n );\n\n return streamId;\n }\n\n function getStream(\n uint256 streamId\n ) external view returns (MockLockupLinear.Stream memory) {\n return streams[streamId];\n }\n\n function withdrawableAmountOf(\n uint256 streamId\n ) public view returns (uint128) {\n MockLockupLinear.Stream memory stream = streams[streamId];\n if (block.timestamp <= stream.startTime) {\n return 0;\n }\n if (block.timestamp >= stream.endTime) {\n return stream.totalAmount;\n }\n return\n uint128(\n (stream.totalAmount * (block.timestamp - stream.startTime)) /\n (stream.endTime - stream.startTime)\n );\n }\n\n function withdrawMax(\n uint256 streamId,\n address to\n ) external returns (uint128 withdrawnAmount) {\n withdrawnAmount = withdrawableAmountOf(streamId);\n MockLockupLinear.Stream storage stream = streams[streamId];\n\n require(\n msg.sender == stream.recipient,\n \"Only recipient can call withdraw\"\n );\n require(\n withdrawnAmount <= withdrawableAmountOf(streamId),\n \"Insufficient withdrawable amount\"\n );\n\n stream.totalAmount -= withdrawnAmount;\n IERC20(stream.asset).transfer(to, withdrawnAmount);\n }\n\n function cancel(uint256 streamId) external {\n MockLockupLinear.Stream memory stream = streams[streamId];\n require(stream.cancelable, \"Stream is not cancelable\");\n require(msg.sender == stream.sender, \"Only sender can cancel\");\n\n uint128 withdrawableAmount = withdrawableAmountOf(streamId);\n uint128 refundAmount = stream.totalAmount - withdrawableAmount;\n\n streams[streamId].wasCanceled = true;\n\n if (withdrawableAmount > 0) {\n IERC20(stream.asset).transfer(stream.recipient, withdrawableAmount);\n }\n if (refundAmount > 0) {\n IERC20(stream.asset).transfer(stream.sender, refundAmount);\n }\n }\n\n function isCancelable(uint256 streamId) external view returns (bool) {\n return streams[streamId].cancelable;\n }\n\n /// @dev Retrieves the stream's status without performing a null check.\n function statusOf(\n uint256 streamId\n ) public view returns (MockLockupLinear.Status) {\n uint256 withdrawableAmount = withdrawableAmountOf(streamId);\n if (withdrawableAmount == 0) {\n return MockLockupLinear.Status.DEPLETED;\n } else if (streams[streamId].wasCanceled) {\n return MockLockupLinear.Status.CANCELED;\n }\n\n if (block.timestamp < streams[streamId].startTime) {\n return MockLockupLinear.Status.PENDING;\n }\n\n if (block.timestamp < streams[streamId].endTime) {\n return MockLockupLinear.Status.STREAMING;\n } else {\n return MockLockupLinear.Status.SETTLED;\n }\n }\n}\n" + }, + "contracts/modules/DecentHatsCreationModule.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.28;\n\nimport {Enum} from \"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\";\nimport {IAvatar} from \"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol\";\nimport {Strings} from \"@openzeppelin/contracts/utils/Strings.sol\";\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {IERC6551Registry} from \"../interfaces/IERC6551Registry.sol\";\nimport {IHats} from \"../interfaces/hats/IHats.sol\";\nimport {LockupLinear, Broker} from \"../interfaces/sablier/types/DataTypes.sol\";\nimport {IHatsModuleFactory} from \"../interfaces/hats/IHatsModuleFactory.sol\";\nimport {IHatsElectionsEligibility} from \"../interfaces/hats/modules/IHatsElectionsEligibility.sol\";\nimport {ModuleProxyFactory} from \"@gnosis.pm/zodiac/contracts/factory/ModuleProxyFactory.sol\";\nimport {ISablierV2LockupLinear} from \"../interfaces/sablier/ISablierV2LockupLinear.sol\";\nimport {DecentHatsModuleUtils} from \"./DecentHatsModuleUtils.sol\";\n\ncontract DecentHatsCreationModule is DecentHatsModuleUtils {\n struct TopHatParams {\n string details;\n string imageURI;\n }\n\n struct AdminHatParams {\n string details;\n string imageURI;\n bool isMutable;\n }\n\n struct CreateTreeParams {\n IHats hatsProtocol;\n IERC6551Registry erc6551Registry;\n IHatsModuleFactory hatsModuleFactory;\n ModuleProxyFactory moduleProxyFactory;\n address keyValuePairs;\n address decentAutonomousAdminImplementation;\n address hatsAccountImplementation;\n address hatsElectionsEligibilityImplementation;\n TopHatParams topHat;\n AdminHatParams adminHat;\n HatParams[] hats;\n }\n\n /* /////////////////////////////////////////////////////////////////////////////\n EXTERNAL FUNCTIONS\n ///////////////////////////////////////////////////////////////////////////// */\n /**\n * @notice For a safe without any roles previously created on it, this function should be called. It sets up the\n * top hat and admin hat, as well as any other hats and their streams that are provided, then transfers the top hat\n * to the calling safe.\n *\n * @notice This contract should be enabled a module on the Safe for which the role(s) are to be created, and disabled after.\n *\n * @dev For each hat that is included, if the hat is:\n * - termed, its stream funds on are targeted directly at the nominated wearer. The wearer should directly call `withdraw-`\n * on the Sablier contract.\n * - untermed, its stream funds are targeted at the hat's smart account. In order to withdraw funds from the stream, the\n * hat's smart account must be the one call to `withdraw-` on the Sablier contract, setting the recipient arg to its wearer.\n *\n * @dev In order for a Safe to seamlessly create roles even if it has never previously created a role and thus has\n * no hat tree, we defer the creation of the hat tree and its setup to this contract. This way, in a single tx block,\n * the resulting topHatId of the newly created hat can be used to create an admin hat and any other hats needed.\n * We also make use of `KeyValuePairs` to associate the topHatId with the Safe.\n *\n * @param treeParams The parameters for creating the Hat Tree with Roles\n */\n function createAndDeclareTree(\n CreateTreeParams calldata treeParams\n ) external {\n // Create Top Hat\n (uint256 topHatId, address topHatAccount) = _processTopHat(\n treeParams.hatsProtocol,\n treeParams.erc6551Registry,\n treeParams.hatsAccountImplementation,\n treeParams.keyValuePairs,\n treeParams.topHat\n );\n\n // Create Admin Hat\n uint256 adminHatId = _processAdminHat(\n treeParams.hatsProtocol,\n treeParams.erc6551Registry,\n treeParams.hatsAccountImplementation,\n topHatId,\n topHatAccount,\n treeParams.moduleProxyFactory,\n treeParams.decentAutonomousAdminImplementation,\n treeParams.adminHat\n );\n\n // Create Role Hats\n _processRoleHats(\n CreateRoleHatsParams({\n hatsProtocol: treeParams.hatsProtocol,\n erc6551Registry: treeParams.erc6551Registry,\n hatsAccountImplementation: treeParams.hatsAccountImplementation,\n topHatId: topHatId,\n topHatAccount: topHatAccount,\n hatsModuleFactory: treeParams.hatsModuleFactory,\n hatsElectionsEligibilityImplementation: treeParams\n .hatsElectionsEligibilityImplementation,\n adminHatId: adminHatId,\n hats: treeParams.hats,\n keyValuePairs: treeParams.keyValuePairs\n })\n );\n }\n\n /* /////////////////////////////////////////////////////////////////////////////\n INTERNAL FUNCTIONS\n ///////////////////////////////////////////////////////////////////////////// */\n\n function _processTopHat(\n IHats hatsProtocol,\n IERC6551Registry erc6551Registry,\n address hatsAccountImplementation,\n address keyValuePairs,\n TopHatParams calldata topHat\n ) internal returns (uint256 topHatId, address topHatAccount) {\n // Call lastTopHatId() and properly decode the response\n (bool success, bytes memory data) = address(hatsProtocol).call(\n abi.encodeWithSignature(\"lastTopHatId()\")\n );\n require(success, \"Failed to get lastTopHatId\");\n topHatId = (abi.decode(data, (uint256)) + 1) << 224;\n\n // Mint Top Hat to the Safe\n IAvatar(msg.sender).execTransactionFromModule(\n address(hatsProtocol),\n 0,\n abi.encodeWithSignature(\n \"mintTopHat(address,string,string)\",\n msg.sender,\n topHat.details,\n topHat.imageURI\n ),\n Enum.Operation.Call\n );\n\n // Create Top Hat's ERC6551 Account\n topHatAccount = erc6551Registry.createAccount(\n hatsAccountImplementation,\n SALT,\n block.chainid,\n address(hatsProtocol),\n topHatId\n );\n\n // Declare Top Hat ID to Safe via KeyValuePairs\n string[] memory keys = new string[](1);\n string[] memory values = new string[](1);\n keys[0] = \"topHatId\";\n values[0] = Strings.toString(topHatId);\n IAvatar(msg.sender).execTransactionFromModule(\n keyValuePairs,\n 0,\n abi.encodeWithSignature(\n \"updateValues(string[],string[])\",\n keys,\n values\n ),\n Enum.Operation.Call\n );\n }\n\n function _processAdminHat(\n IHats hatsProtocol,\n IERC6551Registry erc6551Registry,\n address hatsAccountImplementation,\n uint256 topHatId,\n address topHatAccount,\n ModuleProxyFactory moduleProxyFactory,\n address decentAutonomousAdminImplementation,\n AdminHatParams calldata adminHat\n ) internal returns (uint256 adminHatId) {\n // Create Admin Hat\n adminHatId = hatsProtocol.getNextId(topHatId);\n IAvatar(msg.sender).execTransactionFromModule(\n address(hatsProtocol),\n 0,\n abi.encodeWithSignature(\n \"createHat(uint256,string,uint32,address,address,bool,string)\",\n topHatId,\n adminHat.details,\n 1, // only one Admin Hat\n topHatAccount,\n topHatAccount,\n adminHat.isMutable,\n adminHat.imageURI\n ),\n Enum.Operation.Call\n );\n\n // Create Admin Hat's ERC6551 Account\n erc6551Registry.createAccount(\n hatsAccountImplementation,\n SALT,\n block.chainid,\n address(hatsProtocol),\n adminHatId\n );\n\n // Deploy Decent Autonomous Admin Module, which will wear the Admin Hat\n address autonomousAdmin = moduleProxyFactory.deployModule(\n decentAutonomousAdminImplementation,\n abi.encodeWithSignature(\"setUp(bytes)\", bytes(\"\")),\n uint256(\n keccak256(\n abi.encodePacked(\n // for the salt, we'll concatenate our static salt\n // with the Admin Hat ID\n SALT,\n adminHatId\n )\n )\n )\n );\n\n // Mint Hat to the Decent Autonomous Admin Module\n IAvatar(msg.sender).execTransactionFromModule(\n address(hatsProtocol),\n 0,\n abi.encodeWithSignature(\n \"mintHat(uint256,address)\",\n adminHatId,\n autonomousAdmin\n ),\n Enum.Operation.Call\n );\n }\n}\n" + }, + "contracts/modules/DecentHatsModificationModule.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.28;\n\nimport {DecentHatsModuleUtils} from \"./DecentHatsModuleUtils.sol\";\n\ncontract DecentHatsModificationModule is DecentHatsModuleUtils {\n /**\n * @notice Creates a new termed or untermed role hat and any streams on it.\n *\n * @notice This contract should be enabled a module on the Safe for which the role is to be created, and disabled after.\n *\n * @dev Stream funds on untermed Roles are targeted at the hat's smart account. In order to withdraw funds from the stream, the\n * hat's smart account must be the one call to `withdraw-` on the Sablier contract, setting the recipient arg to its wearer.\n *\n * @dev Stream funds on termed Roles are targeted directly at the nominated wearer.\n * The wearer should directly call `withdraw-` on the Sablier contract.\n *\n * @dev Role hat creation, minting, smart account creation and stream creation are handled here in order\n * to avoid a race condition where not more than one active proposal to create a new role can exist at a time.\n * See: https://github.com/decentdao/decent-interface/issues/2402\n *\n * @param roleHatsParams An array of params for each role hat to be created.\n */\n function createRoleHats(\n CreateRoleHatsParams calldata roleHatsParams\n ) external {\n _processRoleHats(roleHatsParams);\n }\n}\n" + }, + "contracts/modules/DecentHatsModuleUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.28;\n\nimport {Enum} from \"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\";\nimport {IAvatar} from \"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol\";\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {IERC6551Registry} from \"../interfaces/IERC6551Registry.sol\";\nimport {IHats} from \"../interfaces/hats/IHats.sol\";\nimport {LockupLinear, Broker} from \"../interfaces/sablier/types/DataTypes.sol\";\nimport {IHatsModuleFactory} from \"../interfaces/hats/IHatsModuleFactory.sol\";\nimport {ISablierV2LockupLinear} from \"../interfaces/sablier/ISablierV2LockupLinear.sol\";\nimport {Strings} from \"@openzeppelin/contracts/utils/Strings.sol\";\n\nabstract contract DecentHatsModuleUtils {\n bytes32 public constant SALT =\n 0x5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b5072;\n\n struct SablierStreamParams {\n ISablierV2LockupLinear sablier;\n address sender;\n address asset;\n LockupLinear.Timestamps timestamps;\n Broker broker;\n uint128 totalAmount;\n bool cancelable;\n bool transferable;\n }\n\n struct HatParams {\n address wearer;\n string details;\n string imageURI;\n SablierStreamParams[] sablierStreamsParams;\n uint128 termEndDateTs; // If 0, this is an untermed Hat\n uint32 maxSupply;\n bool isMutable;\n }\n\n struct CreateRoleHatsParams {\n IHats hatsProtocol;\n IERC6551Registry erc6551Registry;\n address hatsAccountImplementation;\n uint256 topHatId;\n address topHatAccount;\n address keyValuePairs;\n IHatsModuleFactory hatsModuleFactory;\n address hatsElectionsEligibilityImplementation;\n uint256 adminHatId;\n HatParams[] hats;\n }\n\n function _processRoleHats(\n CreateRoleHatsParams memory roleHatsParams\n ) internal {\n for (uint256 i = 0; i < roleHatsParams.hats.length; ) {\n HatParams memory hatParams = roleHatsParams.hats[i];\n\n // Create eligibility module if needed\n address eligibilityAddress = _createEligibilityModule(\n roleHatsParams.hatsProtocol,\n roleHatsParams.hatsModuleFactory,\n roleHatsParams.hatsElectionsEligibilityImplementation,\n roleHatsParams.topHatId,\n roleHatsParams.topHatAccount,\n roleHatsParams.adminHatId,\n hatParams.termEndDateTs\n );\n\n // Create and Mint the Role Hat\n uint256 hatId = _createAndMintHat(\n roleHatsParams.hatsProtocol,\n roleHatsParams.adminHatId,\n hatParams,\n eligibilityAddress,\n roleHatsParams.topHatAccount\n );\n\n // Get the stream recipient (based on termed or not)\n address streamRecipient = _setupStreamRecipient(\n roleHatsParams.erc6551Registry,\n roleHatsParams.hatsAccountImplementation,\n address(roleHatsParams.hatsProtocol),\n hatParams.termEndDateTs,\n hatParams.wearer,\n hatId\n );\n\n // Create streams\n _processSablierStreams(\n hatParams.sablierStreamsParams,\n streamRecipient,\n roleHatsParams.keyValuePairs,\n hatId\n );\n\n unchecked {\n ++i;\n }\n }\n }\n\n function _createEligibilityModule(\n IHats hatsProtocol,\n IHatsModuleFactory hatsModuleFactory,\n address hatsElectionsEligibilityImplementation,\n uint256 topHatId,\n address topHatAccount,\n uint256 adminHatId,\n uint128 termEndDateTs\n ) private returns (address) {\n // If the Hat is termed, create the eligibility module\n if (termEndDateTs != 0) {\n return\n hatsModuleFactory.createHatsModule(\n hatsElectionsEligibilityImplementation,\n hatsProtocol.getNextId(adminHatId),\n abi.encode(topHatId, uint256(0)), // [BALLOT_BOX_ID, ADMIN_HAT_ID]\n abi.encode(termEndDateTs),\n uint256(SALT)\n );\n }\n\n // Otherwise, return the Top Hat account\n return topHatAccount;\n }\n\n function _createAndMintHat(\n IHats hatsProtocol,\n uint256 adminHatId,\n HatParams memory hat,\n address eligibilityAddress,\n address topHatAccount\n ) private returns (uint256) {\n // Grab the next Hat ID (before creating it)\n uint256 hatId = hatsProtocol.getNextId(adminHatId);\n\n // Create the new Hat\n IAvatar(msg.sender).execTransactionFromModule(\n address(hatsProtocol),\n 0,\n abi.encodeWithSignature(\n \"createHat(uint256,string,uint32,address,address,bool,string)\",\n adminHatId,\n hat.details,\n hat.maxSupply,\n eligibilityAddress,\n topHatAccount,\n hat.isMutable,\n hat.imageURI\n ),\n Enum.Operation.Call\n );\n\n // If the Hat is termed, nominate the wearer as the eligible member\n if (hat.termEndDateTs != 0) {\n address[] memory nominatedWearers = new address[](1);\n nominatedWearers[0] = hat.wearer;\n\n IAvatar(msg.sender).execTransactionFromModule(\n eligibilityAddress,\n 0,\n abi.encodeWithSignature(\n \"elect(uint128,address[])\",\n hat.termEndDateTs,\n nominatedWearers\n ),\n Enum.Operation.Call\n );\n }\n\n // Mint the Hat\n IAvatar(msg.sender).execTransactionFromModule(\n address(hatsProtocol),\n 0,\n abi.encodeWithSignature(\n \"mintHat(uint256,address)\",\n hatId,\n hat.wearer\n ),\n Enum.Operation.Call\n );\n return hatId;\n }\n\n // Exists to avoid stack too deep errors\n function _setupStreamRecipient(\n IERC6551Registry erc6551Registry,\n address hatsAccountImplementation,\n address hatsProtocol,\n uint128 termEndDateTs,\n address wearer,\n uint256 hatId\n ) private returns (address) {\n // If the hat is termed, the wearer is the stream recipient\n if (termEndDateTs != 0) {\n return wearer;\n }\n\n // Otherwise, the Hat's smart account is the stream recipient\n return\n erc6551Registry.createAccount(\n hatsAccountImplementation,\n SALT,\n block.chainid,\n hatsProtocol,\n hatId\n );\n }\n\n function _processSablierStreams(\n SablierStreamParams[] memory streamParams,\n address streamRecipient,\n address keyValuePairs,\n uint256 hatId\n ) private {\n for (uint256 i = 0; i < streamParams.length; ) {\n SablierStreamParams memory sablierStreamParams = streamParams[i];\n\n // Approve tokens for Sablier\n IAvatar(msg.sender).execTransactionFromModule(\n sablierStreamParams.asset,\n 0,\n abi.encodeWithSignature(\n \"approve(address,uint256)\",\n sablierStreamParams.sablier,\n sablierStreamParams.totalAmount\n ),\n Enum.Operation.Call\n );\n uint256 streamId = ISablierV2LockupLinear(\n sablierStreamParams.sablier\n ).nextStreamId();\n\n // Proxy the Sablier call through IAvatar\n IAvatar(msg.sender).execTransactionFromModule(\n address(sablierStreamParams.sablier),\n 0,\n abi.encodeWithSignature(\n \"createWithTimestamps((address,address,uint128,address,bool,bool,(uint40,uint40,uint40),(address,uint256)))\",\n LockupLinear.CreateWithTimestamps({\n sender: sablierStreamParams.sender,\n recipient: streamRecipient,\n totalAmount: sablierStreamParams.totalAmount,\n asset: IERC20(sablierStreamParams.asset),\n cancelable: sablierStreamParams.cancelable,\n transferable: sablierStreamParams.transferable,\n timestamps: sablierStreamParams.timestamps,\n broker: sablierStreamParams.broker\n })\n ),\n Enum.Operation.Call\n );\n\n // Update KeyValuePairs with the stream ID and Hat ID\n string[] memory keys = new string[](1);\n string[] memory values = new string[](1);\n keys[0] = \"hatIdToStreamId\";\n values[0] = string(\n abi.encodePacked(\n Strings.toString(hatId),\n \":\",\n Strings.toString(streamId)\n )\n );\n\n IAvatar(msg.sender).execTransactionFromModule(\n keyValuePairs,\n 0,\n abi.encodeWithSignature(\n \"updateValues(string[],string[])\",\n keys,\n values\n ),\n Enum.Operation.Call\n );\n\n unchecked {\n ++i;\n }\n }\n }\n}\n" + }, + "contracts/modules/DecentSablierStreamManagementModule.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.28;\n\nimport {Enum} from \"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\";\nimport {IAvatar} from \"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol\";\nimport {ISablierV2Lockup} from \"../interfaces/sablier/ISablierV2Lockup.sol\";\nimport {Lockup} from \"../interfaces/sablier/types/DataTypes.sol\";\n\ncontract DecentSablierStreamManagementModule {\n function withdrawMaxFromStream(\n ISablierV2Lockup sablier,\n address recipientHatAccount,\n uint256 streamId,\n address to\n ) public {\n // Check if there are funds to withdraw\n if (sablier.withdrawableAmountOf(streamId) == 0) {\n return;\n }\n\n // Proxy the Sablier withdrawMax call through IAvatar (Safe)\n IAvatar(msg.sender).execTransactionFromModule(\n recipientHatAccount,\n 0,\n abi.encodeWithSignature(\n \"execute(address,uint256,bytes,uint8)\",\n address(sablier),\n 0,\n abi.encodeWithSignature(\n \"withdrawMax(uint256,address)\",\n streamId,\n to\n ),\n 0\n ),\n Enum.Operation.Call\n );\n }\n\n function cancelStream(ISablierV2Lockup sablier, uint256 streamId) public {\n // Check if the stream can be cancelled\n Lockup.Status streamStatus = sablier.statusOf(streamId);\n if (\n streamStatus != Lockup.Status.PENDING &&\n streamStatus != Lockup.Status.STREAMING\n ) {\n return;\n }\n\n IAvatar(msg.sender).execTransactionFromModule(\n address(sablier),\n 0,\n abi.encodeWithSignature(\"cancel(uint256)\", streamId),\n Enum.Operation.Call\n );\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 200 + }, + "evmVersion": "paris", + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/deployments/sepolia/DecentHatsCreationModule.json b/deployments/sepolia/DecentHatsCreationModule.json index a620c4d..9175109 100644 --- a/deployments/sepolia/DecentHatsCreationModule.json +++ b/deployments/sepolia/DecentHatsCreationModule.json @@ -1,5 +1,5 @@ { - "address": "0xfA3f982C47543eB6FF745ae5Cd1B7B55DF4962a4", + "address": "0xCC570D5d5FD317CD93c33d4A29B9baba5109B9d7", "abi": [ { "inputs": [], @@ -222,28 +222,28 @@ "type": "function" } ], - "transactionHash": "0x261a05cb3ef6c07106c812654ded0109b7e476b70284c1e6cb3c3f4326ff70c3", + "transactionHash": "0xf234505610913fe33fa8a99962944a96bf4774eecd1e81eb0b627eb0a1b4d937", "receipt": { "to": null, "from": "0xfcf7a2794D066110162ADdcE3085dfd6221D4ddD", - "contractAddress": "0xfA3f982C47543eB6FF745ae5Cd1B7B55DF4962a4", - "transactionIndex": 15, - "gasUsed": "1751463", + "contractAddress": "0xCC570D5d5FD317CD93c33d4A29B9baba5109B9d7", + "transactionIndex": 22, + "gasUsed": "1887591", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x2c64e6810831911c01f6cf2f5e43900254207478afaf6b331817534c8758b345", - "transactionHash": "0x261a05cb3ef6c07106c812654ded0109b7e476b70284c1e6cb3c3f4326ff70c3", + "blockHash": "0x04d27cae49bb30dc1cf4b9bdaa548e0f21572d35e7906f9b436b9f4d1022da46", + "transactionHash": "0xf234505610913fe33fa8a99962944a96bf4774eecd1e81eb0b627eb0a1b4d937", "logs": [], - "blockNumber": 7018753, - "cumulativeGasUsed": "4445945", + "blockNumber": 7129765, + "cumulativeGasUsed": "4113596", "status": 1, "byzantium": true }, "args": [], - "numDeployments": 1, - "solcInputHash": "e3ec7808efccf5e6b24e16a29ead3983", - "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"SALT\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"contract IHats\",\"name\":\"hatsProtocol\",\"type\":\"address\"},{\"internalType\":\"contract IERC6551Registry\",\"name\":\"erc6551Registry\",\"type\":\"address\"},{\"internalType\":\"contract IHatsModuleFactory\",\"name\":\"hatsModuleFactory\",\"type\":\"address\"},{\"internalType\":\"contract ModuleProxyFactory\",\"name\":\"moduleProxyFactory\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"keyValuePairs\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"decentAutonomousAdminImplementation\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"hatsAccountImplementation\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"hatsElectionsEligibilityImplementation\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"string\",\"name\":\"details\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"imageURI\",\"type\":\"string\"}],\"internalType\":\"struct DecentHatsCreationModule.TopHatParams\",\"name\":\"topHat\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"string\",\"name\":\"details\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"imageURI\",\"type\":\"string\"},{\"internalType\":\"bool\",\"name\":\"isMutable\",\"type\":\"bool\"}],\"internalType\":\"struct DecentHatsCreationModule.AdminHatParams\",\"name\":\"adminHat\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"wearer\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"details\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"imageURI\",\"type\":\"string\"},{\"components\":[{\"internalType\":\"contract ISablierV2LockupLinear\",\"name\":\"sablier\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint40\",\"name\":\"start\",\"type\":\"uint40\"},{\"internalType\":\"uint40\",\"name\":\"cliff\",\"type\":\"uint40\"},{\"internalType\":\"uint40\",\"name\":\"end\",\"type\":\"uint40\"}],\"internalType\":\"struct LockupLinear.Timestamps\",\"name\":\"timestamps\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"UD60x18\",\"name\":\"fee\",\"type\":\"uint256\"}],\"internalType\":\"struct Broker\",\"name\":\"broker\",\"type\":\"tuple\"},{\"internalType\":\"uint128\",\"name\":\"totalAmount\",\"type\":\"uint128\"},{\"internalType\":\"bool\",\"name\":\"cancelable\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"transferable\",\"type\":\"bool\"}],\"internalType\":\"struct DecentHatsModuleUtils.SablierStreamParams[]\",\"name\":\"sablierStreamsParams\",\"type\":\"tuple[]\"},{\"internalType\":\"uint128\",\"name\":\"termEndDateTs\",\"type\":\"uint128\"},{\"internalType\":\"uint32\",\"name\":\"maxSupply\",\"type\":\"uint32\"},{\"internalType\":\"bool\",\"name\":\"isMutable\",\"type\":\"bool\"}],\"internalType\":\"struct DecentHatsModuleUtils.HatParams[]\",\"name\":\"hats\",\"type\":\"tuple[]\"}],\"internalType\":\"struct DecentHatsCreationModule.CreateTreeParams\",\"name\":\"treeParams\",\"type\":\"tuple\"}],\"name\":\"createAndDeclareTree\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"createAndDeclareTree((address,address,address,address,address,address,address,address,(string,string),(string,string,bool),(address,string,string,(address,address,address,(uint40,uint40,uint40),(address,uint256),uint128,bool,bool)[],uint128,uint32,bool)[]))\":{\"details\":\"For each hat that is included, if the hat is: - termed, its stream funds on are targeted directly at the nominated wearer. The wearer should directly call `withdraw-` on the Sablier contract. - untermed, its stream funds are targeted at the hat's smart account. In order to withdraw funds from the stream, the hat's smart account must be the one call to `withdraw-` on the Sablier contract, setting the recipient arg to its wearer.In order for a Safe to seamlessly create roles even if it has never previously created a role and thus has no hat tree, we defer the creation of the hat tree and its setup to this contract. This way, in a single tx block, the resulting topHatId of the newly created hat can be used to create an admin hat and any other hats needed. We also make use of `KeyValuePairs` to associate the topHatId with the Safe.\",\"params\":{\"treeParams\":\"The parameters for creating the Hat Tree with Roles\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"createAndDeclareTree((address,address,address,address,address,address,address,address,(string,string),(string,string,bool),(address,string,string,(address,address,address,(uint40,uint40,uint40),(address,uint256),uint128,bool,bool)[],uint128,uint32,bool)[]))\":{\"notice\":\"For a safe without any roles previously created on it, this function should be called. It sets up the top hat and admin hat, as well as any other hats and their streams that are provided, then transfers the top hat to the calling safe.This contract should be enabled a module on the Safe for which the role(s) are to be created, and disabled after.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/modules/DecentHatsCreationModule.sol\":\"DecentHatsCreationModule\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\npragma solidity >=0.7.0 <0.9.0;\\n\\n/// @title Enum - Collection of enums\\n/// @author Richard Meissner - \\ncontract Enum {\\n enum Operation {Call, DelegateCall}\\n}\\n\",\"keccak256\":\"0x473e45b1a5cc47be494b0e123c9127f0c11c1e0992a321ae5a644c0bfdb2c14f\",\"license\":\"LGPL-3.0-only\"},\"@gnosis.pm/zodiac/contracts/factory/ModuleProxyFactory.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\npragma solidity >=0.8.0;\\n\\ncontract ModuleProxyFactory {\\n event ModuleProxyCreation(\\n address indexed proxy,\\n address indexed masterCopy\\n );\\n\\n /// `target` can not be zero.\\n error ZeroAddress(address target);\\n\\n /// `address_` is already taken.\\n error TakenAddress(address address_);\\n\\n /// @notice Initialization failed.\\n error FailedInitialization();\\n\\n function createProxy(address target, bytes32 salt)\\n internal\\n returns (address result)\\n {\\n if (address(target) == address(0)) revert ZeroAddress(target);\\n bytes memory deployment = abi.encodePacked(\\n hex\\\"602d8060093d393df3363d3d373d3d3d363d73\\\",\\n target,\\n hex\\\"5af43d82803e903d91602b57fd5bf3\\\"\\n );\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n result := create2(0, add(deployment, 0x20), mload(deployment), salt)\\n }\\n if (result == address(0)) revert TakenAddress(result);\\n }\\n\\n function deployModule(\\n address masterCopy,\\n bytes memory initializer,\\n uint256 saltNonce\\n ) public returns (address proxy) {\\n proxy = createProxy(\\n masterCopy,\\n keccak256(abi.encodePacked(keccak256(initializer), saltNonce))\\n );\\n (bool success, ) = proxy.call(initializer);\\n if (!success) revert FailedInitialization();\\n\\n emit ModuleProxyCreation(proxy, masterCopy);\\n }\\n}\\n\",\"keccak256\":\"0x70f6f1d88cf3382748e58f85ba87279f5bb8761863c293dd8c197a71ff558761\",\"license\":\"LGPL-3.0-only\"},\"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\n\\n/// @title Zodiac Avatar - A contract that manages modules that can execute transactions via this contract.\\npragma solidity >=0.7.0 <0.9.0;\\n\\nimport \\\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\\\";\\n\\ninterface IAvatar {\\n event EnabledModule(address module);\\n event DisabledModule(address module);\\n event ExecutionFromModuleSuccess(address indexed module);\\n event ExecutionFromModuleFailure(address indexed module);\\n\\n /// @dev Enables a module on the avatar.\\n /// @notice Can only be called by the avatar.\\n /// @notice Modules should be stored as a linked list.\\n /// @notice Must emit EnabledModule(address module) if successful.\\n /// @param module Module to be enabled.\\n function enableModule(address module) external;\\n\\n /// @dev Disables a module on the avatar.\\n /// @notice Can only be called by the avatar.\\n /// @notice Must emit DisabledModule(address module) if successful.\\n /// @param prevModule Address that pointed to the module to be removed in the linked list\\n /// @param module Module to be removed.\\n function disableModule(address prevModule, address module) external;\\n\\n /// @dev Allows a Module to execute a transaction.\\n /// @notice Can only be called by an enabled module.\\n /// @notice Must emit ExecutionFromModuleSuccess(address module) if successful.\\n /// @notice Must emit ExecutionFromModuleFailure(address module) if unsuccessful.\\n /// @param to Destination address of module transaction.\\n /// @param value Ether value of module transaction.\\n /// @param data Data payload of module transaction.\\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\\n function execTransactionFromModule(\\n address to,\\n uint256 value,\\n bytes memory data,\\n Enum.Operation operation\\n ) external returns (bool success);\\n\\n /// @dev Allows a Module to execute a transaction and return data\\n /// @notice Can only be called by an enabled module.\\n /// @notice Must emit ExecutionFromModuleSuccess(address module) if successful.\\n /// @notice Must emit ExecutionFromModuleFailure(address module) if unsuccessful.\\n /// @param to Destination address of module transaction.\\n /// @param value Ether value of module transaction.\\n /// @param data Data payload of module transaction.\\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\\n function execTransactionFromModuleReturnData(\\n address to,\\n uint256 value,\\n bytes memory data,\\n Enum.Operation operation\\n ) external returns (bool success, bytes memory returnData);\\n\\n /// @dev Returns if an module is enabled\\n /// @return True if the module is enabled\\n function isModuleEnabled(address module) external view returns (bool);\\n\\n /// @dev Returns array of modules.\\n /// @param start Start of the page.\\n /// @param pageSize Maximum number of modules that should be returned.\\n /// @return array Array of modules.\\n /// @return next Start of the next page.\\n function getModulesPaginated(address start, uint256 pageSize)\\n external\\n view\\n returns (address[] memory array, address next);\\n}\\n\",\"keccak256\":\"0xcd5508ffe596eef8fbccfd5fc4f10a34397773547ce64e212d48b5212865ec1f\",\"license\":\"LGPL-3.0-only\"},\"@openzeppelin/contracts/interfaces/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/introspection/IERC165.sol\\\";\\n\",\"keccak256\":\"0xd04b0f06e0666f29cf7cccc82894de541e19bb30a765b107b1e40bb7fe5f7d7a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev 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 amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `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 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes calldata data\\n ) external;\\n\\n /**\\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 {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the caller.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool _approved) external;\\n\\n /**\\n * @dev Returns 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\",\"keccak256\":\"0xed6a749c5373af398105ce6ee3ac4763aa450ea7285d268c85d9eeca809cdb1f\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../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\",\"keccak256\":\"0x75b829ff2f26c14355d1cba20e16fe7b29ca58eb5fef665ede48bc0f9c6c74b9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _HEX_SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\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 // Inspired by OraclizeAPI's implementation - MIT licence\\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\\n\\n if (value == 0) {\\n return \\\"0\\\";\\n }\\n uint256 temp = value;\\n uint256 digits;\\n while (temp != 0) {\\n digits++;\\n temp /= 10;\\n }\\n bytes memory buffer = new bytes(digits);\\n while (value != 0) {\\n digits -= 1;\\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\\n value /= 10;\\n }\\n return string(buffer);\\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 if (value == 0) {\\n return \\\"0x00\\\";\\n }\\n uint256 temp = value;\\n uint256 length = 0;\\n while (temp != 0) {\\n length++;\\n temp >>= 8;\\n }\\n return toHexString(value, length);\\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 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_SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\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 representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n}\\n\",\"keccak256\":\"0xaf159a8b1923ad2a26d516089bceca9bdeaeacd04be50983ea00ba63070f08a3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"@prb/math/src/Common.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\n// Common.sol\\n//\\n// Common mathematical functions used in both SD59x18 and UD60x18. Note that these global functions do not\\n// always operate with SD59x18 and UD60x18 numbers.\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CUSTOM ERRORS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @notice Thrown when the resultant value in {mulDiv} overflows uint256.\\nerror PRBMath_MulDiv_Overflow(uint256 x, uint256 y, uint256 denominator);\\n\\n/// @notice Thrown when the resultant value in {mulDiv18} overflows uint256.\\nerror PRBMath_MulDiv18_Overflow(uint256 x, uint256 y);\\n\\n/// @notice Thrown when one of the inputs passed to {mulDivSigned} is `type(int256).min`.\\nerror PRBMath_MulDivSigned_InputTooSmall();\\n\\n/// @notice Thrown when the resultant value in {mulDivSigned} overflows int256.\\nerror PRBMath_MulDivSigned_Overflow(int256 x, int256 y);\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CONSTANTS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @dev The maximum value a uint128 number can have.\\nuint128 constant MAX_UINT128 = type(uint128).max;\\n\\n/// @dev The maximum value a uint40 number can have.\\nuint40 constant MAX_UINT40 = type(uint40).max;\\n\\n/// @dev The unit number, which the decimal precision of the fixed-point types.\\nuint256 constant UNIT = 1e18;\\n\\n/// @dev The unit number inverted mod 2^256.\\nuint256 constant UNIT_INVERSE = 78156646155174841979727994598816262306175212592076161876661_508869554232690281;\\n\\n/// @dev The the largest power of two that divides the decimal value of `UNIT`. The logarithm of this value is the least significant\\n/// bit in the binary representation of `UNIT`.\\nuint256 constant UNIT_LPOTD = 262144;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @notice Calculates the binary exponent of x using the binary fraction method.\\n/// @dev Has to use 192.64-bit fixed-point numbers. See https://ethereum.stackexchange.com/a/96594/24693.\\n/// @param x The exponent as an unsigned 192.64-bit fixed-point number.\\n/// @return result The result as an unsigned 60.18-decimal fixed-point number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp2(uint256 x) pure returns (uint256 result) {\\n unchecked {\\n // Start from 0.5 in the 192.64-bit fixed-point format.\\n result = 0x800000000000000000000000000000000000000000000000;\\n\\n // The following logic multiplies the result by $\\\\sqrt{2^{-i}}$ when the bit at position i is 1. Key points:\\n //\\n // 1. Intermediate results will not overflow, as the starting point is 2^191 and all magic factors are under 2^65.\\n // 2. The rationale for organizing the if statements into groups of 8 is gas savings. If the result of performing\\n // a bitwise AND operation between x and any value in the array [0x80; 0x40; 0x20; 0x10; 0x08; 0x04; 0x02; 0x01] is 1,\\n // we know that `x & 0xFF` is also 1.\\n if (x & 0xFF00000000000000 > 0) {\\n if (x & 0x8000000000000000 > 0) {\\n result = (result * 0x16A09E667F3BCC909) >> 64;\\n }\\n if (x & 0x4000000000000000 > 0) {\\n result = (result * 0x1306FE0A31B7152DF) >> 64;\\n }\\n if (x & 0x2000000000000000 > 0) {\\n result = (result * 0x1172B83C7D517ADCE) >> 64;\\n }\\n if (x & 0x1000000000000000 > 0) {\\n result = (result * 0x10B5586CF9890F62A) >> 64;\\n }\\n if (x & 0x800000000000000 > 0) {\\n result = (result * 0x1059B0D31585743AE) >> 64;\\n }\\n if (x & 0x400000000000000 > 0) {\\n result = (result * 0x102C9A3E778060EE7) >> 64;\\n }\\n if (x & 0x200000000000000 > 0) {\\n result = (result * 0x10163DA9FB33356D8) >> 64;\\n }\\n if (x & 0x100000000000000 > 0) {\\n result = (result * 0x100B1AFA5ABCBED61) >> 64;\\n }\\n }\\n\\n if (x & 0xFF000000000000 > 0) {\\n if (x & 0x80000000000000 > 0) {\\n result = (result * 0x10058C86DA1C09EA2) >> 64;\\n }\\n if (x & 0x40000000000000 > 0) {\\n result = (result * 0x1002C605E2E8CEC50) >> 64;\\n }\\n if (x & 0x20000000000000 > 0) {\\n result = (result * 0x100162F3904051FA1) >> 64;\\n }\\n if (x & 0x10000000000000 > 0) {\\n result = (result * 0x1000B175EFFDC76BA) >> 64;\\n }\\n if (x & 0x8000000000000 > 0) {\\n result = (result * 0x100058BA01FB9F96D) >> 64;\\n }\\n if (x & 0x4000000000000 > 0) {\\n result = (result * 0x10002C5CC37DA9492) >> 64;\\n }\\n if (x & 0x2000000000000 > 0) {\\n result = (result * 0x1000162E525EE0547) >> 64;\\n }\\n if (x & 0x1000000000000 > 0) {\\n result = (result * 0x10000B17255775C04) >> 64;\\n }\\n }\\n\\n if (x & 0xFF0000000000 > 0) {\\n if (x & 0x800000000000 > 0) {\\n result = (result * 0x1000058B91B5BC9AE) >> 64;\\n }\\n if (x & 0x400000000000 > 0) {\\n result = (result * 0x100002C5C89D5EC6D) >> 64;\\n }\\n if (x & 0x200000000000 > 0) {\\n result = (result * 0x10000162E43F4F831) >> 64;\\n }\\n if (x & 0x100000000000 > 0) {\\n result = (result * 0x100000B1721BCFC9A) >> 64;\\n }\\n if (x & 0x80000000000 > 0) {\\n result = (result * 0x10000058B90CF1E6E) >> 64;\\n }\\n if (x & 0x40000000000 > 0) {\\n result = (result * 0x1000002C5C863B73F) >> 64;\\n }\\n if (x & 0x20000000000 > 0) {\\n result = (result * 0x100000162E430E5A2) >> 64;\\n }\\n if (x & 0x10000000000 > 0) {\\n result = (result * 0x1000000B172183551) >> 64;\\n }\\n }\\n\\n if (x & 0xFF00000000 > 0) {\\n if (x & 0x8000000000 > 0) {\\n result = (result * 0x100000058B90C0B49) >> 64;\\n }\\n if (x & 0x4000000000 > 0) {\\n result = (result * 0x10000002C5C8601CC) >> 64;\\n }\\n if (x & 0x2000000000 > 0) {\\n result = (result * 0x1000000162E42FFF0) >> 64;\\n }\\n if (x & 0x1000000000 > 0) {\\n result = (result * 0x10000000B17217FBB) >> 64;\\n }\\n if (x & 0x800000000 > 0) {\\n result = (result * 0x1000000058B90BFCE) >> 64;\\n }\\n if (x & 0x400000000 > 0) {\\n result = (result * 0x100000002C5C85FE3) >> 64;\\n }\\n if (x & 0x200000000 > 0) {\\n result = (result * 0x10000000162E42FF1) >> 64;\\n }\\n if (x & 0x100000000 > 0) {\\n result = (result * 0x100000000B17217F8) >> 64;\\n }\\n }\\n\\n if (x & 0xFF000000 > 0) {\\n if (x & 0x80000000 > 0) {\\n result = (result * 0x10000000058B90BFC) >> 64;\\n }\\n if (x & 0x40000000 > 0) {\\n result = (result * 0x1000000002C5C85FE) >> 64;\\n }\\n if (x & 0x20000000 > 0) {\\n result = (result * 0x100000000162E42FF) >> 64;\\n }\\n if (x & 0x10000000 > 0) {\\n result = (result * 0x1000000000B17217F) >> 64;\\n }\\n if (x & 0x8000000 > 0) {\\n result = (result * 0x100000000058B90C0) >> 64;\\n }\\n if (x & 0x4000000 > 0) {\\n result = (result * 0x10000000002C5C860) >> 64;\\n }\\n if (x & 0x2000000 > 0) {\\n result = (result * 0x1000000000162E430) >> 64;\\n }\\n if (x & 0x1000000 > 0) {\\n result = (result * 0x10000000000B17218) >> 64;\\n }\\n }\\n\\n if (x & 0xFF0000 > 0) {\\n if (x & 0x800000 > 0) {\\n result = (result * 0x1000000000058B90C) >> 64;\\n }\\n if (x & 0x400000 > 0) {\\n result = (result * 0x100000000002C5C86) >> 64;\\n }\\n if (x & 0x200000 > 0) {\\n result = (result * 0x10000000000162E43) >> 64;\\n }\\n if (x & 0x100000 > 0) {\\n result = (result * 0x100000000000B1721) >> 64;\\n }\\n if (x & 0x80000 > 0) {\\n result = (result * 0x10000000000058B91) >> 64;\\n }\\n if (x & 0x40000 > 0) {\\n result = (result * 0x1000000000002C5C8) >> 64;\\n }\\n if (x & 0x20000 > 0) {\\n result = (result * 0x100000000000162E4) >> 64;\\n }\\n if (x & 0x10000 > 0) {\\n result = (result * 0x1000000000000B172) >> 64;\\n }\\n }\\n\\n if (x & 0xFF00 > 0) {\\n if (x & 0x8000 > 0) {\\n result = (result * 0x100000000000058B9) >> 64;\\n }\\n if (x & 0x4000 > 0) {\\n result = (result * 0x10000000000002C5D) >> 64;\\n }\\n if (x & 0x2000 > 0) {\\n result = (result * 0x1000000000000162E) >> 64;\\n }\\n if (x & 0x1000 > 0) {\\n result = (result * 0x10000000000000B17) >> 64;\\n }\\n if (x & 0x800 > 0) {\\n result = (result * 0x1000000000000058C) >> 64;\\n }\\n if (x & 0x400 > 0) {\\n result = (result * 0x100000000000002C6) >> 64;\\n }\\n if (x & 0x200 > 0) {\\n result = (result * 0x10000000000000163) >> 64;\\n }\\n if (x & 0x100 > 0) {\\n result = (result * 0x100000000000000B1) >> 64;\\n }\\n }\\n\\n if (x & 0xFF > 0) {\\n if (x & 0x80 > 0) {\\n result = (result * 0x10000000000000059) >> 64;\\n }\\n if (x & 0x40 > 0) {\\n result = (result * 0x1000000000000002C) >> 64;\\n }\\n if (x & 0x20 > 0) {\\n result = (result * 0x10000000000000016) >> 64;\\n }\\n if (x & 0x10 > 0) {\\n result = (result * 0x1000000000000000B) >> 64;\\n }\\n if (x & 0x8 > 0) {\\n result = (result * 0x10000000000000006) >> 64;\\n }\\n if (x & 0x4 > 0) {\\n result = (result * 0x10000000000000003) >> 64;\\n }\\n if (x & 0x2 > 0) {\\n result = (result * 0x10000000000000001) >> 64;\\n }\\n if (x & 0x1 > 0) {\\n result = (result * 0x10000000000000001) >> 64;\\n }\\n }\\n\\n // In the code snippet below, two operations are executed simultaneously:\\n //\\n // 1. The result is multiplied by $(2^n + 1)$, where $2^n$ represents the integer part, and the additional 1\\n // accounts for the initial guess of 0.5. This is achieved by subtracting from 191 instead of 192.\\n // 2. The result is then converted to an unsigned 60.18-decimal fixed-point format.\\n //\\n // The underlying logic is based on the relationship $2^{191-ip} = 2^{ip} / 2^{191}$, where $ip$ denotes the,\\n // integer part, $2^n$.\\n result *= UNIT;\\n result >>= (191 - (x >> 64));\\n }\\n}\\n\\n/// @notice Finds the zero-based index of the first 1 in the binary representation of x.\\n///\\n/// @dev See the note on \\\"msb\\\" in this Wikipedia article: https://en.wikipedia.org/wiki/Find_first_set\\n///\\n/// Each step in this implementation is equivalent to this high-level code:\\n///\\n/// ```solidity\\n/// if (x >= 2 ** 128) {\\n/// x >>= 128;\\n/// result += 128;\\n/// }\\n/// ```\\n///\\n/// Where 128 is replaced with each respective power of two factor. See the full high-level implementation here:\\n/// https://gist.github.com/PaulRBerg/f932f8693f2733e30c4d479e8e980948\\n///\\n/// The Yul instructions used below are:\\n///\\n/// - \\\"gt\\\" is \\\"greater than\\\"\\n/// - \\\"or\\\" is the OR bitwise operator\\n/// - \\\"shl\\\" is \\\"shift left\\\"\\n/// - \\\"shr\\\" is \\\"shift right\\\"\\n///\\n/// @param x The uint256 number for which to find the index of the most significant bit.\\n/// @return result The index of the most significant bit as a uint256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction msb(uint256 x) pure returns (uint256 result) {\\n // 2^128\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(7, gt(x, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^64\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(6, gt(x, 0xFFFFFFFFFFFFFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^32\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(5, gt(x, 0xFFFFFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^16\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(4, gt(x, 0xFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^8\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(3, gt(x, 0xFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^4\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(2, gt(x, 0xF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^2\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(1, gt(x, 0x3))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^1\\n // No need to shift x any more.\\n assembly (\\\"memory-safe\\\") {\\n let factor := gt(x, 0x1)\\n result := or(result, factor)\\n }\\n}\\n\\n/// @notice Calculates x*y\\u00f7denominator with 512-bit precision.\\n///\\n/// @dev Credits to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv.\\n///\\n/// Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - The denominator must not be zero.\\n/// - The result must fit in uint256.\\n///\\n/// @param x The multiplicand as a uint256.\\n/// @param y The multiplier as a uint256.\\n/// @param denominator The divisor as a uint256.\\n/// @return result The result as a uint256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mulDiv(uint256 x, uint256 y, uint256 denominator) pure returns (uint256 result) {\\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; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly (\\\"memory-safe\\\") {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\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 unchecked {\\n return prod0 / denominator;\\n }\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n if (prod1 >= denominator) {\\n revert PRBMath_MulDiv_Overflow(x, y, denominator);\\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 (\\\"memory-safe\\\") {\\n // Compute remainder using the mulmod Yul instruction.\\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 unchecked {\\n // Calculate the largest power of two divisor of the denominator using the unary operator ~. This operation cannot overflow\\n // because the denominator cannot be zero at this point in the function execution. The result is always >= 1.\\n // For more detail, see https://cs.stackexchange.com/q/138556/92363.\\n uint256 lpotdod = denominator & (~denominator + 1);\\n uint256 flippedLpotdod;\\n\\n assembly (\\\"memory-safe\\\") {\\n // Factor powers of two out of denominator.\\n denominator := div(denominator, lpotdod)\\n\\n // Divide [prod1 prod0] by lpotdod.\\n prod0 := div(prod0, lpotdod)\\n\\n // Get the flipped value `2^256 / lpotdod`. If the `lpotdod` is zero, the flipped value is one.\\n // `sub(0, lpotdod)` produces the two's complement version of `lpotdod`, which is equivalent to flipping all the bits.\\n // However, `div` interprets this value as an unsigned value: https://ethereum.stackexchange.com/q/147168/24693\\n flippedLpotdod := add(div(sub(0, lpotdod), lpotdod), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * flippedLpotdod;\\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 works\\n // 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 }\\n}\\n\\n/// @notice Calculates x*y\\u00f71e18 with 512-bit precision.\\n///\\n/// @dev A variant of {mulDiv} with constant folding, i.e. in which the denominator is hard coded to 1e18.\\n///\\n/// Notes:\\n/// - The body is purposely left uncommented; to understand how this works, see the documentation in {mulDiv}.\\n/// - The result is rounded toward zero.\\n/// - We take as an axiom that the result cannot be `MAX_UINT256` when x and y solve the following system of equations:\\n///\\n/// $$\\n/// \\\\begin{cases}\\n/// x * y = MAX\\\\_UINT256 * UNIT \\\\\\\\\\n/// (x * y) \\\\% UNIT \\\\geq \\\\frac{UNIT}{2}\\n/// \\\\end{cases}\\n/// $$\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {mulDiv}.\\n/// - The result must fit in uint256.\\n///\\n/// @param x The multiplicand as an unsigned 60.18-decimal fixed-point number.\\n/// @param y The multiplier as an unsigned 60.18-decimal fixed-point number.\\n/// @return result The result as an unsigned 60.18-decimal fixed-point number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mulDiv18(uint256 x, uint256 y) pure returns (uint256 result) {\\n uint256 prod0;\\n uint256 prod1;\\n assembly (\\\"memory-safe\\\") {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n if (prod1 == 0) {\\n unchecked {\\n return prod0 / UNIT;\\n }\\n }\\n\\n if (prod1 >= UNIT) {\\n revert PRBMath_MulDiv18_Overflow(x, y);\\n }\\n\\n uint256 remainder;\\n assembly (\\\"memory-safe\\\") {\\n remainder := mulmod(x, y, UNIT)\\n result :=\\n mul(\\n or(\\n div(sub(prod0, remainder), UNIT_LPOTD),\\n mul(sub(prod1, gt(remainder, prod0)), add(div(sub(0, UNIT_LPOTD), UNIT_LPOTD), 1))\\n ),\\n UNIT_INVERSE\\n )\\n }\\n}\\n\\n/// @notice Calculates x*y\\u00f7denominator with 512-bit precision.\\n///\\n/// @dev This is an extension of {mulDiv} for signed numbers, which works by computing the signs and the absolute values separately.\\n///\\n/// Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {mulDiv}.\\n/// - None of the inputs can be `type(int256).min`.\\n/// - The result must fit in int256.\\n///\\n/// @param x The multiplicand as an int256.\\n/// @param y The multiplier as an int256.\\n/// @param denominator The divisor as an int256.\\n/// @return result The result as an int256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mulDivSigned(int256 x, int256 y, int256 denominator) pure returns (int256 result) {\\n if (x == type(int256).min || y == type(int256).min || denominator == type(int256).min) {\\n revert PRBMath_MulDivSigned_InputTooSmall();\\n }\\n\\n // Get hold of the absolute values of x, y and the denominator.\\n uint256 xAbs;\\n uint256 yAbs;\\n uint256 dAbs;\\n unchecked {\\n xAbs = x < 0 ? uint256(-x) : uint256(x);\\n yAbs = y < 0 ? uint256(-y) : uint256(y);\\n dAbs = denominator < 0 ? uint256(-denominator) : uint256(denominator);\\n }\\n\\n // Compute the absolute value of x*y\\u00f7denominator. The result must fit in int256.\\n uint256 resultAbs = mulDiv(xAbs, yAbs, dAbs);\\n if (resultAbs > uint256(type(int256).max)) {\\n revert PRBMath_MulDivSigned_Overflow(x, y);\\n }\\n\\n // Get the signs of x, y and the denominator.\\n uint256 sx;\\n uint256 sy;\\n uint256 sd;\\n assembly (\\\"memory-safe\\\") {\\n // \\\"sgt\\\" is the \\\"signed greater than\\\" assembly instruction and \\\"sub(0,1)\\\" is -1 in two's complement.\\n sx := sgt(x, sub(0, 1))\\n sy := sgt(y, sub(0, 1))\\n sd := sgt(denominator, sub(0, 1))\\n }\\n\\n // XOR over sx, sy and sd. What this does is to check whether there are 1 or 3 negative signs in the inputs.\\n // If there are, the result should be negative. Otherwise, it should be positive.\\n unchecked {\\n result = sx ^ sy ^ sd == 0 ? -int256(resultAbs) : int256(resultAbs);\\n }\\n}\\n\\n/// @notice Calculates the square root of x using the Babylonian method.\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\\n///\\n/// Notes:\\n/// - If x is not a perfect square, the result is rounded down.\\n/// - Credits to OpenZeppelin for the explanations in comments below.\\n///\\n/// @param x The uint256 number for which to calculate the square root.\\n/// @return result The result as a uint256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction sqrt(uint256 x) pure returns (uint256 result) {\\n if (x == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we calculate the biggest power of 2 which is smaller than the square root of x.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of x is a power of 2 such that we have:\\n //\\n // $$\\n // msb(x) <= x <= 2*msb(x)$\\n // $$\\n //\\n // We write $msb(x)$ as $2^k$, and we get:\\n //\\n // $$\\n // k = log_2(x)\\n // $$\\n //\\n // Thus, we can write the initial inequality as:\\n //\\n // $$\\n // 2^{log_2(x)} <= x <= 2*2^{log_2(x)+1} \\\\\\\\\\n // sqrt(2^k) <= sqrt(x) < sqrt(2^{k+1}) \\\\\\\\\\n // 2^{k/2} <= sqrt(x) < 2^{(k+1)/2} <= 2^{(k/2)+1}\\n // $$\\n //\\n // Consequently, $2^{log_2(x) /2} is a good first approximation of sqrt(x) with at least one correct bit.\\n uint256 xAux = uint256(x);\\n result = 1;\\n if (xAux >= 2 ** 128) {\\n xAux >>= 128;\\n result <<= 64;\\n }\\n if (xAux >= 2 ** 64) {\\n xAux >>= 64;\\n result <<= 32;\\n }\\n if (xAux >= 2 ** 32) {\\n xAux >>= 32;\\n result <<= 16;\\n }\\n if (xAux >= 2 ** 16) {\\n xAux >>= 16;\\n result <<= 8;\\n }\\n if (xAux >= 2 ** 8) {\\n xAux >>= 8;\\n result <<= 4;\\n }\\n if (xAux >= 2 ** 4) {\\n xAux >>= 4;\\n result <<= 2;\\n }\\n if (xAux >= 2 ** 2) {\\n result <<= 1;\\n }\\n\\n // At this point, `result` is an estimation with at least one bit of precision. We know the true value has at\\n // most 128 bits, since it is the square root of a uint256. Newton's method converges quadratically (precision\\n // doubles at every iteration). We thus need at most 7 iteration to turn our partial result with one bit of\\n // precision into the expected uint128 result.\\n unchecked {\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n\\n // If x is not a perfect square, round the result toward zero.\\n uint256 roundedResult = x / result;\\n if (result >= roundedResult) {\\n result = roundedResult;\\n }\\n }\\n}\\n\",\"keccak256\":\"0xaa374e2c26cc93e8c22a6953804ee05f811597ef5fa82f76824378b22944778b\",\"license\":\"MIT\"},\"@prb/math/src/UD2x18.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\n/*\\n\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2550\\u2550\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2554\\u2588\\u2588\\u2588\\u2588\\u2554\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551 \\u255a\\u2550\\u255d \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\n\\n\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2550\\u2550\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d \\u255a\\u2588\\u2588\\u2588\\u2554\\u255d \\u255a\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u255d\\n\\n*/\\n\\nimport \\\"./ud2x18/Casting.sol\\\";\\nimport \\\"./ud2x18/Constants.sol\\\";\\nimport \\\"./ud2x18/Errors.sol\\\";\\nimport \\\"./ud2x18/ValueType.sol\\\";\\n\",\"keccak256\":\"0xfb624e24cd8bb790fa08e7827819de85504a86e20e961fa4ad126c65b6d90641\",\"license\":\"MIT\"},\"@prb/math/src/UD60x18.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\n/*\\n\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2550\\u2550\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2554\\u2588\\u2588\\u2588\\u2588\\u2554\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551 \\u255a\\u2550\\u255d \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\n\\n\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2550\\u2588\\u2588\\u2588\\u2588\\u2557\\u255a\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2588\\u2588\\u2551 \\u255a\\u2588\\u2588\\u2588\\u2554\\u255d \\u255a\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2554\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2554\\u255d \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u255d\\n\\n*/\\n\\nimport \\\"./ud60x18/Casting.sol\\\";\\nimport \\\"./ud60x18/Constants.sol\\\";\\nimport \\\"./ud60x18/Conversions.sol\\\";\\nimport \\\"./ud60x18/Errors.sol\\\";\\nimport \\\"./ud60x18/Helpers.sol\\\";\\nimport \\\"./ud60x18/Math.sol\\\";\\nimport \\\"./ud60x18/ValueType.sol\\\";\\n\",\"keccak256\":\"0xb98c6f74275914d279e8af6c502c2b1f50d5f6e1ed418d3b0153f5a193206c48\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as CastingErrors;\\nimport { SD59x18 } from \\\"../sd59x18/ValueType.sol\\\";\\nimport { UD2x18 } from \\\"../ud2x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"../ud60x18/ValueType.sol\\\";\\nimport { SD1x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts an SD1x18 number into SD59x18.\\n/// @dev There is no overflow check because the domain of SD1x18 is a subset of SD59x18.\\nfunction intoSD59x18(SD1x18 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(int256(SD1x18.unwrap(x)));\\n}\\n\\n/// @notice Casts an SD1x18 number into UD2x18.\\n/// - x must be positive.\\nfunction intoUD2x18(SD1x18 x) pure returns (UD2x18 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUD2x18_Underflow(x);\\n }\\n result = UD2x18.wrap(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into UD60x18.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUD60x18(SD1x18 x) pure returns (UD60x18 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUD60x18_Underflow(x);\\n }\\n result = UD60x18.wrap(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into uint256.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUint256(SD1x18 x) pure returns (uint256 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint256_Underflow(x);\\n }\\n result = uint256(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into uint128.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUint128(SD1x18 x) pure returns (uint128 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint128_Underflow(x);\\n }\\n result = uint128(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(SD1x18 x) pure returns (uint40 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint40_Underflow(x);\\n }\\n if (xInt > int64(uint64(Common.MAX_UINT40))) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint40_Overflow(x);\\n }\\n result = uint40(uint64(xInt));\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction sd1x18(int64 x) pure returns (SD1x18 result) {\\n result = SD1x18.wrap(x);\\n}\\n\\n/// @notice Unwraps an SD1x18 number into int64.\\nfunction unwrap(SD1x18 x) pure returns (int64 result) {\\n result = SD1x18.unwrap(x);\\n}\\n\\n/// @notice Wraps an int64 number into SD1x18.\\nfunction wrap(int64 x) pure returns (SD1x18 result) {\\n result = SD1x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x9e49e2b37c1bb845861740805edaaef3fe951a7b96eef16ce84fbf76e8278670\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD1x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @dev Euler's number as an SD1x18 number.\\nSD1x18 constant E = SD1x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum value an SD1x18 number can have.\\nint64 constant uMAX_SD1x18 = 9_223372036854775807;\\nSD1x18 constant MAX_SD1x18 = SD1x18.wrap(uMAX_SD1x18);\\n\\n/// @dev The maximum value an SD1x18 number can have.\\nint64 constant uMIN_SD1x18 = -9_223372036854775808;\\nSD1x18 constant MIN_SD1x18 = SD1x18.wrap(uMIN_SD1x18);\\n\\n/// @dev PI as an SD1x18 number.\\nSD1x18 constant PI = SD1x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of SD1x18.\\nSD1x18 constant UNIT = SD1x18.wrap(1e18);\\nint64 constant uUNIT = 1e18;\\n\",\"keccak256\":\"0x6496165b80552785a4b65a239b96e2a5fedf62fe54f002eeed72d75e566d7585\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD1x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in UD2x18.\\nerror PRBMath_SD1x18_ToUD2x18_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in UD60x18.\\nerror PRBMath_SD1x18_ToUD60x18_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint128.\\nerror PRBMath_SD1x18_ToUint128_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint256.\\nerror PRBMath_SD1x18_ToUint256_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint40.\\nerror PRBMath_SD1x18_ToUint40_Overflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint40.\\nerror PRBMath_SD1x18_ToUint40_Underflow(SD1x18 x);\\n\",\"keccak256\":\"0x836cb42ba619ca369fd4765bc47fefc3c3621369c5861882af14660aca5057ee\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\n\\n/// @notice The signed 1.18-decimal fixed-point number representation, which can have up to 1 digit and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\\n/// type int64. This is useful when end users want to use int64 to save gas, e.g. with tight variable packing in contract\\n/// storage.\\ntype SD1x18 is int64;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoSD59x18,\\n Casting.intoUD2x18,\\n Casting.intoUD60x18,\\n Casting.intoUint256,\\n Casting.intoUint128,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for SD1x18 global;\\n\",\"keccak256\":\"0x2f86f1aa9fca42f40808b51a879b406ac51817647bdb9642f8a79dd8fdb754a7\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Errors.sol\\\" as CastingErrors;\\nimport { MAX_UINT128, MAX_UINT40 } from \\\"../Common.sol\\\";\\nimport { uMAX_SD1x18, uMIN_SD1x18 } from \\\"../sd1x18/Constants.sol\\\";\\nimport { SD1x18 } from \\\"../sd1x18/ValueType.sol\\\";\\nimport { uMAX_UD2x18 } from \\\"../ud2x18/Constants.sol\\\";\\nimport { UD2x18 } from \\\"../ud2x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"../ud60x18/ValueType.sol\\\";\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts an SD59x18 number into int256.\\n/// @dev This is basically a functional alias for {unwrap}.\\nfunction intoInt256(SD59x18 x) pure returns (int256 result) {\\n result = SD59x18.unwrap(x);\\n}\\n\\n/// @notice Casts an SD59x18 number into SD1x18.\\n/// @dev Requirements:\\n/// - x must be greater than or equal to `uMIN_SD1x18`.\\n/// - x must be less than or equal to `uMAX_SD1x18`.\\nfunction intoSD1x18(SD59x18 x) pure returns (SD1x18 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < uMIN_SD1x18) {\\n revert CastingErrors.PRBMath_SD59x18_IntoSD1x18_Underflow(x);\\n }\\n if (xInt > uMAX_SD1x18) {\\n revert CastingErrors.PRBMath_SD59x18_IntoSD1x18_Overflow(x);\\n }\\n result = SD1x18.wrap(int64(xInt));\\n}\\n\\n/// @notice Casts an SD59x18 number into UD2x18.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `uMAX_UD2x18`.\\nfunction intoUD2x18(SD59x18 x) pure returns (UD2x18 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUD2x18_Underflow(x);\\n }\\n if (xInt > int256(uint256(uMAX_UD2x18))) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUD2x18_Overflow(x);\\n }\\n result = UD2x18.wrap(uint64(uint256(xInt)));\\n}\\n\\n/// @notice Casts an SD59x18 number into UD60x18.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUD60x18(SD59x18 x) pure returns (UD60x18 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUD60x18_Underflow(x);\\n }\\n result = UD60x18.wrap(uint256(xInt));\\n}\\n\\n/// @notice Casts an SD59x18 number into uint256.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUint256(SD59x18 x) pure returns (uint256 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint256_Underflow(x);\\n }\\n result = uint256(xInt);\\n}\\n\\n/// @notice Casts an SD59x18 number into uint128.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `uMAX_UINT128`.\\nfunction intoUint128(SD59x18 x) pure returns (uint128 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint128_Underflow(x);\\n }\\n if (xInt > int256(uint256(MAX_UINT128))) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint128_Overflow(x);\\n }\\n result = uint128(uint256(xInt));\\n}\\n\\n/// @notice Casts an SD59x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(SD59x18 x) pure returns (uint40 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint40_Underflow(x);\\n }\\n if (xInt > int256(uint256(MAX_UINT40))) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint40_Overflow(x);\\n }\\n result = uint40(uint256(xInt));\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction sd(int256 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(x);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction sd59x18(int256 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(x);\\n}\\n\\n/// @notice Unwraps an SD59x18 number into int256.\\nfunction unwrap(SD59x18 x) pure returns (int256 result) {\\n result = SD59x18.unwrap(x);\\n}\\n\\n/// @notice Wraps an int256 number into SD59x18.\\nfunction wrap(int256 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x3b21b60ec2998c3ae32f647412da51d3683b3f183a807198cc8d157499484f99\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n// NOTICE: the \\\"u\\\" prefix stands for \\\"unwrapped\\\".\\n\\n/// @dev Euler's number as an SD59x18 number.\\nSD59x18 constant E = SD59x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum input permitted in {exp}.\\nint256 constant uEXP_MAX_INPUT = 133_084258667509499440;\\nSD59x18 constant EXP_MAX_INPUT = SD59x18.wrap(uEXP_MAX_INPUT);\\n\\n/// @dev Any value less than this returns 0 in {exp}.\\nint256 constant uEXP_MIN_THRESHOLD = -41_446531673892822322;\\nSD59x18 constant EXP_MIN_THRESHOLD = SD59x18.wrap(uEXP_MIN_THRESHOLD);\\n\\n/// @dev The maximum input permitted in {exp2}.\\nint256 constant uEXP2_MAX_INPUT = 192e18 - 1;\\nSD59x18 constant EXP2_MAX_INPUT = SD59x18.wrap(uEXP2_MAX_INPUT);\\n\\n/// @dev Any value less than this returns 0 in {exp2}.\\nint256 constant uEXP2_MIN_THRESHOLD = -59_794705707972522261;\\nSD59x18 constant EXP2_MIN_THRESHOLD = SD59x18.wrap(uEXP2_MIN_THRESHOLD);\\n\\n/// @dev Half the UNIT number.\\nint256 constant uHALF_UNIT = 0.5e18;\\nSD59x18 constant HALF_UNIT = SD59x18.wrap(uHALF_UNIT);\\n\\n/// @dev $log_2(10)$ as an SD59x18 number.\\nint256 constant uLOG2_10 = 3_321928094887362347;\\nSD59x18 constant LOG2_10 = SD59x18.wrap(uLOG2_10);\\n\\n/// @dev $log_2(e)$ as an SD59x18 number.\\nint256 constant uLOG2_E = 1_442695040888963407;\\nSD59x18 constant LOG2_E = SD59x18.wrap(uLOG2_E);\\n\\n/// @dev The maximum value an SD59x18 number can have.\\nint256 constant uMAX_SD59x18 = 57896044618658097711785492504343953926634992332820282019728_792003956564819967;\\nSD59x18 constant MAX_SD59x18 = SD59x18.wrap(uMAX_SD59x18);\\n\\n/// @dev The maximum whole value an SD59x18 number can have.\\nint256 constant uMAX_WHOLE_SD59x18 = 57896044618658097711785492504343953926634992332820282019728_000000000000000000;\\nSD59x18 constant MAX_WHOLE_SD59x18 = SD59x18.wrap(uMAX_WHOLE_SD59x18);\\n\\n/// @dev The minimum value an SD59x18 number can have.\\nint256 constant uMIN_SD59x18 = -57896044618658097711785492504343953926634992332820282019728_792003956564819968;\\nSD59x18 constant MIN_SD59x18 = SD59x18.wrap(uMIN_SD59x18);\\n\\n/// @dev The minimum whole value an SD59x18 number can have.\\nint256 constant uMIN_WHOLE_SD59x18 = -57896044618658097711785492504343953926634992332820282019728_000000000000000000;\\nSD59x18 constant MIN_WHOLE_SD59x18 = SD59x18.wrap(uMIN_WHOLE_SD59x18);\\n\\n/// @dev PI as an SD59x18 number.\\nSD59x18 constant PI = SD59x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of SD59x18.\\nint256 constant uUNIT = 1e18;\\nSD59x18 constant UNIT = SD59x18.wrap(1e18);\\n\\n/// @dev The unit number squared.\\nint256 constant uUNIT_SQUARED = 1e36;\\nSD59x18 constant UNIT_SQUARED = SD59x18.wrap(uUNIT_SQUARED);\\n\\n/// @dev Zero as an SD59x18 number.\\nSD59x18 constant ZERO = SD59x18.wrap(0);\\n\",\"keccak256\":\"0x9bcb8dd6b3e886d140ad1c32747a4f6d29a492529ceb835be878ae837aa6cc3a\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when taking the absolute value of `MIN_SD59x18`.\\nerror PRBMath_SD59x18_Abs_MinSD59x18();\\n\\n/// @notice Thrown when ceiling a number overflows SD59x18.\\nerror PRBMath_SD59x18_Ceil_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when converting a basic integer to the fixed-point format overflows SD59x18.\\nerror PRBMath_SD59x18_Convert_Overflow(int256 x);\\n\\n/// @notice Thrown when converting a basic integer to the fixed-point format underflows SD59x18.\\nerror PRBMath_SD59x18_Convert_Underflow(int256 x);\\n\\n/// @notice Thrown when dividing two numbers and one of them is `MIN_SD59x18`.\\nerror PRBMath_SD59x18_Div_InputTooSmall();\\n\\n/// @notice Thrown when dividing two numbers and one of the intermediary unsigned results overflows SD59x18.\\nerror PRBMath_SD59x18_Div_Overflow(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when taking the natural exponent of a base greater than 133_084258667509499441.\\nerror PRBMath_SD59x18_Exp_InputTooBig(SD59x18 x);\\n\\n/// @notice Thrown when taking the binary exponent of a base greater than 192e18.\\nerror PRBMath_SD59x18_Exp2_InputTooBig(SD59x18 x);\\n\\n/// @notice Thrown when flooring a number underflows SD59x18.\\nerror PRBMath_SD59x18_Floor_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when taking the geometric mean of two numbers and their product is negative.\\nerror PRBMath_SD59x18_Gm_NegativeProduct(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when taking the geometric mean of two numbers and multiplying them overflows SD59x18.\\nerror PRBMath_SD59x18_Gm_Overflow(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\\nerror PRBMath_SD59x18_IntoSD1x18_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\\nerror PRBMath_SD59x18_IntoSD1x18_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\\nerror PRBMath_SD59x18_IntoUD2x18_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\\nerror PRBMath_SD59x18_IntoUD2x18_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD60x18.\\nerror PRBMath_SD59x18_IntoUD60x18_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\\nerror PRBMath_SD59x18_IntoUint128_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\\nerror PRBMath_SD59x18_IntoUint128_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint256.\\nerror PRBMath_SD59x18_IntoUint256_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\\nerror PRBMath_SD59x18_IntoUint40_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\\nerror PRBMath_SD59x18_IntoUint40_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when taking the logarithm of a number less than or equal to zero.\\nerror PRBMath_SD59x18_Log_InputTooSmall(SD59x18 x);\\n\\n/// @notice Thrown when multiplying two numbers and one of the inputs is `MIN_SD59x18`.\\nerror PRBMath_SD59x18_Mul_InputTooSmall();\\n\\n/// @notice Thrown when multiplying two numbers and the intermediary absolute result overflows SD59x18.\\nerror PRBMath_SD59x18_Mul_Overflow(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when raising a number to a power and the intermediary absolute result overflows SD59x18.\\nerror PRBMath_SD59x18_Powu_Overflow(SD59x18 x, uint256 y);\\n\\n/// @notice Thrown when taking the square root of a negative number.\\nerror PRBMath_SD59x18_Sqrt_NegativeInput(SD59x18 x);\\n\\n/// @notice Thrown when the calculating the square root overflows SD59x18.\\nerror PRBMath_SD59x18_Sqrt_Overflow(SD59x18 x);\\n\",\"keccak256\":\"0xa6d00fe5efa215ac0df25c896e3da99a12fb61e799644b2ec32da947313d3db4\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Helpers.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { wrap } from \\\"./Casting.sol\\\";\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Implements the checked addition operation (+) in the SD59x18 type.\\nfunction add(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n return wrap(x.unwrap() + y.unwrap());\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the SD59x18 type.\\nfunction and(SD59x18 x, int256 bits) pure returns (SD59x18 result) {\\n return wrap(x.unwrap() & bits);\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the SD59x18 type.\\nfunction and2(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n return wrap(x.unwrap() & y.unwrap());\\n}\\n\\n/// @notice Implements the equal (=) operation in the SD59x18 type.\\nfunction eq(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() == y.unwrap();\\n}\\n\\n/// @notice Implements the greater than operation (>) in the SD59x18 type.\\nfunction gt(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() > y.unwrap();\\n}\\n\\n/// @notice Implements the greater than or equal to operation (>=) in the SD59x18 type.\\nfunction gte(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() >= y.unwrap();\\n}\\n\\n/// @notice Implements a zero comparison check function in the SD59x18 type.\\nfunction isZero(SD59x18 x) pure returns (bool result) {\\n result = x.unwrap() == 0;\\n}\\n\\n/// @notice Implements the left shift operation (<<) in the SD59x18 type.\\nfunction lshift(SD59x18 x, uint256 bits) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() << bits);\\n}\\n\\n/// @notice Implements the lower than operation (<) in the SD59x18 type.\\nfunction lt(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() < y.unwrap();\\n}\\n\\n/// @notice Implements the lower than or equal to operation (<=) in the SD59x18 type.\\nfunction lte(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() <= y.unwrap();\\n}\\n\\n/// @notice Implements the unchecked modulo operation (%) in the SD59x18 type.\\nfunction mod(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() % y.unwrap());\\n}\\n\\n/// @notice Implements the not equal operation (!=) in the SD59x18 type.\\nfunction neq(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() != y.unwrap();\\n}\\n\\n/// @notice Implements the NOT (~) bitwise operation in the SD59x18 type.\\nfunction not(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(~x.unwrap());\\n}\\n\\n/// @notice Implements the OR (|) bitwise operation in the SD59x18 type.\\nfunction or(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() | y.unwrap());\\n}\\n\\n/// @notice Implements the right shift operation (>>) in the SD59x18 type.\\nfunction rshift(SD59x18 x, uint256 bits) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() >> bits);\\n}\\n\\n/// @notice Implements the checked subtraction operation (-) in the SD59x18 type.\\nfunction sub(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() - y.unwrap());\\n}\\n\\n/// @notice Implements the checked unary minus operation (-) in the SD59x18 type.\\nfunction unary(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(-x.unwrap());\\n}\\n\\n/// @notice Implements the unchecked addition operation (+) in the SD59x18 type.\\nfunction uncheckedAdd(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() + y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the unchecked subtraction operation (-) in the SD59x18 type.\\nfunction uncheckedSub(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() - y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the unchecked unary minus operation (-) in the SD59x18 type.\\nfunction uncheckedUnary(SD59x18 x) pure returns (SD59x18 result) {\\n unchecked {\\n result = wrap(-x.unwrap());\\n }\\n}\\n\\n/// @notice Implements the XOR (^) bitwise operation in the SD59x18 type.\\nfunction xor(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() ^ y.unwrap());\\n}\\n\",\"keccak256\":\"0x208570f1657cf730cb6c3d81aa14030e0d45cf906cdedea5059369d7df4bb716\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as Errors;\\nimport {\\n uEXP_MAX_INPUT,\\n uEXP2_MAX_INPUT,\\n uEXP_MIN_THRESHOLD,\\n uEXP2_MIN_THRESHOLD,\\n uHALF_UNIT,\\n uLOG2_10,\\n uLOG2_E,\\n uMAX_SD59x18,\\n uMAX_WHOLE_SD59x18,\\n uMIN_SD59x18,\\n uMIN_WHOLE_SD59x18,\\n UNIT,\\n uUNIT,\\n uUNIT_SQUARED,\\n ZERO\\n} from \\\"./Constants.sol\\\";\\nimport { wrap } from \\\"./Helpers.sol\\\";\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Calculates the absolute value of x.\\n///\\n/// @dev Requirements:\\n/// - x must be greater than `MIN_SD59x18`.\\n///\\n/// @param x The SD59x18 number for which to calculate the absolute value.\\n/// @param result The absolute value of x as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction abs(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt == uMIN_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Abs_MinSD59x18();\\n }\\n result = xInt < 0 ? wrap(-xInt) : x;\\n}\\n\\n/// @notice Calculates the arithmetic average of x and y.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// @param x The first operand as an SD59x18 number.\\n/// @param y The second operand as an SD59x18 number.\\n/// @return result The arithmetic average as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction avg(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n\\n unchecked {\\n // This operation is equivalent to `x / 2 + y / 2`, and it can never overflow.\\n int256 sum = (xInt >> 1) + (yInt >> 1);\\n\\n if (sum < 0) {\\n // If at least one of x and y is odd, add 1 to the result, because shifting negative numbers to the right\\n // rounds toward negative infinity. The right part is equivalent to `sum + (x % 2 == 1 || y % 2 == 1)`.\\n assembly (\\\"memory-safe\\\") {\\n result := add(sum, and(or(xInt, yInt), 1))\\n }\\n } else {\\n // Add 1 if both x and y are odd to account for the double 0.5 remainder truncated after shifting.\\n result = wrap(sum + (xInt & yInt & 1));\\n }\\n }\\n}\\n\\n/// @notice Yields the smallest whole number greater than or equal to x.\\n///\\n/// @dev Optimized for fractional value inputs, because every whole value has (1e18 - 1) fractional counterparts.\\n/// See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n///\\n/// Requirements:\\n/// - x must be less than or equal to `MAX_WHOLE_SD59x18`.\\n///\\n/// @param x The SD59x18 number to ceil.\\n/// @param result The smallest whole number greater than or equal to x, as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ceil(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt > uMAX_WHOLE_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Ceil_Overflow(x);\\n }\\n\\n int256 remainder = xInt % uUNIT;\\n if (remainder == 0) {\\n result = x;\\n } else {\\n unchecked {\\n // Solidity uses C fmod style, which returns a modulus with the same sign as x.\\n int256 resultInt = xInt - remainder;\\n if (xInt > 0) {\\n resultInt += uUNIT;\\n }\\n result = wrap(resultInt);\\n }\\n }\\n}\\n\\n/// @notice Divides two SD59x18 numbers, returning a new SD59x18 number.\\n///\\n/// @dev This is an extension of {Common.mulDiv} for signed numbers, which works by computing the signs and the absolute\\n/// values separately.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv}.\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv}.\\n/// - None of the inputs can be `MIN_SD59x18`.\\n/// - The denominator must not be zero.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The numerator as an SD59x18 number.\\n/// @param y The denominator as an SD59x18 number.\\n/// @param result The quotient as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction div(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n if (xInt == uMIN_SD59x18 || yInt == uMIN_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Div_InputTooSmall();\\n }\\n\\n // Get hold of the absolute values of x and y.\\n uint256 xAbs;\\n uint256 yAbs;\\n unchecked {\\n xAbs = xInt < 0 ? uint256(-xInt) : uint256(xInt);\\n yAbs = yInt < 0 ? uint256(-yInt) : uint256(yInt);\\n }\\n\\n // Compute the absolute value (x*UNIT\\u00f7y). The resulting value must fit in SD59x18.\\n uint256 resultAbs = Common.mulDiv(xAbs, uint256(uUNIT), yAbs);\\n if (resultAbs > uint256(uMAX_SD59x18)) {\\n revert Errors.PRBMath_SD59x18_Div_Overflow(x, y);\\n }\\n\\n // Check if x and y have the same sign using two's complement representation. The left-most bit represents the sign (1 for\\n // negative, 0 for positive or zero).\\n bool sameSign = (xInt ^ yInt) > -1;\\n\\n // If the inputs have the same sign, the result should be positive. Otherwise, it should be negative.\\n unchecked {\\n result = wrap(sameSign ? int256(resultAbs) : -int256(resultAbs));\\n }\\n}\\n\\n/// @notice Calculates the natural exponent of x using the following formula:\\n///\\n/// $$\\n/// e^x = 2^{x * log_2{e}}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {exp2}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {exp2}.\\n/// - x must be less than 133_084258667509499441.\\n///\\n/// @param x The exponent as an SD59x18 number.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n\\n // Any input less than the threshold returns zero.\\n // This check also prevents an overflow for very small numbers.\\n if (xInt < uEXP_MIN_THRESHOLD) {\\n return ZERO;\\n }\\n\\n // This check prevents values greater than 192e18 from being passed to {exp2}.\\n if (xInt > uEXP_MAX_INPUT) {\\n revert Errors.PRBMath_SD59x18_Exp_InputTooBig(x);\\n }\\n\\n unchecked {\\n // Inline the fixed-point multiplication to save gas.\\n int256 doubleUnitProduct = xInt * uLOG2_E;\\n result = exp2(wrap(doubleUnitProduct / uUNIT));\\n }\\n}\\n\\n/// @notice Calculates the binary exponent of x using the binary fraction method using the following formula:\\n///\\n/// $$\\n/// 2^{-x} = \\\\frac{1}{2^x}\\n/// $$\\n///\\n/// @dev See https://ethereum.stackexchange.com/q/79903/24693.\\n///\\n/// Notes:\\n/// - If x is less than -59_794705707972522261, the result is zero.\\n///\\n/// Requirements:\\n/// - x must be less than 192e18.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The exponent as an SD59x18 number.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp2(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < 0) {\\n // The inverse of any number less than the threshold is truncated to zero.\\n if (xInt < uEXP2_MIN_THRESHOLD) {\\n return ZERO;\\n }\\n\\n unchecked {\\n // Inline the fixed-point inversion to save gas.\\n result = wrap(uUNIT_SQUARED / exp2(wrap(-xInt)).unwrap());\\n }\\n } else {\\n // Numbers greater than or equal to 192e18 don't fit in the 192.64-bit format.\\n if (xInt > uEXP2_MAX_INPUT) {\\n revert Errors.PRBMath_SD59x18_Exp2_InputTooBig(x);\\n }\\n\\n unchecked {\\n // Convert x to the 192.64-bit fixed-point format.\\n uint256 x_192x64 = uint256((xInt << 64) / uUNIT);\\n\\n // It is safe to cast the result to int256 due to the checks above.\\n result = wrap(int256(Common.exp2(x_192x64)));\\n }\\n }\\n}\\n\\n/// @notice Yields the greatest whole number less than or equal to x.\\n///\\n/// @dev Optimized for fractional value inputs, because for every whole value there are (1e18 - 1) fractional\\n/// counterparts. See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n///\\n/// Requirements:\\n/// - x must be greater than or equal to `MIN_WHOLE_SD59x18`.\\n///\\n/// @param x The SD59x18 number to floor.\\n/// @param result The greatest whole number less than or equal to x, as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction floor(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < uMIN_WHOLE_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Floor_Underflow(x);\\n }\\n\\n int256 remainder = xInt % uUNIT;\\n if (remainder == 0) {\\n result = x;\\n } else {\\n unchecked {\\n // Solidity uses C fmod style, which returns a modulus with the same sign as x.\\n int256 resultInt = xInt - remainder;\\n if (xInt < 0) {\\n resultInt -= uUNIT;\\n }\\n result = wrap(resultInt);\\n }\\n }\\n}\\n\\n/// @notice Yields the excess beyond the floor of x for positive numbers and the part of the number to the right.\\n/// of the radix point for negative numbers.\\n/// @dev Based on the odd function definition. https://en.wikipedia.org/wiki/Fractional_part\\n/// @param x The SD59x18 number to get the fractional part of.\\n/// @param result The fractional part of x as an SD59x18 number.\\nfunction frac(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() % uUNIT);\\n}\\n\\n/// @notice Calculates the geometric mean of x and y, i.e. $\\\\sqrt{x * y}$.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x * y must fit in SD59x18.\\n/// - x * y must not be negative, since complex numbers are not supported.\\n///\\n/// @param x The first operand as an SD59x18 number.\\n/// @param y The second operand as an SD59x18 number.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction gm(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n if (xInt == 0 || yInt == 0) {\\n return ZERO;\\n }\\n\\n unchecked {\\n // Equivalent to `xy / x != y`. Checking for overflow this way is faster than letting Solidity do it.\\n int256 xyInt = xInt * yInt;\\n if (xyInt / xInt != yInt) {\\n revert Errors.PRBMath_SD59x18_Gm_Overflow(x, y);\\n }\\n\\n // The product must not be negative, since complex numbers are not supported.\\n if (xyInt < 0) {\\n revert Errors.PRBMath_SD59x18_Gm_NegativeProduct(x, y);\\n }\\n\\n // We don't need to multiply the result by `UNIT` here because the x*y product picked up a factor of `UNIT`\\n // during multiplication. See the comments in {Common.sqrt}.\\n uint256 resultUint = Common.sqrt(uint256(xyInt));\\n result = wrap(int256(resultUint));\\n }\\n}\\n\\n/// @notice Calculates the inverse of x.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x must not be zero.\\n///\\n/// @param x The SD59x18 number for which to calculate the inverse.\\n/// @return result The inverse as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction inv(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(uUNIT_SQUARED / x.unwrap());\\n}\\n\\n/// @notice Calculates the natural logarithm of x using the following formula:\\n///\\n/// $$\\n/// ln{x} = log_2{x} / log_2{e}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n/// - The precision isn't sufficiently fine-grained to return exactly `UNIT` when the input is `E`.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The SD59x18 number for which to calculate the natural logarithm.\\n/// @return result The natural logarithm as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ln(SD59x18 x) pure returns (SD59x18 result) {\\n // Inline the fixed-point multiplication to save gas. This is overflow-safe because the maximum value that\\n // {log2} can return is ~195_205294292027477728.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_E);\\n}\\n\\n/// @notice Calculates the common logarithm of x using the following formula:\\n///\\n/// $$\\n/// log_{10}{x} = log_2{x} / log_2{10}\\n/// $$\\n///\\n/// However, if x is an exact power of ten, a hard coded value is returned.\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The SD59x18 number for which to calculate the common logarithm.\\n/// @return result The common logarithm as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log10(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < 0) {\\n revert Errors.PRBMath_SD59x18_Log_InputTooSmall(x);\\n }\\n\\n // Note that the `mul` in this block is the standard multiplication operation, not {SD59x18.mul}.\\n // prettier-ignore\\n assembly (\\\"memory-safe\\\") {\\n switch x\\n case 1 { result := mul(uUNIT, sub(0, 18)) }\\n case 10 { result := mul(uUNIT, sub(1, 18)) }\\n case 100 { result := mul(uUNIT, sub(2, 18)) }\\n case 1000 { result := mul(uUNIT, sub(3, 18)) }\\n case 10000 { result := mul(uUNIT, sub(4, 18)) }\\n case 100000 { result := mul(uUNIT, sub(5, 18)) }\\n case 1000000 { result := mul(uUNIT, sub(6, 18)) }\\n case 10000000 { result := mul(uUNIT, sub(7, 18)) }\\n case 100000000 { result := mul(uUNIT, sub(8, 18)) }\\n case 1000000000 { result := mul(uUNIT, sub(9, 18)) }\\n case 10000000000 { result := mul(uUNIT, sub(10, 18)) }\\n case 100000000000 { result := mul(uUNIT, sub(11, 18)) }\\n case 1000000000000 { result := mul(uUNIT, sub(12, 18)) }\\n case 10000000000000 { result := mul(uUNIT, sub(13, 18)) }\\n case 100000000000000 { result := mul(uUNIT, sub(14, 18)) }\\n case 1000000000000000 { result := mul(uUNIT, sub(15, 18)) }\\n case 10000000000000000 { result := mul(uUNIT, sub(16, 18)) }\\n case 100000000000000000 { result := mul(uUNIT, sub(17, 18)) }\\n case 1000000000000000000 { result := 0 }\\n case 10000000000000000000 { result := uUNIT }\\n case 100000000000000000000 { result := mul(uUNIT, 2) }\\n case 1000000000000000000000 { result := mul(uUNIT, 3) }\\n case 10000000000000000000000 { result := mul(uUNIT, 4) }\\n case 100000000000000000000000 { result := mul(uUNIT, 5) }\\n case 1000000000000000000000000 { result := mul(uUNIT, 6) }\\n case 10000000000000000000000000 { result := mul(uUNIT, 7) }\\n case 100000000000000000000000000 { result := mul(uUNIT, 8) }\\n case 1000000000000000000000000000 { result := mul(uUNIT, 9) }\\n case 10000000000000000000000000000 { result := mul(uUNIT, 10) }\\n case 100000000000000000000000000000 { result := mul(uUNIT, 11) }\\n case 1000000000000000000000000000000 { result := mul(uUNIT, 12) }\\n case 10000000000000000000000000000000 { result := mul(uUNIT, 13) }\\n case 100000000000000000000000000000000 { result := mul(uUNIT, 14) }\\n case 1000000000000000000000000000000000 { result := mul(uUNIT, 15) }\\n case 10000000000000000000000000000000000 { result := mul(uUNIT, 16) }\\n case 100000000000000000000000000000000000 { result := mul(uUNIT, 17) }\\n case 1000000000000000000000000000000000000 { result := mul(uUNIT, 18) }\\n case 10000000000000000000000000000000000000 { result := mul(uUNIT, 19) }\\n case 100000000000000000000000000000000000000 { result := mul(uUNIT, 20) }\\n case 1000000000000000000000000000000000000000 { result := mul(uUNIT, 21) }\\n case 10000000000000000000000000000000000000000 { result := mul(uUNIT, 22) }\\n case 100000000000000000000000000000000000000000 { result := mul(uUNIT, 23) }\\n case 1000000000000000000000000000000000000000000 { result := mul(uUNIT, 24) }\\n case 10000000000000000000000000000000000000000000 { result := mul(uUNIT, 25) }\\n case 100000000000000000000000000000000000000000000 { result := mul(uUNIT, 26) }\\n case 1000000000000000000000000000000000000000000000 { result := mul(uUNIT, 27) }\\n case 10000000000000000000000000000000000000000000000 { result := mul(uUNIT, 28) }\\n case 100000000000000000000000000000000000000000000000 { result := mul(uUNIT, 29) }\\n case 1000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 30) }\\n case 10000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 31) }\\n case 100000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 32) }\\n case 1000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 33) }\\n case 10000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 34) }\\n case 100000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 35) }\\n case 1000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 36) }\\n case 10000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 37) }\\n case 100000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 38) }\\n case 1000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 39) }\\n case 10000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 40) }\\n case 100000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 41) }\\n case 1000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 42) }\\n case 10000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 43) }\\n case 100000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 44) }\\n case 1000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 45) }\\n case 10000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 46) }\\n case 100000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 47) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 48) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 49) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 50) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 51) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 52) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 53) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 54) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 55) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 56) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 57) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 58) }\\n default { result := uMAX_SD59x18 }\\n }\\n\\n if (result.unwrap() == uMAX_SD59x18) {\\n unchecked {\\n // Inline the fixed-point division to save gas.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_10);\\n }\\n }\\n}\\n\\n/// @notice Calculates the binary logarithm of x using the iterative approximation algorithm:\\n///\\n/// $$\\n/// log_2{x} = n + log_2{y}, \\\\text{ where } y = x*2^{-n}, \\\\ y \\\\in [1, 2)\\n/// $$\\n///\\n/// For $0 \\\\leq x \\\\lt 1$, the input is inverted:\\n///\\n/// $$\\n/// log_2{x} = -log_2{\\\\frac{1}{x}}\\n/// $$\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Binary_logarithm#Iterative_approximation.\\n///\\n/// Notes:\\n/// - Due to the lossy precision of the iterative approximation, the results are not perfectly accurate to the last decimal.\\n///\\n/// Requirements:\\n/// - x must be greater than zero.\\n///\\n/// @param x The SD59x18 number for which to calculate the binary logarithm.\\n/// @return result The binary logarithm as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log2(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt <= 0) {\\n revert Errors.PRBMath_SD59x18_Log_InputTooSmall(x);\\n }\\n\\n unchecked {\\n int256 sign;\\n if (xInt >= uUNIT) {\\n sign = 1;\\n } else {\\n sign = -1;\\n // Inline the fixed-point inversion to save gas.\\n xInt = uUNIT_SQUARED / xInt;\\n }\\n\\n // Calculate the integer part of the logarithm.\\n uint256 n = Common.msb(uint256(xInt / uUNIT));\\n\\n // This is the integer part of the logarithm as an SD59x18 number. The operation can't overflow\\n // because n is at most 255, `UNIT` is 1e18, and the sign is either 1 or -1.\\n int256 resultInt = int256(n) * uUNIT;\\n\\n // Calculate $y = x * 2^{-n}$.\\n int256 y = xInt >> n;\\n\\n // If y is the unit number, the fractional part is zero.\\n if (y == uUNIT) {\\n return wrap(resultInt * sign);\\n }\\n\\n // Calculate the fractional part via the iterative approximation.\\n // The `delta >>= 1` part is equivalent to `delta /= 2`, but shifting bits is more gas efficient.\\n int256 DOUBLE_UNIT = 2e18;\\n for (int256 delta = uHALF_UNIT; delta > 0; delta >>= 1) {\\n y = (y * y) / uUNIT;\\n\\n // Is y^2 >= 2e18 and so in the range [2e18, 4e18)?\\n if (y >= DOUBLE_UNIT) {\\n // Add the 2^{-m} factor to the logarithm.\\n resultInt = resultInt + delta;\\n\\n // Halve y, which corresponds to z/2 in the Wikipedia article.\\n y >>= 1;\\n }\\n }\\n resultInt *= sign;\\n result = wrap(resultInt);\\n }\\n}\\n\\n/// @notice Multiplies two SD59x18 numbers together, returning a new SD59x18 number.\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {Common.mulDiv18}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv18}.\\n/// - None of the inputs can be `MIN_SD59x18`.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The multiplicand as an SD59x18 number.\\n/// @param y The multiplier as an SD59x18 number.\\n/// @return result The product as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mul(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n if (xInt == uMIN_SD59x18 || yInt == uMIN_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Mul_InputTooSmall();\\n }\\n\\n // Get hold of the absolute values of x and y.\\n uint256 xAbs;\\n uint256 yAbs;\\n unchecked {\\n xAbs = xInt < 0 ? uint256(-xInt) : uint256(xInt);\\n yAbs = yInt < 0 ? uint256(-yInt) : uint256(yInt);\\n }\\n\\n // Compute the absolute value (x*y\\u00f7UNIT). The resulting value must fit in SD59x18.\\n uint256 resultAbs = Common.mulDiv18(xAbs, yAbs);\\n if (resultAbs > uint256(uMAX_SD59x18)) {\\n revert Errors.PRBMath_SD59x18_Mul_Overflow(x, y);\\n }\\n\\n // Check if x and y have the same sign using two's complement representation. The left-most bit represents the sign (1 for\\n // negative, 0 for positive or zero).\\n bool sameSign = (xInt ^ yInt) > -1;\\n\\n // If the inputs have the same sign, the result should be positive. Otherwise, it should be negative.\\n unchecked {\\n result = wrap(sameSign ? int256(resultAbs) : -int256(resultAbs));\\n }\\n}\\n\\n/// @notice Raises x to the power of y using the following formula:\\n///\\n/// $$\\n/// x^y = 2^{log_2{x} * y}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {exp2}, {log2}, and {mul}.\\n/// - Returns `UNIT` for 0^0.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {exp2}, {log2}, and {mul}.\\n///\\n/// @param x The base as an SD59x18 number.\\n/// @param y Exponent to raise x to, as an SD59x18 number\\n/// @return result x raised to power y, as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction pow(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n\\n // If both x and y are zero, the result is `UNIT`. If just x is zero, the result is always zero.\\n if (xInt == 0) {\\n return yInt == 0 ? UNIT : ZERO;\\n }\\n // If x is `UNIT`, the result is always `UNIT`.\\n else if (xInt == uUNIT) {\\n return UNIT;\\n }\\n\\n // If y is zero, the result is always `UNIT`.\\n if (yInt == 0) {\\n return UNIT;\\n }\\n // If y is `UNIT`, the result is always x.\\n else if (yInt == uUNIT) {\\n return x;\\n }\\n\\n // Calculate the result using the formula.\\n result = exp2(mul(log2(x), y));\\n}\\n\\n/// @notice Raises x (an SD59x18 number) to the power y (an unsigned basic integer) using the well-known\\n/// algorithm \\\"exponentiation by squaring\\\".\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Exponentiation_by_squaring.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv18}.\\n/// - Returns `UNIT` for 0^0.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {abs} and {Common.mulDiv18}.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The base as an SD59x18 number.\\n/// @param y The exponent as a uint256.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction powu(SD59x18 x, uint256 y) pure returns (SD59x18 result) {\\n uint256 xAbs = uint256(abs(x).unwrap());\\n\\n // Calculate the first iteration of the loop in advance.\\n uint256 resultAbs = y & 1 > 0 ? xAbs : uint256(uUNIT);\\n\\n // Equivalent to `for(y /= 2; y > 0; y /= 2)`.\\n uint256 yAux = y;\\n for (yAux >>= 1; yAux > 0; yAux >>= 1) {\\n xAbs = Common.mulDiv18(xAbs, xAbs);\\n\\n // Equivalent to `y % 2 == 1`.\\n if (yAux & 1 > 0) {\\n resultAbs = Common.mulDiv18(resultAbs, xAbs);\\n }\\n }\\n\\n // The result must fit in SD59x18.\\n if (resultAbs > uint256(uMAX_SD59x18)) {\\n revert Errors.PRBMath_SD59x18_Powu_Overflow(x, y);\\n }\\n\\n unchecked {\\n // Is the base negative and the exponent odd? If yes, the result should be negative.\\n int256 resultInt = int256(resultAbs);\\n bool isNegative = x.unwrap() < 0 && y & 1 == 1;\\n if (isNegative) {\\n resultInt = -resultInt;\\n }\\n result = wrap(resultInt);\\n }\\n}\\n\\n/// @notice Calculates the square root of x using the Babylonian method.\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\\n///\\n/// Notes:\\n/// - Only the positive root is returned.\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x cannot be negative, since complex numbers are not supported.\\n/// - x must be less than `MAX_SD59x18 / UNIT`.\\n///\\n/// @param x The SD59x18 number for which to calculate the square root.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction sqrt(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < 0) {\\n revert Errors.PRBMath_SD59x18_Sqrt_NegativeInput(x);\\n }\\n if (xInt > uMAX_SD59x18 / uUNIT) {\\n revert Errors.PRBMath_SD59x18_Sqrt_Overflow(x);\\n }\\n\\n unchecked {\\n // Multiply x by `UNIT` to account for the factor of `UNIT` picked up when multiplying two SD59x18 numbers.\\n // In this case, the two numbers are both the square root.\\n uint256 resultUint = Common.sqrt(uint256(xInt * uUNIT));\\n result = wrap(int256(resultUint));\\n }\\n}\\n\",\"keccak256\":\"0xa074831139fc89ca0e5a36086b30eb50896bb6770cd5823461b1f2769017d2f0\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\nimport \\\"./Helpers.sol\\\" as Helpers;\\nimport \\\"./Math.sol\\\" as Math;\\n\\n/// @notice The signed 59.18-decimal fixed-point number representation, which can have up to 59 digits and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\\n/// type int256.\\ntype SD59x18 is int256;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoInt256,\\n Casting.intoSD1x18,\\n Casting.intoUD2x18,\\n Casting.intoUD60x18,\\n Casting.intoUint256,\\n Casting.intoUint128,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for SD59x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n MATHEMATICAL FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Math.abs,\\n Math.avg,\\n Math.ceil,\\n Math.div,\\n Math.exp,\\n Math.exp2,\\n Math.floor,\\n Math.frac,\\n Math.gm,\\n Math.inv,\\n Math.log10,\\n Math.log2,\\n Math.ln,\\n Math.mul,\\n Math.pow,\\n Math.powu,\\n Math.sqrt\\n} for SD59x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n HELPER FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Helpers.add,\\n Helpers.and,\\n Helpers.eq,\\n Helpers.gt,\\n Helpers.gte,\\n Helpers.isZero,\\n Helpers.lshift,\\n Helpers.lt,\\n Helpers.lte,\\n Helpers.mod,\\n Helpers.neq,\\n Helpers.not,\\n Helpers.or,\\n Helpers.rshift,\\n Helpers.sub,\\n Helpers.uncheckedAdd,\\n Helpers.uncheckedSub,\\n Helpers.uncheckedUnary,\\n Helpers.xor\\n} for SD59x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n OPERATORS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes it possible to use these operators on the SD59x18 type.\\nusing {\\n Helpers.add as +,\\n Helpers.and2 as &,\\n Math.div as /,\\n Helpers.eq as ==,\\n Helpers.gt as >,\\n Helpers.gte as >=,\\n Helpers.lt as <,\\n Helpers.lte as <=,\\n Helpers.mod as %,\\n Math.mul as *,\\n Helpers.neq as !=,\\n Helpers.not as ~,\\n Helpers.or as |,\\n Helpers.sub as -,\\n Helpers.unary as -,\\n Helpers.xor as ^\\n} for SD59x18 global;\\n\",\"keccak256\":\"0xe03112d145dcd5863aff24e5f381debaae29d446acd5666f3d640e3d9af738d7\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as Errors;\\nimport { uMAX_SD1x18 } from \\\"../sd1x18/Constants.sol\\\";\\nimport { SD1x18 } from \\\"../sd1x18/ValueType.sol\\\";\\nimport { SD59x18 } from \\\"../sd59x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"../ud60x18/ValueType.sol\\\";\\nimport { UD2x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts a UD2x18 number into SD1x18.\\n/// - x must be less than or equal to `uMAX_SD1x18`.\\nfunction intoSD1x18(UD2x18 x) pure returns (SD1x18 result) {\\n uint64 xUint = UD2x18.unwrap(x);\\n if (xUint > uint64(uMAX_SD1x18)) {\\n revert Errors.PRBMath_UD2x18_IntoSD1x18_Overflow(x);\\n }\\n result = SD1x18.wrap(int64(xUint));\\n}\\n\\n/// @notice Casts a UD2x18 number into SD59x18.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of SD59x18.\\nfunction intoSD59x18(UD2x18 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(int256(uint256(UD2x18.unwrap(x))));\\n}\\n\\n/// @notice Casts a UD2x18 number into UD60x18.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of UD60x18.\\nfunction intoUD60x18(UD2x18 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(UD2x18.unwrap(x));\\n}\\n\\n/// @notice Casts a UD2x18 number into uint128.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of uint128.\\nfunction intoUint128(UD2x18 x) pure returns (uint128 result) {\\n result = uint128(UD2x18.unwrap(x));\\n}\\n\\n/// @notice Casts a UD2x18 number into uint256.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of uint256.\\nfunction intoUint256(UD2x18 x) pure returns (uint256 result) {\\n result = uint256(UD2x18.unwrap(x));\\n}\\n\\n/// @notice Casts a UD2x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(UD2x18 x) pure returns (uint40 result) {\\n uint64 xUint = UD2x18.unwrap(x);\\n if (xUint > uint64(Common.MAX_UINT40)) {\\n revert Errors.PRBMath_UD2x18_IntoUint40_Overflow(x);\\n }\\n result = uint40(xUint);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction ud2x18(uint64 x) pure returns (UD2x18 result) {\\n result = UD2x18.wrap(x);\\n}\\n\\n/// @notice Unwrap a UD2x18 number into uint64.\\nfunction unwrap(UD2x18 x) pure returns (uint64 result) {\\n result = UD2x18.unwrap(x);\\n}\\n\\n/// @notice Wraps a uint64 number into UD2x18.\\nfunction wrap(uint64 x) pure returns (UD2x18 result) {\\n result = UD2x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x9b1a35d432ef951a415fae8098b3c609a99b630a3d5464b3c8e1efa8893eea07\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD2x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @dev Euler's number as a UD2x18 number.\\nUD2x18 constant E = UD2x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum value a UD2x18 number can have.\\nuint64 constant uMAX_UD2x18 = 18_446744073709551615;\\nUD2x18 constant MAX_UD2x18 = UD2x18.wrap(uMAX_UD2x18);\\n\\n/// @dev PI as a UD2x18 number.\\nUD2x18 constant PI = UD2x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of UD2x18.\\nUD2x18 constant UNIT = UD2x18.wrap(1e18);\\nuint64 constant uUNIT = 1e18;\\n\",\"keccak256\":\"0x29b0e050c865899e1fb9022b460a7829cdee248c44c4299f068ba80695eec3fc\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD2x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when trying to cast a UD2x18 number that doesn't fit in SD1x18.\\nerror PRBMath_UD2x18_IntoSD1x18_Overflow(UD2x18 x);\\n\\n/// @notice Thrown when trying to cast a UD2x18 number that doesn't fit in uint40.\\nerror PRBMath_UD2x18_IntoUint40_Overflow(UD2x18 x);\\n\",\"keccak256\":\"0xdf1e22f0b4c8032bcc8b7f63fe3984e1387f3dc7b2e9ab381822249f75376d33\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\n\\n/// @notice The unsigned 2.18-decimal fixed-point number representation, which can have up to 2 digits and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\\n/// type uint64. This is useful when end users want to use uint64 to save gas, e.g. with tight variable packing in contract\\n/// storage.\\ntype UD2x18 is uint64;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoSD1x18,\\n Casting.intoSD59x18,\\n Casting.intoUD60x18,\\n Casting.intoUint256,\\n Casting.intoUint128,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for UD2x18 global;\\n\",\"keccak256\":\"0x2802edc9869db116a0b5c490cc5f8554742f747183fa30ac5e9c80bb967e61a1\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Errors.sol\\\" as CastingErrors;\\nimport { MAX_UINT128, MAX_UINT40 } from \\\"../Common.sol\\\";\\nimport { uMAX_SD1x18 } from \\\"../sd1x18/Constants.sol\\\";\\nimport { SD1x18 } from \\\"../sd1x18/ValueType.sol\\\";\\nimport { uMAX_SD59x18 } from \\\"../sd59x18/Constants.sol\\\";\\nimport { SD59x18 } from \\\"../sd59x18/ValueType.sol\\\";\\nimport { uMAX_UD2x18 } from \\\"../ud2x18/Constants.sol\\\";\\nimport { UD2x18 } from \\\"../ud2x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts a UD60x18 number into SD1x18.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `uMAX_SD1x18`.\\nfunction intoSD1x18(UD60x18 x) pure returns (SD1x18 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > uint256(int256(uMAX_SD1x18))) {\\n revert CastingErrors.PRBMath_UD60x18_IntoSD1x18_Overflow(x);\\n }\\n result = SD1x18.wrap(int64(uint64(xUint)));\\n}\\n\\n/// @notice Casts a UD60x18 number into UD2x18.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `uMAX_UD2x18`.\\nfunction intoUD2x18(UD60x18 x) pure returns (UD2x18 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > uMAX_UD2x18) {\\n revert CastingErrors.PRBMath_UD60x18_IntoUD2x18_Overflow(x);\\n }\\n result = UD2x18.wrap(uint64(xUint));\\n}\\n\\n/// @notice Casts a UD60x18 number into SD59x18.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `uMAX_SD59x18`.\\nfunction intoSD59x18(UD60x18 x) pure returns (SD59x18 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > uint256(uMAX_SD59x18)) {\\n revert CastingErrors.PRBMath_UD60x18_IntoSD59x18_Overflow(x);\\n }\\n result = SD59x18.wrap(int256(xUint));\\n}\\n\\n/// @notice Casts a UD60x18 number into uint128.\\n/// @dev This is basically an alias for {unwrap}.\\nfunction intoUint256(UD60x18 x) pure returns (uint256 result) {\\n result = UD60x18.unwrap(x);\\n}\\n\\n/// @notice Casts a UD60x18 number into uint128.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UINT128`.\\nfunction intoUint128(UD60x18 x) pure returns (uint128 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > MAX_UINT128) {\\n revert CastingErrors.PRBMath_UD60x18_IntoUint128_Overflow(x);\\n }\\n result = uint128(xUint);\\n}\\n\\n/// @notice Casts a UD60x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(UD60x18 x) pure returns (uint40 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > MAX_UINT40) {\\n revert CastingErrors.PRBMath_UD60x18_IntoUint40_Overflow(x);\\n }\\n result = uint40(xUint);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction ud(uint256 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(x);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction ud60x18(uint256 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(x);\\n}\\n\\n/// @notice Unwraps a UD60x18 number into uint256.\\nfunction unwrap(UD60x18 x) pure returns (uint256 result) {\\n result = UD60x18.unwrap(x);\\n}\\n\\n/// @notice Wraps a uint256 number into the UD60x18 value type.\\nfunction wrap(uint256 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x5bb532da36921cbdac64d1f16de5d366ef1f664502e3b7c07d0ad06917551f85\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n// NOTICE: the \\\"u\\\" prefix stands for \\\"unwrapped\\\".\\n\\n/// @dev Euler's number as a UD60x18 number.\\nUD60x18 constant E = UD60x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum input permitted in {exp}.\\nuint256 constant uEXP_MAX_INPUT = 133_084258667509499440;\\nUD60x18 constant EXP_MAX_INPUT = UD60x18.wrap(uEXP_MAX_INPUT);\\n\\n/// @dev The maximum input permitted in {exp2}.\\nuint256 constant uEXP2_MAX_INPUT = 192e18 - 1;\\nUD60x18 constant EXP2_MAX_INPUT = UD60x18.wrap(uEXP2_MAX_INPUT);\\n\\n/// @dev Half the UNIT number.\\nuint256 constant uHALF_UNIT = 0.5e18;\\nUD60x18 constant HALF_UNIT = UD60x18.wrap(uHALF_UNIT);\\n\\n/// @dev $log_2(10)$ as a UD60x18 number.\\nuint256 constant uLOG2_10 = 3_321928094887362347;\\nUD60x18 constant LOG2_10 = UD60x18.wrap(uLOG2_10);\\n\\n/// @dev $log_2(e)$ as a UD60x18 number.\\nuint256 constant uLOG2_E = 1_442695040888963407;\\nUD60x18 constant LOG2_E = UD60x18.wrap(uLOG2_E);\\n\\n/// @dev The maximum value a UD60x18 number can have.\\nuint256 constant uMAX_UD60x18 = 115792089237316195423570985008687907853269984665640564039457_584007913129639935;\\nUD60x18 constant MAX_UD60x18 = UD60x18.wrap(uMAX_UD60x18);\\n\\n/// @dev The maximum whole value a UD60x18 number can have.\\nuint256 constant uMAX_WHOLE_UD60x18 = 115792089237316195423570985008687907853269984665640564039457_000000000000000000;\\nUD60x18 constant MAX_WHOLE_UD60x18 = UD60x18.wrap(uMAX_WHOLE_UD60x18);\\n\\n/// @dev PI as a UD60x18 number.\\nUD60x18 constant PI = UD60x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of UD60x18.\\nuint256 constant uUNIT = 1e18;\\nUD60x18 constant UNIT = UD60x18.wrap(uUNIT);\\n\\n/// @dev The unit number squared.\\nuint256 constant uUNIT_SQUARED = 1e36;\\nUD60x18 constant UNIT_SQUARED = UD60x18.wrap(uUNIT_SQUARED);\\n\\n/// @dev Zero as a UD60x18 number.\\nUD60x18 constant ZERO = UD60x18.wrap(0);\\n\",\"keccak256\":\"0x2b80d26153d3fdcfb3a9ca772d9309d31ed1275f5b8b54c3ffb54d3652b37d90\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Conversions.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { uMAX_UD60x18, uUNIT } from \\\"./Constants.sol\\\";\\nimport { PRBMath_UD60x18_Convert_Overflow } from \\\"./Errors.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Converts a UD60x18 number to a simple integer by dividing it by `UNIT`.\\n/// @dev The result is rounded toward zero.\\n/// @param x The UD60x18 number to convert.\\n/// @return result The same number in basic integer form.\\nfunction convert(UD60x18 x) pure returns (uint256 result) {\\n result = UD60x18.unwrap(x) / uUNIT;\\n}\\n\\n/// @notice Converts a simple integer to UD60x18 by multiplying it by `UNIT`.\\n///\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UD60x18 / UNIT`.\\n///\\n/// @param x The basic integer to convert.\\n/// @param result The same number converted to UD60x18.\\nfunction convert(uint256 x) pure returns (UD60x18 result) {\\n if (x > uMAX_UD60x18 / uUNIT) {\\n revert PRBMath_UD60x18_Convert_Overflow(x);\\n }\\n unchecked {\\n result = UD60x18.wrap(x * uUNIT);\\n }\\n}\\n\",\"keccak256\":\"0xaf7fc2523413822de3b66ba339fe2884fb3b8c6f6cf38ec90a2c3e3aae71df6b\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when ceiling a number overflows UD60x18.\\nerror PRBMath_UD60x18_Ceil_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when converting a basic integer to the fixed-point format overflows UD60x18.\\nerror PRBMath_UD60x18_Convert_Overflow(uint256 x);\\n\\n/// @notice Thrown when taking the natural exponent of a base greater than 133_084258667509499441.\\nerror PRBMath_UD60x18_Exp_InputTooBig(UD60x18 x);\\n\\n/// @notice Thrown when taking the binary exponent of a base greater than 192e18.\\nerror PRBMath_UD60x18_Exp2_InputTooBig(UD60x18 x);\\n\\n/// @notice Thrown when taking the geometric mean of two numbers and multiplying them overflows UD60x18.\\nerror PRBMath_UD60x18_Gm_Overflow(UD60x18 x, UD60x18 y);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\\nerror PRBMath_UD60x18_IntoSD1x18_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD59x18.\\nerror PRBMath_UD60x18_IntoSD59x18_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\\nerror PRBMath_UD60x18_IntoUD2x18_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\\nerror PRBMath_UD60x18_IntoUint128_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\\nerror PRBMath_UD60x18_IntoUint40_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when taking the logarithm of a number less than 1.\\nerror PRBMath_UD60x18_Log_InputTooSmall(UD60x18 x);\\n\\n/// @notice Thrown when calculating the square root overflows UD60x18.\\nerror PRBMath_UD60x18_Sqrt_Overflow(UD60x18 x);\\n\",\"keccak256\":\"0xa8c60d4066248df22c49c882873efbc017344107edabc48c52209abbc39cb1e3\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Helpers.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { wrap } from \\\"./Casting.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Implements the checked addition operation (+) in the UD60x18 type.\\nfunction add(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() + y.unwrap());\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the UD60x18 type.\\nfunction and(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() & bits);\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the UD60x18 type.\\nfunction and2(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() & y.unwrap());\\n}\\n\\n/// @notice Implements the equal operation (==) in the UD60x18 type.\\nfunction eq(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() == y.unwrap();\\n}\\n\\n/// @notice Implements the greater than operation (>) in the UD60x18 type.\\nfunction gt(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() > y.unwrap();\\n}\\n\\n/// @notice Implements the greater than or equal to operation (>=) in the UD60x18 type.\\nfunction gte(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() >= y.unwrap();\\n}\\n\\n/// @notice Implements a zero comparison check function in the UD60x18 type.\\nfunction isZero(UD60x18 x) pure returns (bool result) {\\n // This wouldn't work if x could be negative.\\n result = x.unwrap() == 0;\\n}\\n\\n/// @notice Implements the left shift operation (<<) in the UD60x18 type.\\nfunction lshift(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() << bits);\\n}\\n\\n/// @notice Implements the lower than operation (<) in the UD60x18 type.\\nfunction lt(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() < y.unwrap();\\n}\\n\\n/// @notice Implements the lower than or equal to operation (<=) in the UD60x18 type.\\nfunction lte(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() <= y.unwrap();\\n}\\n\\n/// @notice Implements the checked modulo operation (%) in the UD60x18 type.\\nfunction mod(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() % y.unwrap());\\n}\\n\\n/// @notice Implements the not equal operation (!=) in the UD60x18 type.\\nfunction neq(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() != y.unwrap();\\n}\\n\\n/// @notice Implements the NOT (~) bitwise operation in the UD60x18 type.\\nfunction not(UD60x18 x) pure returns (UD60x18 result) {\\n result = wrap(~x.unwrap());\\n}\\n\\n/// @notice Implements the OR (|) bitwise operation in the UD60x18 type.\\nfunction or(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() | y.unwrap());\\n}\\n\\n/// @notice Implements the right shift operation (>>) in the UD60x18 type.\\nfunction rshift(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() >> bits);\\n}\\n\\n/// @notice Implements the checked subtraction operation (-) in the UD60x18 type.\\nfunction sub(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() - y.unwrap());\\n}\\n\\n/// @notice Implements the unchecked addition operation (+) in the UD60x18 type.\\nfunction uncheckedAdd(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() + y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the unchecked subtraction operation (-) in the UD60x18 type.\\nfunction uncheckedSub(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() - y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the XOR (^) bitwise operation in the UD60x18 type.\\nfunction xor(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() ^ y.unwrap());\\n}\\n\",\"keccak256\":\"0xf5faff881391d2c060029499a666cc5f0bea90a213150bb476fae8f02a5df268\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as Errors;\\nimport { wrap } from \\\"./Casting.sol\\\";\\nimport {\\n uEXP_MAX_INPUT,\\n uEXP2_MAX_INPUT,\\n uHALF_UNIT,\\n uLOG2_10,\\n uLOG2_E,\\n uMAX_UD60x18,\\n uMAX_WHOLE_UD60x18,\\n UNIT,\\n uUNIT,\\n uUNIT_SQUARED,\\n ZERO\\n} from \\\"./Constants.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n MATHEMATICAL FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @notice Calculates the arithmetic average of x and y using the following formula:\\n///\\n/// $$\\n/// avg(x, y) = (x & y) + ((xUint ^ yUint) / 2)\\n/// $$\\n///\\n/// In English, this is what this formula does:\\n///\\n/// 1. AND x and y.\\n/// 2. Calculate half of XOR x and y.\\n/// 3. Add the two results together.\\n///\\n/// This technique is known as SWAR, which stands for \\\"SIMD within a register\\\". You can read more about it here:\\n/// https://devblogs.microsoft.com/oldnewthing/20220207-00/?p=106223\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// @param x The first operand as a UD60x18 number.\\n/// @param y The second operand as a UD60x18 number.\\n/// @return result The arithmetic average as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction avg(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n uint256 yUint = y.unwrap();\\n unchecked {\\n result = wrap((xUint & yUint) + ((xUint ^ yUint) >> 1));\\n }\\n}\\n\\n/// @notice Yields the smallest whole number greater than or equal to x.\\n///\\n/// @dev This is optimized for fractional value inputs, because for every whole value there are (1e18 - 1) fractional\\n/// counterparts. See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n///\\n/// Requirements:\\n/// - x must be less than or equal to `MAX_WHOLE_UD60x18`.\\n///\\n/// @param x The UD60x18 number to ceil.\\n/// @param result The smallest whole number greater than or equal to x, as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ceil(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n if (xUint > uMAX_WHOLE_UD60x18) {\\n revert Errors.PRBMath_UD60x18_Ceil_Overflow(x);\\n }\\n\\n assembly (\\\"memory-safe\\\") {\\n // Equivalent to `x % UNIT`.\\n let remainder := mod(x, uUNIT)\\n\\n // Equivalent to `UNIT - remainder`.\\n let delta := sub(uUNIT, remainder)\\n\\n // Equivalent to `x + remainder > 0 ? delta : 0`.\\n result := add(x, mul(delta, gt(remainder, 0)))\\n }\\n}\\n\\n/// @notice Divides two UD60x18 numbers, returning a new UD60x18 number.\\n///\\n/// @dev Uses {Common.mulDiv} to enable overflow-safe multiplication and division.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv}.\\n///\\n/// @param x The numerator as a UD60x18 number.\\n/// @param y The denominator as a UD60x18 number.\\n/// @param result The quotient as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction div(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(Common.mulDiv(x.unwrap(), uUNIT, y.unwrap()));\\n}\\n\\n/// @notice Calculates the natural exponent of x using the following formula:\\n///\\n/// $$\\n/// e^x = 2^{x * log_2{e}}\\n/// $$\\n///\\n/// @dev Requirements:\\n/// - x must be less than 133_084258667509499441.\\n///\\n/// @param x The exponent as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n // This check prevents values greater than 192e18 from being passed to {exp2}.\\n if (xUint > uEXP_MAX_INPUT) {\\n revert Errors.PRBMath_UD60x18_Exp_InputTooBig(x);\\n }\\n\\n unchecked {\\n // Inline the fixed-point multiplication to save gas.\\n uint256 doubleUnitProduct = xUint * uLOG2_E;\\n result = exp2(wrap(doubleUnitProduct / uUNIT));\\n }\\n}\\n\\n/// @notice Calculates the binary exponent of x using the binary fraction method.\\n///\\n/// @dev See https://ethereum.stackexchange.com/q/79903/24693\\n///\\n/// Requirements:\\n/// - x must be less than 192e18.\\n/// - The result must fit in UD60x18.\\n///\\n/// @param x The exponent as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp2(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n // Numbers greater than or equal to 192e18 don't fit in the 192.64-bit format.\\n if (xUint > uEXP2_MAX_INPUT) {\\n revert Errors.PRBMath_UD60x18_Exp2_InputTooBig(x);\\n }\\n\\n // Convert x to the 192.64-bit fixed-point format.\\n uint256 x_192x64 = (xUint << 64) / uUNIT;\\n\\n // Pass x to the {Common.exp2} function, which uses the 192.64-bit fixed-point number representation.\\n result = wrap(Common.exp2(x_192x64));\\n}\\n\\n/// @notice Yields the greatest whole number less than or equal to x.\\n/// @dev Optimized for fractional value inputs, because every whole value has (1e18 - 1) fractional counterparts.\\n/// See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n/// @param x The UD60x18 number to floor.\\n/// @param result The greatest whole number less than or equal to x, as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction floor(UD60x18 x) pure returns (UD60x18 result) {\\n assembly (\\\"memory-safe\\\") {\\n // Equivalent to `x % UNIT`.\\n let remainder := mod(x, uUNIT)\\n\\n // Equivalent to `x - remainder > 0 ? remainder : 0)`.\\n result := sub(x, mul(remainder, gt(remainder, 0)))\\n }\\n}\\n\\n/// @notice Yields the excess beyond the floor of x using the odd function definition.\\n/// @dev See https://en.wikipedia.org/wiki/Fractional_part.\\n/// @param x The UD60x18 number to get the fractional part of.\\n/// @param result The fractional part of x as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction frac(UD60x18 x) pure returns (UD60x18 result) {\\n assembly (\\\"memory-safe\\\") {\\n result := mod(x, uUNIT)\\n }\\n}\\n\\n/// @notice Calculates the geometric mean of x and y, i.e. $\\\\sqrt{x * y}$, rounding down.\\n///\\n/// @dev Requirements:\\n/// - x * y must fit in UD60x18.\\n///\\n/// @param x The first operand as a UD60x18 number.\\n/// @param y The second operand as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction gm(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n uint256 yUint = y.unwrap();\\n if (xUint == 0 || yUint == 0) {\\n return ZERO;\\n }\\n\\n unchecked {\\n // Checking for overflow this way is faster than letting Solidity do it.\\n uint256 xyUint = xUint * yUint;\\n if (xyUint / xUint != yUint) {\\n revert Errors.PRBMath_UD60x18_Gm_Overflow(x, y);\\n }\\n\\n // We don't need to multiply the result by `UNIT` here because the x*y product picked up a factor of `UNIT`\\n // during multiplication. See the comments in {Common.sqrt}.\\n result = wrap(Common.sqrt(xyUint));\\n }\\n}\\n\\n/// @notice Calculates the inverse of x.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x must not be zero.\\n///\\n/// @param x The UD60x18 number for which to calculate the inverse.\\n/// @return result The inverse as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction inv(UD60x18 x) pure returns (UD60x18 result) {\\n unchecked {\\n result = wrap(uUNIT_SQUARED / x.unwrap());\\n }\\n}\\n\\n/// @notice Calculates the natural logarithm of x using the following formula:\\n///\\n/// $$\\n/// ln{x} = log_2{x} / log_2{e}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n/// - The precision isn't sufficiently fine-grained to return exactly `UNIT` when the input is `E`.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The UD60x18 number for which to calculate the natural logarithm.\\n/// @return result The natural logarithm as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ln(UD60x18 x) pure returns (UD60x18 result) {\\n unchecked {\\n // Inline the fixed-point multiplication to save gas. This is overflow-safe because the maximum value that\\n // {log2} can return is ~196_205294292027477728.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_E);\\n }\\n}\\n\\n/// @notice Calculates the common logarithm of x using the following formula:\\n///\\n/// $$\\n/// log_{10}{x} = log_2{x} / log_2{10}\\n/// $$\\n///\\n/// However, if x is an exact power of ten, a hard coded value is returned.\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The UD60x18 number for which to calculate the common logarithm.\\n/// @return result The common logarithm as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log10(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n if (xUint < uUNIT) {\\n revert Errors.PRBMath_UD60x18_Log_InputTooSmall(x);\\n }\\n\\n // Note that the `mul` in this assembly block is the standard multiplication operation, not {UD60x18.mul}.\\n // prettier-ignore\\n assembly (\\\"memory-safe\\\") {\\n switch x\\n case 1 { result := mul(uUNIT, sub(0, 18)) }\\n case 10 { result := mul(uUNIT, sub(1, 18)) }\\n case 100 { result := mul(uUNIT, sub(2, 18)) }\\n case 1000 { result := mul(uUNIT, sub(3, 18)) }\\n case 10000 { result := mul(uUNIT, sub(4, 18)) }\\n case 100000 { result := mul(uUNIT, sub(5, 18)) }\\n case 1000000 { result := mul(uUNIT, sub(6, 18)) }\\n case 10000000 { result := mul(uUNIT, sub(7, 18)) }\\n case 100000000 { result := mul(uUNIT, sub(8, 18)) }\\n case 1000000000 { result := mul(uUNIT, sub(9, 18)) }\\n case 10000000000 { result := mul(uUNIT, sub(10, 18)) }\\n case 100000000000 { result := mul(uUNIT, sub(11, 18)) }\\n case 1000000000000 { result := mul(uUNIT, sub(12, 18)) }\\n case 10000000000000 { result := mul(uUNIT, sub(13, 18)) }\\n case 100000000000000 { result := mul(uUNIT, sub(14, 18)) }\\n case 1000000000000000 { result := mul(uUNIT, sub(15, 18)) }\\n case 10000000000000000 { result := mul(uUNIT, sub(16, 18)) }\\n case 100000000000000000 { result := mul(uUNIT, sub(17, 18)) }\\n case 1000000000000000000 { result := 0 }\\n case 10000000000000000000 { result := uUNIT }\\n case 100000000000000000000 { result := mul(uUNIT, 2) }\\n case 1000000000000000000000 { result := mul(uUNIT, 3) }\\n case 10000000000000000000000 { result := mul(uUNIT, 4) }\\n case 100000000000000000000000 { result := mul(uUNIT, 5) }\\n case 1000000000000000000000000 { result := mul(uUNIT, 6) }\\n case 10000000000000000000000000 { result := mul(uUNIT, 7) }\\n case 100000000000000000000000000 { result := mul(uUNIT, 8) }\\n case 1000000000000000000000000000 { result := mul(uUNIT, 9) }\\n case 10000000000000000000000000000 { result := mul(uUNIT, 10) }\\n case 100000000000000000000000000000 { result := mul(uUNIT, 11) }\\n case 1000000000000000000000000000000 { result := mul(uUNIT, 12) }\\n case 10000000000000000000000000000000 { result := mul(uUNIT, 13) }\\n case 100000000000000000000000000000000 { result := mul(uUNIT, 14) }\\n case 1000000000000000000000000000000000 { result := mul(uUNIT, 15) }\\n case 10000000000000000000000000000000000 { result := mul(uUNIT, 16) }\\n case 100000000000000000000000000000000000 { result := mul(uUNIT, 17) }\\n case 1000000000000000000000000000000000000 { result := mul(uUNIT, 18) }\\n case 10000000000000000000000000000000000000 { result := mul(uUNIT, 19) }\\n case 100000000000000000000000000000000000000 { result := mul(uUNIT, 20) }\\n case 1000000000000000000000000000000000000000 { result := mul(uUNIT, 21) }\\n case 10000000000000000000000000000000000000000 { result := mul(uUNIT, 22) }\\n case 100000000000000000000000000000000000000000 { result := mul(uUNIT, 23) }\\n case 1000000000000000000000000000000000000000000 { result := mul(uUNIT, 24) }\\n case 10000000000000000000000000000000000000000000 { result := mul(uUNIT, 25) }\\n case 100000000000000000000000000000000000000000000 { result := mul(uUNIT, 26) }\\n case 1000000000000000000000000000000000000000000000 { result := mul(uUNIT, 27) }\\n case 10000000000000000000000000000000000000000000000 { result := mul(uUNIT, 28) }\\n case 100000000000000000000000000000000000000000000000 { result := mul(uUNIT, 29) }\\n case 1000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 30) }\\n case 10000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 31) }\\n case 100000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 32) }\\n case 1000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 33) }\\n case 10000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 34) }\\n case 100000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 35) }\\n case 1000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 36) }\\n case 10000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 37) }\\n case 100000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 38) }\\n case 1000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 39) }\\n case 10000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 40) }\\n case 100000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 41) }\\n case 1000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 42) }\\n case 10000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 43) }\\n case 100000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 44) }\\n case 1000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 45) }\\n case 10000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 46) }\\n case 100000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 47) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 48) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 49) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 50) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 51) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 52) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 53) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 54) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 55) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 56) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 57) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 58) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 59) }\\n default { result := uMAX_UD60x18 }\\n }\\n\\n if (result.unwrap() == uMAX_UD60x18) {\\n unchecked {\\n // Inline the fixed-point division to save gas.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_10);\\n }\\n }\\n}\\n\\n/// @notice Calculates the binary logarithm of x using the iterative approximation algorithm:\\n///\\n/// $$\\n/// log_2{x} = n + log_2{y}, \\\\text{ where } y = x*2^{-n}, \\\\ y \\\\in [1, 2)\\n/// $$\\n///\\n/// For $0 \\\\leq x \\\\lt 1$, the input is inverted:\\n///\\n/// $$\\n/// log_2{x} = -log_2{\\\\frac{1}{x}}\\n/// $$\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Binary_logarithm#Iterative_approximation\\n///\\n/// Notes:\\n/// - Due to the lossy precision of the iterative approximation, the results are not perfectly accurate to the last decimal.\\n///\\n/// Requirements:\\n/// - x must be greater than zero.\\n///\\n/// @param x The UD60x18 number for which to calculate the binary logarithm.\\n/// @return result The binary logarithm as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log2(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n if (xUint < uUNIT) {\\n revert Errors.PRBMath_UD60x18_Log_InputTooSmall(x);\\n }\\n\\n unchecked {\\n // Calculate the integer part of the logarithm.\\n uint256 n = Common.msb(xUint / uUNIT);\\n\\n // This is the integer part of the logarithm as a UD60x18 number. The operation can't overflow because n\\n // n is at most 255 and UNIT is 1e18.\\n uint256 resultUint = n * uUNIT;\\n\\n // Calculate $y = x * 2^{-n}$.\\n uint256 y = xUint >> n;\\n\\n // If y is the unit number, the fractional part is zero.\\n if (y == uUNIT) {\\n return wrap(resultUint);\\n }\\n\\n // Calculate the fractional part via the iterative approximation.\\n // The `delta >>= 1` part is equivalent to `delta /= 2`, but shifting bits is more gas efficient.\\n uint256 DOUBLE_UNIT = 2e18;\\n for (uint256 delta = uHALF_UNIT; delta > 0; delta >>= 1) {\\n y = (y * y) / uUNIT;\\n\\n // Is y^2 >= 2e18 and so in the range [2e18, 4e18)?\\n if (y >= DOUBLE_UNIT) {\\n // Add the 2^{-m} factor to the logarithm.\\n resultUint += delta;\\n\\n // Halve y, which corresponds to z/2 in the Wikipedia article.\\n y >>= 1;\\n }\\n }\\n result = wrap(resultUint);\\n }\\n}\\n\\n/// @notice Multiplies two UD60x18 numbers together, returning a new UD60x18 number.\\n///\\n/// @dev Uses {Common.mulDiv} to enable overflow-safe multiplication and division.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv}.\\n///\\n/// @dev See the documentation in {Common.mulDiv18}.\\n/// @param x The multiplicand as a UD60x18 number.\\n/// @param y The multiplier as a UD60x18 number.\\n/// @return result The product as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mul(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(Common.mulDiv18(x.unwrap(), y.unwrap()));\\n}\\n\\n/// @notice Raises x to the power of y.\\n///\\n/// For $1 \\\\leq x \\\\leq \\\\infty$, the following standard formula is used:\\n///\\n/// $$\\n/// x^y = 2^{log_2{x} * y}\\n/// $$\\n///\\n/// For $0 \\\\leq x \\\\lt 1$, since the unsigned {log2} is undefined, an equivalent formula is used:\\n///\\n/// $$\\n/// i = \\\\frac{1}{x}\\n/// w = 2^{log_2{i} * y}\\n/// x^y = \\\\frac{1}{w}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2} and {mul}.\\n/// - Returns `UNIT` for 0^0.\\n/// - It may not perform well with very small values of x. Consider using SD59x18 as an alternative.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {exp2}, {log2}, and {mul}.\\n///\\n/// @param x The base as a UD60x18 number.\\n/// @param y The exponent as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction pow(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n uint256 yUint = y.unwrap();\\n\\n // If both x and y are zero, the result is `UNIT`. If just x is zero, the result is always zero.\\n if (xUint == 0) {\\n return yUint == 0 ? UNIT : ZERO;\\n }\\n // If x is `UNIT`, the result is always `UNIT`.\\n else if (xUint == uUNIT) {\\n return UNIT;\\n }\\n\\n // If y is zero, the result is always `UNIT`.\\n if (yUint == 0) {\\n return UNIT;\\n }\\n // If y is `UNIT`, the result is always x.\\n else if (yUint == uUNIT) {\\n return x;\\n }\\n\\n // If x is greater than `UNIT`, use the standard formula.\\n if (xUint > uUNIT) {\\n result = exp2(mul(log2(x), y));\\n }\\n // Conversely, if x is less than `UNIT`, use the equivalent formula.\\n else {\\n UD60x18 i = wrap(uUNIT_SQUARED / xUint);\\n UD60x18 w = exp2(mul(log2(i), y));\\n result = wrap(uUNIT_SQUARED / w.unwrap());\\n }\\n}\\n\\n/// @notice Raises x (a UD60x18 number) to the power y (an unsigned basic integer) using the well-known\\n/// algorithm \\\"exponentiation by squaring\\\".\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Exponentiation_by_squaring.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv18}.\\n/// - Returns `UNIT` for 0^0.\\n///\\n/// Requirements:\\n/// - The result must fit in UD60x18.\\n///\\n/// @param x The base as a UD60x18 number.\\n/// @param y The exponent as a uint256.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction powu(UD60x18 x, uint256 y) pure returns (UD60x18 result) {\\n // Calculate the first iteration of the loop in advance.\\n uint256 xUint = x.unwrap();\\n uint256 resultUint = y & 1 > 0 ? xUint : uUNIT;\\n\\n // Equivalent to `for(y /= 2; y > 0; y /= 2)`.\\n for (y >>= 1; y > 0; y >>= 1) {\\n xUint = Common.mulDiv18(xUint, xUint);\\n\\n // Equivalent to `y % 2 == 1`.\\n if (y & 1 > 0) {\\n resultUint = Common.mulDiv18(resultUint, xUint);\\n }\\n }\\n result = wrap(resultUint);\\n}\\n\\n/// @notice Calculates the square root of x using the Babylonian method.\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\\n///\\n/// Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x must be less than `MAX_UD60x18 / UNIT`.\\n///\\n/// @param x The UD60x18 number for which to calculate the square root.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction sqrt(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n unchecked {\\n if (xUint > uMAX_UD60x18 / uUNIT) {\\n revert Errors.PRBMath_UD60x18_Sqrt_Overflow(x);\\n }\\n // Multiply x by `UNIT` to account for the factor of `UNIT` picked up when multiplying two UD60x18 numbers.\\n // In this case, the two numbers are both the square root.\\n result = wrap(Common.sqrt(xUint * uUNIT));\\n }\\n}\\n\",\"keccak256\":\"0x462144667aac3f96d5f8dba7aa68fe4c5a3f61e1d7bbbc81bee21168817f9c09\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\nimport \\\"./Helpers.sol\\\" as Helpers;\\nimport \\\"./Math.sol\\\" as Math;\\n\\n/// @notice The unsigned 60.18-decimal fixed-point number representation, which can have up to 60 digits and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the Solidity type uint256.\\n/// @dev The value type is defined here so it can be imported in all other files.\\ntype UD60x18 is uint256;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoSD1x18,\\n Casting.intoUD2x18,\\n Casting.intoSD59x18,\\n Casting.intoUint128,\\n Casting.intoUint256,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for UD60x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n MATHEMATICAL FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes the functions in this library callable on the UD60x18 type.\\nusing {\\n Math.avg,\\n Math.ceil,\\n Math.div,\\n Math.exp,\\n Math.exp2,\\n Math.floor,\\n Math.frac,\\n Math.gm,\\n Math.inv,\\n Math.ln,\\n Math.log10,\\n Math.log2,\\n Math.mul,\\n Math.pow,\\n Math.powu,\\n Math.sqrt\\n} for UD60x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n HELPER FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes the functions in this library callable on the UD60x18 type.\\nusing {\\n Helpers.add,\\n Helpers.and,\\n Helpers.eq,\\n Helpers.gt,\\n Helpers.gte,\\n Helpers.isZero,\\n Helpers.lshift,\\n Helpers.lt,\\n Helpers.lte,\\n Helpers.mod,\\n Helpers.neq,\\n Helpers.not,\\n Helpers.or,\\n Helpers.rshift,\\n Helpers.sub,\\n Helpers.uncheckedAdd,\\n Helpers.uncheckedSub,\\n Helpers.xor\\n} for UD60x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n OPERATORS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes it possible to use these operators on the UD60x18 type.\\nusing {\\n Helpers.add as +,\\n Helpers.and2 as &,\\n Math.div as /,\\n Helpers.eq as ==,\\n Helpers.gt as >,\\n Helpers.gte as >=,\\n Helpers.lt as <,\\n Helpers.lte as <=,\\n Helpers.or as |,\\n Helpers.mod as %,\\n Math.mul as *,\\n Helpers.neq as !=,\\n Helpers.not as ~,\\n Helpers.sub as -,\\n Helpers.xor as ^\\n} for UD60x18 global;\\n\",\"keccak256\":\"0xdd873b5124180d9b71498b3a7fe93b1c08c368bec741f7d5f8e17f78a0b70f31\",\"license\":\"MIT\"},\"contracts/interfaces/IERC6551Registry.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\ninterface IERC6551Registry {\\n /**\\n * @dev Creates a token bound account for a non-fungible token.\\n *\\n * If account has already been created, returns the account address without calling create2.\\n *\\n * Emits ERC6551AccountCreated event.\\n *\\n * @return account The address of the token bound account\\n */\\n function createAccount(\\n address implementation,\\n bytes32 salt,\\n uint256 chainId,\\n address tokenContract,\\n uint256 tokenId\\n ) external returns (address account);\\n}\\n\",\"keccak256\":\"0x64c52de8a8e68398e61dd8b42dda8e9af8cf6abf93bb85629c322440991ea568\",\"license\":\"MIT\"},\"contracts/interfaces/hats/HatsErrors.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface HatsErrors {\\n /// @notice Emitted when `user` is attempting to perform an action on `hatId` but is not wearing one of `hatId`'s admin hats\\n /// @dev Can be equivalent to `NotHatWearer(buildHatId(hatId))`, such as when emitted by `approveLinkTopHatToTree` or `relinkTopHatToTree`\\n error NotAdmin(address user, uint256 hatId);\\n\\n /// @notice Emitted when attempting to perform an action as or for an account that is not a wearer of a given hat\\n error NotHatWearer();\\n\\n /// @notice Emitted when attempting to perform an action that requires being either an admin or wearer of a given hat\\n error NotAdminOrWearer();\\n\\n /// @notice Emitted when attempting to mint `hatId` but `hatId`'s maxSupply has been reached\\n error AllHatsWorn(uint256 hatId);\\n\\n /// @notice Emitted when attempting to create a hat with a level 14 hat as its admin\\n error MaxLevelsReached();\\n\\n /// @notice Emitted when an attempted hat id has empty intermediate level(s)\\n error InvalidHatId();\\n\\n /// @notice Emitted when attempting to mint `hatId` to a `wearer` who is already wearing the hat\\n error AlreadyWearingHat(address wearer, uint256 hatId);\\n\\n /// @notice Emitted when attempting to mint a non-existant hat\\n error HatDoesNotExist(uint256 hatId);\\n\\n /// @notice Emmitted when attempting to mint or transfer a hat that is not active\\n error HatNotActive();\\n\\n /// @notice Emitted when attempting to mint or transfer a hat to an ineligible wearer\\n error NotEligible();\\n\\n /// @notice Emitted when attempting to check or set a hat's status from an account that is not that hat's toggle module\\n error NotHatsToggle();\\n\\n /// @notice Emitted when attempting to check or set a hat wearer's status from an account that is not that hat's eligibility module\\n error NotHatsEligibility();\\n\\n /// @notice Emitted when array arguments to a batch function have mismatching lengths\\n error BatchArrayLengthMismatch();\\n\\n /// @notice Emitted when attempting to mutate or transfer an immutable hat\\n error Immutable();\\n\\n /// @notice Emitted when attempting to change a hat's maxSupply to a value lower than its current supply\\n error NewMaxSupplyTooLow();\\n\\n /// @notice Emitted when attempting to link a tophat to a new admin for which the tophat serves as an admin\\n error CircularLinkage();\\n\\n /// @notice Emitted when attempting to link or relink a tophat to a separate tree\\n error CrossTreeLinkage();\\n\\n /// @notice Emitted when attempting to link a tophat without a request\\n error LinkageNotRequested();\\n\\n /// @notice Emitted when attempting to unlink a tophat that does not have a wearer\\n /// @dev This ensures that unlinking never results in a bricked tophat\\n error InvalidUnlink();\\n\\n /// @notice Emmited when attempting to change a hat's eligibility or toggle module to the zero address\\n error ZeroAddress();\\n\\n /// @notice Emmitted when attempting to change a hat's details or imageURI to a string with over 7000 bytes (~characters)\\n /// @dev This protects against a DOS attack where an admin iteratively extend's a hat's details or imageURI\\n /// to be so long that reading it exceeds the block gas limit, breaking `uri()` and `viewHat()`\\n error StringTooLong();\\n}\\n\",\"keccak256\":\"0x81b0056b7bed86eabc07c0e4a9655c586ddb8e6c128320593669b76efd5a08de\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/HatsEvents.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface HatsEvents {\\n /// @notice Emitted when a new hat is created\\n /// @param id The id for the new hat\\n /// @param details A description of the Hat\\n /// @param maxSupply The total instances of the Hat that can be worn at once\\n /// @param eligibility The address that can report on the Hat wearer's status\\n /// @param toggle The address that can deactivate the Hat\\n /// @param mutable_ Whether the hat's properties are changeable after creation\\n /// @param imageURI The image uri for this hat and the fallback for its\\n event HatCreated(\\n uint256 id,\\n string details,\\n uint32 maxSupply,\\n address eligibility,\\n address toggle,\\n bool mutable_,\\n string imageURI\\n );\\n\\n /// @notice Emitted when a hat wearer's standing is updated\\n /// @dev Eligibility is excluded since the source of truth for eligibility is the eligibility module and may change without a transaction\\n /// @param hatId The id of the wearer's hat\\n /// @param wearer The wearer's address\\n /// @param wearerStanding Whether the wearer is in good standing for the hat\\n event WearerStandingChanged(\\n uint256 hatId,\\n address wearer,\\n bool wearerStanding\\n );\\n\\n /// @notice Emitted when a hat's status is updated\\n /// @param hatId The id of the hat\\n /// @param newStatus Whether the hat is active\\n event HatStatusChanged(uint256 hatId, bool newStatus);\\n\\n /// @notice Emitted when a hat's details are updated\\n /// @param hatId The id of the hat\\n /// @param newDetails The updated details\\n event HatDetailsChanged(uint256 hatId, string newDetails);\\n\\n /// @notice Emitted when a hat's eligibility module is updated\\n /// @param hatId The id of the hat\\n /// @param newEligibility The updated eligibiliy module\\n event HatEligibilityChanged(uint256 hatId, address newEligibility);\\n\\n /// @notice Emitted when a hat's toggle module is updated\\n /// @param hatId The id of the hat\\n /// @param newToggle The updated toggle module\\n event HatToggleChanged(uint256 hatId, address newToggle);\\n\\n /// @notice Emitted when a hat's mutability is updated\\n /// @param hatId The id of the hat\\n event HatMutabilityChanged(uint256 hatId);\\n\\n /// @notice Emitted when a hat's maximum supply is updated\\n /// @param hatId The id of the hat\\n /// @param newMaxSupply The updated max supply\\n event HatMaxSupplyChanged(uint256 hatId, uint32 newMaxSupply);\\n\\n /// @notice Emitted when a hat's image URI is updated\\n /// @param hatId The id of the hat\\n /// @param newImageURI The updated image URI\\n event HatImageURIChanged(uint256 hatId, string newImageURI);\\n\\n /// @notice Emitted when a tophat linkage is requested by its admin\\n /// @param domain The domain of the tree tophat to link\\n /// @param newAdmin The tophat's would-be admin in the parent tree\\n event TopHatLinkRequested(uint32 domain, uint256 newAdmin);\\n\\n /// @notice Emitted when a tophat is linked to a another tree\\n /// @param domain The domain of the newly-linked tophat\\n /// @param newAdmin The tophat's new admin in the parent tree\\n event TopHatLinked(uint32 domain, uint256 newAdmin);\\n}\\n\",\"keccak256\":\"0x53413397d15e1636c3cd7bd667656b79bc2886785403b824bcd4ed122667f2c6\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/IHats.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\nimport \\\"./IHatsIdUtilities.sol\\\";\\nimport \\\"./HatsErrors.sol\\\";\\nimport \\\"./HatsEvents.sol\\\";\\n\\ninterface IHats is IHatsIdUtilities, HatsErrors, HatsEvents {\\n function mintTopHat(\\n address _target,\\n string memory _details,\\n string memory _imageURI\\n ) external returns (uint256 topHatId);\\n\\n function createHat(\\n uint256 _admin,\\n string calldata _details,\\n uint32 _maxSupply,\\n address _eligibility,\\n address _toggle,\\n bool _mutable,\\n string calldata _imageURI\\n ) external returns (uint256 newHatId);\\n\\n function batchCreateHats(\\n uint256[] calldata _admins,\\n string[] calldata _details,\\n uint32[] calldata _maxSupplies,\\n address[] memory _eligibilityModules,\\n address[] memory _toggleModules,\\n bool[] calldata _mutables,\\n string[] calldata _imageURIs\\n ) external returns (bool success);\\n\\n function getNextId(uint256 _admin) external view returns (uint256 nextId);\\n\\n function mintHat(\\n uint256 _hatId,\\n address _wearer\\n ) external returns (bool success);\\n\\n function batchMintHats(\\n uint256[] calldata _hatIds,\\n address[] calldata _wearers\\n ) external returns (bool success);\\n\\n function setHatStatus(\\n uint256 _hatId,\\n bool _newStatus\\n ) external returns (bool toggled);\\n\\n function checkHatStatus(uint256 _hatId) external returns (bool toggled);\\n\\n function setHatWearerStatus(\\n uint256 _hatId,\\n address _wearer,\\n bool _eligible,\\n bool _standing\\n ) external returns (bool updated);\\n\\n function checkHatWearerStatus(\\n uint256 _hatId,\\n address _wearer\\n ) external returns (bool updated);\\n\\n function renounceHat(uint256 _hatId) external;\\n\\n function transferHat(uint256 _hatId, address _from, address _to) external;\\n\\n /*//////////////////////////////////////////////////////////////\\n HATS ADMIN FUNCTIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n function makeHatImmutable(uint256 _hatId) external;\\n\\n function changeHatDetails(\\n uint256 _hatId,\\n string memory _newDetails\\n ) external;\\n\\n function changeHatEligibility(\\n uint256 _hatId,\\n address _newEligibility\\n ) external;\\n\\n function changeHatToggle(uint256 _hatId, address _newToggle) external;\\n\\n function changeHatImageURI(\\n uint256 _hatId,\\n string memory _newImageURI\\n ) external;\\n\\n function changeHatMaxSupply(uint256 _hatId, uint32 _newMaxSupply) external;\\n\\n function requestLinkTopHatToTree(\\n uint32 _topHatId,\\n uint256 _newAdminHat\\n ) external;\\n\\n function approveLinkTopHatToTree(\\n uint32 _topHatId,\\n uint256 _newAdminHat,\\n address _eligibility,\\n address _toggle,\\n string calldata _details,\\n string calldata _imageURI\\n ) external;\\n\\n function unlinkTopHatFromTree(uint32 _topHatId, address _wearer) external;\\n\\n function relinkTopHatWithinTree(\\n uint32 _topHatDomain,\\n uint256 _newAdminHat,\\n address _eligibility,\\n address _toggle,\\n string calldata _details,\\n string calldata _imageURI\\n ) external;\\n\\n /*//////////////////////////////////////////////////////////////\\n VIEW FUNCTIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n function viewHat(\\n uint256 _hatId\\n )\\n external\\n view\\n returns (\\n string memory details,\\n uint32 maxSupply,\\n uint32 supply,\\n address eligibility,\\n address toggle,\\n string memory imageURI,\\n uint16 lastHatId,\\n bool mutable_,\\n bool active\\n );\\n\\n function isWearerOfHat(\\n address _user,\\n uint256 _hatId\\n ) external view returns (bool isWearer);\\n\\n function isAdminOfHat(\\n address _user,\\n uint256 _hatId\\n ) external view returns (bool isAdmin);\\n\\n function isInGoodStanding(\\n address _wearer,\\n uint256 _hatId\\n ) external view returns (bool standing);\\n\\n function isEligible(\\n address _wearer,\\n uint256 _hatId\\n ) external view returns (bool eligible);\\n\\n function getHatEligibilityModule(\\n uint256 _hatId\\n ) external view returns (address eligibility);\\n\\n function getHatToggleModule(\\n uint256 _hatId\\n ) external view returns (address toggle);\\n\\n function getHatMaxSupply(\\n uint256 _hatId\\n ) external view returns (uint32 maxSupply);\\n\\n function hatSupply(uint256 _hatId) external view returns (uint32 supply);\\n\\n function getImageURIForHat(\\n uint256 _hatId\\n ) external view returns (string memory _uri);\\n\\n function balanceOf(\\n address wearer,\\n uint256 hatId\\n ) external view returns (uint256 balance);\\n\\n function balanceOfBatch(\\n address[] calldata _wearers,\\n uint256[] calldata _hatIds\\n ) external view returns (uint256[] memory);\\n\\n function uri(uint256 id) external view returns (string memory _uri);\\n}\\n\",\"keccak256\":\"0x2867004bddc5148fa1937f25c0403e5d9977583aaf50fdbdb74bd463f64f21c8\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/IHatsIdUtilities.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface IHatsIdUtilities {\\n function buildHatId(\\n uint256 _admin,\\n uint16 _newHat\\n ) external pure returns (uint256 id);\\n\\n function getHatLevel(uint256 _hatId) external view returns (uint32 level);\\n\\n function getLocalHatLevel(\\n uint256 _hatId\\n ) external pure returns (uint32 level);\\n\\n function isTopHat(uint256 _hatId) external view returns (bool _topHat);\\n\\n function isLocalTopHat(\\n uint256 _hatId\\n ) external pure returns (bool _localTopHat);\\n\\n function isValidHatId(\\n uint256 _hatId\\n ) external view returns (bool validHatId);\\n\\n function getAdminAtLevel(\\n uint256 _hatId,\\n uint32 _level\\n ) external view returns (uint256 admin);\\n\\n function getAdminAtLocalLevel(\\n uint256 _hatId,\\n uint32 _level\\n ) external pure returns (uint256 admin);\\n\\n function getTopHatDomain(\\n uint256 _hatId\\n ) external view returns (uint32 domain);\\n\\n function getTippyTopHatDomain(\\n uint32 _topHatDomain\\n ) external view returns (uint32 domain);\\n\\n function noCircularLinkage(\\n uint32 _topHatDomain,\\n uint256 _linkedAdmin\\n ) external view returns (bool notCircular);\\n\\n function sameTippyTopHatDomain(\\n uint32 _topHatDomain,\\n uint256 _newAdminHat\\n ) external view returns (bool sameDomain);\\n}\\n\",\"keccak256\":\"0x007fcc07b20bf84bacad1f9a2ddf4e30e1a8be961e144b7bef8e98a51781aee9\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/IHatsModuleFactory.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.19;\\n\\ninterface IHatsModuleFactory {\\n error HatsModuleFactory_ModuleAlreadyDeployed(\\n address implementation,\\n uint256 hatId,\\n bytes otherImmutableArgs,\\n uint256 saltNonce\\n );\\n\\n error BatchArrayLengthMismatch();\\n\\n event HatsModuleFactory_ModuleDeployed(\\n address implementation,\\n address instance,\\n uint256 hatId,\\n bytes otherImmutableArgs,\\n bytes initData,\\n uint256 saltNonce\\n );\\n\\n function HATS() external view returns (address);\\n\\n function version() external view returns (string memory);\\n\\n function createHatsModule(\\n address _implementation,\\n uint256 _hatId,\\n bytes calldata _otherImmutableArgs,\\n bytes calldata _initData,\\n uint256 _saltNonce\\n ) external returns (address _instance);\\n\\n function batchCreateHatsModule(\\n address[] calldata _implementations,\\n uint256[] calldata _hatIds,\\n bytes[] calldata _otherImmutableArgsArray,\\n bytes[] calldata _initDataArray,\\n uint256[] calldata _saltNonces\\n ) external returns (bool success);\\n\\n function getHatsModuleAddress(\\n address _implementation,\\n uint256 _hatId,\\n bytes calldata _otherImmutableArgs,\\n uint256 _saltNonce\\n ) external view returns (address);\\n\\n function deployed(\\n address _implementation,\\n uint256 _hatId,\\n bytes calldata _otherImmutableArgs,\\n uint256 _saltNonce\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x861faf40785cedb829243116d492653414a367853408a5c27d201522f6c3bfdd\",\"license\":\"MIT\"},\"contracts/interfaces/hats/modules/IHatsElectionsEligibility.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.13;\\n\\ninterface IHatsElectionsEligibility {\\n event ElectionOpened(uint128 nextTermEnd);\\n event ElectionCompleted(uint128 termEnd, address[] winners);\\n event NewTermStarted(uint128 termEnd);\\n event Recalled(uint128 termEnd, address[] accounts);\\n\\n /// @notice Returns the first second after the current term ends.\\n /// @dev Also serves as the id for the current term.\\n function currentTermEnd() external view returns (uint128);\\n\\n /// @notice Returns the first second after the next term ends.\\n /// @dev Also serves as the id for the next term.\\n function nextTermEnd() external view returns (uint128);\\n\\n /// @notice Returns the election status (open or closed) for a given term end.\\n /// @param termEnd The term end timestamp to query.\\n function electionStatus(\\n uint128 termEnd\\n ) external view returns (bool isElectionOpen);\\n\\n /// @notice Returns whether a candidate was elected in a given term.\\n /// @param termEnd The term end timestamp to query.\\n /// @param candidate The address of the candidate.\\n function electionResults(\\n uint128 termEnd,\\n address candidate\\n ) external view returns (bool elected);\\n\\n /// @notice Returns the BALLOT_BOX_HAT constant.\\n function BALLOT_BOX_HAT() external pure returns (uint256);\\n\\n /// @notice Returns the ADMIN_HAT constant.\\n function ADMIN_HAT() external pure returns (uint256);\\n\\n /**\\n * @notice Submit the results of an election for a specified term.\\n * @dev Only callable by the wearer(s) of the BALLOT_BOX_HAT.\\n * @param _termEnd The id of the term for which the election results are being submitted.\\n * @param _winners The addresses of the winners of the election.\\n */\\n function elect(uint128 _termEnd, address[] calldata _winners) external;\\n\\n /**\\n * @notice Submit the results of a recall election for a specified term.\\n * @dev Only callable by the wearer(s) of the BALLOT_BOX_HAT.\\n * @param _termEnd The id of the term for which the recall results are being submitted.\\n * @param _recallees The addresses to be recalled.\\n */\\n function recall(uint128 _termEnd, address[] calldata _recallees) external;\\n\\n /**\\n * @notice Set the next term and open the election for it.\\n * @dev Only callable by the wearer(s) of the ADMIN_HAT.\\n * @param _newTermEnd The id of the term that will be opened.\\n */\\n function setNextTerm(uint128 _newTermEnd) external;\\n\\n /**\\n * @notice Start the next term, updating the current term.\\n * @dev Can be called by anyone, but will revert if conditions are not met.\\n */\\n function startNextTerm() external;\\n\\n /**\\n * @notice Determine the eligibility and standing of a wearer for a hat.\\n * @param _wearer The address of the hat wearer.\\n * @param _hatId The ID of the hat.\\n * @return eligible True if the wearer is eligible for the hat.\\n * @return standing True if the wearer is in good standing.\\n */\\n function getWearerStatus(\\n address _wearer,\\n uint256 _hatId\\n ) external view returns (bool eligible, bool standing);\\n}\\n\",\"keccak256\":\"0x74dfc5d538d866ddb8ee2ca1b569abf62e02d848c59f308adf6075ecff175c7d\",\"license\":\"MIT\"},\"contracts/interfaces/sablier/IAdminable.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\n/// @title IAdminable\\n/// @notice Contract module that provides a basic access control mechanism, with an admin that can be\\n/// granted exclusive access to specific functions. The inheriting contract must set the initial admin\\n/// in the constructor.\\ninterface IAdminable {\\n /*//////////////////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Emitted when the admin is transferred.\\n /// @param oldAdmin The address of the old admin.\\n /// @param newAdmin The address of the new admin.\\n event TransferAdmin(address indexed oldAdmin, address indexed newAdmin);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice The address of the admin account or contract.\\n function admin() external view returns (address);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n NON-CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Transfers the contract admin to a new address.\\n ///\\n /// @dev Notes:\\n /// - Does not revert if the admin is the same.\\n /// - This function can potentially leave the contract without an admin, thereby removing any\\n /// functionality that is only available to the admin.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the contract admin.\\n ///\\n /// @param newAdmin The address of the new admin.\\n function transferAdmin(address newAdmin) external;\\n}\\n\",\"keccak256\":\"0xa279c49e51228b571329164e36250e82b2c1378e8b549194ab7dd90fca9c3b2b\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/IERC4096.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 \\\"@openzeppelin/contracts/interfaces/IERC165.sol\\\";\\nimport {IERC721} from \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\n\\n/// @title ERC-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\",\"keccak256\":\"0xa34b9c52cbe36be860244f52256f1b05badf0cb797d208664b87337610d0e82d\",\"license\":\"MIT\"},\"contracts/interfaces/sablier/ISablierV2Lockup.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC4906} from \\\"./IERC4096.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IERC721Metadata} from \\\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\\\";\\nimport {UD60x18} from \\\"@prb/math/src/UD60x18.sol\\\";\\n\\nimport {Lockup} from \\\"./types/DataTypes.sol\\\";\\nimport {IAdminable} from \\\"./IAdminable.sol\\\";\\nimport {ISablierV2NFTDescriptor} from \\\"./ISablierV2NFTDescriptor.sol\\\";\\n\\n/// @title ISablierV2Lockup\\n/// @notice Common logic between all Sablier V2 Lockup contracts.\\ninterface ISablierV2Lockup is\\n IAdminable, // 0 inherited components\\n IERC4906, // 2 inherited components\\n IERC721Metadata // 2 inherited components\\n{\\n /*//////////////////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Emitted when the admin allows a new recipient contract to hook to Sablier.\\n /// @param admin The address of the current contract admin.\\n /// @param recipient The address of the recipient contract put on the allowlist.\\n event AllowToHook(address indexed admin, address recipient);\\n\\n /// @notice Emitted when a stream is canceled.\\n /// @param streamId The ID of the stream.\\n /// @param sender The address of the stream's sender.\\n /// @param recipient The address of the stream's recipient.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param senderAmount The amount of assets refunded to the stream's sender, denoted in units of the asset's\\n /// decimals.\\n /// @param recipientAmount The amount of assets left for the stream's recipient to withdraw, denoted in units of the\\n /// asset's decimals.\\n event CancelLockupStream(\\n uint256 streamId,\\n address indexed sender,\\n address indexed recipient,\\n IERC20 indexed asset,\\n uint128 senderAmount,\\n uint128 recipientAmount\\n );\\n\\n /// @notice Emitted when a sender gives up the right to cancel a stream.\\n /// @param streamId The ID of the stream.\\n event RenounceLockupStream(uint256 indexed streamId);\\n\\n /// @notice Emitted when the admin sets a new NFT descriptor contract.\\n /// @param admin The address of the current contract admin.\\n /// @param oldNFTDescriptor The address of the old NFT descriptor contract.\\n /// @param newNFTDescriptor The address of the new NFT descriptor contract.\\n event SetNFTDescriptor(\\n address indexed admin,\\n ISablierV2NFTDescriptor oldNFTDescriptor,\\n ISablierV2NFTDescriptor newNFTDescriptor\\n );\\n\\n /// @notice Emitted when assets are withdrawn from a stream.\\n /// @param streamId The ID of the stream.\\n /// @param to The address that has received the withdrawn assets.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param amount The amount of assets withdrawn, denoted in units of the asset's decimals.\\n event WithdrawFromLockupStream(\\n uint256 indexed streamId,\\n address indexed to,\\n IERC20 indexed asset,\\n uint128 amount\\n );\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Retrieves the address of the ERC-20 asset to be distributed.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getAsset(uint256 streamId) external view returns (IERC20 asset);\\n\\n /// @notice Retrieves the amount deposited in the stream, denoted in units of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getDepositedAmount(\\n uint256 streamId\\n ) external view returns (uint128 depositedAmount);\\n\\n /// @notice Retrieves the stream's end time, which is a Unix timestamp.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getEndTime(\\n uint256 streamId\\n ) external view returns (uint40 endTime);\\n\\n /// @notice Retrieves the stream's recipient.\\n /// @dev Reverts if the NFT has been burned.\\n /// @param streamId The stream ID for the query.\\n function getRecipient(\\n uint256 streamId\\n ) external view returns (address recipient);\\n\\n /// @notice Retrieves the amount refunded to the sender after a cancellation, denoted in units of the asset's\\n /// decimals. This amount is always zero unless the stream was canceled.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getRefundedAmount(\\n uint256 streamId\\n ) external view returns (uint128 refundedAmount);\\n\\n /// @notice Retrieves the stream's sender.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getSender(uint256 streamId) external view returns (address sender);\\n\\n /// @notice Retrieves the stream's start time, which is a Unix timestamp.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getStartTime(\\n uint256 streamId\\n ) external view returns (uint40 startTime);\\n\\n /// @notice Retrieves the amount withdrawn from the stream, denoted in units of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getWithdrawnAmount(\\n uint256 streamId\\n ) external view returns (uint128 withdrawnAmount);\\n\\n /// @notice Retrieves a flag indicating whether the provided address is a contract allowed to hook to Sablier\\n /// when a stream is canceled or when assets are withdrawn.\\n /// @dev See {ISablierLockupRecipient} for more information.\\n function isAllowedToHook(\\n address recipient\\n ) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream can be canceled. When the stream is cold, this\\n /// flag is always `false`.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isCancelable(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream is cold, i.e. settled, canceled, or depleted.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isCold(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream is depleted.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isDepleted(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream exists.\\n /// @dev Does not revert if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isStream(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream NFT can be transferred.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isTransferable(\\n uint256 streamId\\n ) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream is warm, i.e. either pending or streaming.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isWarm(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves the maximum broker fee that can be charged by the broker, denoted as a fixed-point\\n /// number where 1e18 is 100%.\\n /// @dev This value is hard coded as a constant.\\n function MAX_BROKER_FEE() external view returns (UD60x18);\\n\\n /// @notice Counter for stream IDs, used in the create functions.\\n function nextStreamId() external view returns (uint256);\\n\\n /// @notice Contract that generates the non-fungible token URI.\\n function nftDescriptor() external view returns (ISablierV2NFTDescriptor);\\n\\n /// @notice Calculates the amount that the sender would be refunded if the stream were canceled, denoted in units\\n /// of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function refundableAmountOf(\\n uint256 streamId\\n ) external view returns (uint128 refundableAmount);\\n\\n /// @notice Retrieves the stream's status.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function statusOf(\\n uint256 streamId\\n ) external view returns (Lockup.Status status);\\n\\n /// @notice Calculates the amount streamed to the recipient, denoted in units of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n ///\\n /// Notes:\\n /// - Upon cancellation of the stream, the amount streamed is calculated as the difference between the deposited\\n /// amount and the refunded amount. Ultimately, when the stream becomes depleted, the streamed amount is equivalent\\n /// to the total amount withdrawn.\\n ///\\n /// @param streamId The stream ID for the query.\\n function streamedAmountOf(\\n uint256 streamId\\n ) external view returns (uint128 streamedAmount);\\n\\n /// @notice Retrieves a flag indicating whether the stream was canceled.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function wasCanceled(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Calculates the amount that the recipient can withdraw from the stream, denoted in units of the asset's\\n /// decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function withdrawableAmountOf(\\n uint256 streamId\\n ) external view returns (uint128 withdrawableAmount);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n NON-CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Allows a recipient contract to hook to Sablier when a stream is canceled or when assets are withdrawn.\\n /// Useful for implementing contracts that hold streams on behalf of users, such as vaults or staking contracts.\\n ///\\n /// @dev Emits an {AllowToHook} event.\\n ///\\n /// Notes:\\n /// - Does not revert if the contract is already on the allowlist.\\n /// - This is an irreversible operation. The contract cannot be removed from the allowlist.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the contract admin.\\n /// - `recipient` must have a non-zero code size.\\n /// - `recipient` must implement {ISablierLockupRecipient}.\\n ///\\n /// @param recipient The address of the contract to allow for hooks.\\n function allowToHook(address recipient) external;\\n\\n /// @notice Burns the NFT associated with the stream.\\n ///\\n /// @dev Emits a {Transfer} event.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `streamId` must reference a depleted stream.\\n /// - The NFT must exist.\\n /// - `msg.sender` must be either the NFT owner or an approved third party.\\n ///\\n /// @param streamId The ID of the stream NFT to burn.\\n function burn(uint256 streamId) external;\\n\\n /// @notice Cancels the stream and refunds any remaining assets to the sender.\\n ///\\n /// @dev Emits a {Transfer}, {CancelLockupStream}, and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - If there any assets left for the recipient to withdraw, the stream is marked as canceled. Otherwise, the\\n /// stream is marked as depleted.\\n /// - This function attempts to invoke a hook on the recipient, if the resolved address is a contract.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - The stream must be warm and cancelable.\\n /// - `msg.sender` must be the stream's sender.\\n ///\\n /// @param streamId The ID of the stream to cancel.\\n function cancel(uint256 streamId) external;\\n\\n /// @notice Cancels multiple streams and refunds any remaining assets to the sender.\\n ///\\n /// @dev Emits multiple {Transfer}, {CancelLockupStream}, and {MetadataUpdate} events.\\n ///\\n /// Notes:\\n /// - Refer to the notes in {cancel}.\\n ///\\n /// Requirements:\\n /// - All requirements from {cancel} must be met for each stream.\\n ///\\n /// @param streamIds The IDs of the streams to cancel.\\n function cancelMultiple(uint256[] calldata streamIds) external;\\n\\n /// @notice Removes the right of the stream's sender to cancel the stream.\\n ///\\n /// @dev Emits a {RenounceLockupStream} and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - This is an irreversible operation.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `streamId` must reference a warm stream.\\n /// - `msg.sender` must be the stream's sender.\\n /// - The stream must be cancelable.\\n ///\\n /// @param streamId The ID of the stream to renounce.\\n function renounce(uint256 streamId) external;\\n\\n /// @notice Sets a new NFT descriptor contract, which produces the URI describing the Sablier stream NFTs.\\n ///\\n /// @dev Emits a {SetNFTDescriptor} and {BatchMetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - Does not revert if the NFT descriptor is the same.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the contract admin.\\n ///\\n /// @param newNFTDescriptor The address of the new NFT descriptor contract.\\n function setNFTDescriptor(\\n ISablierV2NFTDescriptor newNFTDescriptor\\n ) external;\\n\\n /// @notice Withdraws the provided amount of assets from the stream to the `to` address.\\n ///\\n /// @dev Emits a {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - This function attempts to call a hook on the recipient of the stream, unless `msg.sender` is the recipient.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `streamId` must not reference a null or depleted stream.\\n /// - `to` must not be the zero address.\\n /// - `amount` must be greater than zero and must not exceed the withdrawable amount.\\n /// - `to` must be the recipient if `msg.sender` is not the stream's recipient or an approved third party.\\n ///\\n /// @param streamId The ID of the stream to withdraw from.\\n /// @param to The address receiving the withdrawn assets.\\n /// @param amount The amount to withdraw, denoted in units of the asset's decimals.\\n function withdraw(uint256 streamId, address to, uint128 amount) external;\\n\\n /// @notice Withdraws the maximum withdrawable amount from the stream to the provided address `to`.\\n ///\\n /// @dev Emits a {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - Refer to the notes in {withdraw}.\\n ///\\n /// Requirements:\\n /// - Refer to the requirements in {withdraw}.\\n ///\\n /// @param streamId The ID of the stream to withdraw from.\\n /// @param to The address receiving the withdrawn assets.\\n /// @return withdrawnAmount The amount withdrawn, denoted in units of the asset's decimals.\\n function withdrawMax(\\n uint256 streamId,\\n address to\\n ) external returns (uint128 withdrawnAmount);\\n\\n /// @notice Withdraws the maximum withdrawable amount from the stream to the current recipient, and transfers the\\n /// NFT to `newRecipient`.\\n ///\\n /// @dev Emits a {WithdrawFromLockupStream} and a {Transfer} event.\\n ///\\n /// Notes:\\n /// - If the withdrawable amount is zero, the withdrawal is skipped.\\n /// - Refer to the notes in {withdraw}.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the stream's recipient.\\n /// - Refer to the requirements in {withdraw}.\\n /// - Refer to the requirements in {IERC721.transferFrom}.\\n ///\\n /// @param streamId The ID of the stream NFT to transfer.\\n /// @param newRecipient The address of the new owner of the stream NFT.\\n /// @return withdrawnAmount The amount withdrawn, denoted in units of the asset's decimals.\\n function withdrawMaxAndTransfer(\\n uint256 streamId,\\n address newRecipient\\n ) external returns (uint128 withdrawnAmount);\\n\\n /// @notice Withdraws assets from streams to the recipient of each stream.\\n ///\\n /// @dev Emits multiple {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} events.\\n ///\\n /// Notes:\\n /// - This function attempts to call a hook on the recipient of each stream, unless `msg.sender` is the recipient.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - There must be an equal number of `streamIds` and `amounts`.\\n /// - Each stream ID in the array must not reference a null or depleted stream.\\n /// - Each amount in the array must be greater than zero and must not exceed the withdrawable amount.\\n ///\\n /// @param streamIds The IDs of the streams to withdraw from.\\n /// @param amounts The amounts to withdraw, denoted in units of the asset's decimals.\\n function withdrawMultiple(\\n uint256[] calldata streamIds,\\n uint128[] calldata amounts\\n ) external;\\n}\\n\",\"keccak256\":\"0x3e5541c38a901637bd310965deb5bbde73ef07fe4ee3c752cbec330c6b9d62a3\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/ISablierV2LockupLinear.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\nimport {Lockup, LockupLinear} from \\\"./types/DataTypes.sol\\\";\\nimport {ISablierV2Lockup} from \\\"./ISablierV2Lockup.sol\\\";\\n\\n/// @title ISablierV2LockupLinear\\n/// @notice Creates and manages Lockup streams with a linear distribution function.\\ninterface ISablierV2LockupLinear is ISablierV2Lockup {\\n /*//////////////////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Emitted when a stream is created.\\n /// @param streamId The ID of the newly created stream.\\n /// @param funder The address which funded the stream.\\n /// @param sender The address distributing the assets, which will have the ability to cancel the stream.\\n /// @param recipient The address receiving the assets.\\n /// @param amounts Struct encapsulating (i) the deposit amount, and (ii) the broker fee amount, both denoted\\n /// in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Boolean indicating whether the stream will be cancelable or not.\\n /// @param transferable Boolean indicating whether the stream NFT is transferable or not.\\n /// @param timestamps Struct encapsulating (i) the stream's start time, (ii) cliff time, and (iii) end time, all as\\n /// Unix timestamps.\\n /// @param broker The address of the broker who has helped create the stream, e.g. a front-end website.\\n event CreateLockupLinearStream(\\n uint256 streamId,\\n address funder,\\n address indexed sender,\\n address indexed recipient,\\n Lockup.CreateAmounts amounts,\\n IERC20 indexed asset,\\n bool cancelable,\\n bool transferable,\\n LockupLinear.Timestamps timestamps,\\n address broker\\n );\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Retrieves the stream's cliff time, which is a Unix timestamp. A value of zero means there\\n /// is no cliff.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getCliffTime(\\n uint256 streamId\\n ) external view returns (uint40 cliffTime);\\n\\n /// @notice Retrieves the full stream details.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n /// @return stream See the documentation in {DataTypes}.\\n function getStream(\\n uint256 streamId\\n ) external view returns (LockupLinear.StreamLL memory stream);\\n\\n /// @notice Retrieves the stream's start, cliff and end timestamps.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n /// @return timestamps See the documentation in {DataTypes}.\\n function getTimestamps(\\n uint256 streamId\\n ) external view returns (LockupLinear.Timestamps memory timestamps);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n NON-CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Creates a stream by setting the start time to `block.timestamp`, and the end time to\\n /// the sum of `block.timestamp` and `params.durations.total`. The stream is funded by `msg.sender` and is wrapped\\n /// in an ERC-721 NFT.\\n ///\\n /// @dev Emits a {Transfer} and {CreateLockupLinearStream} event.\\n ///\\n /// Requirements:\\n /// - All requirements in {createWithTimestamps} must be met for the calculated parameters.\\n ///\\n /// @param params Struct encapsulating the function parameters, which are documented in {DataTypes}.\\n /// @return streamId The ID of the newly created stream.\\n function createWithDurations(\\n LockupLinear.CreateWithDurations calldata params\\n ) external returns (uint256 streamId);\\n\\n /// @notice Creates a stream with the provided start time and end time. The stream is funded by `msg.sender` and is\\n /// wrapped in an ERC-721 NFT.\\n ///\\n /// @dev Emits a {Transfer} and {CreateLockupLinearStream} event.\\n ///\\n /// Notes:\\n /// - A cliff time of zero means there is no cliff.\\n /// - As long as the times are ordered, it is not an error for the start or the cliff time to be in the past.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `params.totalAmount` must be greater than zero.\\n /// - If set, `params.broker.fee` must not be greater than `MAX_BROKER_FEE`.\\n /// - `params.timestamps.start` must be greater than zero and less than `params.timestamps.end`.\\n /// - If set, `params.timestamps.cliff` must be greater than `params.timestamps.start` and less than\\n /// `params.timestamps.end`.\\n /// - `params.timestamps.end` must be in the future.\\n /// - `params.recipient` must not be the zero address.\\n /// - `msg.sender` must have allowed this contract to spend at least `params.totalAmount` assets.\\n ///\\n /// @param params Struct encapsulating the function parameters, which are documented in {DataTypes}.\\n /// @return streamId The ID of the newly created stream.\\n function createWithTimestamps(\\n LockupLinear.CreateWithTimestamps calldata params\\n ) external returns (uint256 streamId);\\n}\\n\",\"keccak256\":\"0x064264723114b1f1cf3953fd79874dfcbb42cf313857aee6d5e6b09a23e0010b\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/ISablierV2NFTDescriptor.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC721Metadata} from \\\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\\\";\\n\\n/// @title ISablierV2NFTDescriptor\\n/// @notice This contract generates the URI describing the Sablier V2 stream NFTs.\\n/// @dev Inspired by Uniswap V3 Positions NFTs.\\ninterface ISablierV2NFTDescriptor {\\n /// @notice Produces the URI describing a particular stream NFT.\\n /// @dev This is a data URI with the JSON contents directly inlined.\\n /// @param sablier The address of the Sablier contract the stream was created in.\\n /// @param streamId The ID of the stream for which to produce a description.\\n /// @return uri The URI of the ERC721-compliant metadata.\\n function tokenURI(\\n IERC721Metadata sablier,\\n uint256 streamId\\n ) external view returns (string memory uri);\\n}\\n\",\"keccak256\":\"0x4ed430e553d14161e93efdaaacd1a502f49b38969c9d714b45d2e682a74fa0bc\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/types/DataTypes.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {UD2x18} from \\\"@prb/math/src/UD2x18.sol\\\";\\nimport {UD60x18} from \\\"@prb/math/src/UD60x18.sol\\\";\\n\\n// DataTypes.sol\\n//\\n// This file defines all structs used in V2 Core, most of which are organized under three namespaces:\\n//\\n// - Lockup\\n// - LockupDynamic\\n// - LockupLinear\\n// - LockupTranched\\n//\\n// You will notice that some structs contain \\\"slot\\\" annotations - they are used to indicate the\\n// storage layout of the struct. It is more gas efficient to group small data types together so\\n// that they fit in a single 32-byte slot.\\n\\n/// @notice Struct encapsulating the broker parameters passed to the create functions. Both can be set to zero.\\n/// @param account The address receiving the broker's fee.\\n/// @param fee The broker's percentage fee from the total amount, denoted as a fixed-point number where 1e18 is 100%.\\nstruct Broker {\\n address account;\\n UD60x18 fee;\\n}\\n\\n/// @notice Namespace for the structs used in both {SablierV2LockupLinear} and {SablierV2LockupDynamic}.\\nlibrary Lockup {\\n /// @notice Struct encapsulating the deposit, withdrawn, and refunded amounts, all denoted in units of the asset's\\n /// decimals.\\n /// @dev Because the deposited and the withdrawn amount are often read together, declaring them in the same slot\\n /// saves gas.\\n /// @param deposited The initial amount deposited in the stream, net of broker fee.\\n /// @param withdrawn The cumulative amount withdrawn from the stream.\\n /// @param refunded The amount refunded to the sender. Unless the stream was canceled, this is always zero.\\n struct Amounts {\\n // slot 0\\n uint128 deposited;\\n uint128 withdrawn;\\n // slot 1\\n uint128 refunded;\\n }\\n\\n /// @notice Struct encapsulating (i) the deposit amount and (ii) the broker fee amount, both denoted in units of the\\n /// asset's decimals.\\n /// @param deposit The amount to deposit in the stream.\\n /// @param brokerFee The broker fee amount.\\n struct CreateAmounts {\\n uint128 deposit;\\n uint128 brokerFee;\\n }\\n\\n /// @notice Enum representing the different statuses of a stream.\\n /// @custom:value0 PENDING Stream created but not started; assets are in a pending state.\\n /// @custom:value1 STREAMING Active stream where assets are currently being streamed.\\n /// @custom:value2 SETTLED All assets have been streamed; recipient is due to withdraw them.\\n /// @custom:value3 CANCELED Canceled stream; remaining assets await recipient's withdrawal.\\n /// @custom:value4 DEPLETED Depleted stream; all assets have been withdrawn and/or refunded.\\n enum Status {\\n PENDING,\\n STREAMING,\\n SETTLED,\\n CANCELED,\\n DEPLETED\\n }\\n\\n /// @notice A common data structure to be stored in all {SablierV2Lockup} models.\\n /// @dev The fields are arranged like this to save gas via tight variable packing.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream.\\n /// @param startTime The Unix timestamp indicating the stream's start.\\n /// @param endTime The Unix timestamp indicating the stream's end.\\n /// @param isCancelable Boolean indicating if the stream is cancelable.\\n /// @param wasCanceled Boolean indicating if the stream was canceled.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param isDepleted Boolean indicating if the stream is depleted.\\n /// @param isStream Boolean indicating if the struct entity exists.\\n /// @param isTransferable Boolean indicating if the stream NFT is transferable.\\n /// @param amounts Struct encapsulating the deposit, withdrawn, and refunded amounts, all denoted in units of the\\n /// asset's decimals.\\n struct Stream {\\n // slot 0\\n address sender;\\n uint40 startTime;\\n uint40 endTime;\\n bool isCancelable;\\n bool wasCanceled;\\n // slot 1\\n IERC20 asset;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n // slot 2 and 3\\n Lockup.Amounts amounts;\\n }\\n}\\n\\n/// @notice Namespace for the structs used in {SablierV2LockupDynamic}.\\nlibrary LockupDynamic {\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupDynamic.createWithDurations} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param segments Segments with durations used to compose the dynamic distribution function. Timestamps are\\n /// calculated by starting from `block.timestamp` and adding each duration to the previous timestamp.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithDurations {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n SegmentWithDuration[] segments;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupDynamic.createWithTimestamps} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param startTime The Unix timestamp indicating the stream's start.\\n /// @param segments Segments used to compose the dynamic distribution function.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithTimestamps {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n uint40 startTime;\\n Segment[] segments;\\n Broker broker;\\n }\\n\\n /// @notice Segment struct used in the Lockup Dynamic stream.\\n /// @param amount The amount of assets to be streamed in the segment, denoted in units of the asset's decimals.\\n /// @param exponent The exponent of the segment, denoted as a fixed-point number.\\n /// @param timestamp The Unix timestamp indicating the segment's end.\\n struct Segment {\\n // slot 0\\n uint128 amount;\\n UD2x18 exponent;\\n uint40 timestamp;\\n }\\n\\n /// @notice Segment struct used at runtime in {SablierV2LockupDynamic.createWithDurations}.\\n /// @param amount The amount of assets to be streamed in the segment, denoted in units of the asset's decimals.\\n /// @param exponent The exponent of the segment, denoted as a fixed-point number.\\n /// @param duration The time difference in seconds between the segment and the previous one.\\n struct SegmentWithDuration {\\n uint128 amount;\\n UD2x18 exponent;\\n uint40 duration;\\n }\\n\\n /// @notice Struct encapsulating the full details of a stream.\\n /// @dev Extends `Lockup.Stream` by including the recipient and the segments.\\n struct StreamLD {\\n address sender;\\n address recipient;\\n uint40 startTime;\\n uint40 endTime;\\n bool isCancelable;\\n bool wasCanceled;\\n IERC20 asset;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n Lockup.Amounts amounts;\\n Segment[] segments;\\n }\\n\\n /// @notice Struct encapsulating the LockupDynamic timestamps.\\n /// @param start The Unix timestamp indicating the stream's start.\\n /// @param end The Unix timestamp indicating the stream's end.\\n struct Timestamps {\\n uint40 start;\\n uint40 end;\\n }\\n}\\n\\n/// @notice Namespace for the structs used in {SablierV2LockupLinear}.\\nlibrary LockupLinear {\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupLinear.createWithDurations} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param durations Struct encapsulating (i) cliff period duration and (ii) total stream duration, both in seconds.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithDurations {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n Durations durations;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupLinear.createWithTimestamps} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param timestamps Struct encapsulating (i) the stream's start time, (ii) cliff time, and (iii) end time, all as\\n /// Unix timestamps.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithTimestamps {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n Timestamps timestamps;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the cliff duration and the total duration.\\n /// @param cliff The cliff duration in seconds.\\n /// @param total The total duration in seconds.\\n struct Durations {\\n uint40 cliff;\\n uint40 total;\\n }\\n\\n /// @notice Struct encapsulating the full details of a stream.\\n /// @dev Extends `Lockup.Stream` by including the recipient and the cliff time.\\n struct StreamLL {\\n address sender;\\n address recipient;\\n uint40 startTime;\\n bool isCancelable;\\n bool wasCanceled;\\n IERC20 asset;\\n uint40 endTime;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n Lockup.Amounts amounts;\\n uint40 cliffTime;\\n }\\n\\n /// @notice Struct encapsulating the LockupLinear timestamps.\\n /// @param start The Unix timestamp for the stream's start.\\n /// @param cliff The Unix timestamp for the cliff period's end. A value of zero means there is no cliff.\\n /// @param end The Unix timestamp for the stream's end.\\n struct Timestamps {\\n uint40 start;\\n uint40 cliff;\\n uint40 end;\\n }\\n}\\n\\n/// @notice Namespace for the structs used in {SablierV2LockupTranched}.\\nlibrary LockupTranched {\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupTranched.createWithDurations} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param tranches Tranches with durations used to compose the tranched distribution function. Timestamps are\\n /// calculated by starting from `block.timestamp` and adding each duration to the previous timestamp.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithDurations {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n TrancheWithDuration[] tranches;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupTranched.createWithTimestamps} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param startTime The Unix timestamp indicating the stream's start.\\n /// @param tranches Tranches used to compose the tranched distribution function.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithTimestamps {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n uint40 startTime;\\n Tranche[] tranches;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the full details of a stream.\\n /// @dev Extends `Lockup.Stream` by including the recipient and the tranches.\\n struct StreamLT {\\n address sender;\\n address recipient;\\n uint40 startTime;\\n uint40 endTime;\\n bool isCancelable;\\n bool wasCanceled;\\n IERC20 asset;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n Lockup.Amounts amounts;\\n Tranche[] tranches;\\n }\\n\\n /// @notice Struct encapsulating the LockupTranched timestamps.\\n /// @param start The Unix timestamp indicating the stream's start.\\n /// @param end The Unix timestamp indicating the stream's end.\\n struct Timestamps {\\n uint40 start;\\n uint40 end;\\n }\\n\\n /// @notice Tranche struct used in the Lockup Tranched stream.\\n /// @param amount The amount of assets to be unlocked in the tranche, denoted in units of the asset's decimals.\\n /// @param timestamp The Unix timestamp indicating the tranche's end.\\n struct Tranche {\\n // slot 0\\n uint128 amount;\\n uint40 timestamp;\\n }\\n\\n /// @notice Tranche struct used at runtime in {SablierV2LockupTranched.createWithDurations}.\\n /// @param amount The amount of assets to be unlocked in the tranche, denoted in units of the asset's decimals.\\n /// @param duration The time difference in seconds between the tranche and the previous one.\\n struct TrancheWithDuration {\\n uint128 amount;\\n uint40 duration;\\n }\\n}\\n\",\"keccak256\":\"0x727722c0ec71a76a947b935c9dfcac8fd846d6c3547dfbc8739c7109f3b95068\",\"license\":\"GPL-3.0-or-later\"},\"contracts/modules/DecentHatsCreationModule.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.28;\\n\\nimport {Enum} from \\\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\\\";\\nimport {IAvatar} from \\\"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol\\\";\\nimport {Strings} from \\\"@openzeppelin/contracts/utils/Strings.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IERC6551Registry} from \\\"../interfaces/IERC6551Registry.sol\\\";\\nimport {IHats} from \\\"../interfaces/hats/IHats.sol\\\";\\nimport {LockupLinear, Broker} from \\\"../interfaces/sablier/types/DataTypes.sol\\\";\\nimport {IHatsModuleFactory} from \\\"../interfaces/hats/IHatsModuleFactory.sol\\\";\\nimport {IHatsElectionsEligibility} from \\\"../interfaces/hats/modules/IHatsElectionsEligibility.sol\\\";\\nimport {ModuleProxyFactory} from \\\"@gnosis.pm/zodiac/contracts/factory/ModuleProxyFactory.sol\\\";\\nimport {ISablierV2LockupLinear} from \\\"../interfaces/sablier/ISablierV2LockupLinear.sol\\\";\\nimport {DecentHatsModuleUtils} from \\\"./DecentHatsModuleUtils.sol\\\";\\n\\ncontract DecentHatsCreationModule is DecentHatsModuleUtils {\\n struct TopHatParams {\\n string details;\\n string imageURI;\\n }\\n\\n struct AdminHatParams {\\n string details;\\n string imageURI;\\n bool isMutable;\\n }\\n\\n struct CreateTreeParams {\\n IHats hatsProtocol;\\n IERC6551Registry erc6551Registry;\\n IHatsModuleFactory hatsModuleFactory;\\n ModuleProxyFactory moduleProxyFactory;\\n address keyValuePairs;\\n address decentAutonomousAdminImplementation;\\n address hatsAccountImplementation;\\n address hatsElectionsEligibilityImplementation;\\n TopHatParams topHat;\\n AdminHatParams adminHat;\\n HatParams[] hats;\\n }\\n\\n /* /////////////////////////////////////////////////////////////////////////////\\n EXTERNAL FUNCTIONS\\n ///////////////////////////////////////////////////////////////////////////// */\\n /**\\n * @notice For a safe without any roles previously created on it, this function should be called. It sets up the\\n * top hat and admin hat, as well as any other hats and their streams that are provided, then transfers the top hat\\n * to the calling safe.\\n *\\n * @notice This contract should be enabled a module on the Safe for which the role(s) are to be created, and disabled after.\\n *\\n * @dev For each hat that is included, if the hat is:\\n * - termed, its stream funds on are targeted directly at the nominated wearer. The wearer should directly call `withdraw-`\\n * on the Sablier contract.\\n * - untermed, its stream funds are targeted at the hat's smart account. In order to withdraw funds from the stream, the\\n * hat's smart account must be the one call to `withdraw-` on the Sablier contract, setting the recipient arg to its wearer.\\n *\\n * @dev In order for a Safe to seamlessly create roles even if it has never previously created a role and thus has\\n * no hat tree, we defer the creation of the hat tree and its setup to this contract. This way, in a single tx block,\\n * the resulting topHatId of the newly created hat can be used to create an admin hat and any other hats needed.\\n * We also make use of `KeyValuePairs` to associate the topHatId with the Safe.\\n *\\n * @param treeParams The parameters for creating the Hat Tree with Roles\\n */\\n function createAndDeclareTree(\\n CreateTreeParams calldata treeParams\\n ) external {\\n // Create Top Hat\\n (uint256 topHatId, address topHatAccount) = _processTopHat(\\n treeParams.hatsProtocol,\\n treeParams.erc6551Registry,\\n treeParams.hatsAccountImplementation,\\n treeParams.keyValuePairs,\\n treeParams.topHat\\n );\\n\\n // Create Admin Hat\\n uint256 adminHatId = _processAdminHat(\\n treeParams.hatsProtocol,\\n treeParams.erc6551Registry,\\n treeParams.hatsAccountImplementation,\\n topHatId,\\n topHatAccount,\\n treeParams.moduleProxyFactory,\\n treeParams.decentAutonomousAdminImplementation,\\n treeParams.adminHat\\n );\\n\\n // Create Role Hats\\n _processRoleHats(\\n CreateRoleHatsParams({\\n hatsProtocol: treeParams.hatsProtocol,\\n erc6551Registry: treeParams.erc6551Registry,\\n hatsAccountImplementation: treeParams.hatsAccountImplementation,\\n topHatId: topHatId,\\n topHatAccount: topHatAccount,\\n hatsModuleFactory: treeParams.hatsModuleFactory,\\n hatsElectionsEligibilityImplementation: treeParams\\n .hatsElectionsEligibilityImplementation,\\n adminHatId: adminHatId,\\n hats: treeParams.hats\\n })\\n );\\n }\\n\\n /* /////////////////////////////////////////////////////////////////////////////\\n INTERNAL FUNCTIONS\\n ///////////////////////////////////////////////////////////////////////////// */\\n\\n function _processTopHat(\\n IHats hatsProtocol,\\n IERC6551Registry erc6551Registry,\\n address hatsAccountImplementation,\\n address keyValuePairs,\\n TopHatParams calldata topHat\\n ) internal returns (uint256 topHatId, address topHatAccount) {\\n // Call lastTopHatId() and properly decode the response\\n (bool success, bytes memory data) = address(hatsProtocol).call(\\n abi.encodeWithSignature(\\\"lastTopHatId()\\\")\\n );\\n require(success, \\\"Failed to get lastTopHatId\\\");\\n topHatId = (abi.decode(data, (uint256)) + 1) << 224;\\n\\n // Mint Top Hat to the Safe\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"mintTopHat(address,string,string)\\\",\\n msg.sender,\\n topHat.details,\\n topHat.imageURI\\n ),\\n Enum.Operation.Call\\n );\\n\\n // Create Top Hat's ERC6551 Account\\n topHatAccount = erc6551Registry.createAccount(\\n hatsAccountImplementation,\\n SALT,\\n block.chainid,\\n address(hatsProtocol),\\n topHatId\\n );\\n\\n // Declare Top Hat ID to Safe via KeyValuePairs\\n string[] memory keys = new string[](1);\\n string[] memory values = new string[](1);\\n keys[0] = \\\"topHatId\\\";\\n values[0] = Strings.toString(topHatId);\\n IAvatar(msg.sender).execTransactionFromModule(\\n keyValuePairs,\\n 0,\\n abi.encodeWithSignature(\\n \\\"updateValues(string[],string[])\\\",\\n keys,\\n values\\n ),\\n Enum.Operation.Call\\n );\\n }\\n\\n function _processAdminHat(\\n IHats hatsProtocol,\\n IERC6551Registry erc6551Registry,\\n address hatsAccountImplementation,\\n uint256 topHatId,\\n address topHatAccount,\\n ModuleProxyFactory moduleProxyFactory,\\n address decentAutonomousAdminImplementation,\\n AdminHatParams calldata adminHat\\n ) internal returns (uint256 adminHatId) {\\n // Create Admin Hat\\n adminHatId = hatsProtocol.getNextId(topHatId);\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"createHat(uint256,string,uint32,address,address,bool,string)\\\",\\n topHatId,\\n adminHat.details,\\n 1, // only one Admin Hat\\n topHatAccount,\\n topHatAccount,\\n adminHat.isMutable,\\n adminHat.imageURI\\n ),\\n Enum.Operation.Call\\n );\\n\\n // Create Admin Hat's ERC6551 Account\\n erc6551Registry.createAccount(\\n hatsAccountImplementation,\\n SALT,\\n block.chainid,\\n address(hatsProtocol),\\n adminHatId\\n );\\n\\n // Deploy Decent Autonomous Admin Module, which will wear the Admin Hat\\n address autonomousAdmin = moduleProxyFactory.deployModule(\\n decentAutonomousAdminImplementation,\\n abi.encodeWithSignature(\\\"setUp(bytes)\\\", bytes(\\\"\\\")),\\n uint256(\\n keccak256(\\n abi.encodePacked(\\n // for the salt, we'll concatenate our static salt\\n // with the Admin Hat ID\\n SALT,\\n adminHatId\\n )\\n )\\n )\\n );\\n\\n // Mint Hat to the Decent Autonomous Admin Module\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"mintHat(uint256,address)\\\",\\n adminHatId,\\n autonomousAdmin\\n ),\\n Enum.Operation.Call\\n );\\n }\\n}\\n\",\"keccak256\":\"0x0d952c31bdbe70343c618cdab6930200c3064eee26ccfb6913a94a2be635dd41\",\"license\":\"MIT\"},\"contracts/modules/DecentHatsModuleUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.28;\\n\\nimport {Enum} from \\\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\\\";\\nimport {IAvatar} from \\\"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IERC6551Registry} from \\\"../interfaces/IERC6551Registry.sol\\\";\\nimport {IHats} from \\\"../interfaces/hats/IHats.sol\\\";\\nimport {LockupLinear, Broker} from \\\"../interfaces/sablier/types/DataTypes.sol\\\";\\nimport {IHatsModuleFactory} from \\\"../interfaces/hats/IHatsModuleFactory.sol\\\";\\nimport {ISablierV2LockupLinear} from \\\"../interfaces/sablier/ISablierV2LockupLinear.sol\\\";\\n\\nabstract contract DecentHatsModuleUtils {\\n bytes32 public constant SALT =\\n 0x5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b5072;\\n\\n struct SablierStreamParams {\\n ISablierV2LockupLinear sablier;\\n address sender;\\n address asset;\\n LockupLinear.Timestamps timestamps;\\n Broker broker;\\n uint128 totalAmount;\\n bool cancelable;\\n bool transferable;\\n }\\n\\n struct HatParams {\\n address wearer;\\n string details;\\n string imageURI;\\n SablierStreamParams[] sablierStreamsParams;\\n uint128 termEndDateTs; // If 0, this is an untermed Hat\\n uint32 maxSupply;\\n bool isMutable;\\n }\\n\\n struct CreateRoleHatsParams {\\n IHats hatsProtocol;\\n IERC6551Registry erc6551Registry;\\n address hatsAccountImplementation;\\n uint256 topHatId;\\n address topHatAccount;\\n IHatsModuleFactory hatsModuleFactory;\\n address hatsElectionsEligibilityImplementation;\\n uint256 adminHatId;\\n HatParams[] hats;\\n }\\n\\n function _processRoleHats(\\n CreateRoleHatsParams memory roleHatsParams\\n ) internal {\\n for (uint256 i = 0; i < roleHatsParams.hats.length; ) {\\n HatParams memory hatParams = roleHatsParams.hats[i];\\n\\n // Create eligibility module if needed\\n address eligibilityAddress = _createEligibilityModule(\\n roleHatsParams.hatsProtocol,\\n roleHatsParams.hatsModuleFactory,\\n roleHatsParams.hatsElectionsEligibilityImplementation,\\n roleHatsParams.topHatId,\\n roleHatsParams.topHatAccount,\\n roleHatsParams.adminHatId,\\n hatParams.termEndDateTs\\n );\\n\\n // Create and Mint the Role Hat\\n uint256 hatId = _createAndMintHat(\\n roleHatsParams.hatsProtocol,\\n roleHatsParams.adminHatId,\\n hatParams,\\n eligibilityAddress,\\n roleHatsParams.topHatAccount\\n );\\n\\n // Get the stream recipient (based on termed or not)\\n address streamRecipient = _setupStreamRecipient(\\n roleHatsParams.erc6551Registry,\\n roleHatsParams.hatsAccountImplementation,\\n address(roleHatsParams.hatsProtocol),\\n hatParams.termEndDateTs,\\n hatParams.wearer,\\n hatId\\n );\\n\\n // Create streams\\n _processSablierStreams(\\n hatParams.sablierStreamsParams,\\n streamRecipient\\n );\\n\\n unchecked {\\n ++i;\\n }\\n }\\n }\\n\\n function _createEligibilityModule(\\n IHats hatsProtocol,\\n IHatsModuleFactory hatsModuleFactory,\\n address hatsElectionsEligibilityImplementation,\\n uint256 topHatId,\\n address topHatAccount,\\n uint256 adminHatId,\\n uint128 termEndDateTs\\n ) private returns (address) {\\n // If the Hat is termed, create the eligibility module\\n if (termEndDateTs != 0) {\\n return\\n hatsModuleFactory.createHatsModule(\\n hatsElectionsEligibilityImplementation,\\n hatsProtocol.getNextId(adminHatId),\\n abi.encode(topHatId, uint256(0)), // [BALLOT_BOX_ID, ADMIN_HAT_ID]\\n abi.encode(termEndDateTs),\\n uint256(SALT)\\n );\\n }\\n\\n // Otherwise, return the Top Hat account\\n return topHatAccount;\\n }\\n\\n function _createAndMintHat(\\n IHats hatsProtocol,\\n uint256 adminHatId,\\n HatParams memory hat,\\n address eligibilityAddress,\\n address topHatAccount\\n ) private returns (uint256) {\\n // Grab the next Hat ID (before creating it)\\n uint256 hatId = hatsProtocol.getNextId(adminHatId);\\n\\n // Create the new Hat\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"createHat(uint256,string,uint32,address,address,bool,string)\\\",\\n adminHatId,\\n hat.details,\\n hat.maxSupply,\\n eligibilityAddress,\\n topHatAccount,\\n hat.isMutable,\\n hat.imageURI\\n ),\\n Enum.Operation.Call\\n );\\n\\n // If the Hat is termed, nominate the wearer as the eligible member\\n if (hat.termEndDateTs != 0) {\\n address[] memory nominatedWearers = new address[](1);\\n nominatedWearers[0] = hat.wearer;\\n\\n IAvatar(msg.sender).execTransactionFromModule(\\n eligibilityAddress,\\n 0,\\n abi.encodeWithSignature(\\n \\\"elect(uint128,address[])\\\",\\n hat.termEndDateTs,\\n nominatedWearers\\n ),\\n Enum.Operation.Call\\n );\\n }\\n\\n // Mint the Hat\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"mintHat(uint256,address)\\\",\\n hatId,\\n hat.wearer\\n ),\\n Enum.Operation.Call\\n );\\n return hatId;\\n }\\n\\n // Exists to avoid stack too deep errors\\n function _setupStreamRecipient(\\n IERC6551Registry erc6551Registry,\\n address hatsAccountImplementation,\\n address hatsProtocol,\\n uint128 termEndDateTs,\\n address wearer,\\n uint256 hatId\\n ) private returns (address) {\\n // If the hat is termed, the wearer is the stream recipient\\n if (termEndDateTs != 0) {\\n return wearer;\\n }\\n\\n // Otherwise, the Hat's smart account is the stream recipient\\n return\\n erc6551Registry.createAccount(\\n hatsAccountImplementation,\\n SALT,\\n block.chainid,\\n hatsProtocol,\\n hatId\\n );\\n }\\n\\n function _processSablierStreams(\\n SablierStreamParams[] memory streamParams,\\n address streamRecipient\\n ) private {\\n for (uint256 i = 0; i < streamParams.length; ) {\\n SablierStreamParams memory sablierStreamParams = streamParams[i];\\n\\n // Approve tokens for Sablier\\n IAvatar(msg.sender).execTransactionFromModule(\\n sablierStreamParams.asset,\\n 0,\\n abi.encodeWithSignature(\\n \\\"approve(address,uint256)\\\",\\n sablierStreamParams.sablier,\\n sablierStreamParams.totalAmount\\n ),\\n Enum.Operation.Call\\n );\\n\\n // Proxy the Sablier call through IAvatar\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(sablierStreamParams.sablier),\\n 0,\\n abi.encodeWithSignature(\\n \\\"createWithTimestamps((address,address,uint128,address,bool,bool,(uint40,uint40,uint40),(address,uint256)))\\\",\\n LockupLinear.CreateWithTimestamps({\\n sender: sablierStreamParams.sender,\\n recipient: streamRecipient,\\n totalAmount: sablierStreamParams.totalAmount,\\n asset: IERC20(sablierStreamParams.asset),\\n cancelable: sablierStreamParams.cancelable,\\n transferable: sablierStreamParams.transferable,\\n timestamps: sablierStreamParams.timestamps,\\n broker: sablierStreamParams.broker\\n })\\n ),\\n Enum.Operation.Call\\n );\\n\\n unchecked {\\n ++i;\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x357c5264ecb63f8f15f67ffb7498c7fb55d9efe8d46358790933b4892bd38cde\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x6080604052348015600f57600080fd5b50611eb88061001f6000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c8063ba9a91a51461003b578063d58041b714610062575b600080fd5b610050600080516020611e6383398151915281565b60405190815260200160405180910390f35b6100756100703660046112ff565b610077565b005b6000806100cd61008a6020850185611359565b61009a6040860160208701611359565b6100aa60e0870160c08801611359565b6100ba60a0880160808901611359565b6100c8610100890189611386565b610227565b909250905060006101396100e46020860186611359565b6100f46040870160208801611359565b61010460e0880160c08901611359565b868661011660808b0160608c01611359565b61012660c08c0160a08d01611359565b6101346101208d018d6113a6565b610603565b604080516101208101909152909150610221908061015a6020880188611359565b6001600160a01b0316815260200186602001602081019061017b9190611359565b6001600160a01b0316815260200161019960e0880160c08901611359565b6001600160a01b03168152602001858152602001846001600160a01b031681526020018660400160208101906101cf9190611359565b6001600160a01b031681526020016101ee610100880160e08901611359565b6001600160a01b03168152602081018490526040016102116101408801886113bc565b61021a9161175d565b905261099f565b50505050565b60408051600481526024810182526020810180516001600160e01b0316633f0f816960e21b17905290516000918291829182916001600160a01b038b169161026e916118bf565b6000604051808303816000865af19150503d80600081146102ab576040519150601f19603f3d011682016040523d82523d6000602084013e6102b0565b606091505b5091509150816103065760405162461bcd60e51b815260206004820152601a60248201527f4661696c656420746f20676574206c617374546f704861744964000000000000604482015260640160405180910390fd5b60e08180602001905181019061031c91906118d1565b610327906001611900565b901b93503363468721a78a60008361033f8a80611919565b61034c60208d018d611919565b604051602401610360959493929190611988565b60408051601f198184030181529181526020820180516001600160e01b0316631a64dfad60e01b1790525160e085901b6001600160e01b03191681526103ae939291906000906004016119f8565b6020604051808303816000875af11580156103cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103f19190611a4e565b50604051638a54c52f60e01b81526001600160a01b03891690638a54c52f90610434908a90600080516020611e638339815191529046908f908b90600401611a6b565b6020604051808303816000875af1158015610453573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104779190611a9e565b60408051600180825281830190925291945060009190816020015b606081526020019060019003908161049257505060408051600180825281830190925291925060009190602082015b60608152602001906001900390816104c1579050509050604051806040016040528060088152602001671d1bdc12185d125960c21b8152508260008151811061050c5761050c611abb565b602002602001018190525061052086610a66565b8160008151811061053357610533611abb565b6020026020010181905250336001600160a01b031663468721a78960008585604051602401610563929190611b2d565b60408051601f198184030181529181526020820180516001600160e01b031663579374b960e11b1790525160e085901b6001600160e01b03191681526105b1939291906000906004016119f8565b6020604051808303816000875af11580156105d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105f49190611a4e565b50505050509550959350505050565b60405162460ea360e61b8152600481018690526000906001600160a01b038a1690631183a8c090602401602060405180830381865afa15801561064a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061066e91906118d1565b90503363468721a78a6000896106848780611919565b60018c8061069860608d0160408e01611b5b565b6106a560208e018e611919565b6040516024016106bd99989796959493929190611b78565b60408051601f198184030181529181526020820180516001600160e01b0316635829492f60e11b1790525160e085901b6001600160e01b031916815261070b939291906000906004016119f8565b6020604051808303816000875af115801561072a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061074e9190611a4e565b50604051638a54c52f60e01b81526001600160a01b03891690638a54c52f90610791908a90600080516020611e638339815191529046908f908890600401611a6b565b6020604051808303816000875af11580156107b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107d49190611a9e565b506000846001600160a01b031663f1ab873c85604051806020016040528060008152506040516024016108079190611bdd565b60408051601f19818403018152918152602080830180516001600160e01b031663a4f9edbf60e01b179052905161085991600080516020611e6383398151915291899101918252602082015260400190565b60408051601f198184030181529082905280516020909101206001600160e01b031960e086901b168252610891939291600401611bf0565b6020604051808303816000875af11580156108b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108d49190611a9e565b604051602481018490526001600160a01b0382166044820152909150339063468721a7908c9060009060640160408051601f198184030181529181526020820180516001600160e01b031663320fbbb760e11b1790525160e085901b6001600160e01b031916815261094e939291906000906004016119f8565b6020604051808303816000875af115801561096d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109919190611a4e565b505098975050505050505050565b60005b81610100015151811015610a6257600082610100015182815181106109c9576109c9611abb565b602002602001015190506000610a0084600001518560a001518660c00151876060015188608001518960e001518860800151610b6e565b90506000610a1d85600001518660e0015185858960800151610cd5565b90506000610a438660200151876040015188600001518760800151886000015187611007565b9050610a538460600151826110b1565b846001019450505050506109a2565b5050565b606081600003610a8d5750506040805180820190915260018152600360fc1b602082015290565b8160005b8115610ab75780610aa181611c24565b9150610ab09050600a83611c53565b9150610a91565b6000816001600160401b03811115610ad157610ad161140c565b6040519080825280601f01601f191660200182016040528015610afb576020820181803683370190505b5090505b8415610b6657610b10600183611c67565b9150610b1d600a86611c7a565b610b28906030611900565b60f81b818381518110610b3d57610b3d611abb565b60200101906001600160f81b031916908160001a905350610b5f600a86611c53565b9450610aff565b949350505050565b60006001600160801b03821615610cc757866001600160a01b0316632f7fb7b6878a6001600160a01b0316631183a8c0876040518263ffffffff1660e01b8152600401610bbd91815260200190565b602060405180830381865afa158015610bda573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bfe91906118d1565b886000604051602001610c1b929190918252602082015260400190565b60408051601f198184030181528282526001600160801b0389166020840152910160408051601f19818403018152908290526001600160e01b031960e087901b168252610c7d94939291600080516020611e6383398151915290600401611c8e565b6020604051808303816000875af1158015610c9c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cc09190611a9e565b9050610cca565b50825b979650505050505050565b60405162460ea360e61b81526004810185905260009081906001600160a01b03881690631183a8c090602401602060405180830381865afa158015610d1e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d4291906118d1565b9050336001600160a01b031663468721a78860008989602001518a60a001518a8a8d60c001518e60400151604051602401610d839796959493929190611cda565b60408051601f198184030181529181526020820180516001600160e01b0316635829492f60e11b1790525160e085901b6001600160e01b0319168152610dd1939291906000906004016119f8565b6020604051808303816000875af1158015610df0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e149190611a4e565b5060808501516001600160801b031615610f3f5760408051600180825281830190925260009160208083019080368337019050509050856000015181600081518110610e6257610e62611abb565b60200260200101906001600160a01b031690816001600160a01b031681525050336001600160a01b031663468721a7866000896080015185604051602401610eab929190611d3e565b60408051601f198184030181529181526020820180516001600160e01b0316634a231cef60e01b1790525160e085901b6001600160e01b0319168152610ef9939291906000906004016119f8565b6020604051808303816000875af1158015610f18573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f3c9190611a4e565b50505b8451604051602481018390526001600160a01b039091166044820152339063468721a790899060009060640160408051601f198184030181529181526020820180516001600160e01b031663320fbbb760e11b1790525160e085901b6001600160e01b0319168152610fb9939291906000906004016119f8565b6020604051808303816000875af1158015610fd8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ffc9190611a4e565b509695505050505050565b60006001600160801b0384161561101f5750816110a7565b604051638a54c52f60e01b81526001600160a01b03881690638a54c52f90611061908990600080516020611e638339815191529046908b908990600401611a6b565b6020604051808303816000875af1158015611080573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110a49190611a9e565b90505b9695505050505050565b60005b82518110156112fa5760008382815181106110d1576110d1611abb565b60200260200101519050336001600160a01b031663468721a78260400151600084600001518560a001516040516024016111299291906001600160a01b039290921682526001600160801b0316602082015260400190565b60408051601f198184030181529181526020820180516001600160e01b031663095ea7b360e01b1790525160e085901b6001600160e01b0319168152611177939291906000906004016119f8565b6020604051808303816000875af1158015611196573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111ba9190611a4e565b50336001600160a01b031663468721a78260000151600060405180610100016040528086602001516001600160a01b03168152602001886001600160a01b031681526020018660a001516001600160801b0316815260200186604001516001600160a01b031681526020018660c00151151581526020018660e001511515815260200186606001518152602001866080015181525060405160240161125f9190611d93565b60408051601f198184030181529181526020820180516001600160e01b03166353b1572760e01b1790525160e085901b6001600160e01b03191681526112ad939291906000906004016119f8565b6020604051808303816000875af11580156112cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112f09190611a4e565b50506001016110b4565b505050565b60006020828403121561131157600080fd5b81356001600160401b0381111561132757600080fd5b8201610160818503121561133a57600080fd5b9392505050565b6001600160a01b038116811461135657600080fd5b50565b60006020828403121561136b57600080fd5b813561133a81611341565b803561138181611341565b919050565b60008235603e1983360301811261139c57600080fd5b9190910192915050565b60008235605e1983360301811261139c57600080fd5b6000808335601e198436030181126113d357600080fd5b8301803591506001600160401b038211156113ed57600080fd5b6020019150600581901b360382131561140557600080fd5b9250929050565b634e487b7160e01b600052604160045260246000fd5b60405161010081016001600160401b03811182821017156114455761144561140c565b60405290565b60405160e081016001600160401b03811182821017156114455761144561140c565b604051601f8201601f191681016001600160401b03811182821017156114955761149561140c565b604052919050565b60006001600160401b038211156114b6576114b661140c565b5060051b60200190565b600082601f8301126114d157600080fd5b81356001600160401b038111156114ea576114ea61140c565b6114fd601f8201601f191660200161146d565b81815284602083860101111561151257600080fd5b816020850160208301376000918101602001919091529392505050565b803564ffffffffff8116811461138157600080fd5b60006060828403121561155657600080fd5b604051606081016001600160401b03811182821017156115785761157861140c565b6040529050806115878361152f565b81526115956020840161152f565b60208201526115a66040840161152f565b60408201525092915050565b6000604082840312156115c457600080fd5b604080519081016001600160401b03811182821017156115e6576115e661140c565b60405290508082356115f781611341565b8152602092830135920191909152919050565b80356001600160801b038116811461138157600080fd5b801515811461135657600080fd5b803561138181611621565b600082601f83011261164b57600080fd5b813561165e6116598261149d565b61146d565b808282526020820191506020610160840286010192508583111561168157600080fd5b602085015b8381101561173f57610160818803121561169f57600080fd5b6116a7611422565b6116b082611376565b81526116be60208301611376565b60208201526116cf60408301611376565b60408201526116e18860608401611544565b60608201526116f38860c084016115b2565b6080820152611705610100830161160a565b60a0820152611717610120830161162f565b60c0820152611729610140830161162f565b60e0820152835260209092019161016001611686565b5095945050505050565b803563ffffffff8116811461138157600080fd5b600061176b6116598461149d565b8381526020810190600585901b84013681111561178757600080fd5b845b818110156118905780356001600160401b038111156117a757600080fd5b860160e03682900312156117ba57600080fd5b6117c261144b565b6117cb82611376565b815260208201356001600160401b038111156117e657600080fd5b6117f2368285016114c0565b60208301525060408201356001600160401b0381111561181157600080fd5b61181d368285016114c0565b60408301525060608201356001600160401b0381111561183c57600080fd5b6118483682850161163a565b60608301525061185a6080830161160a565b608082015261186b60a08301611749565b60a082015261187c60c0830161162f565b60c082015285525060209384019301611789565b509095945050505050565b60005b838110156118b657818101518382015260200161189e565b50506000910152565b6000825161139c81846020870161189b565b6000602082840312156118e357600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b80820180821115611913576119136118ea565b92915050565b6000808335601e1984360301811261193057600080fd5b8301803591506001600160401b0382111561194a57600080fd5b60200191503681900382131561140557600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b03861681526060602082018190526000906119ad908301868861195f565b82810360408401526119c081858761195f565b98975050505050505050565b600081518084526119e481602086016020860161189b565b601f01601f19169290920160200192915050565b60018060a01b0385168152836020820152608060408201526000611a1f60808301856119cc565b905060028310611a3f57634e487b7160e01b600052602160045260246000fd5b82606083015295945050505050565b600060208284031215611a6057600080fd5b815161133a81611621565b6001600160a01b039586168152602081019490945260408401929092529092166060820152608081019190915260a00190565b600060208284031215611ab057600080fd5b815161133a81611341565b634e487b7160e01b600052603260045260246000fd5b600082825180855260208501945060208160051b8301016020850160005b83811015611b2157601f19858403018852611b0b8383516119cc565b6020988901989093509190910190600101611aef565b50909695505050505050565b604081526000611b406040830185611ad1565b8281036020840152611b528185611ad1565b95945050505050565b600060208284031215611b6d57600080fd5b813561133a81611621565b89815260e060208201526000611b9260e083018a8c61195f565b60ff891660408401526001600160a01b0388811660608501528716608084015285151560a084015282810360c0840152611bcd81858761195f565b9c9b505050505050505050505050565b60208152600061133a60208301846119cc565b6001600160a01b0384168152606060208201819052600090611c14908301856119cc565b9050826040830152949350505050565b600060018201611c3657611c366118ea565b5060010190565b634e487b7160e01b600052601260045260246000fd5b600082611c6257611c62611c3d565b500490565b81810381811115611913576119136118ea565b600082611c8957611c89611c3d565b500690565b60018060a01b038616815284602082015260a060408201526000611cb560a08301866119cc565b8281036060840152611cc781866119cc565b9150508260808301529695505050505050565b87815260e060208201526000611cf360e08301896119cc565b63ffffffff881660408401526001600160a01b0387811660608501528616608084015284151560a084015282810360c0840152611d3081856119cc565b9a9950505050505050505050565b6000604082016001600160801b03851683526040602084015280845180835260608501915060208601925060005b81811015611b215783516001600160a01b0316835260209384019390920191600101611d6c565b81516001600160a01b0390811682526020808401518216908301526040808401516001600160801b03169083015260608084015191821690830152610160820190506080830151611de8608084018215159052565b5060a0830151611dfc60a084018215159052565b5060c0830151611e3b60c084018264ffffffffff815116825264ffffffffff602082015116602083015264ffffffffff60408201511660408301525050565b5060e0929092015180516001600160a01b031661012083015260200151610140909101529056fe5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b5072a26469706673582212201f5f415bcb47b5bcc3f3fe15fa8e4612de722a3ea1aaa69d546320c040c561ba64736f6c634300081c0033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100365760003560e01c8063ba9a91a51461003b578063d58041b714610062575b600080fd5b610050600080516020611e6383398151915281565b60405190815260200160405180910390f35b6100756100703660046112ff565b610077565b005b6000806100cd61008a6020850185611359565b61009a6040860160208701611359565b6100aa60e0870160c08801611359565b6100ba60a0880160808901611359565b6100c8610100890189611386565b610227565b909250905060006101396100e46020860186611359565b6100f46040870160208801611359565b61010460e0880160c08901611359565b868661011660808b0160608c01611359565b61012660c08c0160a08d01611359565b6101346101208d018d6113a6565b610603565b604080516101208101909152909150610221908061015a6020880188611359565b6001600160a01b0316815260200186602001602081019061017b9190611359565b6001600160a01b0316815260200161019960e0880160c08901611359565b6001600160a01b03168152602001858152602001846001600160a01b031681526020018660400160208101906101cf9190611359565b6001600160a01b031681526020016101ee610100880160e08901611359565b6001600160a01b03168152602081018490526040016102116101408801886113bc565b61021a9161175d565b905261099f565b50505050565b60408051600481526024810182526020810180516001600160e01b0316633f0f816960e21b17905290516000918291829182916001600160a01b038b169161026e916118bf565b6000604051808303816000865af19150503d80600081146102ab576040519150601f19603f3d011682016040523d82523d6000602084013e6102b0565b606091505b5091509150816103065760405162461bcd60e51b815260206004820152601a60248201527f4661696c656420746f20676574206c617374546f704861744964000000000000604482015260640160405180910390fd5b60e08180602001905181019061031c91906118d1565b610327906001611900565b901b93503363468721a78a60008361033f8a80611919565b61034c60208d018d611919565b604051602401610360959493929190611988565b60408051601f198184030181529181526020820180516001600160e01b0316631a64dfad60e01b1790525160e085901b6001600160e01b03191681526103ae939291906000906004016119f8565b6020604051808303816000875af11580156103cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103f19190611a4e565b50604051638a54c52f60e01b81526001600160a01b03891690638a54c52f90610434908a90600080516020611e638339815191529046908f908b90600401611a6b565b6020604051808303816000875af1158015610453573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104779190611a9e565b60408051600180825281830190925291945060009190816020015b606081526020019060019003908161049257505060408051600180825281830190925291925060009190602082015b60608152602001906001900390816104c1579050509050604051806040016040528060088152602001671d1bdc12185d125960c21b8152508260008151811061050c5761050c611abb565b602002602001018190525061052086610a66565b8160008151811061053357610533611abb565b6020026020010181905250336001600160a01b031663468721a78960008585604051602401610563929190611b2d565b60408051601f198184030181529181526020820180516001600160e01b031663579374b960e11b1790525160e085901b6001600160e01b03191681526105b1939291906000906004016119f8565b6020604051808303816000875af11580156105d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105f49190611a4e565b50505050509550959350505050565b60405162460ea360e61b8152600481018690526000906001600160a01b038a1690631183a8c090602401602060405180830381865afa15801561064a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061066e91906118d1565b90503363468721a78a6000896106848780611919565b60018c8061069860608d0160408e01611b5b565b6106a560208e018e611919565b6040516024016106bd99989796959493929190611b78565b60408051601f198184030181529181526020820180516001600160e01b0316635829492f60e11b1790525160e085901b6001600160e01b031916815261070b939291906000906004016119f8565b6020604051808303816000875af115801561072a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061074e9190611a4e565b50604051638a54c52f60e01b81526001600160a01b03891690638a54c52f90610791908a90600080516020611e638339815191529046908f908890600401611a6b565b6020604051808303816000875af11580156107b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107d49190611a9e565b506000846001600160a01b031663f1ab873c85604051806020016040528060008152506040516024016108079190611bdd565b60408051601f19818403018152918152602080830180516001600160e01b031663a4f9edbf60e01b179052905161085991600080516020611e6383398151915291899101918252602082015260400190565b60408051601f198184030181529082905280516020909101206001600160e01b031960e086901b168252610891939291600401611bf0565b6020604051808303816000875af11580156108b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108d49190611a9e565b604051602481018490526001600160a01b0382166044820152909150339063468721a7908c9060009060640160408051601f198184030181529181526020820180516001600160e01b031663320fbbb760e11b1790525160e085901b6001600160e01b031916815261094e939291906000906004016119f8565b6020604051808303816000875af115801561096d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109919190611a4e565b505098975050505050505050565b60005b81610100015151811015610a6257600082610100015182815181106109c9576109c9611abb565b602002602001015190506000610a0084600001518560a001518660c00151876060015188608001518960e001518860800151610b6e565b90506000610a1d85600001518660e0015185858960800151610cd5565b90506000610a438660200151876040015188600001518760800151886000015187611007565b9050610a538460600151826110b1565b846001019450505050506109a2565b5050565b606081600003610a8d5750506040805180820190915260018152600360fc1b602082015290565b8160005b8115610ab75780610aa181611c24565b9150610ab09050600a83611c53565b9150610a91565b6000816001600160401b03811115610ad157610ad161140c565b6040519080825280601f01601f191660200182016040528015610afb576020820181803683370190505b5090505b8415610b6657610b10600183611c67565b9150610b1d600a86611c7a565b610b28906030611900565b60f81b818381518110610b3d57610b3d611abb565b60200101906001600160f81b031916908160001a905350610b5f600a86611c53565b9450610aff565b949350505050565b60006001600160801b03821615610cc757866001600160a01b0316632f7fb7b6878a6001600160a01b0316631183a8c0876040518263ffffffff1660e01b8152600401610bbd91815260200190565b602060405180830381865afa158015610bda573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bfe91906118d1565b886000604051602001610c1b929190918252602082015260400190565b60408051601f198184030181528282526001600160801b0389166020840152910160408051601f19818403018152908290526001600160e01b031960e087901b168252610c7d94939291600080516020611e6383398151915290600401611c8e565b6020604051808303816000875af1158015610c9c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cc09190611a9e565b9050610cca565b50825b979650505050505050565b60405162460ea360e61b81526004810185905260009081906001600160a01b03881690631183a8c090602401602060405180830381865afa158015610d1e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d4291906118d1565b9050336001600160a01b031663468721a78860008989602001518a60a001518a8a8d60c001518e60400151604051602401610d839796959493929190611cda565b60408051601f198184030181529181526020820180516001600160e01b0316635829492f60e11b1790525160e085901b6001600160e01b0319168152610dd1939291906000906004016119f8565b6020604051808303816000875af1158015610df0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e149190611a4e565b5060808501516001600160801b031615610f3f5760408051600180825281830190925260009160208083019080368337019050509050856000015181600081518110610e6257610e62611abb565b60200260200101906001600160a01b031690816001600160a01b031681525050336001600160a01b031663468721a7866000896080015185604051602401610eab929190611d3e565b60408051601f198184030181529181526020820180516001600160e01b0316634a231cef60e01b1790525160e085901b6001600160e01b0319168152610ef9939291906000906004016119f8565b6020604051808303816000875af1158015610f18573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f3c9190611a4e565b50505b8451604051602481018390526001600160a01b039091166044820152339063468721a790899060009060640160408051601f198184030181529181526020820180516001600160e01b031663320fbbb760e11b1790525160e085901b6001600160e01b0319168152610fb9939291906000906004016119f8565b6020604051808303816000875af1158015610fd8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ffc9190611a4e565b509695505050505050565b60006001600160801b0384161561101f5750816110a7565b604051638a54c52f60e01b81526001600160a01b03881690638a54c52f90611061908990600080516020611e638339815191529046908b908990600401611a6b565b6020604051808303816000875af1158015611080573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110a49190611a9e565b90505b9695505050505050565b60005b82518110156112fa5760008382815181106110d1576110d1611abb565b60200260200101519050336001600160a01b031663468721a78260400151600084600001518560a001516040516024016111299291906001600160a01b039290921682526001600160801b0316602082015260400190565b60408051601f198184030181529181526020820180516001600160e01b031663095ea7b360e01b1790525160e085901b6001600160e01b0319168152611177939291906000906004016119f8565b6020604051808303816000875af1158015611196573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111ba9190611a4e565b50336001600160a01b031663468721a78260000151600060405180610100016040528086602001516001600160a01b03168152602001886001600160a01b031681526020018660a001516001600160801b0316815260200186604001516001600160a01b031681526020018660c00151151581526020018660e001511515815260200186606001518152602001866080015181525060405160240161125f9190611d93565b60408051601f198184030181529181526020820180516001600160e01b03166353b1572760e01b1790525160e085901b6001600160e01b03191681526112ad939291906000906004016119f8565b6020604051808303816000875af11580156112cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112f09190611a4e565b50506001016110b4565b505050565b60006020828403121561131157600080fd5b81356001600160401b0381111561132757600080fd5b8201610160818503121561133a57600080fd5b9392505050565b6001600160a01b038116811461135657600080fd5b50565b60006020828403121561136b57600080fd5b813561133a81611341565b803561138181611341565b919050565b60008235603e1983360301811261139c57600080fd5b9190910192915050565b60008235605e1983360301811261139c57600080fd5b6000808335601e198436030181126113d357600080fd5b8301803591506001600160401b038211156113ed57600080fd5b6020019150600581901b360382131561140557600080fd5b9250929050565b634e487b7160e01b600052604160045260246000fd5b60405161010081016001600160401b03811182821017156114455761144561140c565b60405290565b60405160e081016001600160401b03811182821017156114455761144561140c565b604051601f8201601f191681016001600160401b03811182821017156114955761149561140c565b604052919050565b60006001600160401b038211156114b6576114b661140c565b5060051b60200190565b600082601f8301126114d157600080fd5b81356001600160401b038111156114ea576114ea61140c565b6114fd601f8201601f191660200161146d565b81815284602083860101111561151257600080fd5b816020850160208301376000918101602001919091529392505050565b803564ffffffffff8116811461138157600080fd5b60006060828403121561155657600080fd5b604051606081016001600160401b03811182821017156115785761157861140c565b6040529050806115878361152f565b81526115956020840161152f565b60208201526115a66040840161152f565b60408201525092915050565b6000604082840312156115c457600080fd5b604080519081016001600160401b03811182821017156115e6576115e661140c565b60405290508082356115f781611341565b8152602092830135920191909152919050565b80356001600160801b038116811461138157600080fd5b801515811461135657600080fd5b803561138181611621565b600082601f83011261164b57600080fd5b813561165e6116598261149d565b61146d565b808282526020820191506020610160840286010192508583111561168157600080fd5b602085015b8381101561173f57610160818803121561169f57600080fd5b6116a7611422565b6116b082611376565b81526116be60208301611376565b60208201526116cf60408301611376565b60408201526116e18860608401611544565b60608201526116f38860c084016115b2565b6080820152611705610100830161160a565b60a0820152611717610120830161162f565b60c0820152611729610140830161162f565b60e0820152835260209092019161016001611686565b5095945050505050565b803563ffffffff8116811461138157600080fd5b600061176b6116598461149d565b8381526020810190600585901b84013681111561178757600080fd5b845b818110156118905780356001600160401b038111156117a757600080fd5b860160e03682900312156117ba57600080fd5b6117c261144b565b6117cb82611376565b815260208201356001600160401b038111156117e657600080fd5b6117f2368285016114c0565b60208301525060408201356001600160401b0381111561181157600080fd5b61181d368285016114c0565b60408301525060608201356001600160401b0381111561183c57600080fd5b6118483682850161163a565b60608301525061185a6080830161160a565b608082015261186b60a08301611749565b60a082015261187c60c0830161162f565b60c082015285525060209384019301611789565b509095945050505050565b60005b838110156118b657818101518382015260200161189e565b50506000910152565b6000825161139c81846020870161189b565b6000602082840312156118e357600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b80820180821115611913576119136118ea565b92915050565b6000808335601e1984360301811261193057600080fd5b8301803591506001600160401b0382111561194a57600080fd5b60200191503681900382131561140557600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b03861681526060602082018190526000906119ad908301868861195f565b82810360408401526119c081858761195f565b98975050505050505050565b600081518084526119e481602086016020860161189b565b601f01601f19169290920160200192915050565b60018060a01b0385168152836020820152608060408201526000611a1f60808301856119cc565b905060028310611a3f57634e487b7160e01b600052602160045260246000fd5b82606083015295945050505050565b600060208284031215611a6057600080fd5b815161133a81611621565b6001600160a01b039586168152602081019490945260408401929092529092166060820152608081019190915260a00190565b600060208284031215611ab057600080fd5b815161133a81611341565b634e487b7160e01b600052603260045260246000fd5b600082825180855260208501945060208160051b8301016020850160005b83811015611b2157601f19858403018852611b0b8383516119cc565b6020988901989093509190910190600101611aef565b50909695505050505050565b604081526000611b406040830185611ad1565b8281036020840152611b528185611ad1565b95945050505050565b600060208284031215611b6d57600080fd5b813561133a81611621565b89815260e060208201526000611b9260e083018a8c61195f565b60ff891660408401526001600160a01b0388811660608501528716608084015285151560a084015282810360c0840152611bcd81858761195f565b9c9b505050505050505050505050565b60208152600061133a60208301846119cc565b6001600160a01b0384168152606060208201819052600090611c14908301856119cc565b9050826040830152949350505050565b600060018201611c3657611c366118ea565b5060010190565b634e487b7160e01b600052601260045260246000fd5b600082611c6257611c62611c3d565b500490565b81810381811115611913576119136118ea565b600082611c8957611c89611c3d565b500690565b60018060a01b038616815284602082015260a060408201526000611cb560a08301866119cc565b8281036060840152611cc781866119cc565b9150508260808301529695505050505050565b87815260e060208201526000611cf360e08301896119cc565b63ffffffff881660408401526001600160a01b0387811660608501528616608084015284151560a084015282810360c0840152611d3081856119cc565b9a9950505050505050505050565b6000604082016001600160801b03851683526040602084015280845180835260608501915060208601925060005b81811015611b215783516001600160a01b0316835260209384019390920191600101611d6c565b81516001600160a01b0390811682526020808401518216908301526040808401516001600160801b03169083015260608084015191821690830152610160820190506080830151611de8608084018215159052565b5060a0830151611dfc60a084018215159052565b5060c0830151611e3b60c084018264ffffffffff815116825264ffffffffff602082015116602083015264ffffffffff60408201511660408301525050565b5060e0929092015180516001600160a01b031661012083015260200151610140909101529056fe5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b5072a26469706673582212201f5f415bcb47b5bcc3f3fe15fa8e4612de722a3ea1aaa69d546320c040c561ba64736f6c634300081c0033", + "numDeployments": 2, + "solcInputHash": "f1fca9a70591742a2aedd10e2fd7e744", + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"SALT\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"contract IHats\",\"name\":\"hatsProtocol\",\"type\":\"address\"},{\"internalType\":\"contract IERC6551Registry\",\"name\":\"erc6551Registry\",\"type\":\"address\"},{\"internalType\":\"contract IHatsModuleFactory\",\"name\":\"hatsModuleFactory\",\"type\":\"address\"},{\"internalType\":\"contract ModuleProxyFactory\",\"name\":\"moduleProxyFactory\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"keyValuePairs\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"decentAutonomousAdminImplementation\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"hatsAccountImplementation\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"hatsElectionsEligibilityImplementation\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"string\",\"name\":\"details\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"imageURI\",\"type\":\"string\"}],\"internalType\":\"struct DecentHatsCreationModule.TopHatParams\",\"name\":\"topHat\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"string\",\"name\":\"details\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"imageURI\",\"type\":\"string\"},{\"internalType\":\"bool\",\"name\":\"isMutable\",\"type\":\"bool\"}],\"internalType\":\"struct DecentHatsCreationModule.AdminHatParams\",\"name\":\"adminHat\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"wearer\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"details\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"imageURI\",\"type\":\"string\"},{\"components\":[{\"internalType\":\"contract ISablierV2LockupLinear\",\"name\":\"sablier\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint40\",\"name\":\"start\",\"type\":\"uint40\"},{\"internalType\":\"uint40\",\"name\":\"cliff\",\"type\":\"uint40\"},{\"internalType\":\"uint40\",\"name\":\"end\",\"type\":\"uint40\"}],\"internalType\":\"struct LockupLinear.Timestamps\",\"name\":\"timestamps\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"UD60x18\",\"name\":\"fee\",\"type\":\"uint256\"}],\"internalType\":\"struct Broker\",\"name\":\"broker\",\"type\":\"tuple\"},{\"internalType\":\"uint128\",\"name\":\"totalAmount\",\"type\":\"uint128\"},{\"internalType\":\"bool\",\"name\":\"cancelable\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"transferable\",\"type\":\"bool\"}],\"internalType\":\"struct DecentHatsModuleUtils.SablierStreamParams[]\",\"name\":\"sablierStreamsParams\",\"type\":\"tuple[]\"},{\"internalType\":\"uint128\",\"name\":\"termEndDateTs\",\"type\":\"uint128\"},{\"internalType\":\"uint32\",\"name\":\"maxSupply\",\"type\":\"uint32\"},{\"internalType\":\"bool\",\"name\":\"isMutable\",\"type\":\"bool\"}],\"internalType\":\"struct DecentHatsModuleUtils.HatParams[]\",\"name\":\"hats\",\"type\":\"tuple[]\"}],\"internalType\":\"struct DecentHatsCreationModule.CreateTreeParams\",\"name\":\"treeParams\",\"type\":\"tuple\"}],\"name\":\"createAndDeclareTree\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"createAndDeclareTree((address,address,address,address,address,address,address,address,(string,string),(string,string,bool),(address,string,string,(address,address,address,(uint40,uint40,uint40),(address,uint256),uint128,bool,bool)[],uint128,uint32,bool)[]))\":{\"details\":\"For each hat that is included, if the hat is: - termed, its stream funds on are targeted directly at the nominated wearer. The wearer should directly call `withdraw-` on the Sablier contract. - untermed, its stream funds are targeted at the hat's smart account. In order to withdraw funds from the stream, the hat's smart account must be the one call to `withdraw-` on the Sablier contract, setting the recipient arg to its wearer.In order for a Safe to seamlessly create roles even if it has never previously created a role and thus has no hat tree, we defer the creation of the hat tree and its setup to this contract. This way, in a single tx block, the resulting topHatId of the newly created hat can be used to create an admin hat and any other hats needed. We also make use of `KeyValuePairs` to associate the topHatId with the Safe.\",\"params\":{\"treeParams\":\"The parameters for creating the Hat Tree with Roles\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"createAndDeclareTree((address,address,address,address,address,address,address,address,(string,string),(string,string,bool),(address,string,string,(address,address,address,(uint40,uint40,uint40),(address,uint256),uint128,bool,bool)[],uint128,uint32,bool)[]))\":{\"notice\":\"For a safe without any roles previously created on it, this function should be called. It sets up the top hat and admin hat, as well as any other hats and their streams that are provided, then transfers the top hat to the calling safe.This contract should be enabled a module on the Safe for which the role(s) are to be created, and disabled after.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/modules/DecentHatsCreationModule.sol\":\"DecentHatsCreationModule\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\npragma solidity >=0.7.0 <0.9.0;\\n\\n/// @title Enum - Collection of enums\\n/// @author Richard Meissner - \\ncontract Enum {\\n enum Operation {Call, DelegateCall}\\n}\\n\",\"keccak256\":\"0x473e45b1a5cc47be494b0e123c9127f0c11c1e0992a321ae5a644c0bfdb2c14f\",\"license\":\"LGPL-3.0-only\"},\"@gnosis.pm/zodiac/contracts/factory/ModuleProxyFactory.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\npragma solidity >=0.8.0;\\n\\ncontract ModuleProxyFactory {\\n event ModuleProxyCreation(\\n address indexed proxy,\\n address indexed masterCopy\\n );\\n\\n /// `target` can not be zero.\\n error ZeroAddress(address target);\\n\\n /// `address_` is already taken.\\n error TakenAddress(address address_);\\n\\n /// @notice Initialization failed.\\n error FailedInitialization();\\n\\n function createProxy(address target, bytes32 salt)\\n internal\\n returns (address result)\\n {\\n if (address(target) == address(0)) revert ZeroAddress(target);\\n bytes memory deployment = abi.encodePacked(\\n hex\\\"602d8060093d393df3363d3d373d3d3d363d73\\\",\\n target,\\n hex\\\"5af43d82803e903d91602b57fd5bf3\\\"\\n );\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n result := create2(0, add(deployment, 0x20), mload(deployment), salt)\\n }\\n if (result == address(0)) revert TakenAddress(result);\\n }\\n\\n function deployModule(\\n address masterCopy,\\n bytes memory initializer,\\n uint256 saltNonce\\n ) public returns (address proxy) {\\n proxy = createProxy(\\n masterCopy,\\n keccak256(abi.encodePacked(keccak256(initializer), saltNonce))\\n );\\n (bool success, ) = proxy.call(initializer);\\n if (!success) revert FailedInitialization();\\n\\n emit ModuleProxyCreation(proxy, masterCopy);\\n }\\n}\\n\",\"keccak256\":\"0x70f6f1d88cf3382748e58f85ba87279f5bb8761863c293dd8c197a71ff558761\",\"license\":\"LGPL-3.0-only\"},\"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\n\\n/// @title Zodiac Avatar - A contract that manages modules that can execute transactions via this contract.\\npragma solidity >=0.7.0 <0.9.0;\\n\\nimport \\\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\\\";\\n\\ninterface IAvatar {\\n event EnabledModule(address module);\\n event DisabledModule(address module);\\n event ExecutionFromModuleSuccess(address indexed module);\\n event ExecutionFromModuleFailure(address indexed module);\\n\\n /// @dev Enables a module on the avatar.\\n /// @notice Can only be called by the avatar.\\n /// @notice Modules should be stored as a linked list.\\n /// @notice Must emit EnabledModule(address module) if successful.\\n /// @param module Module to be enabled.\\n function enableModule(address module) external;\\n\\n /// @dev Disables a module on the avatar.\\n /// @notice Can only be called by the avatar.\\n /// @notice Must emit DisabledModule(address module) if successful.\\n /// @param prevModule Address that pointed to the module to be removed in the linked list\\n /// @param module Module to be removed.\\n function disableModule(address prevModule, address module) external;\\n\\n /// @dev Allows a Module to execute a transaction.\\n /// @notice Can only be called by an enabled module.\\n /// @notice Must emit ExecutionFromModuleSuccess(address module) if successful.\\n /// @notice Must emit ExecutionFromModuleFailure(address module) if unsuccessful.\\n /// @param to Destination address of module transaction.\\n /// @param value Ether value of module transaction.\\n /// @param data Data payload of module transaction.\\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\\n function execTransactionFromModule(\\n address to,\\n uint256 value,\\n bytes memory data,\\n Enum.Operation operation\\n ) external returns (bool success);\\n\\n /// @dev Allows a Module to execute a transaction and return data\\n /// @notice Can only be called by an enabled module.\\n /// @notice Must emit ExecutionFromModuleSuccess(address module) if successful.\\n /// @notice Must emit ExecutionFromModuleFailure(address module) if unsuccessful.\\n /// @param to Destination address of module transaction.\\n /// @param value Ether value of module transaction.\\n /// @param data Data payload of module transaction.\\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\\n function execTransactionFromModuleReturnData(\\n address to,\\n uint256 value,\\n bytes memory data,\\n Enum.Operation operation\\n ) external returns (bool success, bytes memory returnData);\\n\\n /// @dev Returns if an module is enabled\\n /// @return True if the module is enabled\\n function isModuleEnabled(address module) external view returns (bool);\\n\\n /// @dev Returns array of modules.\\n /// @param start Start of the page.\\n /// @param pageSize Maximum number of modules that should be returned.\\n /// @return array Array of modules.\\n /// @return next Start of the next page.\\n function getModulesPaginated(address start, uint256 pageSize)\\n external\\n view\\n returns (address[] memory array, address next);\\n}\\n\",\"keccak256\":\"0xcd5508ffe596eef8fbccfd5fc4f10a34397773547ce64e212d48b5212865ec1f\",\"license\":\"LGPL-3.0-only\"},\"@openzeppelin/contracts/interfaces/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/introspection/IERC165.sol\\\";\\n\",\"keccak256\":\"0xd04b0f06e0666f29cf7cccc82894de541e19bb30a765b107b1e40bb7fe5f7d7a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev 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 amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `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 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes calldata data\\n ) external;\\n\\n /**\\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 {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the caller.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool _approved) external;\\n\\n /**\\n * @dev Returns 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\",\"keccak256\":\"0xed6a749c5373af398105ce6ee3ac4763aa450ea7285d268c85d9eeca809cdb1f\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../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\",\"keccak256\":\"0x75b829ff2f26c14355d1cba20e16fe7b29ca58eb5fef665ede48bc0f9c6c74b9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _HEX_SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\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 // Inspired by OraclizeAPI's implementation - MIT licence\\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\\n\\n if (value == 0) {\\n return \\\"0\\\";\\n }\\n uint256 temp = value;\\n uint256 digits;\\n while (temp != 0) {\\n digits++;\\n temp /= 10;\\n }\\n bytes memory buffer = new bytes(digits);\\n while (value != 0) {\\n digits -= 1;\\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\\n value /= 10;\\n }\\n return string(buffer);\\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 if (value == 0) {\\n return \\\"0x00\\\";\\n }\\n uint256 temp = value;\\n uint256 length = 0;\\n while (temp != 0) {\\n length++;\\n temp >>= 8;\\n }\\n return toHexString(value, length);\\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 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_SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\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 representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n}\\n\",\"keccak256\":\"0xaf159a8b1923ad2a26d516089bceca9bdeaeacd04be50983ea00ba63070f08a3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"@prb/math/src/Common.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\n// Common.sol\\n//\\n// Common mathematical functions used in both SD59x18 and UD60x18. Note that these global functions do not\\n// always operate with SD59x18 and UD60x18 numbers.\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CUSTOM ERRORS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @notice Thrown when the resultant value in {mulDiv} overflows uint256.\\nerror PRBMath_MulDiv_Overflow(uint256 x, uint256 y, uint256 denominator);\\n\\n/// @notice Thrown when the resultant value in {mulDiv18} overflows uint256.\\nerror PRBMath_MulDiv18_Overflow(uint256 x, uint256 y);\\n\\n/// @notice Thrown when one of the inputs passed to {mulDivSigned} is `type(int256).min`.\\nerror PRBMath_MulDivSigned_InputTooSmall();\\n\\n/// @notice Thrown when the resultant value in {mulDivSigned} overflows int256.\\nerror PRBMath_MulDivSigned_Overflow(int256 x, int256 y);\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CONSTANTS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @dev The maximum value a uint128 number can have.\\nuint128 constant MAX_UINT128 = type(uint128).max;\\n\\n/// @dev The maximum value a uint40 number can have.\\nuint40 constant MAX_UINT40 = type(uint40).max;\\n\\n/// @dev The unit number, which the decimal precision of the fixed-point types.\\nuint256 constant UNIT = 1e18;\\n\\n/// @dev The unit number inverted mod 2^256.\\nuint256 constant UNIT_INVERSE = 78156646155174841979727994598816262306175212592076161876661_508869554232690281;\\n\\n/// @dev The the largest power of two that divides the decimal value of `UNIT`. The logarithm of this value is the least significant\\n/// bit in the binary representation of `UNIT`.\\nuint256 constant UNIT_LPOTD = 262144;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @notice Calculates the binary exponent of x using the binary fraction method.\\n/// @dev Has to use 192.64-bit fixed-point numbers. See https://ethereum.stackexchange.com/a/96594/24693.\\n/// @param x The exponent as an unsigned 192.64-bit fixed-point number.\\n/// @return result The result as an unsigned 60.18-decimal fixed-point number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp2(uint256 x) pure returns (uint256 result) {\\n unchecked {\\n // Start from 0.5 in the 192.64-bit fixed-point format.\\n result = 0x800000000000000000000000000000000000000000000000;\\n\\n // The following logic multiplies the result by $\\\\sqrt{2^{-i}}$ when the bit at position i is 1. Key points:\\n //\\n // 1. Intermediate results will not overflow, as the starting point is 2^191 and all magic factors are under 2^65.\\n // 2. The rationale for organizing the if statements into groups of 8 is gas savings. If the result of performing\\n // a bitwise AND operation between x and any value in the array [0x80; 0x40; 0x20; 0x10; 0x08; 0x04; 0x02; 0x01] is 1,\\n // we know that `x & 0xFF` is also 1.\\n if (x & 0xFF00000000000000 > 0) {\\n if (x & 0x8000000000000000 > 0) {\\n result = (result * 0x16A09E667F3BCC909) >> 64;\\n }\\n if (x & 0x4000000000000000 > 0) {\\n result = (result * 0x1306FE0A31B7152DF) >> 64;\\n }\\n if (x & 0x2000000000000000 > 0) {\\n result = (result * 0x1172B83C7D517ADCE) >> 64;\\n }\\n if (x & 0x1000000000000000 > 0) {\\n result = (result * 0x10B5586CF9890F62A) >> 64;\\n }\\n if (x & 0x800000000000000 > 0) {\\n result = (result * 0x1059B0D31585743AE) >> 64;\\n }\\n if (x & 0x400000000000000 > 0) {\\n result = (result * 0x102C9A3E778060EE7) >> 64;\\n }\\n if (x & 0x200000000000000 > 0) {\\n result = (result * 0x10163DA9FB33356D8) >> 64;\\n }\\n if (x & 0x100000000000000 > 0) {\\n result = (result * 0x100B1AFA5ABCBED61) >> 64;\\n }\\n }\\n\\n if (x & 0xFF000000000000 > 0) {\\n if (x & 0x80000000000000 > 0) {\\n result = (result * 0x10058C86DA1C09EA2) >> 64;\\n }\\n if (x & 0x40000000000000 > 0) {\\n result = (result * 0x1002C605E2E8CEC50) >> 64;\\n }\\n if (x & 0x20000000000000 > 0) {\\n result = (result * 0x100162F3904051FA1) >> 64;\\n }\\n if (x & 0x10000000000000 > 0) {\\n result = (result * 0x1000B175EFFDC76BA) >> 64;\\n }\\n if (x & 0x8000000000000 > 0) {\\n result = (result * 0x100058BA01FB9F96D) >> 64;\\n }\\n if (x & 0x4000000000000 > 0) {\\n result = (result * 0x10002C5CC37DA9492) >> 64;\\n }\\n if (x & 0x2000000000000 > 0) {\\n result = (result * 0x1000162E525EE0547) >> 64;\\n }\\n if (x & 0x1000000000000 > 0) {\\n result = (result * 0x10000B17255775C04) >> 64;\\n }\\n }\\n\\n if (x & 0xFF0000000000 > 0) {\\n if (x & 0x800000000000 > 0) {\\n result = (result * 0x1000058B91B5BC9AE) >> 64;\\n }\\n if (x & 0x400000000000 > 0) {\\n result = (result * 0x100002C5C89D5EC6D) >> 64;\\n }\\n if (x & 0x200000000000 > 0) {\\n result = (result * 0x10000162E43F4F831) >> 64;\\n }\\n if (x & 0x100000000000 > 0) {\\n result = (result * 0x100000B1721BCFC9A) >> 64;\\n }\\n if (x & 0x80000000000 > 0) {\\n result = (result * 0x10000058B90CF1E6E) >> 64;\\n }\\n if (x & 0x40000000000 > 0) {\\n result = (result * 0x1000002C5C863B73F) >> 64;\\n }\\n if (x & 0x20000000000 > 0) {\\n result = (result * 0x100000162E430E5A2) >> 64;\\n }\\n if (x & 0x10000000000 > 0) {\\n result = (result * 0x1000000B172183551) >> 64;\\n }\\n }\\n\\n if (x & 0xFF00000000 > 0) {\\n if (x & 0x8000000000 > 0) {\\n result = (result * 0x100000058B90C0B49) >> 64;\\n }\\n if (x & 0x4000000000 > 0) {\\n result = (result * 0x10000002C5C8601CC) >> 64;\\n }\\n if (x & 0x2000000000 > 0) {\\n result = (result * 0x1000000162E42FFF0) >> 64;\\n }\\n if (x & 0x1000000000 > 0) {\\n result = (result * 0x10000000B17217FBB) >> 64;\\n }\\n if (x & 0x800000000 > 0) {\\n result = (result * 0x1000000058B90BFCE) >> 64;\\n }\\n if (x & 0x400000000 > 0) {\\n result = (result * 0x100000002C5C85FE3) >> 64;\\n }\\n if (x & 0x200000000 > 0) {\\n result = (result * 0x10000000162E42FF1) >> 64;\\n }\\n if (x & 0x100000000 > 0) {\\n result = (result * 0x100000000B17217F8) >> 64;\\n }\\n }\\n\\n if (x & 0xFF000000 > 0) {\\n if (x & 0x80000000 > 0) {\\n result = (result * 0x10000000058B90BFC) >> 64;\\n }\\n if (x & 0x40000000 > 0) {\\n result = (result * 0x1000000002C5C85FE) >> 64;\\n }\\n if (x & 0x20000000 > 0) {\\n result = (result * 0x100000000162E42FF) >> 64;\\n }\\n if (x & 0x10000000 > 0) {\\n result = (result * 0x1000000000B17217F) >> 64;\\n }\\n if (x & 0x8000000 > 0) {\\n result = (result * 0x100000000058B90C0) >> 64;\\n }\\n if (x & 0x4000000 > 0) {\\n result = (result * 0x10000000002C5C860) >> 64;\\n }\\n if (x & 0x2000000 > 0) {\\n result = (result * 0x1000000000162E430) >> 64;\\n }\\n if (x & 0x1000000 > 0) {\\n result = (result * 0x10000000000B17218) >> 64;\\n }\\n }\\n\\n if (x & 0xFF0000 > 0) {\\n if (x & 0x800000 > 0) {\\n result = (result * 0x1000000000058B90C) >> 64;\\n }\\n if (x & 0x400000 > 0) {\\n result = (result * 0x100000000002C5C86) >> 64;\\n }\\n if (x & 0x200000 > 0) {\\n result = (result * 0x10000000000162E43) >> 64;\\n }\\n if (x & 0x100000 > 0) {\\n result = (result * 0x100000000000B1721) >> 64;\\n }\\n if (x & 0x80000 > 0) {\\n result = (result * 0x10000000000058B91) >> 64;\\n }\\n if (x & 0x40000 > 0) {\\n result = (result * 0x1000000000002C5C8) >> 64;\\n }\\n if (x & 0x20000 > 0) {\\n result = (result * 0x100000000000162E4) >> 64;\\n }\\n if (x & 0x10000 > 0) {\\n result = (result * 0x1000000000000B172) >> 64;\\n }\\n }\\n\\n if (x & 0xFF00 > 0) {\\n if (x & 0x8000 > 0) {\\n result = (result * 0x100000000000058B9) >> 64;\\n }\\n if (x & 0x4000 > 0) {\\n result = (result * 0x10000000000002C5D) >> 64;\\n }\\n if (x & 0x2000 > 0) {\\n result = (result * 0x1000000000000162E) >> 64;\\n }\\n if (x & 0x1000 > 0) {\\n result = (result * 0x10000000000000B17) >> 64;\\n }\\n if (x & 0x800 > 0) {\\n result = (result * 0x1000000000000058C) >> 64;\\n }\\n if (x & 0x400 > 0) {\\n result = (result * 0x100000000000002C6) >> 64;\\n }\\n if (x & 0x200 > 0) {\\n result = (result * 0x10000000000000163) >> 64;\\n }\\n if (x & 0x100 > 0) {\\n result = (result * 0x100000000000000B1) >> 64;\\n }\\n }\\n\\n if (x & 0xFF > 0) {\\n if (x & 0x80 > 0) {\\n result = (result * 0x10000000000000059) >> 64;\\n }\\n if (x & 0x40 > 0) {\\n result = (result * 0x1000000000000002C) >> 64;\\n }\\n if (x & 0x20 > 0) {\\n result = (result * 0x10000000000000016) >> 64;\\n }\\n if (x & 0x10 > 0) {\\n result = (result * 0x1000000000000000B) >> 64;\\n }\\n if (x & 0x8 > 0) {\\n result = (result * 0x10000000000000006) >> 64;\\n }\\n if (x & 0x4 > 0) {\\n result = (result * 0x10000000000000003) >> 64;\\n }\\n if (x & 0x2 > 0) {\\n result = (result * 0x10000000000000001) >> 64;\\n }\\n if (x & 0x1 > 0) {\\n result = (result * 0x10000000000000001) >> 64;\\n }\\n }\\n\\n // In the code snippet below, two operations are executed simultaneously:\\n //\\n // 1. The result is multiplied by $(2^n + 1)$, where $2^n$ represents the integer part, and the additional 1\\n // accounts for the initial guess of 0.5. This is achieved by subtracting from 191 instead of 192.\\n // 2. The result is then converted to an unsigned 60.18-decimal fixed-point format.\\n //\\n // The underlying logic is based on the relationship $2^{191-ip} = 2^{ip} / 2^{191}$, where $ip$ denotes the,\\n // integer part, $2^n$.\\n result *= UNIT;\\n result >>= (191 - (x >> 64));\\n }\\n}\\n\\n/// @notice Finds the zero-based index of the first 1 in the binary representation of x.\\n///\\n/// @dev See the note on \\\"msb\\\" in this Wikipedia article: https://en.wikipedia.org/wiki/Find_first_set\\n///\\n/// Each step in this implementation is equivalent to this high-level code:\\n///\\n/// ```solidity\\n/// if (x >= 2 ** 128) {\\n/// x >>= 128;\\n/// result += 128;\\n/// }\\n/// ```\\n///\\n/// Where 128 is replaced with each respective power of two factor. See the full high-level implementation here:\\n/// https://gist.github.com/PaulRBerg/f932f8693f2733e30c4d479e8e980948\\n///\\n/// The Yul instructions used below are:\\n///\\n/// - \\\"gt\\\" is \\\"greater than\\\"\\n/// - \\\"or\\\" is the OR bitwise operator\\n/// - \\\"shl\\\" is \\\"shift left\\\"\\n/// - \\\"shr\\\" is \\\"shift right\\\"\\n///\\n/// @param x The uint256 number for which to find the index of the most significant bit.\\n/// @return result The index of the most significant bit as a uint256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction msb(uint256 x) pure returns (uint256 result) {\\n // 2^128\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(7, gt(x, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^64\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(6, gt(x, 0xFFFFFFFFFFFFFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^32\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(5, gt(x, 0xFFFFFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^16\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(4, gt(x, 0xFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^8\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(3, gt(x, 0xFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^4\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(2, gt(x, 0xF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^2\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(1, gt(x, 0x3))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^1\\n // No need to shift x any more.\\n assembly (\\\"memory-safe\\\") {\\n let factor := gt(x, 0x1)\\n result := or(result, factor)\\n }\\n}\\n\\n/// @notice Calculates x*y\\u00f7denominator with 512-bit precision.\\n///\\n/// @dev Credits to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv.\\n///\\n/// Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - The denominator must not be zero.\\n/// - The result must fit in uint256.\\n///\\n/// @param x The multiplicand as a uint256.\\n/// @param y The multiplier as a uint256.\\n/// @param denominator The divisor as a uint256.\\n/// @return result The result as a uint256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mulDiv(uint256 x, uint256 y, uint256 denominator) pure returns (uint256 result) {\\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; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly (\\\"memory-safe\\\") {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\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 unchecked {\\n return prod0 / denominator;\\n }\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n if (prod1 >= denominator) {\\n revert PRBMath_MulDiv_Overflow(x, y, denominator);\\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 (\\\"memory-safe\\\") {\\n // Compute remainder using the mulmod Yul instruction.\\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 unchecked {\\n // Calculate the largest power of two divisor of the denominator using the unary operator ~. This operation cannot overflow\\n // because the denominator cannot be zero at this point in the function execution. The result is always >= 1.\\n // For more detail, see https://cs.stackexchange.com/q/138556/92363.\\n uint256 lpotdod = denominator & (~denominator + 1);\\n uint256 flippedLpotdod;\\n\\n assembly (\\\"memory-safe\\\") {\\n // Factor powers of two out of denominator.\\n denominator := div(denominator, lpotdod)\\n\\n // Divide [prod1 prod0] by lpotdod.\\n prod0 := div(prod0, lpotdod)\\n\\n // Get the flipped value `2^256 / lpotdod`. If the `lpotdod` is zero, the flipped value is one.\\n // `sub(0, lpotdod)` produces the two's complement version of `lpotdod`, which is equivalent to flipping all the bits.\\n // However, `div` interprets this value as an unsigned value: https://ethereum.stackexchange.com/q/147168/24693\\n flippedLpotdod := add(div(sub(0, lpotdod), lpotdod), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * flippedLpotdod;\\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 works\\n // 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 }\\n}\\n\\n/// @notice Calculates x*y\\u00f71e18 with 512-bit precision.\\n///\\n/// @dev A variant of {mulDiv} with constant folding, i.e. in which the denominator is hard coded to 1e18.\\n///\\n/// Notes:\\n/// - The body is purposely left uncommented; to understand how this works, see the documentation in {mulDiv}.\\n/// - The result is rounded toward zero.\\n/// - We take as an axiom that the result cannot be `MAX_UINT256` when x and y solve the following system of equations:\\n///\\n/// $$\\n/// \\\\begin{cases}\\n/// x * y = MAX\\\\_UINT256 * UNIT \\\\\\\\\\n/// (x * y) \\\\% UNIT \\\\geq \\\\frac{UNIT}{2}\\n/// \\\\end{cases}\\n/// $$\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {mulDiv}.\\n/// - The result must fit in uint256.\\n///\\n/// @param x The multiplicand as an unsigned 60.18-decimal fixed-point number.\\n/// @param y The multiplier as an unsigned 60.18-decimal fixed-point number.\\n/// @return result The result as an unsigned 60.18-decimal fixed-point number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mulDiv18(uint256 x, uint256 y) pure returns (uint256 result) {\\n uint256 prod0;\\n uint256 prod1;\\n assembly (\\\"memory-safe\\\") {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n if (prod1 == 0) {\\n unchecked {\\n return prod0 / UNIT;\\n }\\n }\\n\\n if (prod1 >= UNIT) {\\n revert PRBMath_MulDiv18_Overflow(x, y);\\n }\\n\\n uint256 remainder;\\n assembly (\\\"memory-safe\\\") {\\n remainder := mulmod(x, y, UNIT)\\n result :=\\n mul(\\n or(\\n div(sub(prod0, remainder), UNIT_LPOTD),\\n mul(sub(prod1, gt(remainder, prod0)), add(div(sub(0, UNIT_LPOTD), UNIT_LPOTD), 1))\\n ),\\n UNIT_INVERSE\\n )\\n }\\n}\\n\\n/// @notice Calculates x*y\\u00f7denominator with 512-bit precision.\\n///\\n/// @dev This is an extension of {mulDiv} for signed numbers, which works by computing the signs and the absolute values separately.\\n///\\n/// Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {mulDiv}.\\n/// - None of the inputs can be `type(int256).min`.\\n/// - The result must fit in int256.\\n///\\n/// @param x The multiplicand as an int256.\\n/// @param y The multiplier as an int256.\\n/// @param denominator The divisor as an int256.\\n/// @return result The result as an int256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mulDivSigned(int256 x, int256 y, int256 denominator) pure returns (int256 result) {\\n if (x == type(int256).min || y == type(int256).min || denominator == type(int256).min) {\\n revert PRBMath_MulDivSigned_InputTooSmall();\\n }\\n\\n // Get hold of the absolute values of x, y and the denominator.\\n uint256 xAbs;\\n uint256 yAbs;\\n uint256 dAbs;\\n unchecked {\\n xAbs = x < 0 ? uint256(-x) : uint256(x);\\n yAbs = y < 0 ? uint256(-y) : uint256(y);\\n dAbs = denominator < 0 ? uint256(-denominator) : uint256(denominator);\\n }\\n\\n // Compute the absolute value of x*y\\u00f7denominator. The result must fit in int256.\\n uint256 resultAbs = mulDiv(xAbs, yAbs, dAbs);\\n if (resultAbs > uint256(type(int256).max)) {\\n revert PRBMath_MulDivSigned_Overflow(x, y);\\n }\\n\\n // Get the signs of x, y and the denominator.\\n uint256 sx;\\n uint256 sy;\\n uint256 sd;\\n assembly (\\\"memory-safe\\\") {\\n // \\\"sgt\\\" is the \\\"signed greater than\\\" assembly instruction and \\\"sub(0,1)\\\" is -1 in two's complement.\\n sx := sgt(x, sub(0, 1))\\n sy := sgt(y, sub(0, 1))\\n sd := sgt(denominator, sub(0, 1))\\n }\\n\\n // XOR over sx, sy and sd. What this does is to check whether there are 1 or 3 negative signs in the inputs.\\n // If there are, the result should be negative. Otherwise, it should be positive.\\n unchecked {\\n result = sx ^ sy ^ sd == 0 ? -int256(resultAbs) : int256(resultAbs);\\n }\\n}\\n\\n/// @notice Calculates the square root of x using the Babylonian method.\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\\n///\\n/// Notes:\\n/// - If x is not a perfect square, the result is rounded down.\\n/// - Credits to OpenZeppelin for the explanations in comments below.\\n///\\n/// @param x The uint256 number for which to calculate the square root.\\n/// @return result The result as a uint256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction sqrt(uint256 x) pure returns (uint256 result) {\\n if (x == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we calculate the biggest power of 2 which is smaller than the square root of x.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of x is a power of 2 such that we have:\\n //\\n // $$\\n // msb(x) <= x <= 2*msb(x)$\\n // $$\\n //\\n // We write $msb(x)$ as $2^k$, and we get:\\n //\\n // $$\\n // k = log_2(x)\\n // $$\\n //\\n // Thus, we can write the initial inequality as:\\n //\\n // $$\\n // 2^{log_2(x)} <= x <= 2*2^{log_2(x)+1} \\\\\\\\\\n // sqrt(2^k) <= sqrt(x) < sqrt(2^{k+1}) \\\\\\\\\\n // 2^{k/2} <= sqrt(x) < 2^{(k+1)/2} <= 2^{(k/2)+1}\\n // $$\\n //\\n // Consequently, $2^{log_2(x) /2} is a good first approximation of sqrt(x) with at least one correct bit.\\n uint256 xAux = uint256(x);\\n result = 1;\\n if (xAux >= 2 ** 128) {\\n xAux >>= 128;\\n result <<= 64;\\n }\\n if (xAux >= 2 ** 64) {\\n xAux >>= 64;\\n result <<= 32;\\n }\\n if (xAux >= 2 ** 32) {\\n xAux >>= 32;\\n result <<= 16;\\n }\\n if (xAux >= 2 ** 16) {\\n xAux >>= 16;\\n result <<= 8;\\n }\\n if (xAux >= 2 ** 8) {\\n xAux >>= 8;\\n result <<= 4;\\n }\\n if (xAux >= 2 ** 4) {\\n xAux >>= 4;\\n result <<= 2;\\n }\\n if (xAux >= 2 ** 2) {\\n result <<= 1;\\n }\\n\\n // At this point, `result` is an estimation with at least one bit of precision. We know the true value has at\\n // most 128 bits, since it is the square root of a uint256. Newton's method converges quadratically (precision\\n // doubles at every iteration). We thus need at most 7 iteration to turn our partial result with one bit of\\n // precision into the expected uint128 result.\\n unchecked {\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n\\n // If x is not a perfect square, round the result toward zero.\\n uint256 roundedResult = x / result;\\n if (result >= roundedResult) {\\n result = roundedResult;\\n }\\n }\\n}\\n\",\"keccak256\":\"0xaa374e2c26cc93e8c22a6953804ee05f811597ef5fa82f76824378b22944778b\",\"license\":\"MIT\"},\"@prb/math/src/UD2x18.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\n/*\\n\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2550\\u2550\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2554\\u2588\\u2588\\u2588\\u2588\\u2554\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551 \\u255a\\u2550\\u255d \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\n\\n\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2550\\u2550\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d \\u255a\\u2588\\u2588\\u2588\\u2554\\u255d \\u255a\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u255d\\n\\n*/\\n\\nimport \\\"./ud2x18/Casting.sol\\\";\\nimport \\\"./ud2x18/Constants.sol\\\";\\nimport \\\"./ud2x18/Errors.sol\\\";\\nimport \\\"./ud2x18/ValueType.sol\\\";\\n\",\"keccak256\":\"0xfb624e24cd8bb790fa08e7827819de85504a86e20e961fa4ad126c65b6d90641\",\"license\":\"MIT\"},\"@prb/math/src/UD60x18.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\n/*\\n\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2550\\u2550\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2554\\u2588\\u2588\\u2588\\u2588\\u2554\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551 \\u255a\\u2550\\u255d \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\n\\n\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2550\\u2588\\u2588\\u2588\\u2588\\u2557\\u255a\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2588\\u2588\\u2551 \\u255a\\u2588\\u2588\\u2588\\u2554\\u255d \\u255a\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2554\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2554\\u255d \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u255d\\n\\n*/\\n\\nimport \\\"./ud60x18/Casting.sol\\\";\\nimport \\\"./ud60x18/Constants.sol\\\";\\nimport \\\"./ud60x18/Conversions.sol\\\";\\nimport \\\"./ud60x18/Errors.sol\\\";\\nimport \\\"./ud60x18/Helpers.sol\\\";\\nimport \\\"./ud60x18/Math.sol\\\";\\nimport \\\"./ud60x18/ValueType.sol\\\";\\n\",\"keccak256\":\"0xb98c6f74275914d279e8af6c502c2b1f50d5f6e1ed418d3b0153f5a193206c48\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as CastingErrors;\\nimport { SD59x18 } from \\\"../sd59x18/ValueType.sol\\\";\\nimport { UD2x18 } from \\\"../ud2x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"../ud60x18/ValueType.sol\\\";\\nimport { SD1x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts an SD1x18 number into SD59x18.\\n/// @dev There is no overflow check because the domain of SD1x18 is a subset of SD59x18.\\nfunction intoSD59x18(SD1x18 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(int256(SD1x18.unwrap(x)));\\n}\\n\\n/// @notice Casts an SD1x18 number into UD2x18.\\n/// - x must be positive.\\nfunction intoUD2x18(SD1x18 x) pure returns (UD2x18 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUD2x18_Underflow(x);\\n }\\n result = UD2x18.wrap(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into UD60x18.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUD60x18(SD1x18 x) pure returns (UD60x18 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUD60x18_Underflow(x);\\n }\\n result = UD60x18.wrap(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into uint256.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUint256(SD1x18 x) pure returns (uint256 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint256_Underflow(x);\\n }\\n result = uint256(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into uint128.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUint128(SD1x18 x) pure returns (uint128 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint128_Underflow(x);\\n }\\n result = uint128(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(SD1x18 x) pure returns (uint40 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint40_Underflow(x);\\n }\\n if (xInt > int64(uint64(Common.MAX_UINT40))) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint40_Overflow(x);\\n }\\n result = uint40(uint64(xInt));\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction sd1x18(int64 x) pure returns (SD1x18 result) {\\n result = SD1x18.wrap(x);\\n}\\n\\n/// @notice Unwraps an SD1x18 number into int64.\\nfunction unwrap(SD1x18 x) pure returns (int64 result) {\\n result = SD1x18.unwrap(x);\\n}\\n\\n/// @notice Wraps an int64 number into SD1x18.\\nfunction wrap(int64 x) pure returns (SD1x18 result) {\\n result = SD1x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x9e49e2b37c1bb845861740805edaaef3fe951a7b96eef16ce84fbf76e8278670\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD1x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @dev Euler's number as an SD1x18 number.\\nSD1x18 constant E = SD1x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum value an SD1x18 number can have.\\nint64 constant uMAX_SD1x18 = 9_223372036854775807;\\nSD1x18 constant MAX_SD1x18 = SD1x18.wrap(uMAX_SD1x18);\\n\\n/// @dev The maximum value an SD1x18 number can have.\\nint64 constant uMIN_SD1x18 = -9_223372036854775808;\\nSD1x18 constant MIN_SD1x18 = SD1x18.wrap(uMIN_SD1x18);\\n\\n/// @dev PI as an SD1x18 number.\\nSD1x18 constant PI = SD1x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of SD1x18.\\nSD1x18 constant UNIT = SD1x18.wrap(1e18);\\nint64 constant uUNIT = 1e18;\\n\",\"keccak256\":\"0x6496165b80552785a4b65a239b96e2a5fedf62fe54f002eeed72d75e566d7585\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD1x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in UD2x18.\\nerror PRBMath_SD1x18_ToUD2x18_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in UD60x18.\\nerror PRBMath_SD1x18_ToUD60x18_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint128.\\nerror PRBMath_SD1x18_ToUint128_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint256.\\nerror PRBMath_SD1x18_ToUint256_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint40.\\nerror PRBMath_SD1x18_ToUint40_Overflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint40.\\nerror PRBMath_SD1x18_ToUint40_Underflow(SD1x18 x);\\n\",\"keccak256\":\"0x836cb42ba619ca369fd4765bc47fefc3c3621369c5861882af14660aca5057ee\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\n\\n/// @notice The signed 1.18-decimal fixed-point number representation, which can have up to 1 digit and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\\n/// type int64. This is useful when end users want to use int64 to save gas, e.g. with tight variable packing in contract\\n/// storage.\\ntype SD1x18 is int64;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoSD59x18,\\n Casting.intoUD2x18,\\n Casting.intoUD60x18,\\n Casting.intoUint256,\\n Casting.intoUint128,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for SD1x18 global;\\n\",\"keccak256\":\"0x2f86f1aa9fca42f40808b51a879b406ac51817647bdb9642f8a79dd8fdb754a7\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Errors.sol\\\" as CastingErrors;\\nimport { MAX_UINT128, MAX_UINT40 } from \\\"../Common.sol\\\";\\nimport { uMAX_SD1x18, uMIN_SD1x18 } from \\\"../sd1x18/Constants.sol\\\";\\nimport { SD1x18 } from \\\"../sd1x18/ValueType.sol\\\";\\nimport { uMAX_UD2x18 } from \\\"../ud2x18/Constants.sol\\\";\\nimport { UD2x18 } from \\\"../ud2x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"../ud60x18/ValueType.sol\\\";\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts an SD59x18 number into int256.\\n/// @dev This is basically a functional alias for {unwrap}.\\nfunction intoInt256(SD59x18 x) pure returns (int256 result) {\\n result = SD59x18.unwrap(x);\\n}\\n\\n/// @notice Casts an SD59x18 number into SD1x18.\\n/// @dev Requirements:\\n/// - x must be greater than or equal to `uMIN_SD1x18`.\\n/// - x must be less than or equal to `uMAX_SD1x18`.\\nfunction intoSD1x18(SD59x18 x) pure returns (SD1x18 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < uMIN_SD1x18) {\\n revert CastingErrors.PRBMath_SD59x18_IntoSD1x18_Underflow(x);\\n }\\n if (xInt > uMAX_SD1x18) {\\n revert CastingErrors.PRBMath_SD59x18_IntoSD1x18_Overflow(x);\\n }\\n result = SD1x18.wrap(int64(xInt));\\n}\\n\\n/// @notice Casts an SD59x18 number into UD2x18.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `uMAX_UD2x18`.\\nfunction intoUD2x18(SD59x18 x) pure returns (UD2x18 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUD2x18_Underflow(x);\\n }\\n if (xInt > int256(uint256(uMAX_UD2x18))) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUD2x18_Overflow(x);\\n }\\n result = UD2x18.wrap(uint64(uint256(xInt)));\\n}\\n\\n/// @notice Casts an SD59x18 number into UD60x18.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUD60x18(SD59x18 x) pure returns (UD60x18 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUD60x18_Underflow(x);\\n }\\n result = UD60x18.wrap(uint256(xInt));\\n}\\n\\n/// @notice Casts an SD59x18 number into uint256.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUint256(SD59x18 x) pure returns (uint256 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint256_Underflow(x);\\n }\\n result = uint256(xInt);\\n}\\n\\n/// @notice Casts an SD59x18 number into uint128.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `uMAX_UINT128`.\\nfunction intoUint128(SD59x18 x) pure returns (uint128 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint128_Underflow(x);\\n }\\n if (xInt > int256(uint256(MAX_UINT128))) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint128_Overflow(x);\\n }\\n result = uint128(uint256(xInt));\\n}\\n\\n/// @notice Casts an SD59x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(SD59x18 x) pure returns (uint40 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint40_Underflow(x);\\n }\\n if (xInt > int256(uint256(MAX_UINT40))) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint40_Overflow(x);\\n }\\n result = uint40(uint256(xInt));\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction sd(int256 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(x);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction sd59x18(int256 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(x);\\n}\\n\\n/// @notice Unwraps an SD59x18 number into int256.\\nfunction unwrap(SD59x18 x) pure returns (int256 result) {\\n result = SD59x18.unwrap(x);\\n}\\n\\n/// @notice Wraps an int256 number into SD59x18.\\nfunction wrap(int256 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x3b21b60ec2998c3ae32f647412da51d3683b3f183a807198cc8d157499484f99\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n// NOTICE: the \\\"u\\\" prefix stands for \\\"unwrapped\\\".\\n\\n/// @dev Euler's number as an SD59x18 number.\\nSD59x18 constant E = SD59x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum input permitted in {exp}.\\nint256 constant uEXP_MAX_INPUT = 133_084258667509499440;\\nSD59x18 constant EXP_MAX_INPUT = SD59x18.wrap(uEXP_MAX_INPUT);\\n\\n/// @dev Any value less than this returns 0 in {exp}.\\nint256 constant uEXP_MIN_THRESHOLD = -41_446531673892822322;\\nSD59x18 constant EXP_MIN_THRESHOLD = SD59x18.wrap(uEXP_MIN_THRESHOLD);\\n\\n/// @dev The maximum input permitted in {exp2}.\\nint256 constant uEXP2_MAX_INPUT = 192e18 - 1;\\nSD59x18 constant EXP2_MAX_INPUT = SD59x18.wrap(uEXP2_MAX_INPUT);\\n\\n/// @dev Any value less than this returns 0 in {exp2}.\\nint256 constant uEXP2_MIN_THRESHOLD = -59_794705707972522261;\\nSD59x18 constant EXP2_MIN_THRESHOLD = SD59x18.wrap(uEXP2_MIN_THRESHOLD);\\n\\n/// @dev Half the UNIT number.\\nint256 constant uHALF_UNIT = 0.5e18;\\nSD59x18 constant HALF_UNIT = SD59x18.wrap(uHALF_UNIT);\\n\\n/// @dev $log_2(10)$ as an SD59x18 number.\\nint256 constant uLOG2_10 = 3_321928094887362347;\\nSD59x18 constant LOG2_10 = SD59x18.wrap(uLOG2_10);\\n\\n/// @dev $log_2(e)$ as an SD59x18 number.\\nint256 constant uLOG2_E = 1_442695040888963407;\\nSD59x18 constant LOG2_E = SD59x18.wrap(uLOG2_E);\\n\\n/// @dev The maximum value an SD59x18 number can have.\\nint256 constant uMAX_SD59x18 = 57896044618658097711785492504343953926634992332820282019728_792003956564819967;\\nSD59x18 constant MAX_SD59x18 = SD59x18.wrap(uMAX_SD59x18);\\n\\n/// @dev The maximum whole value an SD59x18 number can have.\\nint256 constant uMAX_WHOLE_SD59x18 = 57896044618658097711785492504343953926634992332820282019728_000000000000000000;\\nSD59x18 constant MAX_WHOLE_SD59x18 = SD59x18.wrap(uMAX_WHOLE_SD59x18);\\n\\n/// @dev The minimum value an SD59x18 number can have.\\nint256 constant uMIN_SD59x18 = -57896044618658097711785492504343953926634992332820282019728_792003956564819968;\\nSD59x18 constant MIN_SD59x18 = SD59x18.wrap(uMIN_SD59x18);\\n\\n/// @dev The minimum whole value an SD59x18 number can have.\\nint256 constant uMIN_WHOLE_SD59x18 = -57896044618658097711785492504343953926634992332820282019728_000000000000000000;\\nSD59x18 constant MIN_WHOLE_SD59x18 = SD59x18.wrap(uMIN_WHOLE_SD59x18);\\n\\n/// @dev PI as an SD59x18 number.\\nSD59x18 constant PI = SD59x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of SD59x18.\\nint256 constant uUNIT = 1e18;\\nSD59x18 constant UNIT = SD59x18.wrap(1e18);\\n\\n/// @dev The unit number squared.\\nint256 constant uUNIT_SQUARED = 1e36;\\nSD59x18 constant UNIT_SQUARED = SD59x18.wrap(uUNIT_SQUARED);\\n\\n/// @dev Zero as an SD59x18 number.\\nSD59x18 constant ZERO = SD59x18.wrap(0);\\n\",\"keccak256\":\"0x9bcb8dd6b3e886d140ad1c32747a4f6d29a492529ceb835be878ae837aa6cc3a\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when taking the absolute value of `MIN_SD59x18`.\\nerror PRBMath_SD59x18_Abs_MinSD59x18();\\n\\n/// @notice Thrown when ceiling a number overflows SD59x18.\\nerror PRBMath_SD59x18_Ceil_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when converting a basic integer to the fixed-point format overflows SD59x18.\\nerror PRBMath_SD59x18_Convert_Overflow(int256 x);\\n\\n/// @notice Thrown when converting a basic integer to the fixed-point format underflows SD59x18.\\nerror PRBMath_SD59x18_Convert_Underflow(int256 x);\\n\\n/// @notice Thrown when dividing two numbers and one of them is `MIN_SD59x18`.\\nerror PRBMath_SD59x18_Div_InputTooSmall();\\n\\n/// @notice Thrown when dividing two numbers and one of the intermediary unsigned results overflows SD59x18.\\nerror PRBMath_SD59x18_Div_Overflow(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when taking the natural exponent of a base greater than 133_084258667509499441.\\nerror PRBMath_SD59x18_Exp_InputTooBig(SD59x18 x);\\n\\n/// @notice Thrown when taking the binary exponent of a base greater than 192e18.\\nerror PRBMath_SD59x18_Exp2_InputTooBig(SD59x18 x);\\n\\n/// @notice Thrown when flooring a number underflows SD59x18.\\nerror PRBMath_SD59x18_Floor_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when taking the geometric mean of two numbers and their product is negative.\\nerror PRBMath_SD59x18_Gm_NegativeProduct(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when taking the geometric mean of two numbers and multiplying them overflows SD59x18.\\nerror PRBMath_SD59x18_Gm_Overflow(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\\nerror PRBMath_SD59x18_IntoSD1x18_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\\nerror PRBMath_SD59x18_IntoSD1x18_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\\nerror PRBMath_SD59x18_IntoUD2x18_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\\nerror PRBMath_SD59x18_IntoUD2x18_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD60x18.\\nerror PRBMath_SD59x18_IntoUD60x18_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\\nerror PRBMath_SD59x18_IntoUint128_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\\nerror PRBMath_SD59x18_IntoUint128_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint256.\\nerror PRBMath_SD59x18_IntoUint256_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\\nerror PRBMath_SD59x18_IntoUint40_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\\nerror PRBMath_SD59x18_IntoUint40_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when taking the logarithm of a number less than or equal to zero.\\nerror PRBMath_SD59x18_Log_InputTooSmall(SD59x18 x);\\n\\n/// @notice Thrown when multiplying two numbers and one of the inputs is `MIN_SD59x18`.\\nerror PRBMath_SD59x18_Mul_InputTooSmall();\\n\\n/// @notice Thrown when multiplying two numbers and the intermediary absolute result overflows SD59x18.\\nerror PRBMath_SD59x18_Mul_Overflow(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when raising a number to a power and the intermediary absolute result overflows SD59x18.\\nerror PRBMath_SD59x18_Powu_Overflow(SD59x18 x, uint256 y);\\n\\n/// @notice Thrown when taking the square root of a negative number.\\nerror PRBMath_SD59x18_Sqrt_NegativeInput(SD59x18 x);\\n\\n/// @notice Thrown when the calculating the square root overflows SD59x18.\\nerror PRBMath_SD59x18_Sqrt_Overflow(SD59x18 x);\\n\",\"keccak256\":\"0xa6d00fe5efa215ac0df25c896e3da99a12fb61e799644b2ec32da947313d3db4\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Helpers.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { wrap } from \\\"./Casting.sol\\\";\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Implements the checked addition operation (+) in the SD59x18 type.\\nfunction add(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n return wrap(x.unwrap() + y.unwrap());\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the SD59x18 type.\\nfunction and(SD59x18 x, int256 bits) pure returns (SD59x18 result) {\\n return wrap(x.unwrap() & bits);\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the SD59x18 type.\\nfunction and2(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n return wrap(x.unwrap() & y.unwrap());\\n}\\n\\n/// @notice Implements the equal (=) operation in the SD59x18 type.\\nfunction eq(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() == y.unwrap();\\n}\\n\\n/// @notice Implements the greater than operation (>) in the SD59x18 type.\\nfunction gt(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() > y.unwrap();\\n}\\n\\n/// @notice Implements the greater than or equal to operation (>=) in the SD59x18 type.\\nfunction gte(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() >= y.unwrap();\\n}\\n\\n/// @notice Implements a zero comparison check function in the SD59x18 type.\\nfunction isZero(SD59x18 x) pure returns (bool result) {\\n result = x.unwrap() == 0;\\n}\\n\\n/// @notice Implements the left shift operation (<<) in the SD59x18 type.\\nfunction lshift(SD59x18 x, uint256 bits) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() << bits);\\n}\\n\\n/// @notice Implements the lower than operation (<) in the SD59x18 type.\\nfunction lt(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() < y.unwrap();\\n}\\n\\n/// @notice Implements the lower than or equal to operation (<=) in the SD59x18 type.\\nfunction lte(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() <= y.unwrap();\\n}\\n\\n/// @notice Implements the unchecked modulo operation (%) in the SD59x18 type.\\nfunction mod(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() % y.unwrap());\\n}\\n\\n/// @notice Implements the not equal operation (!=) in the SD59x18 type.\\nfunction neq(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() != y.unwrap();\\n}\\n\\n/// @notice Implements the NOT (~) bitwise operation in the SD59x18 type.\\nfunction not(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(~x.unwrap());\\n}\\n\\n/// @notice Implements the OR (|) bitwise operation in the SD59x18 type.\\nfunction or(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() | y.unwrap());\\n}\\n\\n/// @notice Implements the right shift operation (>>) in the SD59x18 type.\\nfunction rshift(SD59x18 x, uint256 bits) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() >> bits);\\n}\\n\\n/// @notice Implements the checked subtraction operation (-) in the SD59x18 type.\\nfunction sub(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() - y.unwrap());\\n}\\n\\n/// @notice Implements the checked unary minus operation (-) in the SD59x18 type.\\nfunction unary(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(-x.unwrap());\\n}\\n\\n/// @notice Implements the unchecked addition operation (+) in the SD59x18 type.\\nfunction uncheckedAdd(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() + y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the unchecked subtraction operation (-) in the SD59x18 type.\\nfunction uncheckedSub(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() - y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the unchecked unary minus operation (-) in the SD59x18 type.\\nfunction uncheckedUnary(SD59x18 x) pure returns (SD59x18 result) {\\n unchecked {\\n result = wrap(-x.unwrap());\\n }\\n}\\n\\n/// @notice Implements the XOR (^) bitwise operation in the SD59x18 type.\\nfunction xor(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() ^ y.unwrap());\\n}\\n\",\"keccak256\":\"0x208570f1657cf730cb6c3d81aa14030e0d45cf906cdedea5059369d7df4bb716\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as Errors;\\nimport {\\n uEXP_MAX_INPUT,\\n uEXP2_MAX_INPUT,\\n uEXP_MIN_THRESHOLD,\\n uEXP2_MIN_THRESHOLD,\\n uHALF_UNIT,\\n uLOG2_10,\\n uLOG2_E,\\n uMAX_SD59x18,\\n uMAX_WHOLE_SD59x18,\\n uMIN_SD59x18,\\n uMIN_WHOLE_SD59x18,\\n UNIT,\\n uUNIT,\\n uUNIT_SQUARED,\\n ZERO\\n} from \\\"./Constants.sol\\\";\\nimport { wrap } from \\\"./Helpers.sol\\\";\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Calculates the absolute value of x.\\n///\\n/// @dev Requirements:\\n/// - x must be greater than `MIN_SD59x18`.\\n///\\n/// @param x The SD59x18 number for which to calculate the absolute value.\\n/// @param result The absolute value of x as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction abs(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt == uMIN_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Abs_MinSD59x18();\\n }\\n result = xInt < 0 ? wrap(-xInt) : x;\\n}\\n\\n/// @notice Calculates the arithmetic average of x and y.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// @param x The first operand as an SD59x18 number.\\n/// @param y The second operand as an SD59x18 number.\\n/// @return result The arithmetic average as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction avg(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n\\n unchecked {\\n // This operation is equivalent to `x / 2 + y / 2`, and it can never overflow.\\n int256 sum = (xInt >> 1) + (yInt >> 1);\\n\\n if (sum < 0) {\\n // If at least one of x and y is odd, add 1 to the result, because shifting negative numbers to the right\\n // rounds toward negative infinity. The right part is equivalent to `sum + (x % 2 == 1 || y % 2 == 1)`.\\n assembly (\\\"memory-safe\\\") {\\n result := add(sum, and(or(xInt, yInt), 1))\\n }\\n } else {\\n // Add 1 if both x and y are odd to account for the double 0.5 remainder truncated after shifting.\\n result = wrap(sum + (xInt & yInt & 1));\\n }\\n }\\n}\\n\\n/// @notice Yields the smallest whole number greater than or equal to x.\\n///\\n/// @dev Optimized for fractional value inputs, because every whole value has (1e18 - 1) fractional counterparts.\\n/// See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n///\\n/// Requirements:\\n/// - x must be less than or equal to `MAX_WHOLE_SD59x18`.\\n///\\n/// @param x The SD59x18 number to ceil.\\n/// @param result The smallest whole number greater than or equal to x, as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ceil(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt > uMAX_WHOLE_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Ceil_Overflow(x);\\n }\\n\\n int256 remainder = xInt % uUNIT;\\n if (remainder == 0) {\\n result = x;\\n } else {\\n unchecked {\\n // Solidity uses C fmod style, which returns a modulus with the same sign as x.\\n int256 resultInt = xInt - remainder;\\n if (xInt > 0) {\\n resultInt += uUNIT;\\n }\\n result = wrap(resultInt);\\n }\\n }\\n}\\n\\n/// @notice Divides two SD59x18 numbers, returning a new SD59x18 number.\\n///\\n/// @dev This is an extension of {Common.mulDiv} for signed numbers, which works by computing the signs and the absolute\\n/// values separately.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv}.\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv}.\\n/// - None of the inputs can be `MIN_SD59x18`.\\n/// - The denominator must not be zero.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The numerator as an SD59x18 number.\\n/// @param y The denominator as an SD59x18 number.\\n/// @param result The quotient as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction div(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n if (xInt == uMIN_SD59x18 || yInt == uMIN_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Div_InputTooSmall();\\n }\\n\\n // Get hold of the absolute values of x and y.\\n uint256 xAbs;\\n uint256 yAbs;\\n unchecked {\\n xAbs = xInt < 0 ? uint256(-xInt) : uint256(xInt);\\n yAbs = yInt < 0 ? uint256(-yInt) : uint256(yInt);\\n }\\n\\n // Compute the absolute value (x*UNIT\\u00f7y). The resulting value must fit in SD59x18.\\n uint256 resultAbs = Common.mulDiv(xAbs, uint256(uUNIT), yAbs);\\n if (resultAbs > uint256(uMAX_SD59x18)) {\\n revert Errors.PRBMath_SD59x18_Div_Overflow(x, y);\\n }\\n\\n // Check if x and y have the same sign using two's complement representation. The left-most bit represents the sign (1 for\\n // negative, 0 for positive or zero).\\n bool sameSign = (xInt ^ yInt) > -1;\\n\\n // If the inputs have the same sign, the result should be positive. Otherwise, it should be negative.\\n unchecked {\\n result = wrap(sameSign ? int256(resultAbs) : -int256(resultAbs));\\n }\\n}\\n\\n/// @notice Calculates the natural exponent of x using the following formula:\\n///\\n/// $$\\n/// e^x = 2^{x * log_2{e}}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {exp2}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {exp2}.\\n/// - x must be less than 133_084258667509499441.\\n///\\n/// @param x The exponent as an SD59x18 number.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n\\n // Any input less than the threshold returns zero.\\n // This check also prevents an overflow for very small numbers.\\n if (xInt < uEXP_MIN_THRESHOLD) {\\n return ZERO;\\n }\\n\\n // This check prevents values greater than 192e18 from being passed to {exp2}.\\n if (xInt > uEXP_MAX_INPUT) {\\n revert Errors.PRBMath_SD59x18_Exp_InputTooBig(x);\\n }\\n\\n unchecked {\\n // Inline the fixed-point multiplication to save gas.\\n int256 doubleUnitProduct = xInt * uLOG2_E;\\n result = exp2(wrap(doubleUnitProduct / uUNIT));\\n }\\n}\\n\\n/// @notice Calculates the binary exponent of x using the binary fraction method using the following formula:\\n///\\n/// $$\\n/// 2^{-x} = \\\\frac{1}{2^x}\\n/// $$\\n///\\n/// @dev See https://ethereum.stackexchange.com/q/79903/24693.\\n///\\n/// Notes:\\n/// - If x is less than -59_794705707972522261, the result is zero.\\n///\\n/// Requirements:\\n/// - x must be less than 192e18.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The exponent as an SD59x18 number.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp2(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < 0) {\\n // The inverse of any number less than the threshold is truncated to zero.\\n if (xInt < uEXP2_MIN_THRESHOLD) {\\n return ZERO;\\n }\\n\\n unchecked {\\n // Inline the fixed-point inversion to save gas.\\n result = wrap(uUNIT_SQUARED / exp2(wrap(-xInt)).unwrap());\\n }\\n } else {\\n // Numbers greater than or equal to 192e18 don't fit in the 192.64-bit format.\\n if (xInt > uEXP2_MAX_INPUT) {\\n revert Errors.PRBMath_SD59x18_Exp2_InputTooBig(x);\\n }\\n\\n unchecked {\\n // Convert x to the 192.64-bit fixed-point format.\\n uint256 x_192x64 = uint256((xInt << 64) / uUNIT);\\n\\n // It is safe to cast the result to int256 due to the checks above.\\n result = wrap(int256(Common.exp2(x_192x64)));\\n }\\n }\\n}\\n\\n/// @notice Yields the greatest whole number less than or equal to x.\\n///\\n/// @dev Optimized for fractional value inputs, because for every whole value there are (1e18 - 1) fractional\\n/// counterparts. See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n///\\n/// Requirements:\\n/// - x must be greater than or equal to `MIN_WHOLE_SD59x18`.\\n///\\n/// @param x The SD59x18 number to floor.\\n/// @param result The greatest whole number less than or equal to x, as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction floor(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < uMIN_WHOLE_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Floor_Underflow(x);\\n }\\n\\n int256 remainder = xInt % uUNIT;\\n if (remainder == 0) {\\n result = x;\\n } else {\\n unchecked {\\n // Solidity uses C fmod style, which returns a modulus with the same sign as x.\\n int256 resultInt = xInt - remainder;\\n if (xInt < 0) {\\n resultInt -= uUNIT;\\n }\\n result = wrap(resultInt);\\n }\\n }\\n}\\n\\n/// @notice Yields the excess beyond the floor of x for positive numbers and the part of the number to the right.\\n/// of the radix point for negative numbers.\\n/// @dev Based on the odd function definition. https://en.wikipedia.org/wiki/Fractional_part\\n/// @param x The SD59x18 number to get the fractional part of.\\n/// @param result The fractional part of x as an SD59x18 number.\\nfunction frac(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() % uUNIT);\\n}\\n\\n/// @notice Calculates the geometric mean of x and y, i.e. $\\\\sqrt{x * y}$.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x * y must fit in SD59x18.\\n/// - x * y must not be negative, since complex numbers are not supported.\\n///\\n/// @param x The first operand as an SD59x18 number.\\n/// @param y The second operand as an SD59x18 number.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction gm(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n if (xInt == 0 || yInt == 0) {\\n return ZERO;\\n }\\n\\n unchecked {\\n // Equivalent to `xy / x != y`. Checking for overflow this way is faster than letting Solidity do it.\\n int256 xyInt = xInt * yInt;\\n if (xyInt / xInt != yInt) {\\n revert Errors.PRBMath_SD59x18_Gm_Overflow(x, y);\\n }\\n\\n // The product must not be negative, since complex numbers are not supported.\\n if (xyInt < 0) {\\n revert Errors.PRBMath_SD59x18_Gm_NegativeProduct(x, y);\\n }\\n\\n // We don't need to multiply the result by `UNIT` here because the x*y product picked up a factor of `UNIT`\\n // during multiplication. See the comments in {Common.sqrt}.\\n uint256 resultUint = Common.sqrt(uint256(xyInt));\\n result = wrap(int256(resultUint));\\n }\\n}\\n\\n/// @notice Calculates the inverse of x.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x must not be zero.\\n///\\n/// @param x The SD59x18 number for which to calculate the inverse.\\n/// @return result The inverse as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction inv(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(uUNIT_SQUARED / x.unwrap());\\n}\\n\\n/// @notice Calculates the natural logarithm of x using the following formula:\\n///\\n/// $$\\n/// ln{x} = log_2{x} / log_2{e}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n/// - The precision isn't sufficiently fine-grained to return exactly `UNIT` when the input is `E`.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The SD59x18 number for which to calculate the natural logarithm.\\n/// @return result The natural logarithm as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ln(SD59x18 x) pure returns (SD59x18 result) {\\n // Inline the fixed-point multiplication to save gas. This is overflow-safe because the maximum value that\\n // {log2} can return is ~195_205294292027477728.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_E);\\n}\\n\\n/// @notice Calculates the common logarithm of x using the following formula:\\n///\\n/// $$\\n/// log_{10}{x} = log_2{x} / log_2{10}\\n/// $$\\n///\\n/// However, if x is an exact power of ten, a hard coded value is returned.\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The SD59x18 number for which to calculate the common logarithm.\\n/// @return result The common logarithm as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log10(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < 0) {\\n revert Errors.PRBMath_SD59x18_Log_InputTooSmall(x);\\n }\\n\\n // Note that the `mul` in this block is the standard multiplication operation, not {SD59x18.mul}.\\n // prettier-ignore\\n assembly (\\\"memory-safe\\\") {\\n switch x\\n case 1 { result := mul(uUNIT, sub(0, 18)) }\\n case 10 { result := mul(uUNIT, sub(1, 18)) }\\n case 100 { result := mul(uUNIT, sub(2, 18)) }\\n case 1000 { result := mul(uUNIT, sub(3, 18)) }\\n case 10000 { result := mul(uUNIT, sub(4, 18)) }\\n case 100000 { result := mul(uUNIT, sub(5, 18)) }\\n case 1000000 { result := mul(uUNIT, sub(6, 18)) }\\n case 10000000 { result := mul(uUNIT, sub(7, 18)) }\\n case 100000000 { result := mul(uUNIT, sub(8, 18)) }\\n case 1000000000 { result := mul(uUNIT, sub(9, 18)) }\\n case 10000000000 { result := mul(uUNIT, sub(10, 18)) }\\n case 100000000000 { result := mul(uUNIT, sub(11, 18)) }\\n case 1000000000000 { result := mul(uUNIT, sub(12, 18)) }\\n case 10000000000000 { result := mul(uUNIT, sub(13, 18)) }\\n case 100000000000000 { result := mul(uUNIT, sub(14, 18)) }\\n case 1000000000000000 { result := mul(uUNIT, sub(15, 18)) }\\n case 10000000000000000 { result := mul(uUNIT, sub(16, 18)) }\\n case 100000000000000000 { result := mul(uUNIT, sub(17, 18)) }\\n case 1000000000000000000 { result := 0 }\\n case 10000000000000000000 { result := uUNIT }\\n case 100000000000000000000 { result := mul(uUNIT, 2) }\\n case 1000000000000000000000 { result := mul(uUNIT, 3) }\\n case 10000000000000000000000 { result := mul(uUNIT, 4) }\\n case 100000000000000000000000 { result := mul(uUNIT, 5) }\\n case 1000000000000000000000000 { result := mul(uUNIT, 6) }\\n case 10000000000000000000000000 { result := mul(uUNIT, 7) }\\n case 100000000000000000000000000 { result := mul(uUNIT, 8) }\\n case 1000000000000000000000000000 { result := mul(uUNIT, 9) }\\n case 10000000000000000000000000000 { result := mul(uUNIT, 10) }\\n case 100000000000000000000000000000 { result := mul(uUNIT, 11) }\\n case 1000000000000000000000000000000 { result := mul(uUNIT, 12) }\\n case 10000000000000000000000000000000 { result := mul(uUNIT, 13) }\\n case 100000000000000000000000000000000 { result := mul(uUNIT, 14) }\\n case 1000000000000000000000000000000000 { result := mul(uUNIT, 15) }\\n case 10000000000000000000000000000000000 { result := mul(uUNIT, 16) }\\n case 100000000000000000000000000000000000 { result := mul(uUNIT, 17) }\\n case 1000000000000000000000000000000000000 { result := mul(uUNIT, 18) }\\n case 10000000000000000000000000000000000000 { result := mul(uUNIT, 19) }\\n case 100000000000000000000000000000000000000 { result := mul(uUNIT, 20) }\\n case 1000000000000000000000000000000000000000 { result := mul(uUNIT, 21) }\\n case 10000000000000000000000000000000000000000 { result := mul(uUNIT, 22) }\\n case 100000000000000000000000000000000000000000 { result := mul(uUNIT, 23) }\\n case 1000000000000000000000000000000000000000000 { result := mul(uUNIT, 24) }\\n case 10000000000000000000000000000000000000000000 { result := mul(uUNIT, 25) }\\n case 100000000000000000000000000000000000000000000 { result := mul(uUNIT, 26) }\\n case 1000000000000000000000000000000000000000000000 { result := mul(uUNIT, 27) }\\n case 10000000000000000000000000000000000000000000000 { result := mul(uUNIT, 28) }\\n case 100000000000000000000000000000000000000000000000 { result := mul(uUNIT, 29) }\\n case 1000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 30) }\\n case 10000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 31) }\\n case 100000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 32) }\\n case 1000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 33) }\\n case 10000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 34) }\\n case 100000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 35) }\\n case 1000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 36) }\\n case 10000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 37) }\\n case 100000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 38) }\\n case 1000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 39) }\\n case 10000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 40) }\\n case 100000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 41) }\\n case 1000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 42) }\\n case 10000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 43) }\\n case 100000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 44) }\\n case 1000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 45) }\\n case 10000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 46) }\\n case 100000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 47) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 48) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 49) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 50) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 51) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 52) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 53) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 54) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 55) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 56) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 57) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 58) }\\n default { result := uMAX_SD59x18 }\\n }\\n\\n if (result.unwrap() == uMAX_SD59x18) {\\n unchecked {\\n // Inline the fixed-point division to save gas.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_10);\\n }\\n }\\n}\\n\\n/// @notice Calculates the binary logarithm of x using the iterative approximation algorithm:\\n///\\n/// $$\\n/// log_2{x} = n + log_2{y}, \\\\text{ where } y = x*2^{-n}, \\\\ y \\\\in [1, 2)\\n/// $$\\n///\\n/// For $0 \\\\leq x \\\\lt 1$, the input is inverted:\\n///\\n/// $$\\n/// log_2{x} = -log_2{\\\\frac{1}{x}}\\n/// $$\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Binary_logarithm#Iterative_approximation.\\n///\\n/// Notes:\\n/// - Due to the lossy precision of the iterative approximation, the results are not perfectly accurate to the last decimal.\\n///\\n/// Requirements:\\n/// - x must be greater than zero.\\n///\\n/// @param x The SD59x18 number for which to calculate the binary logarithm.\\n/// @return result The binary logarithm as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log2(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt <= 0) {\\n revert Errors.PRBMath_SD59x18_Log_InputTooSmall(x);\\n }\\n\\n unchecked {\\n int256 sign;\\n if (xInt >= uUNIT) {\\n sign = 1;\\n } else {\\n sign = -1;\\n // Inline the fixed-point inversion to save gas.\\n xInt = uUNIT_SQUARED / xInt;\\n }\\n\\n // Calculate the integer part of the logarithm.\\n uint256 n = Common.msb(uint256(xInt / uUNIT));\\n\\n // This is the integer part of the logarithm as an SD59x18 number. The operation can't overflow\\n // because n is at most 255, `UNIT` is 1e18, and the sign is either 1 or -1.\\n int256 resultInt = int256(n) * uUNIT;\\n\\n // Calculate $y = x * 2^{-n}$.\\n int256 y = xInt >> n;\\n\\n // If y is the unit number, the fractional part is zero.\\n if (y == uUNIT) {\\n return wrap(resultInt * sign);\\n }\\n\\n // Calculate the fractional part via the iterative approximation.\\n // The `delta >>= 1` part is equivalent to `delta /= 2`, but shifting bits is more gas efficient.\\n int256 DOUBLE_UNIT = 2e18;\\n for (int256 delta = uHALF_UNIT; delta > 0; delta >>= 1) {\\n y = (y * y) / uUNIT;\\n\\n // Is y^2 >= 2e18 and so in the range [2e18, 4e18)?\\n if (y >= DOUBLE_UNIT) {\\n // Add the 2^{-m} factor to the logarithm.\\n resultInt = resultInt + delta;\\n\\n // Halve y, which corresponds to z/2 in the Wikipedia article.\\n y >>= 1;\\n }\\n }\\n resultInt *= sign;\\n result = wrap(resultInt);\\n }\\n}\\n\\n/// @notice Multiplies two SD59x18 numbers together, returning a new SD59x18 number.\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {Common.mulDiv18}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv18}.\\n/// - None of the inputs can be `MIN_SD59x18`.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The multiplicand as an SD59x18 number.\\n/// @param y The multiplier as an SD59x18 number.\\n/// @return result The product as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mul(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n if (xInt == uMIN_SD59x18 || yInt == uMIN_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Mul_InputTooSmall();\\n }\\n\\n // Get hold of the absolute values of x and y.\\n uint256 xAbs;\\n uint256 yAbs;\\n unchecked {\\n xAbs = xInt < 0 ? uint256(-xInt) : uint256(xInt);\\n yAbs = yInt < 0 ? uint256(-yInt) : uint256(yInt);\\n }\\n\\n // Compute the absolute value (x*y\\u00f7UNIT). The resulting value must fit in SD59x18.\\n uint256 resultAbs = Common.mulDiv18(xAbs, yAbs);\\n if (resultAbs > uint256(uMAX_SD59x18)) {\\n revert Errors.PRBMath_SD59x18_Mul_Overflow(x, y);\\n }\\n\\n // Check if x and y have the same sign using two's complement representation. The left-most bit represents the sign (1 for\\n // negative, 0 for positive or zero).\\n bool sameSign = (xInt ^ yInt) > -1;\\n\\n // If the inputs have the same sign, the result should be positive. Otherwise, it should be negative.\\n unchecked {\\n result = wrap(sameSign ? int256(resultAbs) : -int256(resultAbs));\\n }\\n}\\n\\n/// @notice Raises x to the power of y using the following formula:\\n///\\n/// $$\\n/// x^y = 2^{log_2{x} * y}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {exp2}, {log2}, and {mul}.\\n/// - Returns `UNIT` for 0^0.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {exp2}, {log2}, and {mul}.\\n///\\n/// @param x The base as an SD59x18 number.\\n/// @param y Exponent to raise x to, as an SD59x18 number\\n/// @return result x raised to power y, as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction pow(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n\\n // If both x and y are zero, the result is `UNIT`. If just x is zero, the result is always zero.\\n if (xInt == 0) {\\n return yInt == 0 ? UNIT : ZERO;\\n }\\n // If x is `UNIT`, the result is always `UNIT`.\\n else if (xInt == uUNIT) {\\n return UNIT;\\n }\\n\\n // If y is zero, the result is always `UNIT`.\\n if (yInt == 0) {\\n return UNIT;\\n }\\n // If y is `UNIT`, the result is always x.\\n else if (yInt == uUNIT) {\\n return x;\\n }\\n\\n // Calculate the result using the formula.\\n result = exp2(mul(log2(x), y));\\n}\\n\\n/// @notice Raises x (an SD59x18 number) to the power y (an unsigned basic integer) using the well-known\\n/// algorithm \\\"exponentiation by squaring\\\".\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Exponentiation_by_squaring.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv18}.\\n/// - Returns `UNIT` for 0^0.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {abs} and {Common.mulDiv18}.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The base as an SD59x18 number.\\n/// @param y The exponent as a uint256.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction powu(SD59x18 x, uint256 y) pure returns (SD59x18 result) {\\n uint256 xAbs = uint256(abs(x).unwrap());\\n\\n // Calculate the first iteration of the loop in advance.\\n uint256 resultAbs = y & 1 > 0 ? xAbs : uint256(uUNIT);\\n\\n // Equivalent to `for(y /= 2; y > 0; y /= 2)`.\\n uint256 yAux = y;\\n for (yAux >>= 1; yAux > 0; yAux >>= 1) {\\n xAbs = Common.mulDiv18(xAbs, xAbs);\\n\\n // Equivalent to `y % 2 == 1`.\\n if (yAux & 1 > 0) {\\n resultAbs = Common.mulDiv18(resultAbs, xAbs);\\n }\\n }\\n\\n // The result must fit in SD59x18.\\n if (resultAbs > uint256(uMAX_SD59x18)) {\\n revert Errors.PRBMath_SD59x18_Powu_Overflow(x, y);\\n }\\n\\n unchecked {\\n // Is the base negative and the exponent odd? If yes, the result should be negative.\\n int256 resultInt = int256(resultAbs);\\n bool isNegative = x.unwrap() < 0 && y & 1 == 1;\\n if (isNegative) {\\n resultInt = -resultInt;\\n }\\n result = wrap(resultInt);\\n }\\n}\\n\\n/// @notice Calculates the square root of x using the Babylonian method.\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\\n///\\n/// Notes:\\n/// - Only the positive root is returned.\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x cannot be negative, since complex numbers are not supported.\\n/// - x must be less than `MAX_SD59x18 / UNIT`.\\n///\\n/// @param x The SD59x18 number for which to calculate the square root.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction sqrt(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < 0) {\\n revert Errors.PRBMath_SD59x18_Sqrt_NegativeInput(x);\\n }\\n if (xInt > uMAX_SD59x18 / uUNIT) {\\n revert Errors.PRBMath_SD59x18_Sqrt_Overflow(x);\\n }\\n\\n unchecked {\\n // Multiply x by `UNIT` to account for the factor of `UNIT` picked up when multiplying two SD59x18 numbers.\\n // In this case, the two numbers are both the square root.\\n uint256 resultUint = Common.sqrt(uint256(xInt * uUNIT));\\n result = wrap(int256(resultUint));\\n }\\n}\\n\",\"keccak256\":\"0xa074831139fc89ca0e5a36086b30eb50896bb6770cd5823461b1f2769017d2f0\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\nimport \\\"./Helpers.sol\\\" as Helpers;\\nimport \\\"./Math.sol\\\" as Math;\\n\\n/// @notice The signed 59.18-decimal fixed-point number representation, which can have up to 59 digits and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\\n/// type int256.\\ntype SD59x18 is int256;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoInt256,\\n Casting.intoSD1x18,\\n Casting.intoUD2x18,\\n Casting.intoUD60x18,\\n Casting.intoUint256,\\n Casting.intoUint128,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for SD59x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n MATHEMATICAL FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Math.abs,\\n Math.avg,\\n Math.ceil,\\n Math.div,\\n Math.exp,\\n Math.exp2,\\n Math.floor,\\n Math.frac,\\n Math.gm,\\n Math.inv,\\n Math.log10,\\n Math.log2,\\n Math.ln,\\n Math.mul,\\n Math.pow,\\n Math.powu,\\n Math.sqrt\\n} for SD59x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n HELPER FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Helpers.add,\\n Helpers.and,\\n Helpers.eq,\\n Helpers.gt,\\n Helpers.gte,\\n Helpers.isZero,\\n Helpers.lshift,\\n Helpers.lt,\\n Helpers.lte,\\n Helpers.mod,\\n Helpers.neq,\\n Helpers.not,\\n Helpers.or,\\n Helpers.rshift,\\n Helpers.sub,\\n Helpers.uncheckedAdd,\\n Helpers.uncheckedSub,\\n Helpers.uncheckedUnary,\\n Helpers.xor\\n} for SD59x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n OPERATORS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes it possible to use these operators on the SD59x18 type.\\nusing {\\n Helpers.add as +,\\n Helpers.and2 as &,\\n Math.div as /,\\n Helpers.eq as ==,\\n Helpers.gt as >,\\n Helpers.gte as >=,\\n Helpers.lt as <,\\n Helpers.lte as <=,\\n Helpers.mod as %,\\n Math.mul as *,\\n Helpers.neq as !=,\\n Helpers.not as ~,\\n Helpers.or as |,\\n Helpers.sub as -,\\n Helpers.unary as -,\\n Helpers.xor as ^\\n} for SD59x18 global;\\n\",\"keccak256\":\"0xe03112d145dcd5863aff24e5f381debaae29d446acd5666f3d640e3d9af738d7\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as Errors;\\nimport { uMAX_SD1x18 } from \\\"../sd1x18/Constants.sol\\\";\\nimport { SD1x18 } from \\\"../sd1x18/ValueType.sol\\\";\\nimport { SD59x18 } from \\\"../sd59x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"../ud60x18/ValueType.sol\\\";\\nimport { UD2x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts a UD2x18 number into SD1x18.\\n/// - x must be less than or equal to `uMAX_SD1x18`.\\nfunction intoSD1x18(UD2x18 x) pure returns (SD1x18 result) {\\n uint64 xUint = UD2x18.unwrap(x);\\n if (xUint > uint64(uMAX_SD1x18)) {\\n revert Errors.PRBMath_UD2x18_IntoSD1x18_Overflow(x);\\n }\\n result = SD1x18.wrap(int64(xUint));\\n}\\n\\n/// @notice Casts a UD2x18 number into SD59x18.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of SD59x18.\\nfunction intoSD59x18(UD2x18 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(int256(uint256(UD2x18.unwrap(x))));\\n}\\n\\n/// @notice Casts a UD2x18 number into UD60x18.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of UD60x18.\\nfunction intoUD60x18(UD2x18 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(UD2x18.unwrap(x));\\n}\\n\\n/// @notice Casts a UD2x18 number into uint128.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of uint128.\\nfunction intoUint128(UD2x18 x) pure returns (uint128 result) {\\n result = uint128(UD2x18.unwrap(x));\\n}\\n\\n/// @notice Casts a UD2x18 number into uint256.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of uint256.\\nfunction intoUint256(UD2x18 x) pure returns (uint256 result) {\\n result = uint256(UD2x18.unwrap(x));\\n}\\n\\n/// @notice Casts a UD2x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(UD2x18 x) pure returns (uint40 result) {\\n uint64 xUint = UD2x18.unwrap(x);\\n if (xUint > uint64(Common.MAX_UINT40)) {\\n revert Errors.PRBMath_UD2x18_IntoUint40_Overflow(x);\\n }\\n result = uint40(xUint);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction ud2x18(uint64 x) pure returns (UD2x18 result) {\\n result = UD2x18.wrap(x);\\n}\\n\\n/// @notice Unwrap a UD2x18 number into uint64.\\nfunction unwrap(UD2x18 x) pure returns (uint64 result) {\\n result = UD2x18.unwrap(x);\\n}\\n\\n/// @notice Wraps a uint64 number into UD2x18.\\nfunction wrap(uint64 x) pure returns (UD2x18 result) {\\n result = UD2x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x9b1a35d432ef951a415fae8098b3c609a99b630a3d5464b3c8e1efa8893eea07\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD2x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @dev Euler's number as a UD2x18 number.\\nUD2x18 constant E = UD2x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum value a UD2x18 number can have.\\nuint64 constant uMAX_UD2x18 = 18_446744073709551615;\\nUD2x18 constant MAX_UD2x18 = UD2x18.wrap(uMAX_UD2x18);\\n\\n/// @dev PI as a UD2x18 number.\\nUD2x18 constant PI = UD2x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of UD2x18.\\nUD2x18 constant UNIT = UD2x18.wrap(1e18);\\nuint64 constant uUNIT = 1e18;\\n\",\"keccak256\":\"0x29b0e050c865899e1fb9022b460a7829cdee248c44c4299f068ba80695eec3fc\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD2x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when trying to cast a UD2x18 number that doesn't fit in SD1x18.\\nerror PRBMath_UD2x18_IntoSD1x18_Overflow(UD2x18 x);\\n\\n/// @notice Thrown when trying to cast a UD2x18 number that doesn't fit in uint40.\\nerror PRBMath_UD2x18_IntoUint40_Overflow(UD2x18 x);\\n\",\"keccak256\":\"0xdf1e22f0b4c8032bcc8b7f63fe3984e1387f3dc7b2e9ab381822249f75376d33\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\n\\n/// @notice The unsigned 2.18-decimal fixed-point number representation, which can have up to 2 digits and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\\n/// type uint64. This is useful when end users want to use uint64 to save gas, e.g. with tight variable packing in contract\\n/// storage.\\ntype UD2x18 is uint64;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoSD1x18,\\n Casting.intoSD59x18,\\n Casting.intoUD60x18,\\n Casting.intoUint256,\\n Casting.intoUint128,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for UD2x18 global;\\n\",\"keccak256\":\"0x2802edc9869db116a0b5c490cc5f8554742f747183fa30ac5e9c80bb967e61a1\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Errors.sol\\\" as CastingErrors;\\nimport { MAX_UINT128, MAX_UINT40 } from \\\"../Common.sol\\\";\\nimport { uMAX_SD1x18 } from \\\"../sd1x18/Constants.sol\\\";\\nimport { SD1x18 } from \\\"../sd1x18/ValueType.sol\\\";\\nimport { uMAX_SD59x18 } from \\\"../sd59x18/Constants.sol\\\";\\nimport { SD59x18 } from \\\"../sd59x18/ValueType.sol\\\";\\nimport { uMAX_UD2x18 } from \\\"../ud2x18/Constants.sol\\\";\\nimport { UD2x18 } from \\\"../ud2x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts a UD60x18 number into SD1x18.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `uMAX_SD1x18`.\\nfunction intoSD1x18(UD60x18 x) pure returns (SD1x18 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > uint256(int256(uMAX_SD1x18))) {\\n revert CastingErrors.PRBMath_UD60x18_IntoSD1x18_Overflow(x);\\n }\\n result = SD1x18.wrap(int64(uint64(xUint)));\\n}\\n\\n/// @notice Casts a UD60x18 number into UD2x18.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `uMAX_UD2x18`.\\nfunction intoUD2x18(UD60x18 x) pure returns (UD2x18 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > uMAX_UD2x18) {\\n revert CastingErrors.PRBMath_UD60x18_IntoUD2x18_Overflow(x);\\n }\\n result = UD2x18.wrap(uint64(xUint));\\n}\\n\\n/// @notice Casts a UD60x18 number into SD59x18.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `uMAX_SD59x18`.\\nfunction intoSD59x18(UD60x18 x) pure returns (SD59x18 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > uint256(uMAX_SD59x18)) {\\n revert CastingErrors.PRBMath_UD60x18_IntoSD59x18_Overflow(x);\\n }\\n result = SD59x18.wrap(int256(xUint));\\n}\\n\\n/// @notice Casts a UD60x18 number into uint128.\\n/// @dev This is basically an alias for {unwrap}.\\nfunction intoUint256(UD60x18 x) pure returns (uint256 result) {\\n result = UD60x18.unwrap(x);\\n}\\n\\n/// @notice Casts a UD60x18 number into uint128.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UINT128`.\\nfunction intoUint128(UD60x18 x) pure returns (uint128 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > MAX_UINT128) {\\n revert CastingErrors.PRBMath_UD60x18_IntoUint128_Overflow(x);\\n }\\n result = uint128(xUint);\\n}\\n\\n/// @notice Casts a UD60x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(UD60x18 x) pure returns (uint40 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > MAX_UINT40) {\\n revert CastingErrors.PRBMath_UD60x18_IntoUint40_Overflow(x);\\n }\\n result = uint40(xUint);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction ud(uint256 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(x);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction ud60x18(uint256 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(x);\\n}\\n\\n/// @notice Unwraps a UD60x18 number into uint256.\\nfunction unwrap(UD60x18 x) pure returns (uint256 result) {\\n result = UD60x18.unwrap(x);\\n}\\n\\n/// @notice Wraps a uint256 number into the UD60x18 value type.\\nfunction wrap(uint256 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x5bb532da36921cbdac64d1f16de5d366ef1f664502e3b7c07d0ad06917551f85\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n// NOTICE: the \\\"u\\\" prefix stands for \\\"unwrapped\\\".\\n\\n/// @dev Euler's number as a UD60x18 number.\\nUD60x18 constant E = UD60x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum input permitted in {exp}.\\nuint256 constant uEXP_MAX_INPUT = 133_084258667509499440;\\nUD60x18 constant EXP_MAX_INPUT = UD60x18.wrap(uEXP_MAX_INPUT);\\n\\n/// @dev The maximum input permitted in {exp2}.\\nuint256 constant uEXP2_MAX_INPUT = 192e18 - 1;\\nUD60x18 constant EXP2_MAX_INPUT = UD60x18.wrap(uEXP2_MAX_INPUT);\\n\\n/// @dev Half the UNIT number.\\nuint256 constant uHALF_UNIT = 0.5e18;\\nUD60x18 constant HALF_UNIT = UD60x18.wrap(uHALF_UNIT);\\n\\n/// @dev $log_2(10)$ as a UD60x18 number.\\nuint256 constant uLOG2_10 = 3_321928094887362347;\\nUD60x18 constant LOG2_10 = UD60x18.wrap(uLOG2_10);\\n\\n/// @dev $log_2(e)$ as a UD60x18 number.\\nuint256 constant uLOG2_E = 1_442695040888963407;\\nUD60x18 constant LOG2_E = UD60x18.wrap(uLOG2_E);\\n\\n/// @dev The maximum value a UD60x18 number can have.\\nuint256 constant uMAX_UD60x18 = 115792089237316195423570985008687907853269984665640564039457_584007913129639935;\\nUD60x18 constant MAX_UD60x18 = UD60x18.wrap(uMAX_UD60x18);\\n\\n/// @dev The maximum whole value a UD60x18 number can have.\\nuint256 constant uMAX_WHOLE_UD60x18 = 115792089237316195423570985008687907853269984665640564039457_000000000000000000;\\nUD60x18 constant MAX_WHOLE_UD60x18 = UD60x18.wrap(uMAX_WHOLE_UD60x18);\\n\\n/// @dev PI as a UD60x18 number.\\nUD60x18 constant PI = UD60x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of UD60x18.\\nuint256 constant uUNIT = 1e18;\\nUD60x18 constant UNIT = UD60x18.wrap(uUNIT);\\n\\n/// @dev The unit number squared.\\nuint256 constant uUNIT_SQUARED = 1e36;\\nUD60x18 constant UNIT_SQUARED = UD60x18.wrap(uUNIT_SQUARED);\\n\\n/// @dev Zero as a UD60x18 number.\\nUD60x18 constant ZERO = UD60x18.wrap(0);\\n\",\"keccak256\":\"0x2b80d26153d3fdcfb3a9ca772d9309d31ed1275f5b8b54c3ffb54d3652b37d90\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Conversions.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { uMAX_UD60x18, uUNIT } from \\\"./Constants.sol\\\";\\nimport { PRBMath_UD60x18_Convert_Overflow } from \\\"./Errors.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Converts a UD60x18 number to a simple integer by dividing it by `UNIT`.\\n/// @dev The result is rounded toward zero.\\n/// @param x The UD60x18 number to convert.\\n/// @return result The same number in basic integer form.\\nfunction convert(UD60x18 x) pure returns (uint256 result) {\\n result = UD60x18.unwrap(x) / uUNIT;\\n}\\n\\n/// @notice Converts a simple integer to UD60x18 by multiplying it by `UNIT`.\\n///\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UD60x18 / UNIT`.\\n///\\n/// @param x The basic integer to convert.\\n/// @param result The same number converted to UD60x18.\\nfunction convert(uint256 x) pure returns (UD60x18 result) {\\n if (x > uMAX_UD60x18 / uUNIT) {\\n revert PRBMath_UD60x18_Convert_Overflow(x);\\n }\\n unchecked {\\n result = UD60x18.wrap(x * uUNIT);\\n }\\n}\\n\",\"keccak256\":\"0xaf7fc2523413822de3b66ba339fe2884fb3b8c6f6cf38ec90a2c3e3aae71df6b\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when ceiling a number overflows UD60x18.\\nerror PRBMath_UD60x18_Ceil_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when converting a basic integer to the fixed-point format overflows UD60x18.\\nerror PRBMath_UD60x18_Convert_Overflow(uint256 x);\\n\\n/// @notice Thrown when taking the natural exponent of a base greater than 133_084258667509499441.\\nerror PRBMath_UD60x18_Exp_InputTooBig(UD60x18 x);\\n\\n/// @notice Thrown when taking the binary exponent of a base greater than 192e18.\\nerror PRBMath_UD60x18_Exp2_InputTooBig(UD60x18 x);\\n\\n/// @notice Thrown when taking the geometric mean of two numbers and multiplying them overflows UD60x18.\\nerror PRBMath_UD60x18_Gm_Overflow(UD60x18 x, UD60x18 y);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\\nerror PRBMath_UD60x18_IntoSD1x18_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD59x18.\\nerror PRBMath_UD60x18_IntoSD59x18_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\\nerror PRBMath_UD60x18_IntoUD2x18_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\\nerror PRBMath_UD60x18_IntoUint128_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\\nerror PRBMath_UD60x18_IntoUint40_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when taking the logarithm of a number less than 1.\\nerror PRBMath_UD60x18_Log_InputTooSmall(UD60x18 x);\\n\\n/// @notice Thrown when calculating the square root overflows UD60x18.\\nerror PRBMath_UD60x18_Sqrt_Overflow(UD60x18 x);\\n\",\"keccak256\":\"0xa8c60d4066248df22c49c882873efbc017344107edabc48c52209abbc39cb1e3\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Helpers.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { wrap } from \\\"./Casting.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Implements the checked addition operation (+) in the UD60x18 type.\\nfunction add(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() + y.unwrap());\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the UD60x18 type.\\nfunction and(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() & bits);\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the UD60x18 type.\\nfunction and2(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() & y.unwrap());\\n}\\n\\n/// @notice Implements the equal operation (==) in the UD60x18 type.\\nfunction eq(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() == y.unwrap();\\n}\\n\\n/// @notice Implements the greater than operation (>) in the UD60x18 type.\\nfunction gt(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() > y.unwrap();\\n}\\n\\n/// @notice Implements the greater than or equal to operation (>=) in the UD60x18 type.\\nfunction gte(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() >= y.unwrap();\\n}\\n\\n/// @notice Implements a zero comparison check function in the UD60x18 type.\\nfunction isZero(UD60x18 x) pure returns (bool result) {\\n // This wouldn't work if x could be negative.\\n result = x.unwrap() == 0;\\n}\\n\\n/// @notice Implements the left shift operation (<<) in the UD60x18 type.\\nfunction lshift(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() << bits);\\n}\\n\\n/// @notice Implements the lower than operation (<) in the UD60x18 type.\\nfunction lt(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() < y.unwrap();\\n}\\n\\n/// @notice Implements the lower than or equal to operation (<=) in the UD60x18 type.\\nfunction lte(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() <= y.unwrap();\\n}\\n\\n/// @notice Implements the checked modulo operation (%) in the UD60x18 type.\\nfunction mod(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() % y.unwrap());\\n}\\n\\n/// @notice Implements the not equal operation (!=) in the UD60x18 type.\\nfunction neq(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() != y.unwrap();\\n}\\n\\n/// @notice Implements the NOT (~) bitwise operation in the UD60x18 type.\\nfunction not(UD60x18 x) pure returns (UD60x18 result) {\\n result = wrap(~x.unwrap());\\n}\\n\\n/// @notice Implements the OR (|) bitwise operation in the UD60x18 type.\\nfunction or(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() | y.unwrap());\\n}\\n\\n/// @notice Implements the right shift operation (>>) in the UD60x18 type.\\nfunction rshift(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() >> bits);\\n}\\n\\n/// @notice Implements the checked subtraction operation (-) in the UD60x18 type.\\nfunction sub(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() - y.unwrap());\\n}\\n\\n/// @notice Implements the unchecked addition operation (+) in the UD60x18 type.\\nfunction uncheckedAdd(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() + y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the unchecked subtraction operation (-) in the UD60x18 type.\\nfunction uncheckedSub(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() - y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the XOR (^) bitwise operation in the UD60x18 type.\\nfunction xor(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() ^ y.unwrap());\\n}\\n\",\"keccak256\":\"0xf5faff881391d2c060029499a666cc5f0bea90a213150bb476fae8f02a5df268\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as Errors;\\nimport { wrap } from \\\"./Casting.sol\\\";\\nimport {\\n uEXP_MAX_INPUT,\\n uEXP2_MAX_INPUT,\\n uHALF_UNIT,\\n uLOG2_10,\\n uLOG2_E,\\n uMAX_UD60x18,\\n uMAX_WHOLE_UD60x18,\\n UNIT,\\n uUNIT,\\n uUNIT_SQUARED,\\n ZERO\\n} from \\\"./Constants.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n MATHEMATICAL FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @notice Calculates the arithmetic average of x and y using the following formula:\\n///\\n/// $$\\n/// avg(x, y) = (x & y) + ((xUint ^ yUint) / 2)\\n/// $$\\n///\\n/// In English, this is what this formula does:\\n///\\n/// 1. AND x and y.\\n/// 2. Calculate half of XOR x and y.\\n/// 3. Add the two results together.\\n///\\n/// This technique is known as SWAR, which stands for \\\"SIMD within a register\\\". You can read more about it here:\\n/// https://devblogs.microsoft.com/oldnewthing/20220207-00/?p=106223\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// @param x The first operand as a UD60x18 number.\\n/// @param y The second operand as a UD60x18 number.\\n/// @return result The arithmetic average as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction avg(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n uint256 yUint = y.unwrap();\\n unchecked {\\n result = wrap((xUint & yUint) + ((xUint ^ yUint) >> 1));\\n }\\n}\\n\\n/// @notice Yields the smallest whole number greater than or equal to x.\\n///\\n/// @dev This is optimized for fractional value inputs, because for every whole value there are (1e18 - 1) fractional\\n/// counterparts. See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n///\\n/// Requirements:\\n/// - x must be less than or equal to `MAX_WHOLE_UD60x18`.\\n///\\n/// @param x The UD60x18 number to ceil.\\n/// @param result The smallest whole number greater than or equal to x, as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ceil(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n if (xUint > uMAX_WHOLE_UD60x18) {\\n revert Errors.PRBMath_UD60x18_Ceil_Overflow(x);\\n }\\n\\n assembly (\\\"memory-safe\\\") {\\n // Equivalent to `x % UNIT`.\\n let remainder := mod(x, uUNIT)\\n\\n // Equivalent to `UNIT - remainder`.\\n let delta := sub(uUNIT, remainder)\\n\\n // Equivalent to `x + remainder > 0 ? delta : 0`.\\n result := add(x, mul(delta, gt(remainder, 0)))\\n }\\n}\\n\\n/// @notice Divides two UD60x18 numbers, returning a new UD60x18 number.\\n///\\n/// @dev Uses {Common.mulDiv} to enable overflow-safe multiplication and division.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv}.\\n///\\n/// @param x The numerator as a UD60x18 number.\\n/// @param y The denominator as a UD60x18 number.\\n/// @param result The quotient as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction div(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(Common.mulDiv(x.unwrap(), uUNIT, y.unwrap()));\\n}\\n\\n/// @notice Calculates the natural exponent of x using the following formula:\\n///\\n/// $$\\n/// e^x = 2^{x * log_2{e}}\\n/// $$\\n///\\n/// @dev Requirements:\\n/// - x must be less than 133_084258667509499441.\\n///\\n/// @param x The exponent as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n // This check prevents values greater than 192e18 from being passed to {exp2}.\\n if (xUint > uEXP_MAX_INPUT) {\\n revert Errors.PRBMath_UD60x18_Exp_InputTooBig(x);\\n }\\n\\n unchecked {\\n // Inline the fixed-point multiplication to save gas.\\n uint256 doubleUnitProduct = xUint * uLOG2_E;\\n result = exp2(wrap(doubleUnitProduct / uUNIT));\\n }\\n}\\n\\n/// @notice Calculates the binary exponent of x using the binary fraction method.\\n///\\n/// @dev See https://ethereum.stackexchange.com/q/79903/24693\\n///\\n/// Requirements:\\n/// - x must be less than 192e18.\\n/// - The result must fit in UD60x18.\\n///\\n/// @param x The exponent as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp2(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n // Numbers greater than or equal to 192e18 don't fit in the 192.64-bit format.\\n if (xUint > uEXP2_MAX_INPUT) {\\n revert Errors.PRBMath_UD60x18_Exp2_InputTooBig(x);\\n }\\n\\n // Convert x to the 192.64-bit fixed-point format.\\n uint256 x_192x64 = (xUint << 64) / uUNIT;\\n\\n // Pass x to the {Common.exp2} function, which uses the 192.64-bit fixed-point number representation.\\n result = wrap(Common.exp2(x_192x64));\\n}\\n\\n/// @notice Yields the greatest whole number less than or equal to x.\\n/// @dev Optimized for fractional value inputs, because every whole value has (1e18 - 1) fractional counterparts.\\n/// See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n/// @param x The UD60x18 number to floor.\\n/// @param result The greatest whole number less than or equal to x, as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction floor(UD60x18 x) pure returns (UD60x18 result) {\\n assembly (\\\"memory-safe\\\") {\\n // Equivalent to `x % UNIT`.\\n let remainder := mod(x, uUNIT)\\n\\n // Equivalent to `x - remainder > 0 ? remainder : 0)`.\\n result := sub(x, mul(remainder, gt(remainder, 0)))\\n }\\n}\\n\\n/// @notice Yields the excess beyond the floor of x using the odd function definition.\\n/// @dev See https://en.wikipedia.org/wiki/Fractional_part.\\n/// @param x The UD60x18 number to get the fractional part of.\\n/// @param result The fractional part of x as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction frac(UD60x18 x) pure returns (UD60x18 result) {\\n assembly (\\\"memory-safe\\\") {\\n result := mod(x, uUNIT)\\n }\\n}\\n\\n/// @notice Calculates the geometric mean of x and y, i.e. $\\\\sqrt{x * y}$, rounding down.\\n///\\n/// @dev Requirements:\\n/// - x * y must fit in UD60x18.\\n///\\n/// @param x The first operand as a UD60x18 number.\\n/// @param y The second operand as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction gm(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n uint256 yUint = y.unwrap();\\n if (xUint == 0 || yUint == 0) {\\n return ZERO;\\n }\\n\\n unchecked {\\n // Checking for overflow this way is faster than letting Solidity do it.\\n uint256 xyUint = xUint * yUint;\\n if (xyUint / xUint != yUint) {\\n revert Errors.PRBMath_UD60x18_Gm_Overflow(x, y);\\n }\\n\\n // We don't need to multiply the result by `UNIT` here because the x*y product picked up a factor of `UNIT`\\n // during multiplication. See the comments in {Common.sqrt}.\\n result = wrap(Common.sqrt(xyUint));\\n }\\n}\\n\\n/// @notice Calculates the inverse of x.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x must not be zero.\\n///\\n/// @param x The UD60x18 number for which to calculate the inverse.\\n/// @return result The inverse as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction inv(UD60x18 x) pure returns (UD60x18 result) {\\n unchecked {\\n result = wrap(uUNIT_SQUARED / x.unwrap());\\n }\\n}\\n\\n/// @notice Calculates the natural logarithm of x using the following formula:\\n///\\n/// $$\\n/// ln{x} = log_2{x} / log_2{e}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n/// - The precision isn't sufficiently fine-grained to return exactly `UNIT` when the input is `E`.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The UD60x18 number for which to calculate the natural logarithm.\\n/// @return result The natural logarithm as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ln(UD60x18 x) pure returns (UD60x18 result) {\\n unchecked {\\n // Inline the fixed-point multiplication to save gas. This is overflow-safe because the maximum value that\\n // {log2} can return is ~196_205294292027477728.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_E);\\n }\\n}\\n\\n/// @notice Calculates the common logarithm of x using the following formula:\\n///\\n/// $$\\n/// log_{10}{x} = log_2{x} / log_2{10}\\n/// $$\\n///\\n/// However, if x is an exact power of ten, a hard coded value is returned.\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The UD60x18 number for which to calculate the common logarithm.\\n/// @return result The common logarithm as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log10(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n if (xUint < uUNIT) {\\n revert Errors.PRBMath_UD60x18_Log_InputTooSmall(x);\\n }\\n\\n // Note that the `mul` in this assembly block is the standard multiplication operation, not {UD60x18.mul}.\\n // prettier-ignore\\n assembly (\\\"memory-safe\\\") {\\n switch x\\n case 1 { result := mul(uUNIT, sub(0, 18)) }\\n case 10 { result := mul(uUNIT, sub(1, 18)) }\\n case 100 { result := mul(uUNIT, sub(2, 18)) }\\n case 1000 { result := mul(uUNIT, sub(3, 18)) }\\n case 10000 { result := mul(uUNIT, sub(4, 18)) }\\n case 100000 { result := mul(uUNIT, sub(5, 18)) }\\n case 1000000 { result := mul(uUNIT, sub(6, 18)) }\\n case 10000000 { result := mul(uUNIT, sub(7, 18)) }\\n case 100000000 { result := mul(uUNIT, sub(8, 18)) }\\n case 1000000000 { result := mul(uUNIT, sub(9, 18)) }\\n case 10000000000 { result := mul(uUNIT, sub(10, 18)) }\\n case 100000000000 { result := mul(uUNIT, sub(11, 18)) }\\n case 1000000000000 { result := mul(uUNIT, sub(12, 18)) }\\n case 10000000000000 { result := mul(uUNIT, sub(13, 18)) }\\n case 100000000000000 { result := mul(uUNIT, sub(14, 18)) }\\n case 1000000000000000 { result := mul(uUNIT, sub(15, 18)) }\\n case 10000000000000000 { result := mul(uUNIT, sub(16, 18)) }\\n case 100000000000000000 { result := mul(uUNIT, sub(17, 18)) }\\n case 1000000000000000000 { result := 0 }\\n case 10000000000000000000 { result := uUNIT }\\n case 100000000000000000000 { result := mul(uUNIT, 2) }\\n case 1000000000000000000000 { result := mul(uUNIT, 3) }\\n case 10000000000000000000000 { result := mul(uUNIT, 4) }\\n case 100000000000000000000000 { result := mul(uUNIT, 5) }\\n case 1000000000000000000000000 { result := mul(uUNIT, 6) }\\n case 10000000000000000000000000 { result := mul(uUNIT, 7) }\\n case 100000000000000000000000000 { result := mul(uUNIT, 8) }\\n case 1000000000000000000000000000 { result := mul(uUNIT, 9) }\\n case 10000000000000000000000000000 { result := mul(uUNIT, 10) }\\n case 100000000000000000000000000000 { result := mul(uUNIT, 11) }\\n case 1000000000000000000000000000000 { result := mul(uUNIT, 12) }\\n case 10000000000000000000000000000000 { result := mul(uUNIT, 13) }\\n case 100000000000000000000000000000000 { result := mul(uUNIT, 14) }\\n case 1000000000000000000000000000000000 { result := mul(uUNIT, 15) }\\n case 10000000000000000000000000000000000 { result := mul(uUNIT, 16) }\\n case 100000000000000000000000000000000000 { result := mul(uUNIT, 17) }\\n case 1000000000000000000000000000000000000 { result := mul(uUNIT, 18) }\\n case 10000000000000000000000000000000000000 { result := mul(uUNIT, 19) }\\n case 100000000000000000000000000000000000000 { result := mul(uUNIT, 20) }\\n case 1000000000000000000000000000000000000000 { result := mul(uUNIT, 21) }\\n case 10000000000000000000000000000000000000000 { result := mul(uUNIT, 22) }\\n case 100000000000000000000000000000000000000000 { result := mul(uUNIT, 23) }\\n case 1000000000000000000000000000000000000000000 { result := mul(uUNIT, 24) }\\n case 10000000000000000000000000000000000000000000 { result := mul(uUNIT, 25) }\\n case 100000000000000000000000000000000000000000000 { result := mul(uUNIT, 26) }\\n case 1000000000000000000000000000000000000000000000 { result := mul(uUNIT, 27) }\\n case 10000000000000000000000000000000000000000000000 { result := mul(uUNIT, 28) }\\n case 100000000000000000000000000000000000000000000000 { result := mul(uUNIT, 29) }\\n case 1000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 30) }\\n case 10000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 31) }\\n case 100000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 32) }\\n case 1000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 33) }\\n case 10000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 34) }\\n case 100000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 35) }\\n case 1000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 36) }\\n case 10000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 37) }\\n case 100000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 38) }\\n case 1000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 39) }\\n case 10000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 40) }\\n case 100000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 41) }\\n case 1000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 42) }\\n case 10000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 43) }\\n case 100000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 44) }\\n case 1000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 45) }\\n case 10000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 46) }\\n case 100000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 47) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 48) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 49) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 50) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 51) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 52) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 53) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 54) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 55) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 56) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 57) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 58) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 59) }\\n default { result := uMAX_UD60x18 }\\n }\\n\\n if (result.unwrap() == uMAX_UD60x18) {\\n unchecked {\\n // Inline the fixed-point division to save gas.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_10);\\n }\\n }\\n}\\n\\n/// @notice Calculates the binary logarithm of x using the iterative approximation algorithm:\\n///\\n/// $$\\n/// log_2{x} = n + log_2{y}, \\\\text{ where } y = x*2^{-n}, \\\\ y \\\\in [1, 2)\\n/// $$\\n///\\n/// For $0 \\\\leq x \\\\lt 1$, the input is inverted:\\n///\\n/// $$\\n/// log_2{x} = -log_2{\\\\frac{1}{x}}\\n/// $$\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Binary_logarithm#Iterative_approximation\\n///\\n/// Notes:\\n/// - Due to the lossy precision of the iterative approximation, the results are not perfectly accurate to the last decimal.\\n///\\n/// Requirements:\\n/// - x must be greater than zero.\\n///\\n/// @param x The UD60x18 number for which to calculate the binary logarithm.\\n/// @return result The binary logarithm as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log2(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n if (xUint < uUNIT) {\\n revert Errors.PRBMath_UD60x18_Log_InputTooSmall(x);\\n }\\n\\n unchecked {\\n // Calculate the integer part of the logarithm.\\n uint256 n = Common.msb(xUint / uUNIT);\\n\\n // This is the integer part of the logarithm as a UD60x18 number. The operation can't overflow because n\\n // n is at most 255 and UNIT is 1e18.\\n uint256 resultUint = n * uUNIT;\\n\\n // Calculate $y = x * 2^{-n}$.\\n uint256 y = xUint >> n;\\n\\n // If y is the unit number, the fractional part is zero.\\n if (y == uUNIT) {\\n return wrap(resultUint);\\n }\\n\\n // Calculate the fractional part via the iterative approximation.\\n // The `delta >>= 1` part is equivalent to `delta /= 2`, but shifting bits is more gas efficient.\\n uint256 DOUBLE_UNIT = 2e18;\\n for (uint256 delta = uHALF_UNIT; delta > 0; delta >>= 1) {\\n y = (y * y) / uUNIT;\\n\\n // Is y^2 >= 2e18 and so in the range [2e18, 4e18)?\\n if (y >= DOUBLE_UNIT) {\\n // Add the 2^{-m} factor to the logarithm.\\n resultUint += delta;\\n\\n // Halve y, which corresponds to z/2 in the Wikipedia article.\\n y >>= 1;\\n }\\n }\\n result = wrap(resultUint);\\n }\\n}\\n\\n/// @notice Multiplies two UD60x18 numbers together, returning a new UD60x18 number.\\n///\\n/// @dev Uses {Common.mulDiv} to enable overflow-safe multiplication and division.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv}.\\n///\\n/// @dev See the documentation in {Common.mulDiv18}.\\n/// @param x The multiplicand as a UD60x18 number.\\n/// @param y The multiplier as a UD60x18 number.\\n/// @return result The product as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mul(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(Common.mulDiv18(x.unwrap(), y.unwrap()));\\n}\\n\\n/// @notice Raises x to the power of y.\\n///\\n/// For $1 \\\\leq x \\\\leq \\\\infty$, the following standard formula is used:\\n///\\n/// $$\\n/// x^y = 2^{log_2{x} * y}\\n/// $$\\n///\\n/// For $0 \\\\leq x \\\\lt 1$, since the unsigned {log2} is undefined, an equivalent formula is used:\\n///\\n/// $$\\n/// i = \\\\frac{1}{x}\\n/// w = 2^{log_2{i} * y}\\n/// x^y = \\\\frac{1}{w}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2} and {mul}.\\n/// - Returns `UNIT` for 0^0.\\n/// - It may not perform well with very small values of x. Consider using SD59x18 as an alternative.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {exp2}, {log2}, and {mul}.\\n///\\n/// @param x The base as a UD60x18 number.\\n/// @param y The exponent as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction pow(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n uint256 yUint = y.unwrap();\\n\\n // If both x and y are zero, the result is `UNIT`. If just x is zero, the result is always zero.\\n if (xUint == 0) {\\n return yUint == 0 ? UNIT : ZERO;\\n }\\n // If x is `UNIT`, the result is always `UNIT`.\\n else if (xUint == uUNIT) {\\n return UNIT;\\n }\\n\\n // If y is zero, the result is always `UNIT`.\\n if (yUint == 0) {\\n return UNIT;\\n }\\n // If y is `UNIT`, the result is always x.\\n else if (yUint == uUNIT) {\\n return x;\\n }\\n\\n // If x is greater than `UNIT`, use the standard formula.\\n if (xUint > uUNIT) {\\n result = exp2(mul(log2(x), y));\\n }\\n // Conversely, if x is less than `UNIT`, use the equivalent formula.\\n else {\\n UD60x18 i = wrap(uUNIT_SQUARED / xUint);\\n UD60x18 w = exp2(mul(log2(i), y));\\n result = wrap(uUNIT_SQUARED / w.unwrap());\\n }\\n}\\n\\n/// @notice Raises x (a UD60x18 number) to the power y (an unsigned basic integer) using the well-known\\n/// algorithm \\\"exponentiation by squaring\\\".\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Exponentiation_by_squaring.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv18}.\\n/// - Returns `UNIT` for 0^0.\\n///\\n/// Requirements:\\n/// - The result must fit in UD60x18.\\n///\\n/// @param x The base as a UD60x18 number.\\n/// @param y The exponent as a uint256.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction powu(UD60x18 x, uint256 y) pure returns (UD60x18 result) {\\n // Calculate the first iteration of the loop in advance.\\n uint256 xUint = x.unwrap();\\n uint256 resultUint = y & 1 > 0 ? xUint : uUNIT;\\n\\n // Equivalent to `for(y /= 2; y > 0; y /= 2)`.\\n for (y >>= 1; y > 0; y >>= 1) {\\n xUint = Common.mulDiv18(xUint, xUint);\\n\\n // Equivalent to `y % 2 == 1`.\\n if (y & 1 > 0) {\\n resultUint = Common.mulDiv18(resultUint, xUint);\\n }\\n }\\n result = wrap(resultUint);\\n}\\n\\n/// @notice Calculates the square root of x using the Babylonian method.\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\\n///\\n/// Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x must be less than `MAX_UD60x18 / UNIT`.\\n///\\n/// @param x The UD60x18 number for which to calculate the square root.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction sqrt(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n unchecked {\\n if (xUint > uMAX_UD60x18 / uUNIT) {\\n revert Errors.PRBMath_UD60x18_Sqrt_Overflow(x);\\n }\\n // Multiply x by `UNIT` to account for the factor of `UNIT` picked up when multiplying two UD60x18 numbers.\\n // In this case, the two numbers are both the square root.\\n result = wrap(Common.sqrt(xUint * uUNIT));\\n }\\n}\\n\",\"keccak256\":\"0x462144667aac3f96d5f8dba7aa68fe4c5a3f61e1d7bbbc81bee21168817f9c09\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\nimport \\\"./Helpers.sol\\\" as Helpers;\\nimport \\\"./Math.sol\\\" as Math;\\n\\n/// @notice The unsigned 60.18-decimal fixed-point number representation, which can have up to 60 digits and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the Solidity type uint256.\\n/// @dev The value type is defined here so it can be imported in all other files.\\ntype UD60x18 is uint256;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoSD1x18,\\n Casting.intoUD2x18,\\n Casting.intoSD59x18,\\n Casting.intoUint128,\\n Casting.intoUint256,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for UD60x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n MATHEMATICAL FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes the functions in this library callable on the UD60x18 type.\\nusing {\\n Math.avg,\\n Math.ceil,\\n Math.div,\\n Math.exp,\\n Math.exp2,\\n Math.floor,\\n Math.frac,\\n Math.gm,\\n Math.inv,\\n Math.ln,\\n Math.log10,\\n Math.log2,\\n Math.mul,\\n Math.pow,\\n Math.powu,\\n Math.sqrt\\n} for UD60x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n HELPER FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes the functions in this library callable on the UD60x18 type.\\nusing {\\n Helpers.add,\\n Helpers.and,\\n Helpers.eq,\\n Helpers.gt,\\n Helpers.gte,\\n Helpers.isZero,\\n Helpers.lshift,\\n Helpers.lt,\\n Helpers.lte,\\n Helpers.mod,\\n Helpers.neq,\\n Helpers.not,\\n Helpers.or,\\n Helpers.rshift,\\n Helpers.sub,\\n Helpers.uncheckedAdd,\\n Helpers.uncheckedSub,\\n Helpers.xor\\n} for UD60x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n OPERATORS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes it possible to use these operators on the UD60x18 type.\\nusing {\\n Helpers.add as +,\\n Helpers.and2 as &,\\n Math.div as /,\\n Helpers.eq as ==,\\n Helpers.gt as >,\\n Helpers.gte as >=,\\n Helpers.lt as <,\\n Helpers.lte as <=,\\n Helpers.or as |,\\n Helpers.mod as %,\\n Math.mul as *,\\n Helpers.neq as !=,\\n Helpers.not as ~,\\n Helpers.sub as -,\\n Helpers.xor as ^\\n} for UD60x18 global;\\n\",\"keccak256\":\"0xdd873b5124180d9b71498b3a7fe93b1c08c368bec741f7d5f8e17f78a0b70f31\",\"license\":\"MIT\"},\"contracts/interfaces/IERC6551Registry.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\ninterface IERC6551Registry {\\n /**\\n * @dev Creates a token bound account for a non-fungible token.\\n *\\n * If account has already been created, returns the account address without calling create2.\\n *\\n * Emits ERC6551AccountCreated event.\\n *\\n * @return account The address of the token bound account\\n */\\n function createAccount(\\n address implementation,\\n bytes32 salt,\\n uint256 chainId,\\n address tokenContract,\\n uint256 tokenId\\n ) external returns (address account);\\n}\\n\",\"keccak256\":\"0x64c52de8a8e68398e61dd8b42dda8e9af8cf6abf93bb85629c322440991ea568\",\"license\":\"MIT\"},\"contracts/interfaces/hats/HatsErrors.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface HatsErrors {\\n /// @notice Emitted when `user` is attempting to perform an action on `hatId` but is not wearing one of `hatId`'s admin hats\\n /// @dev Can be equivalent to `NotHatWearer(buildHatId(hatId))`, such as when emitted by `approveLinkTopHatToTree` or `relinkTopHatToTree`\\n error NotAdmin(address user, uint256 hatId);\\n\\n /// @notice Emitted when attempting to perform an action as or for an account that is not a wearer of a given hat\\n error NotHatWearer();\\n\\n /// @notice Emitted when attempting to perform an action that requires being either an admin or wearer of a given hat\\n error NotAdminOrWearer();\\n\\n /// @notice Emitted when attempting to mint `hatId` but `hatId`'s maxSupply has been reached\\n error AllHatsWorn(uint256 hatId);\\n\\n /// @notice Emitted when attempting to create a hat with a level 14 hat as its admin\\n error MaxLevelsReached();\\n\\n /// @notice Emitted when an attempted hat id has empty intermediate level(s)\\n error InvalidHatId();\\n\\n /// @notice Emitted when attempting to mint `hatId` to a `wearer` who is already wearing the hat\\n error AlreadyWearingHat(address wearer, uint256 hatId);\\n\\n /// @notice Emitted when attempting to mint a non-existant hat\\n error HatDoesNotExist(uint256 hatId);\\n\\n /// @notice Emmitted when attempting to mint or transfer a hat that is not active\\n error HatNotActive();\\n\\n /// @notice Emitted when attempting to mint or transfer a hat to an ineligible wearer\\n error NotEligible();\\n\\n /// @notice Emitted when attempting to check or set a hat's status from an account that is not that hat's toggle module\\n error NotHatsToggle();\\n\\n /// @notice Emitted when attempting to check or set a hat wearer's status from an account that is not that hat's eligibility module\\n error NotHatsEligibility();\\n\\n /// @notice Emitted when array arguments to a batch function have mismatching lengths\\n error BatchArrayLengthMismatch();\\n\\n /// @notice Emitted when attempting to mutate or transfer an immutable hat\\n error Immutable();\\n\\n /// @notice Emitted when attempting to change a hat's maxSupply to a value lower than its current supply\\n error NewMaxSupplyTooLow();\\n\\n /// @notice Emitted when attempting to link a tophat to a new admin for which the tophat serves as an admin\\n error CircularLinkage();\\n\\n /// @notice Emitted when attempting to link or relink a tophat to a separate tree\\n error CrossTreeLinkage();\\n\\n /// @notice Emitted when attempting to link a tophat without a request\\n error LinkageNotRequested();\\n\\n /// @notice Emitted when attempting to unlink a tophat that does not have a wearer\\n /// @dev This ensures that unlinking never results in a bricked tophat\\n error InvalidUnlink();\\n\\n /// @notice Emmited when attempting to change a hat's eligibility or toggle module to the zero address\\n error ZeroAddress();\\n\\n /// @notice Emmitted when attempting to change a hat's details or imageURI to a string with over 7000 bytes (~characters)\\n /// @dev This protects against a DOS attack where an admin iteratively extend's a hat's details or imageURI\\n /// to be so long that reading it exceeds the block gas limit, breaking `uri()` and `viewHat()`\\n error StringTooLong();\\n}\\n\",\"keccak256\":\"0x81b0056b7bed86eabc07c0e4a9655c586ddb8e6c128320593669b76efd5a08de\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/HatsEvents.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface HatsEvents {\\n /// @notice Emitted when a new hat is created\\n /// @param id The id for the new hat\\n /// @param details A description of the Hat\\n /// @param maxSupply The total instances of the Hat that can be worn at once\\n /// @param eligibility The address that can report on the Hat wearer's status\\n /// @param toggle The address that can deactivate the Hat\\n /// @param mutable_ Whether the hat's properties are changeable after creation\\n /// @param imageURI The image uri for this hat and the fallback for its\\n event HatCreated(\\n uint256 id,\\n string details,\\n uint32 maxSupply,\\n address eligibility,\\n address toggle,\\n bool mutable_,\\n string imageURI\\n );\\n\\n /// @notice Emitted when a hat wearer's standing is updated\\n /// @dev Eligibility is excluded since the source of truth for eligibility is the eligibility module and may change without a transaction\\n /// @param hatId The id of the wearer's hat\\n /// @param wearer The wearer's address\\n /// @param wearerStanding Whether the wearer is in good standing for the hat\\n event WearerStandingChanged(\\n uint256 hatId,\\n address wearer,\\n bool wearerStanding\\n );\\n\\n /// @notice Emitted when a hat's status is updated\\n /// @param hatId The id of the hat\\n /// @param newStatus Whether the hat is active\\n event HatStatusChanged(uint256 hatId, bool newStatus);\\n\\n /// @notice Emitted when a hat's details are updated\\n /// @param hatId The id of the hat\\n /// @param newDetails The updated details\\n event HatDetailsChanged(uint256 hatId, string newDetails);\\n\\n /// @notice Emitted when a hat's eligibility module is updated\\n /// @param hatId The id of the hat\\n /// @param newEligibility The updated eligibiliy module\\n event HatEligibilityChanged(uint256 hatId, address newEligibility);\\n\\n /// @notice Emitted when a hat's toggle module is updated\\n /// @param hatId The id of the hat\\n /// @param newToggle The updated toggle module\\n event HatToggleChanged(uint256 hatId, address newToggle);\\n\\n /// @notice Emitted when a hat's mutability is updated\\n /// @param hatId The id of the hat\\n event HatMutabilityChanged(uint256 hatId);\\n\\n /// @notice Emitted when a hat's maximum supply is updated\\n /// @param hatId The id of the hat\\n /// @param newMaxSupply The updated max supply\\n event HatMaxSupplyChanged(uint256 hatId, uint32 newMaxSupply);\\n\\n /// @notice Emitted when a hat's image URI is updated\\n /// @param hatId The id of the hat\\n /// @param newImageURI The updated image URI\\n event HatImageURIChanged(uint256 hatId, string newImageURI);\\n\\n /// @notice Emitted when a tophat linkage is requested by its admin\\n /// @param domain The domain of the tree tophat to link\\n /// @param newAdmin The tophat's would-be admin in the parent tree\\n event TopHatLinkRequested(uint32 domain, uint256 newAdmin);\\n\\n /// @notice Emitted when a tophat is linked to a another tree\\n /// @param domain The domain of the newly-linked tophat\\n /// @param newAdmin The tophat's new admin in the parent tree\\n event TopHatLinked(uint32 domain, uint256 newAdmin);\\n}\\n\",\"keccak256\":\"0x53413397d15e1636c3cd7bd667656b79bc2886785403b824bcd4ed122667f2c6\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/IHats.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\nimport \\\"./IHatsIdUtilities.sol\\\";\\nimport \\\"./HatsErrors.sol\\\";\\nimport \\\"./HatsEvents.sol\\\";\\n\\ninterface IHats is IHatsIdUtilities, HatsErrors, HatsEvents {\\n function mintTopHat(\\n address _target,\\n string memory _details,\\n string memory _imageURI\\n ) external returns (uint256 topHatId);\\n\\n function createHat(\\n uint256 _admin,\\n string calldata _details,\\n uint32 _maxSupply,\\n address _eligibility,\\n address _toggle,\\n bool _mutable,\\n string calldata _imageURI\\n ) external returns (uint256 newHatId);\\n\\n function batchCreateHats(\\n uint256[] calldata _admins,\\n string[] calldata _details,\\n uint32[] calldata _maxSupplies,\\n address[] memory _eligibilityModules,\\n address[] memory _toggleModules,\\n bool[] calldata _mutables,\\n string[] calldata _imageURIs\\n ) external returns (bool success);\\n\\n function getNextId(uint256 _admin) external view returns (uint256 nextId);\\n\\n function mintHat(\\n uint256 _hatId,\\n address _wearer\\n ) external returns (bool success);\\n\\n function batchMintHats(\\n uint256[] calldata _hatIds,\\n address[] calldata _wearers\\n ) external returns (bool success);\\n\\n function setHatStatus(\\n uint256 _hatId,\\n bool _newStatus\\n ) external returns (bool toggled);\\n\\n function checkHatStatus(uint256 _hatId) external returns (bool toggled);\\n\\n function setHatWearerStatus(\\n uint256 _hatId,\\n address _wearer,\\n bool _eligible,\\n bool _standing\\n ) external returns (bool updated);\\n\\n function checkHatWearerStatus(\\n uint256 _hatId,\\n address _wearer\\n ) external returns (bool updated);\\n\\n function renounceHat(uint256 _hatId) external;\\n\\n function transferHat(uint256 _hatId, address _from, address _to) external;\\n\\n /*//////////////////////////////////////////////////////////////\\n HATS ADMIN FUNCTIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n function makeHatImmutable(uint256 _hatId) external;\\n\\n function changeHatDetails(\\n uint256 _hatId,\\n string memory _newDetails\\n ) external;\\n\\n function changeHatEligibility(\\n uint256 _hatId,\\n address _newEligibility\\n ) external;\\n\\n function changeHatToggle(uint256 _hatId, address _newToggle) external;\\n\\n function changeHatImageURI(\\n uint256 _hatId,\\n string memory _newImageURI\\n ) external;\\n\\n function changeHatMaxSupply(uint256 _hatId, uint32 _newMaxSupply) external;\\n\\n function requestLinkTopHatToTree(\\n uint32 _topHatId,\\n uint256 _newAdminHat\\n ) external;\\n\\n function approveLinkTopHatToTree(\\n uint32 _topHatId,\\n uint256 _newAdminHat,\\n address _eligibility,\\n address _toggle,\\n string calldata _details,\\n string calldata _imageURI\\n ) external;\\n\\n function unlinkTopHatFromTree(uint32 _topHatId, address _wearer) external;\\n\\n function relinkTopHatWithinTree(\\n uint32 _topHatDomain,\\n uint256 _newAdminHat,\\n address _eligibility,\\n address _toggle,\\n string calldata _details,\\n string calldata _imageURI\\n ) external;\\n\\n /*//////////////////////////////////////////////////////////////\\n VIEW FUNCTIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n function viewHat(\\n uint256 _hatId\\n )\\n external\\n view\\n returns (\\n string memory details,\\n uint32 maxSupply,\\n uint32 supply,\\n address eligibility,\\n address toggle,\\n string memory imageURI,\\n uint16 lastHatId,\\n bool mutable_,\\n bool active\\n );\\n\\n function isWearerOfHat(\\n address _user,\\n uint256 _hatId\\n ) external view returns (bool isWearer);\\n\\n function isAdminOfHat(\\n address _user,\\n uint256 _hatId\\n ) external view returns (bool isAdmin);\\n\\n function isInGoodStanding(\\n address _wearer,\\n uint256 _hatId\\n ) external view returns (bool standing);\\n\\n function isEligible(\\n address _wearer,\\n uint256 _hatId\\n ) external view returns (bool eligible);\\n\\n function getHatEligibilityModule(\\n uint256 _hatId\\n ) external view returns (address eligibility);\\n\\n function getHatToggleModule(\\n uint256 _hatId\\n ) external view returns (address toggle);\\n\\n function getHatMaxSupply(\\n uint256 _hatId\\n ) external view returns (uint32 maxSupply);\\n\\n function hatSupply(uint256 _hatId) external view returns (uint32 supply);\\n\\n function getImageURIForHat(\\n uint256 _hatId\\n ) external view returns (string memory _uri);\\n\\n function balanceOf(\\n address wearer,\\n uint256 hatId\\n ) external view returns (uint256 balance);\\n\\n function balanceOfBatch(\\n address[] calldata _wearers,\\n uint256[] calldata _hatIds\\n ) external view returns (uint256[] memory);\\n\\n function uri(uint256 id) external view returns (string memory _uri);\\n}\\n\",\"keccak256\":\"0x2867004bddc5148fa1937f25c0403e5d9977583aaf50fdbdb74bd463f64f21c8\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/IHatsIdUtilities.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface IHatsIdUtilities {\\n function buildHatId(\\n uint256 _admin,\\n uint16 _newHat\\n ) external pure returns (uint256 id);\\n\\n function getHatLevel(uint256 _hatId) external view returns (uint32 level);\\n\\n function getLocalHatLevel(\\n uint256 _hatId\\n ) external pure returns (uint32 level);\\n\\n function isTopHat(uint256 _hatId) external view returns (bool _topHat);\\n\\n function isLocalTopHat(\\n uint256 _hatId\\n ) external pure returns (bool _localTopHat);\\n\\n function isValidHatId(\\n uint256 _hatId\\n ) external view returns (bool validHatId);\\n\\n function getAdminAtLevel(\\n uint256 _hatId,\\n uint32 _level\\n ) external view returns (uint256 admin);\\n\\n function getAdminAtLocalLevel(\\n uint256 _hatId,\\n uint32 _level\\n ) external pure returns (uint256 admin);\\n\\n function getTopHatDomain(\\n uint256 _hatId\\n ) external view returns (uint32 domain);\\n\\n function getTippyTopHatDomain(\\n uint32 _topHatDomain\\n ) external view returns (uint32 domain);\\n\\n function noCircularLinkage(\\n uint32 _topHatDomain,\\n uint256 _linkedAdmin\\n ) external view returns (bool notCircular);\\n\\n function sameTippyTopHatDomain(\\n uint32 _topHatDomain,\\n uint256 _newAdminHat\\n ) external view returns (bool sameDomain);\\n}\\n\",\"keccak256\":\"0x007fcc07b20bf84bacad1f9a2ddf4e30e1a8be961e144b7bef8e98a51781aee9\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/IHatsModuleFactory.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.19;\\n\\ninterface IHatsModuleFactory {\\n error HatsModuleFactory_ModuleAlreadyDeployed(\\n address implementation,\\n uint256 hatId,\\n bytes otherImmutableArgs,\\n uint256 saltNonce\\n );\\n\\n error BatchArrayLengthMismatch();\\n\\n event HatsModuleFactory_ModuleDeployed(\\n address implementation,\\n address instance,\\n uint256 hatId,\\n bytes otherImmutableArgs,\\n bytes initData,\\n uint256 saltNonce\\n );\\n\\n function HATS() external view returns (address);\\n\\n function version() external view returns (string memory);\\n\\n function createHatsModule(\\n address _implementation,\\n uint256 _hatId,\\n bytes calldata _otherImmutableArgs,\\n bytes calldata _initData,\\n uint256 _saltNonce\\n ) external returns (address _instance);\\n\\n function batchCreateHatsModule(\\n address[] calldata _implementations,\\n uint256[] calldata _hatIds,\\n bytes[] calldata _otherImmutableArgsArray,\\n bytes[] calldata _initDataArray,\\n uint256[] calldata _saltNonces\\n ) external returns (bool success);\\n\\n function getHatsModuleAddress(\\n address _implementation,\\n uint256 _hatId,\\n bytes calldata _otherImmutableArgs,\\n uint256 _saltNonce\\n ) external view returns (address);\\n\\n function deployed(\\n address _implementation,\\n uint256 _hatId,\\n bytes calldata _otherImmutableArgs,\\n uint256 _saltNonce\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x861faf40785cedb829243116d492653414a367853408a5c27d201522f6c3bfdd\",\"license\":\"MIT\"},\"contracts/interfaces/hats/modules/IHatsElectionsEligibility.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.13;\\n\\ninterface IHatsElectionsEligibility {\\n event ElectionOpened(uint128 nextTermEnd);\\n event ElectionCompleted(uint128 termEnd, address[] winners);\\n event NewTermStarted(uint128 termEnd);\\n event Recalled(uint128 termEnd, address[] accounts);\\n\\n /// @notice Returns the first second after the current term ends.\\n /// @dev Also serves as the id for the current term.\\n function currentTermEnd() external view returns (uint128);\\n\\n /// @notice Returns the first second after the next term ends.\\n /// @dev Also serves as the id for the next term.\\n function nextTermEnd() external view returns (uint128);\\n\\n /// @notice Returns the election status (open or closed) for a given term end.\\n /// @param termEnd The term end timestamp to query.\\n function electionStatus(\\n uint128 termEnd\\n ) external view returns (bool isElectionOpen);\\n\\n /// @notice Returns whether a candidate was elected in a given term.\\n /// @param termEnd The term end timestamp to query.\\n /// @param candidate The address of the candidate.\\n function electionResults(\\n uint128 termEnd,\\n address candidate\\n ) external view returns (bool elected);\\n\\n /// @notice Returns the BALLOT_BOX_HAT constant.\\n function BALLOT_BOX_HAT() external pure returns (uint256);\\n\\n /// @notice Returns the ADMIN_HAT constant.\\n function ADMIN_HAT() external pure returns (uint256);\\n\\n /**\\n * @notice Submit the results of an election for a specified term.\\n * @dev Only callable by the wearer(s) of the BALLOT_BOX_HAT.\\n * @param _termEnd The id of the term for which the election results are being submitted.\\n * @param _winners The addresses of the winners of the election.\\n */\\n function elect(uint128 _termEnd, address[] calldata _winners) external;\\n\\n /**\\n * @notice Submit the results of a recall election for a specified term.\\n * @dev Only callable by the wearer(s) of the BALLOT_BOX_HAT.\\n * @param _termEnd The id of the term for which the recall results are being submitted.\\n * @param _recallees The addresses to be recalled.\\n */\\n function recall(uint128 _termEnd, address[] calldata _recallees) external;\\n\\n /**\\n * @notice Set the next term and open the election for it.\\n * @dev Only callable by the wearer(s) of the ADMIN_HAT.\\n * @param _newTermEnd The id of the term that will be opened.\\n */\\n function setNextTerm(uint128 _newTermEnd) external;\\n\\n /**\\n * @notice Start the next term, updating the current term.\\n * @dev Can be called by anyone, but will revert if conditions are not met.\\n */\\n function startNextTerm() external;\\n\\n /**\\n * @notice Determine the eligibility and standing of a wearer for a hat.\\n * @param _wearer The address of the hat wearer.\\n * @param _hatId The ID of the hat.\\n * @return eligible True if the wearer is eligible for the hat.\\n * @return standing True if the wearer is in good standing.\\n */\\n function getWearerStatus(\\n address _wearer,\\n uint256 _hatId\\n ) external view returns (bool eligible, bool standing);\\n}\\n\",\"keccak256\":\"0x74dfc5d538d866ddb8ee2ca1b569abf62e02d848c59f308adf6075ecff175c7d\",\"license\":\"MIT\"},\"contracts/interfaces/sablier/IAdminable.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\n/// @title IAdminable\\n/// @notice Contract module that provides a basic access control mechanism, with an admin that can be\\n/// granted exclusive access to specific functions. The inheriting contract must set the initial admin\\n/// in the constructor.\\ninterface IAdminable {\\n /*//////////////////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Emitted when the admin is transferred.\\n /// @param oldAdmin The address of the old admin.\\n /// @param newAdmin The address of the new admin.\\n event TransferAdmin(address indexed oldAdmin, address indexed newAdmin);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice The address of the admin account or contract.\\n function admin() external view returns (address);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n NON-CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Transfers the contract admin to a new address.\\n ///\\n /// @dev Notes:\\n /// - Does not revert if the admin is the same.\\n /// - This function can potentially leave the contract without an admin, thereby removing any\\n /// functionality that is only available to the admin.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the contract admin.\\n ///\\n /// @param newAdmin The address of the new admin.\\n function transferAdmin(address newAdmin) external;\\n}\\n\",\"keccak256\":\"0xa279c49e51228b571329164e36250e82b2c1378e8b549194ab7dd90fca9c3b2b\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/IERC4096.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 \\\"@openzeppelin/contracts/interfaces/IERC165.sol\\\";\\nimport {IERC721} from \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\n\\n/// @title ERC-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\",\"keccak256\":\"0xa34b9c52cbe36be860244f52256f1b05badf0cb797d208664b87337610d0e82d\",\"license\":\"MIT\"},\"contracts/interfaces/sablier/ISablierV2Lockup.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC4906} from \\\"./IERC4096.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IERC721Metadata} from \\\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\\\";\\nimport {UD60x18} from \\\"@prb/math/src/UD60x18.sol\\\";\\n\\nimport {Lockup} from \\\"./types/DataTypes.sol\\\";\\nimport {IAdminable} from \\\"./IAdminable.sol\\\";\\nimport {ISablierV2NFTDescriptor} from \\\"./ISablierV2NFTDescriptor.sol\\\";\\n\\n/// @title ISablierV2Lockup\\n/// @notice Common logic between all Sablier V2 Lockup contracts.\\ninterface ISablierV2Lockup is\\n IAdminable, // 0 inherited components\\n IERC4906, // 2 inherited components\\n IERC721Metadata // 2 inherited components\\n{\\n /*//////////////////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Emitted when the admin allows a new recipient contract to hook to Sablier.\\n /// @param admin The address of the current contract admin.\\n /// @param recipient The address of the recipient contract put on the allowlist.\\n event AllowToHook(address indexed admin, address recipient);\\n\\n /// @notice Emitted when a stream is canceled.\\n /// @param streamId The ID of the stream.\\n /// @param sender The address of the stream's sender.\\n /// @param recipient The address of the stream's recipient.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param senderAmount The amount of assets refunded to the stream's sender, denoted in units of the asset's\\n /// decimals.\\n /// @param recipientAmount The amount of assets left for the stream's recipient to withdraw, denoted in units of the\\n /// asset's decimals.\\n event CancelLockupStream(\\n uint256 streamId,\\n address indexed sender,\\n address indexed recipient,\\n IERC20 indexed asset,\\n uint128 senderAmount,\\n uint128 recipientAmount\\n );\\n\\n /// @notice Emitted when a sender gives up the right to cancel a stream.\\n /// @param streamId The ID of the stream.\\n event RenounceLockupStream(uint256 indexed streamId);\\n\\n /// @notice Emitted when the admin sets a new NFT descriptor contract.\\n /// @param admin The address of the current contract admin.\\n /// @param oldNFTDescriptor The address of the old NFT descriptor contract.\\n /// @param newNFTDescriptor The address of the new NFT descriptor contract.\\n event SetNFTDescriptor(\\n address indexed admin,\\n ISablierV2NFTDescriptor oldNFTDescriptor,\\n ISablierV2NFTDescriptor newNFTDescriptor\\n );\\n\\n /// @notice Emitted when assets are withdrawn from a stream.\\n /// @param streamId The ID of the stream.\\n /// @param to The address that has received the withdrawn assets.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param amount The amount of assets withdrawn, denoted in units of the asset's decimals.\\n event WithdrawFromLockupStream(\\n uint256 indexed streamId,\\n address indexed to,\\n IERC20 indexed asset,\\n uint128 amount\\n );\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Retrieves the address of the ERC-20 asset to be distributed.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getAsset(uint256 streamId) external view returns (IERC20 asset);\\n\\n /// @notice Retrieves the amount deposited in the stream, denoted in units of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getDepositedAmount(\\n uint256 streamId\\n ) external view returns (uint128 depositedAmount);\\n\\n /// @notice Retrieves the stream's end time, which is a Unix timestamp.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getEndTime(\\n uint256 streamId\\n ) external view returns (uint40 endTime);\\n\\n /// @notice Retrieves the stream's recipient.\\n /// @dev Reverts if the NFT has been burned.\\n /// @param streamId The stream ID for the query.\\n function getRecipient(\\n uint256 streamId\\n ) external view returns (address recipient);\\n\\n /// @notice Retrieves the amount refunded to the sender after a cancellation, denoted in units of the asset's\\n /// decimals. This amount is always zero unless the stream was canceled.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getRefundedAmount(\\n uint256 streamId\\n ) external view returns (uint128 refundedAmount);\\n\\n /// @notice Retrieves the stream's sender.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getSender(uint256 streamId) external view returns (address sender);\\n\\n /// @notice Retrieves the stream's start time, which is a Unix timestamp.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getStartTime(\\n uint256 streamId\\n ) external view returns (uint40 startTime);\\n\\n /// @notice Retrieves the amount withdrawn from the stream, denoted in units of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getWithdrawnAmount(\\n uint256 streamId\\n ) external view returns (uint128 withdrawnAmount);\\n\\n /// @notice Retrieves a flag indicating whether the provided address is a contract allowed to hook to Sablier\\n /// when a stream is canceled or when assets are withdrawn.\\n /// @dev See {ISablierLockupRecipient} for more information.\\n function isAllowedToHook(\\n address recipient\\n ) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream can be canceled. When the stream is cold, this\\n /// flag is always `false`.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isCancelable(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream is cold, i.e. settled, canceled, or depleted.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isCold(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream is depleted.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isDepleted(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream exists.\\n /// @dev Does not revert if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isStream(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream NFT can be transferred.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isTransferable(\\n uint256 streamId\\n ) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream is warm, i.e. either pending or streaming.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isWarm(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves the maximum broker fee that can be charged by the broker, denoted as a fixed-point\\n /// number where 1e18 is 100%.\\n /// @dev This value is hard coded as a constant.\\n function MAX_BROKER_FEE() external view returns (UD60x18);\\n\\n /// @notice Counter for stream IDs, used in the create functions.\\n function nextStreamId() external view returns (uint256);\\n\\n /// @notice Contract that generates the non-fungible token URI.\\n function nftDescriptor() external view returns (ISablierV2NFTDescriptor);\\n\\n /// @notice Calculates the amount that the sender would be refunded if the stream were canceled, denoted in units\\n /// of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function refundableAmountOf(\\n uint256 streamId\\n ) external view returns (uint128 refundableAmount);\\n\\n /// @notice Retrieves the stream's status.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function statusOf(\\n uint256 streamId\\n ) external view returns (Lockup.Status status);\\n\\n /// @notice Calculates the amount streamed to the recipient, denoted in units of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n ///\\n /// Notes:\\n /// - Upon cancellation of the stream, the amount streamed is calculated as the difference between the deposited\\n /// amount and the refunded amount. Ultimately, when the stream becomes depleted, the streamed amount is equivalent\\n /// to the total amount withdrawn.\\n ///\\n /// @param streamId The stream ID for the query.\\n function streamedAmountOf(\\n uint256 streamId\\n ) external view returns (uint128 streamedAmount);\\n\\n /// @notice Retrieves a flag indicating whether the stream was canceled.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function wasCanceled(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Calculates the amount that the recipient can withdraw from the stream, denoted in units of the asset's\\n /// decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function withdrawableAmountOf(\\n uint256 streamId\\n ) external view returns (uint128 withdrawableAmount);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n NON-CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Allows a recipient contract to hook to Sablier when a stream is canceled or when assets are withdrawn.\\n /// Useful for implementing contracts that hold streams on behalf of users, such as vaults or staking contracts.\\n ///\\n /// @dev Emits an {AllowToHook} event.\\n ///\\n /// Notes:\\n /// - Does not revert if the contract is already on the allowlist.\\n /// - This is an irreversible operation. The contract cannot be removed from the allowlist.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the contract admin.\\n /// - `recipient` must have a non-zero code size.\\n /// - `recipient` must implement {ISablierLockupRecipient}.\\n ///\\n /// @param recipient The address of the contract to allow for hooks.\\n function allowToHook(address recipient) external;\\n\\n /// @notice Burns the NFT associated with the stream.\\n ///\\n /// @dev Emits a {Transfer} event.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `streamId` must reference a depleted stream.\\n /// - The NFT must exist.\\n /// - `msg.sender` must be either the NFT owner or an approved third party.\\n ///\\n /// @param streamId The ID of the stream NFT to burn.\\n function burn(uint256 streamId) external;\\n\\n /// @notice Cancels the stream and refunds any remaining assets to the sender.\\n ///\\n /// @dev Emits a {Transfer}, {CancelLockupStream}, and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - If there any assets left for the recipient to withdraw, the stream is marked as canceled. Otherwise, the\\n /// stream is marked as depleted.\\n /// - This function attempts to invoke a hook on the recipient, if the resolved address is a contract.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - The stream must be warm and cancelable.\\n /// - `msg.sender` must be the stream's sender.\\n ///\\n /// @param streamId The ID of the stream to cancel.\\n function cancel(uint256 streamId) external;\\n\\n /// @notice Cancels multiple streams and refunds any remaining assets to the sender.\\n ///\\n /// @dev Emits multiple {Transfer}, {CancelLockupStream}, and {MetadataUpdate} events.\\n ///\\n /// Notes:\\n /// - Refer to the notes in {cancel}.\\n ///\\n /// Requirements:\\n /// - All requirements from {cancel} must be met for each stream.\\n ///\\n /// @param streamIds The IDs of the streams to cancel.\\n function cancelMultiple(uint256[] calldata streamIds) external;\\n\\n /// @notice Removes the right of the stream's sender to cancel the stream.\\n ///\\n /// @dev Emits a {RenounceLockupStream} and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - This is an irreversible operation.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `streamId` must reference a warm stream.\\n /// - `msg.sender` must be the stream's sender.\\n /// - The stream must be cancelable.\\n ///\\n /// @param streamId The ID of the stream to renounce.\\n function renounce(uint256 streamId) external;\\n\\n /// @notice Sets a new NFT descriptor contract, which produces the URI describing the Sablier stream NFTs.\\n ///\\n /// @dev Emits a {SetNFTDescriptor} and {BatchMetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - Does not revert if the NFT descriptor is the same.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the contract admin.\\n ///\\n /// @param newNFTDescriptor The address of the new NFT descriptor contract.\\n function setNFTDescriptor(\\n ISablierV2NFTDescriptor newNFTDescriptor\\n ) external;\\n\\n /// @notice Withdraws the provided amount of assets from the stream to the `to` address.\\n ///\\n /// @dev Emits a {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - This function attempts to call a hook on the recipient of the stream, unless `msg.sender` is the recipient.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `streamId` must not reference a null or depleted stream.\\n /// - `to` must not be the zero address.\\n /// - `amount` must be greater than zero and must not exceed the withdrawable amount.\\n /// - `to` must be the recipient if `msg.sender` is not the stream's recipient or an approved third party.\\n ///\\n /// @param streamId The ID of the stream to withdraw from.\\n /// @param to The address receiving the withdrawn assets.\\n /// @param amount The amount to withdraw, denoted in units of the asset's decimals.\\n function withdraw(uint256 streamId, address to, uint128 amount) external;\\n\\n /// @notice Withdraws the maximum withdrawable amount from the stream to the provided address `to`.\\n ///\\n /// @dev Emits a {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - Refer to the notes in {withdraw}.\\n ///\\n /// Requirements:\\n /// - Refer to the requirements in {withdraw}.\\n ///\\n /// @param streamId The ID of the stream to withdraw from.\\n /// @param to The address receiving the withdrawn assets.\\n /// @return withdrawnAmount The amount withdrawn, denoted in units of the asset's decimals.\\n function withdrawMax(\\n uint256 streamId,\\n address to\\n ) external returns (uint128 withdrawnAmount);\\n\\n /// @notice Withdraws the maximum withdrawable amount from the stream to the current recipient, and transfers the\\n /// NFT to `newRecipient`.\\n ///\\n /// @dev Emits a {WithdrawFromLockupStream} and a {Transfer} event.\\n ///\\n /// Notes:\\n /// - If the withdrawable amount is zero, the withdrawal is skipped.\\n /// - Refer to the notes in {withdraw}.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the stream's recipient.\\n /// - Refer to the requirements in {withdraw}.\\n /// - Refer to the requirements in {IERC721.transferFrom}.\\n ///\\n /// @param streamId The ID of the stream NFT to transfer.\\n /// @param newRecipient The address of the new owner of the stream NFT.\\n /// @return withdrawnAmount The amount withdrawn, denoted in units of the asset's decimals.\\n function withdrawMaxAndTransfer(\\n uint256 streamId,\\n address newRecipient\\n ) external returns (uint128 withdrawnAmount);\\n\\n /// @notice Withdraws assets from streams to the recipient of each stream.\\n ///\\n /// @dev Emits multiple {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} events.\\n ///\\n /// Notes:\\n /// - This function attempts to call a hook on the recipient of each stream, unless `msg.sender` is the recipient.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - There must be an equal number of `streamIds` and `amounts`.\\n /// - Each stream ID in the array must not reference a null or depleted stream.\\n /// - Each amount in the array must be greater than zero and must not exceed the withdrawable amount.\\n ///\\n /// @param streamIds The IDs of the streams to withdraw from.\\n /// @param amounts The amounts to withdraw, denoted in units of the asset's decimals.\\n function withdrawMultiple(\\n uint256[] calldata streamIds,\\n uint128[] calldata amounts\\n ) external;\\n}\\n\",\"keccak256\":\"0x3e5541c38a901637bd310965deb5bbde73ef07fe4ee3c752cbec330c6b9d62a3\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/ISablierV2LockupLinear.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\nimport {Lockup, LockupLinear} from \\\"./types/DataTypes.sol\\\";\\nimport {ISablierV2Lockup} from \\\"./ISablierV2Lockup.sol\\\";\\n\\n/// @title ISablierV2LockupLinear\\n/// @notice Creates and manages Lockup streams with a linear distribution function.\\ninterface ISablierV2LockupLinear is ISablierV2Lockup {\\n /*//////////////////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Emitted when a stream is created.\\n /// @param streamId The ID of the newly created stream.\\n /// @param funder The address which funded the stream.\\n /// @param sender The address distributing the assets, which will have the ability to cancel the stream.\\n /// @param recipient The address receiving the assets.\\n /// @param amounts Struct encapsulating (i) the deposit amount, and (ii) the broker fee amount, both denoted\\n /// in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Boolean indicating whether the stream will be cancelable or not.\\n /// @param transferable Boolean indicating whether the stream NFT is transferable or not.\\n /// @param timestamps Struct encapsulating (i) the stream's start time, (ii) cliff time, and (iii) end time, all as\\n /// Unix timestamps.\\n /// @param broker The address of the broker who has helped create the stream, e.g. a front-end website.\\n event CreateLockupLinearStream(\\n uint256 streamId,\\n address funder,\\n address indexed sender,\\n address indexed recipient,\\n Lockup.CreateAmounts amounts,\\n IERC20 indexed asset,\\n bool cancelable,\\n bool transferable,\\n LockupLinear.Timestamps timestamps,\\n address broker\\n );\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Retrieves the stream's cliff time, which is a Unix timestamp. A value of zero means there\\n /// is no cliff.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getCliffTime(\\n uint256 streamId\\n ) external view returns (uint40 cliffTime);\\n\\n /// @notice Retrieves the full stream details.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n /// @return stream See the documentation in {DataTypes}.\\n function getStream(\\n uint256 streamId\\n ) external view returns (LockupLinear.StreamLL memory stream);\\n\\n /// @notice Retrieves the stream's start, cliff and end timestamps.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n /// @return timestamps See the documentation in {DataTypes}.\\n function getTimestamps(\\n uint256 streamId\\n ) external view returns (LockupLinear.Timestamps memory timestamps);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n NON-CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Creates a stream by setting the start time to `block.timestamp`, and the end time to\\n /// the sum of `block.timestamp` and `params.durations.total`. The stream is funded by `msg.sender` and is wrapped\\n /// in an ERC-721 NFT.\\n ///\\n /// @dev Emits a {Transfer} and {CreateLockupLinearStream} event.\\n ///\\n /// Requirements:\\n /// - All requirements in {createWithTimestamps} must be met for the calculated parameters.\\n ///\\n /// @param params Struct encapsulating the function parameters, which are documented in {DataTypes}.\\n /// @return streamId The ID of the newly created stream.\\n function createWithDurations(\\n LockupLinear.CreateWithDurations calldata params\\n ) external returns (uint256 streamId);\\n\\n /// @notice Creates a stream with the provided start time and end time. The stream is funded by `msg.sender` and is\\n /// wrapped in an ERC-721 NFT.\\n ///\\n /// @dev Emits a {Transfer} and {CreateLockupLinearStream} event.\\n ///\\n /// Notes:\\n /// - A cliff time of zero means there is no cliff.\\n /// - As long as the times are ordered, it is not an error for the start or the cliff time to be in the past.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `params.totalAmount` must be greater than zero.\\n /// - If set, `params.broker.fee` must not be greater than `MAX_BROKER_FEE`.\\n /// - `params.timestamps.start` must be greater than zero and less than `params.timestamps.end`.\\n /// - If set, `params.timestamps.cliff` must be greater than `params.timestamps.start` and less than\\n /// `params.timestamps.end`.\\n /// - `params.timestamps.end` must be in the future.\\n /// - `params.recipient` must not be the zero address.\\n /// - `msg.sender` must have allowed this contract to spend at least `params.totalAmount` assets.\\n ///\\n /// @param params Struct encapsulating the function parameters, which are documented in {DataTypes}.\\n /// @return streamId The ID of the newly created stream.\\n function createWithTimestamps(\\n LockupLinear.CreateWithTimestamps calldata params\\n ) external returns (uint256 streamId);\\n}\\n\",\"keccak256\":\"0x064264723114b1f1cf3953fd79874dfcbb42cf313857aee6d5e6b09a23e0010b\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/ISablierV2NFTDescriptor.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC721Metadata} from \\\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\\\";\\n\\n/// @title ISablierV2NFTDescriptor\\n/// @notice This contract generates the URI describing the Sablier V2 stream NFTs.\\n/// @dev Inspired by Uniswap V3 Positions NFTs.\\ninterface ISablierV2NFTDescriptor {\\n /// @notice Produces the URI describing a particular stream NFT.\\n /// @dev This is a data URI with the JSON contents directly inlined.\\n /// @param sablier The address of the Sablier contract the stream was created in.\\n /// @param streamId The ID of the stream for which to produce a description.\\n /// @return uri The URI of the ERC721-compliant metadata.\\n function tokenURI(\\n IERC721Metadata sablier,\\n uint256 streamId\\n ) external view returns (string memory uri);\\n}\\n\",\"keccak256\":\"0x4ed430e553d14161e93efdaaacd1a502f49b38969c9d714b45d2e682a74fa0bc\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/types/DataTypes.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {UD2x18} from \\\"@prb/math/src/UD2x18.sol\\\";\\nimport {UD60x18} from \\\"@prb/math/src/UD60x18.sol\\\";\\n\\n// DataTypes.sol\\n//\\n// This file defines all structs used in V2 Core, most of which are organized under three namespaces:\\n//\\n// - Lockup\\n// - LockupDynamic\\n// - LockupLinear\\n// - LockupTranched\\n//\\n// You will notice that some structs contain \\\"slot\\\" annotations - they are used to indicate the\\n// storage layout of the struct. It is more gas efficient to group small data types together so\\n// that they fit in a single 32-byte slot.\\n\\n/// @notice Struct encapsulating the broker parameters passed to the create functions. Both can be set to zero.\\n/// @param account The address receiving the broker's fee.\\n/// @param fee The broker's percentage fee from the total amount, denoted as a fixed-point number where 1e18 is 100%.\\nstruct Broker {\\n address account;\\n UD60x18 fee;\\n}\\n\\n/// @notice Namespace for the structs used in both {SablierV2LockupLinear} and {SablierV2LockupDynamic}.\\nlibrary Lockup {\\n /// @notice Struct encapsulating the deposit, withdrawn, and refunded amounts, all denoted in units of the asset's\\n /// decimals.\\n /// @dev Because the deposited and the withdrawn amount are often read together, declaring them in the same slot\\n /// saves gas.\\n /// @param deposited The initial amount deposited in the stream, net of broker fee.\\n /// @param withdrawn The cumulative amount withdrawn from the stream.\\n /// @param refunded The amount refunded to the sender. Unless the stream was canceled, this is always zero.\\n struct Amounts {\\n // slot 0\\n uint128 deposited;\\n uint128 withdrawn;\\n // slot 1\\n uint128 refunded;\\n }\\n\\n /// @notice Struct encapsulating (i) the deposit amount and (ii) the broker fee amount, both denoted in units of the\\n /// asset's decimals.\\n /// @param deposit The amount to deposit in the stream.\\n /// @param brokerFee The broker fee amount.\\n struct CreateAmounts {\\n uint128 deposit;\\n uint128 brokerFee;\\n }\\n\\n /// @notice Enum representing the different statuses of a stream.\\n /// @custom:value0 PENDING Stream created but not started; assets are in a pending state.\\n /// @custom:value1 STREAMING Active stream where assets are currently being streamed.\\n /// @custom:value2 SETTLED All assets have been streamed; recipient is due to withdraw them.\\n /// @custom:value3 CANCELED Canceled stream; remaining assets await recipient's withdrawal.\\n /// @custom:value4 DEPLETED Depleted stream; all assets have been withdrawn and/or refunded.\\n enum Status {\\n PENDING,\\n STREAMING,\\n SETTLED,\\n CANCELED,\\n DEPLETED\\n }\\n\\n /// @notice A common data structure to be stored in all {SablierV2Lockup} models.\\n /// @dev The fields are arranged like this to save gas via tight variable packing.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream.\\n /// @param startTime The Unix timestamp indicating the stream's start.\\n /// @param endTime The Unix timestamp indicating the stream's end.\\n /// @param isCancelable Boolean indicating if the stream is cancelable.\\n /// @param wasCanceled Boolean indicating if the stream was canceled.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param isDepleted Boolean indicating if the stream is depleted.\\n /// @param isStream Boolean indicating if the struct entity exists.\\n /// @param isTransferable Boolean indicating if the stream NFT is transferable.\\n /// @param amounts Struct encapsulating the deposit, withdrawn, and refunded amounts, all denoted in units of the\\n /// asset's decimals.\\n struct Stream {\\n // slot 0\\n address sender;\\n uint40 startTime;\\n uint40 endTime;\\n bool isCancelable;\\n bool wasCanceled;\\n // slot 1\\n IERC20 asset;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n // slot 2 and 3\\n Lockup.Amounts amounts;\\n }\\n}\\n\\n/// @notice Namespace for the structs used in {SablierV2LockupDynamic}.\\nlibrary LockupDynamic {\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupDynamic.createWithDurations} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param segments Segments with durations used to compose the dynamic distribution function. Timestamps are\\n /// calculated by starting from `block.timestamp` and adding each duration to the previous timestamp.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithDurations {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n SegmentWithDuration[] segments;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupDynamic.createWithTimestamps} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param startTime The Unix timestamp indicating the stream's start.\\n /// @param segments Segments used to compose the dynamic distribution function.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithTimestamps {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n uint40 startTime;\\n Segment[] segments;\\n Broker broker;\\n }\\n\\n /// @notice Segment struct used in the Lockup Dynamic stream.\\n /// @param amount The amount of assets to be streamed in the segment, denoted in units of the asset's decimals.\\n /// @param exponent The exponent of the segment, denoted as a fixed-point number.\\n /// @param timestamp The Unix timestamp indicating the segment's end.\\n struct Segment {\\n // slot 0\\n uint128 amount;\\n UD2x18 exponent;\\n uint40 timestamp;\\n }\\n\\n /// @notice Segment struct used at runtime in {SablierV2LockupDynamic.createWithDurations}.\\n /// @param amount The amount of assets to be streamed in the segment, denoted in units of the asset's decimals.\\n /// @param exponent The exponent of the segment, denoted as a fixed-point number.\\n /// @param duration The time difference in seconds between the segment and the previous one.\\n struct SegmentWithDuration {\\n uint128 amount;\\n UD2x18 exponent;\\n uint40 duration;\\n }\\n\\n /// @notice Struct encapsulating the full details of a stream.\\n /// @dev Extends `Lockup.Stream` by including the recipient and the segments.\\n struct StreamLD {\\n address sender;\\n address recipient;\\n uint40 startTime;\\n uint40 endTime;\\n bool isCancelable;\\n bool wasCanceled;\\n IERC20 asset;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n Lockup.Amounts amounts;\\n Segment[] segments;\\n }\\n\\n /// @notice Struct encapsulating the LockupDynamic timestamps.\\n /// @param start The Unix timestamp indicating the stream's start.\\n /// @param end The Unix timestamp indicating the stream's end.\\n struct Timestamps {\\n uint40 start;\\n uint40 end;\\n }\\n}\\n\\n/// @notice Namespace for the structs used in {SablierV2LockupLinear}.\\nlibrary LockupLinear {\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupLinear.createWithDurations} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param durations Struct encapsulating (i) cliff period duration and (ii) total stream duration, both in seconds.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithDurations {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n Durations durations;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupLinear.createWithTimestamps} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param timestamps Struct encapsulating (i) the stream's start time, (ii) cliff time, and (iii) end time, all as\\n /// Unix timestamps.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithTimestamps {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n Timestamps timestamps;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the cliff duration and the total duration.\\n /// @param cliff The cliff duration in seconds.\\n /// @param total The total duration in seconds.\\n struct Durations {\\n uint40 cliff;\\n uint40 total;\\n }\\n\\n /// @notice Struct encapsulating the full details of a stream.\\n /// @dev Extends `Lockup.Stream` by including the recipient and the cliff time.\\n struct StreamLL {\\n address sender;\\n address recipient;\\n uint40 startTime;\\n bool isCancelable;\\n bool wasCanceled;\\n IERC20 asset;\\n uint40 endTime;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n Lockup.Amounts amounts;\\n uint40 cliffTime;\\n }\\n\\n /// @notice Struct encapsulating the LockupLinear timestamps.\\n /// @param start The Unix timestamp for the stream's start.\\n /// @param cliff The Unix timestamp for the cliff period's end. A value of zero means there is no cliff.\\n /// @param end The Unix timestamp for the stream's end.\\n struct Timestamps {\\n uint40 start;\\n uint40 cliff;\\n uint40 end;\\n }\\n}\\n\\n/// @notice Namespace for the structs used in {SablierV2LockupTranched}.\\nlibrary LockupTranched {\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupTranched.createWithDurations} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param tranches Tranches with durations used to compose the tranched distribution function. Timestamps are\\n /// calculated by starting from `block.timestamp` and adding each duration to the previous timestamp.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithDurations {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n TrancheWithDuration[] tranches;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupTranched.createWithTimestamps} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param startTime The Unix timestamp indicating the stream's start.\\n /// @param tranches Tranches used to compose the tranched distribution function.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithTimestamps {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n uint40 startTime;\\n Tranche[] tranches;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the full details of a stream.\\n /// @dev Extends `Lockup.Stream` by including the recipient and the tranches.\\n struct StreamLT {\\n address sender;\\n address recipient;\\n uint40 startTime;\\n uint40 endTime;\\n bool isCancelable;\\n bool wasCanceled;\\n IERC20 asset;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n Lockup.Amounts amounts;\\n Tranche[] tranches;\\n }\\n\\n /// @notice Struct encapsulating the LockupTranched timestamps.\\n /// @param start The Unix timestamp indicating the stream's start.\\n /// @param end The Unix timestamp indicating the stream's end.\\n struct Timestamps {\\n uint40 start;\\n uint40 end;\\n }\\n\\n /// @notice Tranche struct used in the Lockup Tranched stream.\\n /// @param amount The amount of assets to be unlocked in the tranche, denoted in units of the asset's decimals.\\n /// @param timestamp The Unix timestamp indicating the tranche's end.\\n struct Tranche {\\n // slot 0\\n uint128 amount;\\n uint40 timestamp;\\n }\\n\\n /// @notice Tranche struct used at runtime in {SablierV2LockupTranched.createWithDurations}.\\n /// @param amount The amount of assets to be unlocked in the tranche, denoted in units of the asset's decimals.\\n /// @param duration The time difference in seconds between the tranche and the previous one.\\n struct TrancheWithDuration {\\n uint128 amount;\\n uint40 duration;\\n }\\n}\\n\",\"keccak256\":\"0x727722c0ec71a76a947b935c9dfcac8fd846d6c3547dfbc8739c7109f3b95068\",\"license\":\"GPL-3.0-or-later\"},\"contracts/modules/DecentHatsCreationModule.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.28;\\n\\nimport {Enum} from \\\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\\\";\\nimport {IAvatar} from \\\"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol\\\";\\nimport {Strings} from \\\"@openzeppelin/contracts/utils/Strings.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IERC6551Registry} from \\\"../interfaces/IERC6551Registry.sol\\\";\\nimport {IHats} from \\\"../interfaces/hats/IHats.sol\\\";\\nimport {LockupLinear, Broker} from \\\"../interfaces/sablier/types/DataTypes.sol\\\";\\nimport {IHatsModuleFactory} from \\\"../interfaces/hats/IHatsModuleFactory.sol\\\";\\nimport {IHatsElectionsEligibility} from \\\"../interfaces/hats/modules/IHatsElectionsEligibility.sol\\\";\\nimport {ModuleProxyFactory} from \\\"@gnosis.pm/zodiac/contracts/factory/ModuleProxyFactory.sol\\\";\\nimport {ISablierV2LockupLinear} from \\\"../interfaces/sablier/ISablierV2LockupLinear.sol\\\";\\nimport {DecentHatsModuleUtils} from \\\"./DecentHatsModuleUtils.sol\\\";\\n\\ncontract DecentHatsCreationModule is DecentHatsModuleUtils {\\n struct TopHatParams {\\n string details;\\n string imageURI;\\n }\\n\\n struct AdminHatParams {\\n string details;\\n string imageURI;\\n bool isMutable;\\n }\\n\\n struct CreateTreeParams {\\n IHats hatsProtocol;\\n IERC6551Registry erc6551Registry;\\n IHatsModuleFactory hatsModuleFactory;\\n ModuleProxyFactory moduleProxyFactory;\\n address keyValuePairs;\\n address decentAutonomousAdminImplementation;\\n address hatsAccountImplementation;\\n address hatsElectionsEligibilityImplementation;\\n TopHatParams topHat;\\n AdminHatParams adminHat;\\n HatParams[] hats;\\n }\\n\\n /* /////////////////////////////////////////////////////////////////////////////\\n EXTERNAL FUNCTIONS\\n ///////////////////////////////////////////////////////////////////////////// */\\n /**\\n * @notice For a safe without any roles previously created on it, this function should be called. It sets up the\\n * top hat and admin hat, as well as any other hats and their streams that are provided, then transfers the top hat\\n * to the calling safe.\\n *\\n * @notice This contract should be enabled a module on the Safe for which the role(s) are to be created, and disabled after.\\n *\\n * @dev For each hat that is included, if the hat is:\\n * - termed, its stream funds on are targeted directly at the nominated wearer. The wearer should directly call `withdraw-`\\n * on the Sablier contract.\\n * - untermed, its stream funds are targeted at the hat's smart account. In order to withdraw funds from the stream, the\\n * hat's smart account must be the one call to `withdraw-` on the Sablier contract, setting the recipient arg to its wearer.\\n *\\n * @dev In order for a Safe to seamlessly create roles even if it has never previously created a role and thus has\\n * no hat tree, we defer the creation of the hat tree and its setup to this contract. This way, in a single tx block,\\n * the resulting topHatId of the newly created hat can be used to create an admin hat and any other hats needed.\\n * We also make use of `KeyValuePairs` to associate the topHatId with the Safe.\\n *\\n * @param treeParams The parameters for creating the Hat Tree with Roles\\n */\\n function createAndDeclareTree(\\n CreateTreeParams calldata treeParams\\n ) external {\\n // Create Top Hat\\n (uint256 topHatId, address topHatAccount) = _processTopHat(\\n treeParams.hatsProtocol,\\n treeParams.erc6551Registry,\\n treeParams.hatsAccountImplementation,\\n treeParams.keyValuePairs,\\n treeParams.topHat\\n );\\n\\n // Create Admin Hat\\n uint256 adminHatId = _processAdminHat(\\n treeParams.hatsProtocol,\\n treeParams.erc6551Registry,\\n treeParams.hatsAccountImplementation,\\n topHatId,\\n topHatAccount,\\n treeParams.moduleProxyFactory,\\n treeParams.decentAutonomousAdminImplementation,\\n treeParams.adminHat\\n );\\n\\n // Create Role Hats\\n _processRoleHats(\\n CreateRoleHatsParams({\\n hatsProtocol: treeParams.hatsProtocol,\\n erc6551Registry: treeParams.erc6551Registry,\\n hatsAccountImplementation: treeParams.hatsAccountImplementation,\\n topHatId: topHatId,\\n topHatAccount: topHatAccount,\\n hatsModuleFactory: treeParams.hatsModuleFactory,\\n hatsElectionsEligibilityImplementation: treeParams\\n .hatsElectionsEligibilityImplementation,\\n adminHatId: adminHatId,\\n hats: treeParams.hats,\\n keyValuePairs: treeParams.keyValuePairs\\n })\\n );\\n }\\n\\n /* /////////////////////////////////////////////////////////////////////////////\\n INTERNAL FUNCTIONS\\n ///////////////////////////////////////////////////////////////////////////// */\\n\\n function _processTopHat(\\n IHats hatsProtocol,\\n IERC6551Registry erc6551Registry,\\n address hatsAccountImplementation,\\n address keyValuePairs,\\n TopHatParams calldata topHat\\n ) internal returns (uint256 topHatId, address topHatAccount) {\\n // Call lastTopHatId() and properly decode the response\\n (bool success, bytes memory data) = address(hatsProtocol).call(\\n abi.encodeWithSignature(\\\"lastTopHatId()\\\")\\n );\\n require(success, \\\"Failed to get lastTopHatId\\\");\\n topHatId = (abi.decode(data, (uint256)) + 1) << 224;\\n\\n // Mint Top Hat to the Safe\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"mintTopHat(address,string,string)\\\",\\n msg.sender,\\n topHat.details,\\n topHat.imageURI\\n ),\\n Enum.Operation.Call\\n );\\n\\n // Create Top Hat's ERC6551 Account\\n topHatAccount = erc6551Registry.createAccount(\\n hatsAccountImplementation,\\n SALT,\\n block.chainid,\\n address(hatsProtocol),\\n topHatId\\n );\\n\\n // Declare Top Hat ID to Safe via KeyValuePairs\\n string[] memory keys = new string[](1);\\n string[] memory values = new string[](1);\\n keys[0] = \\\"topHatId\\\";\\n values[0] = Strings.toString(topHatId);\\n IAvatar(msg.sender).execTransactionFromModule(\\n keyValuePairs,\\n 0,\\n abi.encodeWithSignature(\\n \\\"updateValues(string[],string[])\\\",\\n keys,\\n values\\n ),\\n Enum.Operation.Call\\n );\\n }\\n\\n function _processAdminHat(\\n IHats hatsProtocol,\\n IERC6551Registry erc6551Registry,\\n address hatsAccountImplementation,\\n uint256 topHatId,\\n address topHatAccount,\\n ModuleProxyFactory moduleProxyFactory,\\n address decentAutonomousAdminImplementation,\\n AdminHatParams calldata adminHat\\n ) internal returns (uint256 adminHatId) {\\n // Create Admin Hat\\n adminHatId = hatsProtocol.getNextId(topHatId);\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"createHat(uint256,string,uint32,address,address,bool,string)\\\",\\n topHatId,\\n adminHat.details,\\n 1, // only one Admin Hat\\n topHatAccount,\\n topHatAccount,\\n adminHat.isMutable,\\n adminHat.imageURI\\n ),\\n Enum.Operation.Call\\n );\\n\\n // Create Admin Hat's ERC6551 Account\\n erc6551Registry.createAccount(\\n hatsAccountImplementation,\\n SALT,\\n block.chainid,\\n address(hatsProtocol),\\n adminHatId\\n );\\n\\n // Deploy Decent Autonomous Admin Module, which will wear the Admin Hat\\n address autonomousAdmin = moduleProxyFactory.deployModule(\\n decentAutonomousAdminImplementation,\\n abi.encodeWithSignature(\\\"setUp(bytes)\\\", bytes(\\\"\\\")),\\n uint256(\\n keccak256(\\n abi.encodePacked(\\n // for the salt, we'll concatenate our static salt\\n // with the Admin Hat ID\\n SALT,\\n adminHatId\\n )\\n )\\n )\\n );\\n\\n // Mint Hat to the Decent Autonomous Admin Module\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"mintHat(uint256,address)\\\",\\n adminHatId,\\n autonomousAdmin\\n ),\\n Enum.Operation.Call\\n );\\n }\\n}\\n\",\"keccak256\":\"0x5c95f7e83ded3c184dddd6b769791c92a68794eeb49deaccec4422497935c7c2\",\"license\":\"MIT\"},\"contracts/modules/DecentHatsModuleUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.28;\\n\\nimport {Enum} from \\\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\\\";\\nimport {IAvatar} from \\\"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IERC6551Registry} from \\\"../interfaces/IERC6551Registry.sol\\\";\\nimport {IHats} from \\\"../interfaces/hats/IHats.sol\\\";\\nimport {LockupLinear, Broker} from \\\"../interfaces/sablier/types/DataTypes.sol\\\";\\nimport {IHatsModuleFactory} from \\\"../interfaces/hats/IHatsModuleFactory.sol\\\";\\nimport {ISablierV2LockupLinear} from \\\"../interfaces/sablier/ISablierV2LockupLinear.sol\\\";\\nimport {Strings} from \\\"@openzeppelin/contracts/utils/Strings.sol\\\";\\n\\nabstract contract DecentHatsModuleUtils {\\n bytes32 public constant SALT =\\n 0x5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b5072;\\n\\n struct SablierStreamParams {\\n ISablierV2LockupLinear sablier;\\n address sender;\\n address asset;\\n LockupLinear.Timestamps timestamps;\\n Broker broker;\\n uint128 totalAmount;\\n bool cancelable;\\n bool transferable;\\n }\\n\\n struct HatParams {\\n address wearer;\\n string details;\\n string imageURI;\\n SablierStreamParams[] sablierStreamsParams;\\n uint128 termEndDateTs; // If 0, this is an untermed Hat\\n uint32 maxSupply;\\n bool isMutable;\\n }\\n\\n struct CreateRoleHatsParams {\\n IHats hatsProtocol;\\n IERC6551Registry erc6551Registry;\\n address hatsAccountImplementation;\\n uint256 topHatId;\\n address topHatAccount;\\n address keyValuePairs;\\n IHatsModuleFactory hatsModuleFactory;\\n address hatsElectionsEligibilityImplementation;\\n uint256 adminHatId;\\n HatParams[] hats;\\n }\\n\\n function _processRoleHats(\\n CreateRoleHatsParams memory roleHatsParams\\n ) internal {\\n for (uint256 i = 0; i < roleHatsParams.hats.length; ) {\\n HatParams memory hatParams = roleHatsParams.hats[i];\\n\\n // Create eligibility module if needed\\n address eligibilityAddress = _createEligibilityModule(\\n roleHatsParams.hatsProtocol,\\n roleHatsParams.hatsModuleFactory,\\n roleHatsParams.hatsElectionsEligibilityImplementation,\\n roleHatsParams.topHatId,\\n roleHatsParams.topHatAccount,\\n roleHatsParams.adminHatId,\\n hatParams.termEndDateTs\\n );\\n\\n // Create and Mint the Role Hat\\n uint256 hatId = _createAndMintHat(\\n roleHatsParams.hatsProtocol,\\n roleHatsParams.adminHatId,\\n hatParams,\\n eligibilityAddress,\\n roleHatsParams.topHatAccount\\n );\\n\\n // Get the stream recipient (based on termed or not)\\n address streamRecipient = _setupStreamRecipient(\\n roleHatsParams.erc6551Registry,\\n roleHatsParams.hatsAccountImplementation,\\n address(roleHatsParams.hatsProtocol),\\n hatParams.termEndDateTs,\\n hatParams.wearer,\\n hatId\\n );\\n\\n // Create streams\\n _processSablierStreams(\\n hatParams.sablierStreamsParams,\\n streamRecipient,\\n roleHatsParams.keyValuePairs,\\n hatId\\n );\\n\\n unchecked {\\n ++i;\\n }\\n }\\n }\\n\\n function _createEligibilityModule(\\n IHats hatsProtocol,\\n IHatsModuleFactory hatsModuleFactory,\\n address hatsElectionsEligibilityImplementation,\\n uint256 topHatId,\\n address topHatAccount,\\n uint256 adminHatId,\\n uint128 termEndDateTs\\n ) private returns (address) {\\n // If the Hat is termed, create the eligibility module\\n if (termEndDateTs != 0) {\\n return\\n hatsModuleFactory.createHatsModule(\\n hatsElectionsEligibilityImplementation,\\n hatsProtocol.getNextId(adminHatId),\\n abi.encode(topHatId, uint256(0)), // [BALLOT_BOX_ID, ADMIN_HAT_ID]\\n abi.encode(termEndDateTs),\\n uint256(SALT)\\n );\\n }\\n\\n // Otherwise, return the Top Hat account\\n return topHatAccount;\\n }\\n\\n function _createAndMintHat(\\n IHats hatsProtocol,\\n uint256 adminHatId,\\n HatParams memory hat,\\n address eligibilityAddress,\\n address topHatAccount\\n ) private returns (uint256) {\\n // Grab the next Hat ID (before creating it)\\n uint256 hatId = hatsProtocol.getNextId(adminHatId);\\n\\n // Create the new Hat\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"createHat(uint256,string,uint32,address,address,bool,string)\\\",\\n adminHatId,\\n hat.details,\\n hat.maxSupply,\\n eligibilityAddress,\\n topHatAccount,\\n hat.isMutable,\\n hat.imageURI\\n ),\\n Enum.Operation.Call\\n );\\n\\n // If the Hat is termed, nominate the wearer as the eligible member\\n if (hat.termEndDateTs != 0) {\\n address[] memory nominatedWearers = new address[](1);\\n nominatedWearers[0] = hat.wearer;\\n\\n IAvatar(msg.sender).execTransactionFromModule(\\n eligibilityAddress,\\n 0,\\n abi.encodeWithSignature(\\n \\\"elect(uint128,address[])\\\",\\n hat.termEndDateTs,\\n nominatedWearers\\n ),\\n Enum.Operation.Call\\n );\\n }\\n\\n // Mint the Hat\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"mintHat(uint256,address)\\\",\\n hatId,\\n hat.wearer\\n ),\\n Enum.Operation.Call\\n );\\n return hatId;\\n }\\n\\n // Exists to avoid stack too deep errors\\n function _setupStreamRecipient(\\n IERC6551Registry erc6551Registry,\\n address hatsAccountImplementation,\\n address hatsProtocol,\\n uint128 termEndDateTs,\\n address wearer,\\n uint256 hatId\\n ) private returns (address) {\\n // If the hat is termed, the wearer is the stream recipient\\n if (termEndDateTs != 0) {\\n return wearer;\\n }\\n\\n // Otherwise, the Hat's smart account is the stream recipient\\n return\\n erc6551Registry.createAccount(\\n hatsAccountImplementation,\\n SALT,\\n block.chainid,\\n hatsProtocol,\\n hatId\\n );\\n }\\n\\n function _processSablierStreams(\\n SablierStreamParams[] memory streamParams,\\n address streamRecipient,\\n address keyValuePairs,\\n uint256 hatId\\n ) private {\\n for (uint256 i = 0; i < streamParams.length; ) {\\n SablierStreamParams memory sablierStreamParams = streamParams[i];\\n\\n // Approve tokens for Sablier\\n IAvatar(msg.sender).execTransactionFromModule(\\n sablierStreamParams.asset,\\n 0,\\n abi.encodeWithSignature(\\n \\\"approve(address,uint256)\\\",\\n sablierStreamParams.sablier,\\n sablierStreamParams.totalAmount\\n ),\\n Enum.Operation.Call\\n );\\n uint256 streamId = ISablierV2LockupLinear(\\n sablierStreamParams.sablier\\n ).nextStreamId();\\n\\n // Proxy the Sablier call through IAvatar\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(sablierStreamParams.sablier),\\n 0,\\n abi.encodeWithSignature(\\n \\\"createWithTimestamps((address,address,uint128,address,bool,bool,(uint40,uint40,uint40),(address,uint256)))\\\",\\n LockupLinear.CreateWithTimestamps({\\n sender: sablierStreamParams.sender,\\n recipient: streamRecipient,\\n totalAmount: sablierStreamParams.totalAmount,\\n asset: IERC20(sablierStreamParams.asset),\\n cancelable: sablierStreamParams.cancelable,\\n transferable: sablierStreamParams.transferable,\\n timestamps: sablierStreamParams.timestamps,\\n broker: sablierStreamParams.broker\\n })\\n ),\\n Enum.Operation.Call\\n );\\n\\n // Update KeyValuePairs with the stream ID and Hat ID\\n string[] memory keys = new string[](1);\\n string[] memory values = new string[](1);\\n keys[0] = \\\"hatIdToStreamId\\\";\\n values[0] = string(\\n abi.encodePacked(\\n Strings.toString(hatId),\\n \\\":\\\",\\n Strings.toString(streamId)\\n )\\n );\\n\\n IAvatar(msg.sender).execTransactionFromModule(\\n keyValuePairs,\\n 0,\\n abi.encodeWithSignature(\\n \\\"updateValues(string[],string[])\\\",\\n keys,\\n values\\n ),\\n Enum.Operation.Call\\n );\\n\\n unchecked {\\n ++i;\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xcf91d6de2291dd71d2491292ee2d1120c444b8f4f11b8c31429ed4c630013e69\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052348015600f57600080fd5b5061212e8061001f6000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c8063ba9a91a51461003b578063d58041b714610062575b600080fd5b6100506000805160206120d983398151915281565b60405190815260200160405180910390f35b610075610070366004611539565b610077565b005b6000806100cd61008a6020850185611593565b61009a6040860160208701611593565b6100aa60e0870160c08801611593565b6100ba60a0880160808901611593565b6100c86101008901896115c0565b61023d565b909250905060006101396100e46020860186611593565b6100f46040870160208801611593565b61010460e0880160c08901611593565b868661011660808b0160608c01611593565b61012660c08c0160a08d01611593565b6101346101208d018d6115e0565b610619565b604080516101408101909152909150610237908061015a6020880188611593565b6001600160a01b0316815260200186602001602081019061017b9190611593565b6001600160a01b0316815260200161019960e0880160c08901611593565b6001600160a01b03908116825260208201879052851660408201526060016101c760a0880160808901611593565b6001600160a01b031681526020016101e56060880160408901611593565b6001600160a01b03168152602001610204610100880160e08901611593565b6001600160a01b03168152602081018490526040016102276101408801886115f6565b61023091611997565b90526109b5565b50505050565b60408051600481526024810182526020810180516001600160e01b0316633f0f816960e21b17905290516000918291829182916001600160a01b038b169161028491611af9565b6000604051808303816000865af19150503d80600081146102c1576040519150601f19603f3d011682016040523d82523d6000602084013e6102c6565b606091505b50915091508161031c5760405162461bcd60e51b815260206004820152601a60248201527f4661696c656420746f20676574206c617374546f704861744964000000000000604482015260640160405180910390fd5b60e0818060200190518101906103329190611b0b565b61033d906001611b3a565b901b93503363468721a78a6000836103558a80611b53565b61036260208d018d611b53565b604051602401610376959493929190611bc2565b60408051601f198184030181529181526020820180516001600160e01b0316631a64dfad60e01b1790525160e085901b6001600160e01b03191681526103c493929190600090600401611c32565b6020604051808303816000875af11580156103e3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104079190611c88565b50604051638a54c52f60e01b81526001600160a01b03891690638a54c52f9061044a908a906000805160206120d98339815191529046908f908b90600401611ca5565b6020604051808303816000875af1158015610469573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061048d9190611cd8565b60408051600180825281830190925291945060009190816020015b60608152602001906001900390816104a857505060408051600180825281830190925291925060009190602082015b60608152602001906001900390816104d7579050509050604051806040016040528060088152602001671d1bdc12185d125960c21b8152508260008151811061052257610522611cf5565b602002602001018190525061053686610a84565b8160008151811061054957610549611cf5565b6020026020010181905250336001600160a01b031663468721a78960008585604051602401610579929190611d67565b60408051601f198184030181529181526020820180516001600160e01b031663579374b960e11b1790525160e085901b6001600160e01b03191681526105c793929190600090600401611c32565b6020604051808303816000875af11580156105e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061060a9190611c88565b50505050509550959350505050565b60405162460ea360e61b8152600481018690526000906001600160a01b038a1690631183a8c090602401602060405180830381865afa158015610660573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106849190611b0b565b90503363468721a78a60008961069a8780611b53565b60018c806106ae60608d0160408e01611d95565b6106bb60208e018e611b53565b6040516024016106d399989796959493929190611db2565b60408051601f198184030181529181526020820180516001600160e01b0316635829492f60e11b1790525160e085901b6001600160e01b031916815261072193929190600090600401611c32565b6020604051808303816000875af1158015610740573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107649190611c88565b50604051638a54c52f60e01b81526001600160a01b03891690638a54c52f906107a7908a906000805160206120d98339815191529046908f908890600401611ca5565b6020604051808303816000875af11580156107c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ea9190611cd8565b506000846001600160a01b031663f1ab873c856040518060200160405280600081525060405160240161081d9190611e17565b60408051601f19818403018152918152602080830180516001600160e01b031663a4f9edbf60e01b179052905161086f916000805160206120d983398151915291899101918252602082015260400190565b60408051601f198184030181529082905280516020909101206001600160e01b031960e086901b1682526108a7939291600401611e2a565b6020604051808303816000875af11580156108c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108ea9190611cd8565b604051602481018490526001600160a01b0382166044820152909150339063468721a7908c9060009060640160408051601f198184030181529181526020820180516001600160e01b031663320fbbb760e11b1790525160e085901b6001600160e01b031916815261096493929190600090600401611c32565b6020604051808303816000875af1158015610983573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109a79190611c88565b505098975050505050505050565b60005b81610120015151811015610a8057600082610120015182815181106109df576109df611cf5565b602002602001015190506000610a1784600001518560c001518660e00151876060015188608001518961010001518860800151610b8c565b90506000610a35856000015186610100015185858960800151610cf3565b90506000610a5b8660200151876040015188600001518760800151886000015187611025565b9050610a718460600151828860a00151856110cf565b846001019450505050506109b8565b5050565b606081600003610aab5750506040805180820190915260018152600360fc1b602082015290565b8160005b8115610ad55780610abf81611e5e565b9150610ace9050600a83611e8d565b9150610aaf565b6000816001600160401b03811115610aef57610aef611646565b6040519080825280601f01601f191660200182016040528015610b19576020820181803683370190505b5090505b8415610b8457610b2e600183611ea1565b9150610b3b600a86611eb4565b610b46906030611b3a565b60f81b818381518110610b5b57610b5b611cf5565b60200101906001600160f81b031916908160001a905350610b7d600a86611e8d565b9450610b1d565b949350505050565b60006001600160801b03821615610ce557866001600160a01b0316632f7fb7b6878a6001600160a01b0316631183a8c0876040518263ffffffff1660e01b8152600401610bdb91815260200190565b602060405180830381865afa158015610bf8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c1c9190611b0b565b886000604051602001610c39929190918252602082015260400190565b60408051601f198184030181528282526001600160801b0389166020840152910160408051601f19818403018152908290526001600160e01b031960e087901b168252610c9b949392916000805160206120d983398151915290600401611ec8565b6020604051808303816000875af1158015610cba573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cde9190611cd8565b9050610ce8565b50825b979650505050505050565b60405162460ea360e61b81526004810185905260009081906001600160a01b03881690631183a8c090602401602060405180830381865afa158015610d3c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d609190611b0b565b9050336001600160a01b031663468721a78860008989602001518a60a001518a8a8d60c001518e60400151604051602401610da19796959493929190611f14565b60408051601f198184030181529181526020820180516001600160e01b0316635829492f60e11b1790525160e085901b6001600160e01b0319168152610def93929190600090600401611c32565b6020604051808303816000875af1158015610e0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e329190611c88565b5060808501516001600160801b031615610f5d5760408051600180825281830190925260009160208083019080368337019050509050856000015181600081518110610e8057610e80611cf5565b60200260200101906001600160a01b031690816001600160a01b031681525050336001600160a01b031663468721a7866000896080015185604051602401610ec9929190611f78565b60408051601f198184030181529181526020820180516001600160e01b0316634a231cef60e01b1790525160e085901b6001600160e01b0319168152610f1793929190600090600401611c32565b6020604051808303816000875af1158015610f36573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f5a9190611c88565b50505b8451604051602481018390526001600160a01b039091166044820152339063468721a790899060009060640160408051601f198184030181529181526020820180516001600160e01b031663320fbbb760e11b1790525160e085901b6001600160e01b0319168152610fd793929190600090600401611c32565b6020604051808303816000875af1158015610ff6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061101a9190611c88565b509695505050505050565b60006001600160801b0384161561103d5750816110c5565b604051638a54c52f60e01b81526001600160a01b03881690638a54c52f9061107f9089906000805160206120d98339815191529046908b908990600401611ca5565b6020604051808303816000875af115801561109e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110c29190611cd8565b90505b9695505050505050565b60005b84518110156115325760008582815181106110ef576110ef611cf5565b60200260200101519050336001600160a01b031663468721a78260400151600084600001518560a001516040516024016111479291906001600160a01b039290921682526001600160801b0316602082015260400190565b60408051601f198184030181529181526020820180516001600160e01b031663095ea7b360e01b1790525160e085901b6001600160e01b031916815261119593929190600090600401611c32565b6020604051808303816000875af11580156111b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111d89190611c88565b50600081600001516001600160a01b0316631e99d5696040518163ffffffff1660e01b8152600401602060405180830381865afa15801561121d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112419190611b0b565b9050336001600160a01b031663468721a78360000151600060405180610100016040528087602001516001600160a01b031681526020018b6001600160a01b031681526020018760a001516001600160801b0316815260200187604001516001600160a01b031681526020018760c00151151581526020018760e00151151581526020018760600151815260200187608001518152506040516024016112e79190611fcd565b60408051601f198184030181529181526020820180516001600160e01b03166353b1572760e01b1790525160e085901b6001600160e01b031916815261133593929190600090600401611c32565b6020604051808303816000875af1158015611354573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113789190611c88565b50604080516001808252818301909252600091816020015b606081526020019060019003908161139057505060408051600180825281830190925291925060009190602082015b60608152602001906001900390816113bf5790505090506040518060400160405280600f81526020016e1a185d1259151bd4dd1c99585b5259608a1b8152508260008151811061141157611411611cf5565b602002602001018190525061142586610a84565b61142e84610a84565b60405160200161143f92919061209c565b6040516020818303038152906040528160008151811061146157611461611cf5565b6020026020010181905250336001600160a01b031663468721a78860008585604051602401611491929190611d67565b60408051601f198184030181529181526020820180516001600160e01b031663579374b960e11b1790525160e085901b6001600160e01b03191681526114df93929190600090600401611c32565b6020604051808303816000875af11580156114fe573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115229190611c88565b50846001019450505050506110d2565b5050505050565b60006020828403121561154b57600080fd5b81356001600160401b0381111561156157600080fd5b8201610160818503121561157457600080fd5b9392505050565b6001600160a01b038116811461159057600080fd5b50565b6000602082840312156115a557600080fd5b81356115748161157b565b80356115bb8161157b565b919050565b60008235603e198336030181126115d657600080fd5b9190910192915050565b60008235605e198336030181126115d657600080fd5b6000808335601e1984360301811261160d57600080fd5b8301803591506001600160401b0382111561162757600080fd5b6020019150600581901b360382131561163f57600080fd5b9250929050565b634e487b7160e01b600052604160045260246000fd5b60405161010081016001600160401b038111828210171561167f5761167f611646565b60405290565b60405160e081016001600160401b038111828210171561167f5761167f611646565b604051601f8201601f191681016001600160401b03811182821017156116cf576116cf611646565b604052919050565b60006001600160401b038211156116f0576116f0611646565b5060051b60200190565b600082601f83011261170b57600080fd5b81356001600160401b0381111561172457611724611646565b611737601f8201601f19166020016116a7565b81815284602083860101111561174c57600080fd5b816020850160208301376000918101602001919091529392505050565b803564ffffffffff811681146115bb57600080fd5b60006060828403121561179057600080fd5b604051606081016001600160401b03811182821017156117b2576117b2611646565b6040529050806117c183611769565b81526117cf60208401611769565b60208201526117e060408401611769565b60408201525092915050565b6000604082840312156117fe57600080fd5b604080519081016001600160401b038111828210171561182057611820611646565b60405290508082356118318161157b565b8152602092830135920191909152919050565b80356001600160801b03811681146115bb57600080fd5b801515811461159057600080fd5b80356115bb8161185b565b600082601f83011261188557600080fd5b8135611898611893826116d7565b6116a7565b80828252602082019150602061016084028601019250858311156118bb57600080fd5b602085015b838110156119795761016081880312156118d957600080fd5b6118e161165c565b6118ea826115b0565b81526118f8602083016115b0565b6020820152611909604083016115b0565b604082015261191b886060840161177e565b606082015261192d8860c084016117ec565b608082015261193f6101008301611844565b60a08201526119516101208301611869565b60c08201526119636101408301611869565b60e08201528352602090920191610160016118c0565b5095945050505050565b803563ffffffff811681146115bb57600080fd5b60006119a5611893846116d7565b8381526020810190600585901b8401368111156119c157600080fd5b845b81811015611aca5780356001600160401b038111156119e157600080fd5b860160e03682900312156119f457600080fd5b6119fc611685565b611a05826115b0565b815260208201356001600160401b03811115611a2057600080fd5b611a2c368285016116fa565b60208301525060408201356001600160401b03811115611a4b57600080fd5b611a57368285016116fa565b60408301525060608201356001600160401b03811115611a7657600080fd5b611a8236828501611874565b606083015250611a9460808301611844565b6080820152611aa560a08301611983565b60a0820152611ab660c08301611869565b60c0820152855250602093840193016119c3565b509095945050505050565b60005b83811015611af0578181015183820152602001611ad8565b50506000910152565b600082516115d6818460208701611ad5565b600060208284031215611b1d57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b80820180821115611b4d57611b4d611b24565b92915050565b6000808335601e19843603018112611b6a57600080fd5b8301803591506001600160401b03821115611b8457600080fd5b60200191503681900382131561163f57600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b0386168152606060208201819052600090611be79083018688611b99565b8281036040840152611bfa818587611b99565b98975050505050505050565b60008151808452611c1e816020860160208601611ad5565b601f01601f19169290920160200192915050565b60018060a01b0385168152836020820152608060408201526000611c596080830185611c06565b905060028310611c7957634e487b7160e01b600052602160045260246000fd5b82606083015295945050505050565b600060208284031215611c9a57600080fd5b81516115748161185b565b6001600160a01b039586168152602081019490945260408401929092529092166060820152608081019190915260a00190565b600060208284031215611cea57600080fd5b81516115748161157b565b634e487b7160e01b600052603260045260246000fd5b600082825180855260208501945060208160051b8301016020850160005b83811015611d5b57601f19858403018852611d45838351611c06565b6020988901989093509190910190600101611d29565b50909695505050505050565b604081526000611d7a6040830185611d0b565b8281036020840152611d8c8185611d0b565b95945050505050565b600060208284031215611da757600080fd5b81356115748161185b565b89815260e060208201526000611dcc60e083018a8c611b99565b60ff891660408401526001600160a01b0388811660608501528716608084015285151560a084015282810360c0840152611e07818587611b99565b9c9b505050505050505050505050565b6020815260006115746020830184611c06565b6001600160a01b0384168152606060208201819052600090611e4e90830185611c06565b9050826040830152949350505050565b600060018201611e7057611e70611b24565b5060010190565b634e487b7160e01b600052601260045260246000fd5b600082611e9c57611e9c611e77565b500490565b81810381811115611b4d57611b4d611b24565b600082611ec357611ec3611e77565b500690565b60018060a01b038616815284602082015260a060408201526000611eef60a0830186611c06565b8281036060840152611f018186611c06565b9150508260808301529695505050505050565b87815260e060208201526000611f2d60e0830189611c06565b63ffffffff881660408401526001600160a01b0387811660608501528616608084015284151560a084015282810360c0840152611f6a8185611c06565b9a9950505050505050505050565b6000604082016001600160801b03851683526040602084015280845180835260608501915060208601925060005b81811015611d5b5783516001600160a01b0316835260209384019390920191600101611fa6565b81516001600160a01b0390811682526020808401518216908301526040808401516001600160801b03169083015260608084015191821690830152610160820190506080830151612022608084018215159052565b5060a083015161203660a084018215159052565b5060c083015161207560c084018264ffffffffff815116825264ffffffffff602082015116602083015264ffffffffff60408201511660408301525050565b5060e0929092015180516001600160a01b0316610120830152602001516101409091015290565b600083516120ae818460208801611ad5565b601d60f91b90830190815283516120cc816001840160208801611ad5565b0160010194935050505056fe5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b5072a26469706673582212200934c93692d281e9d89ed2e17022e289297dd78e723d3ba32c6645f05d3b8df864736f6c634300081c0033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100365760003560e01c8063ba9a91a51461003b578063d58041b714610062575b600080fd5b6100506000805160206120d983398151915281565b60405190815260200160405180910390f35b610075610070366004611539565b610077565b005b6000806100cd61008a6020850185611593565b61009a6040860160208701611593565b6100aa60e0870160c08801611593565b6100ba60a0880160808901611593565b6100c86101008901896115c0565b61023d565b909250905060006101396100e46020860186611593565b6100f46040870160208801611593565b61010460e0880160c08901611593565b868661011660808b0160608c01611593565b61012660c08c0160a08d01611593565b6101346101208d018d6115e0565b610619565b604080516101408101909152909150610237908061015a6020880188611593565b6001600160a01b0316815260200186602001602081019061017b9190611593565b6001600160a01b0316815260200161019960e0880160c08901611593565b6001600160a01b03908116825260208201879052851660408201526060016101c760a0880160808901611593565b6001600160a01b031681526020016101e56060880160408901611593565b6001600160a01b03168152602001610204610100880160e08901611593565b6001600160a01b03168152602081018490526040016102276101408801886115f6565b61023091611997565b90526109b5565b50505050565b60408051600481526024810182526020810180516001600160e01b0316633f0f816960e21b17905290516000918291829182916001600160a01b038b169161028491611af9565b6000604051808303816000865af19150503d80600081146102c1576040519150601f19603f3d011682016040523d82523d6000602084013e6102c6565b606091505b50915091508161031c5760405162461bcd60e51b815260206004820152601a60248201527f4661696c656420746f20676574206c617374546f704861744964000000000000604482015260640160405180910390fd5b60e0818060200190518101906103329190611b0b565b61033d906001611b3a565b901b93503363468721a78a6000836103558a80611b53565b61036260208d018d611b53565b604051602401610376959493929190611bc2565b60408051601f198184030181529181526020820180516001600160e01b0316631a64dfad60e01b1790525160e085901b6001600160e01b03191681526103c493929190600090600401611c32565b6020604051808303816000875af11580156103e3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104079190611c88565b50604051638a54c52f60e01b81526001600160a01b03891690638a54c52f9061044a908a906000805160206120d98339815191529046908f908b90600401611ca5565b6020604051808303816000875af1158015610469573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061048d9190611cd8565b60408051600180825281830190925291945060009190816020015b60608152602001906001900390816104a857505060408051600180825281830190925291925060009190602082015b60608152602001906001900390816104d7579050509050604051806040016040528060088152602001671d1bdc12185d125960c21b8152508260008151811061052257610522611cf5565b602002602001018190525061053686610a84565b8160008151811061054957610549611cf5565b6020026020010181905250336001600160a01b031663468721a78960008585604051602401610579929190611d67565b60408051601f198184030181529181526020820180516001600160e01b031663579374b960e11b1790525160e085901b6001600160e01b03191681526105c793929190600090600401611c32565b6020604051808303816000875af11580156105e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061060a9190611c88565b50505050509550959350505050565b60405162460ea360e61b8152600481018690526000906001600160a01b038a1690631183a8c090602401602060405180830381865afa158015610660573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106849190611b0b565b90503363468721a78a60008961069a8780611b53565b60018c806106ae60608d0160408e01611d95565b6106bb60208e018e611b53565b6040516024016106d399989796959493929190611db2565b60408051601f198184030181529181526020820180516001600160e01b0316635829492f60e11b1790525160e085901b6001600160e01b031916815261072193929190600090600401611c32565b6020604051808303816000875af1158015610740573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107649190611c88565b50604051638a54c52f60e01b81526001600160a01b03891690638a54c52f906107a7908a906000805160206120d98339815191529046908f908890600401611ca5565b6020604051808303816000875af11580156107c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ea9190611cd8565b506000846001600160a01b031663f1ab873c856040518060200160405280600081525060405160240161081d9190611e17565b60408051601f19818403018152918152602080830180516001600160e01b031663a4f9edbf60e01b179052905161086f916000805160206120d983398151915291899101918252602082015260400190565b60408051601f198184030181529082905280516020909101206001600160e01b031960e086901b1682526108a7939291600401611e2a565b6020604051808303816000875af11580156108c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108ea9190611cd8565b604051602481018490526001600160a01b0382166044820152909150339063468721a7908c9060009060640160408051601f198184030181529181526020820180516001600160e01b031663320fbbb760e11b1790525160e085901b6001600160e01b031916815261096493929190600090600401611c32565b6020604051808303816000875af1158015610983573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109a79190611c88565b505098975050505050505050565b60005b81610120015151811015610a8057600082610120015182815181106109df576109df611cf5565b602002602001015190506000610a1784600001518560c001518660e00151876060015188608001518961010001518860800151610b8c565b90506000610a35856000015186610100015185858960800151610cf3565b90506000610a5b8660200151876040015188600001518760800151886000015187611025565b9050610a718460600151828860a00151856110cf565b846001019450505050506109b8565b5050565b606081600003610aab5750506040805180820190915260018152600360fc1b602082015290565b8160005b8115610ad55780610abf81611e5e565b9150610ace9050600a83611e8d565b9150610aaf565b6000816001600160401b03811115610aef57610aef611646565b6040519080825280601f01601f191660200182016040528015610b19576020820181803683370190505b5090505b8415610b8457610b2e600183611ea1565b9150610b3b600a86611eb4565b610b46906030611b3a565b60f81b818381518110610b5b57610b5b611cf5565b60200101906001600160f81b031916908160001a905350610b7d600a86611e8d565b9450610b1d565b949350505050565b60006001600160801b03821615610ce557866001600160a01b0316632f7fb7b6878a6001600160a01b0316631183a8c0876040518263ffffffff1660e01b8152600401610bdb91815260200190565b602060405180830381865afa158015610bf8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c1c9190611b0b565b886000604051602001610c39929190918252602082015260400190565b60408051601f198184030181528282526001600160801b0389166020840152910160408051601f19818403018152908290526001600160e01b031960e087901b168252610c9b949392916000805160206120d983398151915290600401611ec8565b6020604051808303816000875af1158015610cba573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cde9190611cd8565b9050610ce8565b50825b979650505050505050565b60405162460ea360e61b81526004810185905260009081906001600160a01b03881690631183a8c090602401602060405180830381865afa158015610d3c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d609190611b0b565b9050336001600160a01b031663468721a78860008989602001518a60a001518a8a8d60c001518e60400151604051602401610da19796959493929190611f14565b60408051601f198184030181529181526020820180516001600160e01b0316635829492f60e11b1790525160e085901b6001600160e01b0319168152610def93929190600090600401611c32565b6020604051808303816000875af1158015610e0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e329190611c88565b5060808501516001600160801b031615610f5d5760408051600180825281830190925260009160208083019080368337019050509050856000015181600081518110610e8057610e80611cf5565b60200260200101906001600160a01b031690816001600160a01b031681525050336001600160a01b031663468721a7866000896080015185604051602401610ec9929190611f78565b60408051601f198184030181529181526020820180516001600160e01b0316634a231cef60e01b1790525160e085901b6001600160e01b0319168152610f1793929190600090600401611c32565b6020604051808303816000875af1158015610f36573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f5a9190611c88565b50505b8451604051602481018390526001600160a01b039091166044820152339063468721a790899060009060640160408051601f198184030181529181526020820180516001600160e01b031663320fbbb760e11b1790525160e085901b6001600160e01b0319168152610fd793929190600090600401611c32565b6020604051808303816000875af1158015610ff6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061101a9190611c88565b509695505050505050565b60006001600160801b0384161561103d5750816110c5565b604051638a54c52f60e01b81526001600160a01b03881690638a54c52f9061107f9089906000805160206120d98339815191529046908b908990600401611ca5565b6020604051808303816000875af115801561109e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110c29190611cd8565b90505b9695505050505050565b60005b84518110156115325760008582815181106110ef576110ef611cf5565b60200260200101519050336001600160a01b031663468721a78260400151600084600001518560a001516040516024016111479291906001600160a01b039290921682526001600160801b0316602082015260400190565b60408051601f198184030181529181526020820180516001600160e01b031663095ea7b360e01b1790525160e085901b6001600160e01b031916815261119593929190600090600401611c32565b6020604051808303816000875af11580156111b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111d89190611c88565b50600081600001516001600160a01b0316631e99d5696040518163ffffffff1660e01b8152600401602060405180830381865afa15801561121d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112419190611b0b565b9050336001600160a01b031663468721a78360000151600060405180610100016040528087602001516001600160a01b031681526020018b6001600160a01b031681526020018760a001516001600160801b0316815260200187604001516001600160a01b031681526020018760c00151151581526020018760e00151151581526020018760600151815260200187608001518152506040516024016112e79190611fcd565b60408051601f198184030181529181526020820180516001600160e01b03166353b1572760e01b1790525160e085901b6001600160e01b031916815261133593929190600090600401611c32565b6020604051808303816000875af1158015611354573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113789190611c88565b50604080516001808252818301909252600091816020015b606081526020019060019003908161139057505060408051600180825281830190925291925060009190602082015b60608152602001906001900390816113bf5790505090506040518060400160405280600f81526020016e1a185d1259151bd4dd1c99585b5259608a1b8152508260008151811061141157611411611cf5565b602002602001018190525061142586610a84565b61142e84610a84565b60405160200161143f92919061209c565b6040516020818303038152906040528160008151811061146157611461611cf5565b6020026020010181905250336001600160a01b031663468721a78860008585604051602401611491929190611d67565b60408051601f198184030181529181526020820180516001600160e01b031663579374b960e11b1790525160e085901b6001600160e01b03191681526114df93929190600090600401611c32565b6020604051808303816000875af11580156114fe573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115229190611c88565b50846001019450505050506110d2565b5050505050565b60006020828403121561154b57600080fd5b81356001600160401b0381111561156157600080fd5b8201610160818503121561157457600080fd5b9392505050565b6001600160a01b038116811461159057600080fd5b50565b6000602082840312156115a557600080fd5b81356115748161157b565b80356115bb8161157b565b919050565b60008235603e198336030181126115d657600080fd5b9190910192915050565b60008235605e198336030181126115d657600080fd5b6000808335601e1984360301811261160d57600080fd5b8301803591506001600160401b0382111561162757600080fd5b6020019150600581901b360382131561163f57600080fd5b9250929050565b634e487b7160e01b600052604160045260246000fd5b60405161010081016001600160401b038111828210171561167f5761167f611646565b60405290565b60405160e081016001600160401b038111828210171561167f5761167f611646565b604051601f8201601f191681016001600160401b03811182821017156116cf576116cf611646565b604052919050565b60006001600160401b038211156116f0576116f0611646565b5060051b60200190565b600082601f83011261170b57600080fd5b81356001600160401b0381111561172457611724611646565b611737601f8201601f19166020016116a7565b81815284602083860101111561174c57600080fd5b816020850160208301376000918101602001919091529392505050565b803564ffffffffff811681146115bb57600080fd5b60006060828403121561179057600080fd5b604051606081016001600160401b03811182821017156117b2576117b2611646565b6040529050806117c183611769565b81526117cf60208401611769565b60208201526117e060408401611769565b60408201525092915050565b6000604082840312156117fe57600080fd5b604080519081016001600160401b038111828210171561182057611820611646565b60405290508082356118318161157b565b8152602092830135920191909152919050565b80356001600160801b03811681146115bb57600080fd5b801515811461159057600080fd5b80356115bb8161185b565b600082601f83011261188557600080fd5b8135611898611893826116d7565b6116a7565b80828252602082019150602061016084028601019250858311156118bb57600080fd5b602085015b838110156119795761016081880312156118d957600080fd5b6118e161165c565b6118ea826115b0565b81526118f8602083016115b0565b6020820152611909604083016115b0565b604082015261191b886060840161177e565b606082015261192d8860c084016117ec565b608082015261193f6101008301611844565b60a08201526119516101208301611869565b60c08201526119636101408301611869565b60e08201528352602090920191610160016118c0565b5095945050505050565b803563ffffffff811681146115bb57600080fd5b60006119a5611893846116d7565b8381526020810190600585901b8401368111156119c157600080fd5b845b81811015611aca5780356001600160401b038111156119e157600080fd5b860160e03682900312156119f457600080fd5b6119fc611685565b611a05826115b0565b815260208201356001600160401b03811115611a2057600080fd5b611a2c368285016116fa565b60208301525060408201356001600160401b03811115611a4b57600080fd5b611a57368285016116fa565b60408301525060608201356001600160401b03811115611a7657600080fd5b611a8236828501611874565b606083015250611a9460808301611844565b6080820152611aa560a08301611983565b60a0820152611ab660c08301611869565b60c0820152855250602093840193016119c3565b509095945050505050565b60005b83811015611af0578181015183820152602001611ad8565b50506000910152565b600082516115d6818460208701611ad5565b600060208284031215611b1d57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b80820180821115611b4d57611b4d611b24565b92915050565b6000808335601e19843603018112611b6a57600080fd5b8301803591506001600160401b03821115611b8457600080fd5b60200191503681900382131561163f57600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b0386168152606060208201819052600090611be79083018688611b99565b8281036040840152611bfa818587611b99565b98975050505050505050565b60008151808452611c1e816020860160208601611ad5565b601f01601f19169290920160200192915050565b60018060a01b0385168152836020820152608060408201526000611c596080830185611c06565b905060028310611c7957634e487b7160e01b600052602160045260246000fd5b82606083015295945050505050565b600060208284031215611c9a57600080fd5b81516115748161185b565b6001600160a01b039586168152602081019490945260408401929092529092166060820152608081019190915260a00190565b600060208284031215611cea57600080fd5b81516115748161157b565b634e487b7160e01b600052603260045260246000fd5b600082825180855260208501945060208160051b8301016020850160005b83811015611d5b57601f19858403018852611d45838351611c06565b6020988901989093509190910190600101611d29565b50909695505050505050565b604081526000611d7a6040830185611d0b565b8281036020840152611d8c8185611d0b565b95945050505050565b600060208284031215611da757600080fd5b81356115748161185b565b89815260e060208201526000611dcc60e083018a8c611b99565b60ff891660408401526001600160a01b0388811660608501528716608084015285151560a084015282810360c0840152611e07818587611b99565b9c9b505050505050505050505050565b6020815260006115746020830184611c06565b6001600160a01b0384168152606060208201819052600090611e4e90830185611c06565b9050826040830152949350505050565b600060018201611e7057611e70611b24565b5060010190565b634e487b7160e01b600052601260045260246000fd5b600082611e9c57611e9c611e77565b500490565b81810381811115611b4d57611b4d611b24565b600082611ec357611ec3611e77565b500690565b60018060a01b038616815284602082015260a060408201526000611eef60a0830186611c06565b8281036060840152611f018186611c06565b9150508260808301529695505050505050565b87815260e060208201526000611f2d60e0830189611c06565b63ffffffff881660408401526001600160a01b0387811660608501528616608084015284151560a084015282810360c0840152611f6a8185611c06565b9a9950505050505050505050565b6000604082016001600160801b03851683526040602084015280845180835260608501915060208601925060005b81811015611d5b5783516001600160a01b0316835260209384019390920191600101611fa6565b81516001600160a01b0390811682526020808401518216908301526040808401516001600160801b03169083015260608084015191821690830152610160820190506080830151612022608084018215159052565b5060a083015161203660a084018215159052565b5060c083015161207560c084018264ffffffffff815116825264ffffffffff602082015116602083015264ffffffffff60408201511660408301525050565b5060e0929092015180516001600160a01b0316610120830152602001516101409091015290565b600083516120ae818460208801611ad5565b601d60f91b90830190815283516120cc816001840160208801611ad5565b0160010194935050505056fe5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b5072a26469706673582212200934c93692d281e9d89ed2e17022e289297dd78e723d3ba32c6645f05d3b8df864736f6c634300081c0033", "devdoc": { "kind": "dev", "methods": { diff --git a/deployments/sepolia/DecentHatsModificationModule.json b/deployments/sepolia/DecentHatsModificationModule.json index cdbb952..94825ba 100644 --- a/deployments/sepolia/DecentHatsModificationModule.json +++ b/deployments/sepolia/DecentHatsModificationModule.json @@ -1,5 +1,5 @@ { - "address": "0xf4f86df6509Af1C2a37ED527bda798e0b5F661B0", + "address": "0xA607292a63CcC55006c38B3D8627522b638070c7", "abi": [ { "inputs": [], @@ -43,6 +43,11 @@ "name": "topHatAccount", "type": "address" }, + { + "internalType": "address", + "name": "keyValuePairs", + "type": "address" + }, { "internalType": "contract IHatsModuleFactory", "name": "hatsModuleFactory", @@ -183,32 +188,32 @@ "type": "function" } ], - "transactionHash": "0x7cad3023b3a4c62efb787dc6495bae4b4d5d8256afd962e81ddce7e007358fcc", + "transactionHash": "0xe9e89748e332f6693f71c77cc0dd6c98dd0f07a98f85239e193e95f8ebe2cb3b", "receipt": { "to": null, "from": "0xfcf7a2794D066110162ADdcE3085dfd6221D4ddD", - "contractAddress": "0xf4f86df6509Af1C2a37ED527bda798e0b5F661B0", - "transactionIndex": 22, - "gasUsed": "1061522", + "contractAddress": "0xA607292a63CcC55006c38B3D8627522b638070c7", + "transactionIndex": 129, + "gasUsed": "1316194", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xdaf9d4d0758f6eab8588ca91adf7abffffc2952091c5e705b1dbd174f9b820ec", - "transactionHash": "0x7cad3023b3a4c62efb787dc6495bae4b4d5d8256afd962e81ddce7e007358fcc", + "blockHash": "0x22463352849fe63b9331bdcd0d80a3576bf701665b72a30a94d2e2e9eb094c72", + "transactionHash": "0xe9e89748e332f6693f71c77cc0dd6c98dd0f07a98f85239e193e95f8ebe2cb3b", "logs": [], - "blockNumber": 7018754, - "cumulativeGasUsed": "5025012", + "blockNumber": 7129766, + "cumulativeGasUsed": "11804943", "status": 1, "byzantium": true }, "args": [], - "numDeployments": 1, - "solcInputHash": "e3ec7808efccf5e6b24e16a29ead3983", - "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"SALT\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"contract IHats\",\"name\":\"hatsProtocol\",\"type\":\"address\"},{\"internalType\":\"contract IERC6551Registry\",\"name\":\"erc6551Registry\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"hatsAccountImplementation\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"topHatId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"topHatAccount\",\"type\":\"address\"},{\"internalType\":\"contract IHatsModuleFactory\",\"name\":\"hatsModuleFactory\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"hatsElectionsEligibilityImplementation\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"adminHatId\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"wearer\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"details\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"imageURI\",\"type\":\"string\"},{\"components\":[{\"internalType\":\"contract ISablierV2LockupLinear\",\"name\":\"sablier\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint40\",\"name\":\"start\",\"type\":\"uint40\"},{\"internalType\":\"uint40\",\"name\":\"cliff\",\"type\":\"uint40\"},{\"internalType\":\"uint40\",\"name\":\"end\",\"type\":\"uint40\"}],\"internalType\":\"struct LockupLinear.Timestamps\",\"name\":\"timestamps\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"UD60x18\",\"name\":\"fee\",\"type\":\"uint256\"}],\"internalType\":\"struct Broker\",\"name\":\"broker\",\"type\":\"tuple\"},{\"internalType\":\"uint128\",\"name\":\"totalAmount\",\"type\":\"uint128\"},{\"internalType\":\"bool\",\"name\":\"cancelable\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"transferable\",\"type\":\"bool\"}],\"internalType\":\"struct DecentHatsModuleUtils.SablierStreamParams[]\",\"name\":\"sablierStreamsParams\",\"type\":\"tuple[]\"},{\"internalType\":\"uint128\",\"name\":\"termEndDateTs\",\"type\":\"uint128\"},{\"internalType\":\"uint32\",\"name\":\"maxSupply\",\"type\":\"uint32\"},{\"internalType\":\"bool\",\"name\":\"isMutable\",\"type\":\"bool\"}],\"internalType\":\"struct DecentHatsModuleUtils.HatParams[]\",\"name\":\"hats\",\"type\":\"tuple[]\"}],\"internalType\":\"struct DecentHatsModuleUtils.CreateRoleHatsParams\",\"name\":\"roleHatsParams\",\"type\":\"tuple\"}],\"name\":\"createRoleHats\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"createRoleHats((address,address,address,uint256,address,address,address,uint256,(address,string,string,(address,address,address,(uint40,uint40,uint40),(address,uint256),uint128,bool,bool)[],uint128,uint32,bool)[]))\":{\"details\":\"Stream funds on untermed Roles are targeted at the hat's smart account. In order to withdraw funds from the stream, the hat's smart account must be the one call to `withdraw-` on the Sablier contract, setting the recipient arg to its wearer.Stream funds on termed Roles are targeted directly at the nominated wearer. The wearer should directly call `withdraw-` on the Sablier contract.Role hat creation, minting, smart account creation and stream creation are handled here in order to avoid a race condition where not more than one active proposal to create a new role can exist at a time. See: https://github.com/decentdao/decent-interface/issues/2402\",\"params\":{\"roleHatsParams\":\"An array of params for each role hat to be created.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"createRoleHats((address,address,address,uint256,address,address,address,uint256,(address,string,string,(address,address,address,(uint40,uint40,uint40),(address,uint256),uint128,bool,bool)[],uint128,uint32,bool)[]))\":{\"notice\":\"Creates a new termed or untermed role hat and any streams on it.This contract should be enabled a module on the Safe for which the role is to be created, and disabled after.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/modules/DecentHatsModificationModule.sol\":\"DecentHatsModificationModule\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\npragma solidity >=0.7.0 <0.9.0;\\n\\n/// @title Enum - Collection of enums\\n/// @author Richard Meissner - \\ncontract Enum {\\n enum Operation {Call, DelegateCall}\\n}\\n\",\"keccak256\":\"0x473e45b1a5cc47be494b0e123c9127f0c11c1e0992a321ae5a644c0bfdb2c14f\",\"license\":\"LGPL-3.0-only\"},\"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\n\\n/// @title Zodiac Avatar - A contract that manages modules that can execute transactions via this contract.\\npragma solidity >=0.7.0 <0.9.0;\\n\\nimport \\\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\\\";\\n\\ninterface IAvatar {\\n event EnabledModule(address module);\\n event DisabledModule(address module);\\n event ExecutionFromModuleSuccess(address indexed module);\\n event ExecutionFromModuleFailure(address indexed module);\\n\\n /// @dev Enables a module on the avatar.\\n /// @notice Can only be called by the avatar.\\n /// @notice Modules should be stored as a linked list.\\n /// @notice Must emit EnabledModule(address module) if successful.\\n /// @param module Module to be enabled.\\n function enableModule(address module) external;\\n\\n /// @dev Disables a module on the avatar.\\n /// @notice Can only be called by the avatar.\\n /// @notice Must emit DisabledModule(address module) if successful.\\n /// @param prevModule Address that pointed to the module to be removed in the linked list\\n /// @param module Module to be removed.\\n function disableModule(address prevModule, address module) external;\\n\\n /// @dev Allows a Module to execute a transaction.\\n /// @notice Can only be called by an enabled module.\\n /// @notice Must emit ExecutionFromModuleSuccess(address module) if successful.\\n /// @notice Must emit ExecutionFromModuleFailure(address module) if unsuccessful.\\n /// @param to Destination address of module transaction.\\n /// @param value Ether value of module transaction.\\n /// @param data Data payload of module transaction.\\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\\n function execTransactionFromModule(\\n address to,\\n uint256 value,\\n bytes memory data,\\n Enum.Operation operation\\n ) external returns (bool success);\\n\\n /// @dev Allows a Module to execute a transaction and return data\\n /// @notice Can only be called by an enabled module.\\n /// @notice Must emit ExecutionFromModuleSuccess(address module) if successful.\\n /// @notice Must emit ExecutionFromModuleFailure(address module) if unsuccessful.\\n /// @param to Destination address of module transaction.\\n /// @param value Ether value of module transaction.\\n /// @param data Data payload of module transaction.\\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\\n function execTransactionFromModuleReturnData(\\n address to,\\n uint256 value,\\n bytes memory data,\\n Enum.Operation operation\\n ) external returns (bool success, bytes memory returnData);\\n\\n /// @dev Returns if an module is enabled\\n /// @return True if the module is enabled\\n function isModuleEnabled(address module) external view returns (bool);\\n\\n /// @dev Returns array of modules.\\n /// @param start Start of the page.\\n /// @param pageSize Maximum number of modules that should be returned.\\n /// @return array Array of modules.\\n /// @return next Start of the next page.\\n function getModulesPaginated(address start, uint256 pageSize)\\n external\\n view\\n returns (address[] memory array, address next);\\n}\\n\",\"keccak256\":\"0xcd5508ffe596eef8fbccfd5fc4f10a34397773547ce64e212d48b5212865ec1f\",\"license\":\"LGPL-3.0-only\"},\"@openzeppelin/contracts/interfaces/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/introspection/IERC165.sol\\\";\\n\",\"keccak256\":\"0xd04b0f06e0666f29cf7cccc82894de541e19bb30a765b107b1e40bb7fe5f7d7a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev 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 amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `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 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes calldata data\\n ) external;\\n\\n /**\\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 {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the caller.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool _approved) external;\\n\\n /**\\n * @dev Returns 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\",\"keccak256\":\"0xed6a749c5373af398105ce6ee3ac4763aa450ea7285d268c85d9eeca809cdb1f\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../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\",\"keccak256\":\"0x75b829ff2f26c14355d1cba20e16fe7b29ca58eb5fef665ede48bc0f9c6c74b9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"@prb/math/src/Common.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\n// Common.sol\\n//\\n// Common mathematical functions used in both SD59x18 and UD60x18. Note that these global functions do not\\n// always operate with SD59x18 and UD60x18 numbers.\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CUSTOM ERRORS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @notice Thrown when the resultant value in {mulDiv} overflows uint256.\\nerror PRBMath_MulDiv_Overflow(uint256 x, uint256 y, uint256 denominator);\\n\\n/// @notice Thrown when the resultant value in {mulDiv18} overflows uint256.\\nerror PRBMath_MulDiv18_Overflow(uint256 x, uint256 y);\\n\\n/// @notice Thrown when one of the inputs passed to {mulDivSigned} is `type(int256).min`.\\nerror PRBMath_MulDivSigned_InputTooSmall();\\n\\n/// @notice Thrown when the resultant value in {mulDivSigned} overflows int256.\\nerror PRBMath_MulDivSigned_Overflow(int256 x, int256 y);\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CONSTANTS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @dev The maximum value a uint128 number can have.\\nuint128 constant MAX_UINT128 = type(uint128).max;\\n\\n/// @dev The maximum value a uint40 number can have.\\nuint40 constant MAX_UINT40 = type(uint40).max;\\n\\n/// @dev The unit number, which the decimal precision of the fixed-point types.\\nuint256 constant UNIT = 1e18;\\n\\n/// @dev The unit number inverted mod 2^256.\\nuint256 constant UNIT_INVERSE = 78156646155174841979727994598816262306175212592076161876661_508869554232690281;\\n\\n/// @dev The the largest power of two that divides the decimal value of `UNIT`. The logarithm of this value is the least significant\\n/// bit in the binary representation of `UNIT`.\\nuint256 constant UNIT_LPOTD = 262144;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @notice Calculates the binary exponent of x using the binary fraction method.\\n/// @dev Has to use 192.64-bit fixed-point numbers. See https://ethereum.stackexchange.com/a/96594/24693.\\n/// @param x The exponent as an unsigned 192.64-bit fixed-point number.\\n/// @return result The result as an unsigned 60.18-decimal fixed-point number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp2(uint256 x) pure returns (uint256 result) {\\n unchecked {\\n // Start from 0.5 in the 192.64-bit fixed-point format.\\n result = 0x800000000000000000000000000000000000000000000000;\\n\\n // The following logic multiplies the result by $\\\\sqrt{2^{-i}}$ when the bit at position i is 1. Key points:\\n //\\n // 1. Intermediate results will not overflow, as the starting point is 2^191 and all magic factors are under 2^65.\\n // 2. The rationale for organizing the if statements into groups of 8 is gas savings. If the result of performing\\n // a bitwise AND operation between x and any value in the array [0x80; 0x40; 0x20; 0x10; 0x08; 0x04; 0x02; 0x01] is 1,\\n // we know that `x & 0xFF` is also 1.\\n if (x & 0xFF00000000000000 > 0) {\\n if (x & 0x8000000000000000 > 0) {\\n result = (result * 0x16A09E667F3BCC909) >> 64;\\n }\\n if (x & 0x4000000000000000 > 0) {\\n result = (result * 0x1306FE0A31B7152DF) >> 64;\\n }\\n if (x & 0x2000000000000000 > 0) {\\n result = (result * 0x1172B83C7D517ADCE) >> 64;\\n }\\n if (x & 0x1000000000000000 > 0) {\\n result = (result * 0x10B5586CF9890F62A) >> 64;\\n }\\n if (x & 0x800000000000000 > 0) {\\n result = (result * 0x1059B0D31585743AE) >> 64;\\n }\\n if (x & 0x400000000000000 > 0) {\\n result = (result * 0x102C9A3E778060EE7) >> 64;\\n }\\n if (x & 0x200000000000000 > 0) {\\n result = (result * 0x10163DA9FB33356D8) >> 64;\\n }\\n if (x & 0x100000000000000 > 0) {\\n result = (result * 0x100B1AFA5ABCBED61) >> 64;\\n }\\n }\\n\\n if (x & 0xFF000000000000 > 0) {\\n if (x & 0x80000000000000 > 0) {\\n result = (result * 0x10058C86DA1C09EA2) >> 64;\\n }\\n if (x & 0x40000000000000 > 0) {\\n result = (result * 0x1002C605E2E8CEC50) >> 64;\\n }\\n if (x & 0x20000000000000 > 0) {\\n result = (result * 0x100162F3904051FA1) >> 64;\\n }\\n if (x & 0x10000000000000 > 0) {\\n result = (result * 0x1000B175EFFDC76BA) >> 64;\\n }\\n if (x & 0x8000000000000 > 0) {\\n result = (result * 0x100058BA01FB9F96D) >> 64;\\n }\\n if (x & 0x4000000000000 > 0) {\\n result = (result * 0x10002C5CC37DA9492) >> 64;\\n }\\n if (x & 0x2000000000000 > 0) {\\n result = (result * 0x1000162E525EE0547) >> 64;\\n }\\n if (x & 0x1000000000000 > 0) {\\n result = (result * 0x10000B17255775C04) >> 64;\\n }\\n }\\n\\n if (x & 0xFF0000000000 > 0) {\\n if (x & 0x800000000000 > 0) {\\n result = (result * 0x1000058B91B5BC9AE) >> 64;\\n }\\n if (x & 0x400000000000 > 0) {\\n result = (result * 0x100002C5C89D5EC6D) >> 64;\\n }\\n if (x & 0x200000000000 > 0) {\\n result = (result * 0x10000162E43F4F831) >> 64;\\n }\\n if (x & 0x100000000000 > 0) {\\n result = (result * 0x100000B1721BCFC9A) >> 64;\\n }\\n if (x & 0x80000000000 > 0) {\\n result = (result * 0x10000058B90CF1E6E) >> 64;\\n }\\n if (x & 0x40000000000 > 0) {\\n result = (result * 0x1000002C5C863B73F) >> 64;\\n }\\n if (x & 0x20000000000 > 0) {\\n result = (result * 0x100000162E430E5A2) >> 64;\\n }\\n if (x & 0x10000000000 > 0) {\\n result = (result * 0x1000000B172183551) >> 64;\\n }\\n }\\n\\n if (x & 0xFF00000000 > 0) {\\n if (x & 0x8000000000 > 0) {\\n result = (result * 0x100000058B90C0B49) >> 64;\\n }\\n if (x & 0x4000000000 > 0) {\\n result = (result * 0x10000002C5C8601CC) >> 64;\\n }\\n if (x & 0x2000000000 > 0) {\\n result = (result * 0x1000000162E42FFF0) >> 64;\\n }\\n if (x & 0x1000000000 > 0) {\\n result = (result * 0x10000000B17217FBB) >> 64;\\n }\\n if (x & 0x800000000 > 0) {\\n result = (result * 0x1000000058B90BFCE) >> 64;\\n }\\n if (x & 0x400000000 > 0) {\\n result = (result * 0x100000002C5C85FE3) >> 64;\\n }\\n if (x & 0x200000000 > 0) {\\n result = (result * 0x10000000162E42FF1) >> 64;\\n }\\n if (x & 0x100000000 > 0) {\\n result = (result * 0x100000000B17217F8) >> 64;\\n }\\n }\\n\\n if (x & 0xFF000000 > 0) {\\n if (x & 0x80000000 > 0) {\\n result = (result * 0x10000000058B90BFC) >> 64;\\n }\\n if (x & 0x40000000 > 0) {\\n result = (result * 0x1000000002C5C85FE) >> 64;\\n }\\n if (x & 0x20000000 > 0) {\\n result = (result * 0x100000000162E42FF) >> 64;\\n }\\n if (x & 0x10000000 > 0) {\\n result = (result * 0x1000000000B17217F) >> 64;\\n }\\n if (x & 0x8000000 > 0) {\\n result = (result * 0x100000000058B90C0) >> 64;\\n }\\n if (x & 0x4000000 > 0) {\\n result = (result * 0x10000000002C5C860) >> 64;\\n }\\n if (x & 0x2000000 > 0) {\\n result = (result * 0x1000000000162E430) >> 64;\\n }\\n if (x & 0x1000000 > 0) {\\n result = (result * 0x10000000000B17218) >> 64;\\n }\\n }\\n\\n if (x & 0xFF0000 > 0) {\\n if (x & 0x800000 > 0) {\\n result = (result * 0x1000000000058B90C) >> 64;\\n }\\n if (x & 0x400000 > 0) {\\n result = (result * 0x100000000002C5C86) >> 64;\\n }\\n if (x & 0x200000 > 0) {\\n result = (result * 0x10000000000162E43) >> 64;\\n }\\n if (x & 0x100000 > 0) {\\n result = (result * 0x100000000000B1721) >> 64;\\n }\\n if (x & 0x80000 > 0) {\\n result = (result * 0x10000000000058B91) >> 64;\\n }\\n if (x & 0x40000 > 0) {\\n result = (result * 0x1000000000002C5C8) >> 64;\\n }\\n if (x & 0x20000 > 0) {\\n result = (result * 0x100000000000162E4) >> 64;\\n }\\n if (x & 0x10000 > 0) {\\n result = (result * 0x1000000000000B172) >> 64;\\n }\\n }\\n\\n if (x & 0xFF00 > 0) {\\n if (x & 0x8000 > 0) {\\n result = (result * 0x100000000000058B9) >> 64;\\n }\\n if (x & 0x4000 > 0) {\\n result = (result * 0x10000000000002C5D) >> 64;\\n }\\n if (x & 0x2000 > 0) {\\n result = (result * 0x1000000000000162E) >> 64;\\n }\\n if (x & 0x1000 > 0) {\\n result = (result * 0x10000000000000B17) >> 64;\\n }\\n if (x & 0x800 > 0) {\\n result = (result * 0x1000000000000058C) >> 64;\\n }\\n if (x & 0x400 > 0) {\\n result = (result * 0x100000000000002C6) >> 64;\\n }\\n if (x & 0x200 > 0) {\\n result = (result * 0x10000000000000163) >> 64;\\n }\\n if (x & 0x100 > 0) {\\n result = (result * 0x100000000000000B1) >> 64;\\n }\\n }\\n\\n if (x & 0xFF > 0) {\\n if (x & 0x80 > 0) {\\n result = (result * 0x10000000000000059) >> 64;\\n }\\n if (x & 0x40 > 0) {\\n result = (result * 0x1000000000000002C) >> 64;\\n }\\n if (x & 0x20 > 0) {\\n result = (result * 0x10000000000000016) >> 64;\\n }\\n if (x & 0x10 > 0) {\\n result = (result * 0x1000000000000000B) >> 64;\\n }\\n if (x & 0x8 > 0) {\\n result = (result * 0x10000000000000006) >> 64;\\n }\\n if (x & 0x4 > 0) {\\n result = (result * 0x10000000000000003) >> 64;\\n }\\n if (x & 0x2 > 0) {\\n result = (result * 0x10000000000000001) >> 64;\\n }\\n if (x & 0x1 > 0) {\\n result = (result * 0x10000000000000001) >> 64;\\n }\\n }\\n\\n // In the code snippet below, two operations are executed simultaneously:\\n //\\n // 1. The result is multiplied by $(2^n + 1)$, where $2^n$ represents the integer part, and the additional 1\\n // accounts for the initial guess of 0.5. This is achieved by subtracting from 191 instead of 192.\\n // 2. The result is then converted to an unsigned 60.18-decimal fixed-point format.\\n //\\n // The underlying logic is based on the relationship $2^{191-ip} = 2^{ip} / 2^{191}$, where $ip$ denotes the,\\n // integer part, $2^n$.\\n result *= UNIT;\\n result >>= (191 - (x >> 64));\\n }\\n}\\n\\n/// @notice Finds the zero-based index of the first 1 in the binary representation of x.\\n///\\n/// @dev See the note on \\\"msb\\\" in this Wikipedia article: https://en.wikipedia.org/wiki/Find_first_set\\n///\\n/// Each step in this implementation is equivalent to this high-level code:\\n///\\n/// ```solidity\\n/// if (x >= 2 ** 128) {\\n/// x >>= 128;\\n/// result += 128;\\n/// }\\n/// ```\\n///\\n/// Where 128 is replaced with each respective power of two factor. See the full high-level implementation here:\\n/// https://gist.github.com/PaulRBerg/f932f8693f2733e30c4d479e8e980948\\n///\\n/// The Yul instructions used below are:\\n///\\n/// - \\\"gt\\\" is \\\"greater than\\\"\\n/// - \\\"or\\\" is the OR bitwise operator\\n/// - \\\"shl\\\" is \\\"shift left\\\"\\n/// - \\\"shr\\\" is \\\"shift right\\\"\\n///\\n/// @param x The uint256 number for which to find the index of the most significant bit.\\n/// @return result The index of the most significant bit as a uint256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction msb(uint256 x) pure returns (uint256 result) {\\n // 2^128\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(7, gt(x, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^64\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(6, gt(x, 0xFFFFFFFFFFFFFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^32\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(5, gt(x, 0xFFFFFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^16\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(4, gt(x, 0xFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^8\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(3, gt(x, 0xFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^4\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(2, gt(x, 0xF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^2\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(1, gt(x, 0x3))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^1\\n // No need to shift x any more.\\n assembly (\\\"memory-safe\\\") {\\n let factor := gt(x, 0x1)\\n result := or(result, factor)\\n }\\n}\\n\\n/// @notice Calculates x*y\\u00f7denominator with 512-bit precision.\\n///\\n/// @dev Credits to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv.\\n///\\n/// Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - The denominator must not be zero.\\n/// - The result must fit in uint256.\\n///\\n/// @param x The multiplicand as a uint256.\\n/// @param y The multiplier as a uint256.\\n/// @param denominator The divisor as a uint256.\\n/// @return result The result as a uint256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mulDiv(uint256 x, uint256 y, uint256 denominator) pure returns (uint256 result) {\\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; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly (\\\"memory-safe\\\") {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\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 unchecked {\\n return prod0 / denominator;\\n }\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n if (prod1 >= denominator) {\\n revert PRBMath_MulDiv_Overflow(x, y, denominator);\\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 (\\\"memory-safe\\\") {\\n // Compute remainder using the mulmod Yul instruction.\\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 unchecked {\\n // Calculate the largest power of two divisor of the denominator using the unary operator ~. This operation cannot overflow\\n // because the denominator cannot be zero at this point in the function execution. The result is always >= 1.\\n // For more detail, see https://cs.stackexchange.com/q/138556/92363.\\n uint256 lpotdod = denominator & (~denominator + 1);\\n uint256 flippedLpotdod;\\n\\n assembly (\\\"memory-safe\\\") {\\n // Factor powers of two out of denominator.\\n denominator := div(denominator, lpotdod)\\n\\n // Divide [prod1 prod0] by lpotdod.\\n prod0 := div(prod0, lpotdod)\\n\\n // Get the flipped value `2^256 / lpotdod`. If the `lpotdod` is zero, the flipped value is one.\\n // `sub(0, lpotdod)` produces the two's complement version of `lpotdod`, which is equivalent to flipping all the bits.\\n // However, `div` interprets this value as an unsigned value: https://ethereum.stackexchange.com/q/147168/24693\\n flippedLpotdod := add(div(sub(0, lpotdod), lpotdod), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * flippedLpotdod;\\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 works\\n // 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 }\\n}\\n\\n/// @notice Calculates x*y\\u00f71e18 with 512-bit precision.\\n///\\n/// @dev A variant of {mulDiv} with constant folding, i.e. in which the denominator is hard coded to 1e18.\\n///\\n/// Notes:\\n/// - The body is purposely left uncommented; to understand how this works, see the documentation in {mulDiv}.\\n/// - The result is rounded toward zero.\\n/// - We take as an axiom that the result cannot be `MAX_UINT256` when x and y solve the following system of equations:\\n///\\n/// $$\\n/// \\\\begin{cases}\\n/// x * y = MAX\\\\_UINT256 * UNIT \\\\\\\\\\n/// (x * y) \\\\% UNIT \\\\geq \\\\frac{UNIT}{2}\\n/// \\\\end{cases}\\n/// $$\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {mulDiv}.\\n/// - The result must fit in uint256.\\n///\\n/// @param x The multiplicand as an unsigned 60.18-decimal fixed-point number.\\n/// @param y The multiplier as an unsigned 60.18-decimal fixed-point number.\\n/// @return result The result as an unsigned 60.18-decimal fixed-point number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mulDiv18(uint256 x, uint256 y) pure returns (uint256 result) {\\n uint256 prod0;\\n uint256 prod1;\\n assembly (\\\"memory-safe\\\") {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n if (prod1 == 0) {\\n unchecked {\\n return prod0 / UNIT;\\n }\\n }\\n\\n if (prod1 >= UNIT) {\\n revert PRBMath_MulDiv18_Overflow(x, y);\\n }\\n\\n uint256 remainder;\\n assembly (\\\"memory-safe\\\") {\\n remainder := mulmod(x, y, UNIT)\\n result :=\\n mul(\\n or(\\n div(sub(prod0, remainder), UNIT_LPOTD),\\n mul(sub(prod1, gt(remainder, prod0)), add(div(sub(0, UNIT_LPOTD), UNIT_LPOTD), 1))\\n ),\\n UNIT_INVERSE\\n )\\n }\\n}\\n\\n/// @notice Calculates x*y\\u00f7denominator with 512-bit precision.\\n///\\n/// @dev This is an extension of {mulDiv} for signed numbers, which works by computing the signs and the absolute values separately.\\n///\\n/// Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {mulDiv}.\\n/// - None of the inputs can be `type(int256).min`.\\n/// - The result must fit in int256.\\n///\\n/// @param x The multiplicand as an int256.\\n/// @param y The multiplier as an int256.\\n/// @param denominator The divisor as an int256.\\n/// @return result The result as an int256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mulDivSigned(int256 x, int256 y, int256 denominator) pure returns (int256 result) {\\n if (x == type(int256).min || y == type(int256).min || denominator == type(int256).min) {\\n revert PRBMath_MulDivSigned_InputTooSmall();\\n }\\n\\n // Get hold of the absolute values of x, y and the denominator.\\n uint256 xAbs;\\n uint256 yAbs;\\n uint256 dAbs;\\n unchecked {\\n xAbs = x < 0 ? uint256(-x) : uint256(x);\\n yAbs = y < 0 ? uint256(-y) : uint256(y);\\n dAbs = denominator < 0 ? uint256(-denominator) : uint256(denominator);\\n }\\n\\n // Compute the absolute value of x*y\\u00f7denominator. The result must fit in int256.\\n uint256 resultAbs = mulDiv(xAbs, yAbs, dAbs);\\n if (resultAbs > uint256(type(int256).max)) {\\n revert PRBMath_MulDivSigned_Overflow(x, y);\\n }\\n\\n // Get the signs of x, y and the denominator.\\n uint256 sx;\\n uint256 sy;\\n uint256 sd;\\n assembly (\\\"memory-safe\\\") {\\n // \\\"sgt\\\" is the \\\"signed greater than\\\" assembly instruction and \\\"sub(0,1)\\\" is -1 in two's complement.\\n sx := sgt(x, sub(0, 1))\\n sy := sgt(y, sub(0, 1))\\n sd := sgt(denominator, sub(0, 1))\\n }\\n\\n // XOR over sx, sy and sd. What this does is to check whether there are 1 or 3 negative signs in the inputs.\\n // If there are, the result should be negative. Otherwise, it should be positive.\\n unchecked {\\n result = sx ^ sy ^ sd == 0 ? -int256(resultAbs) : int256(resultAbs);\\n }\\n}\\n\\n/// @notice Calculates the square root of x using the Babylonian method.\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\\n///\\n/// Notes:\\n/// - If x is not a perfect square, the result is rounded down.\\n/// - Credits to OpenZeppelin for the explanations in comments below.\\n///\\n/// @param x The uint256 number for which to calculate the square root.\\n/// @return result The result as a uint256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction sqrt(uint256 x) pure returns (uint256 result) {\\n if (x == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we calculate the biggest power of 2 which is smaller than the square root of x.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of x is a power of 2 such that we have:\\n //\\n // $$\\n // msb(x) <= x <= 2*msb(x)$\\n // $$\\n //\\n // We write $msb(x)$ as $2^k$, and we get:\\n //\\n // $$\\n // k = log_2(x)\\n // $$\\n //\\n // Thus, we can write the initial inequality as:\\n //\\n // $$\\n // 2^{log_2(x)} <= x <= 2*2^{log_2(x)+1} \\\\\\\\\\n // sqrt(2^k) <= sqrt(x) < sqrt(2^{k+1}) \\\\\\\\\\n // 2^{k/2} <= sqrt(x) < 2^{(k+1)/2} <= 2^{(k/2)+1}\\n // $$\\n //\\n // Consequently, $2^{log_2(x) /2} is a good first approximation of sqrt(x) with at least one correct bit.\\n uint256 xAux = uint256(x);\\n result = 1;\\n if (xAux >= 2 ** 128) {\\n xAux >>= 128;\\n result <<= 64;\\n }\\n if (xAux >= 2 ** 64) {\\n xAux >>= 64;\\n result <<= 32;\\n }\\n if (xAux >= 2 ** 32) {\\n xAux >>= 32;\\n result <<= 16;\\n }\\n if (xAux >= 2 ** 16) {\\n xAux >>= 16;\\n result <<= 8;\\n }\\n if (xAux >= 2 ** 8) {\\n xAux >>= 8;\\n result <<= 4;\\n }\\n if (xAux >= 2 ** 4) {\\n xAux >>= 4;\\n result <<= 2;\\n }\\n if (xAux >= 2 ** 2) {\\n result <<= 1;\\n }\\n\\n // At this point, `result` is an estimation with at least one bit of precision. We know the true value has at\\n // most 128 bits, since it is the square root of a uint256. Newton's method converges quadratically (precision\\n // doubles at every iteration). We thus need at most 7 iteration to turn our partial result with one bit of\\n // precision into the expected uint128 result.\\n unchecked {\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n\\n // If x is not a perfect square, round the result toward zero.\\n uint256 roundedResult = x / result;\\n if (result >= roundedResult) {\\n result = roundedResult;\\n }\\n }\\n}\\n\",\"keccak256\":\"0xaa374e2c26cc93e8c22a6953804ee05f811597ef5fa82f76824378b22944778b\",\"license\":\"MIT\"},\"@prb/math/src/UD2x18.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\n/*\\n\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2550\\u2550\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2554\\u2588\\u2588\\u2588\\u2588\\u2554\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551 \\u255a\\u2550\\u255d \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\n\\n\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2550\\u2550\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d \\u255a\\u2588\\u2588\\u2588\\u2554\\u255d \\u255a\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u255d\\n\\n*/\\n\\nimport \\\"./ud2x18/Casting.sol\\\";\\nimport \\\"./ud2x18/Constants.sol\\\";\\nimport \\\"./ud2x18/Errors.sol\\\";\\nimport \\\"./ud2x18/ValueType.sol\\\";\\n\",\"keccak256\":\"0xfb624e24cd8bb790fa08e7827819de85504a86e20e961fa4ad126c65b6d90641\",\"license\":\"MIT\"},\"@prb/math/src/UD60x18.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\n/*\\n\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2550\\u2550\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2554\\u2588\\u2588\\u2588\\u2588\\u2554\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551 \\u255a\\u2550\\u255d \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\n\\n\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2550\\u2588\\u2588\\u2588\\u2588\\u2557\\u255a\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2588\\u2588\\u2551 \\u255a\\u2588\\u2588\\u2588\\u2554\\u255d \\u255a\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2554\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2554\\u255d \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u255d\\n\\n*/\\n\\nimport \\\"./ud60x18/Casting.sol\\\";\\nimport \\\"./ud60x18/Constants.sol\\\";\\nimport \\\"./ud60x18/Conversions.sol\\\";\\nimport \\\"./ud60x18/Errors.sol\\\";\\nimport \\\"./ud60x18/Helpers.sol\\\";\\nimport \\\"./ud60x18/Math.sol\\\";\\nimport \\\"./ud60x18/ValueType.sol\\\";\\n\",\"keccak256\":\"0xb98c6f74275914d279e8af6c502c2b1f50d5f6e1ed418d3b0153f5a193206c48\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as CastingErrors;\\nimport { SD59x18 } from \\\"../sd59x18/ValueType.sol\\\";\\nimport { UD2x18 } from \\\"../ud2x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"../ud60x18/ValueType.sol\\\";\\nimport { SD1x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts an SD1x18 number into SD59x18.\\n/// @dev There is no overflow check because the domain of SD1x18 is a subset of SD59x18.\\nfunction intoSD59x18(SD1x18 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(int256(SD1x18.unwrap(x)));\\n}\\n\\n/// @notice Casts an SD1x18 number into UD2x18.\\n/// - x must be positive.\\nfunction intoUD2x18(SD1x18 x) pure returns (UD2x18 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUD2x18_Underflow(x);\\n }\\n result = UD2x18.wrap(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into UD60x18.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUD60x18(SD1x18 x) pure returns (UD60x18 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUD60x18_Underflow(x);\\n }\\n result = UD60x18.wrap(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into uint256.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUint256(SD1x18 x) pure returns (uint256 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint256_Underflow(x);\\n }\\n result = uint256(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into uint128.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUint128(SD1x18 x) pure returns (uint128 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint128_Underflow(x);\\n }\\n result = uint128(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(SD1x18 x) pure returns (uint40 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint40_Underflow(x);\\n }\\n if (xInt > int64(uint64(Common.MAX_UINT40))) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint40_Overflow(x);\\n }\\n result = uint40(uint64(xInt));\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction sd1x18(int64 x) pure returns (SD1x18 result) {\\n result = SD1x18.wrap(x);\\n}\\n\\n/// @notice Unwraps an SD1x18 number into int64.\\nfunction unwrap(SD1x18 x) pure returns (int64 result) {\\n result = SD1x18.unwrap(x);\\n}\\n\\n/// @notice Wraps an int64 number into SD1x18.\\nfunction wrap(int64 x) pure returns (SD1x18 result) {\\n result = SD1x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x9e49e2b37c1bb845861740805edaaef3fe951a7b96eef16ce84fbf76e8278670\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD1x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @dev Euler's number as an SD1x18 number.\\nSD1x18 constant E = SD1x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum value an SD1x18 number can have.\\nint64 constant uMAX_SD1x18 = 9_223372036854775807;\\nSD1x18 constant MAX_SD1x18 = SD1x18.wrap(uMAX_SD1x18);\\n\\n/// @dev The maximum value an SD1x18 number can have.\\nint64 constant uMIN_SD1x18 = -9_223372036854775808;\\nSD1x18 constant MIN_SD1x18 = SD1x18.wrap(uMIN_SD1x18);\\n\\n/// @dev PI as an SD1x18 number.\\nSD1x18 constant PI = SD1x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of SD1x18.\\nSD1x18 constant UNIT = SD1x18.wrap(1e18);\\nint64 constant uUNIT = 1e18;\\n\",\"keccak256\":\"0x6496165b80552785a4b65a239b96e2a5fedf62fe54f002eeed72d75e566d7585\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD1x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in UD2x18.\\nerror PRBMath_SD1x18_ToUD2x18_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in UD60x18.\\nerror PRBMath_SD1x18_ToUD60x18_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint128.\\nerror PRBMath_SD1x18_ToUint128_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint256.\\nerror PRBMath_SD1x18_ToUint256_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint40.\\nerror PRBMath_SD1x18_ToUint40_Overflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint40.\\nerror PRBMath_SD1x18_ToUint40_Underflow(SD1x18 x);\\n\",\"keccak256\":\"0x836cb42ba619ca369fd4765bc47fefc3c3621369c5861882af14660aca5057ee\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\n\\n/// @notice The signed 1.18-decimal fixed-point number representation, which can have up to 1 digit and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\\n/// type int64. This is useful when end users want to use int64 to save gas, e.g. with tight variable packing in contract\\n/// storage.\\ntype SD1x18 is int64;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoSD59x18,\\n Casting.intoUD2x18,\\n Casting.intoUD60x18,\\n Casting.intoUint256,\\n Casting.intoUint128,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for SD1x18 global;\\n\",\"keccak256\":\"0x2f86f1aa9fca42f40808b51a879b406ac51817647bdb9642f8a79dd8fdb754a7\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Errors.sol\\\" as CastingErrors;\\nimport { MAX_UINT128, MAX_UINT40 } from \\\"../Common.sol\\\";\\nimport { uMAX_SD1x18, uMIN_SD1x18 } from \\\"../sd1x18/Constants.sol\\\";\\nimport { SD1x18 } from \\\"../sd1x18/ValueType.sol\\\";\\nimport { uMAX_UD2x18 } from \\\"../ud2x18/Constants.sol\\\";\\nimport { UD2x18 } from \\\"../ud2x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"../ud60x18/ValueType.sol\\\";\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts an SD59x18 number into int256.\\n/// @dev This is basically a functional alias for {unwrap}.\\nfunction intoInt256(SD59x18 x) pure returns (int256 result) {\\n result = SD59x18.unwrap(x);\\n}\\n\\n/// @notice Casts an SD59x18 number into SD1x18.\\n/// @dev Requirements:\\n/// - x must be greater than or equal to `uMIN_SD1x18`.\\n/// - x must be less than or equal to `uMAX_SD1x18`.\\nfunction intoSD1x18(SD59x18 x) pure returns (SD1x18 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < uMIN_SD1x18) {\\n revert CastingErrors.PRBMath_SD59x18_IntoSD1x18_Underflow(x);\\n }\\n if (xInt > uMAX_SD1x18) {\\n revert CastingErrors.PRBMath_SD59x18_IntoSD1x18_Overflow(x);\\n }\\n result = SD1x18.wrap(int64(xInt));\\n}\\n\\n/// @notice Casts an SD59x18 number into UD2x18.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `uMAX_UD2x18`.\\nfunction intoUD2x18(SD59x18 x) pure returns (UD2x18 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUD2x18_Underflow(x);\\n }\\n if (xInt > int256(uint256(uMAX_UD2x18))) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUD2x18_Overflow(x);\\n }\\n result = UD2x18.wrap(uint64(uint256(xInt)));\\n}\\n\\n/// @notice Casts an SD59x18 number into UD60x18.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUD60x18(SD59x18 x) pure returns (UD60x18 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUD60x18_Underflow(x);\\n }\\n result = UD60x18.wrap(uint256(xInt));\\n}\\n\\n/// @notice Casts an SD59x18 number into uint256.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUint256(SD59x18 x) pure returns (uint256 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint256_Underflow(x);\\n }\\n result = uint256(xInt);\\n}\\n\\n/// @notice Casts an SD59x18 number into uint128.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `uMAX_UINT128`.\\nfunction intoUint128(SD59x18 x) pure returns (uint128 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint128_Underflow(x);\\n }\\n if (xInt > int256(uint256(MAX_UINT128))) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint128_Overflow(x);\\n }\\n result = uint128(uint256(xInt));\\n}\\n\\n/// @notice Casts an SD59x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(SD59x18 x) pure returns (uint40 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint40_Underflow(x);\\n }\\n if (xInt > int256(uint256(MAX_UINT40))) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint40_Overflow(x);\\n }\\n result = uint40(uint256(xInt));\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction sd(int256 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(x);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction sd59x18(int256 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(x);\\n}\\n\\n/// @notice Unwraps an SD59x18 number into int256.\\nfunction unwrap(SD59x18 x) pure returns (int256 result) {\\n result = SD59x18.unwrap(x);\\n}\\n\\n/// @notice Wraps an int256 number into SD59x18.\\nfunction wrap(int256 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x3b21b60ec2998c3ae32f647412da51d3683b3f183a807198cc8d157499484f99\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n// NOTICE: the \\\"u\\\" prefix stands for \\\"unwrapped\\\".\\n\\n/// @dev Euler's number as an SD59x18 number.\\nSD59x18 constant E = SD59x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum input permitted in {exp}.\\nint256 constant uEXP_MAX_INPUT = 133_084258667509499440;\\nSD59x18 constant EXP_MAX_INPUT = SD59x18.wrap(uEXP_MAX_INPUT);\\n\\n/// @dev Any value less than this returns 0 in {exp}.\\nint256 constant uEXP_MIN_THRESHOLD = -41_446531673892822322;\\nSD59x18 constant EXP_MIN_THRESHOLD = SD59x18.wrap(uEXP_MIN_THRESHOLD);\\n\\n/// @dev The maximum input permitted in {exp2}.\\nint256 constant uEXP2_MAX_INPUT = 192e18 - 1;\\nSD59x18 constant EXP2_MAX_INPUT = SD59x18.wrap(uEXP2_MAX_INPUT);\\n\\n/// @dev Any value less than this returns 0 in {exp2}.\\nint256 constant uEXP2_MIN_THRESHOLD = -59_794705707972522261;\\nSD59x18 constant EXP2_MIN_THRESHOLD = SD59x18.wrap(uEXP2_MIN_THRESHOLD);\\n\\n/// @dev Half the UNIT number.\\nint256 constant uHALF_UNIT = 0.5e18;\\nSD59x18 constant HALF_UNIT = SD59x18.wrap(uHALF_UNIT);\\n\\n/// @dev $log_2(10)$ as an SD59x18 number.\\nint256 constant uLOG2_10 = 3_321928094887362347;\\nSD59x18 constant LOG2_10 = SD59x18.wrap(uLOG2_10);\\n\\n/// @dev $log_2(e)$ as an SD59x18 number.\\nint256 constant uLOG2_E = 1_442695040888963407;\\nSD59x18 constant LOG2_E = SD59x18.wrap(uLOG2_E);\\n\\n/// @dev The maximum value an SD59x18 number can have.\\nint256 constant uMAX_SD59x18 = 57896044618658097711785492504343953926634992332820282019728_792003956564819967;\\nSD59x18 constant MAX_SD59x18 = SD59x18.wrap(uMAX_SD59x18);\\n\\n/// @dev The maximum whole value an SD59x18 number can have.\\nint256 constant uMAX_WHOLE_SD59x18 = 57896044618658097711785492504343953926634992332820282019728_000000000000000000;\\nSD59x18 constant MAX_WHOLE_SD59x18 = SD59x18.wrap(uMAX_WHOLE_SD59x18);\\n\\n/// @dev The minimum value an SD59x18 number can have.\\nint256 constant uMIN_SD59x18 = -57896044618658097711785492504343953926634992332820282019728_792003956564819968;\\nSD59x18 constant MIN_SD59x18 = SD59x18.wrap(uMIN_SD59x18);\\n\\n/// @dev The minimum whole value an SD59x18 number can have.\\nint256 constant uMIN_WHOLE_SD59x18 = -57896044618658097711785492504343953926634992332820282019728_000000000000000000;\\nSD59x18 constant MIN_WHOLE_SD59x18 = SD59x18.wrap(uMIN_WHOLE_SD59x18);\\n\\n/// @dev PI as an SD59x18 number.\\nSD59x18 constant PI = SD59x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of SD59x18.\\nint256 constant uUNIT = 1e18;\\nSD59x18 constant UNIT = SD59x18.wrap(1e18);\\n\\n/// @dev The unit number squared.\\nint256 constant uUNIT_SQUARED = 1e36;\\nSD59x18 constant UNIT_SQUARED = SD59x18.wrap(uUNIT_SQUARED);\\n\\n/// @dev Zero as an SD59x18 number.\\nSD59x18 constant ZERO = SD59x18.wrap(0);\\n\",\"keccak256\":\"0x9bcb8dd6b3e886d140ad1c32747a4f6d29a492529ceb835be878ae837aa6cc3a\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when taking the absolute value of `MIN_SD59x18`.\\nerror PRBMath_SD59x18_Abs_MinSD59x18();\\n\\n/// @notice Thrown when ceiling a number overflows SD59x18.\\nerror PRBMath_SD59x18_Ceil_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when converting a basic integer to the fixed-point format overflows SD59x18.\\nerror PRBMath_SD59x18_Convert_Overflow(int256 x);\\n\\n/// @notice Thrown when converting a basic integer to the fixed-point format underflows SD59x18.\\nerror PRBMath_SD59x18_Convert_Underflow(int256 x);\\n\\n/// @notice Thrown when dividing two numbers and one of them is `MIN_SD59x18`.\\nerror PRBMath_SD59x18_Div_InputTooSmall();\\n\\n/// @notice Thrown when dividing two numbers and one of the intermediary unsigned results overflows SD59x18.\\nerror PRBMath_SD59x18_Div_Overflow(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when taking the natural exponent of a base greater than 133_084258667509499441.\\nerror PRBMath_SD59x18_Exp_InputTooBig(SD59x18 x);\\n\\n/// @notice Thrown when taking the binary exponent of a base greater than 192e18.\\nerror PRBMath_SD59x18_Exp2_InputTooBig(SD59x18 x);\\n\\n/// @notice Thrown when flooring a number underflows SD59x18.\\nerror PRBMath_SD59x18_Floor_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when taking the geometric mean of two numbers and their product is negative.\\nerror PRBMath_SD59x18_Gm_NegativeProduct(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when taking the geometric mean of two numbers and multiplying them overflows SD59x18.\\nerror PRBMath_SD59x18_Gm_Overflow(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\\nerror PRBMath_SD59x18_IntoSD1x18_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\\nerror PRBMath_SD59x18_IntoSD1x18_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\\nerror PRBMath_SD59x18_IntoUD2x18_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\\nerror PRBMath_SD59x18_IntoUD2x18_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD60x18.\\nerror PRBMath_SD59x18_IntoUD60x18_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\\nerror PRBMath_SD59x18_IntoUint128_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\\nerror PRBMath_SD59x18_IntoUint128_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint256.\\nerror PRBMath_SD59x18_IntoUint256_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\\nerror PRBMath_SD59x18_IntoUint40_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\\nerror PRBMath_SD59x18_IntoUint40_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when taking the logarithm of a number less than or equal to zero.\\nerror PRBMath_SD59x18_Log_InputTooSmall(SD59x18 x);\\n\\n/// @notice Thrown when multiplying two numbers and one of the inputs is `MIN_SD59x18`.\\nerror PRBMath_SD59x18_Mul_InputTooSmall();\\n\\n/// @notice Thrown when multiplying two numbers and the intermediary absolute result overflows SD59x18.\\nerror PRBMath_SD59x18_Mul_Overflow(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when raising a number to a power and the intermediary absolute result overflows SD59x18.\\nerror PRBMath_SD59x18_Powu_Overflow(SD59x18 x, uint256 y);\\n\\n/// @notice Thrown when taking the square root of a negative number.\\nerror PRBMath_SD59x18_Sqrt_NegativeInput(SD59x18 x);\\n\\n/// @notice Thrown when the calculating the square root overflows SD59x18.\\nerror PRBMath_SD59x18_Sqrt_Overflow(SD59x18 x);\\n\",\"keccak256\":\"0xa6d00fe5efa215ac0df25c896e3da99a12fb61e799644b2ec32da947313d3db4\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Helpers.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { wrap } from \\\"./Casting.sol\\\";\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Implements the checked addition operation (+) in the SD59x18 type.\\nfunction add(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n return wrap(x.unwrap() + y.unwrap());\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the SD59x18 type.\\nfunction and(SD59x18 x, int256 bits) pure returns (SD59x18 result) {\\n return wrap(x.unwrap() & bits);\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the SD59x18 type.\\nfunction and2(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n return wrap(x.unwrap() & y.unwrap());\\n}\\n\\n/// @notice Implements the equal (=) operation in the SD59x18 type.\\nfunction eq(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() == y.unwrap();\\n}\\n\\n/// @notice Implements the greater than operation (>) in the SD59x18 type.\\nfunction gt(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() > y.unwrap();\\n}\\n\\n/// @notice Implements the greater than or equal to operation (>=) in the SD59x18 type.\\nfunction gte(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() >= y.unwrap();\\n}\\n\\n/// @notice Implements a zero comparison check function in the SD59x18 type.\\nfunction isZero(SD59x18 x) pure returns (bool result) {\\n result = x.unwrap() == 0;\\n}\\n\\n/// @notice Implements the left shift operation (<<) in the SD59x18 type.\\nfunction lshift(SD59x18 x, uint256 bits) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() << bits);\\n}\\n\\n/// @notice Implements the lower than operation (<) in the SD59x18 type.\\nfunction lt(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() < y.unwrap();\\n}\\n\\n/// @notice Implements the lower than or equal to operation (<=) in the SD59x18 type.\\nfunction lte(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() <= y.unwrap();\\n}\\n\\n/// @notice Implements the unchecked modulo operation (%) in the SD59x18 type.\\nfunction mod(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() % y.unwrap());\\n}\\n\\n/// @notice Implements the not equal operation (!=) in the SD59x18 type.\\nfunction neq(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() != y.unwrap();\\n}\\n\\n/// @notice Implements the NOT (~) bitwise operation in the SD59x18 type.\\nfunction not(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(~x.unwrap());\\n}\\n\\n/// @notice Implements the OR (|) bitwise operation in the SD59x18 type.\\nfunction or(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() | y.unwrap());\\n}\\n\\n/// @notice Implements the right shift operation (>>) in the SD59x18 type.\\nfunction rshift(SD59x18 x, uint256 bits) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() >> bits);\\n}\\n\\n/// @notice Implements the checked subtraction operation (-) in the SD59x18 type.\\nfunction sub(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() - y.unwrap());\\n}\\n\\n/// @notice Implements the checked unary minus operation (-) in the SD59x18 type.\\nfunction unary(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(-x.unwrap());\\n}\\n\\n/// @notice Implements the unchecked addition operation (+) in the SD59x18 type.\\nfunction uncheckedAdd(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() + y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the unchecked subtraction operation (-) in the SD59x18 type.\\nfunction uncheckedSub(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() - y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the unchecked unary minus operation (-) in the SD59x18 type.\\nfunction uncheckedUnary(SD59x18 x) pure returns (SD59x18 result) {\\n unchecked {\\n result = wrap(-x.unwrap());\\n }\\n}\\n\\n/// @notice Implements the XOR (^) bitwise operation in the SD59x18 type.\\nfunction xor(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() ^ y.unwrap());\\n}\\n\",\"keccak256\":\"0x208570f1657cf730cb6c3d81aa14030e0d45cf906cdedea5059369d7df4bb716\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as Errors;\\nimport {\\n uEXP_MAX_INPUT,\\n uEXP2_MAX_INPUT,\\n uEXP_MIN_THRESHOLD,\\n uEXP2_MIN_THRESHOLD,\\n uHALF_UNIT,\\n uLOG2_10,\\n uLOG2_E,\\n uMAX_SD59x18,\\n uMAX_WHOLE_SD59x18,\\n uMIN_SD59x18,\\n uMIN_WHOLE_SD59x18,\\n UNIT,\\n uUNIT,\\n uUNIT_SQUARED,\\n ZERO\\n} from \\\"./Constants.sol\\\";\\nimport { wrap } from \\\"./Helpers.sol\\\";\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Calculates the absolute value of x.\\n///\\n/// @dev Requirements:\\n/// - x must be greater than `MIN_SD59x18`.\\n///\\n/// @param x The SD59x18 number for which to calculate the absolute value.\\n/// @param result The absolute value of x as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction abs(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt == uMIN_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Abs_MinSD59x18();\\n }\\n result = xInt < 0 ? wrap(-xInt) : x;\\n}\\n\\n/// @notice Calculates the arithmetic average of x and y.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// @param x The first operand as an SD59x18 number.\\n/// @param y The second operand as an SD59x18 number.\\n/// @return result The arithmetic average as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction avg(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n\\n unchecked {\\n // This operation is equivalent to `x / 2 + y / 2`, and it can never overflow.\\n int256 sum = (xInt >> 1) + (yInt >> 1);\\n\\n if (sum < 0) {\\n // If at least one of x and y is odd, add 1 to the result, because shifting negative numbers to the right\\n // rounds toward negative infinity. The right part is equivalent to `sum + (x % 2 == 1 || y % 2 == 1)`.\\n assembly (\\\"memory-safe\\\") {\\n result := add(sum, and(or(xInt, yInt), 1))\\n }\\n } else {\\n // Add 1 if both x and y are odd to account for the double 0.5 remainder truncated after shifting.\\n result = wrap(sum + (xInt & yInt & 1));\\n }\\n }\\n}\\n\\n/// @notice Yields the smallest whole number greater than or equal to x.\\n///\\n/// @dev Optimized for fractional value inputs, because every whole value has (1e18 - 1) fractional counterparts.\\n/// See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n///\\n/// Requirements:\\n/// - x must be less than or equal to `MAX_WHOLE_SD59x18`.\\n///\\n/// @param x The SD59x18 number to ceil.\\n/// @param result The smallest whole number greater than or equal to x, as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ceil(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt > uMAX_WHOLE_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Ceil_Overflow(x);\\n }\\n\\n int256 remainder = xInt % uUNIT;\\n if (remainder == 0) {\\n result = x;\\n } else {\\n unchecked {\\n // Solidity uses C fmod style, which returns a modulus with the same sign as x.\\n int256 resultInt = xInt - remainder;\\n if (xInt > 0) {\\n resultInt += uUNIT;\\n }\\n result = wrap(resultInt);\\n }\\n }\\n}\\n\\n/// @notice Divides two SD59x18 numbers, returning a new SD59x18 number.\\n///\\n/// @dev This is an extension of {Common.mulDiv} for signed numbers, which works by computing the signs and the absolute\\n/// values separately.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv}.\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv}.\\n/// - None of the inputs can be `MIN_SD59x18`.\\n/// - The denominator must not be zero.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The numerator as an SD59x18 number.\\n/// @param y The denominator as an SD59x18 number.\\n/// @param result The quotient as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction div(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n if (xInt == uMIN_SD59x18 || yInt == uMIN_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Div_InputTooSmall();\\n }\\n\\n // Get hold of the absolute values of x and y.\\n uint256 xAbs;\\n uint256 yAbs;\\n unchecked {\\n xAbs = xInt < 0 ? uint256(-xInt) : uint256(xInt);\\n yAbs = yInt < 0 ? uint256(-yInt) : uint256(yInt);\\n }\\n\\n // Compute the absolute value (x*UNIT\\u00f7y). The resulting value must fit in SD59x18.\\n uint256 resultAbs = Common.mulDiv(xAbs, uint256(uUNIT), yAbs);\\n if (resultAbs > uint256(uMAX_SD59x18)) {\\n revert Errors.PRBMath_SD59x18_Div_Overflow(x, y);\\n }\\n\\n // Check if x and y have the same sign using two's complement representation. The left-most bit represents the sign (1 for\\n // negative, 0 for positive or zero).\\n bool sameSign = (xInt ^ yInt) > -1;\\n\\n // If the inputs have the same sign, the result should be positive. Otherwise, it should be negative.\\n unchecked {\\n result = wrap(sameSign ? int256(resultAbs) : -int256(resultAbs));\\n }\\n}\\n\\n/// @notice Calculates the natural exponent of x using the following formula:\\n///\\n/// $$\\n/// e^x = 2^{x * log_2{e}}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {exp2}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {exp2}.\\n/// - x must be less than 133_084258667509499441.\\n///\\n/// @param x The exponent as an SD59x18 number.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n\\n // Any input less than the threshold returns zero.\\n // This check also prevents an overflow for very small numbers.\\n if (xInt < uEXP_MIN_THRESHOLD) {\\n return ZERO;\\n }\\n\\n // This check prevents values greater than 192e18 from being passed to {exp2}.\\n if (xInt > uEXP_MAX_INPUT) {\\n revert Errors.PRBMath_SD59x18_Exp_InputTooBig(x);\\n }\\n\\n unchecked {\\n // Inline the fixed-point multiplication to save gas.\\n int256 doubleUnitProduct = xInt * uLOG2_E;\\n result = exp2(wrap(doubleUnitProduct / uUNIT));\\n }\\n}\\n\\n/// @notice Calculates the binary exponent of x using the binary fraction method using the following formula:\\n///\\n/// $$\\n/// 2^{-x} = \\\\frac{1}{2^x}\\n/// $$\\n///\\n/// @dev See https://ethereum.stackexchange.com/q/79903/24693.\\n///\\n/// Notes:\\n/// - If x is less than -59_794705707972522261, the result is zero.\\n///\\n/// Requirements:\\n/// - x must be less than 192e18.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The exponent as an SD59x18 number.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp2(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < 0) {\\n // The inverse of any number less than the threshold is truncated to zero.\\n if (xInt < uEXP2_MIN_THRESHOLD) {\\n return ZERO;\\n }\\n\\n unchecked {\\n // Inline the fixed-point inversion to save gas.\\n result = wrap(uUNIT_SQUARED / exp2(wrap(-xInt)).unwrap());\\n }\\n } else {\\n // Numbers greater than or equal to 192e18 don't fit in the 192.64-bit format.\\n if (xInt > uEXP2_MAX_INPUT) {\\n revert Errors.PRBMath_SD59x18_Exp2_InputTooBig(x);\\n }\\n\\n unchecked {\\n // Convert x to the 192.64-bit fixed-point format.\\n uint256 x_192x64 = uint256((xInt << 64) / uUNIT);\\n\\n // It is safe to cast the result to int256 due to the checks above.\\n result = wrap(int256(Common.exp2(x_192x64)));\\n }\\n }\\n}\\n\\n/// @notice Yields the greatest whole number less than or equal to x.\\n///\\n/// @dev Optimized for fractional value inputs, because for every whole value there are (1e18 - 1) fractional\\n/// counterparts. See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n///\\n/// Requirements:\\n/// - x must be greater than or equal to `MIN_WHOLE_SD59x18`.\\n///\\n/// @param x The SD59x18 number to floor.\\n/// @param result The greatest whole number less than or equal to x, as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction floor(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < uMIN_WHOLE_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Floor_Underflow(x);\\n }\\n\\n int256 remainder = xInt % uUNIT;\\n if (remainder == 0) {\\n result = x;\\n } else {\\n unchecked {\\n // Solidity uses C fmod style, which returns a modulus with the same sign as x.\\n int256 resultInt = xInt - remainder;\\n if (xInt < 0) {\\n resultInt -= uUNIT;\\n }\\n result = wrap(resultInt);\\n }\\n }\\n}\\n\\n/// @notice Yields the excess beyond the floor of x for positive numbers and the part of the number to the right.\\n/// of the radix point for negative numbers.\\n/// @dev Based on the odd function definition. https://en.wikipedia.org/wiki/Fractional_part\\n/// @param x The SD59x18 number to get the fractional part of.\\n/// @param result The fractional part of x as an SD59x18 number.\\nfunction frac(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() % uUNIT);\\n}\\n\\n/// @notice Calculates the geometric mean of x and y, i.e. $\\\\sqrt{x * y}$.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x * y must fit in SD59x18.\\n/// - x * y must not be negative, since complex numbers are not supported.\\n///\\n/// @param x The first operand as an SD59x18 number.\\n/// @param y The second operand as an SD59x18 number.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction gm(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n if (xInt == 0 || yInt == 0) {\\n return ZERO;\\n }\\n\\n unchecked {\\n // Equivalent to `xy / x != y`. Checking for overflow this way is faster than letting Solidity do it.\\n int256 xyInt = xInt * yInt;\\n if (xyInt / xInt != yInt) {\\n revert Errors.PRBMath_SD59x18_Gm_Overflow(x, y);\\n }\\n\\n // The product must not be negative, since complex numbers are not supported.\\n if (xyInt < 0) {\\n revert Errors.PRBMath_SD59x18_Gm_NegativeProduct(x, y);\\n }\\n\\n // We don't need to multiply the result by `UNIT` here because the x*y product picked up a factor of `UNIT`\\n // during multiplication. See the comments in {Common.sqrt}.\\n uint256 resultUint = Common.sqrt(uint256(xyInt));\\n result = wrap(int256(resultUint));\\n }\\n}\\n\\n/// @notice Calculates the inverse of x.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x must not be zero.\\n///\\n/// @param x The SD59x18 number for which to calculate the inverse.\\n/// @return result The inverse as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction inv(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(uUNIT_SQUARED / x.unwrap());\\n}\\n\\n/// @notice Calculates the natural logarithm of x using the following formula:\\n///\\n/// $$\\n/// ln{x} = log_2{x} / log_2{e}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n/// - The precision isn't sufficiently fine-grained to return exactly `UNIT` when the input is `E`.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The SD59x18 number for which to calculate the natural logarithm.\\n/// @return result The natural logarithm as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ln(SD59x18 x) pure returns (SD59x18 result) {\\n // Inline the fixed-point multiplication to save gas. This is overflow-safe because the maximum value that\\n // {log2} can return is ~195_205294292027477728.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_E);\\n}\\n\\n/// @notice Calculates the common logarithm of x using the following formula:\\n///\\n/// $$\\n/// log_{10}{x} = log_2{x} / log_2{10}\\n/// $$\\n///\\n/// However, if x is an exact power of ten, a hard coded value is returned.\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The SD59x18 number for which to calculate the common logarithm.\\n/// @return result The common logarithm as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log10(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < 0) {\\n revert Errors.PRBMath_SD59x18_Log_InputTooSmall(x);\\n }\\n\\n // Note that the `mul` in this block is the standard multiplication operation, not {SD59x18.mul}.\\n // prettier-ignore\\n assembly (\\\"memory-safe\\\") {\\n switch x\\n case 1 { result := mul(uUNIT, sub(0, 18)) }\\n case 10 { result := mul(uUNIT, sub(1, 18)) }\\n case 100 { result := mul(uUNIT, sub(2, 18)) }\\n case 1000 { result := mul(uUNIT, sub(3, 18)) }\\n case 10000 { result := mul(uUNIT, sub(4, 18)) }\\n case 100000 { result := mul(uUNIT, sub(5, 18)) }\\n case 1000000 { result := mul(uUNIT, sub(6, 18)) }\\n case 10000000 { result := mul(uUNIT, sub(7, 18)) }\\n case 100000000 { result := mul(uUNIT, sub(8, 18)) }\\n case 1000000000 { result := mul(uUNIT, sub(9, 18)) }\\n case 10000000000 { result := mul(uUNIT, sub(10, 18)) }\\n case 100000000000 { result := mul(uUNIT, sub(11, 18)) }\\n case 1000000000000 { result := mul(uUNIT, sub(12, 18)) }\\n case 10000000000000 { result := mul(uUNIT, sub(13, 18)) }\\n case 100000000000000 { result := mul(uUNIT, sub(14, 18)) }\\n case 1000000000000000 { result := mul(uUNIT, sub(15, 18)) }\\n case 10000000000000000 { result := mul(uUNIT, sub(16, 18)) }\\n case 100000000000000000 { result := mul(uUNIT, sub(17, 18)) }\\n case 1000000000000000000 { result := 0 }\\n case 10000000000000000000 { result := uUNIT }\\n case 100000000000000000000 { result := mul(uUNIT, 2) }\\n case 1000000000000000000000 { result := mul(uUNIT, 3) }\\n case 10000000000000000000000 { result := mul(uUNIT, 4) }\\n case 100000000000000000000000 { result := mul(uUNIT, 5) }\\n case 1000000000000000000000000 { result := mul(uUNIT, 6) }\\n case 10000000000000000000000000 { result := mul(uUNIT, 7) }\\n case 100000000000000000000000000 { result := mul(uUNIT, 8) }\\n case 1000000000000000000000000000 { result := mul(uUNIT, 9) }\\n case 10000000000000000000000000000 { result := mul(uUNIT, 10) }\\n case 100000000000000000000000000000 { result := mul(uUNIT, 11) }\\n case 1000000000000000000000000000000 { result := mul(uUNIT, 12) }\\n case 10000000000000000000000000000000 { result := mul(uUNIT, 13) }\\n case 100000000000000000000000000000000 { result := mul(uUNIT, 14) }\\n case 1000000000000000000000000000000000 { result := mul(uUNIT, 15) }\\n case 10000000000000000000000000000000000 { result := mul(uUNIT, 16) }\\n case 100000000000000000000000000000000000 { result := mul(uUNIT, 17) }\\n case 1000000000000000000000000000000000000 { result := mul(uUNIT, 18) }\\n case 10000000000000000000000000000000000000 { result := mul(uUNIT, 19) }\\n case 100000000000000000000000000000000000000 { result := mul(uUNIT, 20) }\\n case 1000000000000000000000000000000000000000 { result := mul(uUNIT, 21) }\\n case 10000000000000000000000000000000000000000 { result := mul(uUNIT, 22) }\\n case 100000000000000000000000000000000000000000 { result := mul(uUNIT, 23) }\\n case 1000000000000000000000000000000000000000000 { result := mul(uUNIT, 24) }\\n case 10000000000000000000000000000000000000000000 { result := mul(uUNIT, 25) }\\n case 100000000000000000000000000000000000000000000 { result := mul(uUNIT, 26) }\\n case 1000000000000000000000000000000000000000000000 { result := mul(uUNIT, 27) }\\n case 10000000000000000000000000000000000000000000000 { result := mul(uUNIT, 28) }\\n case 100000000000000000000000000000000000000000000000 { result := mul(uUNIT, 29) }\\n case 1000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 30) }\\n case 10000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 31) }\\n case 100000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 32) }\\n case 1000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 33) }\\n case 10000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 34) }\\n case 100000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 35) }\\n case 1000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 36) }\\n case 10000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 37) }\\n case 100000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 38) }\\n case 1000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 39) }\\n case 10000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 40) }\\n case 100000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 41) }\\n case 1000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 42) }\\n case 10000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 43) }\\n case 100000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 44) }\\n case 1000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 45) }\\n case 10000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 46) }\\n case 100000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 47) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 48) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 49) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 50) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 51) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 52) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 53) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 54) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 55) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 56) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 57) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 58) }\\n default { result := uMAX_SD59x18 }\\n }\\n\\n if (result.unwrap() == uMAX_SD59x18) {\\n unchecked {\\n // Inline the fixed-point division to save gas.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_10);\\n }\\n }\\n}\\n\\n/// @notice Calculates the binary logarithm of x using the iterative approximation algorithm:\\n///\\n/// $$\\n/// log_2{x} = n + log_2{y}, \\\\text{ where } y = x*2^{-n}, \\\\ y \\\\in [1, 2)\\n/// $$\\n///\\n/// For $0 \\\\leq x \\\\lt 1$, the input is inverted:\\n///\\n/// $$\\n/// log_2{x} = -log_2{\\\\frac{1}{x}}\\n/// $$\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Binary_logarithm#Iterative_approximation.\\n///\\n/// Notes:\\n/// - Due to the lossy precision of the iterative approximation, the results are not perfectly accurate to the last decimal.\\n///\\n/// Requirements:\\n/// - x must be greater than zero.\\n///\\n/// @param x The SD59x18 number for which to calculate the binary logarithm.\\n/// @return result The binary logarithm as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log2(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt <= 0) {\\n revert Errors.PRBMath_SD59x18_Log_InputTooSmall(x);\\n }\\n\\n unchecked {\\n int256 sign;\\n if (xInt >= uUNIT) {\\n sign = 1;\\n } else {\\n sign = -1;\\n // Inline the fixed-point inversion to save gas.\\n xInt = uUNIT_SQUARED / xInt;\\n }\\n\\n // Calculate the integer part of the logarithm.\\n uint256 n = Common.msb(uint256(xInt / uUNIT));\\n\\n // This is the integer part of the logarithm as an SD59x18 number. The operation can't overflow\\n // because n is at most 255, `UNIT` is 1e18, and the sign is either 1 or -1.\\n int256 resultInt = int256(n) * uUNIT;\\n\\n // Calculate $y = x * 2^{-n}$.\\n int256 y = xInt >> n;\\n\\n // If y is the unit number, the fractional part is zero.\\n if (y == uUNIT) {\\n return wrap(resultInt * sign);\\n }\\n\\n // Calculate the fractional part via the iterative approximation.\\n // The `delta >>= 1` part is equivalent to `delta /= 2`, but shifting bits is more gas efficient.\\n int256 DOUBLE_UNIT = 2e18;\\n for (int256 delta = uHALF_UNIT; delta > 0; delta >>= 1) {\\n y = (y * y) / uUNIT;\\n\\n // Is y^2 >= 2e18 and so in the range [2e18, 4e18)?\\n if (y >= DOUBLE_UNIT) {\\n // Add the 2^{-m} factor to the logarithm.\\n resultInt = resultInt + delta;\\n\\n // Halve y, which corresponds to z/2 in the Wikipedia article.\\n y >>= 1;\\n }\\n }\\n resultInt *= sign;\\n result = wrap(resultInt);\\n }\\n}\\n\\n/// @notice Multiplies two SD59x18 numbers together, returning a new SD59x18 number.\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {Common.mulDiv18}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv18}.\\n/// - None of the inputs can be `MIN_SD59x18`.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The multiplicand as an SD59x18 number.\\n/// @param y The multiplier as an SD59x18 number.\\n/// @return result The product as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mul(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n if (xInt == uMIN_SD59x18 || yInt == uMIN_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Mul_InputTooSmall();\\n }\\n\\n // Get hold of the absolute values of x and y.\\n uint256 xAbs;\\n uint256 yAbs;\\n unchecked {\\n xAbs = xInt < 0 ? uint256(-xInt) : uint256(xInt);\\n yAbs = yInt < 0 ? uint256(-yInt) : uint256(yInt);\\n }\\n\\n // Compute the absolute value (x*y\\u00f7UNIT). The resulting value must fit in SD59x18.\\n uint256 resultAbs = Common.mulDiv18(xAbs, yAbs);\\n if (resultAbs > uint256(uMAX_SD59x18)) {\\n revert Errors.PRBMath_SD59x18_Mul_Overflow(x, y);\\n }\\n\\n // Check if x and y have the same sign using two's complement representation. The left-most bit represents the sign (1 for\\n // negative, 0 for positive or zero).\\n bool sameSign = (xInt ^ yInt) > -1;\\n\\n // If the inputs have the same sign, the result should be positive. Otherwise, it should be negative.\\n unchecked {\\n result = wrap(sameSign ? int256(resultAbs) : -int256(resultAbs));\\n }\\n}\\n\\n/// @notice Raises x to the power of y using the following formula:\\n///\\n/// $$\\n/// x^y = 2^{log_2{x} * y}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {exp2}, {log2}, and {mul}.\\n/// - Returns `UNIT` for 0^0.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {exp2}, {log2}, and {mul}.\\n///\\n/// @param x The base as an SD59x18 number.\\n/// @param y Exponent to raise x to, as an SD59x18 number\\n/// @return result x raised to power y, as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction pow(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n\\n // If both x and y are zero, the result is `UNIT`. If just x is zero, the result is always zero.\\n if (xInt == 0) {\\n return yInt == 0 ? UNIT : ZERO;\\n }\\n // If x is `UNIT`, the result is always `UNIT`.\\n else if (xInt == uUNIT) {\\n return UNIT;\\n }\\n\\n // If y is zero, the result is always `UNIT`.\\n if (yInt == 0) {\\n return UNIT;\\n }\\n // If y is `UNIT`, the result is always x.\\n else if (yInt == uUNIT) {\\n return x;\\n }\\n\\n // Calculate the result using the formula.\\n result = exp2(mul(log2(x), y));\\n}\\n\\n/// @notice Raises x (an SD59x18 number) to the power y (an unsigned basic integer) using the well-known\\n/// algorithm \\\"exponentiation by squaring\\\".\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Exponentiation_by_squaring.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv18}.\\n/// - Returns `UNIT` for 0^0.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {abs} and {Common.mulDiv18}.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The base as an SD59x18 number.\\n/// @param y The exponent as a uint256.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction powu(SD59x18 x, uint256 y) pure returns (SD59x18 result) {\\n uint256 xAbs = uint256(abs(x).unwrap());\\n\\n // Calculate the first iteration of the loop in advance.\\n uint256 resultAbs = y & 1 > 0 ? xAbs : uint256(uUNIT);\\n\\n // Equivalent to `for(y /= 2; y > 0; y /= 2)`.\\n uint256 yAux = y;\\n for (yAux >>= 1; yAux > 0; yAux >>= 1) {\\n xAbs = Common.mulDiv18(xAbs, xAbs);\\n\\n // Equivalent to `y % 2 == 1`.\\n if (yAux & 1 > 0) {\\n resultAbs = Common.mulDiv18(resultAbs, xAbs);\\n }\\n }\\n\\n // The result must fit in SD59x18.\\n if (resultAbs > uint256(uMAX_SD59x18)) {\\n revert Errors.PRBMath_SD59x18_Powu_Overflow(x, y);\\n }\\n\\n unchecked {\\n // Is the base negative and the exponent odd? If yes, the result should be negative.\\n int256 resultInt = int256(resultAbs);\\n bool isNegative = x.unwrap() < 0 && y & 1 == 1;\\n if (isNegative) {\\n resultInt = -resultInt;\\n }\\n result = wrap(resultInt);\\n }\\n}\\n\\n/// @notice Calculates the square root of x using the Babylonian method.\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\\n///\\n/// Notes:\\n/// - Only the positive root is returned.\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x cannot be negative, since complex numbers are not supported.\\n/// - x must be less than `MAX_SD59x18 / UNIT`.\\n///\\n/// @param x The SD59x18 number for which to calculate the square root.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction sqrt(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < 0) {\\n revert Errors.PRBMath_SD59x18_Sqrt_NegativeInput(x);\\n }\\n if (xInt > uMAX_SD59x18 / uUNIT) {\\n revert Errors.PRBMath_SD59x18_Sqrt_Overflow(x);\\n }\\n\\n unchecked {\\n // Multiply x by `UNIT` to account for the factor of `UNIT` picked up when multiplying two SD59x18 numbers.\\n // In this case, the two numbers are both the square root.\\n uint256 resultUint = Common.sqrt(uint256(xInt * uUNIT));\\n result = wrap(int256(resultUint));\\n }\\n}\\n\",\"keccak256\":\"0xa074831139fc89ca0e5a36086b30eb50896bb6770cd5823461b1f2769017d2f0\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\nimport \\\"./Helpers.sol\\\" as Helpers;\\nimport \\\"./Math.sol\\\" as Math;\\n\\n/// @notice The signed 59.18-decimal fixed-point number representation, which can have up to 59 digits and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\\n/// type int256.\\ntype SD59x18 is int256;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoInt256,\\n Casting.intoSD1x18,\\n Casting.intoUD2x18,\\n Casting.intoUD60x18,\\n Casting.intoUint256,\\n Casting.intoUint128,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for SD59x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n MATHEMATICAL FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Math.abs,\\n Math.avg,\\n Math.ceil,\\n Math.div,\\n Math.exp,\\n Math.exp2,\\n Math.floor,\\n Math.frac,\\n Math.gm,\\n Math.inv,\\n Math.log10,\\n Math.log2,\\n Math.ln,\\n Math.mul,\\n Math.pow,\\n Math.powu,\\n Math.sqrt\\n} for SD59x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n HELPER FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Helpers.add,\\n Helpers.and,\\n Helpers.eq,\\n Helpers.gt,\\n Helpers.gte,\\n Helpers.isZero,\\n Helpers.lshift,\\n Helpers.lt,\\n Helpers.lte,\\n Helpers.mod,\\n Helpers.neq,\\n Helpers.not,\\n Helpers.or,\\n Helpers.rshift,\\n Helpers.sub,\\n Helpers.uncheckedAdd,\\n Helpers.uncheckedSub,\\n Helpers.uncheckedUnary,\\n Helpers.xor\\n} for SD59x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n OPERATORS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes it possible to use these operators on the SD59x18 type.\\nusing {\\n Helpers.add as +,\\n Helpers.and2 as &,\\n Math.div as /,\\n Helpers.eq as ==,\\n Helpers.gt as >,\\n Helpers.gte as >=,\\n Helpers.lt as <,\\n Helpers.lte as <=,\\n Helpers.mod as %,\\n Math.mul as *,\\n Helpers.neq as !=,\\n Helpers.not as ~,\\n Helpers.or as |,\\n Helpers.sub as -,\\n Helpers.unary as -,\\n Helpers.xor as ^\\n} for SD59x18 global;\\n\",\"keccak256\":\"0xe03112d145dcd5863aff24e5f381debaae29d446acd5666f3d640e3d9af738d7\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as Errors;\\nimport { uMAX_SD1x18 } from \\\"../sd1x18/Constants.sol\\\";\\nimport { SD1x18 } from \\\"../sd1x18/ValueType.sol\\\";\\nimport { SD59x18 } from \\\"../sd59x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"../ud60x18/ValueType.sol\\\";\\nimport { UD2x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts a UD2x18 number into SD1x18.\\n/// - x must be less than or equal to `uMAX_SD1x18`.\\nfunction intoSD1x18(UD2x18 x) pure returns (SD1x18 result) {\\n uint64 xUint = UD2x18.unwrap(x);\\n if (xUint > uint64(uMAX_SD1x18)) {\\n revert Errors.PRBMath_UD2x18_IntoSD1x18_Overflow(x);\\n }\\n result = SD1x18.wrap(int64(xUint));\\n}\\n\\n/// @notice Casts a UD2x18 number into SD59x18.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of SD59x18.\\nfunction intoSD59x18(UD2x18 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(int256(uint256(UD2x18.unwrap(x))));\\n}\\n\\n/// @notice Casts a UD2x18 number into UD60x18.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of UD60x18.\\nfunction intoUD60x18(UD2x18 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(UD2x18.unwrap(x));\\n}\\n\\n/// @notice Casts a UD2x18 number into uint128.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of uint128.\\nfunction intoUint128(UD2x18 x) pure returns (uint128 result) {\\n result = uint128(UD2x18.unwrap(x));\\n}\\n\\n/// @notice Casts a UD2x18 number into uint256.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of uint256.\\nfunction intoUint256(UD2x18 x) pure returns (uint256 result) {\\n result = uint256(UD2x18.unwrap(x));\\n}\\n\\n/// @notice Casts a UD2x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(UD2x18 x) pure returns (uint40 result) {\\n uint64 xUint = UD2x18.unwrap(x);\\n if (xUint > uint64(Common.MAX_UINT40)) {\\n revert Errors.PRBMath_UD2x18_IntoUint40_Overflow(x);\\n }\\n result = uint40(xUint);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction ud2x18(uint64 x) pure returns (UD2x18 result) {\\n result = UD2x18.wrap(x);\\n}\\n\\n/// @notice Unwrap a UD2x18 number into uint64.\\nfunction unwrap(UD2x18 x) pure returns (uint64 result) {\\n result = UD2x18.unwrap(x);\\n}\\n\\n/// @notice Wraps a uint64 number into UD2x18.\\nfunction wrap(uint64 x) pure returns (UD2x18 result) {\\n result = UD2x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x9b1a35d432ef951a415fae8098b3c609a99b630a3d5464b3c8e1efa8893eea07\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD2x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @dev Euler's number as a UD2x18 number.\\nUD2x18 constant E = UD2x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum value a UD2x18 number can have.\\nuint64 constant uMAX_UD2x18 = 18_446744073709551615;\\nUD2x18 constant MAX_UD2x18 = UD2x18.wrap(uMAX_UD2x18);\\n\\n/// @dev PI as a UD2x18 number.\\nUD2x18 constant PI = UD2x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of UD2x18.\\nUD2x18 constant UNIT = UD2x18.wrap(1e18);\\nuint64 constant uUNIT = 1e18;\\n\",\"keccak256\":\"0x29b0e050c865899e1fb9022b460a7829cdee248c44c4299f068ba80695eec3fc\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD2x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when trying to cast a UD2x18 number that doesn't fit in SD1x18.\\nerror PRBMath_UD2x18_IntoSD1x18_Overflow(UD2x18 x);\\n\\n/// @notice Thrown when trying to cast a UD2x18 number that doesn't fit in uint40.\\nerror PRBMath_UD2x18_IntoUint40_Overflow(UD2x18 x);\\n\",\"keccak256\":\"0xdf1e22f0b4c8032bcc8b7f63fe3984e1387f3dc7b2e9ab381822249f75376d33\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\n\\n/// @notice The unsigned 2.18-decimal fixed-point number representation, which can have up to 2 digits and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\\n/// type uint64. This is useful when end users want to use uint64 to save gas, e.g. with tight variable packing in contract\\n/// storage.\\ntype UD2x18 is uint64;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoSD1x18,\\n Casting.intoSD59x18,\\n Casting.intoUD60x18,\\n Casting.intoUint256,\\n Casting.intoUint128,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for UD2x18 global;\\n\",\"keccak256\":\"0x2802edc9869db116a0b5c490cc5f8554742f747183fa30ac5e9c80bb967e61a1\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Errors.sol\\\" as CastingErrors;\\nimport { MAX_UINT128, MAX_UINT40 } from \\\"../Common.sol\\\";\\nimport { uMAX_SD1x18 } from \\\"../sd1x18/Constants.sol\\\";\\nimport { SD1x18 } from \\\"../sd1x18/ValueType.sol\\\";\\nimport { uMAX_SD59x18 } from \\\"../sd59x18/Constants.sol\\\";\\nimport { SD59x18 } from \\\"../sd59x18/ValueType.sol\\\";\\nimport { uMAX_UD2x18 } from \\\"../ud2x18/Constants.sol\\\";\\nimport { UD2x18 } from \\\"../ud2x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts a UD60x18 number into SD1x18.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `uMAX_SD1x18`.\\nfunction intoSD1x18(UD60x18 x) pure returns (SD1x18 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > uint256(int256(uMAX_SD1x18))) {\\n revert CastingErrors.PRBMath_UD60x18_IntoSD1x18_Overflow(x);\\n }\\n result = SD1x18.wrap(int64(uint64(xUint)));\\n}\\n\\n/// @notice Casts a UD60x18 number into UD2x18.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `uMAX_UD2x18`.\\nfunction intoUD2x18(UD60x18 x) pure returns (UD2x18 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > uMAX_UD2x18) {\\n revert CastingErrors.PRBMath_UD60x18_IntoUD2x18_Overflow(x);\\n }\\n result = UD2x18.wrap(uint64(xUint));\\n}\\n\\n/// @notice Casts a UD60x18 number into SD59x18.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `uMAX_SD59x18`.\\nfunction intoSD59x18(UD60x18 x) pure returns (SD59x18 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > uint256(uMAX_SD59x18)) {\\n revert CastingErrors.PRBMath_UD60x18_IntoSD59x18_Overflow(x);\\n }\\n result = SD59x18.wrap(int256(xUint));\\n}\\n\\n/// @notice Casts a UD60x18 number into uint128.\\n/// @dev This is basically an alias for {unwrap}.\\nfunction intoUint256(UD60x18 x) pure returns (uint256 result) {\\n result = UD60x18.unwrap(x);\\n}\\n\\n/// @notice Casts a UD60x18 number into uint128.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UINT128`.\\nfunction intoUint128(UD60x18 x) pure returns (uint128 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > MAX_UINT128) {\\n revert CastingErrors.PRBMath_UD60x18_IntoUint128_Overflow(x);\\n }\\n result = uint128(xUint);\\n}\\n\\n/// @notice Casts a UD60x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(UD60x18 x) pure returns (uint40 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > MAX_UINT40) {\\n revert CastingErrors.PRBMath_UD60x18_IntoUint40_Overflow(x);\\n }\\n result = uint40(xUint);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction ud(uint256 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(x);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction ud60x18(uint256 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(x);\\n}\\n\\n/// @notice Unwraps a UD60x18 number into uint256.\\nfunction unwrap(UD60x18 x) pure returns (uint256 result) {\\n result = UD60x18.unwrap(x);\\n}\\n\\n/// @notice Wraps a uint256 number into the UD60x18 value type.\\nfunction wrap(uint256 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x5bb532da36921cbdac64d1f16de5d366ef1f664502e3b7c07d0ad06917551f85\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n// NOTICE: the \\\"u\\\" prefix stands for \\\"unwrapped\\\".\\n\\n/// @dev Euler's number as a UD60x18 number.\\nUD60x18 constant E = UD60x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum input permitted in {exp}.\\nuint256 constant uEXP_MAX_INPUT = 133_084258667509499440;\\nUD60x18 constant EXP_MAX_INPUT = UD60x18.wrap(uEXP_MAX_INPUT);\\n\\n/// @dev The maximum input permitted in {exp2}.\\nuint256 constant uEXP2_MAX_INPUT = 192e18 - 1;\\nUD60x18 constant EXP2_MAX_INPUT = UD60x18.wrap(uEXP2_MAX_INPUT);\\n\\n/// @dev Half the UNIT number.\\nuint256 constant uHALF_UNIT = 0.5e18;\\nUD60x18 constant HALF_UNIT = UD60x18.wrap(uHALF_UNIT);\\n\\n/// @dev $log_2(10)$ as a UD60x18 number.\\nuint256 constant uLOG2_10 = 3_321928094887362347;\\nUD60x18 constant LOG2_10 = UD60x18.wrap(uLOG2_10);\\n\\n/// @dev $log_2(e)$ as a UD60x18 number.\\nuint256 constant uLOG2_E = 1_442695040888963407;\\nUD60x18 constant LOG2_E = UD60x18.wrap(uLOG2_E);\\n\\n/// @dev The maximum value a UD60x18 number can have.\\nuint256 constant uMAX_UD60x18 = 115792089237316195423570985008687907853269984665640564039457_584007913129639935;\\nUD60x18 constant MAX_UD60x18 = UD60x18.wrap(uMAX_UD60x18);\\n\\n/// @dev The maximum whole value a UD60x18 number can have.\\nuint256 constant uMAX_WHOLE_UD60x18 = 115792089237316195423570985008687907853269984665640564039457_000000000000000000;\\nUD60x18 constant MAX_WHOLE_UD60x18 = UD60x18.wrap(uMAX_WHOLE_UD60x18);\\n\\n/// @dev PI as a UD60x18 number.\\nUD60x18 constant PI = UD60x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of UD60x18.\\nuint256 constant uUNIT = 1e18;\\nUD60x18 constant UNIT = UD60x18.wrap(uUNIT);\\n\\n/// @dev The unit number squared.\\nuint256 constant uUNIT_SQUARED = 1e36;\\nUD60x18 constant UNIT_SQUARED = UD60x18.wrap(uUNIT_SQUARED);\\n\\n/// @dev Zero as a UD60x18 number.\\nUD60x18 constant ZERO = UD60x18.wrap(0);\\n\",\"keccak256\":\"0x2b80d26153d3fdcfb3a9ca772d9309d31ed1275f5b8b54c3ffb54d3652b37d90\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Conversions.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { uMAX_UD60x18, uUNIT } from \\\"./Constants.sol\\\";\\nimport { PRBMath_UD60x18_Convert_Overflow } from \\\"./Errors.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Converts a UD60x18 number to a simple integer by dividing it by `UNIT`.\\n/// @dev The result is rounded toward zero.\\n/// @param x The UD60x18 number to convert.\\n/// @return result The same number in basic integer form.\\nfunction convert(UD60x18 x) pure returns (uint256 result) {\\n result = UD60x18.unwrap(x) / uUNIT;\\n}\\n\\n/// @notice Converts a simple integer to UD60x18 by multiplying it by `UNIT`.\\n///\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UD60x18 / UNIT`.\\n///\\n/// @param x The basic integer to convert.\\n/// @param result The same number converted to UD60x18.\\nfunction convert(uint256 x) pure returns (UD60x18 result) {\\n if (x > uMAX_UD60x18 / uUNIT) {\\n revert PRBMath_UD60x18_Convert_Overflow(x);\\n }\\n unchecked {\\n result = UD60x18.wrap(x * uUNIT);\\n }\\n}\\n\",\"keccak256\":\"0xaf7fc2523413822de3b66ba339fe2884fb3b8c6f6cf38ec90a2c3e3aae71df6b\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when ceiling a number overflows UD60x18.\\nerror PRBMath_UD60x18_Ceil_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when converting a basic integer to the fixed-point format overflows UD60x18.\\nerror PRBMath_UD60x18_Convert_Overflow(uint256 x);\\n\\n/// @notice Thrown when taking the natural exponent of a base greater than 133_084258667509499441.\\nerror PRBMath_UD60x18_Exp_InputTooBig(UD60x18 x);\\n\\n/// @notice Thrown when taking the binary exponent of a base greater than 192e18.\\nerror PRBMath_UD60x18_Exp2_InputTooBig(UD60x18 x);\\n\\n/// @notice Thrown when taking the geometric mean of two numbers and multiplying them overflows UD60x18.\\nerror PRBMath_UD60x18_Gm_Overflow(UD60x18 x, UD60x18 y);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\\nerror PRBMath_UD60x18_IntoSD1x18_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD59x18.\\nerror PRBMath_UD60x18_IntoSD59x18_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\\nerror PRBMath_UD60x18_IntoUD2x18_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\\nerror PRBMath_UD60x18_IntoUint128_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\\nerror PRBMath_UD60x18_IntoUint40_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when taking the logarithm of a number less than 1.\\nerror PRBMath_UD60x18_Log_InputTooSmall(UD60x18 x);\\n\\n/// @notice Thrown when calculating the square root overflows UD60x18.\\nerror PRBMath_UD60x18_Sqrt_Overflow(UD60x18 x);\\n\",\"keccak256\":\"0xa8c60d4066248df22c49c882873efbc017344107edabc48c52209abbc39cb1e3\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Helpers.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { wrap } from \\\"./Casting.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Implements the checked addition operation (+) in the UD60x18 type.\\nfunction add(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() + y.unwrap());\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the UD60x18 type.\\nfunction and(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() & bits);\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the UD60x18 type.\\nfunction and2(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() & y.unwrap());\\n}\\n\\n/// @notice Implements the equal operation (==) in the UD60x18 type.\\nfunction eq(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() == y.unwrap();\\n}\\n\\n/// @notice Implements the greater than operation (>) in the UD60x18 type.\\nfunction gt(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() > y.unwrap();\\n}\\n\\n/// @notice Implements the greater than or equal to operation (>=) in the UD60x18 type.\\nfunction gte(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() >= y.unwrap();\\n}\\n\\n/// @notice Implements a zero comparison check function in the UD60x18 type.\\nfunction isZero(UD60x18 x) pure returns (bool result) {\\n // This wouldn't work if x could be negative.\\n result = x.unwrap() == 0;\\n}\\n\\n/// @notice Implements the left shift operation (<<) in the UD60x18 type.\\nfunction lshift(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() << bits);\\n}\\n\\n/// @notice Implements the lower than operation (<) in the UD60x18 type.\\nfunction lt(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() < y.unwrap();\\n}\\n\\n/// @notice Implements the lower than or equal to operation (<=) in the UD60x18 type.\\nfunction lte(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() <= y.unwrap();\\n}\\n\\n/// @notice Implements the checked modulo operation (%) in the UD60x18 type.\\nfunction mod(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() % y.unwrap());\\n}\\n\\n/// @notice Implements the not equal operation (!=) in the UD60x18 type.\\nfunction neq(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() != y.unwrap();\\n}\\n\\n/// @notice Implements the NOT (~) bitwise operation in the UD60x18 type.\\nfunction not(UD60x18 x) pure returns (UD60x18 result) {\\n result = wrap(~x.unwrap());\\n}\\n\\n/// @notice Implements the OR (|) bitwise operation in the UD60x18 type.\\nfunction or(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() | y.unwrap());\\n}\\n\\n/// @notice Implements the right shift operation (>>) in the UD60x18 type.\\nfunction rshift(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() >> bits);\\n}\\n\\n/// @notice Implements the checked subtraction operation (-) in the UD60x18 type.\\nfunction sub(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() - y.unwrap());\\n}\\n\\n/// @notice Implements the unchecked addition operation (+) in the UD60x18 type.\\nfunction uncheckedAdd(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() + y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the unchecked subtraction operation (-) in the UD60x18 type.\\nfunction uncheckedSub(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() - y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the XOR (^) bitwise operation in the UD60x18 type.\\nfunction xor(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() ^ y.unwrap());\\n}\\n\",\"keccak256\":\"0xf5faff881391d2c060029499a666cc5f0bea90a213150bb476fae8f02a5df268\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as Errors;\\nimport { wrap } from \\\"./Casting.sol\\\";\\nimport {\\n uEXP_MAX_INPUT,\\n uEXP2_MAX_INPUT,\\n uHALF_UNIT,\\n uLOG2_10,\\n uLOG2_E,\\n uMAX_UD60x18,\\n uMAX_WHOLE_UD60x18,\\n UNIT,\\n uUNIT,\\n uUNIT_SQUARED,\\n ZERO\\n} from \\\"./Constants.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n MATHEMATICAL FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @notice Calculates the arithmetic average of x and y using the following formula:\\n///\\n/// $$\\n/// avg(x, y) = (x & y) + ((xUint ^ yUint) / 2)\\n/// $$\\n///\\n/// In English, this is what this formula does:\\n///\\n/// 1. AND x and y.\\n/// 2. Calculate half of XOR x and y.\\n/// 3. Add the two results together.\\n///\\n/// This technique is known as SWAR, which stands for \\\"SIMD within a register\\\". You can read more about it here:\\n/// https://devblogs.microsoft.com/oldnewthing/20220207-00/?p=106223\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// @param x The first operand as a UD60x18 number.\\n/// @param y The second operand as a UD60x18 number.\\n/// @return result The arithmetic average as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction avg(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n uint256 yUint = y.unwrap();\\n unchecked {\\n result = wrap((xUint & yUint) + ((xUint ^ yUint) >> 1));\\n }\\n}\\n\\n/// @notice Yields the smallest whole number greater than or equal to x.\\n///\\n/// @dev This is optimized for fractional value inputs, because for every whole value there are (1e18 - 1) fractional\\n/// counterparts. See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n///\\n/// Requirements:\\n/// - x must be less than or equal to `MAX_WHOLE_UD60x18`.\\n///\\n/// @param x The UD60x18 number to ceil.\\n/// @param result The smallest whole number greater than or equal to x, as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ceil(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n if (xUint > uMAX_WHOLE_UD60x18) {\\n revert Errors.PRBMath_UD60x18_Ceil_Overflow(x);\\n }\\n\\n assembly (\\\"memory-safe\\\") {\\n // Equivalent to `x % UNIT`.\\n let remainder := mod(x, uUNIT)\\n\\n // Equivalent to `UNIT - remainder`.\\n let delta := sub(uUNIT, remainder)\\n\\n // Equivalent to `x + remainder > 0 ? delta : 0`.\\n result := add(x, mul(delta, gt(remainder, 0)))\\n }\\n}\\n\\n/// @notice Divides two UD60x18 numbers, returning a new UD60x18 number.\\n///\\n/// @dev Uses {Common.mulDiv} to enable overflow-safe multiplication and division.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv}.\\n///\\n/// @param x The numerator as a UD60x18 number.\\n/// @param y The denominator as a UD60x18 number.\\n/// @param result The quotient as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction div(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(Common.mulDiv(x.unwrap(), uUNIT, y.unwrap()));\\n}\\n\\n/// @notice Calculates the natural exponent of x using the following formula:\\n///\\n/// $$\\n/// e^x = 2^{x * log_2{e}}\\n/// $$\\n///\\n/// @dev Requirements:\\n/// - x must be less than 133_084258667509499441.\\n///\\n/// @param x The exponent as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n // This check prevents values greater than 192e18 from being passed to {exp2}.\\n if (xUint > uEXP_MAX_INPUT) {\\n revert Errors.PRBMath_UD60x18_Exp_InputTooBig(x);\\n }\\n\\n unchecked {\\n // Inline the fixed-point multiplication to save gas.\\n uint256 doubleUnitProduct = xUint * uLOG2_E;\\n result = exp2(wrap(doubleUnitProduct / uUNIT));\\n }\\n}\\n\\n/// @notice Calculates the binary exponent of x using the binary fraction method.\\n///\\n/// @dev See https://ethereum.stackexchange.com/q/79903/24693\\n///\\n/// Requirements:\\n/// - x must be less than 192e18.\\n/// - The result must fit in UD60x18.\\n///\\n/// @param x The exponent as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp2(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n // Numbers greater than or equal to 192e18 don't fit in the 192.64-bit format.\\n if (xUint > uEXP2_MAX_INPUT) {\\n revert Errors.PRBMath_UD60x18_Exp2_InputTooBig(x);\\n }\\n\\n // Convert x to the 192.64-bit fixed-point format.\\n uint256 x_192x64 = (xUint << 64) / uUNIT;\\n\\n // Pass x to the {Common.exp2} function, which uses the 192.64-bit fixed-point number representation.\\n result = wrap(Common.exp2(x_192x64));\\n}\\n\\n/// @notice Yields the greatest whole number less than or equal to x.\\n/// @dev Optimized for fractional value inputs, because every whole value has (1e18 - 1) fractional counterparts.\\n/// See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n/// @param x The UD60x18 number to floor.\\n/// @param result The greatest whole number less than or equal to x, as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction floor(UD60x18 x) pure returns (UD60x18 result) {\\n assembly (\\\"memory-safe\\\") {\\n // Equivalent to `x % UNIT`.\\n let remainder := mod(x, uUNIT)\\n\\n // Equivalent to `x - remainder > 0 ? remainder : 0)`.\\n result := sub(x, mul(remainder, gt(remainder, 0)))\\n }\\n}\\n\\n/// @notice Yields the excess beyond the floor of x using the odd function definition.\\n/// @dev See https://en.wikipedia.org/wiki/Fractional_part.\\n/// @param x The UD60x18 number to get the fractional part of.\\n/// @param result The fractional part of x as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction frac(UD60x18 x) pure returns (UD60x18 result) {\\n assembly (\\\"memory-safe\\\") {\\n result := mod(x, uUNIT)\\n }\\n}\\n\\n/// @notice Calculates the geometric mean of x and y, i.e. $\\\\sqrt{x * y}$, rounding down.\\n///\\n/// @dev Requirements:\\n/// - x * y must fit in UD60x18.\\n///\\n/// @param x The first operand as a UD60x18 number.\\n/// @param y The second operand as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction gm(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n uint256 yUint = y.unwrap();\\n if (xUint == 0 || yUint == 0) {\\n return ZERO;\\n }\\n\\n unchecked {\\n // Checking for overflow this way is faster than letting Solidity do it.\\n uint256 xyUint = xUint * yUint;\\n if (xyUint / xUint != yUint) {\\n revert Errors.PRBMath_UD60x18_Gm_Overflow(x, y);\\n }\\n\\n // We don't need to multiply the result by `UNIT` here because the x*y product picked up a factor of `UNIT`\\n // during multiplication. See the comments in {Common.sqrt}.\\n result = wrap(Common.sqrt(xyUint));\\n }\\n}\\n\\n/// @notice Calculates the inverse of x.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x must not be zero.\\n///\\n/// @param x The UD60x18 number for which to calculate the inverse.\\n/// @return result The inverse as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction inv(UD60x18 x) pure returns (UD60x18 result) {\\n unchecked {\\n result = wrap(uUNIT_SQUARED / x.unwrap());\\n }\\n}\\n\\n/// @notice Calculates the natural logarithm of x using the following formula:\\n///\\n/// $$\\n/// ln{x} = log_2{x} / log_2{e}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n/// - The precision isn't sufficiently fine-grained to return exactly `UNIT` when the input is `E`.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The UD60x18 number for which to calculate the natural logarithm.\\n/// @return result The natural logarithm as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ln(UD60x18 x) pure returns (UD60x18 result) {\\n unchecked {\\n // Inline the fixed-point multiplication to save gas. This is overflow-safe because the maximum value that\\n // {log2} can return is ~196_205294292027477728.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_E);\\n }\\n}\\n\\n/// @notice Calculates the common logarithm of x using the following formula:\\n///\\n/// $$\\n/// log_{10}{x} = log_2{x} / log_2{10}\\n/// $$\\n///\\n/// However, if x is an exact power of ten, a hard coded value is returned.\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The UD60x18 number for which to calculate the common logarithm.\\n/// @return result The common logarithm as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log10(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n if (xUint < uUNIT) {\\n revert Errors.PRBMath_UD60x18_Log_InputTooSmall(x);\\n }\\n\\n // Note that the `mul` in this assembly block is the standard multiplication operation, not {UD60x18.mul}.\\n // prettier-ignore\\n assembly (\\\"memory-safe\\\") {\\n switch x\\n case 1 { result := mul(uUNIT, sub(0, 18)) }\\n case 10 { result := mul(uUNIT, sub(1, 18)) }\\n case 100 { result := mul(uUNIT, sub(2, 18)) }\\n case 1000 { result := mul(uUNIT, sub(3, 18)) }\\n case 10000 { result := mul(uUNIT, sub(4, 18)) }\\n case 100000 { result := mul(uUNIT, sub(5, 18)) }\\n case 1000000 { result := mul(uUNIT, sub(6, 18)) }\\n case 10000000 { result := mul(uUNIT, sub(7, 18)) }\\n case 100000000 { result := mul(uUNIT, sub(8, 18)) }\\n case 1000000000 { result := mul(uUNIT, sub(9, 18)) }\\n case 10000000000 { result := mul(uUNIT, sub(10, 18)) }\\n case 100000000000 { result := mul(uUNIT, sub(11, 18)) }\\n case 1000000000000 { result := mul(uUNIT, sub(12, 18)) }\\n case 10000000000000 { result := mul(uUNIT, sub(13, 18)) }\\n case 100000000000000 { result := mul(uUNIT, sub(14, 18)) }\\n case 1000000000000000 { result := mul(uUNIT, sub(15, 18)) }\\n case 10000000000000000 { result := mul(uUNIT, sub(16, 18)) }\\n case 100000000000000000 { result := mul(uUNIT, sub(17, 18)) }\\n case 1000000000000000000 { result := 0 }\\n case 10000000000000000000 { result := uUNIT }\\n case 100000000000000000000 { result := mul(uUNIT, 2) }\\n case 1000000000000000000000 { result := mul(uUNIT, 3) }\\n case 10000000000000000000000 { result := mul(uUNIT, 4) }\\n case 100000000000000000000000 { result := mul(uUNIT, 5) }\\n case 1000000000000000000000000 { result := mul(uUNIT, 6) }\\n case 10000000000000000000000000 { result := mul(uUNIT, 7) }\\n case 100000000000000000000000000 { result := mul(uUNIT, 8) }\\n case 1000000000000000000000000000 { result := mul(uUNIT, 9) }\\n case 10000000000000000000000000000 { result := mul(uUNIT, 10) }\\n case 100000000000000000000000000000 { result := mul(uUNIT, 11) }\\n case 1000000000000000000000000000000 { result := mul(uUNIT, 12) }\\n case 10000000000000000000000000000000 { result := mul(uUNIT, 13) }\\n case 100000000000000000000000000000000 { result := mul(uUNIT, 14) }\\n case 1000000000000000000000000000000000 { result := mul(uUNIT, 15) }\\n case 10000000000000000000000000000000000 { result := mul(uUNIT, 16) }\\n case 100000000000000000000000000000000000 { result := mul(uUNIT, 17) }\\n case 1000000000000000000000000000000000000 { result := mul(uUNIT, 18) }\\n case 10000000000000000000000000000000000000 { result := mul(uUNIT, 19) }\\n case 100000000000000000000000000000000000000 { result := mul(uUNIT, 20) }\\n case 1000000000000000000000000000000000000000 { result := mul(uUNIT, 21) }\\n case 10000000000000000000000000000000000000000 { result := mul(uUNIT, 22) }\\n case 100000000000000000000000000000000000000000 { result := mul(uUNIT, 23) }\\n case 1000000000000000000000000000000000000000000 { result := mul(uUNIT, 24) }\\n case 10000000000000000000000000000000000000000000 { result := mul(uUNIT, 25) }\\n case 100000000000000000000000000000000000000000000 { result := mul(uUNIT, 26) }\\n case 1000000000000000000000000000000000000000000000 { result := mul(uUNIT, 27) }\\n case 10000000000000000000000000000000000000000000000 { result := mul(uUNIT, 28) }\\n case 100000000000000000000000000000000000000000000000 { result := mul(uUNIT, 29) }\\n case 1000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 30) }\\n case 10000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 31) }\\n case 100000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 32) }\\n case 1000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 33) }\\n case 10000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 34) }\\n case 100000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 35) }\\n case 1000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 36) }\\n case 10000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 37) }\\n case 100000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 38) }\\n case 1000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 39) }\\n case 10000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 40) }\\n case 100000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 41) }\\n case 1000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 42) }\\n case 10000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 43) }\\n case 100000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 44) }\\n case 1000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 45) }\\n case 10000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 46) }\\n case 100000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 47) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 48) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 49) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 50) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 51) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 52) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 53) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 54) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 55) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 56) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 57) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 58) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 59) }\\n default { result := uMAX_UD60x18 }\\n }\\n\\n if (result.unwrap() == uMAX_UD60x18) {\\n unchecked {\\n // Inline the fixed-point division to save gas.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_10);\\n }\\n }\\n}\\n\\n/// @notice Calculates the binary logarithm of x using the iterative approximation algorithm:\\n///\\n/// $$\\n/// log_2{x} = n + log_2{y}, \\\\text{ where } y = x*2^{-n}, \\\\ y \\\\in [1, 2)\\n/// $$\\n///\\n/// For $0 \\\\leq x \\\\lt 1$, the input is inverted:\\n///\\n/// $$\\n/// log_2{x} = -log_2{\\\\frac{1}{x}}\\n/// $$\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Binary_logarithm#Iterative_approximation\\n///\\n/// Notes:\\n/// - Due to the lossy precision of the iterative approximation, the results are not perfectly accurate to the last decimal.\\n///\\n/// Requirements:\\n/// - x must be greater than zero.\\n///\\n/// @param x The UD60x18 number for which to calculate the binary logarithm.\\n/// @return result The binary logarithm as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log2(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n if (xUint < uUNIT) {\\n revert Errors.PRBMath_UD60x18_Log_InputTooSmall(x);\\n }\\n\\n unchecked {\\n // Calculate the integer part of the logarithm.\\n uint256 n = Common.msb(xUint / uUNIT);\\n\\n // This is the integer part of the logarithm as a UD60x18 number. The operation can't overflow because n\\n // n is at most 255 and UNIT is 1e18.\\n uint256 resultUint = n * uUNIT;\\n\\n // Calculate $y = x * 2^{-n}$.\\n uint256 y = xUint >> n;\\n\\n // If y is the unit number, the fractional part is zero.\\n if (y == uUNIT) {\\n return wrap(resultUint);\\n }\\n\\n // Calculate the fractional part via the iterative approximation.\\n // The `delta >>= 1` part is equivalent to `delta /= 2`, but shifting bits is more gas efficient.\\n uint256 DOUBLE_UNIT = 2e18;\\n for (uint256 delta = uHALF_UNIT; delta > 0; delta >>= 1) {\\n y = (y * y) / uUNIT;\\n\\n // Is y^2 >= 2e18 and so in the range [2e18, 4e18)?\\n if (y >= DOUBLE_UNIT) {\\n // Add the 2^{-m} factor to the logarithm.\\n resultUint += delta;\\n\\n // Halve y, which corresponds to z/2 in the Wikipedia article.\\n y >>= 1;\\n }\\n }\\n result = wrap(resultUint);\\n }\\n}\\n\\n/// @notice Multiplies two UD60x18 numbers together, returning a new UD60x18 number.\\n///\\n/// @dev Uses {Common.mulDiv} to enable overflow-safe multiplication and division.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv}.\\n///\\n/// @dev See the documentation in {Common.mulDiv18}.\\n/// @param x The multiplicand as a UD60x18 number.\\n/// @param y The multiplier as a UD60x18 number.\\n/// @return result The product as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mul(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(Common.mulDiv18(x.unwrap(), y.unwrap()));\\n}\\n\\n/// @notice Raises x to the power of y.\\n///\\n/// For $1 \\\\leq x \\\\leq \\\\infty$, the following standard formula is used:\\n///\\n/// $$\\n/// x^y = 2^{log_2{x} * y}\\n/// $$\\n///\\n/// For $0 \\\\leq x \\\\lt 1$, since the unsigned {log2} is undefined, an equivalent formula is used:\\n///\\n/// $$\\n/// i = \\\\frac{1}{x}\\n/// w = 2^{log_2{i} * y}\\n/// x^y = \\\\frac{1}{w}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2} and {mul}.\\n/// - Returns `UNIT` for 0^0.\\n/// - It may not perform well with very small values of x. Consider using SD59x18 as an alternative.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {exp2}, {log2}, and {mul}.\\n///\\n/// @param x The base as a UD60x18 number.\\n/// @param y The exponent as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction pow(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n uint256 yUint = y.unwrap();\\n\\n // If both x and y are zero, the result is `UNIT`. If just x is zero, the result is always zero.\\n if (xUint == 0) {\\n return yUint == 0 ? UNIT : ZERO;\\n }\\n // If x is `UNIT`, the result is always `UNIT`.\\n else if (xUint == uUNIT) {\\n return UNIT;\\n }\\n\\n // If y is zero, the result is always `UNIT`.\\n if (yUint == 0) {\\n return UNIT;\\n }\\n // If y is `UNIT`, the result is always x.\\n else if (yUint == uUNIT) {\\n return x;\\n }\\n\\n // If x is greater than `UNIT`, use the standard formula.\\n if (xUint > uUNIT) {\\n result = exp2(mul(log2(x), y));\\n }\\n // Conversely, if x is less than `UNIT`, use the equivalent formula.\\n else {\\n UD60x18 i = wrap(uUNIT_SQUARED / xUint);\\n UD60x18 w = exp2(mul(log2(i), y));\\n result = wrap(uUNIT_SQUARED / w.unwrap());\\n }\\n}\\n\\n/// @notice Raises x (a UD60x18 number) to the power y (an unsigned basic integer) using the well-known\\n/// algorithm \\\"exponentiation by squaring\\\".\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Exponentiation_by_squaring.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv18}.\\n/// - Returns `UNIT` for 0^0.\\n///\\n/// Requirements:\\n/// - The result must fit in UD60x18.\\n///\\n/// @param x The base as a UD60x18 number.\\n/// @param y The exponent as a uint256.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction powu(UD60x18 x, uint256 y) pure returns (UD60x18 result) {\\n // Calculate the first iteration of the loop in advance.\\n uint256 xUint = x.unwrap();\\n uint256 resultUint = y & 1 > 0 ? xUint : uUNIT;\\n\\n // Equivalent to `for(y /= 2; y > 0; y /= 2)`.\\n for (y >>= 1; y > 0; y >>= 1) {\\n xUint = Common.mulDiv18(xUint, xUint);\\n\\n // Equivalent to `y % 2 == 1`.\\n if (y & 1 > 0) {\\n resultUint = Common.mulDiv18(resultUint, xUint);\\n }\\n }\\n result = wrap(resultUint);\\n}\\n\\n/// @notice Calculates the square root of x using the Babylonian method.\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\\n///\\n/// Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x must be less than `MAX_UD60x18 / UNIT`.\\n///\\n/// @param x The UD60x18 number for which to calculate the square root.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction sqrt(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n unchecked {\\n if (xUint > uMAX_UD60x18 / uUNIT) {\\n revert Errors.PRBMath_UD60x18_Sqrt_Overflow(x);\\n }\\n // Multiply x by `UNIT` to account for the factor of `UNIT` picked up when multiplying two UD60x18 numbers.\\n // In this case, the two numbers are both the square root.\\n result = wrap(Common.sqrt(xUint * uUNIT));\\n }\\n}\\n\",\"keccak256\":\"0x462144667aac3f96d5f8dba7aa68fe4c5a3f61e1d7bbbc81bee21168817f9c09\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\nimport \\\"./Helpers.sol\\\" as Helpers;\\nimport \\\"./Math.sol\\\" as Math;\\n\\n/// @notice The unsigned 60.18-decimal fixed-point number representation, which can have up to 60 digits and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the Solidity type uint256.\\n/// @dev The value type is defined here so it can be imported in all other files.\\ntype UD60x18 is uint256;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoSD1x18,\\n Casting.intoUD2x18,\\n Casting.intoSD59x18,\\n Casting.intoUint128,\\n Casting.intoUint256,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for UD60x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n MATHEMATICAL FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes the functions in this library callable on the UD60x18 type.\\nusing {\\n Math.avg,\\n Math.ceil,\\n Math.div,\\n Math.exp,\\n Math.exp2,\\n Math.floor,\\n Math.frac,\\n Math.gm,\\n Math.inv,\\n Math.ln,\\n Math.log10,\\n Math.log2,\\n Math.mul,\\n Math.pow,\\n Math.powu,\\n Math.sqrt\\n} for UD60x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n HELPER FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes the functions in this library callable on the UD60x18 type.\\nusing {\\n Helpers.add,\\n Helpers.and,\\n Helpers.eq,\\n Helpers.gt,\\n Helpers.gte,\\n Helpers.isZero,\\n Helpers.lshift,\\n Helpers.lt,\\n Helpers.lte,\\n Helpers.mod,\\n Helpers.neq,\\n Helpers.not,\\n Helpers.or,\\n Helpers.rshift,\\n Helpers.sub,\\n Helpers.uncheckedAdd,\\n Helpers.uncheckedSub,\\n Helpers.xor\\n} for UD60x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n OPERATORS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes it possible to use these operators on the UD60x18 type.\\nusing {\\n Helpers.add as +,\\n Helpers.and2 as &,\\n Math.div as /,\\n Helpers.eq as ==,\\n Helpers.gt as >,\\n Helpers.gte as >=,\\n Helpers.lt as <,\\n Helpers.lte as <=,\\n Helpers.or as |,\\n Helpers.mod as %,\\n Math.mul as *,\\n Helpers.neq as !=,\\n Helpers.not as ~,\\n Helpers.sub as -,\\n Helpers.xor as ^\\n} for UD60x18 global;\\n\",\"keccak256\":\"0xdd873b5124180d9b71498b3a7fe93b1c08c368bec741f7d5f8e17f78a0b70f31\",\"license\":\"MIT\"},\"contracts/interfaces/IERC6551Registry.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\ninterface IERC6551Registry {\\n /**\\n * @dev Creates a token bound account for a non-fungible token.\\n *\\n * If account has already been created, returns the account address without calling create2.\\n *\\n * Emits ERC6551AccountCreated event.\\n *\\n * @return account The address of the token bound account\\n */\\n function createAccount(\\n address implementation,\\n bytes32 salt,\\n uint256 chainId,\\n address tokenContract,\\n uint256 tokenId\\n ) external returns (address account);\\n}\\n\",\"keccak256\":\"0x64c52de8a8e68398e61dd8b42dda8e9af8cf6abf93bb85629c322440991ea568\",\"license\":\"MIT\"},\"contracts/interfaces/hats/HatsErrors.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface HatsErrors {\\n /// @notice Emitted when `user` is attempting to perform an action on `hatId` but is not wearing one of `hatId`'s admin hats\\n /// @dev Can be equivalent to `NotHatWearer(buildHatId(hatId))`, such as when emitted by `approveLinkTopHatToTree` or `relinkTopHatToTree`\\n error NotAdmin(address user, uint256 hatId);\\n\\n /// @notice Emitted when attempting to perform an action as or for an account that is not a wearer of a given hat\\n error NotHatWearer();\\n\\n /// @notice Emitted when attempting to perform an action that requires being either an admin or wearer of a given hat\\n error NotAdminOrWearer();\\n\\n /// @notice Emitted when attempting to mint `hatId` but `hatId`'s maxSupply has been reached\\n error AllHatsWorn(uint256 hatId);\\n\\n /// @notice Emitted when attempting to create a hat with a level 14 hat as its admin\\n error MaxLevelsReached();\\n\\n /// @notice Emitted when an attempted hat id has empty intermediate level(s)\\n error InvalidHatId();\\n\\n /// @notice Emitted when attempting to mint `hatId` to a `wearer` who is already wearing the hat\\n error AlreadyWearingHat(address wearer, uint256 hatId);\\n\\n /// @notice Emitted when attempting to mint a non-existant hat\\n error HatDoesNotExist(uint256 hatId);\\n\\n /// @notice Emmitted when attempting to mint or transfer a hat that is not active\\n error HatNotActive();\\n\\n /// @notice Emitted when attempting to mint or transfer a hat to an ineligible wearer\\n error NotEligible();\\n\\n /// @notice Emitted when attempting to check or set a hat's status from an account that is not that hat's toggle module\\n error NotHatsToggle();\\n\\n /// @notice Emitted when attempting to check or set a hat wearer's status from an account that is not that hat's eligibility module\\n error NotHatsEligibility();\\n\\n /// @notice Emitted when array arguments to a batch function have mismatching lengths\\n error BatchArrayLengthMismatch();\\n\\n /// @notice Emitted when attempting to mutate or transfer an immutable hat\\n error Immutable();\\n\\n /// @notice Emitted when attempting to change a hat's maxSupply to a value lower than its current supply\\n error NewMaxSupplyTooLow();\\n\\n /// @notice Emitted when attempting to link a tophat to a new admin for which the tophat serves as an admin\\n error CircularLinkage();\\n\\n /// @notice Emitted when attempting to link or relink a tophat to a separate tree\\n error CrossTreeLinkage();\\n\\n /// @notice Emitted when attempting to link a tophat without a request\\n error LinkageNotRequested();\\n\\n /// @notice Emitted when attempting to unlink a tophat that does not have a wearer\\n /// @dev This ensures that unlinking never results in a bricked tophat\\n error InvalidUnlink();\\n\\n /// @notice Emmited when attempting to change a hat's eligibility or toggle module to the zero address\\n error ZeroAddress();\\n\\n /// @notice Emmitted when attempting to change a hat's details or imageURI to a string with over 7000 bytes (~characters)\\n /// @dev This protects against a DOS attack where an admin iteratively extend's a hat's details or imageURI\\n /// to be so long that reading it exceeds the block gas limit, breaking `uri()` and `viewHat()`\\n error StringTooLong();\\n}\\n\",\"keccak256\":\"0x81b0056b7bed86eabc07c0e4a9655c586ddb8e6c128320593669b76efd5a08de\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/HatsEvents.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface HatsEvents {\\n /// @notice Emitted when a new hat is created\\n /// @param id The id for the new hat\\n /// @param details A description of the Hat\\n /// @param maxSupply The total instances of the Hat that can be worn at once\\n /// @param eligibility The address that can report on the Hat wearer's status\\n /// @param toggle The address that can deactivate the Hat\\n /// @param mutable_ Whether the hat's properties are changeable after creation\\n /// @param imageURI The image uri for this hat and the fallback for its\\n event HatCreated(\\n uint256 id,\\n string details,\\n uint32 maxSupply,\\n address eligibility,\\n address toggle,\\n bool mutable_,\\n string imageURI\\n );\\n\\n /// @notice Emitted when a hat wearer's standing is updated\\n /// @dev Eligibility is excluded since the source of truth for eligibility is the eligibility module and may change without a transaction\\n /// @param hatId The id of the wearer's hat\\n /// @param wearer The wearer's address\\n /// @param wearerStanding Whether the wearer is in good standing for the hat\\n event WearerStandingChanged(\\n uint256 hatId,\\n address wearer,\\n bool wearerStanding\\n );\\n\\n /// @notice Emitted when a hat's status is updated\\n /// @param hatId The id of the hat\\n /// @param newStatus Whether the hat is active\\n event HatStatusChanged(uint256 hatId, bool newStatus);\\n\\n /// @notice Emitted when a hat's details are updated\\n /// @param hatId The id of the hat\\n /// @param newDetails The updated details\\n event HatDetailsChanged(uint256 hatId, string newDetails);\\n\\n /// @notice Emitted when a hat's eligibility module is updated\\n /// @param hatId The id of the hat\\n /// @param newEligibility The updated eligibiliy module\\n event HatEligibilityChanged(uint256 hatId, address newEligibility);\\n\\n /// @notice Emitted when a hat's toggle module is updated\\n /// @param hatId The id of the hat\\n /// @param newToggle The updated toggle module\\n event HatToggleChanged(uint256 hatId, address newToggle);\\n\\n /// @notice Emitted when a hat's mutability is updated\\n /// @param hatId The id of the hat\\n event HatMutabilityChanged(uint256 hatId);\\n\\n /// @notice Emitted when a hat's maximum supply is updated\\n /// @param hatId The id of the hat\\n /// @param newMaxSupply The updated max supply\\n event HatMaxSupplyChanged(uint256 hatId, uint32 newMaxSupply);\\n\\n /// @notice Emitted when a hat's image URI is updated\\n /// @param hatId The id of the hat\\n /// @param newImageURI The updated image URI\\n event HatImageURIChanged(uint256 hatId, string newImageURI);\\n\\n /// @notice Emitted when a tophat linkage is requested by its admin\\n /// @param domain The domain of the tree tophat to link\\n /// @param newAdmin The tophat's would-be admin in the parent tree\\n event TopHatLinkRequested(uint32 domain, uint256 newAdmin);\\n\\n /// @notice Emitted when a tophat is linked to a another tree\\n /// @param domain The domain of the newly-linked tophat\\n /// @param newAdmin The tophat's new admin in the parent tree\\n event TopHatLinked(uint32 domain, uint256 newAdmin);\\n}\\n\",\"keccak256\":\"0x53413397d15e1636c3cd7bd667656b79bc2886785403b824bcd4ed122667f2c6\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/IHats.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\nimport \\\"./IHatsIdUtilities.sol\\\";\\nimport \\\"./HatsErrors.sol\\\";\\nimport \\\"./HatsEvents.sol\\\";\\n\\ninterface IHats is IHatsIdUtilities, HatsErrors, HatsEvents {\\n function mintTopHat(\\n address _target,\\n string memory _details,\\n string memory _imageURI\\n ) external returns (uint256 topHatId);\\n\\n function createHat(\\n uint256 _admin,\\n string calldata _details,\\n uint32 _maxSupply,\\n address _eligibility,\\n address _toggle,\\n bool _mutable,\\n string calldata _imageURI\\n ) external returns (uint256 newHatId);\\n\\n function batchCreateHats(\\n uint256[] calldata _admins,\\n string[] calldata _details,\\n uint32[] calldata _maxSupplies,\\n address[] memory _eligibilityModules,\\n address[] memory _toggleModules,\\n bool[] calldata _mutables,\\n string[] calldata _imageURIs\\n ) external returns (bool success);\\n\\n function getNextId(uint256 _admin) external view returns (uint256 nextId);\\n\\n function mintHat(\\n uint256 _hatId,\\n address _wearer\\n ) external returns (bool success);\\n\\n function batchMintHats(\\n uint256[] calldata _hatIds,\\n address[] calldata _wearers\\n ) external returns (bool success);\\n\\n function setHatStatus(\\n uint256 _hatId,\\n bool _newStatus\\n ) external returns (bool toggled);\\n\\n function checkHatStatus(uint256 _hatId) external returns (bool toggled);\\n\\n function setHatWearerStatus(\\n uint256 _hatId,\\n address _wearer,\\n bool _eligible,\\n bool _standing\\n ) external returns (bool updated);\\n\\n function checkHatWearerStatus(\\n uint256 _hatId,\\n address _wearer\\n ) external returns (bool updated);\\n\\n function renounceHat(uint256 _hatId) external;\\n\\n function transferHat(uint256 _hatId, address _from, address _to) external;\\n\\n /*//////////////////////////////////////////////////////////////\\n HATS ADMIN FUNCTIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n function makeHatImmutable(uint256 _hatId) external;\\n\\n function changeHatDetails(\\n uint256 _hatId,\\n string memory _newDetails\\n ) external;\\n\\n function changeHatEligibility(\\n uint256 _hatId,\\n address _newEligibility\\n ) external;\\n\\n function changeHatToggle(uint256 _hatId, address _newToggle) external;\\n\\n function changeHatImageURI(\\n uint256 _hatId,\\n string memory _newImageURI\\n ) external;\\n\\n function changeHatMaxSupply(uint256 _hatId, uint32 _newMaxSupply) external;\\n\\n function requestLinkTopHatToTree(\\n uint32 _topHatId,\\n uint256 _newAdminHat\\n ) external;\\n\\n function approveLinkTopHatToTree(\\n uint32 _topHatId,\\n uint256 _newAdminHat,\\n address _eligibility,\\n address _toggle,\\n string calldata _details,\\n string calldata _imageURI\\n ) external;\\n\\n function unlinkTopHatFromTree(uint32 _topHatId, address _wearer) external;\\n\\n function relinkTopHatWithinTree(\\n uint32 _topHatDomain,\\n uint256 _newAdminHat,\\n address _eligibility,\\n address _toggle,\\n string calldata _details,\\n string calldata _imageURI\\n ) external;\\n\\n /*//////////////////////////////////////////////////////////////\\n VIEW FUNCTIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n function viewHat(\\n uint256 _hatId\\n )\\n external\\n view\\n returns (\\n string memory details,\\n uint32 maxSupply,\\n uint32 supply,\\n address eligibility,\\n address toggle,\\n string memory imageURI,\\n uint16 lastHatId,\\n bool mutable_,\\n bool active\\n );\\n\\n function isWearerOfHat(\\n address _user,\\n uint256 _hatId\\n ) external view returns (bool isWearer);\\n\\n function isAdminOfHat(\\n address _user,\\n uint256 _hatId\\n ) external view returns (bool isAdmin);\\n\\n function isInGoodStanding(\\n address _wearer,\\n uint256 _hatId\\n ) external view returns (bool standing);\\n\\n function isEligible(\\n address _wearer,\\n uint256 _hatId\\n ) external view returns (bool eligible);\\n\\n function getHatEligibilityModule(\\n uint256 _hatId\\n ) external view returns (address eligibility);\\n\\n function getHatToggleModule(\\n uint256 _hatId\\n ) external view returns (address toggle);\\n\\n function getHatMaxSupply(\\n uint256 _hatId\\n ) external view returns (uint32 maxSupply);\\n\\n function hatSupply(uint256 _hatId) external view returns (uint32 supply);\\n\\n function getImageURIForHat(\\n uint256 _hatId\\n ) external view returns (string memory _uri);\\n\\n function balanceOf(\\n address wearer,\\n uint256 hatId\\n ) external view returns (uint256 balance);\\n\\n function balanceOfBatch(\\n address[] calldata _wearers,\\n uint256[] calldata _hatIds\\n ) external view returns (uint256[] memory);\\n\\n function uri(uint256 id) external view returns (string memory _uri);\\n}\\n\",\"keccak256\":\"0x2867004bddc5148fa1937f25c0403e5d9977583aaf50fdbdb74bd463f64f21c8\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/IHatsIdUtilities.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface IHatsIdUtilities {\\n function buildHatId(\\n uint256 _admin,\\n uint16 _newHat\\n ) external pure returns (uint256 id);\\n\\n function getHatLevel(uint256 _hatId) external view returns (uint32 level);\\n\\n function getLocalHatLevel(\\n uint256 _hatId\\n ) external pure returns (uint32 level);\\n\\n function isTopHat(uint256 _hatId) external view returns (bool _topHat);\\n\\n function isLocalTopHat(\\n uint256 _hatId\\n ) external pure returns (bool _localTopHat);\\n\\n function isValidHatId(\\n uint256 _hatId\\n ) external view returns (bool validHatId);\\n\\n function getAdminAtLevel(\\n uint256 _hatId,\\n uint32 _level\\n ) external view returns (uint256 admin);\\n\\n function getAdminAtLocalLevel(\\n uint256 _hatId,\\n uint32 _level\\n ) external pure returns (uint256 admin);\\n\\n function getTopHatDomain(\\n uint256 _hatId\\n ) external view returns (uint32 domain);\\n\\n function getTippyTopHatDomain(\\n uint32 _topHatDomain\\n ) external view returns (uint32 domain);\\n\\n function noCircularLinkage(\\n uint32 _topHatDomain,\\n uint256 _linkedAdmin\\n ) external view returns (bool notCircular);\\n\\n function sameTippyTopHatDomain(\\n uint32 _topHatDomain,\\n uint256 _newAdminHat\\n ) external view returns (bool sameDomain);\\n}\\n\",\"keccak256\":\"0x007fcc07b20bf84bacad1f9a2ddf4e30e1a8be961e144b7bef8e98a51781aee9\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/IHatsModuleFactory.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.19;\\n\\ninterface IHatsModuleFactory {\\n error HatsModuleFactory_ModuleAlreadyDeployed(\\n address implementation,\\n uint256 hatId,\\n bytes otherImmutableArgs,\\n uint256 saltNonce\\n );\\n\\n error BatchArrayLengthMismatch();\\n\\n event HatsModuleFactory_ModuleDeployed(\\n address implementation,\\n address instance,\\n uint256 hatId,\\n bytes otherImmutableArgs,\\n bytes initData,\\n uint256 saltNonce\\n );\\n\\n function HATS() external view returns (address);\\n\\n function version() external view returns (string memory);\\n\\n function createHatsModule(\\n address _implementation,\\n uint256 _hatId,\\n bytes calldata _otherImmutableArgs,\\n bytes calldata _initData,\\n uint256 _saltNonce\\n ) external returns (address _instance);\\n\\n function batchCreateHatsModule(\\n address[] calldata _implementations,\\n uint256[] calldata _hatIds,\\n bytes[] calldata _otherImmutableArgsArray,\\n bytes[] calldata _initDataArray,\\n uint256[] calldata _saltNonces\\n ) external returns (bool success);\\n\\n function getHatsModuleAddress(\\n address _implementation,\\n uint256 _hatId,\\n bytes calldata _otherImmutableArgs,\\n uint256 _saltNonce\\n ) external view returns (address);\\n\\n function deployed(\\n address _implementation,\\n uint256 _hatId,\\n bytes calldata _otherImmutableArgs,\\n uint256 _saltNonce\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x861faf40785cedb829243116d492653414a367853408a5c27d201522f6c3bfdd\",\"license\":\"MIT\"},\"contracts/interfaces/sablier/IAdminable.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\n/// @title IAdminable\\n/// @notice Contract module that provides a basic access control mechanism, with an admin that can be\\n/// granted exclusive access to specific functions. The inheriting contract must set the initial admin\\n/// in the constructor.\\ninterface IAdminable {\\n /*//////////////////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Emitted when the admin is transferred.\\n /// @param oldAdmin The address of the old admin.\\n /// @param newAdmin The address of the new admin.\\n event TransferAdmin(address indexed oldAdmin, address indexed newAdmin);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice The address of the admin account or contract.\\n function admin() external view returns (address);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n NON-CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Transfers the contract admin to a new address.\\n ///\\n /// @dev Notes:\\n /// - Does not revert if the admin is the same.\\n /// - This function can potentially leave the contract without an admin, thereby removing any\\n /// functionality that is only available to the admin.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the contract admin.\\n ///\\n /// @param newAdmin The address of the new admin.\\n function transferAdmin(address newAdmin) external;\\n}\\n\",\"keccak256\":\"0xa279c49e51228b571329164e36250e82b2c1378e8b549194ab7dd90fca9c3b2b\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/IERC4096.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 \\\"@openzeppelin/contracts/interfaces/IERC165.sol\\\";\\nimport {IERC721} from \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\n\\n/// @title ERC-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\",\"keccak256\":\"0xa34b9c52cbe36be860244f52256f1b05badf0cb797d208664b87337610d0e82d\",\"license\":\"MIT\"},\"contracts/interfaces/sablier/ISablierV2Lockup.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC4906} from \\\"./IERC4096.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IERC721Metadata} from \\\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\\\";\\nimport {UD60x18} from \\\"@prb/math/src/UD60x18.sol\\\";\\n\\nimport {Lockup} from \\\"./types/DataTypes.sol\\\";\\nimport {IAdminable} from \\\"./IAdminable.sol\\\";\\nimport {ISablierV2NFTDescriptor} from \\\"./ISablierV2NFTDescriptor.sol\\\";\\n\\n/// @title ISablierV2Lockup\\n/// @notice Common logic between all Sablier V2 Lockup contracts.\\ninterface ISablierV2Lockup is\\n IAdminable, // 0 inherited components\\n IERC4906, // 2 inherited components\\n IERC721Metadata // 2 inherited components\\n{\\n /*//////////////////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Emitted when the admin allows a new recipient contract to hook to Sablier.\\n /// @param admin The address of the current contract admin.\\n /// @param recipient The address of the recipient contract put on the allowlist.\\n event AllowToHook(address indexed admin, address recipient);\\n\\n /// @notice Emitted when a stream is canceled.\\n /// @param streamId The ID of the stream.\\n /// @param sender The address of the stream's sender.\\n /// @param recipient The address of the stream's recipient.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param senderAmount The amount of assets refunded to the stream's sender, denoted in units of the asset's\\n /// decimals.\\n /// @param recipientAmount The amount of assets left for the stream's recipient to withdraw, denoted in units of the\\n /// asset's decimals.\\n event CancelLockupStream(\\n uint256 streamId,\\n address indexed sender,\\n address indexed recipient,\\n IERC20 indexed asset,\\n uint128 senderAmount,\\n uint128 recipientAmount\\n );\\n\\n /// @notice Emitted when a sender gives up the right to cancel a stream.\\n /// @param streamId The ID of the stream.\\n event RenounceLockupStream(uint256 indexed streamId);\\n\\n /// @notice Emitted when the admin sets a new NFT descriptor contract.\\n /// @param admin The address of the current contract admin.\\n /// @param oldNFTDescriptor The address of the old NFT descriptor contract.\\n /// @param newNFTDescriptor The address of the new NFT descriptor contract.\\n event SetNFTDescriptor(\\n address indexed admin,\\n ISablierV2NFTDescriptor oldNFTDescriptor,\\n ISablierV2NFTDescriptor newNFTDescriptor\\n );\\n\\n /// @notice Emitted when assets are withdrawn from a stream.\\n /// @param streamId The ID of the stream.\\n /// @param to The address that has received the withdrawn assets.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param amount The amount of assets withdrawn, denoted in units of the asset's decimals.\\n event WithdrawFromLockupStream(\\n uint256 indexed streamId,\\n address indexed to,\\n IERC20 indexed asset,\\n uint128 amount\\n );\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Retrieves the address of the ERC-20 asset to be distributed.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getAsset(uint256 streamId) external view returns (IERC20 asset);\\n\\n /// @notice Retrieves the amount deposited in the stream, denoted in units of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getDepositedAmount(\\n uint256 streamId\\n ) external view returns (uint128 depositedAmount);\\n\\n /// @notice Retrieves the stream's end time, which is a Unix timestamp.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getEndTime(\\n uint256 streamId\\n ) external view returns (uint40 endTime);\\n\\n /// @notice Retrieves the stream's recipient.\\n /// @dev Reverts if the NFT has been burned.\\n /// @param streamId The stream ID for the query.\\n function getRecipient(\\n uint256 streamId\\n ) external view returns (address recipient);\\n\\n /// @notice Retrieves the amount refunded to the sender after a cancellation, denoted in units of the asset's\\n /// decimals. This amount is always zero unless the stream was canceled.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getRefundedAmount(\\n uint256 streamId\\n ) external view returns (uint128 refundedAmount);\\n\\n /// @notice Retrieves the stream's sender.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getSender(uint256 streamId) external view returns (address sender);\\n\\n /// @notice Retrieves the stream's start time, which is a Unix timestamp.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getStartTime(\\n uint256 streamId\\n ) external view returns (uint40 startTime);\\n\\n /// @notice Retrieves the amount withdrawn from the stream, denoted in units of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getWithdrawnAmount(\\n uint256 streamId\\n ) external view returns (uint128 withdrawnAmount);\\n\\n /// @notice Retrieves a flag indicating whether the provided address is a contract allowed to hook to Sablier\\n /// when a stream is canceled or when assets are withdrawn.\\n /// @dev See {ISablierLockupRecipient} for more information.\\n function isAllowedToHook(\\n address recipient\\n ) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream can be canceled. When the stream is cold, this\\n /// flag is always `false`.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isCancelable(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream is cold, i.e. settled, canceled, or depleted.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isCold(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream is depleted.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isDepleted(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream exists.\\n /// @dev Does not revert if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isStream(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream NFT can be transferred.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isTransferable(\\n uint256 streamId\\n ) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream is warm, i.e. either pending or streaming.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isWarm(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves the maximum broker fee that can be charged by the broker, denoted as a fixed-point\\n /// number where 1e18 is 100%.\\n /// @dev This value is hard coded as a constant.\\n function MAX_BROKER_FEE() external view returns (UD60x18);\\n\\n /// @notice Counter for stream IDs, used in the create functions.\\n function nextStreamId() external view returns (uint256);\\n\\n /// @notice Contract that generates the non-fungible token URI.\\n function nftDescriptor() external view returns (ISablierV2NFTDescriptor);\\n\\n /// @notice Calculates the amount that the sender would be refunded if the stream were canceled, denoted in units\\n /// of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function refundableAmountOf(\\n uint256 streamId\\n ) external view returns (uint128 refundableAmount);\\n\\n /// @notice Retrieves the stream's status.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function statusOf(\\n uint256 streamId\\n ) external view returns (Lockup.Status status);\\n\\n /// @notice Calculates the amount streamed to the recipient, denoted in units of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n ///\\n /// Notes:\\n /// - Upon cancellation of the stream, the amount streamed is calculated as the difference between the deposited\\n /// amount and the refunded amount. Ultimately, when the stream becomes depleted, the streamed amount is equivalent\\n /// to the total amount withdrawn.\\n ///\\n /// @param streamId The stream ID for the query.\\n function streamedAmountOf(\\n uint256 streamId\\n ) external view returns (uint128 streamedAmount);\\n\\n /// @notice Retrieves a flag indicating whether the stream was canceled.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function wasCanceled(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Calculates the amount that the recipient can withdraw from the stream, denoted in units of the asset's\\n /// decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function withdrawableAmountOf(\\n uint256 streamId\\n ) external view returns (uint128 withdrawableAmount);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n NON-CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Allows a recipient contract to hook to Sablier when a stream is canceled or when assets are withdrawn.\\n /// Useful for implementing contracts that hold streams on behalf of users, such as vaults or staking contracts.\\n ///\\n /// @dev Emits an {AllowToHook} event.\\n ///\\n /// Notes:\\n /// - Does not revert if the contract is already on the allowlist.\\n /// - This is an irreversible operation. The contract cannot be removed from the allowlist.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the contract admin.\\n /// - `recipient` must have a non-zero code size.\\n /// - `recipient` must implement {ISablierLockupRecipient}.\\n ///\\n /// @param recipient The address of the contract to allow for hooks.\\n function allowToHook(address recipient) external;\\n\\n /// @notice Burns the NFT associated with the stream.\\n ///\\n /// @dev Emits a {Transfer} event.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `streamId` must reference a depleted stream.\\n /// - The NFT must exist.\\n /// - `msg.sender` must be either the NFT owner or an approved third party.\\n ///\\n /// @param streamId The ID of the stream NFT to burn.\\n function burn(uint256 streamId) external;\\n\\n /// @notice Cancels the stream and refunds any remaining assets to the sender.\\n ///\\n /// @dev Emits a {Transfer}, {CancelLockupStream}, and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - If there any assets left for the recipient to withdraw, the stream is marked as canceled. Otherwise, the\\n /// stream is marked as depleted.\\n /// - This function attempts to invoke a hook on the recipient, if the resolved address is a contract.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - The stream must be warm and cancelable.\\n /// - `msg.sender` must be the stream's sender.\\n ///\\n /// @param streamId The ID of the stream to cancel.\\n function cancel(uint256 streamId) external;\\n\\n /// @notice Cancels multiple streams and refunds any remaining assets to the sender.\\n ///\\n /// @dev Emits multiple {Transfer}, {CancelLockupStream}, and {MetadataUpdate} events.\\n ///\\n /// Notes:\\n /// - Refer to the notes in {cancel}.\\n ///\\n /// Requirements:\\n /// - All requirements from {cancel} must be met for each stream.\\n ///\\n /// @param streamIds The IDs of the streams to cancel.\\n function cancelMultiple(uint256[] calldata streamIds) external;\\n\\n /// @notice Removes the right of the stream's sender to cancel the stream.\\n ///\\n /// @dev Emits a {RenounceLockupStream} and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - This is an irreversible operation.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `streamId` must reference a warm stream.\\n /// - `msg.sender` must be the stream's sender.\\n /// - The stream must be cancelable.\\n ///\\n /// @param streamId The ID of the stream to renounce.\\n function renounce(uint256 streamId) external;\\n\\n /// @notice Sets a new NFT descriptor contract, which produces the URI describing the Sablier stream NFTs.\\n ///\\n /// @dev Emits a {SetNFTDescriptor} and {BatchMetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - Does not revert if the NFT descriptor is the same.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the contract admin.\\n ///\\n /// @param newNFTDescriptor The address of the new NFT descriptor contract.\\n function setNFTDescriptor(\\n ISablierV2NFTDescriptor newNFTDescriptor\\n ) external;\\n\\n /// @notice Withdraws the provided amount of assets from the stream to the `to` address.\\n ///\\n /// @dev Emits a {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - This function attempts to call a hook on the recipient of the stream, unless `msg.sender` is the recipient.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `streamId` must not reference a null or depleted stream.\\n /// - `to` must not be the zero address.\\n /// - `amount` must be greater than zero and must not exceed the withdrawable amount.\\n /// - `to` must be the recipient if `msg.sender` is not the stream's recipient or an approved third party.\\n ///\\n /// @param streamId The ID of the stream to withdraw from.\\n /// @param to The address receiving the withdrawn assets.\\n /// @param amount The amount to withdraw, denoted in units of the asset's decimals.\\n function withdraw(uint256 streamId, address to, uint128 amount) external;\\n\\n /// @notice Withdraws the maximum withdrawable amount from the stream to the provided address `to`.\\n ///\\n /// @dev Emits a {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - Refer to the notes in {withdraw}.\\n ///\\n /// Requirements:\\n /// - Refer to the requirements in {withdraw}.\\n ///\\n /// @param streamId The ID of the stream to withdraw from.\\n /// @param to The address receiving the withdrawn assets.\\n /// @return withdrawnAmount The amount withdrawn, denoted in units of the asset's decimals.\\n function withdrawMax(\\n uint256 streamId,\\n address to\\n ) external returns (uint128 withdrawnAmount);\\n\\n /// @notice Withdraws the maximum withdrawable amount from the stream to the current recipient, and transfers the\\n /// NFT to `newRecipient`.\\n ///\\n /// @dev Emits a {WithdrawFromLockupStream} and a {Transfer} event.\\n ///\\n /// Notes:\\n /// - If the withdrawable amount is zero, the withdrawal is skipped.\\n /// - Refer to the notes in {withdraw}.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the stream's recipient.\\n /// - Refer to the requirements in {withdraw}.\\n /// - Refer to the requirements in {IERC721.transferFrom}.\\n ///\\n /// @param streamId The ID of the stream NFT to transfer.\\n /// @param newRecipient The address of the new owner of the stream NFT.\\n /// @return withdrawnAmount The amount withdrawn, denoted in units of the asset's decimals.\\n function withdrawMaxAndTransfer(\\n uint256 streamId,\\n address newRecipient\\n ) external returns (uint128 withdrawnAmount);\\n\\n /// @notice Withdraws assets from streams to the recipient of each stream.\\n ///\\n /// @dev Emits multiple {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} events.\\n ///\\n /// Notes:\\n /// - This function attempts to call a hook on the recipient of each stream, unless `msg.sender` is the recipient.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - There must be an equal number of `streamIds` and `amounts`.\\n /// - Each stream ID in the array must not reference a null or depleted stream.\\n /// - Each amount in the array must be greater than zero and must not exceed the withdrawable amount.\\n ///\\n /// @param streamIds The IDs of the streams to withdraw from.\\n /// @param amounts The amounts to withdraw, denoted in units of the asset's decimals.\\n function withdrawMultiple(\\n uint256[] calldata streamIds,\\n uint128[] calldata amounts\\n ) external;\\n}\\n\",\"keccak256\":\"0x3e5541c38a901637bd310965deb5bbde73ef07fe4ee3c752cbec330c6b9d62a3\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/ISablierV2LockupLinear.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\nimport {Lockup, LockupLinear} from \\\"./types/DataTypes.sol\\\";\\nimport {ISablierV2Lockup} from \\\"./ISablierV2Lockup.sol\\\";\\n\\n/// @title ISablierV2LockupLinear\\n/// @notice Creates and manages Lockup streams with a linear distribution function.\\ninterface ISablierV2LockupLinear is ISablierV2Lockup {\\n /*//////////////////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Emitted when a stream is created.\\n /// @param streamId The ID of the newly created stream.\\n /// @param funder The address which funded the stream.\\n /// @param sender The address distributing the assets, which will have the ability to cancel the stream.\\n /// @param recipient The address receiving the assets.\\n /// @param amounts Struct encapsulating (i) the deposit amount, and (ii) the broker fee amount, both denoted\\n /// in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Boolean indicating whether the stream will be cancelable or not.\\n /// @param transferable Boolean indicating whether the stream NFT is transferable or not.\\n /// @param timestamps Struct encapsulating (i) the stream's start time, (ii) cliff time, and (iii) end time, all as\\n /// Unix timestamps.\\n /// @param broker The address of the broker who has helped create the stream, e.g. a front-end website.\\n event CreateLockupLinearStream(\\n uint256 streamId,\\n address funder,\\n address indexed sender,\\n address indexed recipient,\\n Lockup.CreateAmounts amounts,\\n IERC20 indexed asset,\\n bool cancelable,\\n bool transferable,\\n LockupLinear.Timestamps timestamps,\\n address broker\\n );\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Retrieves the stream's cliff time, which is a Unix timestamp. A value of zero means there\\n /// is no cliff.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getCliffTime(\\n uint256 streamId\\n ) external view returns (uint40 cliffTime);\\n\\n /// @notice Retrieves the full stream details.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n /// @return stream See the documentation in {DataTypes}.\\n function getStream(\\n uint256 streamId\\n ) external view returns (LockupLinear.StreamLL memory stream);\\n\\n /// @notice Retrieves the stream's start, cliff and end timestamps.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n /// @return timestamps See the documentation in {DataTypes}.\\n function getTimestamps(\\n uint256 streamId\\n ) external view returns (LockupLinear.Timestamps memory timestamps);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n NON-CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Creates a stream by setting the start time to `block.timestamp`, and the end time to\\n /// the sum of `block.timestamp` and `params.durations.total`. The stream is funded by `msg.sender` and is wrapped\\n /// in an ERC-721 NFT.\\n ///\\n /// @dev Emits a {Transfer} and {CreateLockupLinearStream} event.\\n ///\\n /// Requirements:\\n /// - All requirements in {createWithTimestamps} must be met for the calculated parameters.\\n ///\\n /// @param params Struct encapsulating the function parameters, which are documented in {DataTypes}.\\n /// @return streamId The ID of the newly created stream.\\n function createWithDurations(\\n LockupLinear.CreateWithDurations calldata params\\n ) external returns (uint256 streamId);\\n\\n /// @notice Creates a stream with the provided start time and end time. The stream is funded by `msg.sender` and is\\n /// wrapped in an ERC-721 NFT.\\n ///\\n /// @dev Emits a {Transfer} and {CreateLockupLinearStream} event.\\n ///\\n /// Notes:\\n /// - A cliff time of zero means there is no cliff.\\n /// - As long as the times are ordered, it is not an error for the start or the cliff time to be in the past.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `params.totalAmount` must be greater than zero.\\n /// - If set, `params.broker.fee` must not be greater than `MAX_BROKER_FEE`.\\n /// - `params.timestamps.start` must be greater than zero and less than `params.timestamps.end`.\\n /// - If set, `params.timestamps.cliff` must be greater than `params.timestamps.start` and less than\\n /// `params.timestamps.end`.\\n /// - `params.timestamps.end` must be in the future.\\n /// - `params.recipient` must not be the zero address.\\n /// - `msg.sender` must have allowed this contract to spend at least `params.totalAmount` assets.\\n ///\\n /// @param params Struct encapsulating the function parameters, which are documented in {DataTypes}.\\n /// @return streamId The ID of the newly created stream.\\n function createWithTimestamps(\\n LockupLinear.CreateWithTimestamps calldata params\\n ) external returns (uint256 streamId);\\n}\\n\",\"keccak256\":\"0x064264723114b1f1cf3953fd79874dfcbb42cf313857aee6d5e6b09a23e0010b\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/ISablierV2NFTDescriptor.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC721Metadata} from \\\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\\\";\\n\\n/// @title ISablierV2NFTDescriptor\\n/// @notice This contract generates the URI describing the Sablier V2 stream NFTs.\\n/// @dev Inspired by Uniswap V3 Positions NFTs.\\ninterface ISablierV2NFTDescriptor {\\n /// @notice Produces the URI describing a particular stream NFT.\\n /// @dev This is a data URI with the JSON contents directly inlined.\\n /// @param sablier The address of the Sablier contract the stream was created in.\\n /// @param streamId The ID of the stream for which to produce a description.\\n /// @return uri The URI of the ERC721-compliant metadata.\\n function tokenURI(\\n IERC721Metadata sablier,\\n uint256 streamId\\n ) external view returns (string memory uri);\\n}\\n\",\"keccak256\":\"0x4ed430e553d14161e93efdaaacd1a502f49b38969c9d714b45d2e682a74fa0bc\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/types/DataTypes.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {UD2x18} from \\\"@prb/math/src/UD2x18.sol\\\";\\nimport {UD60x18} from \\\"@prb/math/src/UD60x18.sol\\\";\\n\\n// DataTypes.sol\\n//\\n// This file defines all structs used in V2 Core, most of which are organized under three namespaces:\\n//\\n// - Lockup\\n// - LockupDynamic\\n// - LockupLinear\\n// - LockupTranched\\n//\\n// You will notice that some structs contain \\\"slot\\\" annotations - they are used to indicate the\\n// storage layout of the struct. It is more gas efficient to group small data types together so\\n// that they fit in a single 32-byte slot.\\n\\n/// @notice Struct encapsulating the broker parameters passed to the create functions. Both can be set to zero.\\n/// @param account The address receiving the broker's fee.\\n/// @param fee The broker's percentage fee from the total amount, denoted as a fixed-point number where 1e18 is 100%.\\nstruct Broker {\\n address account;\\n UD60x18 fee;\\n}\\n\\n/// @notice Namespace for the structs used in both {SablierV2LockupLinear} and {SablierV2LockupDynamic}.\\nlibrary Lockup {\\n /// @notice Struct encapsulating the deposit, withdrawn, and refunded amounts, all denoted in units of the asset's\\n /// decimals.\\n /// @dev Because the deposited and the withdrawn amount are often read together, declaring them in the same slot\\n /// saves gas.\\n /// @param deposited The initial amount deposited in the stream, net of broker fee.\\n /// @param withdrawn The cumulative amount withdrawn from the stream.\\n /// @param refunded The amount refunded to the sender. Unless the stream was canceled, this is always zero.\\n struct Amounts {\\n // slot 0\\n uint128 deposited;\\n uint128 withdrawn;\\n // slot 1\\n uint128 refunded;\\n }\\n\\n /// @notice Struct encapsulating (i) the deposit amount and (ii) the broker fee amount, both denoted in units of the\\n /// asset's decimals.\\n /// @param deposit The amount to deposit in the stream.\\n /// @param brokerFee The broker fee amount.\\n struct CreateAmounts {\\n uint128 deposit;\\n uint128 brokerFee;\\n }\\n\\n /// @notice Enum representing the different statuses of a stream.\\n /// @custom:value0 PENDING Stream created but not started; assets are in a pending state.\\n /// @custom:value1 STREAMING Active stream where assets are currently being streamed.\\n /// @custom:value2 SETTLED All assets have been streamed; recipient is due to withdraw them.\\n /// @custom:value3 CANCELED Canceled stream; remaining assets await recipient's withdrawal.\\n /// @custom:value4 DEPLETED Depleted stream; all assets have been withdrawn and/or refunded.\\n enum Status {\\n PENDING,\\n STREAMING,\\n SETTLED,\\n CANCELED,\\n DEPLETED\\n }\\n\\n /// @notice A common data structure to be stored in all {SablierV2Lockup} models.\\n /// @dev The fields are arranged like this to save gas via tight variable packing.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream.\\n /// @param startTime The Unix timestamp indicating the stream's start.\\n /// @param endTime The Unix timestamp indicating the stream's end.\\n /// @param isCancelable Boolean indicating if the stream is cancelable.\\n /// @param wasCanceled Boolean indicating if the stream was canceled.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param isDepleted Boolean indicating if the stream is depleted.\\n /// @param isStream Boolean indicating if the struct entity exists.\\n /// @param isTransferable Boolean indicating if the stream NFT is transferable.\\n /// @param amounts Struct encapsulating the deposit, withdrawn, and refunded amounts, all denoted in units of the\\n /// asset's decimals.\\n struct Stream {\\n // slot 0\\n address sender;\\n uint40 startTime;\\n uint40 endTime;\\n bool isCancelable;\\n bool wasCanceled;\\n // slot 1\\n IERC20 asset;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n // slot 2 and 3\\n Lockup.Amounts amounts;\\n }\\n}\\n\\n/// @notice Namespace for the structs used in {SablierV2LockupDynamic}.\\nlibrary LockupDynamic {\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupDynamic.createWithDurations} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param segments Segments with durations used to compose the dynamic distribution function. Timestamps are\\n /// calculated by starting from `block.timestamp` and adding each duration to the previous timestamp.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithDurations {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n SegmentWithDuration[] segments;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupDynamic.createWithTimestamps} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param startTime The Unix timestamp indicating the stream's start.\\n /// @param segments Segments used to compose the dynamic distribution function.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithTimestamps {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n uint40 startTime;\\n Segment[] segments;\\n Broker broker;\\n }\\n\\n /// @notice Segment struct used in the Lockup Dynamic stream.\\n /// @param amount The amount of assets to be streamed in the segment, denoted in units of the asset's decimals.\\n /// @param exponent The exponent of the segment, denoted as a fixed-point number.\\n /// @param timestamp The Unix timestamp indicating the segment's end.\\n struct Segment {\\n // slot 0\\n uint128 amount;\\n UD2x18 exponent;\\n uint40 timestamp;\\n }\\n\\n /// @notice Segment struct used at runtime in {SablierV2LockupDynamic.createWithDurations}.\\n /// @param amount The amount of assets to be streamed in the segment, denoted in units of the asset's decimals.\\n /// @param exponent The exponent of the segment, denoted as a fixed-point number.\\n /// @param duration The time difference in seconds between the segment and the previous one.\\n struct SegmentWithDuration {\\n uint128 amount;\\n UD2x18 exponent;\\n uint40 duration;\\n }\\n\\n /// @notice Struct encapsulating the full details of a stream.\\n /// @dev Extends `Lockup.Stream` by including the recipient and the segments.\\n struct StreamLD {\\n address sender;\\n address recipient;\\n uint40 startTime;\\n uint40 endTime;\\n bool isCancelable;\\n bool wasCanceled;\\n IERC20 asset;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n Lockup.Amounts amounts;\\n Segment[] segments;\\n }\\n\\n /// @notice Struct encapsulating the LockupDynamic timestamps.\\n /// @param start The Unix timestamp indicating the stream's start.\\n /// @param end The Unix timestamp indicating the stream's end.\\n struct Timestamps {\\n uint40 start;\\n uint40 end;\\n }\\n}\\n\\n/// @notice Namespace for the structs used in {SablierV2LockupLinear}.\\nlibrary LockupLinear {\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupLinear.createWithDurations} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param durations Struct encapsulating (i) cliff period duration and (ii) total stream duration, both in seconds.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithDurations {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n Durations durations;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupLinear.createWithTimestamps} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param timestamps Struct encapsulating (i) the stream's start time, (ii) cliff time, and (iii) end time, all as\\n /// Unix timestamps.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithTimestamps {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n Timestamps timestamps;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the cliff duration and the total duration.\\n /// @param cliff The cliff duration in seconds.\\n /// @param total The total duration in seconds.\\n struct Durations {\\n uint40 cliff;\\n uint40 total;\\n }\\n\\n /// @notice Struct encapsulating the full details of a stream.\\n /// @dev Extends `Lockup.Stream` by including the recipient and the cliff time.\\n struct StreamLL {\\n address sender;\\n address recipient;\\n uint40 startTime;\\n bool isCancelable;\\n bool wasCanceled;\\n IERC20 asset;\\n uint40 endTime;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n Lockup.Amounts amounts;\\n uint40 cliffTime;\\n }\\n\\n /// @notice Struct encapsulating the LockupLinear timestamps.\\n /// @param start The Unix timestamp for the stream's start.\\n /// @param cliff The Unix timestamp for the cliff period's end. A value of zero means there is no cliff.\\n /// @param end The Unix timestamp for the stream's end.\\n struct Timestamps {\\n uint40 start;\\n uint40 cliff;\\n uint40 end;\\n }\\n}\\n\\n/// @notice Namespace for the structs used in {SablierV2LockupTranched}.\\nlibrary LockupTranched {\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupTranched.createWithDurations} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param tranches Tranches with durations used to compose the tranched distribution function. Timestamps are\\n /// calculated by starting from `block.timestamp` and adding each duration to the previous timestamp.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithDurations {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n TrancheWithDuration[] tranches;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupTranched.createWithTimestamps} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param startTime The Unix timestamp indicating the stream's start.\\n /// @param tranches Tranches used to compose the tranched distribution function.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithTimestamps {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n uint40 startTime;\\n Tranche[] tranches;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the full details of a stream.\\n /// @dev Extends `Lockup.Stream` by including the recipient and the tranches.\\n struct StreamLT {\\n address sender;\\n address recipient;\\n uint40 startTime;\\n uint40 endTime;\\n bool isCancelable;\\n bool wasCanceled;\\n IERC20 asset;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n Lockup.Amounts amounts;\\n Tranche[] tranches;\\n }\\n\\n /// @notice Struct encapsulating the LockupTranched timestamps.\\n /// @param start The Unix timestamp indicating the stream's start.\\n /// @param end The Unix timestamp indicating the stream's end.\\n struct Timestamps {\\n uint40 start;\\n uint40 end;\\n }\\n\\n /// @notice Tranche struct used in the Lockup Tranched stream.\\n /// @param amount The amount of assets to be unlocked in the tranche, denoted in units of the asset's decimals.\\n /// @param timestamp The Unix timestamp indicating the tranche's end.\\n struct Tranche {\\n // slot 0\\n uint128 amount;\\n uint40 timestamp;\\n }\\n\\n /// @notice Tranche struct used at runtime in {SablierV2LockupTranched.createWithDurations}.\\n /// @param amount The amount of assets to be unlocked in the tranche, denoted in units of the asset's decimals.\\n /// @param duration The time difference in seconds between the tranche and the previous one.\\n struct TrancheWithDuration {\\n uint128 amount;\\n uint40 duration;\\n }\\n}\\n\",\"keccak256\":\"0x727722c0ec71a76a947b935c9dfcac8fd846d6c3547dfbc8739c7109f3b95068\",\"license\":\"GPL-3.0-or-later\"},\"contracts/modules/DecentHatsModificationModule.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.28;\\n\\nimport {DecentHatsModuleUtils} from \\\"./DecentHatsModuleUtils.sol\\\";\\n\\ncontract DecentHatsModificationModule is DecentHatsModuleUtils {\\n /**\\n * @notice Creates a new termed or untermed role hat and any streams on it.\\n *\\n * @notice This contract should be enabled a module on the Safe for which the role is to be created, and disabled after.\\n *\\n * @dev Stream funds on untermed Roles are targeted at the hat's smart account. In order to withdraw funds from the stream, the\\n * hat's smart account must be the one call to `withdraw-` on the Sablier contract, setting the recipient arg to its wearer.\\n *\\n * @dev Stream funds on termed Roles are targeted directly at the nominated wearer.\\n * The wearer should directly call `withdraw-` on the Sablier contract.\\n *\\n * @dev Role hat creation, minting, smart account creation and stream creation are handled here in order\\n * to avoid a race condition where not more than one active proposal to create a new role can exist at a time.\\n * See: https://github.com/decentdao/decent-interface/issues/2402\\n *\\n * @param roleHatsParams An array of params for each role hat to be created.\\n */\\n function createRoleHats(\\n CreateRoleHatsParams calldata roleHatsParams\\n ) external {\\n _processRoleHats(roleHatsParams);\\n }\\n}\\n\",\"keccak256\":\"0x45b9470e000a416382deebea44a8c8734a2d6b453e8c7fbba5ea9bc6fdd4917c\",\"license\":\"MIT\"},\"contracts/modules/DecentHatsModuleUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.28;\\n\\nimport {Enum} from \\\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\\\";\\nimport {IAvatar} from \\\"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IERC6551Registry} from \\\"../interfaces/IERC6551Registry.sol\\\";\\nimport {IHats} from \\\"../interfaces/hats/IHats.sol\\\";\\nimport {LockupLinear, Broker} from \\\"../interfaces/sablier/types/DataTypes.sol\\\";\\nimport {IHatsModuleFactory} from \\\"../interfaces/hats/IHatsModuleFactory.sol\\\";\\nimport {ISablierV2LockupLinear} from \\\"../interfaces/sablier/ISablierV2LockupLinear.sol\\\";\\n\\nabstract contract DecentHatsModuleUtils {\\n bytes32 public constant SALT =\\n 0x5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b5072;\\n\\n struct SablierStreamParams {\\n ISablierV2LockupLinear sablier;\\n address sender;\\n address asset;\\n LockupLinear.Timestamps timestamps;\\n Broker broker;\\n uint128 totalAmount;\\n bool cancelable;\\n bool transferable;\\n }\\n\\n struct HatParams {\\n address wearer;\\n string details;\\n string imageURI;\\n SablierStreamParams[] sablierStreamsParams;\\n uint128 termEndDateTs; // If 0, this is an untermed Hat\\n uint32 maxSupply;\\n bool isMutable;\\n }\\n\\n struct CreateRoleHatsParams {\\n IHats hatsProtocol;\\n IERC6551Registry erc6551Registry;\\n address hatsAccountImplementation;\\n uint256 topHatId;\\n address topHatAccount;\\n IHatsModuleFactory hatsModuleFactory;\\n address hatsElectionsEligibilityImplementation;\\n uint256 adminHatId;\\n HatParams[] hats;\\n }\\n\\n function _processRoleHats(\\n CreateRoleHatsParams memory roleHatsParams\\n ) internal {\\n for (uint256 i = 0; i < roleHatsParams.hats.length; ) {\\n HatParams memory hatParams = roleHatsParams.hats[i];\\n\\n // Create eligibility module if needed\\n address eligibilityAddress = _createEligibilityModule(\\n roleHatsParams.hatsProtocol,\\n roleHatsParams.hatsModuleFactory,\\n roleHatsParams.hatsElectionsEligibilityImplementation,\\n roleHatsParams.topHatId,\\n roleHatsParams.topHatAccount,\\n roleHatsParams.adminHatId,\\n hatParams.termEndDateTs\\n );\\n\\n // Create and Mint the Role Hat\\n uint256 hatId = _createAndMintHat(\\n roleHatsParams.hatsProtocol,\\n roleHatsParams.adminHatId,\\n hatParams,\\n eligibilityAddress,\\n roleHatsParams.topHatAccount\\n );\\n\\n // Get the stream recipient (based on termed or not)\\n address streamRecipient = _setupStreamRecipient(\\n roleHatsParams.erc6551Registry,\\n roleHatsParams.hatsAccountImplementation,\\n address(roleHatsParams.hatsProtocol),\\n hatParams.termEndDateTs,\\n hatParams.wearer,\\n hatId\\n );\\n\\n // Create streams\\n _processSablierStreams(\\n hatParams.sablierStreamsParams,\\n streamRecipient\\n );\\n\\n unchecked {\\n ++i;\\n }\\n }\\n }\\n\\n function _createEligibilityModule(\\n IHats hatsProtocol,\\n IHatsModuleFactory hatsModuleFactory,\\n address hatsElectionsEligibilityImplementation,\\n uint256 topHatId,\\n address topHatAccount,\\n uint256 adminHatId,\\n uint128 termEndDateTs\\n ) private returns (address) {\\n // If the Hat is termed, create the eligibility module\\n if (termEndDateTs != 0) {\\n return\\n hatsModuleFactory.createHatsModule(\\n hatsElectionsEligibilityImplementation,\\n hatsProtocol.getNextId(adminHatId),\\n abi.encode(topHatId, uint256(0)), // [BALLOT_BOX_ID, ADMIN_HAT_ID]\\n abi.encode(termEndDateTs),\\n uint256(SALT)\\n );\\n }\\n\\n // Otherwise, return the Top Hat account\\n return topHatAccount;\\n }\\n\\n function _createAndMintHat(\\n IHats hatsProtocol,\\n uint256 adminHatId,\\n HatParams memory hat,\\n address eligibilityAddress,\\n address topHatAccount\\n ) private returns (uint256) {\\n // Grab the next Hat ID (before creating it)\\n uint256 hatId = hatsProtocol.getNextId(adminHatId);\\n\\n // Create the new Hat\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"createHat(uint256,string,uint32,address,address,bool,string)\\\",\\n adminHatId,\\n hat.details,\\n hat.maxSupply,\\n eligibilityAddress,\\n topHatAccount,\\n hat.isMutable,\\n hat.imageURI\\n ),\\n Enum.Operation.Call\\n );\\n\\n // If the Hat is termed, nominate the wearer as the eligible member\\n if (hat.termEndDateTs != 0) {\\n address[] memory nominatedWearers = new address[](1);\\n nominatedWearers[0] = hat.wearer;\\n\\n IAvatar(msg.sender).execTransactionFromModule(\\n eligibilityAddress,\\n 0,\\n abi.encodeWithSignature(\\n \\\"elect(uint128,address[])\\\",\\n hat.termEndDateTs,\\n nominatedWearers\\n ),\\n Enum.Operation.Call\\n );\\n }\\n\\n // Mint the Hat\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"mintHat(uint256,address)\\\",\\n hatId,\\n hat.wearer\\n ),\\n Enum.Operation.Call\\n );\\n return hatId;\\n }\\n\\n // Exists to avoid stack too deep errors\\n function _setupStreamRecipient(\\n IERC6551Registry erc6551Registry,\\n address hatsAccountImplementation,\\n address hatsProtocol,\\n uint128 termEndDateTs,\\n address wearer,\\n uint256 hatId\\n ) private returns (address) {\\n // If the hat is termed, the wearer is the stream recipient\\n if (termEndDateTs != 0) {\\n return wearer;\\n }\\n\\n // Otherwise, the Hat's smart account is the stream recipient\\n return\\n erc6551Registry.createAccount(\\n hatsAccountImplementation,\\n SALT,\\n block.chainid,\\n hatsProtocol,\\n hatId\\n );\\n }\\n\\n function _processSablierStreams(\\n SablierStreamParams[] memory streamParams,\\n address streamRecipient\\n ) private {\\n for (uint256 i = 0; i < streamParams.length; ) {\\n SablierStreamParams memory sablierStreamParams = streamParams[i];\\n\\n // Approve tokens for Sablier\\n IAvatar(msg.sender).execTransactionFromModule(\\n sablierStreamParams.asset,\\n 0,\\n abi.encodeWithSignature(\\n \\\"approve(address,uint256)\\\",\\n sablierStreamParams.sablier,\\n sablierStreamParams.totalAmount\\n ),\\n Enum.Operation.Call\\n );\\n\\n // Proxy the Sablier call through IAvatar\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(sablierStreamParams.sablier),\\n 0,\\n abi.encodeWithSignature(\\n \\\"createWithTimestamps((address,address,uint128,address,bool,bool,(uint40,uint40,uint40),(address,uint256)))\\\",\\n LockupLinear.CreateWithTimestamps({\\n sender: sablierStreamParams.sender,\\n recipient: streamRecipient,\\n totalAmount: sablierStreamParams.totalAmount,\\n asset: IERC20(sablierStreamParams.asset),\\n cancelable: sablierStreamParams.cancelable,\\n transferable: sablierStreamParams.transferable,\\n timestamps: sablierStreamParams.timestamps,\\n broker: sablierStreamParams.broker\\n })\\n ),\\n Enum.Operation.Call\\n );\\n\\n unchecked {\\n ++i;\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x357c5264ecb63f8f15f67ffb7498c7fb55d9efe8d46358790933b4892bd38cde\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x6080604052348015600f57600080fd5b5061123d8061001f6000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80633dac44e81461003b578063ba9a91a514610050575b600080fd5b61004e610049366004610929565b610089565b005b6100777f5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b507281565b60405190815260200160405180910390f35b61009a61009582610e60565b61009d565b50565b60005b8161010001515181101561016057600082610100015182815181106100c7576100c7610f22565b6020026020010151905060006100fe84600001518560a001518660c00151876060015188608001518960e001518860800151610164565b9050600061011b85600001518660e00151858589608001516102dd565b90506000610141866020015187604001518860000151876080015188600001518761060f565b90506101518460600151826106db565b846001019450505050506100a0565b5050565b60006001600160801b038216156102cf57866001600160a01b0316632f7fb7b6878a6001600160a01b0316631183a8c0876040518263ffffffff1660e01b81526004016101b391815260200190565b602060405180830381865afa1580156101d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101f49190610f38565b886000604051602001610211929190918252602082015260400190565b60408051601f198184030181528282526001600160801b0389166020840152910160408051601f19818403018152908290526001600160e01b031960e087901b168252610285949392917f5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b507290600401610f97565b6020604051808303816000875af11580156102a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102c89190610fe3565b90506102d2565b50825b979650505050505050565b60405162460ea360e61b81526004810185905260009081906001600160a01b03881690631183a8c090602401602060405180830381865afa158015610326573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061034a9190610f38565b9050336001600160a01b031663468721a78860008989602001518a60a001518a8a8d60c001518e6040015160405160240161038b9796959493929190611000565b60408051601f198184030181529181526020820180516001600160e01b0316635829492f60e11b1790525160e085901b6001600160e01b03191681526103d993929190600090600401611064565b6020604051808303816000875af11580156103f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061041c91906110ba565b5060808501516001600160801b031615610547576040805160018082528183019092526000916020808301908036833701905050905085600001518160008151811061046a5761046a610f22565b60200260200101906001600160a01b031690816001600160a01b031681525050336001600160a01b031663468721a78660008960800151856040516024016104b39291906110d7565b60408051601f198184030181529181526020820180516001600160e01b0316634a231cef60e01b1790525160e085901b6001600160e01b031916815261050193929190600090600401611064565b6020604051808303816000875af1158015610520573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061054491906110ba565b50505b8451604051602481018390526001600160a01b039091166044820152339063468721a790899060009060640160408051601f198184030181529181526020820180516001600160e01b031663320fbbb760e11b1790525160e085901b6001600160e01b03191681526105c193929190600090600401611064565b6020604051808303816000875af11580156105e0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061060491906110ba565b509695505050505050565b60006001600160801b038416156106275750816106d1565b604051638a54c52f60e01b81526001600160a01b0387811660048301527f5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b50726024830152466044830152868116606483015260848201849052881690638a54c52f9060a4016020604051808303816000875af11580156106aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106ce9190610fe3565b90505b9695505050505050565b60005b82518110156109245760008382815181106106fb576106fb610f22565b60200260200101519050336001600160a01b031663468721a78260400151600084600001518560a001516040516024016107539291906001600160a01b039290921682526001600160801b0316602082015260400190565b60408051601f198184030181529181526020820180516001600160e01b031663095ea7b360e01b1790525160e085901b6001600160e01b03191681526107a193929190600090600401611064565b6020604051808303816000875af11580156107c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107e491906110ba565b50336001600160a01b031663468721a78260000151600060405180610100016040528086602001516001600160a01b03168152602001886001600160a01b031681526020018660a001516001600160801b0316815260200186604001516001600160a01b031681526020018660c00151151581526020018660e00151151581526020018660600151815260200186608001518152506040516024016108899190611138565b60408051601f198184030181529181526020820180516001600160e01b03166353b1572760e01b1790525160e085901b6001600160e01b03191681526108d793929190600090600401611064565b6020604051808303816000875af11580156108f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061091a91906110ba565b50506001016106de565b505050565b60006020828403121561093b57600080fd5b81356001600160401b0381111561095157600080fd5b8201610120818503121561096457600080fd5b9392505050565b634e487b7160e01b600052604160045260246000fd5b60405161010081016001600160401b03811182821017156109a4576109a461096b565b60405290565b60405160e081016001600160401b03811182821017156109a4576109a461096b565b60405161012081016001600160401b03811182821017156109a4576109a461096b565b604051601f8201601f191681016001600160401b0381118282101715610a1757610a1761096b565b604052919050565b6001600160a01b038116811461009a57600080fd5b8035610a3f81610a1f565b919050565b60006001600160401b03821115610a5d57610a5d61096b565b5060051b60200190565b600082601f830112610a7857600080fd5b81356001600160401b03811115610a9157610a9161096b565b610aa4601f8201601f19166020016109ef565b818152846020838601011115610ab957600080fd5b816020850160208301376000918101602001919091529392505050565b803564ffffffffff81168114610a3f57600080fd5b600060608284031215610afd57600080fd5b604051606081016001600160401b0381118282101715610b1f57610b1f61096b565b604052905080610b2e83610ad6565b8152610b3c60208401610ad6565b6020820152610b4d60408401610ad6565b60408201525092915050565b600060408284031215610b6b57600080fd5b604080519081016001600160401b0381118282101715610b8d57610b8d61096b565b6040529050808235610b9e81610a1f565b8152602092830135920191909152919050565b80356001600160801b0381168114610a3f57600080fd5b801515811461009a57600080fd5b8035610a3f81610bc8565b600082601f830112610bf257600080fd5b8135610c05610c0082610a44565b6109ef565b8082825260208201915060206101608402860101925085831115610c2857600080fd5b602085015b83811015610ce6576101608188031215610c4657600080fd5b610c4e610981565b610c5782610a34565b8152610c6560208301610a34565b6020820152610c7660408301610a34565b6040820152610c888860608401610aeb565b6060820152610c9a8860c08401610b59565b6080820152610cac6101008301610bb1565b60a0820152610cbe6101208301610bd6565b60c0820152610cd06101408301610bd6565b60e0820152835260209092019161016001610c2d565b5095945050505050565b803563ffffffff81168114610a3f57600080fd5b600082601f830112610d1557600080fd5b8135610d23610c0082610a44565b8082825260208201915060208360051b860101925085831115610d4557600080fd5b602085015b83811015610ce65780356001600160401b03811115610d6857600080fd5b860160e0818903601f19011215610d7e57600080fd5b610d866109aa565b610d9260208301610a34565b815260408201356001600160401b03811115610dad57600080fd5b610dbc8a602083860101610a67565b60208301525060608201356001600160401b03811115610ddb57600080fd5b610dea8a602083860101610a67565b60408301525060808201356001600160401b03811115610e0957600080fd5b610e188a602083860101610be1565b606083015250610e2a60a08301610bb1565b6080820152610e3b60c08301610cf0565b60a0820152610e4c60e08301610bd6565b60c082015284525060209283019201610d4a565b60006101208236031215610e7357600080fd5b610e7b6109cc565b610e8483610a34565b8152610e9260208401610a34565b6020820152610ea360408401610a34565b604082015260608381013590820152610ebe60808401610a34565b6080820152610ecf60a08401610a34565b60a0820152610ee060c08401610a34565b60c082015260e083810135908201526101008301356001600160401b03811115610f0957600080fd5b610f1536828601610d04565b6101008301525092915050565b634e487b7160e01b600052603260045260246000fd5b600060208284031215610f4a57600080fd5b5051919050565b6000815180845260005b81811015610f7757602081850181015186830182015201610f5b565b506000602082860101526020601f19601f83011685010191505092915050565b60018060a01b038616815284602082015260a060408201526000610fbe60a0830186610f51565b8281036060840152610fd08186610f51565b9150508260808301529695505050505050565b600060208284031215610ff557600080fd5b815161096481610a1f565b87815260e06020820152600061101960e0830189610f51565b63ffffffff881660408401526001600160a01b0387811660608501528616608084015284151560a084015282810360c08401526110568185610f51565b9a9950505050505050505050565b60018060a01b038516815283602082015260806040820152600061108b6080830185610f51565b9050600283106110ab57634e487b7160e01b600052602160045260246000fd5b82606083015295945050505050565b6000602082840312156110cc57600080fd5b815161096481610bc8565b6000604082016001600160801b03851683526040602084015280845180835260608501915060208601925060005b8181101561112c5783516001600160a01b0316835260209384019390920191600101611105565b50909695505050505050565b81516001600160a01b0390811682526020808401518216908301526040808401516001600160801b0316908301526060808401519182169083015261016082019050608083015161118d608084018215159052565b5060a08301516111a160a084018215159052565b5060c08301516111e060c084018264ffffffffff815116825264ffffffffff602082015116602083015264ffffffffff60408201511660408301525050565b5060e0929092015180516001600160a01b031661012083015260200151610140909101529056fea26469706673582212208ecde80de6a92bc6f34289d7626d01b9bebb41eb9991597e67fb6a0be17a938664736f6c634300081c0033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100365760003560e01c80633dac44e81461003b578063ba9a91a514610050575b600080fd5b61004e610049366004610929565b610089565b005b6100777f5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b507281565b60405190815260200160405180910390f35b61009a61009582610e60565b61009d565b50565b60005b8161010001515181101561016057600082610100015182815181106100c7576100c7610f22565b6020026020010151905060006100fe84600001518560a001518660c00151876060015188608001518960e001518860800151610164565b9050600061011b85600001518660e00151858589608001516102dd565b90506000610141866020015187604001518860000151876080015188600001518761060f565b90506101518460600151826106db565b846001019450505050506100a0565b5050565b60006001600160801b038216156102cf57866001600160a01b0316632f7fb7b6878a6001600160a01b0316631183a8c0876040518263ffffffff1660e01b81526004016101b391815260200190565b602060405180830381865afa1580156101d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101f49190610f38565b886000604051602001610211929190918252602082015260400190565b60408051601f198184030181528282526001600160801b0389166020840152910160408051601f19818403018152908290526001600160e01b031960e087901b168252610285949392917f5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b507290600401610f97565b6020604051808303816000875af11580156102a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102c89190610fe3565b90506102d2565b50825b979650505050505050565b60405162460ea360e61b81526004810185905260009081906001600160a01b03881690631183a8c090602401602060405180830381865afa158015610326573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061034a9190610f38565b9050336001600160a01b031663468721a78860008989602001518a60a001518a8a8d60c001518e6040015160405160240161038b9796959493929190611000565b60408051601f198184030181529181526020820180516001600160e01b0316635829492f60e11b1790525160e085901b6001600160e01b03191681526103d993929190600090600401611064565b6020604051808303816000875af11580156103f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061041c91906110ba565b5060808501516001600160801b031615610547576040805160018082528183019092526000916020808301908036833701905050905085600001518160008151811061046a5761046a610f22565b60200260200101906001600160a01b031690816001600160a01b031681525050336001600160a01b031663468721a78660008960800151856040516024016104b39291906110d7565b60408051601f198184030181529181526020820180516001600160e01b0316634a231cef60e01b1790525160e085901b6001600160e01b031916815261050193929190600090600401611064565b6020604051808303816000875af1158015610520573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061054491906110ba565b50505b8451604051602481018390526001600160a01b039091166044820152339063468721a790899060009060640160408051601f198184030181529181526020820180516001600160e01b031663320fbbb760e11b1790525160e085901b6001600160e01b03191681526105c193929190600090600401611064565b6020604051808303816000875af11580156105e0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061060491906110ba565b509695505050505050565b60006001600160801b038416156106275750816106d1565b604051638a54c52f60e01b81526001600160a01b0387811660048301527f5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b50726024830152466044830152868116606483015260848201849052881690638a54c52f9060a4016020604051808303816000875af11580156106aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106ce9190610fe3565b90505b9695505050505050565b60005b82518110156109245760008382815181106106fb576106fb610f22565b60200260200101519050336001600160a01b031663468721a78260400151600084600001518560a001516040516024016107539291906001600160a01b039290921682526001600160801b0316602082015260400190565b60408051601f198184030181529181526020820180516001600160e01b031663095ea7b360e01b1790525160e085901b6001600160e01b03191681526107a193929190600090600401611064565b6020604051808303816000875af11580156107c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107e491906110ba565b50336001600160a01b031663468721a78260000151600060405180610100016040528086602001516001600160a01b03168152602001886001600160a01b031681526020018660a001516001600160801b0316815260200186604001516001600160a01b031681526020018660c00151151581526020018660e00151151581526020018660600151815260200186608001518152506040516024016108899190611138565b60408051601f198184030181529181526020820180516001600160e01b03166353b1572760e01b1790525160e085901b6001600160e01b03191681526108d793929190600090600401611064565b6020604051808303816000875af11580156108f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061091a91906110ba565b50506001016106de565b505050565b60006020828403121561093b57600080fd5b81356001600160401b0381111561095157600080fd5b8201610120818503121561096457600080fd5b9392505050565b634e487b7160e01b600052604160045260246000fd5b60405161010081016001600160401b03811182821017156109a4576109a461096b565b60405290565b60405160e081016001600160401b03811182821017156109a4576109a461096b565b60405161012081016001600160401b03811182821017156109a4576109a461096b565b604051601f8201601f191681016001600160401b0381118282101715610a1757610a1761096b565b604052919050565b6001600160a01b038116811461009a57600080fd5b8035610a3f81610a1f565b919050565b60006001600160401b03821115610a5d57610a5d61096b565b5060051b60200190565b600082601f830112610a7857600080fd5b81356001600160401b03811115610a9157610a9161096b565b610aa4601f8201601f19166020016109ef565b818152846020838601011115610ab957600080fd5b816020850160208301376000918101602001919091529392505050565b803564ffffffffff81168114610a3f57600080fd5b600060608284031215610afd57600080fd5b604051606081016001600160401b0381118282101715610b1f57610b1f61096b565b604052905080610b2e83610ad6565b8152610b3c60208401610ad6565b6020820152610b4d60408401610ad6565b60408201525092915050565b600060408284031215610b6b57600080fd5b604080519081016001600160401b0381118282101715610b8d57610b8d61096b565b6040529050808235610b9e81610a1f565b8152602092830135920191909152919050565b80356001600160801b0381168114610a3f57600080fd5b801515811461009a57600080fd5b8035610a3f81610bc8565b600082601f830112610bf257600080fd5b8135610c05610c0082610a44565b6109ef565b8082825260208201915060206101608402860101925085831115610c2857600080fd5b602085015b83811015610ce6576101608188031215610c4657600080fd5b610c4e610981565b610c5782610a34565b8152610c6560208301610a34565b6020820152610c7660408301610a34565b6040820152610c888860608401610aeb565b6060820152610c9a8860c08401610b59565b6080820152610cac6101008301610bb1565b60a0820152610cbe6101208301610bd6565b60c0820152610cd06101408301610bd6565b60e0820152835260209092019161016001610c2d565b5095945050505050565b803563ffffffff81168114610a3f57600080fd5b600082601f830112610d1557600080fd5b8135610d23610c0082610a44565b8082825260208201915060208360051b860101925085831115610d4557600080fd5b602085015b83811015610ce65780356001600160401b03811115610d6857600080fd5b860160e0818903601f19011215610d7e57600080fd5b610d866109aa565b610d9260208301610a34565b815260408201356001600160401b03811115610dad57600080fd5b610dbc8a602083860101610a67565b60208301525060608201356001600160401b03811115610ddb57600080fd5b610dea8a602083860101610a67565b60408301525060808201356001600160401b03811115610e0957600080fd5b610e188a602083860101610be1565b606083015250610e2a60a08301610bb1565b6080820152610e3b60c08301610cf0565b60a0820152610e4c60e08301610bd6565b60c082015284525060209283019201610d4a565b60006101208236031215610e7357600080fd5b610e7b6109cc565b610e8483610a34565b8152610e9260208401610a34565b6020820152610ea360408401610a34565b604082015260608381013590820152610ebe60808401610a34565b6080820152610ecf60a08401610a34565b60a0820152610ee060c08401610a34565b60c082015260e083810135908201526101008301356001600160401b03811115610f0957600080fd5b610f1536828601610d04565b6101008301525092915050565b634e487b7160e01b600052603260045260246000fd5b600060208284031215610f4a57600080fd5b5051919050565b6000815180845260005b81811015610f7757602081850181015186830182015201610f5b565b506000602082860101526020601f19601f83011685010191505092915050565b60018060a01b038616815284602082015260a060408201526000610fbe60a0830186610f51565b8281036060840152610fd08186610f51565b9150508260808301529695505050505050565b600060208284031215610ff557600080fd5b815161096481610a1f565b87815260e06020820152600061101960e0830189610f51565b63ffffffff881660408401526001600160a01b0387811660608501528616608084015284151560a084015282810360c08401526110568185610f51565b9a9950505050505050505050565b60018060a01b038516815283602082015260806040820152600061108b6080830185610f51565b9050600283106110ab57634e487b7160e01b600052602160045260246000fd5b82606083015295945050505050565b6000602082840312156110cc57600080fd5b815161096481610bc8565b6000604082016001600160801b03851683526040602084015280845180835260608501915060208601925060005b8181101561112c5783516001600160a01b0316835260209384019390920191600101611105565b50909695505050505050565b81516001600160a01b0390811682526020808401518216908301526040808401516001600160801b0316908301526060808401519182169083015261016082019050608083015161118d608084018215159052565b5060a08301516111a160a084018215159052565b5060c08301516111e060c084018264ffffffffff815116825264ffffffffff602082015116602083015264ffffffffff60408201511660408301525050565b5060e0929092015180516001600160a01b031661012083015260200151610140909101529056fea26469706673582212208ecde80de6a92bc6f34289d7626d01b9bebb41eb9991597e67fb6a0be17a938664736f6c634300081c0033", + "numDeployments": 2, + "solcInputHash": "f1fca9a70591742a2aedd10e2fd7e744", + "metadata": "{\"compiler\":{\"version\":\"0.8.28+commit.7893614a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"SALT\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"contract IHats\",\"name\":\"hatsProtocol\",\"type\":\"address\"},{\"internalType\":\"contract IERC6551Registry\",\"name\":\"erc6551Registry\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"hatsAccountImplementation\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"topHatId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"topHatAccount\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"keyValuePairs\",\"type\":\"address\"},{\"internalType\":\"contract IHatsModuleFactory\",\"name\":\"hatsModuleFactory\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"hatsElectionsEligibilityImplementation\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"adminHatId\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"wearer\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"details\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"imageURI\",\"type\":\"string\"},{\"components\":[{\"internalType\":\"contract ISablierV2LockupLinear\",\"name\":\"sablier\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint40\",\"name\":\"start\",\"type\":\"uint40\"},{\"internalType\":\"uint40\",\"name\":\"cliff\",\"type\":\"uint40\"},{\"internalType\":\"uint40\",\"name\":\"end\",\"type\":\"uint40\"}],\"internalType\":\"struct LockupLinear.Timestamps\",\"name\":\"timestamps\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"UD60x18\",\"name\":\"fee\",\"type\":\"uint256\"}],\"internalType\":\"struct Broker\",\"name\":\"broker\",\"type\":\"tuple\"},{\"internalType\":\"uint128\",\"name\":\"totalAmount\",\"type\":\"uint128\"},{\"internalType\":\"bool\",\"name\":\"cancelable\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"transferable\",\"type\":\"bool\"}],\"internalType\":\"struct DecentHatsModuleUtils.SablierStreamParams[]\",\"name\":\"sablierStreamsParams\",\"type\":\"tuple[]\"},{\"internalType\":\"uint128\",\"name\":\"termEndDateTs\",\"type\":\"uint128\"},{\"internalType\":\"uint32\",\"name\":\"maxSupply\",\"type\":\"uint32\"},{\"internalType\":\"bool\",\"name\":\"isMutable\",\"type\":\"bool\"}],\"internalType\":\"struct DecentHatsModuleUtils.HatParams[]\",\"name\":\"hats\",\"type\":\"tuple[]\"}],\"internalType\":\"struct DecentHatsModuleUtils.CreateRoleHatsParams\",\"name\":\"roleHatsParams\",\"type\":\"tuple\"}],\"name\":\"createRoleHats\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"createRoleHats((address,address,address,uint256,address,address,address,address,uint256,(address,string,string,(address,address,address,(uint40,uint40,uint40),(address,uint256),uint128,bool,bool)[],uint128,uint32,bool)[]))\":{\"details\":\"Stream funds on untermed Roles are targeted at the hat's smart account. In order to withdraw funds from the stream, the hat's smart account must be the one call to `withdraw-` on the Sablier contract, setting the recipient arg to its wearer.Stream funds on termed Roles are targeted directly at the nominated wearer. The wearer should directly call `withdraw-` on the Sablier contract.Role hat creation, minting, smart account creation and stream creation are handled here in order to avoid a race condition where not more than one active proposal to create a new role can exist at a time. See: https://github.com/decentdao/decent-interface/issues/2402\",\"params\":{\"roleHatsParams\":\"An array of params for each role hat to be created.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"createRoleHats((address,address,address,uint256,address,address,address,address,uint256,(address,string,string,(address,address,address,(uint40,uint40,uint40),(address,uint256),uint128,bool,bool)[],uint128,uint32,bool)[]))\":{\"notice\":\"Creates a new termed or untermed role hat and any streams on it.This contract should be enabled a module on the Safe for which the role is to be created, and disabled after.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/modules/DecentHatsModificationModule.sol\":\"DecentHatsModificationModule\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\npragma solidity >=0.7.0 <0.9.0;\\n\\n/// @title Enum - Collection of enums\\n/// @author Richard Meissner - \\ncontract Enum {\\n enum Operation {Call, DelegateCall}\\n}\\n\",\"keccak256\":\"0x473e45b1a5cc47be494b0e123c9127f0c11c1e0992a321ae5a644c0bfdb2c14f\",\"license\":\"LGPL-3.0-only\"},\"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\n\\n/// @title Zodiac Avatar - A contract that manages modules that can execute transactions via this contract.\\npragma solidity >=0.7.0 <0.9.0;\\n\\nimport \\\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\\\";\\n\\ninterface IAvatar {\\n event EnabledModule(address module);\\n event DisabledModule(address module);\\n event ExecutionFromModuleSuccess(address indexed module);\\n event ExecutionFromModuleFailure(address indexed module);\\n\\n /// @dev Enables a module on the avatar.\\n /// @notice Can only be called by the avatar.\\n /// @notice Modules should be stored as a linked list.\\n /// @notice Must emit EnabledModule(address module) if successful.\\n /// @param module Module to be enabled.\\n function enableModule(address module) external;\\n\\n /// @dev Disables a module on the avatar.\\n /// @notice Can only be called by the avatar.\\n /// @notice Must emit DisabledModule(address module) if successful.\\n /// @param prevModule Address that pointed to the module to be removed in the linked list\\n /// @param module Module to be removed.\\n function disableModule(address prevModule, address module) external;\\n\\n /// @dev Allows a Module to execute a transaction.\\n /// @notice Can only be called by an enabled module.\\n /// @notice Must emit ExecutionFromModuleSuccess(address module) if successful.\\n /// @notice Must emit ExecutionFromModuleFailure(address module) if unsuccessful.\\n /// @param to Destination address of module transaction.\\n /// @param value Ether value of module transaction.\\n /// @param data Data payload of module transaction.\\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\\n function execTransactionFromModule(\\n address to,\\n uint256 value,\\n bytes memory data,\\n Enum.Operation operation\\n ) external returns (bool success);\\n\\n /// @dev Allows a Module to execute a transaction and return data\\n /// @notice Can only be called by an enabled module.\\n /// @notice Must emit ExecutionFromModuleSuccess(address module) if successful.\\n /// @notice Must emit ExecutionFromModuleFailure(address module) if unsuccessful.\\n /// @param to Destination address of module transaction.\\n /// @param value Ether value of module transaction.\\n /// @param data Data payload of module transaction.\\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\\n function execTransactionFromModuleReturnData(\\n address to,\\n uint256 value,\\n bytes memory data,\\n Enum.Operation operation\\n ) external returns (bool success, bytes memory returnData);\\n\\n /// @dev Returns if an module is enabled\\n /// @return True if the module is enabled\\n function isModuleEnabled(address module) external view returns (bool);\\n\\n /// @dev Returns array of modules.\\n /// @param start Start of the page.\\n /// @param pageSize Maximum number of modules that should be returned.\\n /// @return array Array of modules.\\n /// @return next Start of the next page.\\n function getModulesPaginated(address start, uint256 pageSize)\\n external\\n view\\n returns (address[] memory array, address next);\\n}\\n\",\"keccak256\":\"0xcd5508ffe596eef8fbccfd5fc4f10a34397773547ce64e212d48b5212865ec1f\",\"license\":\"LGPL-3.0-only\"},\"@openzeppelin/contracts/interfaces/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/introspection/IERC165.sol\\\";\\n\",\"keccak256\":\"0xd04b0f06e0666f29cf7cccc82894de541e19bb30a765b107b1e40bb7fe5f7d7a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev 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 amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `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 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes calldata data\\n ) external;\\n\\n /**\\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 {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the caller.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool _approved) external;\\n\\n /**\\n * @dev Returns 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\",\"keccak256\":\"0xed6a749c5373af398105ce6ee3ac4763aa450ea7285d268c85d9eeca809cdb1f\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../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\",\"keccak256\":\"0x75b829ff2f26c14355d1cba20e16fe7b29ca58eb5fef665ede48bc0f9c6c74b9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _HEX_SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\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 // Inspired by OraclizeAPI's implementation - MIT licence\\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\\n\\n if (value == 0) {\\n return \\\"0\\\";\\n }\\n uint256 temp = value;\\n uint256 digits;\\n while (temp != 0) {\\n digits++;\\n temp /= 10;\\n }\\n bytes memory buffer = new bytes(digits);\\n while (value != 0) {\\n digits -= 1;\\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\\n value /= 10;\\n }\\n return string(buffer);\\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 if (value == 0) {\\n return \\\"0x00\\\";\\n }\\n uint256 temp = value;\\n uint256 length = 0;\\n while (temp != 0) {\\n length++;\\n temp >>= 8;\\n }\\n return toHexString(value, length);\\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 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_SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\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 representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n}\\n\",\"keccak256\":\"0xaf159a8b1923ad2a26d516089bceca9bdeaeacd04be50983ea00ba63070f08a3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"@prb/math/src/Common.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\n// Common.sol\\n//\\n// Common mathematical functions used in both SD59x18 and UD60x18. Note that these global functions do not\\n// always operate with SD59x18 and UD60x18 numbers.\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CUSTOM ERRORS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @notice Thrown when the resultant value in {mulDiv} overflows uint256.\\nerror PRBMath_MulDiv_Overflow(uint256 x, uint256 y, uint256 denominator);\\n\\n/// @notice Thrown when the resultant value in {mulDiv18} overflows uint256.\\nerror PRBMath_MulDiv18_Overflow(uint256 x, uint256 y);\\n\\n/// @notice Thrown when one of the inputs passed to {mulDivSigned} is `type(int256).min`.\\nerror PRBMath_MulDivSigned_InputTooSmall();\\n\\n/// @notice Thrown when the resultant value in {mulDivSigned} overflows int256.\\nerror PRBMath_MulDivSigned_Overflow(int256 x, int256 y);\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CONSTANTS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @dev The maximum value a uint128 number can have.\\nuint128 constant MAX_UINT128 = type(uint128).max;\\n\\n/// @dev The maximum value a uint40 number can have.\\nuint40 constant MAX_UINT40 = type(uint40).max;\\n\\n/// @dev The unit number, which the decimal precision of the fixed-point types.\\nuint256 constant UNIT = 1e18;\\n\\n/// @dev The unit number inverted mod 2^256.\\nuint256 constant UNIT_INVERSE = 78156646155174841979727994598816262306175212592076161876661_508869554232690281;\\n\\n/// @dev The the largest power of two that divides the decimal value of `UNIT`. The logarithm of this value is the least significant\\n/// bit in the binary representation of `UNIT`.\\nuint256 constant UNIT_LPOTD = 262144;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @notice Calculates the binary exponent of x using the binary fraction method.\\n/// @dev Has to use 192.64-bit fixed-point numbers. See https://ethereum.stackexchange.com/a/96594/24693.\\n/// @param x The exponent as an unsigned 192.64-bit fixed-point number.\\n/// @return result The result as an unsigned 60.18-decimal fixed-point number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp2(uint256 x) pure returns (uint256 result) {\\n unchecked {\\n // Start from 0.5 in the 192.64-bit fixed-point format.\\n result = 0x800000000000000000000000000000000000000000000000;\\n\\n // The following logic multiplies the result by $\\\\sqrt{2^{-i}}$ when the bit at position i is 1. Key points:\\n //\\n // 1. Intermediate results will not overflow, as the starting point is 2^191 and all magic factors are under 2^65.\\n // 2. The rationale for organizing the if statements into groups of 8 is gas savings. If the result of performing\\n // a bitwise AND operation between x and any value in the array [0x80; 0x40; 0x20; 0x10; 0x08; 0x04; 0x02; 0x01] is 1,\\n // we know that `x & 0xFF` is also 1.\\n if (x & 0xFF00000000000000 > 0) {\\n if (x & 0x8000000000000000 > 0) {\\n result = (result * 0x16A09E667F3BCC909) >> 64;\\n }\\n if (x & 0x4000000000000000 > 0) {\\n result = (result * 0x1306FE0A31B7152DF) >> 64;\\n }\\n if (x & 0x2000000000000000 > 0) {\\n result = (result * 0x1172B83C7D517ADCE) >> 64;\\n }\\n if (x & 0x1000000000000000 > 0) {\\n result = (result * 0x10B5586CF9890F62A) >> 64;\\n }\\n if (x & 0x800000000000000 > 0) {\\n result = (result * 0x1059B0D31585743AE) >> 64;\\n }\\n if (x & 0x400000000000000 > 0) {\\n result = (result * 0x102C9A3E778060EE7) >> 64;\\n }\\n if (x & 0x200000000000000 > 0) {\\n result = (result * 0x10163DA9FB33356D8) >> 64;\\n }\\n if (x & 0x100000000000000 > 0) {\\n result = (result * 0x100B1AFA5ABCBED61) >> 64;\\n }\\n }\\n\\n if (x & 0xFF000000000000 > 0) {\\n if (x & 0x80000000000000 > 0) {\\n result = (result * 0x10058C86DA1C09EA2) >> 64;\\n }\\n if (x & 0x40000000000000 > 0) {\\n result = (result * 0x1002C605E2E8CEC50) >> 64;\\n }\\n if (x & 0x20000000000000 > 0) {\\n result = (result * 0x100162F3904051FA1) >> 64;\\n }\\n if (x & 0x10000000000000 > 0) {\\n result = (result * 0x1000B175EFFDC76BA) >> 64;\\n }\\n if (x & 0x8000000000000 > 0) {\\n result = (result * 0x100058BA01FB9F96D) >> 64;\\n }\\n if (x & 0x4000000000000 > 0) {\\n result = (result * 0x10002C5CC37DA9492) >> 64;\\n }\\n if (x & 0x2000000000000 > 0) {\\n result = (result * 0x1000162E525EE0547) >> 64;\\n }\\n if (x & 0x1000000000000 > 0) {\\n result = (result * 0x10000B17255775C04) >> 64;\\n }\\n }\\n\\n if (x & 0xFF0000000000 > 0) {\\n if (x & 0x800000000000 > 0) {\\n result = (result * 0x1000058B91B5BC9AE) >> 64;\\n }\\n if (x & 0x400000000000 > 0) {\\n result = (result * 0x100002C5C89D5EC6D) >> 64;\\n }\\n if (x & 0x200000000000 > 0) {\\n result = (result * 0x10000162E43F4F831) >> 64;\\n }\\n if (x & 0x100000000000 > 0) {\\n result = (result * 0x100000B1721BCFC9A) >> 64;\\n }\\n if (x & 0x80000000000 > 0) {\\n result = (result * 0x10000058B90CF1E6E) >> 64;\\n }\\n if (x & 0x40000000000 > 0) {\\n result = (result * 0x1000002C5C863B73F) >> 64;\\n }\\n if (x & 0x20000000000 > 0) {\\n result = (result * 0x100000162E430E5A2) >> 64;\\n }\\n if (x & 0x10000000000 > 0) {\\n result = (result * 0x1000000B172183551) >> 64;\\n }\\n }\\n\\n if (x & 0xFF00000000 > 0) {\\n if (x & 0x8000000000 > 0) {\\n result = (result * 0x100000058B90C0B49) >> 64;\\n }\\n if (x & 0x4000000000 > 0) {\\n result = (result * 0x10000002C5C8601CC) >> 64;\\n }\\n if (x & 0x2000000000 > 0) {\\n result = (result * 0x1000000162E42FFF0) >> 64;\\n }\\n if (x & 0x1000000000 > 0) {\\n result = (result * 0x10000000B17217FBB) >> 64;\\n }\\n if (x & 0x800000000 > 0) {\\n result = (result * 0x1000000058B90BFCE) >> 64;\\n }\\n if (x & 0x400000000 > 0) {\\n result = (result * 0x100000002C5C85FE3) >> 64;\\n }\\n if (x & 0x200000000 > 0) {\\n result = (result * 0x10000000162E42FF1) >> 64;\\n }\\n if (x & 0x100000000 > 0) {\\n result = (result * 0x100000000B17217F8) >> 64;\\n }\\n }\\n\\n if (x & 0xFF000000 > 0) {\\n if (x & 0x80000000 > 0) {\\n result = (result * 0x10000000058B90BFC) >> 64;\\n }\\n if (x & 0x40000000 > 0) {\\n result = (result * 0x1000000002C5C85FE) >> 64;\\n }\\n if (x & 0x20000000 > 0) {\\n result = (result * 0x100000000162E42FF) >> 64;\\n }\\n if (x & 0x10000000 > 0) {\\n result = (result * 0x1000000000B17217F) >> 64;\\n }\\n if (x & 0x8000000 > 0) {\\n result = (result * 0x100000000058B90C0) >> 64;\\n }\\n if (x & 0x4000000 > 0) {\\n result = (result * 0x10000000002C5C860) >> 64;\\n }\\n if (x & 0x2000000 > 0) {\\n result = (result * 0x1000000000162E430) >> 64;\\n }\\n if (x & 0x1000000 > 0) {\\n result = (result * 0x10000000000B17218) >> 64;\\n }\\n }\\n\\n if (x & 0xFF0000 > 0) {\\n if (x & 0x800000 > 0) {\\n result = (result * 0x1000000000058B90C) >> 64;\\n }\\n if (x & 0x400000 > 0) {\\n result = (result * 0x100000000002C5C86) >> 64;\\n }\\n if (x & 0x200000 > 0) {\\n result = (result * 0x10000000000162E43) >> 64;\\n }\\n if (x & 0x100000 > 0) {\\n result = (result * 0x100000000000B1721) >> 64;\\n }\\n if (x & 0x80000 > 0) {\\n result = (result * 0x10000000000058B91) >> 64;\\n }\\n if (x & 0x40000 > 0) {\\n result = (result * 0x1000000000002C5C8) >> 64;\\n }\\n if (x & 0x20000 > 0) {\\n result = (result * 0x100000000000162E4) >> 64;\\n }\\n if (x & 0x10000 > 0) {\\n result = (result * 0x1000000000000B172) >> 64;\\n }\\n }\\n\\n if (x & 0xFF00 > 0) {\\n if (x & 0x8000 > 0) {\\n result = (result * 0x100000000000058B9) >> 64;\\n }\\n if (x & 0x4000 > 0) {\\n result = (result * 0x10000000000002C5D) >> 64;\\n }\\n if (x & 0x2000 > 0) {\\n result = (result * 0x1000000000000162E) >> 64;\\n }\\n if (x & 0x1000 > 0) {\\n result = (result * 0x10000000000000B17) >> 64;\\n }\\n if (x & 0x800 > 0) {\\n result = (result * 0x1000000000000058C) >> 64;\\n }\\n if (x & 0x400 > 0) {\\n result = (result * 0x100000000000002C6) >> 64;\\n }\\n if (x & 0x200 > 0) {\\n result = (result * 0x10000000000000163) >> 64;\\n }\\n if (x & 0x100 > 0) {\\n result = (result * 0x100000000000000B1) >> 64;\\n }\\n }\\n\\n if (x & 0xFF > 0) {\\n if (x & 0x80 > 0) {\\n result = (result * 0x10000000000000059) >> 64;\\n }\\n if (x & 0x40 > 0) {\\n result = (result * 0x1000000000000002C) >> 64;\\n }\\n if (x & 0x20 > 0) {\\n result = (result * 0x10000000000000016) >> 64;\\n }\\n if (x & 0x10 > 0) {\\n result = (result * 0x1000000000000000B) >> 64;\\n }\\n if (x & 0x8 > 0) {\\n result = (result * 0x10000000000000006) >> 64;\\n }\\n if (x & 0x4 > 0) {\\n result = (result * 0x10000000000000003) >> 64;\\n }\\n if (x & 0x2 > 0) {\\n result = (result * 0x10000000000000001) >> 64;\\n }\\n if (x & 0x1 > 0) {\\n result = (result * 0x10000000000000001) >> 64;\\n }\\n }\\n\\n // In the code snippet below, two operations are executed simultaneously:\\n //\\n // 1. The result is multiplied by $(2^n + 1)$, where $2^n$ represents the integer part, and the additional 1\\n // accounts for the initial guess of 0.5. This is achieved by subtracting from 191 instead of 192.\\n // 2. The result is then converted to an unsigned 60.18-decimal fixed-point format.\\n //\\n // The underlying logic is based on the relationship $2^{191-ip} = 2^{ip} / 2^{191}$, where $ip$ denotes the,\\n // integer part, $2^n$.\\n result *= UNIT;\\n result >>= (191 - (x >> 64));\\n }\\n}\\n\\n/// @notice Finds the zero-based index of the first 1 in the binary representation of x.\\n///\\n/// @dev See the note on \\\"msb\\\" in this Wikipedia article: https://en.wikipedia.org/wiki/Find_first_set\\n///\\n/// Each step in this implementation is equivalent to this high-level code:\\n///\\n/// ```solidity\\n/// if (x >= 2 ** 128) {\\n/// x >>= 128;\\n/// result += 128;\\n/// }\\n/// ```\\n///\\n/// Where 128 is replaced with each respective power of two factor. See the full high-level implementation here:\\n/// https://gist.github.com/PaulRBerg/f932f8693f2733e30c4d479e8e980948\\n///\\n/// The Yul instructions used below are:\\n///\\n/// - \\\"gt\\\" is \\\"greater than\\\"\\n/// - \\\"or\\\" is the OR bitwise operator\\n/// - \\\"shl\\\" is \\\"shift left\\\"\\n/// - \\\"shr\\\" is \\\"shift right\\\"\\n///\\n/// @param x The uint256 number for which to find the index of the most significant bit.\\n/// @return result The index of the most significant bit as a uint256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction msb(uint256 x) pure returns (uint256 result) {\\n // 2^128\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(7, gt(x, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^64\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(6, gt(x, 0xFFFFFFFFFFFFFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^32\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(5, gt(x, 0xFFFFFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^16\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(4, gt(x, 0xFFFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^8\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(3, gt(x, 0xFF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^4\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(2, gt(x, 0xF))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^2\\n assembly (\\\"memory-safe\\\") {\\n let factor := shl(1, gt(x, 0x3))\\n x := shr(factor, x)\\n result := or(result, factor)\\n }\\n // 2^1\\n // No need to shift x any more.\\n assembly (\\\"memory-safe\\\") {\\n let factor := gt(x, 0x1)\\n result := or(result, factor)\\n }\\n}\\n\\n/// @notice Calculates x*y\\u00f7denominator with 512-bit precision.\\n///\\n/// @dev Credits to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv.\\n///\\n/// Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - The denominator must not be zero.\\n/// - The result must fit in uint256.\\n///\\n/// @param x The multiplicand as a uint256.\\n/// @param y The multiplier as a uint256.\\n/// @param denominator The divisor as a uint256.\\n/// @return result The result as a uint256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mulDiv(uint256 x, uint256 y, uint256 denominator) pure returns (uint256 result) {\\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; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly (\\\"memory-safe\\\") {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\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 unchecked {\\n return prod0 / denominator;\\n }\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n if (prod1 >= denominator) {\\n revert PRBMath_MulDiv_Overflow(x, y, denominator);\\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 (\\\"memory-safe\\\") {\\n // Compute remainder using the mulmod Yul instruction.\\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 unchecked {\\n // Calculate the largest power of two divisor of the denominator using the unary operator ~. This operation cannot overflow\\n // because the denominator cannot be zero at this point in the function execution. The result is always >= 1.\\n // For more detail, see https://cs.stackexchange.com/q/138556/92363.\\n uint256 lpotdod = denominator & (~denominator + 1);\\n uint256 flippedLpotdod;\\n\\n assembly (\\\"memory-safe\\\") {\\n // Factor powers of two out of denominator.\\n denominator := div(denominator, lpotdod)\\n\\n // Divide [prod1 prod0] by lpotdod.\\n prod0 := div(prod0, lpotdod)\\n\\n // Get the flipped value `2^256 / lpotdod`. If the `lpotdod` is zero, the flipped value is one.\\n // `sub(0, lpotdod)` produces the two's complement version of `lpotdod`, which is equivalent to flipping all the bits.\\n // However, `div` interprets this value as an unsigned value: https://ethereum.stackexchange.com/q/147168/24693\\n flippedLpotdod := add(div(sub(0, lpotdod), lpotdod), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * flippedLpotdod;\\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 works\\n // 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 }\\n}\\n\\n/// @notice Calculates x*y\\u00f71e18 with 512-bit precision.\\n///\\n/// @dev A variant of {mulDiv} with constant folding, i.e. in which the denominator is hard coded to 1e18.\\n///\\n/// Notes:\\n/// - The body is purposely left uncommented; to understand how this works, see the documentation in {mulDiv}.\\n/// - The result is rounded toward zero.\\n/// - We take as an axiom that the result cannot be `MAX_UINT256` when x and y solve the following system of equations:\\n///\\n/// $$\\n/// \\\\begin{cases}\\n/// x * y = MAX\\\\_UINT256 * UNIT \\\\\\\\\\n/// (x * y) \\\\% UNIT \\\\geq \\\\frac{UNIT}{2}\\n/// \\\\end{cases}\\n/// $$\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {mulDiv}.\\n/// - The result must fit in uint256.\\n///\\n/// @param x The multiplicand as an unsigned 60.18-decimal fixed-point number.\\n/// @param y The multiplier as an unsigned 60.18-decimal fixed-point number.\\n/// @return result The result as an unsigned 60.18-decimal fixed-point number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mulDiv18(uint256 x, uint256 y) pure returns (uint256 result) {\\n uint256 prod0;\\n uint256 prod1;\\n assembly (\\\"memory-safe\\\") {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n if (prod1 == 0) {\\n unchecked {\\n return prod0 / UNIT;\\n }\\n }\\n\\n if (prod1 >= UNIT) {\\n revert PRBMath_MulDiv18_Overflow(x, y);\\n }\\n\\n uint256 remainder;\\n assembly (\\\"memory-safe\\\") {\\n remainder := mulmod(x, y, UNIT)\\n result :=\\n mul(\\n or(\\n div(sub(prod0, remainder), UNIT_LPOTD),\\n mul(sub(prod1, gt(remainder, prod0)), add(div(sub(0, UNIT_LPOTD), UNIT_LPOTD), 1))\\n ),\\n UNIT_INVERSE\\n )\\n }\\n}\\n\\n/// @notice Calculates x*y\\u00f7denominator with 512-bit precision.\\n///\\n/// @dev This is an extension of {mulDiv} for signed numbers, which works by computing the signs and the absolute values separately.\\n///\\n/// Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {mulDiv}.\\n/// - None of the inputs can be `type(int256).min`.\\n/// - The result must fit in int256.\\n///\\n/// @param x The multiplicand as an int256.\\n/// @param y The multiplier as an int256.\\n/// @param denominator The divisor as an int256.\\n/// @return result The result as an int256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mulDivSigned(int256 x, int256 y, int256 denominator) pure returns (int256 result) {\\n if (x == type(int256).min || y == type(int256).min || denominator == type(int256).min) {\\n revert PRBMath_MulDivSigned_InputTooSmall();\\n }\\n\\n // Get hold of the absolute values of x, y and the denominator.\\n uint256 xAbs;\\n uint256 yAbs;\\n uint256 dAbs;\\n unchecked {\\n xAbs = x < 0 ? uint256(-x) : uint256(x);\\n yAbs = y < 0 ? uint256(-y) : uint256(y);\\n dAbs = denominator < 0 ? uint256(-denominator) : uint256(denominator);\\n }\\n\\n // Compute the absolute value of x*y\\u00f7denominator. The result must fit in int256.\\n uint256 resultAbs = mulDiv(xAbs, yAbs, dAbs);\\n if (resultAbs > uint256(type(int256).max)) {\\n revert PRBMath_MulDivSigned_Overflow(x, y);\\n }\\n\\n // Get the signs of x, y and the denominator.\\n uint256 sx;\\n uint256 sy;\\n uint256 sd;\\n assembly (\\\"memory-safe\\\") {\\n // \\\"sgt\\\" is the \\\"signed greater than\\\" assembly instruction and \\\"sub(0,1)\\\" is -1 in two's complement.\\n sx := sgt(x, sub(0, 1))\\n sy := sgt(y, sub(0, 1))\\n sd := sgt(denominator, sub(0, 1))\\n }\\n\\n // XOR over sx, sy and sd. What this does is to check whether there are 1 or 3 negative signs in the inputs.\\n // If there are, the result should be negative. Otherwise, it should be positive.\\n unchecked {\\n result = sx ^ sy ^ sd == 0 ? -int256(resultAbs) : int256(resultAbs);\\n }\\n}\\n\\n/// @notice Calculates the square root of x using the Babylonian method.\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\\n///\\n/// Notes:\\n/// - If x is not a perfect square, the result is rounded down.\\n/// - Credits to OpenZeppelin for the explanations in comments below.\\n///\\n/// @param x The uint256 number for which to calculate the square root.\\n/// @return result The result as a uint256.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction sqrt(uint256 x) pure returns (uint256 result) {\\n if (x == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we calculate the biggest power of 2 which is smaller than the square root of x.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of x is a power of 2 such that we have:\\n //\\n // $$\\n // msb(x) <= x <= 2*msb(x)$\\n // $$\\n //\\n // We write $msb(x)$ as $2^k$, and we get:\\n //\\n // $$\\n // k = log_2(x)\\n // $$\\n //\\n // Thus, we can write the initial inequality as:\\n //\\n // $$\\n // 2^{log_2(x)} <= x <= 2*2^{log_2(x)+1} \\\\\\\\\\n // sqrt(2^k) <= sqrt(x) < sqrt(2^{k+1}) \\\\\\\\\\n // 2^{k/2} <= sqrt(x) < 2^{(k+1)/2} <= 2^{(k/2)+1}\\n // $$\\n //\\n // Consequently, $2^{log_2(x) /2} is a good first approximation of sqrt(x) with at least one correct bit.\\n uint256 xAux = uint256(x);\\n result = 1;\\n if (xAux >= 2 ** 128) {\\n xAux >>= 128;\\n result <<= 64;\\n }\\n if (xAux >= 2 ** 64) {\\n xAux >>= 64;\\n result <<= 32;\\n }\\n if (xAux >= 2 ** 32) {\\n xAux >>= 32;\\n result <<= 16;\\n }\\n if (xAux >= 2 ** 16) {\\n xAux >>= 16;\\n result <<= 8;\\n }\\n if (xAux >= 2 ** 8) {\\n xAux >>= 8;\\n result <<= 4;\\n }\\n if (xAux >= 2 ** 4) {\\n xAux >>= 4;\\n result <<= 2;\\n }\\n if (xAux >= 2 ** 2) {\\n result <<= 1;\\n }\\n\\n // At this point, `result` is an estimation with at least one bit of precision. We know the true value has at\\n // most 128 bits, since it is the square root of a uint256. Newton's method converges quadratically (precision\\n // doubles at every iteration). We thus need at most 7 iteration to turn our partial result with one bit of\\n // precision into the expected uint128 result.\\n unchecked {\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n result = (result + x / result) >> 1;\\n\\n // If x is not a perfect square, round the result toward zero.\\n uint256 roundedResult = x / result;\\n if (result >= roundedResult) {\\n result = roundedResult;\\n }\\n }\\n}\\n\",\"keccak256\":\"0xaa374e2c26cc93e8c22a6953804ee05f811597ef5fa82f76824378b22944778b\",\"license\":\"MIT\"},\"@prb/math/src/UD2x18.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\n/*\\n\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2550\\u2550\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2554\\u2588\\u2588\\u2588\\u2588\\u2554\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551 \\u255a\\u2550\\u255d \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\n\\n\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2550\\u2550\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d \\u255a\\u2588\\u2588\\u2588\\u2554\\u255d \\u255a\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u255d\\n\\n*/\\n\\nimport \\\"./ud2x18/Casting.sol\\\";\\nimport \\\"./ud2x18/Constants.sol\\\";\\nimport \\\"./ud2x18/Errors.sol\\\";\\nimport \\\"./ud2x18/ValueType.sol\\\";\\n\",\"keccak256\":\"0xfb624e24cd8bb790fa08e7827819de85504a86e20e961fa4ad126c65b6d90641\",\"license\":\"MIT\"},\"@prb/math/src/UD60x18.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\n/*\\n\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u255a\\u2550\\u2550\\u2588\\u2588\\u2554\\u2550\\u2550\\u255d\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2554\\u2588\\u2588\\u2588\\u2588\\u2554\\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2551\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551 \\u255a\\u2550\\u255d \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\n\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d\\n\\n\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2588\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2550\\u255d \\u2588\\u2588\\u2554\\u2550\\u2588\\u2588\\u2588\\u2588\\u2557\\u255a\\u2588\\u2588\\u2557\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2588\\u2588\\u2551 \\u255a\\u2588\\u2588\\u2588\\u2554\\u255d \\u255a\\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2550\\u2588\\u2588\\u2557\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2551 \\u2588\\u2588\\u2554\\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u2588\\u2588\\u2554\\u2550\\u2550\\u2588\\u2588\\u2557\\n\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\u2588\\u2588\\u2554\\u255d \\u2588\\u2588\\u2557 \\u2588\\u2588\\u2551\\u255a\\u2588\\u2588\\u2588\\u2588\\u2588\\u2554\\u255d\\n \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u255d \\u255a\\u2550\\u2550\\u2550\\u2550\\u255d\\n\\n*/\\n\\nimport \\\"./ud60x18/Casting.sol\\\";\\nimport \\\"./ud60x18/Constants.sol\\\";\\nimport \\\"./ud60x18/Conversions.sol\\\";\\nimport \\\"./ud60x18/Errors.sol\\\";\\nimport \\\"./ud60x18/Helpers.sol\\\";\\nimport \\\"./ud60x18/Math.sol\\\";\\nimport \\\"./ud60x18/ValueType.sol\\\";\\n\",\"keccak256\":\"0xb98c6f74275914d279e8af6c502c2b1f50d5f6e1ed418d3b0153f5a193206c48\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as CastingErrors;\\nimport { SD59x18 } from \\\"../sd59x18/ValueType.sol\\\";\\nimport { UD2x18 } from \\\"../ud2x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"../ud60x18/ValueType.sol\\\";\\nimport { SD1x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts an SD1x18 number into SD59x18.\\n/// @dev There is no overflow check because the domain of SD1x18 is a subset of SD59x18.\\nfunction intoSD59x18(SD1x18 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(int256(SD1x18.unwrap(x)));\\n}\\n\\n/// @notice Casts an SD1x18 number into UD2x18.\\n/// - x must be positive.\\nfunction intoUD2x18(SD1x18 x) pure returns (UD2x18 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUD2x18_Underflow(x);\\n }\\n result = UD2x18.wrap(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into UD60x18.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUD60x18(SD1x18 x) pure returns (UD60x18 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUD60x18_Underflow(x);\\n }\\n result = UD60x18.wrap(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into uint256.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUint256(SD1x18 x) pure returns (uint256 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint256_Underflow(x);\\n }\\n result = uint256(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into uint128.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUint128(SD1x18 x) pure returns (uint128 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint128_Underflow(x);\\n }\\n result = uint128(uint64(xInt));\\n}\\n\\n/// @notice Casts an SD1x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(SD1x18 x) pure returns (uint40 result) {\\n int64 xInt = SD1x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint40_Underflow(x);\\n }\\n if (xInt > int64(uint64(Common.MAX_UINT40))) {\\n revert CastingErrors.PRBMath_SD1x18_ToUint40_Overflow(x);\\n }\\n result = uint40(uint64(xInt));\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction sd1x18(int64 x) pure returns (SD1x18 result) {\\n result = SD1x18.wrap(x);\\n}\\n\\n/// @notice Unwraps an SD1x18 number into int64.\\nfunction unwrap(SD1x18 x) pure returns (int64 result) {\\n result = SD1x18.unwrap(x);\\n}\\n\\n/// @notice Wraps an int64 number into SD1x18.\\nfunction wrap(int64 x) pure returns (SD1x18 result) {\\n result = SD1x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x9e49e2b37c1bb845861740805edaaef3fe951a7b96eef16ce84fbf76e8278670\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD1x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @dev Euler's number as an SD1x18 number.\\nSD1x18 constant E = SD1x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum value an SD1x18 number can have.\\nint64 constant uMAX_SD1x18 = 9_223372036854775807;\\nSD1x18 constant MAX_SD1x18 = SD1x18.wrap(uMAX_SD1x18);\\n\\n/// @dev The maximum value an SD1x18 number can have.\\nint64 constant uMIN_SD1x18 = -9_223372036854775808;\\nSD1x18 constant MIN_SD1x18 = SD1x18.wrap(uMIN_SD1x18);\\n\\n/// @dev PI as an SD1x18 number.\\nSD1x18 constant PI = SD1x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of SD1x18.\\nSD1x18 constant UNIT = SD1x18.wrap(1e18);\\nint64 constant uUNIT = 1e18;\\n\",\"keccak256\":\"0x6496165b80552785a4b65a239b96e2a5fedf62fe54f002eeed72d75e566d7585\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD1x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in UD2x18.\\nerror PRBMath_SD1x18_ToUD2x18_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in UD60x18.\\nerror PRBMath_SD1x18_ToUD60x18_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint128.\\nerror PRBMath_SD1x18_ToUint128_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint256.\\nerror PRBMath_SD1x18_ToUint256_Underflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint40.\\nerror PRBMath_SD1x18_ToUint40_Overflow(SD1x18 x);\\n\\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint40.\\nerror PRBMath_SD1x18_ToUint40_Underflow(SD1x18 x);\\n\",\"keccak256\":\"0x836cb42ba619ca369fd4765bc47fefc3c3621369c5861882af14660aca5057ee\",\"license\":\"MIT\"},\"@prb/math/src/sd1x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\n\\n/// @notice The signed 1.18-decimal fixed-point number representation, which can have up to 1 digit and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\\n/// type int64. This is useful when end users want to use int64 to save gas, e.g. with tight variable packing in contract\\n/// storage.\\ntype SD1x18 is int64;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoSD59x18,\\n Casting.intoUD2x18,\\n Casting.intoUD60x18,\\n Casting.intoUint256,\\n Casting.intoUint128,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for SD1x18 global;\\n\",\"keccak256\":\"0x2f86f1aa9fca42f40808b51a879b406ac51817647bdb9642f8a79dd8fdb754a7\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Errors.sol\\\" as CastingErrors;\\nimport { MAX_UINT128, MAX_UINT40 } from \\\"../Common.sol\\\";\\nimport { uMAX_SD1x18, uMIN_SD1x18 } from \\\"../sd1x18/Constants.sol\\\";\\nimport { SD1x18 } from \\\"../sd1x18/ValueType.sol\\\";\\nimport { uMAX_UD2x18 } from \\\"../ud2x18/Constants.sol\\\";\\nimport { UD2x18 } from \\\"../ud2x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"../ud60x18/ValueType.sol\\\";\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts an SD59x18 number into int256.\\n/// @dev This is basically a functional alias for {unwrap}.\\nfunction intoInt256(SD59x18 x) pure returns (int256 result) {\\n result = SD59x18.unwrap(x);\\n}\\n\\n/// @notice Casts an SD59x18 number into SD1x18.\\n/// @dev Requirements:\\n/// - x must be greater than or equal to `uMIN_SD1x18`.\\n/// - x must be less than or equal to `uMAX_SD1x18`.\\nfunction intoSD1x18(SD59x18 x) pure returns (SD1x18 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < uMIN_SD1x18) {\\n revert CastingErrors.PRBMath_SD59x18_IntoSD1x18_Underflow(x);\\n }\\n if (xInt > uMAX_SD1x18) {\\n revert CastingErrors.PRBMath_SD59x18_IntoSD1x18_Overflow(x);\\n }\\n result = SD1x18.wrap(int64(xInt));\\n}\\n\\n/// @notice Casts an SD59x18 number into UD2x18.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `uMAX_UD2x18`.\\nfunction intoUD2x18(SD59x18 x) pure returns (UD2x18 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUD2x18_Underflow(x);\\n }\\n if (xInt > int256(uint256(uMAX_UD2x18))) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUD2x18_Overflow(x);\\n }\\n result = UD2x18.wrap(uint64(uint256(xInt)));\\n}\\n\\n/// @notice Casts an SD59x18 number into UD60x18.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUD60x18(SD59x18 x) pure returns (UD60x18 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUD60x18_Underflow(x);\\n }\\n result = UD60x18.wrap(uint256(xInt));\\n}\\n\\n/// @notice Casts an SD59x18 number into uint256.\\n/// @dev Requirements:\\n/// - x must be positive.\\nfunction intoUint256(SD59x18 x) pure returns (uint256 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint256_Underflow(x);\\n }\\n result = uint256(xInt);\\n}\\n\\n/// @notice Casts an SD59x18 number into uint128.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `uMAX_UINT128`.\\nfunction intoUint128(SD59x18 x) pure returns (uint128 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint128_Underflow(x);\\n }\\n if (xInt > int256(uint256(MAX_UINT128))) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint128_Overflow(x);\\n }\\n result = uint128(uint256(xInt));\\n}\\n\\n/// @notice Casts an SD59x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be positive.\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(SD59x18 x) pure returns (uint40 result) {\\n int256 xInt = SD59x18.unwrap(x);\\n if (xInt < 0) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint40_Underflow(x);\\n }\\n if (xInt > int256(uint256(MAX_UINT40))) {\\n revert CastingErrors.PRBMath_SD59x18_IntoUint40_Overflow(x);\\n }\\n result = uint40(uint256(xInt));\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction sd(int256 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(x);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction sd59x18(int256 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(x);\\n}\\n\\n/// @notice Unwraps an SD59x18 number into int256.\\nfunction unwrap(SD59x18 x) pure returns (int256 result) {\\n result = SD59x18.unwrap(x);\\n}\\n\\n/// @notice Wraps an int256 number into SD59x18.\\nfunction wrap(int256 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x3b21b60ec2998c3ae32f647412da51d3683b3f183a807198cc8d157499484f99\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n// NOTICE: the \\\"u\\\" prefix stands for \\\"unwrapped\\\".\\n\\n/// @dev Euler's number as an SD59x18 number.\\nSD59x18 constant E = SD59x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum input permitted in {exp}.\\nint256 constant uEXP_MAX_INPUT = 133_084258667509499440;\\nSD59x18 constant EXP_MAX_INPUT = SD59x18.wrap(uEXP_MAX_INPUT);\\n\\n/// @dev Any value less than this returns 0 in {exp}.\\nint256 constant uEXP_MIN_THRESHOLD = -41_446531673892822322;\\nSD59x18 constant EXP_MIN_THRESHOLD = SD59x18.wrap(uEXP_MIN_THRESHOLD);\\n\\n/// @dev The maximum input permitted in {exp2}.\\nint256 constant uEXP2_MAX_INPUT = 192e18 - 1;\\nSD59x18 constant EXP2_MAX_INPUT = SD59x18.wrap(uEXP2_MAX_INPUT);\\n\\n/// @dev Any value less than this returns 0 in {exp2}.\\nint256 constant uEXP2_MIN_THRESHOLD = -59_794705707972522261;\\nSD59x18 constant EXP2_MIN_THRESHOLD = SD59x18.wrap(uEXP2_MIN_THRESHOLD);\\n\\n/// @dev Half the UNIT number.\\nint256 constant uHALF_UNIT = 0.5e18;\\nSD59x18 constant HALF_UNIT = SD59x18.wrap(uHALF_UNIT);\\n\\n/// @dev $log_2(10)$ as an SD59x18 number.\\nint256 constant uLOG2_10 = 3_321928094887362347;\\nSD59x18 constant LOG2_10 = SD59x18.wrap(uLOG2_10);\\n\\n/// @dev $log_2(e)$ as an SD59x18 number.\\nint256 constant uLOG2_E = 1_442695040888963407;\\nSD59x18 constant LOG2_E = SD59x18.wrap(uLOG2_E);\\n\\n/// @dev The maximum value an SD59x18 number can have.\\nint256 constant uMAX_SD59x18 = 57896044618658097711785492504343953926634992332820282019728_792003956564819967;\\nSD59x18 constant MAX_SD59x18 = SD59x18.wrap(uMAX_SD59x18);\\n\\n/// @dev The maximum whole value an SD59x18 number can have.\\nint256 constant uMAX_WHOLE_SD59x18 = 57896044618658097711785492504343953926634992332820282019728_000000000000000000;\\nSD59x18 constant MAX_WHOLE_SD59x18 = SD59x18.wrap(uMAX_WHOLE_SD59x18);\\n\\n/// @dev The minimum value an SD59x18 number can have.\\nint256 constant uMIN_SD59x18 = -57896044618658097711785492504343953926634992332820282019728_792003956564819968;\\nSD59x18 constant MIN_SD59x18 = SD59x18.wrap(uMIN_SD59x18);\\n\\n/// @dev The minimum whole value an SD59x18 number can have.\\nint256 constant uMIN_WHOLE_SD59x18 = -57896044618658097711785492504343953926634992332820282019728_000000000000000000;\\nSD59x18 constant MIN_WHOLE_SD59x18 = SD59x18.wrap(uMIN_WHOLE_SD59x18);\\n\\n/// @dev PI as an SD59x18 number.\\nSD59x18 constant PI = SD59x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of SD59x18.\\nint256 constant uUNIT = 1e18;\\nSD59x18 constant UNIT = SD59x18.wrap(1e18);\\n\\n/// @dev The unit number squared.\\nint256 constant uUNIT_SQUARED = 1e36;\\nSD59x18 constant UNIT_SQUARED = SD59x18.wrap(uUNIT_SQUARED);\\n\\n/// @dev Zero as an SD59x18 number.\\nSD59x18 constant ZERO = SD59x18.wrap(0);\\n\",\"keccak256\":\"0x9bcb8dd6b3e886d140ad1c32747a4f6d29a492529ceb835be878ae837aa6cc3a\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when taking the absolute value of `MIN_SD59x18`.\\nerror PRBMath_SD59x18_Abs_MinSD59x18();\\n\\n/// @notice Thrown when ceiling a number overflows SD59x18.\\nerror PRBMath_SD59x18_Ceil_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when converting a basic integer to the fixed-point format overflows SD59x18.\\nerror PRBMath_SD59x18_Convert_Overflow(int256 x);\\n\\n/// @notice Thrown when converting a basic integer to the fixed-point format underflows SD59x18.\\nerror PRBMath_SD59x18_Convert_Underflow(int256 x);\\n\\n/// @notice Thrown when dividing two numbers and one of them is `MIN_SD59x18`.\\nerror PRBMath_SD59x18_Div_InputTooSmall();\\n\\n/// @notice Thrown when dividing two numbers and one of the intermediary unsigned results overflows SD59x18.\\nerror PRBMath_SD59x18_Div_Overflow(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when taking the natural exponent of a base greater than 133_084258667509499441.\\nerror PRBMath_SD59x18_Exp_InputTooBig(SD59x18 x);\\n\\n/// @notice Thrown when taking the binary exponent of a base greater than 192e18.\\nerror PRBMath_SD59x18_Exp2_InputTooBig(SD59x18 x);\\n\\n/// @notice Thrown when flooring a number underflows SD59x18.\\nerror PRBMath_SD59x18_Floor_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when taking the geometric mean of two numbers and their product is negative.\\nerror PRBMath_SD59x18_Gm_NegativeProduct(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when taking the geometric mean of two numbers and multiplying them overflows SD59x18.\\nerror PRBMath_SD59x18_Gm_Overflow(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\\nerror PRBMath_SD59x18_IntoSD1x18_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\\nerror PRBMath_SD59x18_IntoSD1x18_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\\nerror PRBMath_SD59x18_IntoUD2x18_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\\nerror PRBMath_SD59x18_IntoUD2x18_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD60x18.\\nerror PRBMath_SD59x18_IntoUD60x18_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\\nerror PRBMath_SD59x18_IntoUint128_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\\nerror PRBMath_SD59x18_IntoUint128_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint256.\\nerror PRBMath_SD59x18_IntoUint256_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\\nerror PRBMath_SD59x18_IntoUint40_Overflow(SD59x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\\nerror PRBMath_SD59x18_IntoUint40_Underflow(SD59x18 x);\\n\\n/// @notice Thrown when taking the logarithm of a number less than or equal to zero.\\nerror PRBMath_SD59x18_Log_InputTooSmall(SD59x18 x);\\n\\n/// @notice Thrown when multiplying two numbers and one of the inputs is `MIN_SD59x18`.\\nerror PRBMath_SD59x18_Mul_InputTooSmall();\\n\\n/// @notice Thrown when multiplying two numbers and the intermediary absolute result overflows SD59x18.\\nerror PRBMath_SD59x18_Mul_Overflow(SD59x18 x, SD59x18 y);\\n\\n/// @notice Thrown when raising a number to a power and the intermediary absolute result overflows SD59x18.\\nerror PRBMath_SD59x18_Powu_Overflow(SD59x18 x, uint256 y);\\n\\n/// @notice Thrown when taking the square root of a negative number.\\nerror PRBMath_SD59x18_Sqrt_NegativeInput(SD59x18 x);\\n\\n/// @notice Thrown when the calculating the square root overflows SD59x18.\\nerror PRBMath_SD59x18_Sqrt_Overflow(SD59x18 x);\\n\",\"keccak256\":\"0xa6d00fe5efa215ac0df25c896e3da99a12fb61e799644b2ec32da947313d3db4\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Helpers.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { wrap } from \\\"./Casting.sol\\\";\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Implements the checked addition operation (+) in the SD59x18 type.\\nfunction add(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n return wrap(x.unwrap() + y.unwrap());\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the SD59x18 type.\\nfunction and(SD59x18 x, int256 bits) pure returns (SD59x18 result) {\\n return wrap(x.unwrap() & bits);\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the SD59x18 type.\\nfunction and2(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n return wrap(x.unwrap() & y.unwrap());\\n}\\n\\n/// @notice Implements the equal (=) operation in the SD59x18 type.\\nfunction eq(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() == y.unwrap();\\n}\\n\\n/// @notice Implements the greater than operation (>) in the SD59x18 type.\\nfunction gt(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() > y.unwrap();\\n}\\n\\n/// @notice Implements the greater than or equal to operation (>=) in the SD59x18 type.\\nfunction gte(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() >= y.unwrap();\\n}\\n\\n/// @notice Implements a zero comparison check function in the SD59x18 type.\\nfunction isZero(SD59x18 x) pure returns (bool result) {\\n result = x.unwrap() == 0;\\n}\\n\\n/// @notice Implements the left shift operation (<<) in the SD59x18 type.\\nfunction lshift(SD59x18 x, uint256 bits) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() << bits);\\n}\\n\\n/// @notice Implements the lower than operation (<) in the SD59x18 type.\\nfunction lt(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() < y.unwrap();\\n}\\n\\n/// @notice Implements the lower than or equal to operation (<=) in the SD59x18 type.\\nfunction lte(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() <= y.unwrap();\\n}\\n\\n/// @notice Implements the unchecked modulo operation (%) in the SD59x18 type.\\nfunction mod(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() % y.unwrap());\\n}\\n\\n/// @notice Implements the not equal operation (!=) in the SD59x18 type.\\nfunction neq(SD59x18 x, SD59x18 y) pure returns (bool result) {\\n result = x.unwrap() != y.unwrap();\\n}\\n\\n/// @notice Implements the NOT (~) bitwise operation in the SD59x18 type.\\nfunction not(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(~x.unwrap());\\n}\\n\\n/// @notice Implements the OR (|) bitwise operation in the SD59x18 type.\\nfunction or(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() | y.unwrap());\\n}\\n\\n/// @notice Implements the right shift operation (>>) in the SD59x18 type.\\nfunction rshift(SD59x18 x, uint256 bits) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() >> bits);\\n}\\n\\n/// @notice Implements the checked subtraction operation (-) in the SD59x18 type.\\nfunction sub(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() - y.unwrap());\\n}\\n\\n/// @notice Implements the checked unary minus operation (-) in the SD59x18 type.\\nfunction unary(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(-x.unwrap());\\n}\\n\\n/// @notice Implements the unchecked addition operation (+) in the SD59x18 type.\\nfunction uncheckedAdd(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() + y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the unchecked subtraction operation (-) in the SD59x18 type.\\nfunction uncheckedSub(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() - y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the unchecked unary minus operation (-) in the SD59x18 type.\\nfunction uncheckedUnary(SD59x18 x) pure returns (SD59x18 result) {\\n unchecked {\\n result = wrap(-x.unwrap());\\n }\\n}\\n\\n/// @notice Implements the XOR (^) bitwise operation in the SD59x18 type.\\nfunction xor(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() ^ y.unwrap());\\n}\\n\",\"keccak256\":\"0x208570f1657cf730cb6c3d81aa14030e0d45cf906cdedea5059369d7df4bb716\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as Errors;\\nimport {\\n uEXP_MAX_INPUT,\\n uEXP2_MAX_INPUT,\\n uEXP_MIN_THRESHOLD,\\n uEXP2_MIN_THRESHOLD,\\n uHALF_UNIT,\\n uLOG2_10,\\n uLOG2_E,\\n uMAX_SD59x18,\\n uMAX_WHOLE_SD59x18,\\n uMIN_SD59x18,\\n uMIN_WHOLE_SD59x18,\\n UNIT,\\n uUNIT,\\n uUNIT_SQUARED,\\n ZERO\\n} from \\\"./Constants.sol\\\";\\nimport { wrap } from \\\"./Helpers.sol\\\";\\nimport { SD59x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Calculates the absolute value of x.\\n///\\n/// @dev Requirements:\\n/// - x must be greater than `MIN_SD59x18`.\\n///\\n/// @param x The SD59x18 number for which to calculate the absolute value.\\n/// @param result The absolute value of x as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction abs(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt == uMIN_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Abs_MinSD59x18();\\n }\\n result = xInt < 0 ? wrap(-xInt) : x;\\n}\\n\\n/// @notice Calculates the arithmetic average of x and y.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// @param x The first operand as an SD59x18 number.\\n/// @param y The second operand as an SD59x18 number.\\n/// @return result The arithmetic average as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction avg(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n\\n unchecked {\\n // This operation is equivalent to `x / 2 + y / 2`, and it can never overflow.\\n int256 sum = (xInt >> 1) + (yInt >> 1);\\n\\n if (sum < 0) {\\n // If at least one of x and y is odd, add 1 to the result, because shifting negative numbers to the right\\n // rounds toward negative infinity. The right part is equivalent to `sum + (x % 2 == 1 || y % 2 == 1)`.\\n assembly (\\\"memory-safe\\\") {\\n result := add(sum, and(or(xInt, yInt), 1))\\n }\\n } else {\\n // Add 1 if both x and y are odd to account for the double 0.5 remainder truncated after shifting.\\n result = wrap(sum + (xInt & yInt & 1));\\n }\\n }\\n}\\n\\n/// @notice Yields the smallest whole number greater than or equal to x.\\n///\\n/// @dev Optimized for fractional value inputs, because every whole value has (1e18 - 1) fractional counterparts.\\n/// See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n///\\n/// Requirements:\\n/// - x must be less than or equal to `MAX_WHOLE_SD59x18`.\\n///\\n/// @param x The SD59x18 number to ceil.\\n/// @param result The smallest whole number greater than or equal to x, as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ceil(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt > uMAX_WHOLE_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Ceil_Overflow(x);\\n }\\n\\n int256 remainder = xInt % uUNIT;\\n if (remainder == 0) {\\n result = x;\\n } else {\\n unchecked {\\n // Solidity uses C fmod style, which returns a modulus with the same sign as x.\\n int256 resultInt = xInt - remainder;\\n if (xInt > 0) {\\n resultInt += uUNIT;\\n }\\n result = wrap(resultInt);\\n }\\n }\\n}\\n\\n/// @notice Divides two SD59x18 numbers, returning a new SD59x18 number.\\n///\\n/// @dev This is an extension of {Common.mulDiv} for signed numbers, which works by computing the signs and the absolute\\n/// values separately.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv}.\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv}.\\n/// - None of the inputs can be `MIN_SD59x18`.\\n/// - The denominator must not be zero.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The numerator as an SD59x18 number.\\n/// @param y The denominator as an SD59x18 number.\\n/// @param result The quotient as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction div(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n if (xInt == uMIN_SD59x18 || yInt == uMIN_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Div_InputTooSmall();\\n }\\n\\n // Get hold of the absolute values of x and y.\\n uint256 xAbs;\\n uint256 yAbs;\\n unchecked {\\n xAbs = xInt < 0 ? uint256(-xInt) : uint256(xInt);\\n yAbs = yInt < 0 ? uint256(-yInt) : uint256(yInt);\\n }\\n\\n // Compute the absolute value (x*UNIT\\u00f7y). The resulting value must fit in SD59x18.\\n uint256 resultAbs = Common.mulDiv(xAbs, uint256(uUNIT), yAbs);\\n if (resultAbs > uint256(uMAX_SD59x18)) {\\n revert Errors.PRBMath_SD59x18_Div_Overflow(x, y);\\n }\\n\\n // Check if x and y have the same sign using two's complement representation. The left-most bit represents the sign (1 for\\n // negative, 0 for positive or zero).\\n bool sameSign = (xInt ^ yInt) > -1;\\n\\n // If the inputs have the same sign, the result should be positive. Otherwise, it should be negative.\\n unchecked {\\n result = wrap(sameSign ? int256(resultAbs) : -int256(resultAbs));\\n }\\n}\\n\\n/// @notice Calculates the natural exponent of x using the following formula:\\n///\\n/// $$\\n/// e^x = 2^{x * log_2{e}}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {exp2}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {exp2}.\\n/// - x must be less than 133_084258667509499441.\\n///\\n/// @param x The exponent as an SD59x18 number.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n\\n // Any input less than the threshold returns zero.\\n // This check also prevents an overflow for very small numbers.\\n if (xInt < uEXP_MIN_THRESHOLD) {\\n return ZERO;\\n }\\n\\n // This check prevents values greater than 192e18 from being passed to {exp2}.\\n if (xInt > uEXP_MAX_INPUT) {\\n revert Errors.PRBMath_SD59x18_Exp_InputTooBig(x);\\n }\\n\\n unchecked {\\n // Inline the fixed-point multiplication to save gas.\\n int256 doubleUnitProduct = xInt * uLOG2_E;\\n result = exp2(wrap(doubleUnitProduct / uUNIT));\\n }\\n}\\n\\n/// @notice Calculates the binary exponent of x using the binary fraction method using the following formula:\\n///\\n/// $$\\n/// 2^{-x} = \\\\frac{1}{2^x}\\n/// $$\\n///\\n/// @dev See https://ethereum.stackexchange.com/q/79903/24693.\\n///\\n/// Notes:\\n/// - If x is less than -59_794705707972522261, the result is zero.\\n///\\n/// Requirements:\\n/// - x must be less than 192e18.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The exponent as an SD59x18 number.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp2(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < 0) {\\n // The inverse of any number less than the threshold is truncated to zero.\\n if (xInt < uEXP2_MIN_THRESHOLD) {\\n return ZERO;\\n }\\n\\n unchecked {\\n // Inline the fixed-point inversion to save gas.\\n result = wrap(uUNIT_SQUARED / exp2(wrap(-xInt)).unwrap());\\n }\\n } else {\\n // Numbers greater than or equal to 192e18 don't fit in the 192.64-bit format.\\n if (xInt > uEXP2_MAX_INPUT) {\\n revert Errors.PRBMath_SD59x18_Exp2_InputTooBig(x);\\n }\\n\\n unchecked {\\n // Convert x to the 192.64-bit fixed-point format.\\n uint256 x_192x64 = uint256((xInt << 64) / uUNIT);\\n\\n // It is safe to cast the result to int256 due to the checks above.\\n result = wrap(int256(Common.exp2(x_192x64)));\\n }\\n }\\n}\\n\\n/// @notice Yields the greatest whole number less than or equal to x.\\n///\\n/// @dev Optimized for fractional value inputs, because for every whole value there are (1e18 - 1) fractional\\n/// counterparts. See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n///\\n/// Requirements:\\n/// - x must be greater than or equal to `MIN_WHOLE_SD59x18`.\\n///\\n/// @param x The SD59x18 number to floor.\\n/// @param result The greatest whole number less than or equal to x, as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction floor(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < uMIN_WHOLE_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Floor_Underflow(x);\\n }\\n\\n int256 remainder = xInt % uUNIT;\\n if (remainder == 0) {\\n result = x;\\n } else {\\n unchecked {\\n // Solidity uses C fmod style, which returns a modulus with the same sign as x.\\n int256 resultInt = xInt - remainder;\\n if (xInt < 0) {\\n resultInt -= uUNIT;\\n }\\n result = wrap(resultInt);\\n }\\n }\\n}\\n\\n/// @notice Yields the excess beyond the floor of x for positive numbers and the part of the number to the right.\\n/// of the radix point for negative numbers.\\n/// @dev Based on the odd function definition. https://en.wikipedia.org/wiki/Fractional_part\\n/// @param x The SD59x18 number to get the fractional part of.\\n/// @param result The fractional part of x as an SD59x18 number.\\nfunction frac(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(x.unwrap() % uUNIT);\\n}\\n\\n/// @notice Calculates the geometric mean of x and y, i.e. $\\\\sqrt{x * y}$.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x * y must fit in SD59x18.\\n/// - x * y must not be negative, since complex numbers are not supported.\\n///\\n/// @param x The first operand as an SD59x18 number.\\n/// @param y The second operand as an SD59x18 number.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction gm(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n if (xInt == 0 || yInt == 0) {\\n return ZERO;\\n }\\n\\n unchecked {\\n // Equivalent to `xy / x != y`. Checking for overflow this way is faster than letting Solidity do it.\\n int256 xyInt = xInt * yInt;\\n if (xyInt / xInt != yInt) {\\n revert Errors.PRBMath_SD59x18_Gm_Overflow(x, y);\\n }\\n\\n // The product must not be negative, since complex numbers are not supported.\\n if (xyInt < 0) {\\n revert Errors.PRBMath_SD59x18_Gm_NegativeProduct(x, y);\\n }\\n\\n // We don't need to multiply the result by `UNIT` here because the x*y product picked up a factor of `UNIT`\\n // during multiplication. See the comments in {Common.sqrt}.\\n uint256 resultUint = Common.sqrt(uint256(xyInt));\\n result = wrap(int256(resultUint));\\n }\\n}\\n\\n/// @notice Calculates the inverse of x.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x must not be zero.\\n///\\n/// @param x The SD59x18 number for which to calculate the inverse.\\n/// @return result The inverse as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction inv(SD59x18 x) pure returns (SD59x18 result) {\\n result = wrap(uUNIT_SQUARED / x.unwrap());\\n}\\n\\n/// @notice Calculates the natural logarithm of x using the following formula:\\n///\\n/// $$\\n/// ln{x} = log_2{x} / log_2{e}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n/// - The precision isn't sufficiently fine-grained to return exactly `UNIT` when the input is `E`.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The SD59x18 number for which to calculate the natural logarithm.\\n/// @return result The natural logarithm as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ln(SD59x18 x) pure returns (SD59x18 result) {\\n // Inline the fixed-point multiplication to save gas. This is overflow-safe because the maximum value that\\n // {log2} can return is ~195_205294292027477728.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_E);\\n}\\n\\n/// @notice Calculates the common logarithm of x using the following formula:\\n///\\n/// $$\\n/// log_{10}{x} = log_2{x} / log_2{10}\\n/// $$\\n///\\n/// However, if x is an exact power of ten, a hard coded value is returned.\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The SD59x18 number for which to calculate the common logarithm.\\n/// @return result The common logarithm as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log10(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < 0) {\\n revert Errors.PRBMath_SD59x18_Log_InputTooSmall(x);\\n }\\n\\n // Note that the `mul` in this block is the standard multiplication operation, not {SD59x18.mul}.\\n // prettier-ignore\\n assembly (\\\"memory-safe\\\") {\\n switch x\\n case 1 { result := mul(uUNIT, sub(0, 18)) }\\n case 10 { result := mul(uUNIT, sub(1, 18)) }\\n case 100 { result := mul(uUNIT, sub(2, 18)) }\\n case 1000 { result := mul(uUNIT, sub(3, 18)) }\\n case 10000 { result := mul(uUNIT, sub(4, 18)) }\\n case 100000 { result := mul(uUNIT, sub(5, 18)) }\\n case 1000000 { result := mul(uUNIT, sub(6, 18)) }\\n case 10000000 { result := mul(uUNIT, sub(7, 18)) }\\n case 100000000 { result := mul(uUNIT, sub(8, 18)) }\\n case 1000000000 { result := mul(uUNIT, sub(9, 18)) }\\n case 10000000000 { result := mul(uUNIT, sub(10, 18)) }\\n case 100000000000 { result := mul(uUNIT, sub(11, 18)) }\\n case 1000000000000 { result := mul(uUNIT, sub(12, 18)) }\\n case 10000000000000 { result := mul(uUNIT, sub(13, 18)) }\\n case 100000000000000 { result := mul(uUNIT, sub(14, 18)) }\\n case 1000000000000000 { result := mul(uUNIT, sub(15, 18)) }\\n case 10000000000000000 { result := mul(uUNIT, sub(16, 18)) }\\n case 100000000000000000 { result := mul(uUNIT, sub(17, 18)) }\\n case 1000000000000000000 { result := 0 }\\n case 10000000000000000000 { result := uUNIT }\\n case 100000000000000000000 { result := mul(uUNIT, 2) }\\n case 1000000000000000000000 { result := mul(uUNIT, 3) }\\n case 10000000000000000000000 { result := mul(uUNIT, 4) }\\n case 100000000000000000000000 { result := mul(uUNIT, 5) }\\n case 1000000000000000000000000 { result := mul(uUNIT, 6) }\\n case 10000000000000000000000000 { result := mul(uUNIT, 7) }\\n case 100000000000000000000000000 { result := mul(uUNIT, 8) }\\n case 1000000000000000000000000000 { result := mul(uUNIT, 9) }\\n case 10000000000000000000000000000 { result := mul(uUNIT, 10) }\\n case 100000000000000000000000000000 { result := mul(uUNIT, 11) }\\n case 1000000000000000000000000000000 { result := mul(uUNIT, 12) }\\n case 10000000000000000000000000000000 { result := mul(uUNIT, 13) }\\n case 100000000000000000000000000000000 { result := mul(uUNIT, 14) }\\n case 1000000000000000000000000000000000 { result := mul(uUNIT, 15) }\\n case 10000000000000000000000000000000000 { result := mul(uUNIT, 16) }\\n case 100000000000000000000000000000000000 { result := mul(uUNIT, 17) }\\n case 1000000000000000000000000000000000000 { result := mul(uUNIT, 18) }\\n case 10000000000000000000000000000000000000 { result := mul(uUNIT, 19) }\\n case 100000000000000000000000000000000000000 { result := mul(uUNIT, 20) }\\n case 1000000000000000000000000000000000000000 { result := mul(uUNIT, 21) }\\n case 10000000000000000000000000000000000000000 { result := mul(uUNIT, 22) }\\n case 100000000000000000000000000000000000000000 { result := mul(uUNIT, 23) }\\n case 1000000000000000000000000000000000000000000 { result := mul(uUNIT, 24) }\\n case 10000000000000000000000000000000000000000000 { result := mul(uUNIT, 25) }\\n case 100000000000000000000000000000000000000000000 { result := mul(uUNIT, 26) }\\n case 1000000000000000000000000000000000000000000000 { result := mul(uUNIT, 27) }\\n case 10000000000000000000000000000000000000000000000 { result := mul(uUNIT, 28) }\\n case 100000000000000000000000000000000000000000000000 { result := mul(uUNIT, 29) }\\n case 1000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 30) }\\n case 10000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 31) }\\n case 100000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 32) }\\n case 1000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 33) }\\n case 10000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 34) }\\n case 100000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 35) }\\n case 1000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 36) }\\n case 10000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 37) }\\n case 100000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 38) }\\n case 1000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 39) }\\n case 10000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 40) }\\n case 100000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 41) }\\n case 1000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 42) }\\n case 10000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 43) }\\n case 100000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 44) }\\n case 1000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 45) }\\n case 10000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 46) }\\n case 100000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 47) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 48) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 49) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 50) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 51) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 52) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 53) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 54) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 55) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 56) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 57) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 58) }\\n default { result := uMAX_SD59x18 }\\n }\\n\\n if (result.unwrap() == uMAX_SD59x18) {\\n unchecked {\\n // Inline the fixed-point division to save gas.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_10);\\n }\\n }\\n}\\n\\n/// @notice Calculates the binary logarithm of x using the iterative approximation algorithm:\\n///\\n/// $$\\n/// log_2{x} = n + log_2{y}, \\\\text{ where } y = x*2^{-n}, \\\\ y \\\\in [1, 2)\\n/// $$\\n///\\n/// For $0 \\\\leq x \\\\lt 1$, the input is inverted:\\n///\\n/// $$\\n/// log_2{x} = -log_2{\\\\frac{1}{x}}\\n/// $$\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Binary_logarithm#Iterative_approximation.\\n///\\n/// Notes:\\n/// - Due to the lossy precision of the iterative approximation, the results are not perfectly accurate to the last decimal.\\n///\\n/// Requirements:\\n/// - x must be greater than zero.\\n///\\n/// @param x The SD59x18 number for which to calculate the binary logarithm.\\n/// @return result The binary logarithm as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log2(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt <= 0) {\\n revert Errors.PRBMath_SD59x18_Log_InputTooSmall(x);\\n }\\n\\n unchecked {\\n int256 sign;\\n if (xInt >= uUNIT) {\\n sign = 1;\\n } else {\\n sign = -1;\\n // Inline the fixed-point inversion to save gas.\\n xInt = uUNIT_SQUARED / xInt;\\n }\\n\\n // Calculate the integer part of the logarithm.\\n uint256 n = Common.msb(uint256(xInt / uUNIT));\\n\\n // This is the integer part of the logarithm as an SD59x18 number. The operation can't overflow\\n // because n is at most 255, `UNIT` is 1e18, and the sign is either 1 or -1.\\n int256 resultInt = int256(n) * uUNIT;\\n\\n // Calculate $y = x * 2^{-n}$.\\n int256 y = xInt >> n;\\n\\n // If y is the unit number, the fractional part is zero.\\n if (y == uUNIT) {\\n return wrap(resultInt * sign);\\n }\\n\\n // Calculate the fractional part via the iterative approximation.\\n // The `delta >>= 1` part is equivalent to `delta /= 2`, but shifting bits is more gas efficient.\\n int256 DOUBLE_UNIT = 2e18;\\n for (int256 delta = uHALF_UNIT; delta > 0; delta >>= 1) {\\n y = (y * y) / uUNIT;\\n\\n // Is y^2 >= 2e18 and so in the range [2e18, 4e18)?\\n if (y >= DOUBLE_UNIT) {\\n // Add the 2^{-m} factor to the logarithm.\\n resultInt = resultInt + delta;\\n\\n // Halve y, which corresponds to z/2 in the Wikipedia article.\\n y >>= 1;\\n }\\n }\\n resultInt *= sign;\\n result = wrap(resultInt);\\n }\\n}\\n\\n/// @notice Multiplies two SD59x18 numbers together, returning a new SD59x18 number.\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {Common.mulDiv18}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv18}.\\n/// - None of the inputs can be `MIN_SD59x18`.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The multiplicand as an SD59x18 number.\\n/// @param y The multiplier as an SD59x18 number.\\n/// @return result The product as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mul(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n if (xInt == uMIN_SD59x18 || yInt == uMIN_SD59x18) {\\n revert Errors.PRBMath_SD59x18_Mul_InputTooSmall();\\n }\\n\\n // Get hold of the absolute values of x and y.\\n uint256 xAbs;\\n uint256 yAbs;\\n unchecked {\\n xAbs = xInt < 0 ? uint256(-xInt) : uint256(xInt);\\n yAbs = yInt < 0 ? uint256(-yInt) : uint256(yInt);\\n }\\n\\n // Compute the absolute value (x*y\\u00f7UNIT). The resulting value must fit in SD59x18.\\n uint256 resultAbs = Common.mulDiv18(xAbs, yAbs);\\n if (resultAbs > uint256(uMAX_SD59x18)) {\\n revert Errors.PRBMath_SD59x18_Mul_Overflow(x, y);\\n }\\n\\n // Check if x and y have the same sign using two's complement representation. The left-most bit represents the sign (1 for\\n // negative, 0 for positive or zero).\\n bool sameSign = (xInt ^ yInt) > -1;\\n\\n // If the inputs have the same sign, the result should be positive. Otherwise, it should be negative.\\n unchecked {\\n result = wrap(sameSign ? int256(resultAbs) : -int256(resultAbs));\\n }\\n}\\n\\n/// @notice Raises x to the power of y using the following formula:\\n///\\n/// $$\\n/// x^y = 2^{log_2{x} * y}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {exp2}, {log2}, and {mul}.\\n/// - Returns `UNIT` for 0^0.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {exp2}, {log2}, and {mul}.\\n///\\n/// @param x The base as an SD59x18 number.\\n/// @param y Exponent to raise x to, as an SD59x18 number\\n/// @return result x raised to power y, as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction pow(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n int256 yInt = y.unwrap();\\n\\n // If both x and y are zero, the result is `UNIT`. If just x is zero, the result is always zero.\\n if (xInt == 0) {\\n return yInt == 0 ? UNIT : ZERO;\\n }\\n // If x is `UNIT`, the result is always `UNIT`.\\n else if (xInt == uUNIT) {\\n return UNIT;\\n }\\n\\n // If y is zero, the result is always `UNIT`.\\n if (yInt == 0) {\\n return UNIT;\\n }\\n // If y is `UNIT`, the result is always x.\\n else if (yInt == uUNIT) {\\n return x;\\n }\\n\\n // Calculate the result using the formula.\\n result = exp2(mul(log2(x), y));\\n}\\n\\n/// @notice Raises x (an SD59x18 number) to the power y (an unsigned basic integer) using the well-known\\n/// algorithm \\\"exponentiation by squaring\\\".\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Exponentiation_by_squaring.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv18}.\\n/// - Returns `UNIT` for 0^0.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {abs} and {Common.mulDiv18}.\\n/// - The result must fit in SD59x18.\\n///\\n/// @param x The base as an SD59x18 number.\\n/// @param y The exponent as a uint256.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction powu(SD59x18 x, uint256 y) pure returns (SD59x18 result) {\\n uint256 xAbs = uint256(abs(x).unwrap());\\n\\n // Calculate the first iteration of the loop in advance.\\n uint256 resultAbs = y & 1 > 0 ? xAbs : uint256(uUNIT);\\n\\n // Equivalent to `for(y /= 2; y > 0; y /= 2)`.\\n uint256 yAux = y;\\n for (yAux >>= 1; yAux > 0; yAux >>= 1) {\\n xAbs = Common.mulDiv18(xAbs, xAbs);\\n\\n // Equivalent to `y % 2 == 1`.\\n if (yAux & 1 > 0) {\\n resultAbs = Common.mulDiv18(resultAbs, xAbs);\\n }\\n }\\n\\n // The result must fit in SD59x18.\\n if (resultAbs > uint256(uMAX_SD59x18)) {\\n revert Errors.PRBMath_SD59x18_Powu_Overflow(x, y);\\n }\\n\\n unchecked {\\n // Is the base negative and the exponent odd? If yes, the result should be negative.\\n int256 resultInt = int256(resultAbs);\\n bool isNegative = x.unwrap() < 0 && y & 1 == 1;\\n if (isNegative) {\\n resultInt = -resultInt;\\n }\\n result = wrap(resultInt);\\n }\\n}\\n\\n/// @notice Calculates the square root of x using the Babylonian method.\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\\n///\\n/// Notes:\\n/// - Only the positive root is returned.\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x cannot be negative, since complex numbers are not supported.\\n/// - x must be less than `MAX_SD59x18 / UNIT`.\\n///\\n/// @param x The SD59x18 number for which to calculate the square root.\\n/// @return result The result as an SD59x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction sqrt(SD59x18 x) pure returns (SD59x18 result) {\\n int256 xInt = x.unwrap();\\n if (xInt < 0) {\\n revert Errors.PRBMath_SD59x18_Sqrt_NegativeInput(x);\\n }\\n if (xInt > uMAX_SD59x18 / uUNIT) {\\n revert Errors.PRBMath_SD59x18_Sqrt_Overflow(x);\\n }\\n\\n unchecked {\\n // Multiply x by `UNIT` to account for the factor of `UNIT` picked up when multiplying two SD59x18 numbers.\\n // In this case, the two numbers are both the square root.\\n uint256 resultUint = Common.sqrt(uint256(xInt * uUNIT));\\n result = wrap(int256(resultUint));\\n }\\n}\\n\",\"keccak256\":\"0xa074831139fc89ca0e5a36086b30eb50896bb6770cd5823461b1f2769017d2f0\",\"license\":\"MIT\"},\"@prb/math/src/sd59x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\nimport \\\"./Helpers.sol\\\" as Helpers;\\nimport \\\"./Math.sol\\\" as Math;\\n\\n/// @notice The signed 59.18-decimal fixed-point number representation, which can have up to 59 digits and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\\n/// type int256.\\ntype SD59x18 is int256;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoInt256,\\n Casting.intoSD1x18,\\n Casting.intoUD2x18,\\n Casting.intoUD60x18,\\n Casting.intoUint256,\\n Casting.intoUint128,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for SD59x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n MATHEMATICAL FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Math.abs,\\n Math.avg,\\n Math.ceil,\\n Math.div,\\n Math.exp,\\n Math.exp2,\\n Math.floor,\\n Math.frac,\\n Math.gm,\\n Math.inv,\\n Math.log10,\\n Math.log2,\\n Math.ln,\\n Math.mul,\\n Math.pow,\\n Math.powu,\\n Math.sqrt\\n} for SD59x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n HELPER FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Helpers.add,\\n Helpers.and,\\n Helpers.eq,\\n Helpers.gt,\\n Helpers.gte,\\n Helpers.isZero,\\n Helpers.lshift,\\n Helpers.lt,\\n Helpers.lte,\\n Helpers.mod,\\n Helpers.neq,\\n Helpers.not,\\n Helpers.or,\\n Helpers.rshift,\\n Helpers.sub,\\n Helpers.uncheckedAdd,\\n Helpers.uncheckedSub,\\n Helpers.uncheckedUnary,\\n Helpers.xor\\n} for SD59x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n OPERATORS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes it possible to use these operators on the SD59x18 type.\\nusing {\\n Helpers.add as +,\\n Helpers.and2 as &,\\n Math.div as /,\\n Helpers.eq as ==,\\n Helpers.gt as >,\\n Helpers.gte as >=,\\n Helpers.lt as <,\\n Helpers.lte as <=,\\n Helpers.mod as %,\\n Math.mul as *,\\n Helpers.neq as !=,\\n Helpers.not as ~,\\n Helpers.or as |,\\n Helpers.sub as -,\\n Helpers.unary as -,\\n Helpers.xor as ^\\n} for SD59x18 global;\\n\",\"keccak256\":\"0xe03112d145dcd5863aff24e5f381debaae29d446acd5666f3d640e3d9af738d7\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as Errors;\\nimport { uMAX_SD1x18 } from \\\"../sd1x18/Constants.sol\\\";\\nimport { SD1x18 } from \\\"../sd1x18/ValueType.sol\\\";\\nimport { SD59x18 } from \\\"../sd59x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"../ud60x18/ValueType.sol\\\";\\nimport { UD2x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts a UD2x18 number into SD1x18.\\n/// - x must be less than or equal to `uMAX_SD1x18`.\\nfunction intoSD1x18(UD2x18 x) pure returns (SD1x18 result) {\\n uint64 xUint = UD2x18.unwrap(x);\\n if (xUint > uint64(uMAX_SD1x18)) {\\n revert Errors.PRBMath_UD2x18_IntoSD1x18_Overflow(x);\\n }\\n result = SD1x18.wrap(int64(xUint));\\n}\\n\\n/// @notice Casts a UD2x18 number into SD59x18.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of SD59x18.\\nfunction intoSD59x18(UD2x18 x) pure returns (SD59x18 result) {\\n result = SD59x18.wrap(int256(uint256(UD2x18.unwrap(x))));\\n}\\n\\n/// @notice Casts a UD2x18 number into UD60x18.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of UD60x18.\\nfunction intoUD60x18(UD2x18 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(UD2x18.unwrap(x));\\n}\\n\\n/// @notice Casts a UD2x18 number into uint128.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of uint128.\\nfunction intoUint128(UD2x18 x) pure returns (uint128 result) {\\n result = uint128(UD2x18.unwrap(x));\\n}\\n\\n/// @notice Casts a UD2x18 number into uint256.\\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of uint256.\\nfunction intoUint256(UD2x18 x) pure returns (uint256 result) {\\n result = uint256(UD2x18.unwrap(x));\\n}\\n\\n/// @notice Casts a UD2x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(UD2x18 x) pure returns (uint40 result) {\\n uint64 xUint = UD2x18.unwrap(x);\\n if (xUint > uint64(Common.MAX_UINT40)) {\\n revert Errors.PRBMath_UD2x18_IntoUint40_Overflow(x);\\n }\\n result = uint40(xUint);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction ud2x18(uint64 x) pure returns (UD2x18 result) {\\n result = UD2x18.wrap(x);\\n}\\n\\n/// @notice Unwrap a UD2x18 number into uint64.\\nfunction unwrap(UD2x18 x) pure returns (uint64 result) {\\n result = UD2x18.unwrap(x);\\n}\\n\\n/// @notice Wraps a uint64 number into UD2x18.\\nfunction wrap(uint64 x) pure returns (UD2x18 result) {\\n result = UD2x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x9b1a35d432ef951a415fae8098b3c609a99b630a3d5464b3c8e1efa8893eea07\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD2x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @dev Euler's number as a UD2x18 number.\\nUD2x18 constant E = UD2x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum value a UD2x18 number can have.\\nuint64 constant uMAX_UD2x18 = 18_446744073709551615;\\nUD2x18 constant MAX_UD2x18 = UD2x18.wrap(uMAX_UD2x18);\\n\\n/// @dev PI as a UD2x18 number.\\nUD2x18 constant PI = UD2x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of UD2x18.\\nUD2x18 constant UNIT = UD2x18.wrap(1e18);\\nuint64 constant uUNIT = 1e18;\\n\",\"keccak256\":\"0x29b0e050c865899e1fb9022b460a7829cdee248c44c4299f068ba80695eec3fc\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD2x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when trying to cast a UD2x18 number that doesn't fit in SD1x18.\\nerror PRBMath_UD2x18_IntoSD1x18_Overflow(UD2x18 x);\\n\\n/// @notice Thrown when trying to cast a UD2x18 number that doesn't fit in uint40.\\nerror PRBMath_UD2x18_IntoUint40_Overflow(UD2x18 x);\\n\",\"keccak256\":\"0xdf1e22f0b4c8032bcc8b7f63fe3984e1387f3dc7b2e9ab381822249f75376d33\",\"license\":\"MIT\"},\"@prb/math/src/ud2x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\n\\n/// @notice The unsigned 2.18-decimal fixed-point number representation, which can have up to 2 digits and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\\n/// type uint64. This is useful when end users want to use uint64 to save gas, e.g. with tight variable packing in contract\\n/// storage.\\ntype UD2x18 is uint64;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoSD1x18,\\n Casting.intoSD59x18,\\n Casting.intoUD60x18,\\n Casting.intoUint256,\\n Casting.intoUint128,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for UD2x18 global;\\n\",\"keccak256\":\"0x2802edc9869db116a0b5c490cc5f8554742f747183fa30ac5e9c80bb967e61a1\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Casting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Errors.sol\\\" as CastingErrors;\\nimport { MAX_UINT128, MAX_UINT40 } from \\\"../Common.sol\\\";\\nimport { uMAX_SD1x18 } from \\\"../sd1x18/Constants.sol\\\";\\nimport { SD1x18 } from \\\"../sd1x18/ValueType.sol\\\";\\nimport { uMAX_SD59x18 } from \\\"../sd59x18/Constants.sol\\\";\\nimport { SD59x18 } from \\\"../sd59x18/ValueType.sol\\\";\\nimport { uMAX_UD2x18 } from \\\"../ud2x18/Constants.sol\\\";\\nimport { UD2x18 } from \\\"../ud2x18/ValueType.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Casts a UD60x18 number into SD1x18.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `uMAX_SD1x18`.\\nfunction intoSD1x18(UD60x18 x) pure returns (SD1x18 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > uint256(int256(uMAX_SD1x18))) {\\n revert CastingErrors.PRBMath_UD60x18_IntoSD1x18_Overflow(x);\\n }\\n result = SD1x18.wrap(int64(uint64(xUint)));\\n}\\n\\n/// @notice Casts a UD60x18 number into UD2x18.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `uMAX_UD2x18`.\\nfunction intoUD2x18(UD60x18 x) pure returns (UD2x18 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > uMAX_UD2x18) {\\n revert CastingErrors.PRBMath_UD60x18_IntoUD2x18_Overflow(x);\\n }\\n result = UD2x18.wrap(uint64(xUint));\\n}\\n\\n/// @notice Casts a UD60x18 number into SD59x18.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `uMAX_SD59x18`.\\nfunction intoSD59x18(UD60x18 x) pure returns (SD59x18 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > uint256(uMAX_SD59x18)) {\\n revert CastingErrors.PRBMath_UD60x18_IntoSD59x18_Overflow(x);\\n }\\n result = SD59x18.wrap(int256(xUint));\\n}\\n\\n/// @notice Casts a UD60x18 number into uint128.\\n/// @dev This is basically an alias for {unwrap}.\\nfunction intoUint256(UD60x18 x) pure returns (uint256 result) {\\n result = UD60x18.unwrap(x);\\n}\\n\\n/// @notice Casts a UD60x18 number into uint128.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UINT128`.\\nfunction intoUint128(UD60x18 x) pure returns (uint128 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > MAX_UINT128) {\\n revert CastingErrors.PRBMath_UD60x18_IntoUint128_Overflow(x);\\n }\\n result = uint128(xUint);\\n}\\n\\n/// @notice Casts a UD60x18 number into uint40.\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UINT40`.\\nfunction intoUint40(UD60x18 x) pure returns (uint40 result) {\\n uint256 xUint = UD60x18.unwrap(x);\\n if (xUint > MAX_UINT40) {\\n revert CastingErrors.PRBMath_UD60x18_IntoUint40_Overflow(x);\\n }\\n result = uint40(xUint);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction ud(uint256 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(x);\\n}\\n\\n/// @notice Alias for {wrap}.\\nfunction ud60x18(uint256 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(x);\\n}\\n\\n/// @notice Unwraps a UD60x18 number into uint256.\\nfunction unwrap(UD60x18 x) pure returns (uint256 result) {\\n result = UD60x18.unwrap(x);\\n}\\n\\n/// @notice Wraps a uint256 number into the UD60x18 value type.\\nfunction wrap(uint256 x) pure returns (UD60x18 result) {\\n result = UD60x18.wrap(x);\\n}\\n\",\"keccak256\":\"0x5bb532da36921cbdac64d1f16de5d366ef1f664502e3b7c07d0ad06917551f85\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Constants.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n// NOTICE: the \\\"u\\\" prefix stands for \\\"unwrapped\\\".\\n\\n/// @dev Euler's number as a UD60x18 number.\\nUD60x18 constant E = UD60x18.wrap(2_718281828459045235);\\n\\n/// @dev The maximum input permitted in {exp}.\\nuint256 constant uEXP_MAX_INPUT = 133_084258667509499440;\\nUD60x18 constant EXP_MAX_INPUT = UD60x18.wrap(uEXP_MAX_INPUT);\\n\\n/// @dev The maximum input permitted in {exp2}.\\nuint256 constant uEXP2_MAX_INPUT = 192e18 - 1;\\nUD60x18 constant EXP2_MAX_INPUT = UD60x18.wrap(uEXP2_MAX_INPUT);\\n\\n/// @dev Half the UNIT number.\\nuint256 constant uHALF_UNIT = 0.5e18;\\nUD60x18 constant HALF_UNIT = UD60x18.wrap(uHALF_UNIT);\\n\\n/// @dev $log_2(10)$ as a UD60x18 number.\\nuint256 constant uLOG2_10 = 3_321928094887362347;\\nUD60x18 constant LOG2_10 = UD60x18.wrap(uLOG2_10);\\n\\n/// @dev $log_2(e)$ as a UD60x18 number.\\nuint256 constant uLOG2_E = 1_442695040888963407;\\nUD60x18 constant LOG2_E = UD60x18.wrap(uLOG2_E);\\n\\n/// @dev The maximum value a UD60x18 number can have.\\nuint256 constant uMAX_UD60x18 = 115792089237316195423570985008687907853269984665640564039457_584007913129639935;\\nUD60x18 constant MAX_UD60x18 = UD60x18.wrap(uMAX_UD60x18);\\n\\n/// @dev The maximum whole value a UD60x18 number can have.\\nuint256 constant uMAX_WHOLE_UD60x18 = 115792089237316195423570985008687907853269984665640564039457_000000000000000000;\\nUD60x18 constant MAX_WHOLE_UD60x18 = UD60x18.wrap(uMAX_WHOLE_UD60x18);\\n\\n/// @dev PI as a UD60x18 number.\\nUD60x18 constant PI = UD60x18.wrap(3_141592653589793238);\\n\\n/// @dev The unit number, which gives the decimal precision of UD60x18.\\nuint256 constant uUNIT = 1e18;\\nUD60x18 constant UNIT = UD60x18.wrap(uUNIT);\\n\\n/// @dev The unit number squared.\\nuint256 constant uUNIT_SQUARED = 1e36;\\nUD60x18 constant UNIT_SQUARED = UD60x18.wrap(uUNIT_SQUARED);\\n\\n/// @dev Zero as a UD60x18 number.\\nUD60x18 constant ZERO = UD60x18.wrap(0);\\n\",\"keccak256\":\"0x2b80d26153d3fdcfb3a9ca772d9309d31ed1275f5b8b54c3ffb54d3652b37d90\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Conversions.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { uMAX_UD60x18, uUNIT } from \\\"./Constants.sol\\\";\\nimport { PRBMath_UD60x18_Convert_Overflow } from \\\"./Errors.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Converts a UD60x18 number to a simple integer by dividing it by `UNIT`.\\n/// @dev The result is rounded toward zero.\\n/// @param x The UD60x18 number to convert.\\n/// @return result The same number in basic integer form.\\nfunction convert(UD60x18 x) pure returns (uint256 result) {\\n result = UD60x18.unwrap(x) / uUNIT;\\n}\\n\\n/// @notice Converts a simple integer to UD60x18 by multiplying it by `UNIT`.\\n///\\n/// @dev Requirements:\\n/// - x must be less than or equal to `MAX_UD60x18 / UNIT`.\\n///\\n/// @param x The basic integer to convert.\\n/// @param result The same number converted to UD60x18.\\nfunction convert(uint256 x) pure returns (UD60x18 result) {\\n if (x > uMAX_UD60x18 / uUNIT) {\\n revert PRBMath_UD60x18_Convert_Overflow(x);\\n }\\n unchecked {\\n result = UD60x18.wrap(x * uUNIT);\\n }\\n}\\n\",\"keccak256\":\"0xaf7fc2523413822de3b66ba339fe2884fb3b8c6f6cf38ec90a2c3e3aae71df6b\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Errors.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Thrown when ceiling a number overflows UD60x18.\\nerror PRBMath_UD60x18_Ceil_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when converting a basic integer to the fixed-point format overflows UD60x18.\\nerror PRBMath_UD60x18_Convert_Overflow(uint256 x);\\n\\n/// @notice Thrown when taking the natural exponent of a base greater than 133_084258667509499441.\\nerror PRBMath_UD60x18_Exp_InputTooBig(UD60x18 x);\\n\\n/// @notice Thrown when taking the binary exponent of a base greater than 192e18.\\nerror PRBMath_UD60x18_Exp2_InputTooBig(UD60x18 x);\\n\\n/// @notice Thrown when taking the geometric mean of two numbers and multiplying them overflows UD60x18.\\nerror PRBMath_UD60x18_Gm_Overflow(UD60x18 x, UD60x18 y);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\\nerror PRBMath_UD60x18_IntoSD1x18_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD59x18.\\nerror PRBMath_UD60x18_IntoSD59x18_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\\nerror PRBMath_UD60x18_IntoUD2x18_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\\nerror PRBMath_UD60x18_IntoUint128_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\\nerror PRBMath_UD60x18_IntoUint40_Overflow(UD60x18 x);\\n\\n/// @notice Thrown when taking the logarithm of a number less than 1.\\nerror PRBMath_UD60x18_Log_InputTooSmall(UD60x18 x);\\n\\n/// @notice Thrown when calculating the square root overflows UD60x18.\\nerror PRBMath_UD60x18_Sqrt_Overflow(UD60x18 x);\\n\",\"keccak256\":\"0xa8c60d4066248df22c49c882873efbc017344107edabc48c52209abbc39cb1e3\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Helpers.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport { wrap } from \\\"./Casting.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/// @notice Implements the checked addition operation (+) in the UD60x18 type.\\nfunction add(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() + y.unwrap());\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the UD60x18 type.\\nfunction and(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() & bits);\\n}\\n\\n/// @notice Implements the AND (&) bitwise operation in the UD60x18 type.\\nfunction and2(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() & y.unwrap());\\n}\\n\\n/// @notice Implements the equal operation (==) in the UD60x18 type.\\nfunction eq(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() == y.unwrap();\\n}\\n\\n/// @notice Implements the greater than operation (>) in the UD60x18 type.\\nfunction gt(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() > y.unwrap();\\n}\\n\\n/// @notice Implements the greater than or equal to operation (>=) in the UD60x18 type.\\nfunction gte(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() >= y.unwrap();\\n}\\n\\n/// @notice Implements a zero comparison check function in the UD60x18 type.\\nfunction isZero(UD60x18 x) pure returns (bool result) {\\n // This wouldn't work if x could be negative.\\n result = x.unwrap() == 0;\\n}\\n\\n/// @notice Implements the left shift operation (<<) in the UD60x18 type.\\nfunction lshift(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() << bits);\\n}\\n\\n/// @notice Implements the lower than operation (<) in the UD60x18 type.\\nfunction lt(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() < y.unwrap();\\n}\\n\\n/// @notice Implements the lower than or equal to operation (<=) in the UD60x18 type.\\nfunction lte(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() <= y.unwrap();\\n}\\n\\n/// @notice Implements the checked modulo operation (%) in the UD60x18 type.\\nfunction mod(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() % y.unwrap());\\n}\\n\\n/// @notice Implements the not equal operation (!=) in the UD60x18 type.\\nfunction neq(UD60x18 x, UD60x18 y) pure returns (bool result) {\\n result = x.unwrap() != y.unwrap();\\n}\\n\\n/// @notice Implements the NOT (~) bitwise operation in the UD60x18 type.\\nfunction not(UD60x18 x) pure returns (UD60x18 result) {\\n result = wrap(~x.unwrap());\\n}\\n\\n/// @notice Implements the OR (|) bitwise operation in the UD60x18 type.\\nfunction or(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() | y.unwrap());\\n}\\n\\n/// @notice Implements the right shift operation (>>) in the UD60x18 type.\\nfunction rshift(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() >> bits);\\n}\\n\\n/// @notice Implements the checked subtraction operation (-) in the UD60x18 type.\\nfunction sub(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() - y.unwrap());\\n}\\n\\n/// @notice Implements the unchecked addition operation (+) in the UD60x18 type.\\nfunction uncheckedAdd(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() + y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the unchecked subtraction operation (-) in the UD60x18 type.\\nfunction uncheckedSub(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n unchecked {\\n result = wrap(x.unwrap() - y.unwrap());\\n }\\n}\\n\\n/// @notice Implements the XOR (^) bitwise operation in the UD60x18 type.\\nfunction xor(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(x.unwrap() ^ y.unwrap());\\n}\\n\",\"keccak256\":\"0xf5faff881391d2c060029499a666cc5f0bea90a213150bb476fae8f02a5df268\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/Math.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"../Common.sol\\\" as Common;\\nimport \\\"./Errors.sol\\\" as Errors;\\nimport { wrap } from \\\"./Casting.sol\\\";\\nimport {\\n uEXP_MAX_INPUT,\\n uEXP2_MAX_INPUT,\\n uHALF_UNIT,\\n uLOG2_10,\\n uLOG2_E,\\n uMAX_UD60x18,\\n uMAX_WHOLE_UD60x18,\\n UNIT,\\n uUNIT,\\n uUNIT_SQUARED,\\n ZERO\\n} from \\\"./Constants.sol\\\";\\nimport { UD60x18 } from \\\"./ValueType.sol\\\";\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n MATHEMATICAL FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n/// @notice Calculates the arithmetic average of x and y using the following formula:\\n///\\n/// $$\\n/// avg(x, y) = (x & y) + ((xUint ^ yUint) / 2)\\n/// $$\\n///\\n/// In English, this is what this formula does:\\n///\\n/// 1. AND x and y.\\n/// 2. Calculate half of XOR x and y.\\n/// 3. Add the two results together.\\n///\\n/// This technique is known as SWAR, which stands for \\\"SIMD within a register\\\". You can read more about it here:\\n/// https://devblogs.microsoft.com/oldnewthing/20220207-00/?p=106223\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// @param x The first operand as a UD60x18 number.\\n/// @param y The second operand as a UD60x18 number.\\n/// @return result The arithmetic average as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction avg(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n uint256 yUint = y.unwrap();\\n unchecked {\\n result = wrap((xUint & yUint) + ((xUint ^ yUint) >> 1));\\n }\\n}\\n\\n/// @notice Yields the smallest whole number greater than or equal to x.\\n///\\n/// @dev This is optimized for fractional value inputs, because for every whole value there are (1e18 - 1) fractional\\n/// counterparts. See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n///\\n/// Requirements:\\n/// - x must be less than or equal to `MAX_WHOLE_UD60x18`.\\n///\\n/// @param x The UD60x18 number to ceil.\\n/// @param result The smallest whole number greater than or equal to x, as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ceil(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n if (xUint > uMAX_WHOLE_UD60x18) {\\n revert Errors.PRBMath_UD60x18_Ceil_Overflow(x);\\n }\\n\\n assembly (\\\"memory-safe\\\") {\\n // Equivalent to `x % UNIT`.\\n let remainder := mod(x, uUNIT)\\n\\n // Equivalent to `UNIT - remainder`.\\n let delta := sub(uUNIT, remainder)\\n\\n // Equivalent to `x + remainder > 0 ? delta : 0`.\\n result := add(x, mul(delta, gt(remainder, 0)))\\n }\\n}\\n\\n/// @notice Divides two UD60x18 numbers, returning a new UD60x18 number.\\n///\\n/// @dev Uses {Common.mulDiv} to enable overflow-safe multiplication and division.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv}.\\n///\\n/// @param x The numerator as a UD60x18 number.\\n/// @param y The denominator as a UD60x18 number.\\n/// @param result The quotient as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction div(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(Common.mulDiv(x.unwrap(), uUNIT, y.unwrap()));\\n}\\n\\n/// @notice Calculates the natural exponent of x using the following formula:\\n///\\n/// $$\\n/// e^x = 2^{x * log_2{e}}\\n/// $$\\n///\\n/// @dev Requirements:\\n/// - x must be less than 133_084258667509499441.\\n///\\n/// @param x The exponent as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n // This check prevents values greater than 192e18 from being passed to {exp2}.\\n if (xUint > uEXP_MAX_INPUT) {\\n revert Errors.PRBMath_UD60x18_Exp_InputTooBig(x);\\n }\\n\\n unchecked {\\n // Inline the fixed-point multiplication to save gas.\\n uint256 doubleUnitProduct = xUint * uLOG2_E;\\n result = exp2(wrap(doubleUnitProduct / uUNIT));\\n }\\n}\\n\\n/// @notice Calculates the binary exponent of x using the binary fraction method.\\n///\\n/// @dev See https://ethereum.stackexchange.com/q/79903/24693\\n///\\n/// Requirements:\\n/// - x must be less than 192e18.\\n/// - The result must fit in UD60x18.\\n///\\n/// @param x The exponent as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction exp2(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n // Numbers greater than or equal to 192e18 don't fit in the 192.64-bit format.\\n if (xUint > uEXP2_MAX_INPUT) {\\n revert Errors.PRBMath_UD60x18_Exp2_InputTooBig(x);\\n }\\n\\n // Convert x to the 192.64-bit fixed-point format.\\n uint256 x_192x64 = (xUint << 64) / uUNIT;\\n\\n // Pass x to the {Common.exp2} function, which uses the 192.64-bit fixed-point number representation.\\n result = wrap(Common.exp2(x_192x64));\\n}\\n\\n/// @notice Yields the greatest whole number less than or equal to x.\\n/// @dev Optimized for fractional value inputs, because every whole value has (1e18 - 1) fractional counterparts.\\n/// See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\\n/// @param x The UD60x18 number to floor.\\n/// @param result The greatest whole number less than or equal to x, as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction floor(UD60x18 x) pure returns (UD60x18 result) {\\n assembly (\\\"memory-safe\\\") {\\n // Equivalent to `x % UNIT`.\\n let remainder := mod(x, uUNIT)\\n\\n // Equivalent to `x - remainder > 0 ? remainder : 0)`.\\n result := sub(x, mul(remainder, gt(remainder, 0)))\\n }\\n}\\n\\n/// @notice Yields the excess beyond the floor of x using the odd function definition.\\n/// @dev See https://en.wikipedia.org/wiki/Fractional_part.\\n/// @param x The UD60x18 number to get the fractional part of.\\n/// @param result The fractional part of x as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction frac(UD60x18 x) pure returns (UD60x18 result) {\\n assembly (\\\"memory-safe\\\") {\\n result := mod(x, uUNIT)\\n }\\n}\\n\\n/// @notice Calculates the geometric mean of x and y, i.e. $\\\\sqrt{x * y}$, rounding down.\\n///\\n/// @dev Requirements:\\n/// - x * y must fit in UD60x18.\\n///\\n/// @param x The first operand as a UD60x18 number.\\n/// @param y The second operand as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction gm(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n uint256 yUint = y.unwrap();\\n if (xUint == 0 || yUint == 0) {\\n return ZERO;\\n }\\n\\n unchecked {\\n // Checking for overflow this way is faster than letting Solidity do it.\\n uint256 xyUint = xUint * yUint;\\n if (xyUint / xUint != yUint) {\\n revert Errors.PRBMath_UD60x18_Gm_Overflow(x, y);\\n }\\n\\n // We don't need to multiply the result by `UNIT` here because the x*y product picked up a factor of `UNIT`\\n // during multiplication. See the comments in {Common.sqrt}.\\n result = wrap(Common.sqrt(xyUint));\\n }\\n}\\n\\n/// @notice Calculates the inverse of x.\\n///\\n/// @dev Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x must not be zero.\\n///\\n/// @param x The UD60x18 number for which to calculate the inverse.\\n/// @return result The inverse as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction inv(UD60x18 x) pure returns (UD60x18 result) {\\n unchecked {\\n result = wrap(uUNIT_SQUARED / x.unwrap());\\n }\\n}\\n\\n/// @notice Calculates the natural logarithm of x using the following formula:\\n///\\n/// $$\\n/// ln{x} = log_2{x} / log_2{e}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n/// - The precision isn't sufficiently fine-grained to return exactly `UNIT` when the input is `E`.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The UD60x18 number for which to calculate the natural logarithm.\\n/// @return result The natural logarithm as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction ln(UD60x18 x) pure returns (UD60x18 result) {\\n unchecked {\\n // Inline the fixed-point multiplication to save gas. This is overflow-safe because the maximum value that\\n // {log2} can return is ~196_205294292027477728.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_E);\\n }\\n}\\n\\n/// @notice Calculates the common logarithm of x using the following formula:\\n///\\n/// $$\\n/// log_{10}{x} = log_2{x} / log_2{10}\\n/// $$\\n///\\n/// However, if x is an exact power of ten, a hard coded value is returned.\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {log2}.\\n///\\n/// @param x The UD60x18 number for which to calculate the common logarithm.\\n/// @return result The common logarithm as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log10(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n if (xUint < uUNIT) {\\n revert Errors.PRBMath_UD60x18_Log_InputTooSmall(x);\\n }\\n\\n // Note that the `mul` in this assembly block is the standard multiplication operation, not {UD60x18.mul}.\\n // prettier-ignore\\n assembly (\\\"memory-safe\\\") {\\n switch x\\n case 1 { result := mul(uUNIT, sub(0, 18)) }\\n case 10 { result := mul(uUNIT, sub(1, 18)) }\\n case 100 { result := mul(uUNIT, sub(2, 18)) }\\n case 1000 { result := mul(uUNIT, sub(3, 18)) }\\n case 10000 { result := mul(uUNIT, sub(4, 18)) }\\n case 100000 { result := mul(uUNIT, sub(5, 18)) }\\n case 1000000 { result := mul(uUNIT, sub(6, 18)) }\\n case 10000000 { result := mul(uUNIT, sub(7, 18)) }\\n case 100000000 { result := mul(uUNIT, sub(8, 18)) }\\n case 1000000000 { result := mul(uUNIT, sub(9, 18)) }\\n case 10000000000 { result := mul(uUNIT, sub(10, 18)) }\\n case 100000000000 { result := mul(uUNIT, sub(11, 18)) }\\n case 1000000000000 { result := mul(uUNIT, sub(12, 18)) }\\n case 10000000000000 { result := mul(uUNIT, sub(13, 18)) }\\n case 100000000000000 { result := mul(uUNIT, sub(14, 18)) }\\n case 1000000000000000 { result := mul(uUNIT, sub(15, 18)) }\\n case 10000000000000000 { result := mul(uUNIT, sub(16, 18)) }\\n case 100000000000000000 { result := mul(uUNIT, sub(17, 18)) }\\n case 1000000000000000000 { result := 0 }\\n case 10000000000000000000 { result := uUNIT }\\n case 100000000000000000000 { result := mul(uUNIT, 2) }\\n case 1000000000000000000000 { result := mul(uUNIT, 3) }\\n case 10000000000000000000000 { result := mul(uUNIT, 4) }\\n case 100000000000000000000000 { result := mul(uUNIT, 5) }\\n case 1000000000000000000000000 { result := mul(uUNIT, 6) }\\n case 10000000000000000000000000 { result := mul(uUNIT, 7) }\\n case 100000000000000000000000000 { result := mul(uUNIT, 8) }\\n case 1000000000000000000000000000 { result := mul(uUNIT, 9) }\\n case 10000000000000000000000000000 { result := mul(uUNIT, 10) }\\n case 100000000000000000000000000000 { result := mul(uUNIT, 11) }\\n case 1000000000000000000000000000000 { result := mul(uUNIT, 12) }\\n case 10000000000000000000000000000000 { result := mul(uUNIT, 13) }\\n case 100000000000000000000000000000000 { result := mul(uUNIT, 14) }\\n case 1000000000000000000000000000000000 { result := mul(uUNIT, 15) }\\n case 10000000000000000000000000000000000 { result := mul(uUNIT, 16) }\\n case 100000000000000000000000000000000000 { result := mul(uUNIT, 17) }\\n case 1000000000000000000000000000000000000 { result := mul(uUNIT, 18) }\\n case 10000000000000000000000000000000000000 { result := mul(uUNIT, 19) }\\n case 100000000000000000000000000000000000000 { result := mul(uUNIT, 20) }\\n case 1000000000000000000000000000000000000000 { result := mul(uUNIT, 21) }\\n case 10000000000000000000000000000000000000000 { result := mul(uUNIT, 22) }\\n case 100000000000000000000000000000000000000000 { result := mul(uUNIT, 23) }\\n case 1000000000000000000000000000000000000000000 { result := mul(uUNIT, 24) }\\n case 10000000000000000000000000000000000000000000 { result := mul(uUNIT, 25) }\\n case 100000000000000000000000000000000000000000000 { result := mul(uUNIT, 26) }\\n case 1000000000000000000000000000000000000000000000 { result := mul(uUNIT, 27) }\\n case 10000000000000000000000000000000000000000000000 { result := mul(uUNIT, 28) }\\n case 100000000000000000000000000000000000000000000000 { result := mul(uUNIT, 29) }\\n case 1000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 30) }\\n case 10000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 31) }\\n case 100000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 32) }\\n case 1000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 33) }\\n case 10000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 34) }\\n case 100000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 35) }\\n case 1000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 36) }\\n case 10000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 37) }\\n case 100000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 38) }\\n case 1000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 39) }\\n case 10000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 40) }\\n case 100000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 41) }\\n case 1000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 42) }\\n case 10000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 43) }\\n case 100000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 44) }\\n case 1000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 45) }\\n case 10000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 46) }\\n case 100000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 47) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 48) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 49) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 50) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 51) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 52) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 53) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 54) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 55) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 56) }\\n case 1000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 57) }\\n case 10000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 58) }\\n case 100000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 59) }\\n default { result := uMAX_UD60x18 }\\n }\\n\\n if (result.unwrap() == uMAX_UD60x18) {\\n unchecked {\\n // Inline the fixed-point division to save gas.\\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_10);\\n }\\n }\\n}\\n\\n/// @notice Calculates the binary logarithm of x using the iterative approximation algorithm:\\n///\\n/// $$\\n/// log_2{x} = n + log_2{y}, \\\\text{ where } y = x*2^{-n}, \\\\ y \\\\in [1, 2)\\n/// $$\\n///\\n/// For $0 \\\\leq x \\\\lt 1$, the input is inverted:\\n///\\n/// $$\\n/// log_2{x} = -log_2{\\\\frac{1}{x}}\\n/// $$\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Binary_logarithm#Iterative_approximation\\n///\\n/// Notes:\\n/// - Due to the lossy precision of the iterative approximation, the results are not perfectly accurate to the last decimal.\\n///\\n/// Requirements:\\n/// - x must be greater than zero.\\n///\\n/// @param x The UD60x18 number for which to calculate the binary logarithm.\\n/// @return result The binary logarithm as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction log2(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n if (xUint < uUNIT) {\\n revert Errors.PRBMath_UD60x18_Log_InputTooSmall(x);\\n }\\n\\n unchecked {\\n // Calculate the integer part of the logarithm.\\n uint256 n = Common.msb(xUint / uUNIT);\\n\\n // This is the integer part of the logarithm as a UD60x18 number. The operation can't overflow because n\\n // n is at most 255 and UNIT is 1e18.\\n uint256 resultUint = n * uUNIT;\\n\\n // Calculate $y = x * 2^{-n}$.\\n uint256 y = xUint >> n;\\n\\n // If y is the unit number, the fractional part is zero.\\n if (y == uUNIT) {\\n return wrap(resultUint);\\n }\\n\\n // Calculate the fractional part via the iterative approximation.\\n // The `delta >>= 1` part is equivalent to `delta /= 2`, but shifting bits is more gas efficient.\\n uint256 DOUBLE_UNIT = 2e18;\\n for (uint256 delta = uHALF_UNIT; delta > 0; delta >>= 1) {\\n y = (y * y) / uUNIT;\\n\\n // Is y^2 >= 2e18 and so in the range [2e18, 4e18)?\\n if (y >= DOUBLE_UNIT) {\\n // Add the 2^{-m} factor to the logarithm.\\n resultUint += delta;\\n\\n // Halve y, which corresponds to z/2 in the Wikipedia article.\\n y >>= 1;\\n }\\n }\\n result = wrap(resultUint);\\n }\\n}\\n\\n/// @notice Multiplies two UD60x18 numbers together, returning a new UD60x18 number.\\n///\\n/// @dev Uses {Common.mulDiv} to enable overflow-safe multiplication and division.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv}.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {Common.mulDiv}.\\n///\\n/// @dev See the documentation in {Common.mulDiv18}.\\n/// @param x The multiplicand as a UD60x18 number.\\n/// @param y The multiplier as a UD60x18 number.\\n/// @return result The product as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction mul(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n result = wrap(Common.mulDiv18(x.unwrap(), y.unwrap()));\\n}\\n\\n/// @notice Raises x to the power of y.\\n///\\n/// For $1 \\\\leq x \\\\leq \\\\infty$, the following standard formula is used:\\n///\\n/// $$\\n/// x^y = 2^{log_2{x} * y}\\n/// $$\\n///\\n/// For $0 \\\\leq x \\\\lt 1$, since the unsigned {log2} is undefined, an equivalent formula is used:\\n///\\n/// $$\\n/// i = \\\\frac{1}{x}\\n/// w = 2^{log_2{i} * y}\\n/// x^y = \\\\frac{1}{w}\\n/// $$\\n///\\n/// @dev Notes:\\n/// - Refer to the notes in {log2} and {mul}.\\n/// - Returns `UNIT` for 0^0.\\n/// - It may not perform well with very small values of x. Consider using SD59x18 as an alternative.\\n///\\n/// Requirements:\\n/// - Refer to the requirements in {exp2}, {log2}, and {mul}.\\n///\\n/// @param x The base as a UD60x18 number.\\n/// @param y The exponent as a UD60x18 number.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction pow(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n uint256 yUint = y.unwrap();\\n\\n // If both x and y are zero, the result is `UNIT`. If just x is zero, the result is always zero.\\n if (xUint == 0) {\\n return yUint == 0 ? UNIT : ZERO;\\n }\\n // If x is `UNIT`, the result is always `UNIT`.\\n else if (xUint == uUNIT) {\\n return UNIT;\\n }\\n\\n // If y is zero, the result is always `UNIT`.\\n if (yUint == 0) {\\n return UNIT;\\n }\\n // If y is `UNIT`, the result is always x.\\n else if (yUint == uUNIT) {\\n return x;\\n }\\n\\n // If x is greater than `UNIT`, use the standard formula.\\n if (xUint > uUNIT) {\\n result = exp2(mul(log2(x), y));\\n }\\n // Conversely, if x is less than `UNIT`, use the equivalent formula.\\n else {\\n UD60x18 i = wrap(uUNIT_SQUARED / xUint);\\n UD60x18 w = exp2(mul(log2(i), y));\\n result = wrap(uUNIT_SQUARED / w.unwrap());\\n }\\n}\\n\\n/// @notice Raises x (a UD60x18 number) to the power y (an unsigned basic integer) using the well-known\\n/// algorithm \\\"exponentiation by squaring\\\".\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Exponentiation_by_squaring.\\n///\\n/// Notes:\\n/// - Refer to the notes in {Common.mulDiv18}.\\n/// - Returns `UNIT` for 0^0.\\n///\\n/// Requirements:\\n/// - The result must fit in UD60x18.\\n///\\n/// @param x The base as a UD60x18 number.\\n/// @param y The exponent as a uint256.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction powu(UD60x18 x, uint256 y) pure returns (UD60x18 result) {\\n // Calculate the first iteration of the loop in advance.\\n uint256 xUint = x.unwrap();\\n uint256 resultUint = y & 1 > 0 ? xUint : uUNIT;\\n\\n // Equivalent to `for(y /= 2; y > 0; y /= 2)`.\\n for (y >>= 1; y > 0; y >>= 1) {\\n xUint = Common.mulDiv18(xUint, xUint);\\n\\n // Equivalent to `y % 2 == 1`.\\n if (y & 1 > 0) {\\n resultUint = Common.mulDiv18(resultUint, xUint);\\n }\\n }\\n result = wrap(resultUint);\\n}\\n\\n/// @notice Calculates the square root of x using the Babylonian method.\\n///\\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\\n///\\n/// Notes:\\n/// - The result is rounded toward zero.\\n///\\n/// Requirements:\\n/// - x must be less than `MAX_UD60x18 / UNIT`.\\n///\\n/// @param x The UD60x18 number for which to calculate the square root.\\n/// @return result The result as a UD60x18 number.\\n/// @custom:smtchecker abstract-function-nondet\\nfunction sqrt(UD60x18 x) pure returns (UD60x18 result) {\\n uint256 xUint = x.unwrap();\\n\\n unchecked {\\n if (xUint > uMAX_UD60x18 / uUNIT) {\\n revert Errors.PRBMath_UD60x18_Sqrt_Overflow(x);\\n }\\n // Multiply x by `UNIT` to account for the factor of `UNIT` picked up when multiplying two UD60x18 numbers.\\n // In this case, the two numbers are both the square root.\\n result = wrap(Common.sqrt(xUint * uUNIT));\\n }\\n}\\n\",\"keccak256\":\"0x462144667aac3f96d5f8dba7aa68fe4c5a3f61e1d7bbbc81bee21168817f9c09\",\"license\":\"MIT\"},\"@prb/math/src/ud60x18/ValueType.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.19;\\n\\nimport \\\"./Casting.sol\\\" as Casting;\\nimport \\\"./Helpers.sol\\\" as Helpers;\\nimport \\\"./Math.sol\\\" as Math;\\n\\n/// @notice The unsigned 60.18-decimal fixed-point number representation, which can have up to 60 digits and up to 18\\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the Solidity type uint256.\\n/// @dev The value type is defined here so it can be imported in all other files.\\ntype UD60x18 is uint256;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n CASTING\\n//////////////////////////////////////////////////////////////////////////*/\\n\\nusing {\\n Casting.intoSD1x18,\\n Casting.intoUD2x18,\\n Casting.intoSD59x18,\\n Casting.intoUint128,\\n Casting.intoUint256,\\n Casting.intoUint40,\\n Casting.unwrap\\n} for UD60x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n MATHEMATICAL FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes the functions in this library callable on the UD60x18 type.\\nusing {\\n Math.avg,\\n Math.ceil,\\n Math.div,\\n Math.exp,\\n Math.exp2,\\n Math.floor,\\n Math.frac,\\n Math.gm,\\n Math.inv,\\n Math.ln,\\n Math.log10,\\n Math.log2,\\n Math.mul,\\n Math.pow,\\n Math.powu,\\n Math.sqrt\\n} for UD60x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n HELPER FUNCTIONS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes the functions in this library callable on the UD60x18 type.\\nusing {\\n Helpers.add,\\n Helpers.and,\\n Helpers.eq,\\n Helpers.gt,\\n Helpers.gte,\\n Helpers.isZero,\\n Helpers.lshift,\\n Helpers.lt,\\n Helpers.lte,\\n Helpers.mod,\\n Helpers.neq,\\n Helpers.not,\\n Helpers.or,\\n Helpers.rshift,\\n Helpers.sub,\\n Helpers.uncheckedAdd,\\n Helpers.uncheckedSub,\\n Helpers.xor\\n} for UD60x18 global;\\n\\n/*//////////////////////////////////////////////////////////////////////////\\n OPERATORS\\n//////////////////////////////////////////////////////////////////////////*/\\n\\n// The global \\\"using for\\\" directive makes it possible to use these operators on the UD60x18 type.\\nusing {\\n Helpers.add as +,\\n Helpers.and2 as &,\\n Math.div as /,\\n Helpers.eq as ==,\\n Helpers.gt as >,\\n Helpers.gte as >=,\\n Helpers.lt as <,\\n Helpers.lte as <=,\\n Helpers.or as |,\\n Helpers.mod as %,\\n Math.mul as *,\\n Helpers.neq as !=,\\n Helpers.not as ~,\\n Helpers.sub as -,\\n Helpers.xor as ^\\n} for UD60x18 global;\\n\",\"keccak256\":\"0xdd873b5124180d9b71498b3a7fe93b1c08c368bec741f7d5f8e17f78a0b70f31\",\"license\":\"MIT\"},\"contracts/interfaces/IERC6551Registry.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.4;\\n\\ninterface IERC6551Registry {\\n /**\\n * @dev Creates a token bound account for a non-fungible token.\\n *\\n * If account has already been created, returns the account address without calling create2.\\n *\\n * Emits ERC6551AccountCreated event.\\n *\\n * @return account The address of the token bound account\\n */\\n function createAccount(\\n address implementation,\\n bytes32 salt,\\n uint256 chainId,\\n address tokenContract,\\n uint256 tokenId\\n ) external returns (address account);\\n}\\n\",\"keccak256\":\"0x64c52de8a8e68398e61dd8b42dda8e9af8cf6abf93bb85629c322440991ea568\",\"license\":\"MIT\"},\"contracts/interfaces/hats/HatsErrors.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface HatsErrors {\\n /// @notice Emitted when `user` is attempting to perform an action on `hatId` but is not wearing one of `hatId`'s admin hats\\n /// @dev Can be equivalent to `NotHatWearer(buildHatId(hatId))`, such as when emitted by `approveLinkTopHatToTree` or `relinkTopHatToTree`\\n error NotAdmin(address user, uint256 hatId);\\n\\n /// @notice Emitted when attempting to perform an action as or for an account that is not a wearer of a given hat\\n error NotHatWearer();\\n\\n /// @notice Emitted when attempting to perform an action that requires being either an admin or wearer of a given hat\\n error NotAdminOrWearer();\\n\\n /// @notice Emitted when attempting to mint `hatId` but `hatId`'s maxSupply has been reached\\n error AllHatsWorn(uint256 hatId);\\n\\n /// @notice Emitted when attempting to create a hat with a level 14 hat as its admin\\n error MaxLevelsReached();\\n\\n /// @notice Emitted when an attempted hat id has empty intermediate level(s)\\n error InvalidHatId();\\n\\n /// @notice Emitted when attempting to mint `hatId` to a `wearer` who is already wearing the hat\\n error AlreadyWearingHat(address wearer, uint256 hatId);\\n\\n /// @notice Emitted when attempting to mint a non-existant hat\\n error HatDoesNotExist(uint256 hatId);\\n\\n /// @notice Emmitted when attempting to mint or transfer a hat that is not active\\n error HatNotActive();\\n\\n /// @notice Emitted when attempting to mint or transfer a hat to an ineligible wearer\\n error NotEligible();\\n\\n /// @notice Emitted when attempting to check or set a hat's status from an account that is not that hat's toggle module\\n error NotHatsToggle();\\n\\n /// @notice Emitted when attempting to check or set a hat wearer's status from an account that is not that hat's eligibility module\\n error NotHatsEligibility();\\n\\n /// @notice Emitted when array arguments to a batch function have mismatching lengths\\n error BatchArrayLengthMismatch();\\n\\n /// @notice Emitted when attempting to mutate or transfer an immutable hat\\n error Immutable();\\n\\n /// @notice Emitted when attempting to change a hat's maxSupply to a value lower than its current supply\\n error NewMaxSupplyTooLow();\\n\\n /// @notice Emitted when attempting to link a tophat to a new admin for which the tophat serves as an admin\\n error CircularLinkage();\\n\\n /// @notice Emitted when attempting to link or relink a tophat to a separate tree\\n error CrossTreeLinkage();\\n\\n /// @notice Emitted when attempting to link a tophat without a request\\n error LinkageNotRequested();\\n\\n /// @notice Emitted when attempting to unlink a tophat that does not have a wearer\\n /// @dev This ensures that unlinking never results in a bricked tophat\\n error InvalidUnlink();\\n\\n /// @notice Emmited when attempting to change a hat's eligibility or toggle module to the zero address\\n error ZeroAddress();\\n\\n /// @notice Emmitted when attempting to change a hat's details or imageURI to a string with over 7000 bytes (~characters)\\n /// @dev This protects against a DOS attack where an admin iteratively extend's a hat's details or imageURI\\n /// to be so long that reading it exceeds the block gas limit, breaking `uri()` and `viewHat()`\\n error StringTooLong();\\n}\\n\",\"keccak256\":\"0x81b0056b7bed86eabc07c0e4a9655c586ddb8e6c128320593669b76efd5a08de\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/HatsEvents.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface HatsEvents {\\n /// @notice Emitted when a new hat is created\\n /// @param id The id for the new hat\\n /// @param details A description of the Hat\\n /// @param maxSupply The total instances of the Hat that can be worn at once\\n /// @param eligibility The address that can report on the Hat wearer's status\\n /// @param toggle The address that can deactivate the Hat\\n /// @param mutable_ Whether the hat's properties are changeable after creation\\n /// @param imageURI The image uri for this hat and the fallback for its\\n event HatCreated(\\n uint256 id,\\n string details,\\n uint32 maxSupply,\\n address eligibility,\\n address toggle,\\n bool mutable_,\\n string imageURI\\n );\\n\\n /// @notice Emitted when a hat wearer's standing is updated\\n /// @dev Eligibility is excluded since the source of truth for eligibility is the eligibility module and may change without a transaction\\n /// @param hatId The id of the wearer's hat\\n /// @param wearer The wearer's address\\n /// @param wearerStanding Whether the wearer is in good standing for the hat\\n event WearerStandingChanged(\\n uint256 hatId,\\n address wearer,\\n bool wearerStanding\\n );\\n\\n /// @notice Emitted when a hat's status is updated\\n /// @param hatId The id of the hat\\n /// @param newStatus Whether the hat is active\\n event HatStatusChanged(uint256 hatId, bool newStatus);\\n\\n /// @notice Emitted when a hat's details are updated\\n /// @param hatId The id of the hat\\n /// @param newDetails The updated details\\n event HatDetailsChanged(uint256 hatId, string newDetails);\\n\\n /// @notice Emitted when a hat's eligibility module is updated\\n /// @param hatId The id of the hat\\n /// @param newEligibility The updated eligibiliy module\\n event HatEligibilityChanged(uint256 hatId, address newEligibility);\\n\\n /// @notice Emitted when a hat's toggle module is updated\\n /// @param hatId The id of the hat\\n /// @param newToggle The updated toggle module\\n event HatToggleChanged(uint256 hatId, address newToggle);\\n\\n /// @notice Emitted when a hat's mutability is updated\\n /// @param hatId The id of the hat\\n event HatMutabilityChanged(uint256 hatId);\\n\\n /// @notice Emitted when a hat's maximum supply is updated\\n /// @param hatId The id of the hat\\n /// @param newMaxSupply The updated max supply\\n event HatMaxSupplyChanged(uint256 hatId, uint32 newMaxSupply);\\n\\n /// @notice Emitted when a hat's image URI is updated\\n /// @param hatId The id of the hat\\n /// @param newImageURI The updated image URI\\n event HatImageURIChanged(uint256 hatId, string newImageURI);\\n\\n /// @notice Emitted when a tophat linkage is requested by its admin\\n /// @param domain The domain of the tree tophat to link\\n /// @param newAdmin The tophat's would-be admin in the parent tree\\n event TopHatLinkRequested(uint32 domain, uint256 newAdmin);\\n\\n /// @notice Emitted when a tophat is linked to a another tree\\n /// @param domain The domain of the newly-linked tophat\\n /// @param newAdmin The tophat's new admin in the parent tree\\n event TopHatLinked(uint32 domain, uint256 newAdmin);\\n}\\n\",\"keccak256\":\"0x53413397d15e1636c3cd7bd667656b79bc2886785403b824bcd4ed122667f2c6\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/IHats.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\nimport \\\"./IHatsIdUtilities.sol\\\";\\nimport \\\"./HatsErrors.sol\\\";\\nimport \\\"./HatsEvents.sol\\\";\\n\\ninterface IHats is IHatsIdUtilities, HatsErrors, HatsEvents {\\n function mintTopHat(\\n address _target,\\n string memory _details,\\n string memory _imageURI\\n ) external returns (uint256 topHatId);\\n\\n function createHat(\\n uint256 _admin,\\n string calldata _details,\\n uint32 _maxSupply,\\n address _eligibility,\\n address _toggle,\\n bool _mutable,\\n string calldata _imageURI\\n ) external returns (uint256 newHatId);\\n\\n function batchCreateHats(\\n uint256[] calldata _admins,\\n string[] calldata _details,\\n uint32[] calldata _maxSupplies,\\n address[] memory _eligibilityModules,\\n address[] memory _toggleModules,\\n bool[] calldata _mutables,\\n string[] calldata _imageURIs\\n ) external returns (bool success);\\n\\n function getNextId(uint256 _admin) external view returns (uint256 nextId);\\n\\n function mintHat(\\n uint256 _hatId,\\n address _wearer\\n ) external returns (bool success);\\n\\n function batchMintHats(\\n uint256[] calldata _hatIds,\\n address[] calldata _wearers\\n ) external returns (bool success);\\n\\n function setHatStatus(\\n uint256 _hatId,\\n bool _newStatus\\n ) external returns (bool toggled);\\n\\n function checkHatStatus(uint256 _hatId) external returns (bool toggled);\\n\\n function setHatWearerStatus(\\n uint256 _hatId,\\n address _wearer,\\n bool _eligible,\\n bool _standing\\n ) external returns (bool updated);\\n\\n function checkHatWearerStatus(\\n uint256 _hatId,\\n address _wearer\\n ) external returns (bool updated);\\n\\n function renounceHat(uint256 _hatId) external;\\n\\n function transferHat(uint256 _hatId, address _from, address _to) external;\\n\\n /*//////////////////////////////////////////////////////////////\\n HATS ADMIN FUNCTIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n function makeHatImmutable(uint256 _hatId) external;\\n\\n function changeHatDetails(\\n uint256 _hatId,\\n string memory _newDetails\\n ) external;\\n\\n function changeHatEligibility(\\n uint256 _hatId,\\n address _newEligibility\\n ) external;\\n\\n function changeHatToggle(uint256 _hatId, address _newToggle) external;\\n\\n function changeHatImageURI(\\n uint256 _hatId,\\n string memory _newImageURI\\n ) external;\\n\\n function changeHatMaxSupply(uint256 _hatId, uint32 _newMaxSupply) external;\\n\\n function requestLinkTopHatToTree(\\n uint32 _topHatId,\\n uint256 _newAdminHat\\n ) external;\\n\\n function approveLinkTopHatToTree(\\n uint32 _topHatId,\\n uint256 _newAdminHat,\\n address _eligibility,\\n address _toggle,\\n string calldata _details,\\n string calldata _imageURI\\n ) external;\\n\\n function unlinkTopHatFromTree(uint32 _topHatId, address _wearer) external;\\n\\n function relinkTopHatWithinTree(\\n uint32 _topHatDomain,\\n uint256 _newAdminHat,\\n address _eligibility,\\n address _toggle,\\n string calldata _details,\\n string calldata _imageURI\\n ) external;\\n\\n /*//////////////////////////////////////////////////////////////\\n VIEW FUNCTIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n function viewHat(\\n uint256 _hatId\\n )\\n external\\n view\\n returns (\\n string memory details,\\n uint32 maxSupply,\\n uint32 supply,\\n address eligibility,\\n address toggle,\\n string memory imageURI,\\n uint16 lastHatId,\\n bool mutable_,\\n bool active\\n );\\n\\n function isWearerOfHat(\\n address _user,\\n uint256 _hatId\\n ) external view returns (bool isWearer);\\n\\n function isAdminOfHat(\\n address _user,\\n uint256 _hatId\\n ) external view returns (bool isAdmin);\\n\\n function isInGoodStanding(\\n address _wearer,\\n uint256 _hatId\\n ) external view returns (bool standing);\\n\\n function isEligible(\\n address _wearer,\\n uint256 _hatId\\n ) external view returns (bool eligible);\\n\\n function getHatEligibilityModule(\\n uint256 _hatId\\n ) external view returns (address eligibility);\\n\\n function getHatToggleModule(\\n uint256 _hatId\\n ) external view returns (address toggle);\\n\\n function getHatMaxSupply(\\n uint256 _hatId\\n ) external view returns (uint32 maxSupply);\\n\\n function hatSupply(uint256 _hatId) external view returns (uint32 supply);\\n\\n function getImageURIForHat(\\n uint256 _hatId\\n ) external view returns (string memory _uri);\\n\\n function balanceOf(\\n address wearer,\\n uint256 hatId\\n ) external view returns (uint256 balance);\\n\\n function balanceOfBatch(\\n address[] calldata _wearers,\\n uint256[] calldata _hatIds\\n ) external view returns (uint256[] memory);\\n\\n function uri(uint256 id) external view returns (string memory _uri);\\n}\\n\",\"keccak256\":\"0x2867004bddc5148fa1937f25c0403e5d9977583aaf50fdbdb74bd463f64f21c8\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/IHatsIdUtilities.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface IHatsIdUtilities {\\n function buildHatId(\\n uint256 _admin,\\n uint16 _newHat\\n ) external pure returns (uint256 id);\\n\\n function getHatLevel(uint256 _hatId) external view returns (uint32 level);\\n\\n function getLocalHatLevel(\\n uint256 _hatId\\n ) external pure returns (uint32 level);\\n\\n function isTopHat(uint256 _hatId) external view returns (bool _topHat);\\n\\n function isLocalTopHat(\\n uint256 _hatId\\n ) external pure returns (bool _localTopHat);\\n\\n function isValidHatId(\\n uint256 _hatId\\n ) external view returns (bool validHatId);\\n\\n function getAdminAtLevel(\\n uint256 _hatId,\\n uint32 _level\\n ) external view returns (uint256 admin);\\n\\n function getAdminAtLocalLevel(\\n uint256 _hatId,\\n uint32 _level\\n ) external pure returns (uint256 admin);\\n\\n function getTopHatDomain(\\n uint256 _hatId\\n ) external view returns (uint32 domain);\\n\\n function getTippyTopHatDomain(\\n uint32 _topHatDomain\\n ) external view returns (uint32 domain);\\n\\n function noCircularLinkage(\\n uint32 _topHatDomain,\\n uint256 _linkedAdmin\\n ) external view returns (bool notCircular);\\n\\n function sameTippyTopHatDomain(\\n uint32 _topHatDomain,\\n uint256 _newAdminHat\\n ) external view returns (bool sameDomain);\\n}\\n\",\"keccak256\":\"0x007fcc07b20bf84bacad1f9a2ddf4e30e1a8be961e144b7bef8e98a51781aee9\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/IHatsModuleFactory.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.19;\\n\\ninterface IHatsModuleFactory {\\n error HatsModuleFactory_ModuleAlreadyDeployed(\\n address implementation,\\n uint256 hatId,\\n bytes otherImmutableArgs,\\n uint256 saltNonce\\n );\\n\\n error BatchArrayLengthMismatch();\\n\\n event HatsModuleFactory_ModuleDeployed(\\n address implementation,\\n address instance,\\n uint256 hatId,\\n bytes otherImmutableArgs,\\n bytes initData,\\n uint256 saltNonce\\n );\\n\\n function HATS() external view returns (address);\\n\\n function version() external view returns (string memory);\\n\\n function createHatsModule(\\n address _implementation,\\n uint256 _hatId,\\n bytes calldata _otherImmutableArgs,\\n bytes calldata _initData,\\n uint256 _saltNonce\\n ) external returns (address _instance);\\n\\n function batchCreateHatsModule(\\n address[] calldata _implementations,\\n uint256[] calldata _hatIds,\\n bytes[] calldata _otherImmutableArgsArray,\\n bytes[] calldata _initDataArray,\\n uint256[] calldata _saltNonces\\n ) external returns (bool success);\\n\\n function getHatsModuleAddress(\\n address _implementation,\\n uint256 _hatId,\\n bytes calldata _otherImmutableArgs,\\n uint256 _saltNonce\\n ) external view returns (address);\\n\\n function deployed(\\n address _implementation,\\n uint256 _hatId,\\n bytes calldata _otherImmutableArgs,\\n uint256 _saltNonce\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x861faf40785cedb829243116d492653414a367853408a5c27d201522f6c3bfdd\",\"license\":\"MIT\"},\"contracts/interfaces/sablier/IAdminable.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\n/// @title IAdminable\\n/// @notice Contract module that provides a basic access control mechanism, with an admin that can be\\n/// granted exclusive access to specific functions. The inheriting contract must set the initial admin\\n/// in the constructor.\\ninterface IAdminable {\\n /*//////////////////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Emitted when the admin is transferred.\\n /// @param oldAdmin The address of the old admin.\\n /// @param newAdmin The address of the new admin.\\n event TransferAdmin(address indexed oldAdmin, address indexed newAdmin);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice The address of the admin account or contract.\\n function admin() external view returns (address);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n NON-CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Transfers the contract admin to a new address.\\n ///\\n /// @dev Notes:\\n /// - Does not revert if the admin is the same.\\n /// - This function can potentially leave the contract without an admin, thereby removing any\\n /// functionality that is only available to the admin.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the contract admin.\\n ///\\n /// @param newAdmin The address of the new admin.\\n function transferAdmin(address newAdmin) external;\\n}\\n\",\"keccak256\":\"0xa279c49e51228b571329164e36250e82b2c1378e8b549194ab7dd90fca9c3b2b\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/IERC4096.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 \\\"@openzeppelin/contracts/interfaces/IERC165.sol\\\";\\nimport {IERC721} from \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\n\\n/// @title ERC-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\",\"keccak256\":\"0xa34b9c52cbe36be860244f52256f1b05badf0cb797d208664b87337610d0e82d\",\"license\":\"MIT\"},\"contracts/interfaces/sablier/ISablierV2Lockup.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC4906} from \\\"./IERC4096.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IERC721Metadata} from \\\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\\\";\\nimport {UD60x18} from \\\"@prb/math/src/UD60x18.sol\\\";\\n\\nimport {Lockup} from \\\"./types/DataTypes.sol\\\";\\nimport {IAdminable} from \\\"./IAdminable.sol\\\";\\nimport {ISablierV2NFTDescriptor} from \\\"./ISablierV2NFTDescriptor.sol\\\";\\n\\n/// @title ISablierV2Lockup\\n/// @notice Common logic between all Sablier V2 Lockup contracts.\\ninterface ISablierV2Lockup is\\n IAdminable, // 0 inherited components\\n IERC4906, // 2 inherited components\\n IERC721Metadata // 2 inherited components\\n{\\n /*//////////////////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Emitted when the admin allows a new recipient contract to hook to Sablier.\\n /// @param admin The address of the current contract admin.\\n /// @param recipient The address of the recipient contract put on the allowlist.\\n event AllowToHook(address indexed admin, address recipient);\\n\\n /// @notice Emitted when a stream is canceled.\\n /// @param streamId The ID of the stream.\\n /// @param sender The address of the stream's sender.\\n /// @param recipient The address of the stream's recipient.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param senderAmount The amount of assets refunded to the stream's sender, denoted in units of the asset's\\n /// decimals.\\n /// @param recipientAmount The amount of assets left for the stream's recipient to withdraw, denoted in units of the\\n /// asset's decimals.\\n event CancelLockupStream(\\n uint256 streamId,\\n address indexed sender,\\n address indexed recipient,\\n IERC20 indexed asset,\\n uint128 senderAmount,\\n uint128 recipientAmount\\n );\\n\\n /// @notice Emitted when a sender gives up the right to cancel a stream.\\n /// @param streamId The ID of the stream.\\n event RenounceLockupStream(uint256 indexed streamId);\\n\\n /// @notice Emitted when the admin sets a new NFT descriptor contract.\\n /// @param admin The address of the current contract admin.\\n /// @param oldNFTDescriptor The address of the old NFT descriptor contract.\\n /// @param newNFTDescriptor The address of the new NFT descriptor contract.\\n event SetNFTDescriptor(\\n address indexed admin,\\n ISablierV2NFTDescriptor oldNFTDescriptor,\\n ISablierV2NFTDescriptor newNFTDescriptor\\n );\\n\\n /// @notice Emitted when assets are withdrawn from a stream.\\n /// @param streamId The ID of the stream.\\n /// @param to The address that has received the withdrawn assets.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param amount The amount of assets withdrawn, denoted in units of the asset's decimals.\\n event WithdrawFromLockupStream(\\n uint256 indexed streamId,\\n address indexed to,\\n IERC20 indexed asset,\\n uint128 amount\\n );\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Retrieves the address of the ERC-20 asset to be distributed.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getAsset(uint256 streamId) external view returns (IERC20 asset);\\n\\n /// @notice Retrieves the amount deposited in the stream, denoted in units of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getDepositedAmount(\\n uint256 streamId\\n ) external view returns (uint128 depositedAmount);\\n\\n /// @notice Retrieves the stream's end time, which is a Unix timestamp.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getEndTime(\\n uint256 streamId\\n ) external view returns (uint40 endTime);\\n\\n /// @notice Retrieves the stream's recipient.\\n /// @dev Reverts if the NFT has been burned.\\n /// @param streamId The stream ID for the query.\\n function getRecipient(\\n uint256 streamId\\n ) external view returns (address recipient);\\n\\n /// @notice Retrieves the amount refunded to the sender after a cancellation, denoted in units of the asset's\\n /// decimals. This amount is always zero unless the stream was canceled.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getRefundedAmount(\\n uint256 streamId\\n ) external view returns (uint128 refundedAmount);\\n\\n /// @notice Retrieves the stream's sender.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getSender(uint256 streamId) external view returns (address sender);\\n\\n /// @notice Retrieves the stream's start time, which is a Unix timestamp.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getStartTime(\\n uint256 streamId\\n ) external view returns (uint40 startTime);\\n\\n /// @notice Retrieves the amount withdrawn from the stream, denoted in units of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getWithdrawnAmount(\\n uint256 streamId\\n ) external view returns (uint128 withdrawnAmount);\\n\\n /// @notice Retrieves a flag indicating whether the provided address is a contract allowed to hook to Sablier\\n /// when a stream is canceled or when assets are withdrawn.\\n /// @dev See {ISablierLockupRecipient} for more information.\\n function isAllowedToHook(\\n address recipient\\n ) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream can be canceled. When the stream is cold, this\\n /// flag is always `false`.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isCancelable(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream is cold, i.e. settled, canceled, or depleted.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isCold(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream is depleted.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isDepleted(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream exists.\\n /// @dev Does not revert if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isStream(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream NFT can be transferred.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isTransferable(\\n uint256 streamId\\n ) external view returns (bool result);\\n\\n /// @notice Retrieves a flag indicating whether the stream is warm, i.e. either pending or streaming.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function isWarm(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Retrieves the maximum broker fee that can be charged by the broker, denoted as a fixed-point\\n /// number where 1e18 is 100%.\\n /// @dev This value is hard coded as a constant.\\n function MAX_BROKER_FEE() external view returns (UD60x18);\\n\\n /// @notice Counter for stream IDs, used in the create functions.\\n function nextStreamId() external view returns (uint256);\\n\\n /// @notice Contract that generates the non-fungible token URI.\\n function nftDescriptor() external view returns (ISablierV2NFTDescriptor);\\n\\n /// @notice Calculates the amount that the sender would be refunded if the stream were canceled, denoted in units\\n /// of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function refundableAmountOf(\\n uint256 streamId\\n ) external view returns (uint128 refundableAmount);\\n\\n /// @notice Retrieves the stream's status.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function statusOf(\\n uint256 streamId\\n ) external view returns (Lockup.Status status);\\n\\n /// @notice Calculates the amount streamed to the recipient, denoted in units of the asset's decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n ///\\n /// Notes:\\n /// - Upon cancellation of the stream, the amount streamed is calculated as the difference between the deposited\\n /// amount and the refunded amount. Ultimately, when the stream becomes depleted, the streamed amount is equivalent\\n /// to the total amount withdrawn.\\n ///\\n /// @param streamId The stream ID for the query.\\n function streamedAmountOf(\\n uint256 streamId\\n ) external view returns (uint128 streamedAmount);\\n\\n /// @notice Retrieves a flag indicating whether the stream was canceled.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function wasCanceled(uint256 streamId) external view returns (bool result);\\n\\n /// @notice Calculates the amount that the recipient can withdraw from the stream, denoted in units of the asset's\\n /// decimals.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function withdrawableAmountOf(\\n uint256 streamId\\n ) external view returns (uint128 withdrawableAmount);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n NON-CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Allows a recipient contract to hook to Sablier when a stream is canceled or when assets are withdrawn.\\n /// Useful for implementing contracts that hold streams on behalf of users, such as vaults or staking contracts.\\n ///\\n /// @dev Emits an {AllowToHook} event.\\n ///\\n /// Notes:\\n /// - Does not revert if the contract is already on the allowlist.\\n /// - This is an irreversible operation. The contract cannot be removed from the allowlist.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the contract admin.\\n /// - `recipient` must have a non-zero code size.\\n /// - `recipient` must implement {ISablierLockupRecipient}.\\n ///\\n /// @param recipient The address of the contract to allow for hooks.\\n function allowToHook(address recipient) external;\\n\\n /// @notice Burns the NFT associated with the stream.\\n ///\\n /// @dev Emits a {Transfer} event.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `streamId` must reference a depleted stream.\\n /// - The NFT must exist.\\n /// - `msg.sender` must be either the NFT owner or an approved third party.\\n ///\\n /// @param streamId The ID of the stream NFT to burn.\\n function burn(uint256 streamId) external;\\n\\n /// @notice Cancels the stream and refunds any remaining assets to the sender.\\n ///\\n /// @dev Emits a {Transfer}, {CancelLockupStream}, and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - If there any assets left for the recipient to withdraw, the stream is marked as canceled. Otherwise, the\\n /// stream is marked as depleted.\\n /// - This function attempts to invoke a hook on the recipient, if the resolved address is a contract.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - The stream must be warm and cancelable.\\n /// - `msg.sender` must be the stream's sender.\\n ///\\n /// @param streamId The ID of the stream to cancel.\\n function cancel(uint256 streamId) external;\\n\\n /// @notice Cancels multiple streams and refunds any remaining assets to the sender.\\n ///\\n /// @dev Emits multiple {Transfer}, {CancelLockupStream}, and {MetadataUpdate} events.\\n ///\\n /// Notes:\\n /// - Refer to the notes in {cancel}.\\n ///\\n /// Requirements:\\n /// - All requirements from {cancel} must be met for each stream.\\n ///\\n /// @param streamIds The IDs of the streams to cancel.\\n function cancelMultiple(uint256[] calldata streamIds) external;\\n\\n /// @notice Removes the right of the stream's sender to cancel the stream.\\n ///\\n /// @dev Emits a {RenounceLockupStream} and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - This is an irreversible operation.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `streamId` must reference a warm stream.\\n /// - `msg.sender` must be the stream's sender.\\n /// - The stream must be cancelable.\\n ///\\n /// @param streamId The ID of the stream to renounce.\\n function renounce(uint256 streamId) external;\\n\\n /// @notice Sets a new NFT descriptor contract, which produces the URI describing the Sablier stream NFTs.\\n ///\\n /// @dev Emits a {SetNFTDescriptor} and {BatchMetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - Does not revert if the NFT descriptor is the same.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the contract admin.\\n ///\\n /// @param newNFTDescriptor The address of the new NFT descriptor contract.\\n function setNFTDescriptor(\\n ISablierV2NFTDescriptor newNFTDescriptor\\n ) external;\\n\\n /// @notice Withdraws the provided amount of assets from the stream to the `to` address.\\n ///\\n /// @dev Emits a {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - This function attempts to call a hook on the recipient of the stream, unless `msg.sender` is the recipient.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `streamId` must not reference a null or depleted stream.\\n /// - `to` must not be the zero address.\\n /// - `amount` must be greater than zero and must not exceed the withdrawable amount.\\n /// - `to` must be the recipient if `msg.sender` is not the stream's recipient or an approved third party.\\n ///\\n /// @param streamId The ID of the stream to withdraw from.\\n /// @param to The address receiving the withdrawn assets.\\n /// @param amount The amount to withdraw, denoted in units of the asset's decimals.\\n function withdraw(uint256 streamId, address to, uint128 amount) external;\\n\\n /// @notice Withdraws the maximum withdrawable amount from the stream to the provided address `to`.\\n ///\\n /// @dev Emits a {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} event.\\n ///\\n /// Notes:\\n /// - Refer to the notes in {withdraw}.\\n ///\\n /// Requirements:\\n /// - Refer to the requirements in {withdraw}.\\n ///\\n /// @param streamId The ID of the stream to withdraw from.\\n /// @param to The address receiving the withdrawn assets.\\n /// @return withdrawnAmount The amount withdrawn, denoted in units of the asset's decimals.\\n function withdrawMax(\\n uint256 streamId,\\n address to\\n ) external returns (uint128 withdrawnAmount);\\n\\n /// @notice Withdraws the maximum withdrawable amount from the stream to the current recipient, and transfers the\\n /// NFT to `newRecipient`.\\n ///\\n /// @dev Emits a {WithdrawFromLockupStream} and a {Transfer} event.\\n ///\\n /// Notes:\\n /// - If the withdrawable amount is zero, the withdrawal is skipped.\\n /// - Refer to the notes in {withdraw}.\\n ///\\n /// Requirements:\\n /// - `msg.sender` must be the stream's recipient.\\n /// - Refer to the requirements in {withdraw}.\\n /// - Refer to the requirements in {IERC721.transferFrom}.\\n ///\\n /// @param streamId The ID of the stream NFT to transfer.\\n /// @param newRecipient The address of the new owner of the stream NFT.\\n /// @return withdrawnAmount The amount withdrawn, denoted in units of the asset's decimals.\\n function withdrawMaxAndTransfer(\\n uint256 streamId,\\n address newRecipient\\n ) external returns (uint128 withdrawnAmount);\\n\\n /// @notice Withdraws assets from streams to the recipient of each stream.\\n ///\\n /// @dev Emits multiple {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} events.\\n ///\\n /// Notes:\\n /// - This function attempts to call a hook on the recipient of each stream, unless `msg.sender` is the recipient.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - There must be an equal number of `streamIds` and `amounts`.\\n /// - Each stream ID in the array must not reference a null or depleted stream.\\n /// - Each amount in the array must be greater than zero and must not exceed the withdrawable amount.\\n ///\\n /// @param streamIds The IDs of the streams to withdraw from.\\n /// @param amounts The amounts to withdraw, denoted in units of the asset's decimals.\\n function withdrawMultiple(\\n uint256[] calldata streamIds,\\n uint128[] calldata amounts\\n ) external;\\n}\\n\",\"keccak256\":\"0x3e5541c38a901637bd310965deb5bbde73ef07fe4ee3c752cbec330c6b9d62a3\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/ISablierV2LockupLinear.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\nimport {Lockup, LockupLinear} from \\\"./types/DataTypes.sol\\\";\\nimport {ISablierV2Lockup} from \\\"./ISablierV2Lockup.sol\\\";\\n\\n/// @title ISablierV2LockupLinear\\n/// @notice Creates and manages Lockup streams with a linear distribution function.\\ninterface ISablierV2LockupLinear is ISablierV2Lockup {\\n /*//////////////////////////////////////////////////////////////////////////\\n EVENTS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Emitted when a stream is created.\\n /// @param streamId The ID of the newly created stream.\\n /// @param funder The address which funded the stream.\\n /// @param sender The address distributing the assets, which will have the ability to cancel the stream.\\n /// @param recipient The address receiving the assets.\\n /// @param amounts Struct encapsulating (i) the deposit amount, and (ii) the broker fee amount, both denoted\\n /// in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Boolean indicating whether the stream will be cancelable or not.\\n /// @param transferable Boolean indicating whether the stream NFT is transferable or not.\\n /// @param timestamps Struct encapsulating (i) the stream's start time, (ii) cliff time, and (iii) end time, all as\\n /// Unix timestamps.\\n /// @param broker The address of the broker who has helped create the stream, e.g. a front-end website.\\n event CreateLockupLinearStream(\\n uint256 streamId,\\n address funder,\\n address indexed sender,\\n address indexed recipient,\\n Lockup.CreateAmounts amounts,\\n IERC20 indexed asset,\\n bool cancelable,\\n bool transferable,\\n LockupLinear.Timestamps timestamps,\\n address broker\\n );\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Retrieves the stream's cliff time, which is a Unix timestamp. A value of zero means there\\n /// is no cliff.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n function getCliffTime(\\n uint256 streamId\\n ) external view returns (uint40 cliffTime);\\n\\n /// @notice Retrieves the full stream details.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n /// @return stream See the documentation in {DataTypes}.\\n function getStream(\\n uint256 streamId\\n ) external view returns (LockupLinear.StreamLL memory stream);\\n\\n /// @notice Retrieves the stream's start, cliff and end timestamps.\\n /// @dev Reverts if `streamId` references a null stream.\\n /// @param streamId The stream ID for the query.\\n /// @return timestamps See the documentation in {DataTypes}.\\n function getTimestamps(\\n uint256 streamId\\n ) external view returns (LockupLinear.Timestamps memory timestamps);\\n\\n /*//////////////////////////////////////////////////////////////////////////\\n NON-CONSTANT FUNCTIONS\\n //////////////////////////////////////////////////////////////////////////*/\\n\\n /// @notice Creates a stream by setting the start time to `block.timestamp`, and the end time to\\n /// the sum of `block.timestamp` and `params.durations.total`. The stream is funded by `msg.sender` and is wrapped\\n /// in an ERC-721 NFT.\\n ///\\n /// @dev Emits a {Transfer} and {CreateLockupLinearStream} event.\\n ///\\n /// Requirements:\\n /// - All requirements in {createWithTimestamps} must be met for the calculated parameters.\\n ///\\n /// @param params Struct encapsulating the function parameters, which are documented in {DataTypes}.\\n /// @return streamId The ID of the newly created stream.\\n function createWithDurations(\\n LockupLinear.CreateWithDurations calldata params\\n ) external returns (uint256 streamId);\\n\\n /// @notice Creates a stream with the provided start time and end time. The stream is funded by `msg.sender` and is\\n /// wrapped in an ERC-721 NFT.\\n ///\\n /// @dev Emits a {Transfer} and {CreateLockupLinearStream} event.\\n ///\\n /// Notes:\\n /// - A cliff time of zero means there is no cliff.\\n /// - As long as the times are ordered, it is not an error for the start or the cliff time to be in the past.\\n ///\\n /// Requirements:\\n /// - Must not be delegate called.\\n /// - `params.totalAmount` must be greater than zero.\\n /// - If set, `params.broker.fee` must not be greater than `MAX_BROKER_FEE`.\\n /// - `params.timestamps.start` must be greater than zero and less than `params.timestamps.end`.\\n /// - If set, `params.timestamps.cliff` must be greater than `params.timestamps.start` and less than\\n /// `params.timestamps.end`.\\n /// - `params.timestamps.end` must be in the future.\\n /// - `params.recipient` must not be the zero address.\\n /// - `msg.sender` must have allowed this contract to spend at least `params.totalAmount` assets.\\n ///\\n /// @param params Struct encapsulating the function parameters, which are documented in {DataTypes}.\\n /// @return streamId The ID of the newly created stream.\\n function createWithTimestamps(\\n LockupLinear.CreateWithTimestamps calldata params\\n ) external returns (uint256 streamId);\\n}\\n\",\"keccak256\":\"0x064264723114b1f1cf3953fd79874dfcbb42cf313857aee6d5e6b09a23e0010b\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/ISablierV2NFTDescriptor.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC721Metadata} from \\\"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\\\";\\n\\n/// @title ISablierV2NFTDescriptor\\n/// @notice This contract generates the URI describing the Sablier V2 stream NFTs.\\n/// @dev Inspired by Uniswap V3 Positions NFTs.\\ninterface ISablierV2NFTDescriptor {\\n /// @notice Produces the URI describing a particular stream NFT.\\n /// @dev This is a data URI with the JSON contents directly inlined.\\n /// @param sablier The address of the Sablier contract the stream was created in.\\n /// @param streamId The ID of the stream for which to produce a description.\\n /// @return uri The URI of the ERC721-compliant metadata.\\n function tokenURI(\\n IERC721Metadata sablier,\\n uint256 streamId\\n ) external view returns (string memory uri);\\n}\\n\",\"keccak256\":\"0x4ed430e553d14161e93efdaaacd1a502f49b38969c9d714b45d2e682a74fa0bc\",\"license\":\"GPL-3.0-or-later\"},\"contracts/interfaces/sablier/types/DataTypes.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-or-later\\npragma solidity >=0.8.22;\\n\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {UD2x18} from \\\"@prb/math/src/UD2x18.sol\\\";\\nimport {UD60x18} from \\\"@prb/math/src/UD60x18.sol\\\";\\n\\n// DataTypes.sol\\n//\\n// This file defines all structs used in V2 Core, most of which are organized under three namespaces:\\n//\\n// - Lockup\\n// - LockupDynamic\\n// - LockupLinear\\n// - LockupTranched\\n//\\n// You will notice that some structs contain \\\"slot\\\" annotations - they are used to indicate the\\n// storage layout of the struct. It is more gas efficient to group small data types together so\\n// that they fit in a single 32-byte slot.\\n\\n/// @notice Struct encapsulating the broker parameters passed to the create functions. Both can be set to zero.\\n/// @param account The address receiving the broker's fee.\\n/// @param fee The broker's percentage fee from the total amount, denoted as a fixed-point number where 1e18 is 100%.\\nstruct Broker {\\n address account;\\n UD60x18 fee;\\n}\\n\\n/// @notice Namespace for the structs used in both {SablierV2LockupLinear} and {SablierV2LockupDynamic}.\\nlibrary Lockup {\\n /// @notice Struct encapsulating the deposit, withdrawn, and refunded amounts, all denoted in units of the asset's\\n /// decimals.\\n /// @dev Because the deposited and the withdrawn amount are often read together, declaring them in the same slot\\n /// saves gas.\\n /// @param deposited The initial amount deposited in the stream, net of broker fee.\\n /// @param withdrawn The cumulative amount withdrawn from the stream.\\n /// @param refunded The amount refunded to the sender. Unless the stream was canceled, this is always zero.\\n struct Amounts {\\n // slot 0\\n uint128 deposited;\\n uint128 withdrawn;\\n // slot 1\\n uint128 refunded;\\n }\\n\\n /// @notice Struct encapsulating (i) the deposit amount and (ii) the broker fee amount, both denoted in units of the\\n /// asset's decimals.\\n /// @param deposit The amount to deposit in the stream.\\n /// @param brokerFee The broker fee amount.\\n struct CreateAmounts {\\n uint128 deposit;\\n uint128 brokerFee;\\n }\\n\\n /// @notice Enum representing the different statuses of a stream.\\n /// @custom:value0 PENDING Stream created but not started; assets are in a pending state.\\n /// @custom:value1 STREAMING Active stream where assets are currently being streamed.\\n /// @custom:value2 SETTLED All assets have been streamed; recipient is due to withdraw them.\\n /// @custom:value3 CANCELED Canceled stream; remaining assets await recipient's withdrawal.\\n /// @custom:value4 DEPLETED Depleted stream; all assets have been withdrawn and/or refunded.\\n enum Status {\\n PENDING,\\n STREAMING,\\n SETTLED,\\n CANCELED,\\n DEPLETED\\n }\\n\\n /// @notice A common data structure to be stored in all {SablierV2Lockup} models.\\n /// @dev The fields are arranged like this to save gas via tight variable packing.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream.\\n /// @param startTime The Unix timestamp indicating the stream's start.\\n /// @param endTime The Unix timestamp indicating the stream's end.\\n /// @param isCancelable Boolean indicating if the stream is cancelable.\\n /// @param wasCanceled Boolean indicating if the stream was canceled.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param isDepleted Boolean indicating if the stream is depleted.\\n /// @param isStream Boolean indicating if the struct entity exists.\\n /// @param isTransferable Boolean indicating if the stream NFT is transferable.\\n /// @param amounts Struct encapsulating the deposit, withdrawn, and refunded amounts, all denoted in units of the\\n /// asset's decimals.\\n struct Stream {\\n // slot 0\\n address sender;\\n uint40 startTime;\\n uint40 endTime;\\n bool isCancelable;\\n bool wasCanceled;\\n // slot 1\\n IERC20 asset;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n // slot 2 and 3\\n Lockup.Amounts amounts;\\n }\\n}\\n\\n/// @notice Namespace for the structs used in {SablierV2LockupDynamic}.\\nlibrary LockupDynamic {\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupDynamic.createWithDurations} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param segments Segments with durations used to compose the dynamic distribution function. Timestamps are\\n /// calculated by starting from `block.timestamp` and adding each duration to the previous timestamp.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithDurations {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n SegmentWithDuration[] segments;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupDynamic.createWithTimestamps} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param startTime The Unix timestamp indicating the stream's start.\\n /// @param segments Segments used to compose the dynamic distribution function.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithTimestamps {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n uint40 startTime;\\n Segment[] segments;\\n Broker broker;\\n }\\n\\n /// @notice Segment struct used in the Lockup Dynamic stream.\\n /// @param amount The amount of assets to be streamed in the segment, denoted in units of the asset's decimals.\\n /// @param exponent The exponent of the segment, denoted as a fixed-point number.\\n /// @param timestamp The Unix timestamp indicating the segment's end.\\n struct Segment {\\n // slot 0\\n uint128 amount;\\n UD2x18 exponent;\\n uint40 timestamp;\\n }\\n\\n /// @notice Segment struct used at runtime in {SablierV2LockupDynamic.createWithDurations}.\\n /// @param amount The amount of assets to be streamed in the segment, denoted in units of the asset's decimals.\\n /// @param exponent The exponent of the segment, denoted as a fixed-point number.\\n /// @param duration The time difference in seconds between the segment and the previous one.\\n struct SegmentWithDuration {\\n uint128 amount;\\n UD2x18 exponent;\\n uint40 duration;\\n }\\n\\n /// @notice Struct encapsulating the full details of a stream.\\n /// @dev Extends `Lockup.Stream` by including the recipient and the segments.\\n struct StreamLD {\\n address sender;\\n address recipient;\\n uint40 startTime;\\n uint40 endTime;\\n bool isCancelable;\\n bool wasCanceled;\\n IERC20 asset;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n Lockup.Amounts amounts;\\n Segment[] segments;\\n }\\n\\n /// @notice Struct encapsulating the LockupDynamic timestamps.\\n /// @param start The Unix timestamp indicating the stream's start.\\n /// @param end The Unix timestamp indicating the stream's end.\\n struct Timestamps {\\n uint40 start;\\n uint40 end;\\n }\\n}\\n\\n/// @notice Namespace for the structs used in {SablierV2LockupLinear}.\\nlibrary LockupLinear {\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupLinear.createWithDurations} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param durations Struct encapsulating (i) cliff period duration and (ii) total stream duration, both in seconds.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithDurations {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n Durations durations;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupLinear.createWithTimestamps} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param timestamps Struct encapsulating (i) the stream's start time, (ii) cliff time, and (iii) end time, all as\\n /// Unix timestamps.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithTimestamps {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n Timestamps timestamps;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the cliff duration and the total duration.\\n /// @param cliff The cliff duration in seconds.\\n /// @param total The total duration in seconds.\\n struct Durations {\\n uint40 cliff;\\n uint40 total;\\n }\\n\\n /// @notice Struct encapsulating the full details of a stream.\\n /// @dev Extends `Lockup.Stream` by including the recipient and the cliff time.\\n struct StreamLL {\\n address sender;\\n address recipient;\\n uint40 startTime;\\n bool isCancelable;\\n bool wasCanceled;\\n IERC20 asset;\\n uint40 endTime;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n Lockup.Amounts amounts;\\n uint40 cliffTime;\\n }\\n\\n /// @notice Struct encapsulating the LockupLinear timestamps.\\n /// @param start The Unix timestamp for the stream's start.\\n /// @param cliff The Unix timestamp for the cliff period's end. A value of zero means there is no cliff.\\n /// @param end The Unix timestamp for the stream's end.\\n struct Timestamps {\\n uint40 start;\\n uint40 cliff;\\n uint40 end;\\n }\\n}\\n\\n/// @notice Namespace for the structs used in {SablierV2LockupTranched}.\\nlibrary LockupTranched {\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupTranched.createWithDurations} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param tranches Tranches with durations used to compose the tranched distribution function. Timestamps are\\n /// calculated by starting from `block.timestamp` and adding each duration to the previous timestamp.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithDurations {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n TrancheWithDuration[] tranches;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupTranched.createWithTimestamps} function.\\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\\n /// the same as `msg.sender`.\\n /// @param recipient The address receiving the assets.\\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\\n /// broker fee, denoted in units of the asset's decimals.\\n /// @param asset The contract address of the ERC-20 asset to be distributed.\\n /// @param cancelable Indicates if the stream is cancelable.\\n /// @param transferable Indicates if the stream NFT is transferable.\\n /// @param startTime The Unix timestamp indicating the stream's start.\\n /// @param tranches Tranches used to compose the tranched distribution function.\\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\\n struct CreateWithTimestamps {\\n address sender;\\n address recipient;\\n uint128 totalAmount;\\n IERC20 asset;\\n bool cancelable;\\n bool transferable;\\n uint40 startTime;\\n Tranche[] tranches;\\n Broker broker;\\n }\\n\\n /// @notice Struct encapsulating the full details of a stream.\\n /// @dev Extends `Lockup.Stream` by including the recipient and the tranches.\\n struct StreamLT {\\n address sender;\\n address recipient;\\n uint40 startTime;\\n uint40 endTime;\\n bool isCancelable;\\n bool wasCanceled;\\n IERC20 asset;\\n bool isDepleted;\\n bool isStream;\\n bool isTransferable;\\n Lockup.Amounts amounts;\\n Tranche[] tranches;\\n }\\n\\n /// @notice Struct encapsulating the LockupTranched timestamps.\\n /// @param start The Unix timestamp indicating the stream's start.\\n /// @param end The Unix timestamp indicating the stream's end.\\n struct Timestamps {\\n uint40 start;\\n uint40 end;\\n }\\n\\n /// @notice Tranche struct used in the Lockup Tranched stream.\\n /// @param amount The amount of assets to be unlocked in the tranche, denoted in units of the asset's decimals.\\n /// @param timestamp The Unix timestamp indicating the tranche's end.\\n struct Tranche {\\n // slot 0\\n uint128 amount;\\n uint40 timestamp;\\n }\\n\\n /// @notice Tranche struct used at runtime in {SablierV2LockupTranched.createWithDurations}.\\n /// @param amount The amount of assets to be unlocked in the tranche, denoted in units of the asset's decimals.\\n /// @param duration The time difference in seconds between the tranche and the previous one.\\n struct TrancheWithDuration {\\n uint128 amount;\\n uint40 duration;\\n }\\n}\\n\",\"keccak256\":\"0x727722c0ec71a76a947b935c9dfcac8fd846d6c3547dfbc8739c7109f3b95068\",\"license\":\"GPL-3.0-or-later\"},\"contracts/modules/DecentHatsModificationModule.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.8.28;\\n\\nimport {DecentHatsModuleUtils} from \\\"./DecentHatsModuleUtils.sol\\\";\\n\\ncontract DecentHatsModificationModule is DecentHatsModuleUtils {\\n /**\\n * @notice Creates a new termed or untermed role hat and any streams on it.\\n *\\n * @notice This contract should be enabled a module on the Safe for which the role is to be created, and disabled after.\\n *\\n * @dev Stream funds on untermed Roles are targeted at the hat's smart account. In order to withdraw funds from the stream, the\\n * hat's smart account must be the one call to `withdraw-` on the Sablier contract, setting the recipient arg to its wearer.\\n *\\n * @dev Stream funds on termed Roles are targeted directly at the nominated wearer.\\n * The wearer should directly call `withdraw-` on the Sablier contract.\\n *\\n * @dev Role hat creation, minting, smart account creation and stream creation are handled here in order\\n * to avoid a race condition where not more than one active proposal to create a new role can exist at a time.\\n * See: https://github.com/decentdao/decent-interface/issues/2402\\n *\\n * @param roleHatsParams An array of params for each role hat to be created.\\n */\\n function createRoleHats(\\n CreateRoleHatsParams calldata roleHatsParams\\n ) external {\\n _processRoleHats(roleHatsParams);\\n }\\n}\\n\",\"keccak256\":\"0x45b9470e000a416382deebea44a8c8734a2d6b453e8c7fbba5ea9bc6fdd4917c\",\"license\":\"MIT\"},\"contracts/modules/DecentHatsModuleUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity >=0.8.28;\\n\\nimport {Enum} from \\\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\\\";\\nimport {IAvatar} from \\\"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol\\\";\\nimport {IERC20} from \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport {IERC6551Registry} from \\\"../interfaces/IERC6551Registry.sol\\\";\\nimport {IHats} from \\\"../interfaces/hats/IHats.sol\\\";\\nimport {LockupLinear, Broker} from \\\"../interfaces/sablier/types/DataTypes.sol\\\";\\nimport {IHatsModuleFactory} from \\\"../interfaces/hats/IHatsModuleFactory.sol\\\";\\nimport {ISablierV2LockupLinear} from \\\"../interfaces/sablier/ISablierV2LockupLinear.sol\\\";\\nimport {Strings} from \\\"@openzeppelin/contracts/utils/Strings.sol\\\";\\n\\nabstract contract DecentHatsModuleUtils {\\n bytes32 public constant SALT =\\n 0x5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b5072;\\n\\n struct SablierStreamParams {\\n ISablierV2LockupLinear sablier;\\n address sender;\\n address asset;\\n LockupLinear.Timestamps timestamps;\\n Broker broker;\\n uint128 totalAmount;\\n bool cancelable;\\n bool transferable;\\n }\\n\\n struct HatParams {\\n address wearer;\\n string details;\\n string imageURI;\\n SablierStreamParams[] sablierStreamsParams;\\n uint128 termEndDateTs; // If 0, this is an untermed Hat\\n uint32 maxSupply;\\n bool isMutable;\\n }\\n\\n struct CreateRoleHatsParams {\\n IHats hatsProtocol;\\n IERC6551Registry erc6551Registry;\\n address hatsAccountImplementation;\\n uint256 topHatId;\\n address topHatAccount;\\n address keyValuePairs;\\n IHatsModuleFactory hatsModuleFactory;\\n address hatsElectionsEligibilityImplementation;\\n uint256 adminHatId;\\n HatParams[] hats;\\n }\\n\\n function _processRoleHats(\\n CreateRoleHatsParams memory roleHatsParams\\n ) internal {\\n for (uint256 i = 0; i < roleHatsParams.hats.length; ) {\\n HatParams memory hatParams = roleHatsParams.hats[i];\\n\\n // Create eligibility module if needed\\n address eligibilityAddress = _createEligibilityModule(\\n roleHatsParams.hatsProtocol,\\n roleHatsParams.hatsModuleFactory,\\n roleHatsParams.hatsElectionsEligibilityImplementation,\\n roleHatsParams.topHatId,\\n roleHatsParams.topHatAccount,\\n roleHatsParams.adminHatId,\\n hatParams.termEndDateTs\\n );\\n\\n // Create and Mint the Role Hat\\n uint256 hatId = _createAndMintHat(\\n roleHatsParams.hatsProtocol,\\n roleHatsParams.adminHatId,\\n hatParams,\\n eligibilityAddress,\\n roleHatsParams.topHatAccount\\n );\\n\\n // Get the stream recipient (based on termed or not)\\n address streamRecipient = _setupStreamRecipient(\\n roleHatsParams.erc6551Registry,\\n roleHatsParams.hatsAccountImplementation,\\n address(roleHatsParams.hatsProtocol),\\n hatParams.termEndDateTs,\\n hatParams.wearer,\\n hatId\\n );\\n\\n // Create streams\\n _processSablierStreams(\\n hatParams.sablierStreamsParams,\\n streamRecipient,\\n roleHatsParams.keyValuePairs,\\n hatId\\n );\\n\\n unchecked {\\n ++i;\\n }\\n }\\n }\\n\\n function _createEligibilityModule(\\n IHats hatsProtocol,\\n IHatsModuleFactory hatsModuleFactory,\\n address hatsElectionsEligibilityImplementation,\\n uint256 topHatId,\\n address topHatAccount,\\n uint256 adminHatId,\\n uint128 termEndDateTs\\n ) private returns (address) {\\n // If the Hat is termed, create the eligibility module\\n if (termEndDateTs != 0) {\\n return\\n hatsModuleFactory.createHatsModule(\\n hatsElectionsEligibilityImplementation,\\n hatsProtocol.getNextId(adminHatId),\\n abi.encode(topHatId, uint256(0)), // [BALLOT_BOX_ID, ADMIN_HAT_ID]\\n abi.encode(termEndDateTs),\\n uint256(SALT)\\n );\\n }\\n\\n // Otherwise, return the Top Hat account\\n return topHatAccount;\\n }\\n\\n function _createAndMintHat(\\n IHats hatsProtocol,\\n uint256 adminHatId,\\n HatParams memory hat,\\n address eligibilityAddress,\\n address topHatAccount\\n ) private returns (uint256) {\\n // Grab the next Hat ID (before creating it)\\n uint256 hatId = hatsProtocol.getNextId(adminHatId);\\n\\n // Create the new Hat\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"createHat(uint256,string,uint32,address,address,bool,string)\\\",\\n adminHatId,\\n hat.details,\\n hat.maxSupply,\\n eligibilityAddress,\\n topHatAccount,\\n hat.isMutable,\\n hat.imageURI\\n ),\\n Enum.Operation.Call\\n );\\n\\n // If the Hat is termed, nominate the wearer as the eligible member\\n if (hat.termEndDateTs != 0) {\\n address[] memory nominatedWearers = new address[](1);\\n nominatedWearers[0] = hat.wearer;\\n\\n IAvatar(msg.sender).execTransactionFromModule(\\n eligibilityAddress,\\n 0,\\n abi.encodeWithSignature(\\n \\\"elect(uint128,address[])\\\",\\n hat.termEndDateTs,\\n nominatedWearers\\n ),\\n Enum.Operation.Call\\n );\\n }\\n\\n // Mint the Hat\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(hatsProtocol),\\n 0,\\n abi.encodeWithSignature(\\n \\\"mintHat(uint256,address)\\\",\\n hatId,\\n hat.wearer\\n ),\\n Enum.Operation.Call\\n );\\n return hatId;\\n }\\n\\n // Exists to avoid stack too deep errors\\n function _setupStreamRecipient(\\n IERC6551Registry erc6551Registry,\\n address hatsAccountImplementation,\\n address hatsProtocol,\\n uint128 termEndDateTs,\\n address wearer,\\n uint256 hatId\\n ) private returns (address) {\\n // If the hat is termed, the wearer is the stream recipient\\n if (termEndDateTs != 0) {\\n return wearer;\\n }\\n\\n // Otherwise, the Hat's smart account is the stream recipient\\n return\\n erc6551Registry.createAccount(\\n hatsAccountImplementation,\\n SALT,\\n block.chainid,\\n hatsProtocol,\\n hatId\\n );\\n }\\n\\n function _processSablierStreams(\\n SablierStreamParams[] memory streamParams,\\n address streamRecipient,\\n address keyValuePairs,\\n uint256 hatId\\n ) private {\\n for (uint256 i = 0; i < streamParams.length; ) {\\n SablierStreamParams memory sablierStreamParams = streamParams[i];\\n\\n // Approve tokens for Sablier\\n IAvatar(msg.sender).execTransactionFromModule(\\n sablierStreamParams.asset,\\n 0,\\n abi.encodeWithSignature(\\n \\\"approve(address,uint256)\\\",\\n sablierStreamParams.sablier,\\n sablierStreamParams.totalAmount\\n ),\\n Enum.Operation.Call\\n );\\n uint256 streamId = ISablierV2LockupLinear(\\n sablierStreamParams.sablier\\n ).nextStreamId();\\n\\n // Proxy the Sablier call through IAvatar\\n IAvatar(msg.sender).execTransactionFromModule(\\n address(sablierStreamParams.sablier),\\n 0,\\n abi.encodeWithSignature(\\n \\\"createWithTimestamps((address,address,uint128,address,bool,bool,(uint40,uint40,uint40),(address,uint256)))\\\",\\n LockupLinear.CreateWithTimestamps({\\n sender: sablierStreamParams.sender,\\n recipient: streamRecipient,\\n totalAmount: sablierStreamParams.totalAmount,\\n asset: IERC20(sablierStreamParams.asset),\\n cancelable: sablierStreamParams.cancelable,\\n transferable: sablierStreamParams.transferable,\\n timestamps: sablierStreamParams.timestamps,\\n broker: sablierStreamParams.broker\\n })\\n ),\\n Enum.Operation.Call\\n );\\n\\n // Update KeyValuePairs with the stream ID and Hat ID\\n string[] memory keys = new string[](1);\\n string[] memory values = new string[](1);\\n keys[0] = \\\"hatIdToStreamId\\\";\\n values[0] = string(\\n abi.encodePacked(\\n Strings.toString(hatId),\\n \\\":\\\",\\n Strings.toString(streamId)\\n )\\n );\\n\\n IAvatar(msg.sender).execTransactionFromModule(\\n keyValuePairs,\\n 0,\\n abi.encodeWithSignature(\\n \\\"updateValues(string[],string[])\\\",\\n keys,\\n values\\n ),\\n Enum.Operation.Call\\n );\\n\\n unchecked {\\n ++i;\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xcf91d6de2291dd71d2491292ee2d1120c444b8f4f11b8c31429ed4c630013e69\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6080604052348015600f57600080fd5b506116d88061001f6000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80630ad5e4271461003b578063ba9a91a514610050575b600080fd5b61004e610049366004610c55565b610089565b005b6100777f5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b507281565b60405190815260200160405180910390f35b61009a6100958261118c565b61009d565b50565b60005b8161012001515181101561016857600082610120015182815181106100c7576100c7611260565b6020026020010151905060006100ff84600001518560c001518660e0015187606001518860800151896101000151886080015161016c565b9050600061011d8560000151866101000151858589608001516102e5565b905060006101438660200151876040015188600001518760800151886000015187610617565b90506101598460600151828860a00151856106e3565b846001019450505050506100a0565b5050565b60006001600160801b038216156102d757866001600160a01b0316632f7fb7b6878a6001600160a01b0316631183a8c0876040518263ffffffff1660e01b81526004016101bb91815260200190565b602060405180830381865afa1580156101d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101fc9190611276565b886000604051602001610219929190918252602082015260400190565b60408051601f198184030181528282526001600160801b0389166020840152910160408051601f19818403018152908290526001600160e01b031960e087901b16825261028d949392917f5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b5072906004016112df565b6020604051808303816000875af11580156102ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102d0919061132b565b90506102da565b50825b979650505050505050565b60405162460ea360e61b81526004810185905260009081906001600160a01b03881690631183a8c090602401602060405180830381865afa15801561032e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103529190611276565b9050336001600160a01b031663468721a78860008989602001518a60a001518a8a8d60c001518e604001516040516024016103939796959493929190611348565b60408051601f198184030181529181526020820180516001600160e01b0316635829492f60e11b1790525160e085901b6001600160e01b03191681526103e1939291906000906004016113ac565b6020604051808303816000875af1158015610400573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104249190611402565b5060808501516001600160801b03161561054f576040805160018082528183019092526000916020808301908036833701905050905085600001518160008151811061047257610472611260565b60200260200101906001600160a01b031690816001600160a01b031681525050336001600160a01b031663468721a78660008960800151856040516024016104bb92919061141f565b60408051601f198184030181529181526020820180516001600160e01b0316634a231cef60e01b1790525160e085901b6001600160e01b0319168152610509939291906000906004016113ac565b6020604051808303816000875af1158015610528573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061054c9190611402565b50505b8451604051602481018390526001600160a01b039091166044820152339063468721a790899060009060640160408051601f198184030181529181526020820180516001600160e01b031663320fbbb760e11b1790525160e085901b6001600160e01b03191681526105c9939291906000906004016113ac565b6020604051808303816000875af11580156105e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061060c9190611402565b509695505050505050565b60006001600160801b0384161561062f5750816106d9565b604051638a54c52f60e01b81526001600160a01b0387811660048301527f5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b50726024830152466044830152868116606483015260848201849052881690638a54c52f9060a4016020604051808303816000875af11580156106b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106d6919061132b565b90505b9695505050505050565b60005b8451811015610b4657600085828151811061070357610703611260565b60200260200101519050336001600160a01b031663468721a78260400151600084600001518560a0015160405160240161075b9291906001600160a01b039290921682526001600160801b0316602082015260400190565b60408051601f198184030181529181526020820180516001600160e01b031663095ea7b360e01b1790525160e085901b6001600160e01b03191681526107a9939291906000906004016113ac565b6020604051808303816000875af11580156107c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ec9190611402565b50600081600001516001600160a01b0316631e99d5696040518163ffffffff1660e01b8152600401602060405180830381865afa158015610831573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108559190611276565b9050336001600160a01b031663468721a78360000151600060405180610100016040528087602001516001600160a01b031681526020018b6001600160a01b031681526020018760a001516001600160801b0316815260200187604001516001600160a01b031681526020018760c00151151581526020018760e00151151581526020018760600151815260200187608001518152506040516024016108fb9190611480565b60408051601f198184030181529181526020820180516001600160e01b03166353b1572760e01b1790525160e085901b6001600160e01b0319168152610949939291906000906004016113ac565b6020604051808303816000875af1158015610968573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061098c9190611402565b50604080516001808252818301909252600091816020015b60608152602001906001900390816109a457505060408051600180825281830190925291925060009190602082015b60608152602001906001900390816109d35790505090506040518060400160405280600f81526020016e1a185d1259151bd4dd1c99585b5259608a1b81525082600081518110610a2557610a25611260565b6020026020010181905250610a3986610b4d565b610a4284610b4d565b604051602001610a5392919061154f565b60405160208183030381529060405281600081518110610a7557610a75611260565b6020026020010181905250336001600160a01b031663468721a78860008585604051602401610aa59291906115db565b60408051601f198184030181529181526020820180516001600160e01b031663579374b960e11b1790525160e085901b6001600160e01b0319168152610af3939291906000906004016113ac565b6020604051808303816000875af1158015610b12573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b369190611402565b50846001019450505050506106e6565b5050505050565b606081600003610b745750506040805180820190915260018152600360fc1b602082015290565b8160005b8115610b9e5780610b888161161f565b9150610b979050600a8361164e565b9150610b78565b6000816001600160401b03811115610bb857610bb8610c97565b6040519080825280601f01601f191660200182016040528015610be2576020820181803683370190505b5090505b8415610c4d57610bf7600183611662565b9150610c04600a8661167b565b610c0f90603061168f565b60f81b818381518110610c2457610c24611260565b60200101906001600160f81b031916908160001a905350610c46600a8661164e565b9450610be6565b949350505050565b600060208284031215610c6757600080fd5b81356001600160401b03811115610c7d57600080fd5b82016101408185031215610c9057600080fd5b9392505050565b634e487b7160e01b600052604160045260246000fd5b60405161010081016001600160401b0381118282101715610cd057610cd0610c97565b60405290565b60405160e081016001600160401b0381118282101715610cd057610cd0610c97565b60405161014081016001600160401b0381118282101715610cd057610cd0610c97565b604051601f8201601f191681016001600160401b0381118282101715610d4357610d43610c97565b604052919050565b6001600160a01b038116811461009a57600080fd5b8035610d6b81610d4b565b919050565b60006001600160401b03821115610d8957610d89610c97565b5060051b60200190565b600082601f830112610da457600080fd5b81356001600160401b03811115610dbd57610dbd610c97565b610dd0601f8201601f1916602001610d1b565b818152846020838601011115610de557600080fd5b816020850160208301376000918101602001919091529392505050565b803564ffffffffff81168114610d6b57600080fd5b600060608284031215610e2957600080fd5b604051606081016001600160401b0381118282101715610e4b57610e4b610c97565b604052905080610e5a83610e02565b8152610e6860208401610e02565b6020820152610e7960408401610e02565b60408201525092915050565b600060408284031215610e9757600080fd5b604080519081016001600160401b0381118282101715610eb957610eb9610c97565b6040529050808235610eca81610d4b565b8152602092830135920191909152919050565b80356001600160801b0381168114610d6b57600080fd5b801515811461009a57600080fd5b8035610d6b81610ef4565b600082601f830112610f1e57600080fd5b8135610f31610f2c82610d70565b610d1b565b8082825260208201915060206101608402860101925085831115610f5457600080fd5b602085015b83811015611012576101608188031215610f7257600080fd5b610f7a610cad565b610f8382610d60565b8152610f9160208301610d60565b6020820152610fa260408301610d60565b6040820152610fb48860608401610e17565b6060820152610fc68860c08401610e85565b6080820152610fd86101008301610edd565b60a0820152610fea6101208301610f02565b60c0820152610ffc6101408301610f02565b60e0820152835260209092019161016001610f59565b5095945050505050565b803563ffffffff81168114610d6b57600080fd5b600082601f83011261104157600080fd5b813561104f610f2c82610d70565b8082825260208201915060208360051b86010192508583111561107157600080fd5b602085015b838110156110125780356001600160401b0381111561109457600080fd5b860160e0818903601f190112156110aa57600080fd5b6110b2610cd6565b6110be60208301610d60565b815260408201356001600160401b038111156110d957600080fd5b6110e88a602083860101610d93565b60208301525060608201356001600160401b0381111561110757600080fd5b6111168a602083860101610d93565b60408301525060808201356001600160401b0381111561113557600080fd5b6111448a602083860101610f0d565b60608301525061115660a08301610edd565b608082015261116760c0830161101c565b60a082015261117860e08301610f02565b60c082015284525060209283019201611076565b6000610140823603121561119f57600080fd5b6111a7610cf8565b6111b083610d60565b81526111be60208401610d60565b60208201526111cf60408401610d60565b6040820152606083810135908201526111ea60808401610d60565b60808201526111fb60a08401610d60565b60a082015261120c60c08401610d60565b60c082015261121d60e08401610d60565b60e082015261010083810135908201526101208301356001600160401b0381111561124757600080fd5b61125336828601611030565b6101208301525092915050565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561128857600080fd5b5051919050565b60005b838110156112aa578181015183820152602001611292565b50506000910152565b600081518084526112cb81602086016020860161128f565b601f01601f19169290920160200192915050565b60018060a01b038616815284602082015260a06040820152600061130660a08301866112b3565b828103606084015261131881866112b3565b9150508260808301529695505050505050565b60006020828403121561133d57600080fd5b8151610c9081610d4b565b87815260e06020820152600061136160e08301896112b3565b63ffffffff881660408401526001600160a01b0387811660608501528616608084015284151560a084015282810360c084015261139e81856112b3565b9a9950505050505050505050565b60018060a01b03851681528360208201526080604082015260006113d360808301856112b3565b9050600283106113f357634e487b7160e01b600052602160045260246000fd5b82606083015295945050505050565b60006020828403121561141457600080fd5b8151610c9081610ef4565b6000604082016001600160801b03851683526040602084015280845180835260608501915060208601925060005b818110156114745783516001600160a01b031683526020938401939092019160010161144d565b50909695505050505050565b81516001600160a01b0390811682526020808401518216908301526040808401516001600160801b031690830152606080840151918216908301526101608201905060808301516114d5608084018215159052565b5060a08301516114e960a084018215159052565b5060c083015161152860c084018264ffffffffff815116825264ffffffffff602082015116602083015264ffffffffff60408201511660408301525050565b5060e0929092015180516001600160a01b0316610120830152602001516101409091015290565b6000835161156181846020880161128f565b601d60f91b908301908152835161157f81600184016020880161128f565b01600101949350505050565b600082825180855260208501945060208160051b8301016020850160005b8381101561147457601f198584030188526115c58383516112b3565b60209889019890935091909101906001016115a9565b6040815260006115ee604083018561158b565b8281036020840152611600818561158b565b95945050505050565b634e487b7160e01b600052601160045260246000fd5b60006001820161163157611631611609565b5060010190565b634e487b7160e01b600052601260045260246000fd5b60008261165d5761165d611638565b500490565b8181038181111561167557611675611609565b92915050565b60008261168a5761168a611638565b500690565b808201808211156116755761167561160956fea2646970667358221220cbb4b307eab1d5ffde2b7ecaf86a40052d6217b110fff2ecda840a0a4b601bdc64736f6c634300081c0033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100365760003560e01c80630ad5e4271461003b578063ba9a91a514610050575b600080fd5b61004e610049366004610c55565b610089565b005b6100777f5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b507281565b60405190815260200160405180910390f35b61009a6100958261118c565b61009d565b50565b60005b8161012001515181101561016857600082610120015182815181106100c7576100c7611260565b6020026020010151905060006100ff84600001518560c001518660e0015187606001518860800151896101000151886080015161016c565b9050600061011d8560000151866101000151858589608001516102e5565b905060006101438660200151876040015188600001518760800151886000015187610617565b90506101598460600151828860a00151856106e3565b846001019450505050506100a0565b5050565b60006001600160801b038216156102d757866001600160a01b0316632f7fb7b6878a6001600160a01b0316631183a8c0876040518263ffffffff1660e01b81526004016101bb91815260200190565b602060405180830381865afa1580156101d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101fc9190611276565b886000604051602001610219929190918252602082015260400190565b60408051601f198184030181528282526001600160801b0389166020840152910160408051601f19818403018152908290526001600160e01b031960e087901b16825261028d949392917f5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b5072906004016112df565b6020604051808303816000875af11580156102ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102d0919061132b565b90506102da565b50825b979650505050505050565b60405162460ea360e61b81526004810185905260009081906001600160a01b03881690631183a8c090602401602060405180830381865afa15801561032e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103529190611276565b9050336001600160a01b031663468721a78860008989602001518a60a001518a8a8d60c001518e604001516040516024016103939796959493929190611348565b60408051601f198184030181529181526020820180516001600160e01b0316635829492f60e11b1790525160e085901b6001600160e01b03191681526103e1939291906000906004016113ac565b6020604051808303816000875af1158015610400573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104249190611402565b5060808501516001600160801b03161561054f576040805160018082528183019092526000916020808301908036833701905050905085600001518160008151811061047257610472611260565b60200260200101906001600160a01b031690816001600160a01b031681525050336001600160a01b031663468721a78660008960800151856040516024016104bb92919061141f565b60408051601f198184030181529181526020820180516001600160e01b0316634a231cef60e01b1790525160e085901b6001600160e01b0319168152610509939291906000906004016113ac565b6020604051808303816000875af1158015610528573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061054c9190611402565b50505b8451604051602481018390526001600160a01b039091166044820152339063468721a790899060009060640160408051601f198184030181529181526020820180516001600160e01b031663320fbbb760e11b1790525160e085901b6001600160e01b03191681526105c9939291906000906004016113ac565b6020604051808303816000875af11580156105e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061060c9190611402565b509695505050505050565b60006001600160801b0384161561062f5750816106d9565b604051638a54c52f60e01b81526001600160a01b0387811660048301527f5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b50726024830152466044830152868116606483015260848201849052881690638a54c52f9060a4016020604051808303816000875af11580156106b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106d6919061132b565b90505b9695505050505050565b60005b8451811015610b4657600085828151811061070357610703611260565b60200260200101519050336001600160a01b031663468721a78260400151600084600001518560a0015160405160240161075b9291906001600160a01b039290921682526001600160801b0316602082015260400190565b60408051601f198184030181529181526020820180516001600160e01b031663095ea7b360e01b1790525160e085901b6001600160e01b03191681526107a9939291906000906004016113ac565b6020604051808303816000875af11580156107c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ec9190611402565b50600081600001516001600160a01b0316631e99d5696040518163ffffffff1660e01b8152600401602060405180830381865afa158015610831573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108559190611276565b9050336001600160a01b031663468721a78360000151600060405180610100016040528087602001516001600160a01b031681526020018b6001600160a01b031681526020018760a001516001600160801b0316815260200187604001516001600160a01b031681526020018760c00151151581526020018760e00151151581526020018760600151815260200187608001518152506040516024016108fb9190611480565b60408051601f198184030181529181526020820180516001600160e01b03166353b1572760e01b1790525160e085901b6001600160e01b0319168152610949939291906000906004016113ac565b6020604051808303816000875af1158015610968573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061098c9190611402565b50604080516001808252818301909252600091816020015b60608152602001906001900390816109a457505060408051600180825281830190925291925060009190602082015b60608152602001906001900390816109d35790505090506040518060400160405280600f81526020016e1a185d1259151bd4dd1c99585b5259608a1b81525082600081518110610a2557610a25611260565b6020026020010181905250610a3986610b4d565b610a4284610b4d565b604051602001610a5392919061154f565b60405160208183030381529060405281600081518110610a7557610a75611260565b6020026020010181905250336001600160a01b031663468721a78860008585604051602401610aa59291906115db565b60408051601f198184030181529181526020820180516001600160e01b031663579374b960e11b1790525160e085901b6001600160e01b0319168152610af3939291906000906004016113ac565b6020604051808303816000875af1158015610b12573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b369190611402565b50846001019450505050506106e6565b5050505050565b606081600003610b745750506040805180820190915260018152600360fc1b602082015290565b8160005b8115610b9e5780610b888161161f565b9150610b979050600a8361164e565b9150610b78565b6000816001600160401b03811115610bb857610bb8610c97565b6040519080825280601f01601f191660200182016040528015610be2576020820181803683370190505b5090505b8415610c4d57610bf7600183611662565b9150610c04600a8661167b565b610c0f90603061168f565b60f81b818381518110610c2457610c24611260565b60200101906001600160f81b031916908160001a905350610c46600a8661164e565b9450610be6565b949350505050565b600060208284031215610c6757600080fd5b81356001600160401b03811115610c7d57600080fd5b82016101408185031215610c9057600080fd5b9392505050565b634e487b7160e01b600052604160045260246000fd5b60405161010081016001600160401b0381118282101715610cd057610cd0610c97565b60405290565b60405160e081016001600160401b0381118282101715610cd057610cd0610c97565b60405161014081016001600160401b0381118282101715610cd057610cd0610c97565b604051601f8201601f191681016001600160401b0381118282101715610d4357610d43610c97565b604052919050565b6001600160a01b038116811461009a57600080fd5b8035610d6b81610d4b565b919050565b60006001600160401b03821115610d8957610d89610c97565b5060051b60200190565b600082601f830112610da457600080fd5b81356001600160401b03811115610dbd57610dbd610c97565b610dd0601f8201601f1916602001610d1b565b818152846020838601011115610de557600080fd5b816020850160208301376000918101602001919091529392505050565b803564ffffffffff81168114610d6b57600080fd5b600060608284031215610e2957600080fd5b604051606081016001600160401b0381118282101715610e4b57610e4b610c97565b604052905080610e5a83610e02565b8152610e6860208401610e02565b6020820152610e7960408401610e02565b60408201525092915050565b600060408284031215610e9757600080fd5b604080519081016001600160401b0381118282101715610eb957610eb9610c97565b6040529050808235610eca81610d4b565b8152602092830135920191909152919050565b80356001600160801b0381168114610d6b57600080fd5b801515811461009a57600080fd5b8035610d6b81610ef4565b600082601f830112610f1e57600080fd5b8135610f31610f2c82610d70565b610d1b565b8082825260208201915060206101608402860101925085831115610f5457600080fd5b602085015b83811015611012576101608188031215610f7257600080fd5b610f7a610cad565b610f8382610d60565b8152610f9160208301610d60565b6020820152610fa260408301610d60565b6040820152610fb48860608401610e17565b6060820152610fc68860c08401610e85565b6080820152610fd86101008301610edd565b60a0820152610fea6101208301610f02565b60c0820152610ffc6101408301610f02565b60e0820152835260209092019161016001610f59565b5095945050505050565b803563ffffffff81168114610d6b57600080fd5b600082601f83011261104157600080fd5b813561104f610f2c82610d70565b8082825260208201915060208360051b86010192508583111561107157600080fd5b602085015b838110156110125780356001600160401b0381111561109457600080fd5b860160e0818903601f190112156110aa57600080fd5b6110b2610cd6565b6110be60208301610d60565b815260408201356001600160401b038111156110d957600080fd5b6110e88a602083860101610d93565b60208301525060608201356001600160401b0381111561110757600080fd5b6111168a602083860101610d93565b60408301525060808201356001600160401b0381111561113557600080fd5b6111448a602083860101610f0d565b60608301525061115660a08301610edd565b608082015261116760c0830161101c565b60a082015261117860e08301610f02565b60c082015284525060209283019201611076565b6000610140823603121561119f57600080fd5b6111a7610cf8565b6111b083610d60565b81526111be60208401610d60565b60208201526111cf60408401610d60565b6040820152606083810135908201526111ea60808401610d60565b60808201526111fb60a08401610d60565b60a082015261120c60c08401610d60565b60c082015261121d60e08401610d60565b60e082015261010083810135908201526101208301356001600160401b0381111561124757600080fd5b61125336828601611030565b6101208301525092915050565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561128857600080fd5b5051919050565b60005b838110156112aa578181015183820152602001611292565b50506000910152565b600081518084526112cb81602086016020860161128f565b601f01601f19169290920160200192915050565b60018060a01b038616815284602082015260a06040820152600061130660a08301866112b3565b828103606084015261131881866112b3565b9150508260808301529695505050505050565b60006020828403121561133d57600080fd5b8151610c9081610d4b565b87815260e06020820152600061136160e08301896112b3565b63ffffffff881660408401526001600160a01b0387811660608501528616608084015284151560a084015282810360c084015261139e81856112b3565b9a9950505050505050505050565b60018060a01b03851681528360208201526080604082015260006113d360808301856112b3565b9050600283106113f357634e487b7160e01b600052602160045260246000fd5b82606083015295945050505050565b60006020828403121561141457600080fd5b8151610c9081610ef4565b6000604082016001600160801b03851683526040602084015280845180835260608501915060208601925060005b818110156114745783516001600160a01b031683526020938401939092019160010161144d565b50909695505050505050565b81516001600160a01b0390811682526020808401518216908301526040808401516001600160801b031690830152606080840151918216908301526101608201905060808301516114d5608084018215159052565b5060a08301516114e960a084018215159052565b5060c083015161152860c084018264ffffffffff815116825264ffffffffff602082015116602083015264ffffffffff60408201511660408301525050565b5060e0929092015180516001600160a01b0316610120830152602001516101409091015290565b6000835161156181846020880161128f565b601d60f91b908301908152835161157f81600184016020880161128f565b01600101949350505050565b600082825180855260208501945060208160051b8301016020850160005b8381101561147457601f198584030188526115c58383516112b3565b60209889019890935091909101906001016115a9565b6040815260006115ee604083018561158b565b8281036020840152611600818561158b565b95945050505050565b634e487b7160e01b600052601160045260246000fd5b60006001820161163157611631611609565b5060010190565b634e487b7160e01b600052601260045260246000fd5b60008261165d5761165d611638565b500490565b8181038181111561167557611675611609565b92915050565b60008261168a5761168a611638565b500690565b808201808211156116755761167561160956fea2646970667358221220cbb4b307eab1d5ffde2b7ecaf86a40052d6217b110fff2ecda840a0a4b601bdc64736f6c634300081c0033", "devdoc": { "kind": "dev", "methods": { - "createRoleHats((address,address,address,uint256,address,address,address,uint256,(address,string,string,(address,address,address,(uint40,uint40,uint40),(address,uint256),uint128,bool,bool)[],uint128,uint32,bool)[]))": { + "createRoleHats((address,address,address,uint256,address,address,address,address,uint256,(address,string,string,(address,address,address,(uint40,uint40,uint40),(address,uint256),uint128,bool,bool)[],uint128,uint32,bool)[]))": { "details": "Stream funds on untermed Roles are targeted at the hat's smart account. In order to withdraw funds from the stream, the hat's smart account must be the one call to `withdraw-` on the Sablier contract, setting the recipient arg to its wearer.Stream funds on termed Roles are targeted directly at the nominated wearer. The wearer should directly call `withdraw-` on the Sablier contract.Role hat creation, minting, smart account creation and stream creation are handled here in order to avoid a race condition where not more than one active proposal to create a new role can exist at a time. See: https://github.com/decentdao/decent-interface/issues/2402", "params": { "roleHatsParams": "An array of params for each role hat to be created." @@ -220,7 +225,7 @@ "userdoc": { "kind": "user", "methods": { - "createRoleHats((address,address,address,uint256,address,address,address,uint256,(address,string,string,(address,address,address,(uint40,uint40,uint40),(address,uint256),uint128,bool,bool)[],uint128,uint32,bool)[]))": { + "createRoleHats((address,address,address,uint256,address,address,address,address,uint256,(address,string,string,(address,address,address,(uint40,uint40,uint40),(address,uint256),uint128,bool,bool)[],uint128,uint32,bool)[]))": { "notice": "Creates a new termed or untermed role hat and any streams on it.This contract should be enabled a module on the Safe for which the role is to be created, and disabled after." } }, diff --git a/deployments/sepolia/solcInputs/f1fca9a70591742a2aedd10e2fd7e744.json b/deployments/sepolia/solcInputs/f1fca9a70591742a2aedd10e2fd7e744.json new file mode 100644 index 0000000..14e45d1 --- /dev/null +++ b/deployments/sepolia/solcInputs/f1fca9a70591742a2aedd10e2fd7e744.json @@ -0,0 +1,387 @@ +{ + "language": "Solidity", + "sources": { + "@gnosis.pm/safe-contracts/contracts/base/Executor.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\nimport \"../common/Enum.sol\";\n\n/// @title Executor - A contract that can execute transactions\n/// @author Richard Meissner - \ncontract Executor {\n function execute(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation,\n uint256 txGas\n ) internal returns (bool success) {\n if (operation == Enum.Operation.DelegateCall) {\n // solhint-disable-next-line no-inline-assembly\n assembly {\n success := delegatecall(txGas, to, add(data, 0x20), mload(data), 0, 0)\n }\n } else {\n // solhint-disable-next-line no-inline-assembly\n assembly {\n success := call(txGas, to, value, add(data, 0x20), mload(data), 0, 0)\n }\n }\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/base/FallbackManager.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"../common/SelfAuthorized.sol\";\n\n/// @title Fallback Manager - A contract that manages fallback calls made to this contract\n/// @author Richard Meissner - \ncontract FallbackManager is SelfAuthorized {\n event ChangedFallbackHandler(address handler);\n\n // keccak256(\"fallback_manager.handler.address\")\n bytes32 internal constant FALLBACK_HANDLER_STORAGE_SLOT = 0x6c9a6c4a39284e37ed1cf53d337577d14212a4870fb976a4366c693b939918d5;\n\n function internalSetFallbackHandler(address handler) internal {\n bytes32 slot = FALLBACK_HANDLER_STORAGE_SLOT;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n sstore(slot, handler)\n }\n }\n\n /// @dev Allows to add a contract to handle fallback calls.\n /// Only fallback calls without value and with data will be forwarded.\n /// This can only be done via a Safe transaction.\n /// @param handler contract to handle fallbacks calls.\n function setFallbackHandler(address handler) public authorized {\n internalSetFallbackHandler(handler);\n emit ChangedFallbackHandler(handler);\n }\n\n // solhint-disable-next-line payable-fallback,no-complex-fallback\n fallback() external {\n bytes32 slot = FALLBACK_HANDLER_STORAGE_SLOT;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let handler := sload(slot)\n if iszero(handler) {\n return(0, 0)\n }\n calldatacopy(0, 0, calldatasize())\n // The msg.sender address is shifted to the left by 12 bytes to remove the padding\n // Then the address without padding is stored right after the calldata\n mstore(calldatasize(), shl(96, caller()))\n // Add 20 bytes for the address appended add the end\n let success := call(gas(), handler, 0, 0, add(calldatasize(), 20), 0, 0)\n returndatacopy(0, 0, returndatasize())\n if iszero(success) {\n revert(0, returndatasize())\n }\n return(0, returndatasize())\n }\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/base/GuardManager.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"../common/Enum.sol\";\nimport \"../common/SelfAuthorized.sol\";\n\ninterface Guard {\n function checkTransaction(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation,\n uint256 safeTxGas,\n uint256 baseGas,\n uint256 gasPrice,\n address gasToken,\n address payable refundReceiver,\n bytes memory signatures,\n address msgSender\n ) external;\n\n function checkAfterExecution(bytes32 txHash, bool success) external;\n}\n\n/// @title Fallback Manager - A contract that manages fallback calls made to this contract\n/// @author Richard Meissner - \ncontract GuardManager is SelfAuthorized {\n event ChangedGuard(address guard);\n // keccak256(\"guard_manager.guard.address\")\n bytes32 internal constant GUARD_STORAGE_SLOT = 0x4a204f620c8c5ccdca3fd54d003badd85ba500436a431f0cbda4f558c93c34c8;\n\n /// @dev Set a guard that checks transactions before execution\n /// @param guard The address of the guard to be used or the 0 address to disable the guard\n function setGuard(address guard) external authorized {\n bytes32 slot = GUARD_STORAGE_SLOT;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n sstore(slot, guard)\n }\n emit ChangedGuard(guard);\n }\n\n function getGuard() internal view returns (address guard) {\n bytes32 slot = GUARD_STORAGE_SLOT;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n guard := sload(slot)\n }\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/base/ModuleManager.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\nimport \"../common/Enum.sol\";\nimport \"../common/SelfAuthorized.sol\";\nimport \"./Executor.sol\";\n\n/// @title Module Manager - A contract that manages modules that can execute transactions via this contract\n/// @author Stefan George - \n/// @author Richard Meissner - \ncontract ModuleManager is SelfAuthorized, Executor {\n event EnabledModule(address module);\n event DisabledModule(address module);\n event ExecutionFromModuleSuccess(address indexed module);\n event ExecutionFromModuleFailure(address indexed module);\n\n address internal constant SENTINEL_MODULES = address(0x1);\n\n mapping(address => address) internal modules;\n\n function setupModules(address to, bytes memory data) internal {\n require(modules[SENTINEL_MODULES] == address(0), \"GS100\");\n modules[SENTINEL_MODULES] = SENTINEL_MODULES;\n if (to != address(0))\n // Setup has to complete successfully or transaction fails.\n require(execute(to, 0, data, Enum.Operation.DelegateCall, gasleft()), \"GS000\");\n }\n\n /// @dev Allows to add a module to the whitelist.\n /// This can only be done via a Safe transaction.\n /// @notice Enables the module `module` for the Safe.\n /// @param module Module to be whitelisted.\n function enableModule(address module) public authorized {\n // Module address cannot be null or sentinel.\n require(module != address(0) && module != SENTINEL_MODULES, \"GS101\");\n // Module cannot be added twice.\n require(modules[module] == address(0), \"GS102\");\n modules[module] = modules[SENTINEL_MODULES];\n modules[SENTINEL_MODULES] = module;\n emit EnabledModule(module);\n }\n\n /// @dev Allows to remove a module from the whitelist.\n /// This can only be done via a Safe transaction.\n /// @notice Disables the module `module` for the Safe.\n /// @param prevModule Module that pointed to the module to be removed in the linked list\n /// @param module Module to be removed.\n function disableModule(address prevModule, address module) public authorized {\n // Validate module address and check that it corresponds to module index.\n require(module != address(0) && module != SENTINEL_MODULES, \"GS101\");\n require(modules[prevModule] == module, \"GS103\");\n modules[prevModule] = modules[module];\n modules[module] = address(0);\n emit DisabledModule(module);\n }\n\n /// @dev Allows a Module to execute a Safe transaction without any further confirmations.\n /// @param to Destination address of module transaction.\n /// @param value Ether value of module transaction.\n /// @param data Data payload of module transaction.\n /// @param operation Operation type of module transaction.\n function execTransactionFromModule(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation\n ) public virtual returns (bool success) {\n // Only whitelisted modules are allowed.\n require(msg.sender != SENTINEL_MODULES && modules[msg.sender] != address(0), \"GS104\");\n // Execute transaction without further confirmations.\n success = execute(to, value, data, operation, gasleft());\n if (success) emit ExecutionFromModuleSuccess(msg.sender);\n else emit ExecutionFromModuleFailure(msg.sender);\n }\n\n /// @dev Allows a Module to execute a Safe transaction without any further confirmations and return data\n /// @param to Destination address of module transaction.\n /// @param value Ether value of module transaction.\n /// @param data Data payload of module transaction.\n /// @param operation Operation type of module transaction.\n function execTransactionFromModuleReturnData(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation\n ) public returns (bool success, bytes memory returnData) {\n success = execTransactionFromModule(to, value, data, operation);\n // solhint-disable-next-line no-inline-assembly\n assembly {\n // Load free memory location\n let ptr := mload(0x40)\n // We allocate memory for the return data by setting the free memory location to\n // current free memory location + data size + 32 bytes for data size value\n mstore(0x40, add(ptr, add(returndatasize(), 0x20)))\n // Store the size\n mstore(ptr, returndatasize())\n // Store the data\n returndatacopy(add(ptr, 0x20), 0, returndatasize())\n // Point the return data to the correct memory location\n returnData := ptr\n }\n }\n\n /// @dev Returns if an module is enabled\n /// @return True if the module is enabled\n function isModuleEnabled(address module) public view returns (bool) {\n return SENTINEL_MODULES != module && modules[module] != address(0);\n }\n\n /// @dev Returns array of modules.\n /// @param start Start of the page.\n /// @param pageSize Maximum number of modules that should be returned.\n /// @return array Array of modules.\n /// @return next Start of the next page.\n function getModulesPaginated(address start, uint256 pageSize) external view returns (address[] memory array, address next) {\n // Init array with max page size\n array = new address[](pageSize);\n\n // Populate return array\n uint256 moduleCount = 0;\n address currentModule = modules[start];\n while (currentModule != address(0x0) && currentModule != SENTINEL_MODULES && moduleCount < pageSize) {\n array[moduleCount] = currentModule;\n currentModule = modules[currentModule];\n moduleCount++;\n }\n next = currentModule;\n // Set correct size of returned array\n // solhint-disable-next-line no-inline-assembly\n assembly {\n mstore(array, moduleCount)\n }\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/base/OwnerManager.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\nimport \"../common/SelfAuthorized.sol\";\n\n/// @title OwnerManager - Manages a set of owners and a threshold to perform actions.\n/// @author Stefan George - \n/// @author Richard Meissner - \ncontract OwnerManager is SelfAuthorized {\n event AddedOwner(address owner);\n event RemovedOwner(address owner);\n event ChangedThreshold(uint256 threshold);\n\n address internal constant SENTINEL_OWNERS = address(0x1);\n\n mapping(address => address) internal owners;\n uint256 internal ownerCount;\n uint256 internal threshold;\n\n /// @dev Setup function sets initial storage of contract.\n /// @param _owners List of Safe owners.\n /// @param _threshold Number of required confirmations for a Safe transaction.\n function setupOwners(address[] memory _owners, uint256 _threshold) internal {\n // Threshold can only be 0 at initialization.\n // Check ensures that setup function can only be called once.\n require(threshold == 0, \"GS200\");\n // Validate that threshold is smaller than number of added owners.\n require(_threshold <= _owners.length, \"GS201\");\n // There has to be at least one Safe owner.\n require(_threshold >= 1, \"GS202\");\n // Initializing Safe owners.\n address currentOwner = SENTINEL_OWNERS;\n for (uint256 i = 0; i < _owners.length; i++) {\n // Owner address cannot be null.\n address owner = _owners[i];\n require(owner != address(0) && owner != SENTINEL_OWNERS && owner != address(this) && currentOwner != owner, \"GS203\");\n // No duplicate owners allowed.\n require(owners[owner] == address(0), \"GS204\");\n owners[currentOwner] = owner;\n currentOwner = owner;\n }\n owners[currentOwner] = SENTINEL_OWNERS;\n ownerCount = _owners.length;\n threshold = _threshold;\n }\n\n /// @dev Allows to add a new owner to the Safe and update the threshold at the same time.\n /// This can only be done via a Safe transaction.\n /// @notice Adds the owner `owner` to the Safe and updates the threshold to `_threshold`.\n /// @param owner New owner address.\n /// @param _threshold New threshold.\n function addOwnerWithThreshold(address owner, uint256 _threshold) public authorized {\n // Owner address cannot be null, the sentinel or the Safe itself.\n require(owner != address(0) && owner != SENTINEL_OWNERS && owner != address(this), \"GS203\");\n // No duplicate owners allowed.\n require(owners[owner] == address(0), \"GS204\");\n owners[owner] = owners[SENTINEL_OWNERS];\n owners[SENTINEL_OWNERS] = owner;\n ownerCount++;\n emit AddedOwner(owner);\n // Change threshold if threshold was changed.\n if (threshold != _threshold) changeThreshold(_threshold);\n }\n\n /// @dev Allows to remove an owner from the Safe and update the threshold at the same time.\n /// This can only be done via a Safe transaction.\n /// @notice Removes the owner `owner` from the Safe and updates the threshold to `_threshold`.\n /// @param prevOwner Owner that pointed to the owner to be removed in the linked list\n /// @param owner Owner address to be removed.\n /// @param _threshold New threshold.\n function removeOwner(\n address prevOwner,\n address owner,\n uint256 _threshold\n ) public authorized {\n // Only allow to remove an owner, if threshold can still be reached.\n require(ownerCount - 1 >= _threshold, \"GS201\");\n // Validate owner address and check that it corresponds to owner index.\n require(owner != address(0) && owner != SENTINEL_OWNERS, \"GS203\");\n require(owners[prevOwner] == owner, \"GS205\");\n owners[prevOwner] = owners[owner];\n owners[owner] = address(0);\n ownerCount--;\n emit RemovedOwner(owner);\n // Change threshold if threshold was changed.\n if (threshold != _threshold) changeThreshold(_threshold);\n }\n\n /// @dev Allows to swap/replace an owner from the Safe with another address.\n /// This can only be done via a Safe transaction.\n /// @notice Replaces the owner `oldOwner` in the Safe with `newOwner`.\n /// @param prevOwner Owner that pointed to the owner to be replaced in the linked list\n /// @param oldOwner Owner address to be replaced.\n /// @param newOwner New owner address.\n function swapOwner(\n address prevOwner,\n address oldOwner,\n address newOwner\n ) public authorized {\n // Owner address cannot be null, the sentinel or the Safe itself.\n require(newOwner != address(0) && newOwner != SENTINEL_OWNERS && newOwner != address(this), \"GS203\");\n // No duplicate owners allowed.\n require(owners[newOwner] == address(0), \"GS204\");\n // Validate oldOwner address and check that it corresponds to owner index.\n require(oldOwner != address(0) && oldOwner != SENTINEL_OWNERS, \"GS203\");\n require(owners[prevOwner] == oldOwner, \"GS205\");\n owners[newOwner] = owners[oldOwner];\n owners[prevOwner] = newOwner;\n owners[oldOwner] = address(0);\n emit RemovedOwner(oldOwner);\n emit AddedOwner(newOwner);\n }\n\n /// @dev Allows to update the number of required confirmations by Safe owners.\n /// This can only be done via a Safe transaction.\n /// @notice Changes the threshold of the Safe to `_threshold`.\n /// @param _threshold New threshold.\n function changeThreshold(uint256 _threshold) public authorized {\n // Validate that threshold is smaller than number of owners.\n require(_threshold <= ownerCount, \"GS201\");\n // There has to be at least one Safe owner.\n require(_threshold >= 1, \"GS202\");\n threshold = _threshold;\n emit ChangedThreshold(threshold);\n }\n\n function getThreshold() public view returns (uint256) {\n return threshold;\n }\n\n function isOwner(address owner) public view returns (bool) {\n return owner != SENTINEL_OWNERS && owners[owner] != address(0);\n }\n\n /// @dev Returns array of owners.\n /// @return Array of Safe owners.\n function getOwners() public view returns (address[] memory) {\n address[] memory array = new address[](ownerCount);\n\n // populate return array\n uint256 index = 0;\n address currentOwner = owners[SENTINEL_OWNERS];\n while (currentOwner != SENTINEL_OWNERS) {\n array[index] = currentOwner;\n currentOwner = owners[currentOwner];\n index++;\n }\n return array;\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/common/Enum.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\n/// @title Enum - Collection of enums\n/// @author Richard Meissner - \ncontract Enum {\n enum Operation {Call, DelegateCall}\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/common/EtherPaymentFallback.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\n/// @title EtherPaymentFallback - A contract that has a fallback to accept ether payments\n/// @author Richard Meissner - \ncontract EtherPaymentFallback {\n event SafeReceived(address indexed sender, uint256 value);\n\n /// @dev Fallback function accepts Ether transactions.\n receive() external payable {\n emit SafeReceived(msg.sender, msg.value);\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/common/SecuredTokenTransfer.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\n/// @title SecuredTokenTransfer - Secure token transfer\n/// @author Richard Meissner - \ncontract SecuredTokenTransfer {\n /// @dev Transfers a token and returns if it was a success\n /// @param token Token that should be transferred\n /// @param receiver Receiver to whom the token should be transferred\n /// @param amount The amount of tokens that should be transferred\n function transferToken(\n address token,\n address receiver,\n uint256 amount\n ) internal returns (bool transferred) {\n // 0xa9059cbb - keccack(\"transfer(address,uint256)\")\n bytes memory data = abi.encodeWithSelector(0xa9059cbb, receiver, amount);\n // solhint-disable-next-line no-inline-assembly\n assembly {\n // We write the return value to scratch space.\n // See https://docs.soliditylang.org/en/v0.7.6/internals/layout_in_memory.html#layout-in-memory\n let success := call(sub(gas(), 10000), token, 0, add(data, 0x20), mload(data), 0, 0x20)\n switch returndatasize()\n case 0 {\n transferred := success\n }\n case 0x20 {\n transferred := iszero(or(iszero(success), iszero(mload(0))))\n }\n default {\n transferred := 0\n }\n }\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/common/SelfAuthorized.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\n/// @title SelfAuthorized - authorizes current contract to perform actions\n/// @author Richard Meissner - \ncontract SelfAuthorized {\n function requireSelfCall() private view {\n require(msg.sender == address(this), \"GS031\");\n }\n\n modifier authorized() {\n // This is a function call as it minimized the bytecode size\n requireSelfCall();\n _;\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/common/SignatureDecoder.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\n/// @title SignatureDecoder - Decodes signatures that a encoded as bytes\n/// @author Richard Meissner - \ncontract SignatureDecoder {\n /// @dev divides bytes signature into `uint8 v, bytes32 r, bytes32 s`.\n /// @notice Make sure to peform a bounds check for @param pos, to avoid out of bounds access on @param signatures\n /// @param pos which signature to read. A prior bounds check of this parameter should be performed, to avoid out of bounds access\n /// @param signatures concatenated rsv signatures\n function signatureSplit(bytes memory signatures, uint256 pos)\n internal\n pure\n returns (\n uint8 v,\n bytes32 r,\n bytes32 s\n )\n {\n // The signature format is a compact form of:\n // {bytes32 r}{bytes32 s}{uint8 v}\n // Compact means, uint8 is not padded to 32 bytes.\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let signaturePos := mul(0x41, pos)\n r := mload(add(signatures, add(signaturePos, 0x20)))\n s := mload(add(signatures, add(signaturePos, 0x40)))\n // Here we are loading the last 32 bytes, including 31 bytes\n // of 's'. There is no 'mload8' to do this.\n //\n // 'byte' is not working due to the Solidity parser, so lets\n // use the second best option, 'and'\n v := and(mload(add(signatures, add(signaturePos, 0x41))), 0xff)\n }\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/common/Singleton.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\n/// @title Singleton - Base for singleton contracts (should always be first super contract)\n/// This contract is tightly coupled to our proxy contract (see `proxies/GnosisSafeProxy.sol`)\n/// @author Richard Meissner - \ncontract Singleton {\n // singleton always needs to be first declared variable, to ensure that it is at the same location as in the Proxy contract.\n // It should also always be ensured that the address is stored alone (uses a full word)\n address private singleton;\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/common/StorageAccessible.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\n/// @title StorageAccessible - generic base contract that allows callers to access all internal storage.\n/// @notice See https://github.com/gnosis/util-contracts/blob/bb5fe5fb5df6d8400998094fb1b32a178a47c3a1/contracts/StorageAccessible.sol\ncontract StorageAccessible {\n /**\n * @dev Reads `length` bytes of storage in the currents contract\n * @param offset - the offset in the current contract's storage in words to start reading from\n * @param length - the number of words (32 bytes) of data to read\n * @return the bytes that were read.\n */\n function getStorageAt(uint256 offset, uint256 length) public view returns (bytes memory) {\n bytes memory result = new bytes(length * 32);\n for (uint256 index = 0; index < length; index++) {\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let word := sload(add(offset, index))\n mstore(add(add(result, 0x20), mul(index, 0x20)), word)\n }\n }\n return result;\n }\n\n /**\n * @dev Performs a delegetecall on a targetContract in the context of self.\n * Internally reverts execution to avoid side effects (making it static).\n *\n * This method reverts with data equal to `abi.encode(bool(success), bytes(response))`.\n * Specifically, the `returndata` after a call to this method will be:\n * `success:bool || response.length:uint256 || response:bytes`.\n *\n * @param targetContract Address of the contract containing the code to execute.\n * @param calldataPayload Calldata that should be sent to the target contract (encoded method name and arguments).\n */\n function simulateAndRevert(address targetContract, bytes memory calldataPayload) external {\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let success := delegatecall(gas(), targetContract, add(calldataPayload, 0x20), mload(calldataPayload), 0, 0)\n\n mstore(0x00, success)\n mstore(0x20, returndatasize())\n returndatacopy(0x40, 0, returndatasize())\n revert(0, add(returndatasize(), 0x40))\n }\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/external/GnosisSafeMath.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\n/**\n * @title GnosisSafeMath\n * @dev Math operations with safety checks that revert on error\n * Renamed from SafeMath to GnosisSafeMath to avoid conflicts\n * TODO: remove once open zeppelin update to solc 0.5.0\n */\nlibrary GnosisSafeMath {\n /**\n * @dev Multiplies two numbers, reverts on overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\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-solidity/pull/522\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n require(c / a == b);\n\n return c;\n }\n\n /**\n * @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b <= a);\n uint256 c = a - b;\n\n return c;\n }\n\n /**\n * @dev Adds two numbers, reverts on overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a);\n\n return c;\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" + }, + "@gnosis.pm/safe-contracts/contracts/GnosisSafe.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"./base/ModuleManager.sol\";\nimport \"./base/OwnerManager.sol\";\nimport \"./base/FallbackManager.sol\";\nimport \"./base/GuardManager.sol\";\nimport \"./common/EtherPaymentFallback.sol\";\nimport \"./common/Singleton.sol\";\nimport \"./common/SignatureDecoder.sol\";\nimport \"./common/SecuredTokenTransfer.sol\";\nimport \"./common/StorageAccessible.sol\";\nimport \"./interfaces/ISignatureValidator.sol\";\nimport \"./external/GnosisSafeMath.sol\";\n\n/// @title Gnosis Safe - A multisignature wallet with support for confirmations using signed messages based on ERC191.\n/// @author Stefan George - \n/// @author Richard Meissner - \ncontract GnosisSafe is\n EtherPaymentFallback,\n Singleton,\n ModuleManager,\n OwnerManager,\n SignatureDecoder,\n SecuredTokenTransfer,\n ISignatureValidatorConstants,\n FallbackManager,\n StorageAccessible,\n GuardManager\n{\n using GnosisSafeMath for uint256;\n\n string public constant VERSION = \"1.3.0\";\n\n // keccak256(\n // \"EIP712Domain(uint256 chainId,address verifyingContract)\"\n // );\n bytes32 private constant DOMAIN_SEPARATOR_TYPEHASH = 0x47e79534a245952e8b16893a336b85a3d9ea9fa8c573f3d803afb92a79469218;\n\n // keccak256(\n // \"SafeTx(address to,uint256 value,bytes data,uint8 operation,uint256 safeTxGas,uint256 baseGas,uint256 gasPrice,address gasToken,address refundReceiver,uint256 nonce)\"\n // );\n bytes32 private constant SAFE_TX_TYPEHASH = 0xbb8310d486368db6bd6f849402fdd73ad53d316b5a4b2644ad6efe0f941286d8;\n\n event SafeSetup(address indexed initiator, address[] owners, uint256 threshold, address initializer, address fallbackHandler);\n event ApproveHash(bytes32 indexed approvedHash, address indexed owner);\n event SignMsg(bytes32 indexed msgHash);\n event ExecutionFailure(bytes32 txHash, uint256 payment);\n event ExecutionSuccess(bytes32 txHash, uint256 payment);\n\n uint256 public nonce;\n bytes32 private _deprecatedDomainSeparator;\n // Mapping to keep track of all message hashes that have been approve by ALL REQUIRED owners\n mapping(bytes32 => uint256) public signedMessages;\n // Mapping to keep track of all hashes (message or transaction) that have been approve by ANY owners\n mapping(address => mapping(bytes32 => uint256)) public approvedHashes;\n\n // This constructor ensures that this contract can only be used as a master copy for Proxy contracts\n constructor() {\n // By setting the threshold it is not possible to call setup anymore,\n // so we create a Safe with 0 owners and threshold 1.\n // This is an unusable Safe, perfect for the singleton\n threshold = 1;\n }\n\n /// @dev Setup function sets initial storage of contract.\n /// @param _owners List of Safe owners.\n /// @param _threshold Number of required confirmations for a Safe transaction.\n /// @param to Contract address for optional delegate call.\n /// @param data Data payload for optional delegate call.\n /// @param fallbackHandler Handler for fallback calls to this contract\n /// @param paymentToken Token that should be used for the payment (0 is ETH)\n /// @param payment Value that should be paid\n /// @param paymentReceiver Adddress that should receive the payment (or 0 if tx.origin)\n function setup(\n address[] calldata _owners,\n uint256 _threshold,\n address to,\n bytes calldata data,\n address fallbackHandler,\n address paymentToken,\n uint256 payment,\n address payable paymentReceiver\n ) external {\n // setupOwners checks if the Threshold is already set, therefore preventing that this method is called twice\n setupOwners(_owners, _threshold);\n if (fallbackHandler != address(0)) internalSetFallbackHandler(fallbackHandler);\n // As setupOwners can only be called if the contract has not been initialized we don't need a check for setupModules\n setupModules(to, data);\n\n if (payment > 0) {\n // To avoid running into issues with EIP-170 we reuse the handlePayment function (to avoid adjusting code of that has been verified we do not adjust the method itself)\n // baseGas = 0, gasPrice = 1 and gas = payment => amount = (payment + 0) * 1 = payment\n handlePayment(payment, 0, 1, paymentToken, paymentReceiver);\n }\n emit SafeSetup(msg.sender, _owners, _threshold, to, fallbackHandler);\n }\n\n /// @dev Allows to execute a Safe transaction confirmed by required number of owners and then pays the account that submitted the transaction.\n /// Note: The fees are always transferred, even if the user transaction fails.\n /// @param to Destination address of Safe transaction.\n /// @param value Ether value of Safe transaction.\n /// @param data Data payload of Safe transaction.\n /// @param operation Operation type of Safe transaction.\n /// @param safeTxGas Gas that should be used for the Safe transaction.\n /// @param baseGas Gas costs that are independent of the transaction execution(e.g. base transaction fee, signature check, payment of the refund)\n /// @param gasPrice Gas price that should be used for the payment calculation.\n /// @param gasToken Token address (or 0 if ETH) that is used for the payment.\n /// @param refundReceiver Address of receiver of gas payment (or 0 if tx.origin).\n /// @param signatures Packed signature data ({bytes32 r}{bytes32 s}{uint8 v})\n function execTransaction(\n address to,\n uint256 value,\n bytes calldata data,\n Enum.Operation operation,\n uint256 safeTxGas,\n uint256 baseGas,\n uint256 gasPrice,\n address gasToken,\n address payable refundReceiver,\n bytes memory signatures\n ) public payable virtual returns (bool success) {\n bytes32 txHash;\n // Use scope here to limit variable lifetime and prevent `stack too deep` errors\n {\n bytes memory txHashData =\n encodeTransactionData(\n // Transaction info\n to,\n value,\n data,\n operation,\n safeTxGas,\n // Payment info\n baseGas,\n gasPrice,\n gasToken,\n refundReceiver,\n // Signature info\n nonce\n );\n // Increase nonce and execute transaction.\n nonce++;\n txHash = keccak256(txHashData);\n checkSignatures(txHash, txHashData, signatures);\n }\n address guard = getGuard();\n {\n if (guard != address(0)) {\n Guard(guard).checkTransaction(\n // Transaction info\n to,\n value,\n data,\n operation,\n safeTxGas,\n // Payment info\n baseGas,\n gasPrice,\n gasToken,\n refundReceiver,\n // Signature info\n signatures,\n msg.sender\n );\n }\n }\n // We require some gas to emit the events (at least 2500) after the execution and some to perform code until the execution (500)\n // We also include the 1/64 in the check that is not send along with a call to counteract potential shortings because of EIP-150\n require(gasleft() >= ((safeTxGas * 64) / 63).max(safeTxGas + 2500) + 500, \"GS010\");\n // Use scope here to limit variable lifetime and prevent `stack too deep` errors\n {\n uint256 gasUsed = gasleft();\n // If the gasPrice is 0 we assume that nearly all available gas can be used (it is always more than safeTxGas)\n // We only substract 2500 (compared to the 3000 before) to ensure that the amount passed is still higher than safeTxGas\n success = execute(to, value, data, operation, gasPrice == 0 ? (gasleft() - 2500) : safeTxGas);\n gasUsed = gasUsed.sub(gasleft());\n // If no safeTxGas and no gasPrice was set (e.g. both are 0), then the internal tx is required to be successful\n // This makes it possible to use `estimateGas` without issues, as it searches for the minimum gas where the tx doesn't revert\n require(success || safeTxGas != 0 || gasPrice != 0, \"GS013\");\n // We transfer the calculated tx costs to the tx.origin to avoid sending it to intermediate contracts that have made calls\n uint256 payment = 0;\n if (gasPrice > 0) {\n payment = handlePayment(gasUsed, baseGas, gasPrice, gasToken, refundReceiver);\n }\n if (success) emit ExecutionSuccess(txHash, payment);\n else emit ExecutionFailure(txHash, payment);\n }\n {\n if (guard != address(0)) {\n Guard(guard).checkAfterExecution(txHash, success);\n }\n }\n }\n\n function handlePayment(\n uint256 gasUsed,\n uint256 baseGas,\n uint256 gasPrice,\n address gasToken,\n address payable refundReceiver\n ) private returns (uint256 payment) {\n // solhint-disable-next-line avoid-tx-origin\n address payable receiver = refundReceiver == address(0) ? payable(tx.origin) : refundReceiver;\n if (gasToken == address(0)) {\n // For ETH we will only adjust the gas price to not be higher than the actual used gas price\n payment = gasUsed.add(baseGas).mul(gasPrice < tx.gasprice ? gasPrice : tx.gasprice);\n require(receiver.send(payment), \"GS011\");\n } else {\n payment = gasUsed.add(baseGas).mul(gasPrice);\n require(transferToken(gasToken, receiver, payment), \"GS012\");\n }\n }\n\n /**\n * @dev Checks whether the signature provided is valid for the provided data, hash. Will revert otherwise.\n * @param dataHash Hash of the data (could be either a message hash or transaction hash)\n * @param data That should be signed (this is passed to an external validator contract)\n * @param signatures Signature data that should be verified. Can be ECDSA signature, contract signature (EIP-1271) or approved hash.\n */\n function checkSignatures(\n bytes32 dataHash,\n bytes memory data,\n bytes memory signatures\n ) public view {\n // Load threshold to avoid multiple storage loads\n uint256 _threshold = threshold;\n // Check that a threshold is set\n require(_threshold > 0, \"GS001\");\n checkNSignatures(dataHash, data, signatures, _threshold);\n }\n\n /**\n * @dev Checks whether the signature provided is valid for the provided data, hash. Will revert otherwise.\n * @param dataHash Hash of the data (could be either a message hash or transaction hash)\n * @param data That should be signed (this is passed to an external validator contract)\n * @param signatures Signature data that should be verified. Can be ECDSA signature, contract signature (EIP-1271) or approved hash.\n * @param requiredSignatures Amount of required valid signatures.\n */\n function checkNSignatures(\n bytes32 dataHash,\n bytes memory data,\n bytes memory signatures,\n uint256 requiredSignatures\n ) public view {\n // Check that the provided signature data is not too short\n require(signatures.length >= requiredSignatures.mul(65), \"GS020\");\n // There cannot be an owner with address 0.\n address lastOwner = address(0);\n address currentOwner;\n uint8 v;\n bytes32 r;\n bytes32 s;\n uint256 i;\n for (i = 0; i < requiredSignatures; i++) {\n (v, r, s) = signatureSplit(signatures, i);\n if (v == 0) {\n // If v is 0 then it is a contract signature\n // When handling contract signatures the address of the contract is encoded into r\n currentOwner = address(uint160(uint256(r)));\n\n // Check that signature data pointer (s) is not pointing inside the static part of the signatures bytes\n // This check is not completely accurate, since it is possible that more signatures than the threshold are send.\n // Here we only check that the pointer is not pointing inside the part that is being processed\n require(uint256(s) >= requiredSignatures.mul(65), \"GS021\");\n\n // Check that signature data pointer (s) is in bounds (points to the length of data -> 32 bytes)\n require(uint256(s).add(32) <= signatures.length, \"GS022\");\n\n // Check if the contract signature is in bounds: start of data is s + 32 and end is start + signature length\n uint256 contractSignatureLen;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n contractSignatureLen := mload(add(add(signatures, s), 0x20))\n }\n require(uint256(s).add(32).add(contractSignatureLen) <= signatures.length, \"GS023\");\n\n // Check signature\n bytes memory contractSignature;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n // The signature data for contract signatures is appended to the concatenated signatures and the offset is stored in s\n contractSignature := add(add(signatures, s), 0x20)\n }\n require(ISignatureValidator(currentOwner).isValidSignature(data, contractSignature) == EIP1271_MAGIC_VALUE, \"GS024\");\n } else if (v == 1) {\n // If v is 1 then it is an approved hash\n // When handling approved hashes the address of the approver is encoded into r\n currentOwner = address(uint160(uint256(r)));\n // Hashes are automatically approved by the sender of the message or when they have been pre-approved via a separate transaction\n require(msg.sender == currentOwner || approvedHashes[currentOwner][dataHash] != 0, \"GS025\");\n } else if (v > 30) {\n // If v > 30 then default va (27,28) has been adjusted for eth_sign flow\n // To support eth_sign and similar we adjust v and hash the messageHash with the Ethereum message prefix before applying ecrecover\n currentOwner = ecrecover(keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", dataHash)), v - 4, r, s);\n } else {\n // Default is the ecrecover flow with the provided data hash\n // Use ecrecover with the messageHash for EOA signatures\n currentOwner = ecrecover(dataHash, v, r, s);\n }\n require(currentOwner > lastOwner && owners[currentOwner] != address(0) && currentOwner != SENTINEL_OWNERS, \"GS026\");\n lastOwner = currentOwner;\n }\n }\n\n /// @dev Allows to estimate a Safe transaction.\n /// This method is only meant for estimation purpose, therefore the call will always revert and encode the result in the revert data.\n /// Since the `estimateGas` function includes refunds, call this method to get an estimated of the costs that are deducted from the safe with `execTransaction`\n /// @param to Destination address of Safe transaction.\n /// @param value Ether value of Safe transaction.\n /// @param data Data payload of Safe transaction.\n /// @param operation Operation type of Safe transaction.\n /// @return Estimate without refunds and overhead fees (base transaction and payload data gas costs).\n /// @notice Deprecated in favor of common/StorageAccessible.sol and will be removed in next version.\n function requiredTxGas(\n address to,\n uint256 value,\n bytes calldata data,\n Enum.Operation operation\n ) external returns (uint256) {\n uint256 startGas = gasleft();\n // We don't provide an error message here, as we use it to return the estimate\n require(execute(to, value, data, operation, gasleft()));\n uint256 requiredGas = startGas - gasleft();\n // Convert response to string and return via error message\n revert(string(abi.encodePacked(requiredGas)));\n }\n\n /**\n * @dev Marks a hash as approved. This can be used to validate a hash that is used by a signature.\n * @param hashToApprove The hash that should be marked as approved for signatures that are verified by this contract.\n */\n function approveHash(bytes32 hashToApprove) external {\n require(owners[msg.sender] != address(0), \"GS030\");\n approvedHashes[msg.sender][hashToApprove] = 1;\n emit ApproveHash(hashToApprove, msg.sender);\n }\n\n /// @dev Returns the chain id used by this contract.\n function getChainId() public view returns (uint256) {\n uint256 id;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n id := chainid()\n }\n return id;\n }\n\n function domainSeparator() public view returns (bytes32) {\n return keccak256(abi.encode(DOMAIN_SEPARATOR_TYPEHASH, getChainId(), this));\n }\n\n /// @dev Returns the bytes that are hashed to be signed by owners.\n /// @param to Destination address.\n /// @param value Ether value.\n /// @param data Data payload.\n /// @param operation Operation type.\n /// @param safeTxGas Gas that should be used for the safe transaction.\n /// @param baseGas Gas costs for that are independent of the transaction execution(e.g. base transaction fee, signature check, payment of the refund)\n /// @param gasPrice Maximum gas price that should be used for this transaction.\n /// @param gasToken Token address (or 0 if ETH) that is used for the payment.\n /// @param refundReceiver Address of receiver of gas payment (or 0 if tx.origin).\n /// @param _nonce Transaction nonce.\n /// @return Transaction hash bytes.\n function encodeTransactionData(\n address to,\n uint256 value,\n bytes calldata data,\n Enum.Operation operation,\n uint256 safeTxGas,\n uint256 baseGas,\n uint256 gasPrice,\n address gasToken,\n address refundReceiver,\n uint256 _nonce\n ) public view returns (bytes memory) {\n bytes32 safeTxHash =\n keccak256(\n abi.encode(\n SAFE_TX_TYPEHASH,\n to,\n value,\n keccak256(data),\n operation,\n safeTxGas,\n baseGas,\n gasPrice,\n gasToken,\n refundReceiver,\n _nonce\n )\n );\n return abi.encodePacked(bytes1(0x19), bytes1(0x01), domainSeparator(), safeTxHash);\n }\n\n /// @dev Returns hash to be signed by owners.\n /// @param to Destination address.\n /// @param value Ether value.\n /// @param data Data payload.\n /// @param operation Operation type.\n /// @param safeTxGas Fas that should be used for the safe transaction.\n /// @param baseGas Gas costs for data used to trigger the safe transaction.\n /// @param gasPrice Maximum gas price that should be used for this transaction.\n /// @param gasToken Token address (or 0 if ETH) that is used for the payment.\n /// @param refundReceiver Address of receiver of gas payment (or 0 if tx.origin).\n /// @param _nonce Transaction nonce.\n /// @return Transaction hash.\n function getTransactionHash(\n address to,\n uint256 value,\n bytes calldata data,\n Enum.Operation operation,\n uint256 safeTxGas,\n uint256 baseGas,\n uint256 gasPrice,\n address gasToken,\n address refundReceiver,\n uint256 _nonce\n ) public view returns (bytes32) {\n return keccak256(encodeTransactionData(to, value, data, operation, safeTxGas, baseGas, gasPrice, gasToken, refundReceiver, _nonce));\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/GnosisSafeL2.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"./GnosisSafe.sol\";\n\n/// @title Gnosis Safe - A multisignature wallet with support for confirmations using signed messages based on ERC191.\n/// @author Stefan George - \n/// @author Richard Meissner - \ncontract GnosisSafeL2 is GnosisSafe {\n event SafeMultiSigTransaction(\n address to,\n uint256 value,\n bytes data,\n Enum.Operation operation,\n uint256 safeTxGas,\n uint256 baseGas,\n uint256 gasPrice,\n address gasToken,\n address payable refundReceiver,\n bytes signatures,\n // We combine nonce, sender and threshold into one to avoid stack too deep\n // Dev note: additionalInfo should not contain `bytes`, as this complicates decoding\n bytes additionalInfo\n );\n\n event SafeModuleTransaction(address module, address to, uint256 value, bytes data, Enum.Operation operation);\n\n /// @dev Allows to execute a Safe transaction confirmed by required number of owners and then pays the account that submitted the transaction.\n /// Note: The fees are always transferred, even if the user transaction fails.\n /// @param to Destination address of Safe transaction.\n /// @param value Ether value of Safe transaction.\n /// @param data Data payload of Safe transaction.\n /// @param operation Operation type of Safe transaction.\n /// @param safeTxGas Gas that should be used for the Safe transaction.\n /// @param baseGas Gas costs that are independent of the transaction execution(e.g. base transaction fee, signature check, payment of the refund)\n /// @param gasPrice Gas price that should be used for the payment calculation.\n /// @param gasToken Token address (or 0 if ETH) that is used for the payment.\n /// @param refundReceiver Address of receiver of gas payment (or 0 if tx.origin).\n /// @param signatures Packed signature data ({bytes32 r}{bytes32 s}{uint8 v})\n function execTransaction(\n address to,\n uint256 value,\n bytes calldata data,\n Enum.Operation operation,\n uint256 safeTxGas,\n uint256 baseGas,\n uint256 gasPrice,\n address gasToken,\n address payable refundReceiver,\n bytes memory signatures\n ) public payable override returns (bool) {\n bytes memory additionalInfo;\n {\n additionalInfo = abi.encode(nonce, msg.sender, threshold);\n }\n emit SafeMultiSigTransaction(\n to,\n value,\n data,\n operation,\n safeTxGas,\n baseGas,\n gasPrice,\n gasToken,\n refundReceiver,\n signatures,\n additionalInfo\n );\n return super.execTransaction(to, value, data, operation, safeTxGas, baseGas, gasPrice, gasToken, refundReceiver, signatures);\n }\n\n /// @dev Allows a Module to execute a Safe transaction without any further confirmations.\n /// @param to Destination address of module transaction.\n /// @param value Ether value of module transaction.\n /// @param data Data payload of module transaction.\n /// @param operation Operation type of module transaction.\n function execTransactionFromModule(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation\n ) public override returns (bool success) {\n emit SafeModuleTransaction(msg.sender, to, value, data, operation);\n success = super.execTransactionFromModule(to, value, data, operation);\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/interfaces/ISignatureValidator.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\ncontract ISignatureValidatorConstants {\n // bytes4(keccak256(\"isValidSignature(bytes,bytes)\")\n bytes4 internal constant EIP1271_MAGIC_VALUE = 0x20c13b0b;\n}\n\nabstract contract ISignatureValidator is ISignatureValidatorConstants {\n /**\n * @dev Should return whether the signature provided is valid for the provided data\n * @param _data Arbitrary length data signed on the behalf of address(this)\n * @param _signature Signature byte array associated with _data\n *\n * MUST return the bytes4 magic value 0x20c13b0b when function passes.\n * MUST NOT modify state (using STATICCALL for solc < 0.5, view modifier for solc > 0.5)\n * MUST allow external calls\n */\n function isValidSignature(bytes memory _data, bytes memory _signature) public view virtual returns (bytes4);\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/libraries/MultiSendCallOnly.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\n/// @title Multi Send Call Only - Allows to batch multiple transactions into one, but only calls\n/// @author Stefan George - \n/// @author Richard Meissner - \n/// @notice The guard logic is not required here as this contract doesn't support nested delegate calls\ncontract MultiSendCallOnly {\n /// @dev Sends multiple transactions and reverts all if one fails.\n /// @param transactions Encoded transactions. Each transaction is encoded as a packed bytes of\n /// operation has to be uint8(0) in this version (=> 1 byte),\n /// to as a address (=> 20 bytes),\n /// value as a uint256 (=> 32 bytes),\n /// data length as a uint256 (=> 32 bytes),\n /// data as bytes.\n /// see abi.encodePacked for more information on packed encoding\n /// @notice The code is for most part the same as the normal MultiSend (to keep compatibility),\n /// but reverts if a transaction tries to use a delegatecall.\n /// @notice This method is payable as delegatecalls keep the msg.value from the previous call\n /// If the calling method (e.g. execTransaction) received ETH this would revert otherwise\n function multiSend(bytes memory transactions) public payable {\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let length := mload(transactions)\n let i := 0x20\n for {\n // Pre block is not used in \"while mode\"\n } lt(i, length) {\n // Post block is not used in \"while mode\"\n } {\n // First byte of the data is the operation.\n // We shift by 248 bits (256 - 8 [operation byte]) it right since mload will always load 32 bytes (a word).\n // This will also zero out unused data.\n let operation := shr(0xf8, mload(add(transactions, i)))\n // We offset the load address by 1 byte (operation byte)\n // We shift it right by 96 bits (256 - 160 [20 address bytes]) to right-align the data and zero out unused data.\n let to := shr(0x60, mload(add(transactions, add(i, 0x01))))\n // We offset the load address by 21 byte (operation byte + 20 address bytes)\n let value := mload(add(transactions, add(i, 0x15)))\n // We offset the load address by 53 byte (operation byte + 20 address bytes + 32 value bytes)\n let dataLength := mload(add(transactions, add(i, 0x35)))\n // We offset the load address by 85 byte (operation byte + 20 address bytes + 32 value bytes + 32 data length bytes)\n let data := add(transactions, add(i, 0x55))\n let success := 0\n switch operation\n case 0 {\n success := call(gas(), to, value, data, dataLength, 0, 0)\n }\n // This version does not allow delegatecalls\n case 1 {\n revert(0, 0)\n }\n if eq(success, 0) {\n revert(0, 0)\n }\n // Next entry starts at 85 byte + data length\n i := add(i, add(0x55, dataLength))\n }\n }\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/proxies/GnosisSafeProxy.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\n/// @title IProxy - Helper interface to access masterCopy of the Proxy on-chain\n/// @author Richard Meissner - \ninterface IProxy {\n function masterCopy() external view returns (address);\n}\n\n/// @title GnosisSafeProxy - Generic proxy contract allows to execute all transactions applying the code of a master contract.\n/// @author Stefan George - \n/// @author Richard Meissner - \ncontract GnosisSafeProxy {\n // 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.\n // To reduce deployment costs this variable is internal and needs to be retrieved via `getStorageAt`\n address internal singleton;\n\n /// @dev Constructor function sets address of singleton contract.\n /// @param _singleton Singleton address.\n constructor(address _singleton) {\n require(_singleton != address(0), \"Invalid singleton address provided\");\n singleton = _singleton;\n }\n\n /// @dev Fallback function forwards all transactions and returns all received return data.\n fallback() external payable {\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let _singleton := and(sload(0), 0xffffffffffffffffffffffffffffffffffffffff)\n // 0xa619486e == keccak(\"masterCopy()\"). The value is right padded to 32-bytes with 0s\n if eq(calldataload(0), 0xa619486e00000000000000000000000000000000000000000000000000000000) {\n mstore(0, _singleton)\n return(0, 0x20)\n }\n calldatacopy(0, 0, calldatasize())\n let success := delegatecall(gas(), _singleton, 0, calldatasize(), 0, 0)\n returndatacopy(0, 0, returndatasize())\n if eq(success, 0) {\n revert(0, returndatasize())\n }\n return(0, returndatasize())\n }\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/proxies/GnosisSafeProxyFactory.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"./GnosisSafeProxy.sol\";\nimport \"./IProxyCreationCallback.sol\";\n\n/// @title Proxy Factory - Allows to create new proxy contact and execute a message call to the new proxy within one transaction.\n/// @author Stefan George - \ncontract GnosisSafeProxyFactory {\n event ProxyCreation(GnosisSafeProxy proxy, address singleton);\n\n /// @dev Allows to create new proxy contact and execute a message call to the new proxy within one transaction.\n /// @param singleton Address of singleton contract.\n /// @param data Payload for message call sent to new proxy contract.\n function createProxy(address singleton, bytes memory data) public returns (GnosisSafeProxy proxy) {\n proxy = new GnosisSafeProxy(singleton);\n if (data.length > 0)\n // solhint-disable-next-line no-inline-assembly\n assembly {\n if eq(call(gas(), proxy, 0, add(data, 0x20), mload(data), 0, 0), 0) {\n revert(0, 0)\n }\n }\n emit ProxyCreation(proxy, singleton);\n }\n\n /// @dev Allows to retrieve the runtime code of a deployed Proxy. This can be used to check that the expected Proxy was deployed.\n function proxyRuntimeCode() public pure returns (bytes memory) {\n return type(GnosisSafeProxy).runtimeCode;\n }\n\n /// @dev Allows to retrieve the creation code used for the Proxy deployment. With this it is easily possible to calculate predicted address.\n function proxyCreationCode() public pure returns (bytes memory) {\n return type(GnosisSafeProxy).creationCode;\n }\n\n /// @dev Allows to create new proxy contact using CREATE2 but it doesn't run the initializer.\n /// This method is only meant as an utility to be called from other methods\n /// @param _singleton Address of singleton contract.\n /// @param initializer Payload for message call sent to new proxy contract.\n /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract.\n function deployProxyWithNonce(\n address _singleton,\n bytes memory initializer,\n uint256 saltNonce\n ) internal returns (GnosisSafeProxy proxy) {\n // If the initializer changes the proxy address should change too. Hashing the initializer data is cheaper than just concatinating it\n bytes32 salt = keccak256(abi.encodePacked(keccak256(initializer), saltNonce));\n bytes memory deploymentData = abi.encodePacked(type(GnosisSafeProxy).creationCode, uint256(uint160(_singleton)));\n // solhint-disable-next-line no-inline-assembly\n assembly {\n proxy := create2(0x0, add(0x20, deploymentData), mload(deploymentData), salt)\n }\n require(address(proxy) != address(0), \"Create2 call failed\");\n }\n\n /// @dev Allows to create new proxy contact and execute a message call to the new proxy within one transaction.\n /// @param _singleton Address of singleton contract.\n /// @param initializer Payload for message call sent to new proxy contract.\n /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract.\n function createProxyWithNonce(\n address _singleton,\n bytes memory initializer,\n uint256 saltNonce\n ) public returns (GnosisSafeProxy proxy) {\n proxy = deployProxyWithNonce(_singleton, initializer, saltNonce);\n if (initializer.length > 0)\n // solhint-disable-next-line no-inline-assembly\n assembly {\n if eq(call(gas(), proxy, 0, add(initializer, 0x20), mload(initializer), 0, 0), 0) {\n revert(0, 0)\n }\n }\n emit ProxyCreation(proxy, _singleton);\n }\n\n /// @dev Allows to create new proxy contact, execute a message call to the new proxy and call a specified callback within one transaction\n /// @param _singleton Address of singleton contract.\n /// @param initializer Payload for message call sent to new proxy contract.\n /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract.\n /// @param callback Callback that will be invoced after the new proxy contract has been successfully deployed and initialized.\n function createProxyWithCallback(\n address _singleton,\n bytes memory initializer,\n uint256 saltNonce,\n IProxyCreationCallback callback\n ) public returns (GnosisSafeProxy proxy) {\n uint256 saltNonceWithCallback = uint256(keccak256(abi.encodePacked(saltNonce, callback)));\n proxy = createProxyWithNonce(_singleton, initializer, saltNonceWithCallback);\n if (address(callback) != address(0)) callback.proxyCreated(proxy, _singleton, initializer, saltNonce);\n }\n\n /// @dev Allows to get the address for a new proxy contact created via `createProxyWithNonce`\n /// This method is only meant for address calculation purpose when you use an initializer that would revert,\n /// therefore the response is returned with a revert. When calling this method set `from` to the address of the proxy factory.\n /// @param _singleton Address of singleton contract.\n /// @param initializer Payload for message call sent to new proxy contract.\n /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract.\n function calculateCreateProxyWithNonceAddress(\n address _singleton,\n bytes calldata initializer,\n uint256 saltNonce\n ) external returns (GnosisSafeProxy proxy) {\n proxy = deployProxyWithNonce(_singleton, initializer, saltNonce);\n revert(string(abi.encodePacked(proxy)));\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/proxies/IProxyCreationCallback.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\nimport \"./GnosisSafeProxy.sol\";\n\ninterface IProxyCreationCallback {\n function proxyCreated(\n GnosisSafeProxy proxy,\n address _singleton,\n bytes calldata initializer,\n uint256 saltNonce\n ) external;\n}\n" + }, + "@gnosis.pm/zodiac/contracts/core/Module.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\n\n/// @title Module Interface - A contract that can pass messages to a Module Manager contract if enabled by that contract.\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"../interfaces/IAvatar.sol\";\nimport \"../factory/FactoryFriendly.sol\";\nimport \"../guard/Guardable.sol\";\n\nabstract contract Module is FactoryFriendly, Guardable {\n /// @dev Address that will ultimately execute function calls.\n address public avatar;\n /// @dev Address that this module will pass transactions to.\n address public target;\n\n /// @dev Emitted each time the avatar is set.\n event AvatarSet(address indexed previousAvatar, address indexed newAvatar);\n /// @dev Emitted each time the Target is set.\n event TargetSet(address indexed previousTarget, address indexed newTarget);\n\n /// @dev Sets the avatar to a new avatar (`newAvatar`).\n /// @notice Can only be called by the current owner.\n function setAvatar(address _avatar) public onlyOwner {\n address previousAvatar = avatar;\n avatar = _avatar;\n emit AvatarSet(previousAvatar, _avatar);\n }\n\n /// @dev Sets the target to a new target (`newTarget`).\n /// @notice Can only be called by the current owner.\n function setTarget(address _target) public onlyOwner {\n address previousTarget = target;\n target = _target;\n emit TargetSet(previousTarget, _target);\n }\n\n /// @dev Passes a transaction to be executed by the avatar.\n /// @notice Can only be called by this contract.\n /// @param to Destination address of module transaction.\n /// @param value Ether value of module transaction.\n /// @param data Data payload of module transaction.\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\n function exec(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation\n ) internal returns (bool success) {\n /// Check if a transactioon guard is enabled.\n if (guard != address(0)) {\n IGuard(guard).checkTransaction(\n /// Transaction info used by module transactions.\n to,\n value,\n data,\n operation,\n /// Zero out the redundant transaction information only used for Safe multisig transctions.\n 0,\n 0,\n 0,\n address(0),\n payable(0),\n bytes(\"0x\"),\n msg.sender\n );\n }\n success = IAvatar(target).execTransactionFromModule(\n to,\n value,\n data,\n operation\n );\n if (guard != address(0)) {\n IGuard(guard).checkAfterExecution(bytes32(\"0x\"), success);\n }\n return success;\n }\n\n /// @dev Passes a transaction to be executed by the target and returns data.\n /// @notice Can only be called by this contract.\n /// @param to Destination address of module transaction.\n /// @param value Ether value of module transaction.\n /// @param data Data payload of module transaction.\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\n function execAndReturnData(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation\n ) internal returns (bool success, bytes memory returnData) {\n /// Check if a transactioon guard is enabled.\n if (guard != address(0)) {\n IGuard(guard).checkTransaction(\n /// Transaction info used by module transactions.\n to,\n value,\n data,\n operation,\n /// Zero out the redundant transaction information only used for Safe multisig transctions.\n 0,\n 0,\n 0,\n address(0),\n payable(0),\n bytes(\"0x\"),\n msg.sender\n );\n }\n (success, returnData) = IAvatar(target)\n .execTransactionFromModuleReturnData(to, value, data, operation);\n if (guard != address(0)) {\n IGuard(guard).checkAfterExecution(bytes32(\"0x\"), success);\n }\n return (success, returnData);\n }\n}\n" + }, + "@gnosis.pm/zodiac/contracts/factory/FactoryFriendly.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\n\n/// @title Zodiac FactoryFriendly - A contract that allows other contracts to be initializable and pass bytes as arguments to define contract state\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\n\nabstract contract FactoryFriendly is OwnableUpgradeable {\n function setUp(bytes memory initializeParams) public virtual;\n}\n" + }, + "@gnosis.pm/zodiac/contracts/factory/ModuleProxyFactory.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.8.0;\n\ncontract ModuleProxyFactory {\n event ModuleProxyCreation(\n address indexed proxy,\n address indexed masterCopy\n );\n\n /// `target` can not be zero.\n error ZeroAddress(address target);\n\n /// `address_` is already taken.\n error TakenAddress(address address_);\n\n /// @notice Initialization failed.\n error FailedInitialization();\n\n function createProxy(address target, bytes32 salt)\n internal\n returns (address result)\n {\n if (address(target) == address(0)) revert ZeroAddress(target);\n bytes memory deployment = abi.encodePacked(\n hex\"602d8060093d393df3363d3d373d3d3d363d73\",\n target,\n hex\"5af43d82803e903d91602b57fd5bf3\"\n );\n // solhint-disable-next-line no-inline-assembly\n assembly {\n result := create2(0, add(deployment, 0x20), mload(deployment), salt)\n }\n if (result == address(0)) revert TakenAddress(result);\n }\n\n function deployModule(\n address masterCopy,\n bytes memory initializer,\n uint256 saltNonce\n ) public returns (address proxy) {\n proxy = createProxy(\n masterCopy,\n keccak256(abi.encodePacked(keccak256(initializer), saltNonce))\n );\n (bool success, ) = proxy.call(initializer);\n if (!success) revert FailedInitialization();\n\n emit ModuleProxyCreation(proxy, masterCopy);\n }\n}\n" + }, + "@gnosis.pm/zodiac/contracts/guard/BaseGuard.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"../interfaces/IGuard.sol\";\n\nabstract contract BaseGuard is IERC165 {\n function supportsInterface(bytes4 interfaceId)\n external\n pure\n override\n returns (bool)\n {\n return\n interfaceId == type(IGuard).interfaceId || // 0xe6d7a83a\n interfaceId == type(IERC165).interfaceId; // 0x01ffc9a7\n }\n\n /// @dev Module transactions only use the first four parameters: to, value, data, and operation.\n /// Module.sol hardcodes the remaining parameters as 0 since they are not used for module transactions.\n /// @notice This interface is used to maintain compatibilty with Gnosis Safe transaction guards.\n function checkTransaction(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation,\n uint256 safeTxGas,\n uint256 baseGas,\n uint256 gasPrice,\n address gasToken,\n address payable refundReceiver,\n bytes memory signatures,\n address msgSender\n ) external virtual;\n\n function checkAfterExecution(bytes32 txHash, bool success) external virtual;\n}\n" + }, + "@gnosis.pm/zodiac/contracts/guard/Guardable.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\";\nimport \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport \"./BaseGuard.sol\";\n\n/// @title Guardable - A contract that manages fallback calls made to this contract\ncontract Guardable is OwnableUpgradeable {\n address public guard;\n\n event ChangedGuard(address guard);\n\n /// `guard_` does not implement IERC165.\n error NotIERC165Compliant(address guard_);\n\n /// @dev Set a guard that checks transactions before execution.\n /// @param _guard The address of the guard to be used or the 0 address to disable the guard.\n function setGuard(address _guard) external onlyOwner {\n if (_guard != address(0)) {\n if (!BaseGuard(_guard).supportsInterface(type(IGuard).interfaceId))\n revert NotIERC165Compliant(_guard);\n }\n guard = _guard;\n emit ChangedGuard(guard);\n }\n\n function getGuard() external view returns (address _guard) {\n return guard;\n }\n}\n" + }, + "@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\n\n/// @title Zodiac Avatar - A contract that manages modules that can execute transactions via this contract.\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\";\n\ninterface IAvatar {\n event EnabledModule(address module);\n event DisabledModule(address module);\n event ExecutionFromModuleSuccess(address indexed module);\n event ExecutionFromModuleFailure(address indexed module);\n\n /// @dev Enables a module on the avatar.\n /// @notice Can only be called by the avatar.\n /// @notice Modules should be stored as a linked list.\n /// @notice Must emit EnabledModule(address module) if successful.\n /// @param module Module to be enabled.\n function enableModule(address module) external;\n\n /// @dev Disables a module on the avatar.\n /// @notice Can only be called by the avatar.\n /// @notice Must emit DisabledModule(address module) if successful.\n /// @param prevModule Address that pointed to the module to be removed in the linked list\n /// @param module Module to be removed.\n function disableModule(address prevModule, address module) external;\n\n /// @dev Allows a Module to execute a transaction.\n /// @notice Can only be called by an enabled module.\n /// @notice Must emit ExecutionFromModuleSuccess(address module) if successful.\n /// @notice Must emit ExecutionFromModuleFailure(address module) if unsuccessful.\n /// @param to Destination address of module transaction.\n /// @param value Ether value of module transaction.\n /// @param data Data payload of module transaction.\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\n function execTransactionFromModule(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation\n ) external returns (bool success);\n\n /// @dev Allows a Module to execute a transaction and return data\n /// @notice Can only be called by an enabled module.\n /// @notice Must emit ExecutionFromModuleSuccess(address module) if successful.\n /// @notice Must emit ExecutionFromModuleFailure(address module) if unsuccessful.\n /// @param to Destination address of module transaction.\n /// @param value Ether value of module transaction.\n /// @param data Data payload of module transaction.\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\n function execTransactionFromModuleReturnData(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation\n ) external returns (bool success, bytes memory returnData);\n\n /// @dev Returns if an module is enabled\n /// @return True if the module is enabled\n function isModuleEnabled(address module) external view returns (bool);\n\n /// @dev Returns array of modules.\n /// @param start Start of the page.\n /// @param pageSize Maximum number of modules that should be returned.\n /// @return array Array of modules.\n /// @return next Start of the next page.\n function getModulesPaginated(address start, uint256 pageSize)\n external\n view\n returns (address[] memory array, address next);\n}\n" + }, + "@gnosis.pm/zodiac/contracts/interfaces/IGuard.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\";\n\ninterface IGuard {\n function checkTransaction(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation,\n uint256 safeTxGas,\n uint256 baseGas,\n uint256 gasPrice,\n address gasToken,\n address payable refundReceiver,\n bytes memory signatures,\n address msgSender\n ) external;\n\n function checkAfterExecution(bytes32 txHash, bool success) external;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../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 * 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 OwnableUpgradeable is Initializable, ContextUpgradeable {\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 function __Ownable_init() internal onlyInitializing {\n __Ownable_init_unchained();\n }\n\n function __Ownable_init_unchained() internal onlyInitializing {\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 anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing 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 /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/governance/utils/IVotesUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (governance/utils/IVotes.sol)\npragma solidity ^0.8.0;\n\n/**\n * @dev Common interface for {ERC20Votes}, {ERC721Votes}, and other {Votes}-enabled contracts.\n *\n * _Available since v4.5._\n */\ninterface IVotesUpgradeable {\n /**\n * @dev Emitted when an account changes their delegate.\n */\n event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);\n\n /**\n * @dev Emitted when a token transfer or delegate change results in changes to a delegate's number of votes.\n */\n event DelegateVotesChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance);\n\n /**\n * @dev Returns the current amount of votes that `account` has.\n */\n function getVotes(address account) external view returns (uint256);\n\n /**\n * @dev Returns the amount of votes that `account` had at the end of a past block (`blockNumber`).\n */\n function getPastVotes(address account, uint256 blockNumber) external view returns (uint256);\n\n /**\n * @dev Returns the total supply of votes available at the end of a past block (`blockNumber`).\n *\n * NOTE: This value is the sum of all available votes, which is not necessarily the sum of all delegated votes.\n * Votes that have not been delegated are still part of total supply, even though they would not participate in a\n * vote.\n */\n function getPastTotalSupply(uint256 blockNumber) external view returns (uint256);\n\n /**\n * @dev Returns the delegate that `account` has chosen.\n */\n function delegates(address account) external view returns (address);\n\n /**\n * @dev Delegates votes from the sender to `delegatee`.\n */\n function delegate(address delegatee) external;\n\n /**\n * @dev Delegates votes from signer to `delegatee`.\n */\n function delegateBySig(\n address delegatee,\n uint256 nonce,\n uint256 expiry,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\n * initialization step. This is essential to configure modules that are added through upgrades and that require\n * initialization.\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 modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized < type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20Upgradeable.sol\";\nimport \"./extensions/IERC20MetadataUpgradeable.sol\";\nimport \"../../utils/ContextUpgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20Upgradeable, IERC20MetadataUpgradeable {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n function __ERC20_init(string memory name_, string memory symbol_) internal onlyInitializing {\n __ERC20_init_unchained(name_, symbol_);\n }\n\n function __ERC20_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n }\n _balances[to] += amount;\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n _balances[account] += amount;\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n }\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[45] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-ERC20PermitUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/extensions/draft-ERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./draft-IERC20PermitUpgradeable.sol\";\nimport \"../ERC20Upgradeable.sol\";\nimport \"../../../utils/cryptography/draft-EIP712Upgradeable.sol\";\nimport \"../../../utils/cryptography/ECDSAUpgradeable.sol\";\nimport \"../../../utils/CountersUpgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation 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 * _Available since v3.4._\n *\n * @custom:storage-size 51\n */\nabstract contract ERC20PermitUpgradeable is Initializable, ERC20Upgradeable, IERC20PermitUpgradeable, EIP712Upgradeable {\n using CountersUpgradeable for CountersUpgradeable.Counter;\n\n mapping(address => CountersUpgradeable.Counter) private _nonces;\n\n // solhint-disable-next-line var-name-mixedcase\n bytes32 private constant _PERMIT_TYPEHASH =\n keccak256(\"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\");\n /**\n * @dev In previous versions `_PERMIT_TYPEHASH` was declared as `immutable`.\n * However, to ensure consistency with the upgradeable transpiler, we will continue\n * to reserve a slot.\n * @custom:oz-renamed-from _PERMIT_TYPEHASH\n */\n // solhint-disable-next-line var-name-mixedcase\n bytes32 private _PERMIT_TYPEHASH_DEPRECATED_SLOT;\n\n /**\n * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `\"1\"`.\n *\n * It's a good idea to use the same `name` that is defined as the ERC20 token name.\n */\n function __ERC20Permit_init(string memory name) internal onlyInitializing {\n __EIP712_init_unchained(name, \"1\");\n }\n\n function __ERC20Permit_init_unchained(string memory) internal onlyInitializing {}\n\n /**\n * @dev See {IERC20Permit-permit}.\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 ) public virtual override {\n require(block.timestamp <= deadline, \"ERC20Permit: expired deadline\");\n\n bytes32 structHash = keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline));\n\n bytes32 hash = _hashTypedDataV4(structHash);\n\n address signer = ECDSAUpgradeable.recover(hash, v, r, s);\n require(signer == owner, \"ERC20Permit: invalid signature\");\n\n _approve(owner, spender, value);\n }\n\n /**\n * @dev See {IERC20Permit-nonces}.\n */\n function nonces(address owner) public view virtual override returns (uint256) {\n return _nonces[owner].current();\n }\n\n /**\n * @dev See {IERC20Permit-DOMAIN_SEPARATOR}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view override returns (bytes32) {\n return _domainSeparatorV4();\n }\n\n /**\n * @dev \"Consume a nonce\": return the current value and increment.\n *\n * _Available since v4.1._\n */\n function _useNonce(address owner) internal virtual returns (uint256 current) {\n CountersUpgradeable.Counter storage nonce = _nonces[owner];\n current = nonce.current();\n nonce.increment();\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\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 */\ninterface IERC20PermitUpgradeable {\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 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-upgradeable/token/ERC20/extensions/ERC20SnapshotUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/extensions/ERC20Snapshot.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC20Upgradeable.sol\";\nimport \"../../../utils/ArraysUpgradeable.sol\";\nimport \"../../../utils/CountersUpgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev This contract extends an ERC20 token with a snapshot mechanism. When a snapshot is created, the balances and\n * total supply at the time are recorded for later access.\n *\n * This can be used to safely create mechanisms based on token balances such as trustless dividends or weighted voting.\n * In naive implementations it's possible to perform a \"double spend\" attack by reusing the same balance from different\n * accounts. By using snapshots to calculate dividends or voting power, those attacks no longer apply. It can also be\n * used to create an efficient ERC20 forking mechanism.\n *\n * Snapshots are created by the internal {_snapshot} function, which will emit the {Snapshot} event and return a\n * snapshot id. To get the total supply at the time of a snapshot, call the function {totalSupplyAt} with the snapshot\n * id. To get the balance of an account at the time of a snapshot, call the {balanceOfAt} function with the snapshot id\n * and the account address.\n *\n * NOTE: Snapshot policy can be customized by overriding the {_getCurrentSnapshotId} method. For example, having it\n * return `block.number` will trigger the creation of snapshot at the beginning of each new block. When overriding this\n * function, be careful about the monotonicity of its result. Non-monotonic snapshot ids will break the contract.\n *\n * Implementing snapshots for every block using this method will incur significant gas costs. For a gas-efficient\n * alternative consider {ERC20Votes}.\n *\n * ==== Gas Costs\n *\n * Snapshots are efficient. Snapshot creation is _O(1)_. Retrieval of balances or total supply from a snapshot is _O(log\n * n)_ in the number of snapshots that have been created, although _n_ for a specific account will generally be much\n * smaller since identical balances in subsequent snapshots are stored as a single entry.\n *\n * There is a constant overhead for normal ERC20 transfers due to the additional snapshot bookkeeping. This overhead is\n * only significant for the first transfer that immediately follows a snapshot for a particular account. Subsequent\n * transfers will have normal cost until the next snapshot, and so on.\n */\n\nabstract contract ERC20SnapshotUpgradeable is Initializable, ERC20Upgradeable {\n function __ERC20Snapshot_init() internal onlyInitializing {\n }\n\n function __ERC20Snapshot_init_unchained() internal onlyInitializing {\n }\n // Inspired by Jordi Baylina's MiniMeToken to record historical balances:\n // https://github.com/Giveth/minime/blob/ea04d950eea153a04c51fa510b068b9dded390cb/contracts/MiniMeToken.sol\n\n using ArraysUpgradeable for uint256[];\n using CountersUpgradeable for CountersUpgradeable.Counter;\n\n // Snapshotted values have arrays of ids and the value corresponding to that id. These could be an array of a\n // Snapshot struct, but that would impede usage of functions that work on an array.\n struct Snapshots {\n uint256[] ids;\n uint256[] values;\n }\n\n mapping(address => Snapshots) private _accountBalanceSnapshots;\n Snapshots private _totalSupplySnapshots;\n\n // Snapshot ids increase monotonically, with the first value being 1. An id of 0 is invalid.\n CountersUpgradeable.Counter private _currentSnapshotId;\n\n /**\n * @dev Emitted by {_snapshot} when a snapshot identified by `id` is created.\n */\n event Snapshot(uint256 id);\n\n /**\n * @dev Creates a new snapshot and returns its snapshot id.\n *\n * Emits a {Snapshot} event that contains the same id.\n *\n * {_snapshot} is `internal` and you have to decide how to expose it externally. Its usage may be restricted to a\n * set of accounts, for example using {AccessControl}, or it may be open to the public.\n *\n * [WARNING]\n * ====\n * While an open way of calling {_snapshot} is required for certain trust minimization mechanisms such as forking,\n * you must consider that it can potentially be used by attackers in two ways.\n *\n * First, it can be used to increase the cost of retrieval of values from snapshots, although it will grow\n * logarithmically thus rendering this attack ineffective in the long term. Second, it can be used to target\n * specific accounts and increase the cost of ERC20 transfers for them, in the ways specified in the Gas Costs\n * section above.\n *\n * We haven't measured the actual numbers; if this is something you're interested in please reach out to us.\n * ====\n */\n function _snapshot() internal virtual returns (uint256) {\n _currentSnapshotId.increment();\n\n uint256 currentId = _getCurrentSnapshotId();\n emit Snapshot(currentId);\n return currentId;\n }\n\n /**\n * @dev Get the current snapshotId\n */\n function _getCurrentSnapshotId() internal view virtual returns (uint256) {\n return _currentSnapshotId.current();\n }\n\n /**\n * @dev Retrieves the balance of `account` at the time `snapshotId` was created.\n */\n function balanceOfAt(address account, uint256 snapshotId) public view virtual returns (uint256) {\n (bool snapshotted, uint256 value) = _valueAt(snapshotId, _accountBalanceSnapshots[account]);\n\n return snapshotted ? value : balanceOf(account);\n }\n\n /**\n * @dev Retrieves the total supply at the time `snapshotId` was created.\n */\n function totalSupplyAt(uint256 snapshotId) public view virtual returns (uint256) {\n (bool snapshotted, uint256 value) = _valueAt(snapshotId, _totalSupplySnapshots);\n\n return snapshotted ? value : totalSupply();\n }\n\n // Update balance and/or total supply snapshots before the values are modified. This is implemented\n // in the _beforeTokenTransfer hook, which is executed for _mint, _burn, and _transfer operations.\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual override {\n super._beforeTokenTransfer(from, to, amount);\n\n if (from == address(0)) {\n // mint\n _updateAccountSnapshot(to);\n _updateTotalSupplySnapshot();\n } else if (to == address(0)) {\n // burn\n _updateAccountSnapshot(from);\n _updateTotalSupplySnapshot();\n } else {\n // transfer\n _updateAccountSnapshot(from);\n _updateAccountSnapshot(to);\n }\n }\n\n function _valueAt(uint256 snapshotId, Snapshots storage snapshots) private view returns (bool, uint256) {\n require(snapshotId > 0, \"ERC20Snapshot: id is 0\");\n require(snapshotId <= _getCurrentSnapshotId(), \"ERC20Snapshot: nonexistent id\");\n\n // When a valid snapshot is queried, there are three possibilities:\n // a) The queried value was not modified after the snapshot was taken. Therefore, a snapshot entry was never\n // created for this id, and all stored snapshot ids are smaller than the requested one. The value that corresponds\n // to this id is the current one.\n // b) The queried value was modified after the snapshot was taken. Therefore, there will be an entry with the\n // requested id, and its value is the one to return.\n // c) More snapshots were created after the requested one, and the queried value was later modified. There will be\n // no entry for the requested id: the value that corresponds to it is that of the smallest snapshot id that is\n // larger than the requested one.\n //\n // In summary, we need to find an element in an array, returning the index of the smallest value that is larger if\n // it is not found, unless said value doesn't exist (e.g. when all values are smaller). Arrays.findUpperBound does\n // exactly this.\n\n uint256 index = snapshots.ids.findUpperBound(snapshotId);\n\n if (index == snapshots.ids.length) {\n return (false, 0);\n } else {\n return (true, snapshots.values[index]);\n }\n }\n\n function _updateAccountSnapshot(address account) private {\n _updateSnapshot(_accountBalanceSnapshots[account], balanceOf(account));\n }\n\n function _updateTotalSupplySnapshot() private {\n _updateSnapshot(_totalSupplySnapshots, totalSupply());\n }\n\n function _updateSnapshot(Snapshots storage snapshots, uint256 currentValue) private {\n uint256 currentId = _getCurrentSnapshotId();\n if (_lastSnapshotId(snapshots.ids) < currentId) {\n snapshots.ids.push(currentId);\n snapshots.values.push(currentValue);\n }\n }\n\n function _lastSnapshotId(uint256[] storage ids) private view returns (uint256) {\n if (ids.length == 0) {\n return 0;\n } else {\n return ids[ids.length - 1];\n }\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[46] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20VotesUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/extensions/ERC20Votes.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./draft-ERC20PermitUpgradeable.sol\";\nimport \"../../../utils/math/MathUpgradeable.sol\";\nimport \"../../../governance/utils/IVotesUpgradeable.sol\";\nimport \"../../../utils/math/SafeCastUpgradeable.sol\";\nimport \"../../../utils/cryptography/ECDSAUpgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Extension of ERC20 to support Compound-like voting and delegation. This version is more generic than Compound's,\n * and supports token supply up to 2^224^ - 1, while COMP is limited to 2^96^ - 1.\n *\n * NOTE: If exact COMP compatibility is required, use the {ERC20VotesComp} variant of this module.\n *\n * This extension keeps a history (checkpoints) of each account's vote power. Vote power can be delegated either\n * by calling the {delegate} function directly, or by providing a signature to be used with {delegateBySig}. Voting\n * power can be queried through the public accessors {getVotes} and {getPastVotes}.\n *\n * By default, token balance does not account for voting power. This makes transfers cheaper. The downside is that it\n * requires users to delegate to themselves in order to activate checkpoints and have their voting power tracked.\n *\n * _Available since v4.2._\n */\nabstract contract ERC20VotesUpgradeable is Initializable, IVotesUpgradeable, ERC20PermitUpgradeable {\n function __ERC20Votes_init() internal onlyInitializing {\n }\n\n function __ERC20Votes_init_unchained() internal onlyInitializing {\n }\n struct Checkpoint {\n uint32 fromBlock;\n uint224 votes;\n }\n\n bytes32 private constant _DELEGATION_TYPEHASH =\n keccak256(\"Delegation(address delegatee,uint256 nonce,uint256 expiry)\");\n\n mapping(address => address) private _delegates;\n mapping(address => Checkpoint[]) private _checkpoints;\n Checkpoint[] private _totalSupplyCheckpoints;\n\n /**\n * @dev Get the `pos`-th checkpoint for `account`.\n */\n function checkpoints(address account, uint32 pos) public view virtual returns (Checkpoint memory) {\n return _checkpoints[account][pos];\n }\n\n /**\n * @dev Get number of checkpoints for `account`.\n */\n function numCheckpoints(address account) public view virtual returns (uint32) {\n return SafeCastUpgradeable.toUint32(_checkpoints[account].length);\n }\n\n /**\n * @dev Get the address `account` is currently delegating to.\n */\n function delegates(address account) public view virtual override returns (address) {\n return _delegates[account];\n }\n\n /**\n * @dev Gets the current votes balance for `account`\n */\n function getVotes(address account) public view virtual override returns (uint256) {\n uint256 pos = _checkpoints[account].length;\n return pos == 0 ? 0 : _checkpoints[account][pos - 1].votes;\n }\n\n /**\n * @dev Retrieve the number of votes for `account` at the end of `blockNumber`.\n *\n * Requirements:\n *\n * - `blockNumber` must have been already mined\n */\n function getPastVotes(address account, uint256 blockNumber) public view virtual override returns (uint256) {\n require(blockNumber < block.number, \"ERC20Votes: block not yet mined\");\n return _checkpointsLookup(_checkpoints[account], blockNumber);\n }\n\n /**\n * @dev Retrieve the `totalSupply` at the end of `blockNumber`. Note, this value is the sum of all balances.\n * It is but NOT the sum of all the delegated votes!\n *\n * Requirements:\n *\n * - `blockNumber` must have been already mined\n */\n function getPastTotalSupply(uint256 blockNumber) public view virtual override returns (uint256) {\n require(blockNumber < block.number, \"ERC20Votes: block not yet mined\");\n return _checkpointsLookup(_totalSupplyCheckpoints, blockNumber);\n }\n\n /**\n * @dev Lookup a value in a list of (sorted) checkpoints.\n */\n function _checkpointsLookup(Checkpoint[] storage ckpts, uint256 blockNumber) private view returns (uint256) {\n // We run a binary search to look for the earliest checkpoint taken after `blockNumber`.\n //\n // During the loop, the index of the wanted checkpoint remains in the range [low-1, high).\n // With each iteration, either `low` or `high` is moved towards the middle of the range to maintain the invariant.\n // - If the middle checkpoint is after `blockNumber`, we look in [low, mid)\n // - If the middle checkpoint is before or equal to `blockNumber`, we look in [mid+1, high)\n // Once we reach a single value (when low == high), we've found the right checkpoint at the index high-1, if not\n // out of bounds (in which case we're looking too far in the past and the result is 0).\n // Note that if the latest checkpoint available is exactly for `blockNumber`, we end up with an index that is\n // past the end of the array, so we technically don't find a checkpoint after `blockNumber`, but it works out\n // the same.\n uint256 high = ckpts.length;\n uint256 low = 0;\n while (low < high) {\n uint256 mid = MathUpgradeable.average(low, high);\n if (ckpts[mid].fromBlock > blockNumber) {\n high = mid;\n } else {\n low = mid + 1;\n }\n }\n\n return high == 0 ? 0 : ckpts[high - 1].votes;\n }\n\n /**\n * @dev Delegate votes from the sender to `delegatee`.\n */\n function delegate(address delegatee) public virtual override {\n _delegate(_msgSender(), delegatee);\n }\n\n /**\n * @dev Delegates votes from signer to `delegatee`\n */\n function delegateBySig(\n address delegatee,\n uint256 nonce,\n uint256 expiry,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) public virtual override {\n require(block.timestamp <= expiry, \"ERC20Votes: signature expired\");\n address signer = ECDSAUpgradeable.recover(\n _hashTypedDataV4(keccak256(abi.encode(_DELEGATION_TYPEHASH, delegatee, nonce, expiry))),\n v,\n r,\n s\n );\n require(nonce == _useNonce(signer), \"ERC20Votes: invalid nonce\");\n _delegate(signer, delegatee);\n }\n\n /**\n * @dev Maximum token supply. Defaults to `type(uint224).max` (2^224^ - 1).\n */\n function _maxSupply() internal view virtual returns (uint224) {\n return type(uint224).max;\n }\n\n /**\n * @dev Snapshots the totalSupply after it has been increased.\n */\n function _mint(address account, uint256 amount) internal virtual override {\n super._mint(account, amount);\n require(totalSupply() <= _maxSupply(), \"ERC20Votes: total supply risks overflowing votes\");\n\n _writeCheckpoint(_totalSupplyCheckpoints, _add, amount);\n }\n\n /**\n * @dev Snapshots the totalSupply after it has been decreased.\n */\n function _burn(address account, uint256 amount) internal virtual override {\n super._burn(account, amount);\n\n _writeCheckpoint(_totalSupplyCheckpoints, _subtract, amount);\n }\n\n /**\n * @dev Move voting power when tokens are transferred.\n *\n * Emits a {DelegateVotesChanged} event.\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual override {\n super._afterTokenTransfer(from, to, amount);\n\n _moveVotingPower(delegates(from), delegates(to), amount);\n }\n\n /**\n * @dev Change delegation for `delegator` to `delegatee`.\n *\n * Emits events {DelegateChanged} and {DelegateVotesChanged}.\n */\n function _delegate(address delegator, address delegatee) internal virtual {\n address currentDelegate = delegates(delegator);\n uint256 delegatorBalance = balanceOf(delegator);\n _delegates[delegator] = delegatee;\n\n emit DelegateChanged(delegator, currentDelegate, delegatee);\n\n _moveVotingPower(currentDelegate, delegatee, delegatorBalance);\n }\n\n function _moveVotingPower(\n address src,\n address dst,\n uint256 amount\n ) private {\n if (src != dst && amount > 0) {\n if (src != address(0)) {\n (uint256 oldWeight, uint256 newWeight) = _writeCheckpoint(_checkpoints[src], _subtract, amount);\n emit DelegateVotesChanged(src, oldWeight, newWeight);\n }\n\n if (dst != address(0)) {\n (uint256 oldWeight, uint256 newWeight) = _writeCheckpoint(_checkpoints[dst], _add, amount);\n emit DelegateVotesChanged(dst, oldWeight, newWeight);\n }\n }\n }\n\n function _writeCheckpoint(\n Checkpoint[] storage ckpts,\n function(uint256, uint256) view returns (uint256) op,\n uint256 delta\n ) private returns (uint256 oldWeight, uint256 newWeight) {\n uint256 pos = ckpts.length;\n oldWeight = pos == 0 ? 0 : ckpts[pos - 1].votes;\n newWeight = op(oldWeight, delta);\n\n if (pos > 0 && ckpts[pos - 1].fromBlock == block.number) {\n ckpts[pos - 1].votes = SafeCastUpgradeable.toUint224(newWeight);\n } else {\n ckpts.push(Checkpoint({fromBlock: SafeCastUpgradeable.toUint32(block.number), votes: SafeCastUpgradeable.toUint224(newWeight)}));\n }\n }\n\n function _add(uint256 a, uint256 b) private pure returns (uint256) {\n return a + b;\n }\n\n function _subtract(uint256 a, uint256 b) private pure returns (uint256) {\n return a - b;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[47] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20WrapperUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/extensions/ERC20Wrapper.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC20Upgradeable.sol\";\nimport \"../utils/SafeERC20Upgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Extension of the ERC20 token contract to support token wrapping.\n *\n * Users can deposit and withdraw \"underlying tokens\" and receive a matching number of \"wrapped tokens\". This is useful\n * in conjunction with other modules. For example, combining this wrapping mechanism with {ERC20Votes} will allow the\n * wrapping of an existing \"basic\" ERC20 into a governance token.\n *\n * _Available since v4.2._\n *\n * @custom:storage-size 51\n */\nabstract contract ERC20WrapperUpgradeable is Initializable, ERC20Upgradeable {\n IERC20Upgradeable public underlying;\n\n function __ERC20Wrapper_init(IERC20Upgradeable underlyingToken) internal onlyInitializing {\n __ERC20Wrapper_init_unchained(underlyingToken);\n }\n\n function __ERC20Wrapper_init_unchained(IERC20Upgradeable underlyingToken) internal onlyInitializing {\n underlying = underlyingToken;\n }\n\n /**\n * @dev See {ERC20-decimals}.\n */\n function decimals() public view virtual override returns (uint8) {\n try IERC20MetadataUpgradeable(address(underlying)).decimals() returns (uint8 value) {\n return value;\n } catch {\n return super.decimals();\n }\n }\n\n /**\n * @dev Allow a user to deposit underlying tokens and mint the corresponding number of wrapped tokens.\n */\n function depositFor(address account, uint256 amount) public virtual returns (bool) {\n SafeERC20Upgradeable.safeTransferFrom(underlying, _msgSender(), address(this), amount);\n _mint(account, amount);\n return true;\n }\n\n /**\n * @dev Allow a user to burn a number of wrapped tokens and withdraw the corresponding number of underlying tokens.\n */\n function withdrawTo(address account, uint256 amount) public virtual returns (bool) {\n _burn(_msgSender(), amount);\n SafeERC20Upgradeable.safeTransfer(underlying, account, amount);\n return true;\n }\n\n /**\n * @dev Mint wrapped token to cover any underlyingTokens that would have been transferred by mistake. Internal\n * function that can be exposed with access control if desired.\n */\n function _recover(address account) internal virtual returns (uint256) {\n uint256 value = underlying.balanceOf(address(this)) - totalSupply();\n _mint(account, value);\n return value;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20Upgradeable.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20MetadataUpgradeable is IERC20Upgradeable {\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-upgradeable/token/ERC20/IERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\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 amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `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 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20Upgradeable.sol\";\nimport \"../extensions/draft-IERC20PermitUpgradeable.sol\";\nimport \"../../../utils/AddressUpgradeable.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 SafeERC20Upgradeable {\n using AddressUpgradeable for address;\n\n function safeTransfer(\n IERC20Upgradeable token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20Upgradeable token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20Upgradeable token,\n address spender,\n uint256 value\n ) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20Upgradeable token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20Upgradeable token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n function safePermit(\n IERC20PermitUpgradeable token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\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(IERC20Upgradeable token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.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 *\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://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @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}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/ArraysUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Arrays.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/MathUpgradeable.sol\";\n\n/**\n * @dev Collection of functions related to array types.\n */\nlibrary ArraysUpgradeable {\n /**\n * @dev Searches a sorted `array` and returns the first index that contains\n * a value greater or equal to `element`. If no such index exists (i.e. all\n * values in the array are strictly less than `element`), the array length is\n * returned. Time complexity O(log n).\n *\n * `array` is expected to be sorted in ascending order, and to contain no\n * repeated elements.\n */\n function findUpperBound(uint256[] storage array, uint256 element) internal view returns (uint256) {\n if (array.length == 0) {\n return 0;\n }\n\n uint256 low = 0;\n uint256 high = array.length;\n\n while (low < high) {\n uint256 mid = MathUpgradeable.average(low, high);\n\n // Note that mid will always be strictly less than high (i.e. it will be a valid array index)\n // because Math.average rounds down (it does integer division with truncation).\n if (array[mid] > element) {\n high = mid;\n } else {\n low = mid + 1;\n }\n }\n\n // At this point `low` is the exclusive upper bound. We will return the inclusive upper bound.\n if (low > 0 && array[low - 1] == element) {\n return low - 1;\n } else {\n return low;\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\nimport \"../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 /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title Counters\n * @author Matt Condon (@shrugs)\n * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number\n * of elements in a mapping, issuing ERC721 ids, or counting request ids.\n *\n * Include with `using Counters for Counters.Counter;`\n */\nlibrary CountersUpgradeable {\n struct Counter {\n // This variable should never be directly accessed by users of the library: interactions must be restricted to\n // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add\n // this feature: see https://github.com/ethereum/solidity/issues/4637\n uint256 _value; // default: 0\n }\n\n function current(Counter storage counter) internal view returns (uint256) {\n return counter._value;\n }\n\n function increment(Counter storage counter) internal {\n unchecked {\n counter._value += 1;\n }\n }\n\n function decrement(Counter storage counter) internal {\n uint256 value = counter._value;\n require(value > 0, \"Counter: decrement overflow\");\n unchecked {\n counter._value = value - 1;\n }\n }\n\n function reset(Counter storage counter) internal {\n counter._value = 0;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/cryptography/draft-EIP712Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/cryptography/draft-EIP712.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./ECDSAUpgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.\n *\n * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,\n * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding\n * they need in their contracts using a combination of `abi.encode` and `keccak256`.\n *\n * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding\n * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA\n * ({_hashTypedDataV4}).\n *\n * The implementation of the domain separator was designed to be as efficient as possible while still properly updating\n * the chain id to protect against replay attacks on an eventual fork of the chain.\n *\n * NOTE: This contract implements the version of the encoding known as \"v4\", as implemented by the JSON RPC method\n * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].\n *\n * _Available since v3.4._\n *\n * @custom:storage-size 52\n */\nabstract contract EIP712Upgradeable is Initializable {\n /* solhint-disable var-name-mixedcase */\n bytes32 private _HASHED_NAME;\n bytes32 private _HASHED_VERSION;\n bytes32 private constant _TYPE_HASH = keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\");\n\n /* solhint-enable var-name-mixedcase */\n\n /**\n * @dev Initializes the domain separator and parameter caches.\n *\n * The meaning of `name` and `version` is specified in\n * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:\n *\n * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.\n * - `version`: the current major version of the signing domain.\n *\n * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart\n * contract upgrade].\n */\n function __EIP712_init(string memory name, string memory version) internal onlyInitializing {\n __EIP712_init_unchained(name, version);\n }\n\n function __EIP712_init_unchained(string memory name, string memory version) internal onlyInitializing {\n bytes32 hashedName = keccak256(bytes(name));\n bytes32 hashedVersion = keccak256(bytes(version));\n _HASHED_NAME = hashedName;\n _HASHED_VERSION = hashedVersion;\n }\n\n /**\n * @dev Returns the domain separator for the current chain.\n */\n function _domainSeparatorV4() internal view returns (bytes32) {\n return _buildDomainSeparator(_TYPE_HASH, _EIP712NameHash(), _EIP712VersionHash());\n }\n\n function _buildDomainSeparator(\n bytes32 typeHash,\n bytes32 nameHash,\n bytes32 versionHash\n ) private view returns (bytes32) {\n return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this)));\n }\n\n /**\n * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this\n * function returns the hash of the fully encoded EIP712 message for this domain.\n *\n * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:\n *\n * ```solidity\n * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(\n * keccak256(\"Mail(address to,string contents)\"),\n * mailTo,\n * keccak256(bytes(mailContents))\n * )));\n * address signer = ECDSA.recover(digest, signature);\n * ```\n */\n function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {\n return ECDSAUpgradeable.toTypedDataHash(_domainSeparatorV4(), structHash);\n }\n\n /**\n * @dev The hash of the name parameter for the EIP712 domain.\n *\n * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs\n * are a concern.\n */\n function _EIP712NameHash() internal virtual view returns (bytes32) {\n return _HASHED_NAME;\n }\n\n /**\n * @dev The hash of the version parameter for the EIP712 domain.\n *\n * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs\n * are a concern.\n */\n function _EIP712VersionHash() internal virtual view returns (bytes32) {\n return _HASHED_VERSION;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.3) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../StringsUpgradeable.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSAUpgradeable {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS,\n InvalidSignatureV\n }\n\n function _throwError(RecoverError error) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert(\"ECDSA: invalid signature\");\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert(\"ECDSA: invalid signature length\");\n } else if (error == RecoverError.InvalidSignatureS) {\n revert(\"ECDSA: invalid signature 's' value\");\n } else if (error == RecoverError.InvalidSignatureV) {\n revert(\"ECDSA: invalid signature 'v' value\");\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature` or error string. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n /// @solidity memory-safe-assembly\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength);\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, signature);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n *\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address, RecoverError) {\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n uint8 v = uint8((uint256(vs) >> 255) + 27);\n return tryRecover(hash, v, r, s);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n *\n * _Available since v4.2._\n */\n function recover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n * `r` and `s` signature fields separately.\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address, RecoverError) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS);\n }\n if (v != 27 && v != 28) {\n return (address(0), RecoverError.InvalidSignatureV);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature);\n }\n\n return (signer, RecoverError.NoError);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", hash));\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from `s`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", StringsUpgradeable.toString(s.length), s));\n }\n\n /**\n * @dev Returns an Ethereum Signed Typed Data, created from a\n * `domainSeparator` and a `structHash`. This produces hash corresponding\n * to the one signed with the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n * JSON-RPC method as part of EIP-712.\n *\n * See {recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x01\", domainSeparator, structHash));\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary MathUpgradeable {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\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 up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 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 denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) 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; // 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 prod0 := mul(x, y)\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 return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n 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. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\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 works\n // 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(\n uint256 x,\n uint256 y,\n uint256 denominator,\n Rounding rounding\n ) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. It the number is not a perfect square, the value is rounded down.\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 // 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)`.\n // We also know that `k`, the position of the most significant bit, is such that `msb(a) = 2**k`.\n // This gives `2**k < a <= 2**(k+1)` → `2**(k/2) <= sqrt(a) < 2 ** (k/2+1)`.\n // Using an algorithm similar to the msb conmputation, we are able to compute `result = 2**(k/2)` which is a\n // good first aproximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1;\n uint256 x = a;\n if (x >> 128 > 0) {\n x >>= 128;\n result <<= 64;\n }\n if (x >> 64 > 0) {\n x >>= 64;\n result <<= 32;\n }\n if (x >> 32 > 0) {\n x >>= 32;\n result <<= 16;\n }\n if (x >> 16 > 0) {\n x >>= 16;\n result <<= 8;\n }\n if (x >> 8 > 0) {\n x >>= 8;\n result <<= 4;\n }\n if (x >> 4 > 0) {\n x >>= 4;\n result <<= 2;\n }\n if (x >> 2 > 0) {\n result <<= 1;\n }\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 uint256 result = sqrt(a);\n if (rounding == Rounding.Up && result * result < a) {\n result += 1;\n }\n return result;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/math/SafeCastUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/math/SafeCast.sol)\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 SafeCastUpgradeable {\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) {\n require(value >= type(int248).min && value <= type(int248).max, \"SafeCast: value doesn't fit in 248 bits\");\n return int248(value);\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) {\n require(value >= type(int240).min && value <= type(int240).max, \"SafeCast: value doesn't fit in 240 bits\");\n return int240(value);\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) {\n require(value >= type(int232).min && value <= type(int232).max, \"SafeCast: value doesn't fit in 232 bits\");\n return int232(value);\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) {\n require(value >= type(int224).min && value <= type(int224).max, \"SafeCast: value doesn't fit in 224 bits\");\n return int224(value);\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) {\n require(value >= type(int216).min && value <= type(int216).max, \"SafeCast: value doesn't fit in 216 bits\");\n return int216(value);\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) {\n require(value >= type(int208).min && value <= type(int208).max, \"SafeCast: value doesn't fit in 208 bits\");\n return int208(value);\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) {\n require(value >= type(int200).min && value <= type(int200).max, \"SafeCast: value doesn't fit in 200 bits\");\n return int200(value);\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) {\n require(value >= type(int192).min && value <= type(int192).max, \"SafeCast: value doesn't fit in 192 bits\");\n return int192(value);\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) {\n require(value >= type(int184).min && value <= type(int184).max, \"SafeCast: value doesn't fit in 184 bits\");\n return int184(value);\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) {\n require(value >= type(int176).min && value <= type(int176).max, \"SafeCast: value doesn't fit in 176 bits\");\n return int176(value);\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) {\n require(value >= type(int168).min && value <= type(int168).max, \"SafeCast: value doesn't fit in 168 bits\");\n return int168(value);\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) {\n require(value >= type(int160).min && value <= type(int160).max, \"SafeCast: value doesn't fit in 160 bits\");\n return int160(value);\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) {\n require(value >= type(int152).min && value <= type(int152).max, \"SafeCast: value doesn't fit in 152 bits\");\n return int152(value);\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) {\n require(value >= type(int144).min && value <= type(int144).max, \"SafeCast: value doesn't fit in 144 bits\");\n return int144(value);\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) {\n require(value >= type(int136).min && value <= type(int136).max, \"SafeCast: value doesn't fit in 136 bits\");\n return int136(value);\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) {\n require(value >= type(int128).min && value <= type(int128).max, \"SafeCast: value doesn't fit in 128 bits\");\n return int128(value);\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) {\n require(value >= type(int120).min && value <= type(int120).max, \"SafeCast: value doesn't fit in 120 bits\");\n return int120(value);\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) {\n require(value >= type(int112).min && value <= type(int112).max, \"SafeCast: value doesn't fit in 112 bits\");\n return int112(value);\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) {\n require(value >= type(int104).min && value <= type(int104).max, \"SafeCast: value doesn't fit in 104 bits\");\n return int104(value);\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) {\n require(value >= type(int96).min && value <= type(int96).max, \"SafeCast: value doesn't fit in 96 bits\");\n return int96(value);\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) {\n require(value >= type(int88).min && value <= type(int88).max, \"SafeCast: value doesn't fit in 88 bits\");\n return int88(value);\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) {\n require(value >= type(int80).min && value <= type(int80).max, \"SafeCast: value doesn't fit in 80 bits\");\n return int80(value);\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) {\n require(value >= type(int72).min && value <= type(int72).max, \"SafeCast: value doesn't fit in 72 bits\");\n return int72(value);\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) {\n require(value >= type(int64).min && value <= type(int64).max, \"SafeCast: value doesn't fit in 64 bits\");\n return int64(value);\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) {\n require(value >= type(int56).min && value <= type(int56).max, \"SafeCast: value doesn't fit in 56 bits\");\n return int56(value);\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) {\n require(value >= type(int48).min && value <= type(int48).max, \"SafeCast: value doesn't fit in 48 bits\");\n return int48(value);\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) {\n require(value >= type(int40).min && value <= type(int40).max, \"SafeCast: value doesn't fit in 40 bits\");\n return int40(value);\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) {\n require(value >= type(int32).min && value <= type(int32).max, \"SafeCast: value doesn't fit in 32 bits\");\n return int32(value);\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) {\n require(value >= type(int24).min && value <= type(int24).max, \"SafeCast: value doesn't fit in 24 bits\");\n return int24(value);\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) {\n require(value >= type(int16).min && value <= type(int16).max, \"SafeCast: value doesn't fit in 16 bits\");\n return int16(value);\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) {\n require(value >= type(int8).min && value <= type(int8).max, \"SafeCast: value doesn't fit in 8 bits\");\n return int8(value);\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" + }, + "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev String operations.\n */\nlibrary StringsUpgradeable {\n bytes16 private constant _HEX_SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\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 // Inspired by OraclizeAPI's implementation - MIT licence\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\n\n if (value == 0) {\n return \"0\";\n }\n uint256 temp = value;\n uint256 digits;\n while (temp != 0) {\n digits++;\n temp /= 10;\n }\n bytes memory buffer = new bytes(digits);\n while (value != 0) {\n digits -= 1;\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\n value /= 10;\n }\n return string(buffer);\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 if (value == 0) {\n return \"0x00\";\n }\n uint256 temp = value;\n uint256 length = 0;\n while (temp != 0) {\n length++;\n temp >>= 8;\n }\n return toHexString(value, length);\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 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_SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\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 representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "@openzeppelin/contracts/governance/utils/IVotes.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (governance/utils/IVotes.sol)\npragma solidity ^0.8.0;\n\n/**\n * @dev Common interface for {ERC20Votes}, {ERC721Votes}, and other {Votes}-enabled contracts.\n *\n * _Available since v4.5._\n */\ninterface IVotes {\n /**\n * @dev Emitted when an account changes their delegate.\n */\n event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);\n\n /**\n * @dev Emitted when a token transfer or delegate change results in changes to a delegate's number of votes.\n */\n event DelegateVotesChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance);\n\n /**\n * @dev Returns the current amount of votes that `account` has.\n */\n function getVotes(address account) external view returns (uint256);\n\n /**\n * @dev Returns the amount of votes that `account` had at the end of a past block (`blockNumber`).\n */\n function getPastVotes(address account, uint256 blockNumber) external view returns (uint256);\n\n /**\n * @dev Returns the total supply of votes available at the end of a past block (`blockNumber`).\n *\n * NOTE: This value is the sum of all available votes, which is not necessarily the sum of all delegated votes.\n * Votes that have not been delegated are still part of total supply, even though they would not participate in a\n * vote.\n */\n function getPastTotalSupply(uint256 blockNumber) external view returns (uint256);\n\n /**\n * @dev Returns the delegate that `account` has chosen.\n */\n function delegates(address account) external view returns (address);\n\n /**\n * @dev Delegates votes from the sender to `delegatee`.\n */\n function delegate(address delegatee) external;\n\n /**\n * @dev Delegates votes from signer to `delegatee`.\n */\n function delegateBySig(\n address delegatee,\n uint256 nonce,\n uint256 expiry,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n}\n" + }, + "@openzeppelin/contracts/interfaces/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/introspection/IERC165.sol\";\n" + }, + "@openzeppelin/contracts/token/ERC20/ERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n }\n _balances[to] += amount;\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n _balances[account] += amount;\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n }\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\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 */\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 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/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\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 v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev 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 amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `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 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../extensions/draft-IERC20Permit.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n function safePermit(\n IERC20Permit token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/ERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721.sol\";\nimport \"./IERC721Receiver.sol\";\nimport \"./extensions/IERC721Metadata.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/Context.sol\";\nimport \"../../utils/Strings.sol\";\nimport \"../../utils/introspection/ERC165.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 */\ncontract ERC721 is Context, ERC165, IERC721, IERC721Metadata {\n using Address for address;\n using Strings for uint256;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to owner address\n mapping(uint256 => address) private _owners;\n\n // Mapping owner address to token count\n mapping(address => uint256) private _balances;\n\n // Mapping from token ID to approved address\n mapping(uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, 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 override returns (uint256) {\n require(owner != address(0), \"ERC721: address zero is not a valid owner\");\n return _balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n address owner = _owners[tokenId];\n require(owner != address(0), \"ERC721: invalid token ID\");\n return owner;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(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 override {\n address owner = ERC721.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not token owner nor approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n _requireMinted(tokenId);\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner nor approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner nor approved\");\n _safeTransfer(from, to, tokenId, data);\n }\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 * `data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\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 `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(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _transfer(from, to, tokenId);\n require(_checkOnERC721Received(from, to, tokenId, data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n * and stop existing when they are burned (`_burn`).\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _owners[tokenId] != address(0);\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n address owner = ERC721.ownerOf(tokenId);\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\n }\n\n /**\n * @dev Safely mints `tokenId` and transfers it to `to`.\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 virtual {\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(\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _mint(to, tokenId);\n require(\n _checkOnERC721Received(address(0), to, tokenId, data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\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 virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId);\n\n _balances[to] += 1;\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId);\n\n // Clear approvals\n _approve(address(0), tokenId);\n\n _balances[owner] -= 1;\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId);\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(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId);\n\n // Clear approvals from the previous owner\n _approve(address(0), tokenId);\n\n _balances[from] -= 1;\n _balances[to] += 1;\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ERC721.ownerOf(tokenId), to, tokenId);\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(\n address owner,\n address operator,\n bool approved\n ) internal virtual {\n require(owner != operator, \"ERC721: approve to caller\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Reverts if the `tokenId` has not been minted yet.\n */\n function _requireMinted(uint256 tokenId) internal view virtual {\n require(_exists(tokenId), \"ERC721: invalid token ID\");\n }\n\n /**\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n * 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 * @return bool whether the call correctly returned the expected magic value\n */\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) private returns (bool) {\n if (to.isContract()) {\n try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n return retval == IERC721Receiver.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\"ERC721: transfer to non ERC721Receiver implementer\");\n } else {\n /// @solidity memory-safe-assembly\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting\n * and burning.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be\n * transferred to `to`.\n * - When `from` is zero, `tokenId` will be minted for `to`.\n * - When `to` is zero, ``from``'s `tokenId` will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../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 v4.7.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n\n /**\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 {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns 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 v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `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/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.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 *\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://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @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}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165Storage.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165Storage.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./ERC165.sol\";\n\n/**\n * @dev Storage based implementation of the {IERC165} interface.\n *\n * Contracts may inherit from this and call {_registerInterface} to declare\n * their support of an interface.\n */\nabstract contract ERC165Storage is ERC165 {\n /**\n * @dev Mapping of interface ids to whether or not it's supported.\n */\n mapping(bytes4 => bool) private _supportedInterfaces;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return super.supportsInterface(interfaceId) || _supportedInterfaces[interfaceId];\n }\n\n /**\n * @dev Registers the contract as an implementer of the interface defined by\n * `interfaceId`. Support of the actual ERC165 interface is automatic and\n * registering its interface id is not required.\n *\n * See {IERC165-supportsInterface}.\n *\n * Requirements:\n *\n * - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`).\n */\n function _registerInterface(bytes4 interfaceId) internal virtual {\n require(interfaceId != 0xffffffff, \"ERC165: invalid interface id\");\n _supportedInterfaces[interfaceId] = true;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _HEX_SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\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 // Inspired by OraclizeAPI's implementation - MIT licence\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\n\n if (value == 0) {\n return \"0\";\n }\n uint256 temp = value;\n uint256 digits;\n while (temp != 0) {\n digits++;\n temp /= 10;\n }\n bytes memory buffer = new bytes(digits);\n while (value != 0) {\n digits -= 1;\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\n value /= 10;\n }\n return string(buffer);\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 if (value == 0) {\n return \"0x00\";\n }\n uint256 temp = value;\n uint256 length = 0;\n while (temp != 0) {\n length++;\n temp >>= 8;\n }\n return toHexString(value, length);\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 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_SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\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 representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "@prb/math/src/Common.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\n// Common.sol\n//\n// Common mathematical functions used in both SD59x18 and UD60x18. Note that these global functions do not\n// always operate with SD59x18 and UD60x18 numbers.\n\n/*//////////////////////////////////////////////////////////////////////////\n CUSTOM ERRORS\n//////////////////////////////////////////////////////////////////////////*/\n\n/// @notice Thrown when the resultant value in {mulDiv} overflows uint256.\nerror PRBMath_MulDiv_Overflow(uint256 x, uint256 y, uint256 denominator);\n\n/// @notice Thrown when the resultant value in {mulDiv18} overflows uint256.\nerror PRBMath_MulDiv18_Overflow(uint256 x, uint256 y);\n\n/// @notice Thrown when one of the inputs passed to {mulDivSigned} is `type(int256).min`.\nerror PRBMath_MulDivSigned_InputTooSmall();\n\n/// @notice Thrown when the resultant value in {mulDivSigned} overflows int256.\nerror PRBMath_MulDivSigned_Overflow(int256 x, int256 y);\n\n/*//////////////////////////////////////////////////////////////////////////\n CONSTANTS\n//////////////////////////////////////////////////////////////////////////*/\n\n/// @dev The maximum value a uint128 number can have.\nuint128 constant MAX_UINT128 = type(uint128).max;\n\n/// @dev The maximum value a uint40 number can have.\nuint40 constant MAX_UINT40 = type(uint40).max;\n\n/// @dev The unit number, which the decimal precision of the fixed-point types.\nuint256 constant UNIT = 1e18;\n\n/// @dev The unit number inverted mod 2^256.\nuint256 constant UNIT_INVERSE = 78156646155174841979727994598816262306175212592076161876661_508869554232690281;\n\n/// @dev The the largest power of two that divides the decimal value of `UNIT`. The logarithm of this value is the least significant\n/// bit in the binary representation of `UNIT`.\nuint256 constant UNIT_LPOTD = 262144;\n\n/*//////////////////////////////////////////////////////////////////////////\n FUNCTIONS\n//////////////////////////////////////////////////////////////////////////*/\n\n/// @notice Calculates the binary exponent of x using the binary fraction method.\n/// @dev Has to use 192.64-bit fixed-point numbers. See https://ethereum.stackexchange.com/a/96594/24693.\n/// @param x The exponent as an unsigned 192.64-bit fixed-point number.\n/// @return result The result as an unsigned 60.18-decimal fixed-point number.\n/// @custom:smtchecker abstract-function-nondet\nfunction exp2(uint256 x) pure returns (uint256 result) {\n unchecked {\n // Start from 0.5 in the 192.64-bit fixed-point format.\n result = 0x800000000000000000000000000000000000000000000000;\n\n // The following logic multiplies the result by $\\sqrt{2^{-i}}$ when the bit at position i is 1. Key points:\n //\n // 1. Intermediate results will not overflow, as the starting point is 2^191 and all magic factors are under 2^65.\n // 2. The rationale for organizing the if statements into groups of 8 is gas savings. If the result of performing\n // a bitwise AND operation between x and any value in the array [0x80; 0x40; 0x20; 0x10; 0x08; 0x04; 0x02; 0x01] is 1,\n // we know that `x & 0xFF` is also 1.\n if (x & 0xFF00000000000000 > 0) {\n if (x & 0x8000000000000000 > 0) {\n result = (result * 0x16A09E667F3BCC909) >> 64;\n }\n if (x & 0x4000000000000000 > 0) {\n result = (result * 0x1306FE0A31B7152DF) >> 64;\n }\n if (x & 0x2000000000000000 > 0) {\n result = (result * 0x1172B83C7D517ADCE) >> 64;\n }\n if (x & 0x1000000000000000 > 0) {\n result = (result * 0x10B5586CF9890F62A) >> 64;\n }\n if (x & 0x800000000000000 > 0) {\n result = (result * 0x1059B0D31585743AE) >> 64;\n }\n if (x & 0x400000000000000 > 0) {\n result = (result * 0x102C9A3E778060EE7) >> 64;\n }\n if (x & 0x200000000000000 > 0) {\n result = (result * 0x10163DA9FB33356D8) >> 64;\n }\n if (x & 0x100000000000000 > 0) {\n result = (result * 0x100B1AFA5ABCBED61) >> 64;\n }\n }\n\n if (x & 0xFF000000000000 > 0) {\n if (x & 0x80000000000000 > 0) {\n result = (result * 0x10058C86DA1C09EA2) >> 64;\n }\n if (x & 0x40000000000000 > 0) {\n result = (result * 0x1002C605E2E8CEC50) >> 64;\n }\n if (x & 0x20000000000000 > 0) {\n result = (result * 0x100162F3904051FA1) >> 64;\n }\n if (x & 0x10000000000000 > 0) {\n result = (result * 0x1000B175EFFDC76BA) >> 64;\n }\n if (x & 0x8000000000000 > 0) {\n result = (result * 0x100058BA01FB9F96D) >> 64;\n }\n if (x & 0x4000000000000 > 0) {\n result = (result * 0x10002C5CC37DA9492) >> 64;\n }\n if (x & 0x2000000000000 > 0) {\n result = (result * 0x1000162E525EE0547) >> 64;\n }\n if (x & 0x1000000000000 > 0) {\n result = (result * 0x10000B17255775C04) >> 64;\n }\n }\n\n if (x & 0xFF0000000000 > 0) {\n if (x & 0x800000000000 > 0) {\n result = (result * 0x1000058B91B5BC9AE) >> 64;\n }\n if (x & 0x400000000000 > 0) {\n result = (result * 0x100002C5C89D5EC6D) >> 64;\n }\n if (x & 0x200000000000 > 0) {\n result = (result * 0x10000162E43F4F831) >> 64;\n }\n if (x & 0x100000000000 > 0) {\n result = (result * 0x100000B1721BCFC9A) >> 64;\n }\n if (x & 0x80000000000 > 0) {\n result = (result * 0x10000058B90CF1E6E) >> 64;\n }\n if (x & 0x40000000000 > 0) {\n result = (result * 0x1000002C5C863B73F) >> 64;\n }\n if (x & 0x20000000000 > 0) {\n result = (result * 0x100000162E430E5A2) >> 64;\n }\n if (x & 0x10000000000 > 0) {\n result = (result * 0x1000000B172183551) >> 64;\n }\n }\n\n if (x & 0xFF00000000 > 0) {\n if (x & 0x8000000000 > 0) {\n result = (result * 0x100000058B90C0B49) >> 64;\n }\n if (x & 0x4000000000 > 0) {\n result = (result * 0x10000002C5C8601CC) >> 64;\n }\n if (x & 0x2000000000 > 0) {\n result = (result * 0x1000000162E42FFF0) >> 64;\n }\n if (x & 0x1000000000 > 0) {\n result = (result * 0x10000000B17217FBB) >> 64;\n }\n if (x & 0x800000000 > 0) {\n result = (result * 0x1000000058B90BFCE) >> 64;\n }\n if (x & 0x400000000 > 0) {\n result = (result * 0x100000002C5C85FE3) >> 64;\n }\n if (x & 0x200000000 > 0) {\n result = (result * 0x10000000162E42FF1) >> 64;\n }\n if (x & 0x100000000 > 0) {\n result = (result * 0x100000000B17217F8) >> 64;\n }\n }\n\n if (x & 0xFF000000 > 0) {\n if (x & 0x80000000 > 0) {\n result = (result * 0x10000000058B90BFC) >> 64;\n }\n if (x & 0x40000000 > 0) {\n result = (result * 0x1000000002C5C85FE) >> 64;\n }\n if (x & 0x20000000 > 0) {\n result = (result * 0x100000000162E42FF) >> 64;\n }\n if (x & 0x10000000 > 0) {\n result = (result * 0x1000000000B17217F) >> 64;\n }\n if (x & 0x8000000 > 0) {\n result = (result * 0x100000000058B90C0) >> 64;\n }\n if (x & 0x4000000 > 0) {\n result = (result * 0x10000000002C5C860) >> 64;\n }\n if (x & 0x2000000 > 0) {\n result = (result * 0x1000000000162E430) >> 64;\n }\n if (x & 0x1000000 > 0) {\n result = (result * 0x10000000000B17218) >> 64;\n }\n }\n\n if (x & 0xFF0000 > 0) {\n if (x & 0x800000 > 0) {\n result = (result * 0x1000000000058B90C) >> 64;\n }\n if (x & 0x400000 > 0) {\n result = (result * 0x100000000002C5C86) >> 64;\n }\n if (x & 0x200000 > 0) {\n result = (result * 0x10000000000162E43) >> 64;\n }\n if (x & 0x100000 > 0) {\n result = (result * 0x100000000000B1721) >> 64;\n }\n if (x & 0x80000 > 0) {\n result = (result * 0x10000000000058B91) >> 64;\n }\n if (x & 0x40000 > 0) {\n result = (result * 0x1000000000002C5C8) >> 64;\n }\n if (x & 0x20000 > 0) {\n result = (result * 0x100000000000162E4) >> 64;\n }\n if (x & 0x10000 > 0) {\n result = (result * 0x1000000000000B172) >> 64;\n }\n }\n\n if (x & 0xFF00 > 0) {\n if (x & 0x8000 > 0) {\n result = (result * 0x100000000000058B9) >> 64;\n }\n if (x & 0x4000 > 0) {\n result = (result * 0x10000000000002C5D) >> 64;\n }\n if (x & 0x2000 > 0) {\n result = (result * 0x1000000000000162E) >> 64;\n }\n if (x & 0x1000 > 0) {\n result = (result * 0x10000000000000B17) >> 64;\n }\n if (x & 0x800 > 0) {\n result = (result * 0x1000000000000058C) >> 64;\n }\n if (x & 0x400 > 0) {\n result = (result * 0x100000000000002C6) >> 64;\n }\n if (x & 0x200 > 0) {\n result = (result * 0x10000000000000163) >> 64;\n }\n if (x & 0x100 > 0) {\n result = (result * 0x100000000000000B1) >> 64;\n }\n }\n\n if (x & 0xFF > 0) {\n if (x & 0x80 > 0) {\n result = (result * 0x10000000000000059) >> 64;\n }\n if (x & 0x40 > 0) {\n result = (result * 0x1000000000000002C) >> 64;\n }\n if (x & 0x20 > 0) {\n result = (result * 0x10000000000000016) >> 64;\n }\n if (x & 0x10 > 0) {\n result = (result * 0x1000000000000000B) >> 64;\n }\n if (x & 0x8 > 0) {\n result = (result * 0x10000000000000006) >> 64;\n }\n if (x & 0x4 > 0) {\n result = (result * 0x10000000000000003) >> 64;\n }\n if (x & 0x2 > 0) {\n result = (result * 0x10000000000000001) >> 64;\n }\n if (x & 0x1 > 0) {\n result = (result * 0x10000000000000001) >> 64;\n }\n }\n\n // In the code snippet below, two operations are executed simultaneously:\n //\n // 1. The result is multiplied by $(2^n + 1)$, where $2^n$ represents the integer part, and the additional 1\n // accounts for the initial guess of 0.5. This is achieved by subtracting from 191 instead of 192.\n // 2. The result is then converted to an unsigned 60.18-decimal fixed-point format.\n //\n // The underlying logic is based on the relationship $2^{191-ip} = 2^{ip} / 2^{191}$, where $ip$ denotes the,\n // integer part, $2^n$.\n result *= UNIT;\n result >>= (191 - (x >> 64));\n }\n}\n\n/// @notice Finds the zero-based index of the first 1 in the binary representation of x.\n///\n/// @dev See the note on \"msb\" in this Wikipedia article: https://en.wikipedia.org/wiki/Find_first_set\n///\n/// Each step in this implementation is equivalent to this high-level code:\n///\n/// ```solidity\n/// if (x >= 2 ** 128) {\n/// x >>= 128;\n/// result += 128;\n/// }\n/// ```\n///\n/// Where 128 is replaced with each respective power of two factor. See the full high-level implementation here:\n/// https://gist.github.com/PaulRBerg/f932f8693f2733e30c4d479e8e980948\n///\n/// The Yul instructions used below are:\n///\n/// - \"gt\" is \"greater than\"\n/// - \"or\" is the OR bitwise operator\n/// - \"shl\" is \"shift left\"\n/// - \"shr\" is \"shift right\"\n///\n/// @param x The uint256 number for which to find the index of the most significant bit.\n/// @return result The index of the most significant bit as a uint256.\n/// @custom:smtchecker abstract-function-nondet\nfunction msb(uint256 x) pure returns (uint256 result) {\n // 2^128\n assembly (\"memory-safe\") {\n let factor := shl(7, gt(x, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))\n x := shr(factor, x)\n result := or(result, factor)\n }\n // 2^64\n assembly (\"memory-safe\") {\n let factor := shl(6, gt(x, 0xFFFFFFFFFFFFFFFF))\n x := shr(factor, x)\n result := or(result, factor)\n }\n // 2^32\n assembly (\"memory-safe\") {\n let factor := shl(5, gt(x, 0xFFFFFFFF))\n x := shr(factor, x)\n result := or(result, factor)\n }\n // 2^16\n assembly (\"memory-safe\") {\n let factor := shl(4, gt(x, 0xFFFF))\n x := shr(factor, x)\n result := or(result, factor)\n }\n // 2^8\n assembly (\"memory-safe\") {\n let factor := shl(3, gt(x, 0xFF))\n x := shr(factor, x)\n result := or(result, factor)\n }\n // 2^4\n assembly (\"memory-safe\") {\n let factor := shl(2, gt(x, 0xF))\n x := shr(factor, x)\n result := or(result, factor)\n }\n // 2^2\n assembly (\"memory-safe\") {\n let factor := shl(1, gt(x, 0x3))\n x := shr(factor, x)\n result := or(result, factor)\n }\n // 2^1\n // No need to shift x any more.\n assembly (\"memory-safe\") {\n let factor := gt(x, 0x1)\n result := or(result, factor)\n }\n}\n\n/// @notice Calculates x*y÷denominator with 512-bit precision.\n///\n/// @dev Credits to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv.\n///\n/// Notes:\n/// - The result is rounded toward zero.\n///\n/// Requirements:\n/// - The denominator must not be zero.\n/// - The result must fit in uint256.\n///\n/// @param x The multiplicand as a uint256.\n/// @param y The multiplier as a uint256.\n/// @param denominator The divisor as a uint256.\n/// @return result The result as a uint256.\n/// @custom:smtchecker abstract-function-nondet\nfunction mulDiv(uint256 x, uint256 y, uint256 denominator) pure returns (uint256 result) {\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; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly (\"memory-safe\") {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\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 unchecked {\n return prod0 / denominator;\n }\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n if (prod1 >= denominator) {\n revert PRBMath_MulDiv_Overflow(x, y, denominator);\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 (\"memory-safe\") {\n // Compute remainder using the mulmod Yul instruction.\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 unchecked {\n // Calculate the largest power of two divisor of the denominator using the unary operator ~. This operation cannot overflow\n // because the denominator cannot be zero at this point in the function execution. The result is always >= 1.\n // For more detail, see https://cs.stackexchange.com/q/138556/92363.\n uint256 lpotdod = denominator & (~denominator + 1);\n uint256 flippedLpotdod;\n\n assembly (\"memory-safe\") {\n // Factor powers of two out of denominator.\n denominator := div(denominator, lpotdod)\n\n // Divide [prod1 prod0] by lpotdod.\n prod0 := div(prod0, lpotdod)\n\n // Get the flipped value `2^256 / lpotdod`. If the `lpotdod` is zero, the flipped value is one.\n // `sub(0, lpotdod)` produces the two's complement version of `lpotdod`, which is equivalent to flipping all the bits.\n // However, `div` interprets this value as an unsigned value: https://ethereum.stackexchange.com/q/147168/24693\n flippedLpotdod := add(div(sub(0, lpotdod), lpotdod), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * flippedLpotdod;\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 works\n // 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 }\n}\n\n/// @notice Calculates x*y÷1e18 with 512-bit precision.\n///\n/// @dev A variant of {mulDiv} with constant folding, i.e. in which the denominator is hard coded to 1e18.\n///\n/// Notes:\n/// - The body is purposely left uncommented; to understand how this works, see the documentation in {mulDiv}.\n/// - The result is rounded toward zero.\n/// - We take as an axiom that the result cannot be `MAX_UINT256` when x and y solve the following system of equations:\n///\n/// $$\n/// \\begin{cases}\n/// x * y = MAX\\_UINT256 * UNIT \\\\\n/// (x * y) \\% UNIT \\geq \\frac{UNIT}{2}\n/// \\end{cases}\n/// $$\n///\n/// Requirements:\n/// - Refer to the requirements in {mulDiv}.\n/// - The result must fit in uint256.\n///\n/// @param x The multiplicand as an unsigned 60.18-decimal fixed-point number.\n/// @param y The multiplier as an unsigned 60.18-decimal fixed-point number.\n/// @return result The result as an unsigned 60.18-decimal fixed-point number.\n/// @custom:smtchecker abstract-function-nondet\nfunction mulDiv18(uint256 x, uint256 y) pure returns (uint256 result) {\n uint256 prod0;\n uint256 prod1;\n assembly (\"memory-safe\") {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n if (prod1 == 0) {\n unchecked {\n return prod0 / UNIT;\n }\n }\n\n if (prod1 >= UNIT) {\n revert PRBMath_MulDiv18_Overflow(x, y);\n }\n\n uint256 remainder;\n assembly (\"memory-safe\") {\n remainder := mulmod(x, y, UNIT)\n result :=\n mul(\n or(\n div(sub(prod0, remainder), UNIT_LPOTD),\n mul(sub(prod1, gt(remainder, prod0)), add(div(sub(0, UNIT_LPOTD), UNIT_LPOTD), 1))\n ),\n UNIT_INVERSE\n )\n }\n}\n\n/// @notice Calculates x*y÷denominator with 512-bit precision.\n///\n/// @dev This is an extension of {mulDiv} for signed numbers, which works by computing the signs and the absolute values separately.\n///\n/// Notes:\n/// - The result is rounded toward zero.\n///\n/// Requirements:\n/// - Refer to the requirements in {mulDiv}.\n/// - None of the inputs can be `type(int256).min`.\n/// - The result must fit in int256.\n///\n/// @param x The multiplicand as an int256.\n/// @param y The multiplier as an int256.\n/// @param denominator The divisor as an int256.\n/// @return result The result as an int256.\n/// @custom:smtchecker abstract-function-nondet\nfunction mulDivSigned(int256 x, int256 y, int256 denominator) pure returns (int256 result) {\n if (x == type(int256).min || y == type(int256).min || denominator == type(int256).min) {\n revert PRBMath_MulDivSigned_InputTooSmall();\n }\n\n // Get hold of the absolute values of x, y and the denominator.\n uint256 xAbs;\n uint256 yAbs;\n uint256 dAbs;\n unchecked {\n xAbs = x < 0 ? uint256(-x) : uint256(x);\n yAbs = y < 0 ? uint256(-y) : uint256(y);\n dAbs = denominator < 0 ? uint256(-denominator) : uint256(denominator);\n }\n\n // Compute the absolute value of x*y÷denominator. The result must fit in int256.\n uint256 resultAbs = mulDiv(xAbs, yAbs, dAbs);\n if (resultAbs > uint256(type(int256).max)) {\n revert PRBMath_MulDivSigned_Overflow(x, y);\n }\n\n // Get the signs of x, y and the denominator.\n uint256 sx;\n uint256 sy;\n uint256 sd;\n assembly (\"memory-safe\") {\n // \"sgt\" is the \"signed greater than\" assembly instruction and \"sub(0,1)\" is -1 in two's complement.\n sx := sgt(x, sub(0, 1))\n sy := sgt(y, sub(0, 1))\n sd := sgt(denominator, sub(0, 1))\n }\n\n // XOR over sx, sy and sd. What this does is to check whether there are 1 or 3 negative signs in the inputs.\n // If there are, the result should be negative. Otherwise, it should be positive.\n unchecked {\n result = sx ^ sy ^ sd == 0 ? -int256(resultAbs) : int256(resultAbs);\n }\n}\n\n/// @notice Calculates the square root of x using the Babylonian method.\n///\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\n///\n/// Notes:\n/// - If x is not a perfect square, the result is rounded down.\n/// - Credits to OpenZeppelin for the explanations in comments below.\n///\n/// @param x The uint256 number for which to calculate the square root.\n/// @return result The result as a uint256.\n/// @custom:smtchecker abstract-function-nondet\nfunction sqrt(uint256 x) pure returns (uint256 result) {\n if (x == 0) {\n return 0;\n }\n\n // For our first guess, we calculate the biggest power of 2 which is smaller than the square root of x.\n //\n // We know that the \"msb\" (most significant bit) of x is a power of 2 such that we have:\n //\n // $$\n // msb(x) <= x <= 2*msb(x)$\n // $$\n //\n // We write $msb(x)$ as $2^k$, and we get:\n //\n // $$\n // k = log_2(x)\n // $$\n //\n // Thus, we can write the initial inequality as:\n //\n // $$\n // 2^{log_2(x)} <= x <= 2*2^{log_2(x)+1} \\\\\n // sqrt(2^k) <= sqrt(x) < sqrt(2^{k+1}) \\\\\n // 2^{k/2} <= sqrt(x) < 2^{(k+1)/2} <= 2^{(k/2)+1}\n // $$\n //\n // Consequently, $2^{log_2(x) /2} is a good first approximation of sqrt(x) with at least one correct bit.\n uint256 xAux = uint256(x);\n result = 1;\n if (xAux >= 2 ** 128) {\n xAux >>= 128;\n result <<= 64;\n }\n if (xAux >= 2 ** 64) {\n xAux >>= 64;\n result <<= 32;\n }\n if (xAux >= 2 ** 32) {\n xAux >>= 32;\n result <<= 16;\n }\n if (xAux >= 2 ** 16) {\n xAux >>= 16;\n result <<= 8;\n }\n if (xAux >= 2 ** 8) {\n xAux >>= 8;\n result <<= 4;\n }\n if (xAux >= 2 ** 4) {\n xAux >>= 4;\n result <<= 2;\n }\n if (xAux >= 2 ** 2) {\n result <<= 1;\n }\n\n // At this point, `result` is an estimation with at least one bit of precision. We know the true value has at\n // most 128 bits, since it is the square root of a uint256. Newton's method converges quadratically (precision\n // doubles at every iteration). We thus need at most 7 iteration to turn our partial result with one bit of\n // precision into the expected uint128 result.\n unchecked {\n result = (result + x / result) >> 1;\n result = (result + x / result) >> 1;\n result = (result + x / result) >> 1;\n result = (result + x / result) >> 1;\n result = (result + x / result) >> 1;\n result = (result + x / result) >> 1;\n result = (result + x / result) >> 1;\n\n // If x is not a perfect square, round the result toward zero.\n uint256 roundedResult = x / result;\n if (result >= roundedResult) {\n result = roundedResult;\n }\n }\n}\n" + }, + "@prb/math/src/sd1x18/Casting.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport \"../Common.sol\" as Common;\nimport \"./Errors.sol\" as CastingErrors;\nimport { SD59x18 } from \"../sd59x18/ValueType.sol\";\nimport { UD2x18 } from \"../ud2x18/ValueType.sol\";\nimport { UD60x18 } from \"../ud60x18/ValueType.sol\";\nimport { SD1x18 } from \"./ValueType.sol\";\n\n/// @notice Casts an SD1x18 number into SD59x18.\n/// @dev There is no overflow check because the domain of SD1x18 is a subset of SD59x18.\nfunction intoSD59x18(SD1x18 x) pure returns (SD59x18 result) {\n result = SD59x18.wrap(int256(SD1x18.unwrap(x)));\n}\n\n/// @notice Casts an SD1x18 number into UD2x18.\n/// - x must be positive.\nfunction intoUD2x18(SD1x18 x) pure returns (UD2x18 result) {\n int64 xInt = SD1x18.unwrap(x);\n if (xInt < 0) {\n revert CastingErrors.PRBMath_SD1x18_ToUD2x18_Underflow(x);\n }\n result = UD2x18.wrap(uint64(xInt));\n}\n\n/// @notice Casts an SD1x18 number into UD60x18.\n/// @dev Requirements:\n/// - x must be positive.\nfunction intoUD60x18(SD1x18 x) pure returns (UD60x18 result) {\n int64 xInt = SD1x18.unwrap(x);\n if (xInt < 0) {\n revert CastingErrors.PRBMath_SD1x18_ToUD60x18_Underflow(x);\n }\n result = UD60x18.wrap(uint64(xInt));\n}\n\n/// @notice Casts an SD1x18 number into uint256.\n/// @dev Requirements:\n/// - x must be positive.\nfunction intoUint256(SD1x18 x) pure returns (uint256 result) {\n int64 xInt = SD1x18.unwrap(x);\n if (xInt < 0) {\n revert CastingErrors.PRBMath_SD1x18_ToUint256_Underflow(x);\n }\n result = uint256(uint64(xInt));\n}\n\n/// @notice Casts an SD1x18 number into uint128.\n/// @dev Requirements:\n/// - x must be positive.\nfunction intoUint128(SD1x18 x) pure returns (uint128 result) {\n int64 xInt = SD1x18.unwrap(x);\n if (xInt < 0) {\n revert CastingErrors.PRBMath_SD1x18_ToUint128_Underflow(x);\n }\n result = uint128(uint64(xInt));\n}\n\n/// @notice Casts an SD1x18 number into uint40.\n/// @dev Requirements:\n/// - x must be positive.\n/// - x must be less than or equal to `MAX_UINT40`.\nfunction intoUint40(SD1x18 x) pure returns (uint40 result) {\n int64 xInt = SD1x18.unwrap(x);\n if (xInt < 0) {\n revert CastingErrors.PRBMath_SD1x18_ToUint40_Underflow(x);\n }\n if (xInt > int64(uint64(Common.MAX_UINT40))) {\n revert CastingErrors.PRBMath_SD1x18_ToUint40_Overflow(x);\n }\n result = uint40(uint64(xInt));\n}\n\n/// @notice Alias for {wrap}.\nfunction sd1x18(int64 x) pure returns (SD1x18 result) {\n result = SD1x18.wrap(x);\n}\n\n/// @notice Unwraps an SD1x18 number into int64.\nfunction unwrap(SD1x18 x) pure returns (int64 result) {\n result = SD1x18.unwrap(x);\n}\n\n/// @notice Wraps an int64 number into SD1x18.\nfunction wrap(int64 x) pure returns (SD1x18 result) {\n result = SD1x18.wrap(x);\n}\n" + }, + "@prb/math/src/sd1x18/Constants.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport { SD1x18 } from \"./ValueType.sol\";\n\n/// @dev Euler's number as an SD1x18 number.\nSD1x18 constant E = SD1x18.wrap(2_718281828459045235);\n\n/// @dev The maximum value an SD1x18 number can have.\nint64 constant uMAX_SD1x18 = 9_223372036854775807;\nSD1x18 constant MAX_SD1x18 = SD1x18.wrap(uMAX_SD1x18);\n\n/// @dev The maximum value an SD1x18 number can have.\nint64 constant uMIN_SD1x18 = -9_223372036854775808;\nSD1x18 constant MIN_SD1x18 = SD1x18.wrap(uMIN_SD1x18);\n\n/// @dev PI as an SD1x18 number.\nSD1x18 constant PI = SD1x18.wrap(3_141592653589793238);\n\n/// @dev The unit number, which gives the decimal precision of SD1x18.\nSD1x18 constant UNIT = SD1x18.wrap(1e18);\nint64 constant uUNIT = 1e18;\n" + }, + "@prb/math/src/sd1x18/Errors.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport { SD1x18 } from \"./ValueType.sol\";\n\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in UD2x18.\nerror PRBMath_SD1x18_ToUD2x18_Underflow(SD1x18 x);\n\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in UD60x18.\nerror PRBMath_SD1x18_ToUD60x18_Underflow(SD1x18 x);\n\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint128.\nerror PRBMath_SD1x18_ToUint128_Underflow(SD1x18 x);\n\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint256.\nerror PRBMath_SD1x18_ToUint256_Underflow(SD1x18 x);\n\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint40.\nerror PRBMath_SD1x18_ToUint40_Overflow(SD1x18 x);\n\n/// @notice Thrown when trying to cast a SD1x18 number that doesn't fit in uint40.\nerror PRBMath_SD1x18_ToUint40_Underflow(SD1x18 x);\n" + }, + "@prb/math/src/sd1x18/ValueType.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport \"./Casting.sol\" as Casting;\n\n/// @notice The signed 1.18-decimal fixed-point number representation, which can have up to 1 digit and up to 18\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\n/// type int64. This is useful when end users want to use int64 to save gas, e.g. with tight variable packing in contract\n/// storage.\ntype SD1x18 is int64;\n\n/*//////////////////////////////////////////////////////////////////////////\n CASTING\n//////////////////////////////////////////////////////////////////////////*/\n\nusing {\n Casting.intoSD59x18,\n Casting.intoUD2x18,\n Casting.intoUD60x18,\n Casting.intoUint256,\n Casting.intoUint128,\n Casting.intoUint40,\n Casting.unwrap\n} for SD1x18 global;\n" + }, + "@prb/math/src/sd59x18/Casting.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport \"./Errors.sol\" as CastingErrors;\nimport { MAX_UINT128, MAX_UINT40 } from \"../Common.sol\";\nimport { uMAX_SD1x18, uMIN_SD1x18 } from \"../sd1x18/Constants.sol\";\nimport { SD1x18 } from \"../sd1x18/ValueType.sol\";\nimport { uMAX_UD2x18 } from \"../ud2x18/Constants.sol\";\nimport { UD2x18 } from \"../ud2x18/ValueType.sol\";\nimport { UD60x18 } from \"../ud60x18/ValueType.sol\";\nimport { SD59x18 } from \"./ValueType.sol\";\n\n/// @notice Casts an SD59x18 number into int256.\n/// @dev This is basically a functional alias for {unwrap}.\nfunction intoInt256(SD59x18 x) pure returns (int256 result) {\n result = SD59x18.unwrap(x);\n}\n\n/// @notice Casts an SD59x18 number into SD1x18.\n/// @dev Requirements:\n/// - x must be greater than or equal to `uMIN_SD1x18`.\n/// - x must be less than or equal to `uMAX_SD1x18`.\nfunction intoSD1x18(SD59x18 x) pure returns (SD1x18 result) {\n int256 xInt = SD59x18.unwrap(x);\n if (xInt < uMIN_SD1x18) {\n revert CastingErrors.PRBMath_SD59x18_IntoSD1x18_Underflow(x);\n }\n if (xInt > uMAX_SD1x18) {\n revert CastingErrors.PRBMath_SD59x18_IntoSD1x18_Overflow(x);\n }\n result = SD1x18.wrap(int64(xInt));\n}\n\n/// @notice Casts an SD59x18 number into UD2x18.\n/// @dev Requirements:\n/// - x must be positive.\n/// - x must be less than or equal to `uMAX_UD2x18`.\nfunction intoUD2x18(SD59x18 x) pure returns (UD2x18 result) {\n int256 xInt = SD59x18.unwrap(x);\n if (xInt < 0) {\n revert CastingErrors.PRBMath_SD59x18_IntoUD2x18_Underflow(x);\n }\n if (xInt > int256(uint256(uMAX_UD2x18))) {\n revert CastingErrors.PRBMath_SD59x18_IntoUD2x18_Overflow(x);\n }\n result = UD2x18.wrap(uint64(uint256(xInt)));\n}\n\n/// @notice Casts an SD59x18 number into UD60x18.\n/// @dev Requirements:\n/// - x must be positive.\nfunction intoUD60x18(SD59x18 x) pure returns (UD60x18 result) {\n int256 xInt = SD59x18.unwrap(x);\n if (xInt < 0) {\n revert CastingErrors.PRBMath_SD59x18_IntoUD60x18_Underflow(x);\n }\n result = UD60x18.wrap(uint256(xInt));\n}\n\n/// @notice Casts an SD59x18 number into uint256.\n/// @dev Requirements:\n/// - x must be positive.\nfunction intoUint256(SD59x18 x) pure returns (uint256 result) {\n int256 xInt = SD59x18.unwrap(x);\n if (xInt < 0) {\n revert CastingErrors.PRBMath_SD59x18_IntoUint256_Underflow(x);\n }\n result = uint256(xInt);\n}\n\n/// @notice Casts an SD59x18 number into uint128.\n/// @dev Requirements:\n/// - x must be positive.\n/// - x must be less than or equal to `uMAX_UINT128`.\nfunction intoUint128(SD59x18 x) pure returns (uint128 result) {\n int256 xInt = SD59x18.unwrap(x);\n if (xInt < 0) {\n revert CastingErrors.PRBMath_SD59x18_IntoUint128_Underflow(x);\n }\n if (xInt > int256(uint256(MAX_UINT128))) {\n revert CastingErrors.PRBMath_SD59x18_IntoUint128_Overflow(x);\n }\n result = uint128(uint256(xInt));\n}\n\n/// @notice Casts an SD59x18 number into uint40.\n/// @dev Requirements:\n/// - x must be positive.\n/// - x must be less than or equal to `MAX_UINT40`.\nfunction intoUint40(SD59x18 x) pure returns (uint40 result) {\n int256 xInt = SD59x18.unwrap(x);\n if (xInt < 0) {\n revert CastingErrors.PRBMath_SD59x18_IntoUint40_Underflow(x);\n }\n if (xInt > int256(uint256(MAX_UINT40))) {\n revert CastingErrors.PRBMath_SD59x18_IntoUint40_Overflow(x);\n }\n result = uint40(uint256(xInt));\n}\n\n/// @notice Alias for {wrap}.\nfunction sd(int256 x) pure returns (SD59x18 result) {\n result = SD59x18.wrap(x);\n}\n\n/// @notice Alias for {wrap}.\nfunction sd59x18(int256 x) pure returns (SD59x18 result) {\n result = SD59x18.wrap(x);\n}\n\n/// @notice Unwraps an SD59x18 number into int256.\nfunction unwrap(SD59x18 x) pure returns (int256 result) {\n result = SD59x18.unwrap(x);\n}\n\n/// @notice Wraps an int256 number into SD59x18.\nfunction wrap(int256 x) pure returns (SD59x18 result) {\n result = SD59x18.wrap(x);\n}\n" + }, + "@prb/math/src/sd59x18/Constants.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport { SD59x18 } from \"./ValueType.sol\";\n\n// NOTICE: the \"u\" prefix stands for \"unwrapped\".\n\n/// @dev Euler's number as an SD59x18 number.\nSD59x18 constant E = SD59x18.wrap(2_718281828459045235);\n\n/// @dev The maximum input permitted in {exp}.\nint256 constant uEXP_MAX_INPUT = 133_084258667509499440;\nSD59x18 constant EXP_MAX_INPUT = SD59x18.wrap(uEXP_MAX_INPUT);\n\n/// @dev Any value less than this returns 0 in {exp}.\nint256 constant uEXP_MIN_THRESHOLD = -41_446531673892822322;\nSD59x18 constant EXP_MIN_THRESHOLD = SD59x18.wrap(uEXP_MIN_THRESHOLD);\n\n/// @dev The maximum input permitted in {exp2}.\nint256 constant uEXP2_MAX_INPUT = 192e18 - 1;\nSD59x18 constant EXP2_MAX_INPUT = SD59x18.wrap(uEXP2_MAX_INPUT);\n\n/// @dev Any value less than this returns 0 in {exp2}.\nint256 constant uEXP2_MIN_THRESHOLD = -59_794705707972522261;\nSD59x18 constant EXP2_MIN_THRESHOLD = SD59x18.wrap(uEXP2_MIN_THRESHOLD);\n\n/// @dev Half the UNIT number.\nint256 constant uHALF_UNIT = 0.5e18;\nSD59x18 constant HALF_UNIT = SD59x18.wrap(uHALF_UNIT);\n\n/// @dev $log_2(10)$ as an SD59x18 number.\nint256 constant uLOG2_10 = 3_321928094887362347;\nSD59x18 constant LOG2_10 = SD59x18.wrap(uLOG2_10);\n\n/// @dev $log_2(e)$ as an SD59x18 number.\nint256 constant uLOG2_E = 1_442695040888963407;\nSD59x18 constant LOG2_E = SD59x18.wrap(uLOG2_E);\n\n/// @dev The maximum value an SD59x18 number can have.\nint256 constant uMAX_SD59x18 = 57896044618658097711785492504343953926634992332820282019728_792003956564819967;\nSD59x18 constant MAX_SD59x18 = SD59x18.wrap(uMAX_SD59x18);\n\n/// @dev The maximum whole value an SD59x18 number can have.\nint256 constant uMAX_WHOLE_SD59x18 = 57896044618658097711785492504343953926634992332820282019728_000000000000000000;\nSD59x18 constant MAX_WHOLE_SD59x18 = SD59x18.wrap(uMAX_WHOLE_SD59x18);\n\n/// @dev The minimum value an SD59x18 number can have.\nint256 constant uMIN_SD59x18 = -57896044618658097711785492504343953926634992332820282019728_792003956564819968;\nSD59x18 constant MIN_SD59x18 = SD59x18.wrap(uMIN_SD59x18);\n\n/// @dev The minimum whole value an SD59x18 number can have.\nint256 constant uMIN_WHOLE_SD59x18 = -57896044618658097711785492504343953926634992332820282019728_000000000000000000;\nSD59x18 constant MIN_WHOLE_SD59x18 = SD59x18.wrap(uMIN_WHOLE_SD59x18);\n\n/// @dev PI as an SD59x18 number.\nSD59x18 constant PI = SD59x18.wrap(3_141592653589793238);\n\n/// @dev The unit number, which gives the decimal precision of SD59x18.\nint256 constant uUNIT = 1e18;\nSD59x18 constant UNIT = SD59x18.wrap(1e18);\n\n/// @dev The unit number squared.\nint256 constant uUNIT_SQUARED = 1e36;\nSD59x18 constant UNIT_SQUARED = SD59x18.wrap(uUNIT_SQUARED);\n\n/// @dev Zero as an SD59x18 number.\nSD59x18 constant ZERO = SD59x18.wrap(0);\n" + }, + "@prb/math/src/sd59x18/Errors.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport { SD59x18 } from \"./ValueType.sol\";\n\n/// @notice Thrown when taking the absolute value of `MIN_SD59x18`.\nerror PRBMath_SD59x18_Abs_MinSD59x18();\n\n/// @notice Thrown when ceiling a number overflows SD59x18.\nerror PRBMath_SD59x18_Ceil_Overflow(SD59x18 x);\n\n/// @notice Thrown when converting a basic integer to the fixed-point format overflows SD59x18.\nerror PRBMath_SD59x18_Convert_Overflow(int256 x);\n\n/// @notice Thrown when converting a basic integer to the fixed-point format underflows SD59x18.\nerror PRBMath_SD59x18_Convert_Underflow(int256 x);\n\n/// @notice Thrown when dividing two numbers and one of them is `MIN_SD59x18`.\nerror PRBMath_SD59x18_Div_InputTooSmall();\n\n/// @notice Thrown when dividing two numbers and one of the intermediary unsigned results overflows SD59x18.\nerror PRBMath_SD59x18_Div_Overflow(SD59x18 x, SD59x18 y);\n\n/// @notice Thrown when taking the natural exponent of a base greater than 133_084258667509499441.\nerror PRBMath_SD59x18_Exp_InputTooBig(SD59x18 x);\n\n/// @notice Thrown when taking the binary exponent of a base greater than 192e18.\nerror PRBMath_SD59x18_Exp2_InputTooBig(SD59x18 x);\n\n/// @notice Thrown when flooring a number underflows SD59x18.\nerror PRBMath_SD59x18_Floor_Underflow(SD59x18 x);\n\n/// @notice Thrown when taking the geometric mean of two numbers and their product is negative.\nerror PRBMath_SD59x18_Gm_NegativeProduct(SD59x18 x, SD59x18 y);\n\n/// @notice Thrown when taking the geometric mean of two numbers and multiplying them overflows SD59x18.\nerror PRBMath_SD59x18_Gm_Overflow(SD59x18 x, SD59x18 y);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\nerror PRBMath_SD59x18_IntoSD1x18_Overflow(SD59x18 x);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\nerror PRBMath_SD59x18_IntoSD1x18_Underflow(SD59x18 x);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\nerror PRBMath_SD59x18_IntoUD2x18_Overflow(SD59x18 x);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\nerror PRBMath_SD59x18_IntoUD2x18_Underflow(SD59x18 x);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD60x18.\nerror PRBMath_SD59x18_IntoUD60x18_Underflow(SD59x18 x);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\nerror PRBMath_SD59x18_IntoUint128_Overflow(SD59x18 x);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\nerror PRBMath_SD59x18_IntoUint128_Underflow(SD59x18 x);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint256.\nerror PRBMath_SD59x18_IntoUint256_Underflow(SD59x18 x);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\nerror PRBMath_SD59x18_IntoUint40_Overflow(SD59x18 x);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\nerror PRBMath_SD59x18_IntoUint40_Underflow(SD59x18 x);\n\n/// @notice Thrown when taking the logarithm of a number less than or equal to zero.\nerror PRBMath_SD59x18_Log_InputTooSmall(SD59x18 x);\n\n/// @notice Thrown when multiplying two numbers and one of the inputs is `MIN_SD59x18`.\nerror PRBMath_SD59x18_Mul_InputTooSmall();\n\n/// @notice Thrown when multiplying two numbers and the intermediary absolute result overflows SD59x18.\nerror PRBMath_SD59x18_Mul_Overflow(SD59x18 x, SD59x18 y);\n\n/// @notice Thrown when raising a number to a power and the intermediary absolute result overflows SD59x18.\nerror PRBMath_SD59x18_Powu_Overflow(SD59x18 x, uint256 y);\n\n/// @notice Thrown when taking the square root of a negative number.\nerror PRBMath_SD59x18_Sqrt_NegativeInput(SD59x18 x);\n\n/// @notice Thrown when the calculating the square root overflows SD59x18.\nerror PRBMath_SD59x18_Sqrt_Overflow(SD59x18 x);\n" + }, + "@prb/math/src/sd59x18/Helpers.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport { wrap } from \"./Casting.sol\";\nimport { SD59x18 } from \"./ValueType.sol\";\n\n/// @notice Implements the checked addition operation (+) in the SD59x18 type.\nfunction add(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\n return wrap(x.unwrap() + y.unwrap());\n}\n\n/// @notice Implements the AND (&) bitwise operation in the SD59x18 type.\nfunction and(SD59x18 x, int256 bits) pure returns (SD59x18 result) {\n return wrap(x.unwrap() & bits);\n}\n\n/// @notice Implements the AND (&) bitwise operation in the SD59x18 type.\nfunction and2(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\n return wrap(x.unwrap() & y.unwrap());\n}\n\n/// @notice Implements the equal (=) operation in the SD59x18 type.\nfunction eq(SD59x18 x, SD59x18 y) pure returns (bool result) {\n result = x.unwrap() == y.unwrap();\n}\n\n/// @notice Implements the greater than operation (>) in the SD59x18 type.\nfunction gt(SD59x18 x, SD59x18 y) pure returns (bool result) {\n result = x.unwrap() > y.unwrap();\n}\n\n/// @notice Implements the greater than or equal to operation (>=) in the SD59x18 type.\nfunction gte(SD59x18 x, SD59x18 y) pure returns (bool result) {\n result = x.unwrap() >= y.unwrap();\n}\n\n/// @notice Implements a zero comparison check function in the SD59x18 type.\nfunction isZero(SD59x18 x) pure returns (bool result) {\n result = x.unwrap() == 0;\n}\n\n/// @notice Implements the left shift operation (<<) in the SD59x18 type.\nfunction lshift(SD59x18 x, uint256 bits) pure returns (SD59x18 result) {\n result = wrap(x.unwrap() << bits);\n}\n\n/// @notice Implements the lower than operation (<) in the SD59x18 type.\nfunction lt(SD59x18 x, SD59x18 y) pure returns (bool result) {\n result = x.unwrap() < y.unwrap();\n}\n\n/// @notice Implements the lower than or equal to operation (<=) in the SD59x18 type.\nfunction lte(SD59x18 x, SD59x18 y) pure returns (bool result) {\n result = x.unwrap() <= y.unwrap();\n}\n\n/// @notice Implements the unchecked modulo operation (%) in the SD59x18 type.\nfunction mod(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\n result = wrap(x.unwrap() % y.unwrap());\n}\n\n/// @notice Implements the not equal operation (!=) in the SD59x18 type.\nfunction neq(SD59x18 x, SD59x18 y) pure returns (bool result) {\n result = x.unwrap() != y.unwrap();\n}\n\n/// @notice Implements the NOT (~) bitwise operation in the SD59x18 type.\nfunction not(SD59x18 x) pure returns (SD59x18 result) {\n result = wrap(~x.unwrap());\n}\n\n/// @notice Implements the OR (|) bitwise operation in the SD59x18 type.\nfunction or(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\n result = wrap(x.unwrap() | y.unwrap());\n}\n\n/// @notice Implements the right shift operation (>>) in the SD59x18 type.\nfunction rshift(SD59x18 x, uint256 bits) pure returns (SD59x18 result) {\n result = wrap(x.unwrap() >> bits);\n}\n\n/// @notice Implements the checked subtraction operation (-) in the SD59x18 type.\nfunction sub(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\n result = wrap(x.unwrap() - y.unwrap());\n}\n\n/// @notice Implements the checked unary minus operation (-) in the SD59x18 type.\nfunction unary(SD59x18 x) pure returns (SD59x18 result) {\n result = wrap(-x.unwrap());\n}\n\n/// @notice Implements the unchecked addition operation (+) in the SD59x18 type.\nfunction uncheckedAdd(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\n unchecked {\n result = wrap(x.unwrap() + y.unwrap());\n }\n}\n\n/// @notice Implements the unchecked subtraction operation (-) in the SD59x18 type.\nfunction uncheckedSub(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\n unchecked {\n result = wrap(x.unwrap() - y.unwrap());\n }\n}\n\n/// @notice Implements the unchecked unary minus operation (-) in the SD59x18 type.\nfunction uncheckedUnary(SD59x18 x) pure returns (SD59x18 result) {\n unchecked {\n result = wrap(-x.unwrap());\n }\n}\n\n/// @notice Implements the XOR (^) bitwise operation in the SD59x18 type.\nfunction xor(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\n result = wrap(x.unwrap() ^ y.unwrap());\n}\n" + }, + "@prb/math/src/sd59x18/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport \"../Common.sol\" as Common;\nimport \"./Errors.sol\" as Errors;\nimport {\n uEXP_MAX_INPUT,\n uEXP2_MAX_INPUT,\n uEXP_MIN_THRESHOLD,\n uEXP2_MIN_THRESHOLD,\n uHALF_UNIT,\n uLOG2_10,\n uLOG2_E,\n uMAX_SD59x18,\n uMAX_WHOLE_SD59x18,\n uMIN_SD59x18,\n uMIN_WHOLE_SD59x18,\n UNIT,\n uUNIT,\n uUNIT_SQUARED,\n ZERO\n} from \"./Constants.sol\";\nimport { wrap } from \"./Helpers.sol\";\nimport { SD59x18 } from \"./ValueType.sol\";\n\n/// @notice Calculates the absolute value of x.\n///\n/// @dev Requirements:\n/// - x must be greater than `MIN_SD59x18`.\n///\n/// @param x The SD59x18 number for which to calculate the absolute value.\n/// @param result The absolute value of x as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction abs(SD59x18 x) pure returns (SD59x18 result) {\n int256 xInt = x.unwrap();\n if (xInt == uMIN_SD59x18) {\n revert Errors.PRBMath_SD59x18_Abs_MinSD59x18();\n }\n result = xInt < 0 ? wrap(-xInt) : x;\n}\n\n/// @notice Calculates the arithmetic average of x and y.\n///\n/// @dev Notes:\n/// - The result is rounded toward zero.\n///\n/// @param x The first operand as an SD59x18 number.\n/// @param y The second operand as an SD59x18 number.\n/// @return result The arithmetic average as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction avg(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\n int256 xInt = x.unwrap();\n int256 yInt = y.unwrap();\n\n unchecked {\n // This operation is equivalent to `x / 2 + y / 2`, and it can never overflow.\n int256 sum = (xInt >> 1) + (yInt >> 1);\n\n if (sum < 0) {\n // If at least one of x and y is odd, add 1 to the result, because shifting negative numbers to the right\n // rounds toward negative infinity. The right part is equivalent to `sum + (x % 2 == 1 || y % 2 == 1)`.\n assembly (\"memory-safe\") {\n result := add(sum, and(or(xInt, yInt), 1))\n }\n } else {\n // Add 1 if both x and y are odd to account for the double 0.5 remainder truncated after shifting.\n result = wrap(sum + (xInt & yInt & 1));\n }\n }\n}\n\n/// @notice Yields the smallest whole number greater than or equal to x.\n///\n/// @dev Optimized for fractional value inputs, because every whole value has (1e18 - 1) fractional counterparts.\n/// See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\n///\n/// Requirements:\n/// - x must be less than or equal to `MAX_WHOLE_SD59x18`.\n///\n/// @param x The SD59x18 number to ceil.\n/// @param result The smallest whole number greater than or equal to x, as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction ceil(SD59x18 x) pure returns (SD59x18 result) {\n int256 xInt = x.unwrap();\n if (xInt > uMAX_WHOLE_SD59x18) {\n revert Errors.PRBMath_SD59x18_Ceil_Overflow(x);\n }\n\n int256 remainder = xInt % uUNIT;\n if (remainder == 0) {\n result = x;\n } else {\n unchecked {\n // Solidity uses C fmod style, which returns a modulus with the same sign as x.\n int256 resultInt = xInt - remainder;\n if (xInt > 0) {\n resultInt += uUNIT;\n }\n result = wrap(resultInt);\n }\n }\n}\n\n/// @notice Divides two SD59x18 numbers, returning a new SD59x18 number.\n///\n/// @dev This is an extension of {Common.mulDiv} for signed numbers, which works by computing the signs and the absolute\n/// values separately.\n///\n/// Notes:\n/// - Refer to the notes in {Common.mulDiv}.\n/// - The result is rounded toward zero.\n///\n/// Requirements:\n/// - Refer to the requirements in {Common.mulDiv}.\n/// - None of the inputs can be `MIN_SD59x18`.\n/// - The denominator must not be zero.\n/// - The result must fit in SD59x18.\n///\n/// @param x The numerator as an SD59x18 number.\n/// @param y The denominator as an SD59x18 number.\n/// @param result The quotient as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction div(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\n int256 xInt = x.unwrap();\n int256 yInt = y.unwrap();\n if (xInt == uMIN_SD59x18 || yInt == uMIN_SD59x18) {\n revert Errors.PRBMath_SD59x18_Div_InputTooSmall();\n }\n\n // Get hold of the absolute values of x and y.\n uint256 xAbs;\n uint256 yAbs;\n unchecked {\n xAbs = xInt < 0 ? uint256(-xInt) : uint256(xInt);\n yAbs = yInt < 0 ? uint256(-yInt) : uint256(yInt);\n }\n\n // Compute the absolute value (x*UNIT÷y). The resulting value must fit in SD59x18.\n uint256 resultAbs = Common.mulDiv(xAbs, uint256(uUNIT), yAbs);\n if (resultAbs > uint256(uMAX_SD59x18)) {\n revert Errors.PRBMath_SD59x18_Div_Overflow(x, y);\n }\n\n // Check if x and y have the same sign using two's complement representation. The left-most bit represents the sign (1 for\n // negative, 0 for positive or zero).\n bool sameSign = (xInt ^ yInt) > -1;\n\n // If the inputs have the same sign, the result should be positive. Otherwise, it should be negative.\n unchecked {\n result = wrap(sameSign ? int256(resultAbs) : -int256(resultAbs));\n }\n}\n\n/// @notice Calculates the natural exponent of x using the following formula:\n///\n/// $$\n/// e^x = 2^{x * log_2{e}}\n/// $$\n///\n/// @dev Notes:\n/// - Refer to the notes in {exp2}.\n///\n/// Requirements:\n/// - Refer to the requirements in {exp2}.\n/// - x must be less than 133_084258667509499441.\n///\n/// @param x The exponent as an SD59x18 number.\n/// @return result The result as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction exp(SD59x18 x) pure returns (SD59x18 result) {\n int256 xInt = x.unwrap();\n\n // Any input less than the threshold returns zero.\n // This check also prevents an overflow for very small numbers.\n if (xInt < uEXP_MIN_THRESHOLD) {\n return ZERO;\n }\n\n // This check prevents values greater than 192e18 from being passed to {exp2}.\n if (xInt > uEXP_MAX_INPUT) {\n revert Errors.PRBMath_SD59x18_Exp_InputTooBig(x);\n }\n\n unchecked {\n // Inline the fixed-point multiplication to save gas.\n int256 doubleUnitProduct = xInt * uLOG2_E;\n result = exp2(wrap(doubleUnitProduct / uUNIT));\n }\n}\n\n/// @notice Calculates the binary exponent of x using the binary fraction method using the following formula:\n///\n/// $$\n/// 2^{-x} = \\frac{1}{2^x}\n/// $$\n///\n/// @dev See https://ethereum.stackexchange.com/q/79903/24693.\n///\n/// Notes:\n/// - If x is less than -59_794705707972522261, the result is zero.\n///\n/// Requirements:\n/// - x must be less than 192e18.\n/// - The result must fit in SD59x18.\n///\n/// @param x The exponent as an SD59x18 number.\n/// @return result The result as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction exp2(SD59x18 x) pure returns (SD59x18 result) {\n int256 xInt = x.unwrap();\n if (xInt < 0) {\n // The inverse of any number less than the threshold is truncated to zero.\n if (xInt < uEXP2_MIN_THRESHOLD) {\n return ZERO;\n }\n\n unchecked {\n // Inline the fixed-point inversion to save gas.\n result = wrap(uUNIT_SQUARED / exp2(wrap(-xInt)).unwrap());\n }\n } else {\n // Numbers greater than or equal to 192e18 don't fit in the 192.64-bit format.\n if (xInt > uEXP2_MAX_INPUT) {\n revert Errors.PRBMath_SD59x18_Exp2_InputTooBig(x);\n }\n\n unchecked {\n // Convert x to the 192.64-bit fixed-point format.\n uint256 x_192x64 = uint256((xInt << 64) / uUNIT);\n\n // It is safe to cast the result to int256 due to the checks above.\n result = wrap(int256(Common.exp2(x_192x64)));\n }\n }\n}\n\n/// @notice Yields the greatest whole number less than or equal to x.\n///\n/// @dev Optimized for fractional value inputs, because for every whole value there are (1e18 - 1) fractional\n/// counterparts. See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\n///\n/// Requirements:\n/// - x must be greater than or equal to `MIN_WHOLE_SD59x18`.\n///\n/// @param x The SD59x18 number to floor.\n/// @param result The greatest whole number less than or equal to x, as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction floor(SD59x18 x) pure returns (SD59x18 result) {\n int256 xInt = x.unwrap();\n if (xInt < uMIN_WHOLE_SD59x18) {\n revert Errors.PRBMath_SD59x18_Floor_Underflow(x);\n }\n\n int256 remainder = xInt % uUNIT;\n if (remainder == 0) {\n result = x;\n } else {\n unchecked {\n // Solidity uses C fmod style, which returns a modulus with the same sign as x.\n int256 resultInt = xInt - remainder;\n if (xInt < 0) {\n resultInt -= uUNIT;\n }\n result = wrap(resultInt);\n }\n }\n}\n\n/// @notice Yields the excess beyond the floor of x for positive numbers and the part of the number to the right.\n/// of the radix point for negative numbers.\n/// @dev Based on the odd function definition. https://en.wikipedia.org/wiki/Fractional_part\n/// @param x The SD59x18 number to get the fractional part of.\n/// @param result The fractional part of x as an SD59x18 number.\nfunction frac(SD59x18 x) pure returns (SD59x18 result) {\n result = wrap(x.unwrap() % uUNIT);\n}\n\n/// @notice Calculates the geometric mean of x and y, i.e. $\\sqrt{x * y}$.\n///\n/// @dev Notes:\n/// - The result is rounded toward zero.\n///\n/// Requirements:\n/// - x * y must fit in SD59x18.\n/// - x * y must not be negative, since complex numbers are not supported.\n///\n/// @param x The first operand as an SD59x18 number.\n/// @param y The second operand as an SD59x18 number.\n/// @return result The result as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction gm(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\n int256 xInt = x.unwrap();\n int256 yInt = y.unwrap();\n if (xInt == 0 || yInt == 0) {\n return ZERO;\n }\n\n unchecked {\n // Equivalent to `xy / x != y`. Checking for overflow this way is faster than letting Solidity do it.\n int256 xyInt = xInt * yInt;\n if (xyInt / xInt != yInt) {\n revert Errors.PRBMath_SD59x18_Gm_Overflow(x, y);\n }\n\n // The product must not be negative, since complex numbers are not supported.\n if (xyInt < 0) {\n revert Errors.PRBMath_SD59x18_Gm_NegativeProduct(x, y);\n }\n\n // We don't need to multiply the result by `UNIT` here because the x*y product picked up a factor of `UNIT`\n // during multiplication. See the comments in {Common.sqrt}.\n uint256 resultUint = Common.sqrt(uint256(xyInt));\n result = wrap(int256(resultUint));\n }\n}\n\n/// @notice Calculates the inverse of x.\n///\n/// @dev Notes:\n/// - The result is rounded toward zero.\n///\n/// Requirements:\n/// - x must not be zero.\n///\n/// @param x The SD59x18 number for which to calculate the inverse.\n/// @return result The inverse as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction inv(SD59x18 x) pure returns (SD59x18 result) {\n result = wrap(uUNIT_SQUARED / x.unwrap());\n}\n\n/// @notice Calculates the natural logarithm of x using the following formula:\n///\n/// $$\n/// ln{x} = log_2{x} / log_2{e}\n/// $$\n///\n/// @dev Notes:\n/// - Refer to the notes in {log2}.\n/// - The precision isn't sufficiently fine-grained to return exactly `UNIT` when the input is `E`.\n///\n/// Requirements:\n/// - Refer to the requirements in {log2}.\n///\n/// @param x The SD59x18 number for which to calculate the natural logarithm.\n/// @return result The natural logarithm as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction ln(SD59x18 x) pure returns (SD59x18 result) {\n // Inline the fixed-point multiplication to save gas. This is overflow-safe because the maximum value that\n // {log2} can return is ~195_205294292027477728.\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_E);\n}\n\n/// @notice Calculates the common logarithm of x using the following formula:\n///\n/// $$\n/// log_{10}{x} = log_2{x} / log_2{10}\n/// $$\n///\n/// However, if x is an exact power of ten, a hard coded value is returned.\n///\n/// @dev Notes:\n/// - Refer to the notes in {log2}.\n///\n/// Requirements:\n/// - Refer to the requirements in {log2}.\n///\n/// @param x The SD59x18 number for which to calculate the common logarithm.\n/// @return result The common logarithm as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction log10(SD59x18 x) pure returns (SD59x18 result) {\n int256 xInt = x.unwrap();\n if (xInt < 0) {\n revert Errors.PRBMath_SD59x18_Log_InputTooSmall(x);\n }\n\n // Note that the `mul` in this block is the standard multiplication operation, not {SD59x18.mul}.\n // prettier-ignore\n assembly (\"memory-safe\") {\n switch x\n case 1 { result := mul(uUNIT, sub(0, 18)) }\n case 10 { result := mul(uUNIT, sub(1, 18)) }\n case 100 { result := mul(uUNIT, sub(2, 18)) }\n case 1000 { result := mul(uUNIT, sub(3, 18)) }\n case 10000 { result := mul(uUNIT, sub(4, 18)) }\n case 100000 { result := mul(uUNIT, sub(5, 18)) }\n case 1000000 { result := mul(uUNIT, sub(6, 18)) }\n case 10000000 { result := mul(uUNIT, sub(7, 18)) }\n case 100000000 { result := mul(uUNIT, sub(8, 18)) }\n case 1000000000 { result := mul(uUNIT, sub(9, 18)) }\n case 10000000000 { result := mul(uUNIT, sub(10, 18)) }\n case 100000000000 { result := mul(uUNIT, sub(11, 18)) }\n case 1000000000000 { result := mul(uUNIT, sub(12, 18)) }\n case 10000000000000 { result := mul(uUNIT, sub(13, 18)) }\n case 100000000000000 { result := mul(uUNIT, sub(14, 18)) }\n case 1000000000000000 { result := mul(uUNIT, sub(15, 18)) }\n case 10000000000000000 { result := mul(uUNIT, sub(16, 18)) }\n case 100000000000000000 { result := mul(uUNIT, sub(17, 18)) }\n case 1000000000000000000 { result := 0 }\n case 10000000000000000000 { result := uUNIT }\n case 100000000000000000000 { result := mul(uUNIT, 2) }\n case 1000000000000000000000 { result := mul(uUNIT, 3) }\n case 10000000000000000000000 { result := mul(uUNIT, 4) }\n case 100000000000000000000000 { result := mul(uUNIT, 5) }\n case 1000000000000000000000000 { result := mul(uUNIT, 6) }\n case 10000000000000000000000000 { result := mul(uUNIT, 7) }\n case 100000000000000000000000000 { result := mul(uUNIT, 8) }\n case 1000000000000000000000000000 { result := mul(uUNIT, 9) }\n case 10000000000000000000000000000 { result := mul(uUNIT, 10) }\n case 100000000000000000000000000000 { result := mul(uUNIT, 11) }\n case 1000000000000000000000000000000 { result := mul(uUNIT, 12) }\n case 10000000000000000000000000000000 { result := mul(uUNIT, 13) }\n case 100000000000000000000000000000000 { result := mul(uUNIT, 14) }\n case 1000000000000000000000000000000000 { result := mul(uUNIT, 15) }\n case 10000000000000000000000000000000000 { result := mul(uUNIT, 16) }\n case 100000000000000000000000000000000000 { result := mul(uUNIT, 17) }\n case 1000000000000000000000000000000000000 { result := mul(uUNIT, 18) }\n case 10000000000000000000000000000000000000 { result := mul(uUNIT, 19) }\n case 100000000000000000000000000000000000000 { result := mul(uUNIT, 20) }\n case 1000000000000000000000000000000000000000 { result := mul(uUNIT, 21) }\n case 10000000000000000000000000000000000000000 { result := mul(uUNIT, 22) }\n case 100000000000000000000000000000000000000000 { result := mul(uUNIT, 23) }\n case 1000000000000000000000000000000000000000000 { result := mul(uUNIT, 24) }\n case 10000000000000000000000000000000000000000000 { result := mul(uUNIT, 25) }\n case 100000000000000000000000000000000000000000000 { result := mul(uUNIT, 26) }\n case 1000000000000000000000000000000000000000000000 { result := mul(uUNIT, 27) }\n case 10000000000000000000000000000000000000000000000 { result := mul(uUNIT, 28) }\n case 100000000000000000000000000000000000000000000000 { result := mul(uUNIT, 29) }\n case 1000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 30) }\n case 10000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 31) }\n case 100000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 32) }\n case 1000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 33) }\n case 10000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 34) }\n case 100000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 35) }\n case 1000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 36) }\n case 10000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 37) }\n case 100000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 38) }\n case 1000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 39) }\n case 10000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 40) }\n case 100000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 41) }\n case 1000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 42) }\n case 10000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 43) }\n case 100000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 44) }\n case 1000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 45) }\n case 10000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 46) }\n case 100000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 47) }\n case 1000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 48) }\n case 10000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 49) }\n case 100000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 50) }\n case 1000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 51) }\n case 10000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 52) }\n case 100000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 53) }\n case 1000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 54) }\n case 10000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 55) }\n case 100000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 56) }\n case 1000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 57) }\n case 10000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 58) }\n default { result := uMAX_SD59x18 }\n }\n\n if (result.unwrap() == uMAX_SD59x18) {\n unchecked {\n // Inline the fixed-point division to save gas.\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_10);\n }\n }\n}\n\n/// @notice Calculates the binary logarithm of x using the iterative approximation algorithm:\n///\n/// $$\n/// log_2{x} = n + log_2{y}, \\text{ where } y = x*2^{-n}, \\ y \\in [1, 2)\n/// $$\n///\n/// For $0 \\leq x \\lt 1$, the input is inverted:\n///\n/// $$\n/// log_2{x} = -log_2{\\frac{1}{x}}\n/// $$\n///\n/// @dev See https://en.wikipedia.org/wiki/Binary_logarithm#Iterative_approximation.\n///\n/// Notes:\n/// - Due to the lossy precision of the iterative approximation, the results are not perfectly accurate to the last decimal.\n///\n/// Requirements:\n/// - x must be greater than zero.\n///\n/// @param x The SD59x18 number for which to calculate the binary logarithm.\n/// @return result The binary logarithm as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction log2(SD59x18 x) pure returns (SD59x18 result) {\n int256 xInt = x.unwrap();\n if (xInt <= 0) {\n revert Errors.PRBMath_SD59x18_Log_InputTooSmall(x);\n }\n\n unchecked {\n int256 sign;\n if (xInt >= uUNIT) {\n sign = 1;\n } else {\n sign = -1;\n // Inline the fixed-point inversion to save gas.\n xInt = uUNIT_SQUARED / xInt;\n }\n\n // Calculate the integer part of the logarithm.\n uint256 n = Common.msb(uint256(xInt / uUNIT));\n\n // This is the integer part of the logarithm as an SD59x18 number. The operation can't overflow\n // because n is at most 255, `UNIT` is 1e18, and the sign is either 1 or -1.\n int256 resultInt = int256(n) * uUNIT;\n\n // Calculate $y = x * 2^{-n}$.\n int256 y = xInt >> n;\n\n // If y is the unit number, the fractional part is zero.\n if (y == uUNIT) {\n return wrap(resultInt * sign);\n }\n\n // Calculate the fractional part via the iterative approximation.\n // The `delta >>= 1` part is equivalent to `delta /= 2`, but shifting bits is more gas efficient.\n int256 DOUBLE_UNIT = 2e18;\n for (int256 delta = uHALF_UNIT; delta > 0; delta >>= 1) {\n y = (y * y) / uUNIT;\n\n // Is y^2 >= 2e18 and so in the range [2e18, 4e18)?\n if (y >= DOUBLE_UNIT) {\n // Add the 2^{-m} factor to the logarithm.\n resultInt = resultInt + delta;\n\n // Halve y, which corresponds to z/2 in the Wikipedia article.\n y >>= 1;\n }\n }\n resultInt *= sign;\n result = wrap(resultInt);\n }\n}\n\n/// @notice Multiplies two SD59x18 numbers together, returning a new SD59x18 number.\n///\n/// @dev Notes:\n/// - Refer to the notes in {Common.mulDiv18}.\n///\n/// Requirements:\n/// - Refer to the requirements in {Common.mulDiv18}.\n/// - None of the inputs can be `MIN_SD59x18`.\n/// - The result must fit in SD59x18.\n///\n/// @param x The multiplicand as an SD59x18 number.\n/// @param y The multiplier as an SD59x18 number.\n/// @return result The product as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction mul(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\n int256 xInt = x.unwrap();\n int256 yInt = y.unwrap();\n if (xInt == uMIN_SD59x18 || yInt == uMIN_SD59x18) {\n revert Errors.PRBMath_SD59x18_Mul_InputTooSmall();\n }\n\n // Get hold of the absolute values of x and y.\n uint256 xAbs;\n uint256 yAbs;\n unchecked {\n xAbs = xInt < 0 ? uint256(-xInt) : uint256(xInt);\n yAbs = yInt < 0 ? uint256(-yInt) : uint256(yInt);\n }\n\n // Compute the absolute value (x*y÷UNIT). The resulting value must fit in SD59x18.\n uint256 resultAbs = Common.mulDiv18(xAbs, yAbs);\n if (resultAbs > uint256(uMAX_SD59x18)) {\n revert Errors.PRBMath_SD59x18_Mul_Overflow(x, y);\n }\n\n // Check if x and y have the same sign using two's complement representation. The left-most bit represents the sign (1 for\n // negative, 0 for positive or zero).\n bool sameSign = (xInt ^ yInt) > -1;\n\n // If the inputs have the same sign, the result should be positive. Otherwise, it should be negative.\n unchecked {\n result = wrap(sameSign ? int256(resultAbs) : -int256(resultAbs));\n }\n}\n\n/// @notice Raises x to the power of y using the following formula:\n///\n/// $$\n/// x^y = 2^{log_2{x} * y}\n/// $$\n///\n/// @dev Notes:\n/// - Refer to the notes in {exp2}, {log2}, and {mul}.\n/// - Returns `UNIT` for 0^0.\n///\n/// Requirements:\n/// - Refer to the requirements in {exp2}, {log2}, and {mul}.\n///\n/// @param x The base as an SD59x18 number.\n/// @param y Exponent to raise x to, as an SD59x18 number\n/// @return result x raised to power y, as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction pow(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) {\n int256 xInt = x.unwrap();\n int256 yInt = y.unwrap();\n\n // If both x and y are zero, the result is `UNIT`. If just x is zero, the result is always zero.\n if (xInt == 0) {\n return yInt == 0 ? UNIT : ZERO;\n }\n // If x is `UNIT`, the result is always `UNIT`.\n else if (xInt == uUNIT) {\n return UNIT;\n }\n\n // If y is zero, the result is always `UNIT`.\n if (yInt == 0) {\n return UNIT;\n }\n // If y is `UNIT`, the result is always x.\n else if (yInt == uUNIT) {\n return x;\n }\n\n // Calculate the result using the formula.\n result = exp2(mul(log2(x), y));\n}\n\n/// @notice Raises x (an SD59x18 number) to the power y (an unsigned basic integer) using the well-known\n/// algorithm \"exponentiation by squaring\".\n///\n/// @dev See https://en.wikipedia.org/wiki/Exponentiation_by_squaring.\n///\n/// Notes:\n/// - Refer to the notes in {Common.mulDiv18}.\n/// - Returns `UNIT` for 0^0.\n///\n/// Requirements:\n/// - Refer to the requirements in {abs} and {Common.mulDiv18}.\n/// - The result must fit in SD59x18.\n///\n/// @param x The base as an SD59x18 number.\n/// @param y The exponent as a uint256.\n/// @return result The result as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction powu(SD59x18 x, uint256 y) pure returns (SD59x18 result) {\n uint256 xAbs = uint256(abs(x).unwrap());\n\n // Calculate the first iteration of the loop in advance.\n uint256 resultAbs = y & 1 > 0 ? xAbs : uint256(uUNIT);\n\n // Equivalent to `for(y /= 2; y > 0; y /= 2)`.\n uint256 yAux = y;\n for (yAux >>= 1; yAux > 0; yAux >>= 1) {\n xAbs = Common.mulDiv18(xAbs, xAbs);\n\n // Equivalent to `y % 2 == 1`.\n if (yAux & 1 > 0) {\n resultAbs = Common.mulDiv18(resultAbs, xAbs);\n }\n }\n\n // The result must fit in SD59x18.\n if (resultAbs > uint256(uMAX_SD59x18)) {\n revert Errors.PRBMath_SD59x18_Powu_Overflow(x, y);\n }\n\n unchecked {\n // Is the base negative and the exponent odd? If yes, the result should be negative.\n int256 resultInt = int256(resultAbs);\n bool isNegative = x.unwrap() < 0 && y & 1 == 1;\n if (isNegative) {\n resultInt = -resultInt;\n }\n result = wrap(resultInt);\n }\n}\n\n/// @notice Calculates the square root of x using the Babylonian method.\n///\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\n///\n/// Notes:\n/// - Only the positive root is returned.\n/// - The result is rounded toward zero.\n///\n/// Requirements:\n/// - x cannot be negative, since complex numbers are not supported.\n/// - x must be less than `MAX_SD59x18 / UNIT`.\n///\n/// @param x The SD59x18 number for which to calculate the square root.\n/// @return result The result as an SD59x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction sqrt(SD59x18 x) pure returns (SD59x18 result) {\n int256 xInt = x.unwrap();\n if (xInt < 0) {\n revert Errors.PRBMath_SD59x18_Sqrt_NegativeInput(x);\n }\n if (xInt > uMAX_SD59x18 / uUNIT) {\n revert Errors.PRBMath_SD59x18_Sqrt_Overflow(x);\n }\n\n unchecked {\n // Multiply x by `UNIT` to account for the factor of `UNIT` picked up when multiplying two SD59x18 numbers.\n // In this case, the two numbers are both the square root.\n uint256 resultUint = Common.sqrt(uint256(xInt * uUNIT));\n result = wrap(int256(resultUint));\n }\n}\n" + }, + "@prb/math/src/sd59x18/ValueType.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport \"./Casting.sol\" as Casting;\nimport \"./Helpers.sol\" as Helpers;\nimport \"./Math.sol\" as Math;\n\n/// @notice The signed 59.18-decimal fixed-point number representation, which can have up to 59 digits and up to 18\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\n/// type int256.\ntype SD59x18 is int256;\n\n/*//////////////////////////////////////////////////////////////////////////\n CASTING\n//////////////////////////////////////////////////////////////////////////*/\n\nusing {\n Casting.intoInt256,\n Casting.intoSD1x18,\n Casting.intoUD2x18,\n Casting.intoUD60x18,\n Casting.intoUint256,\n Casting.intoUint128,\n Casting.intoUint40,\n Casting.unwrap\n} for SD59x18 global;\n\n/*//////////////////////////////////////////////////////////////////////////\n MATHEMATICAL FUNCTIONS\n//////////////////////////////////////////////////////////////////////////*/\n\nusing {\n Math.abs,\n Math.avg,\n Math.ceil,\n Math.div,\n Math.exp,\n Math.exp2,\n Math.floor,\n Math.frac,\n Math.gm,\n Math.inv,\n Math.log10,\n Math.log2,\n Math.ln,\n Math.mul,\n Math.pow,\n Math.powu,\n Math.sqrt\n} for SD59x18 global;\n\n/*//////////////////////////////////////////////////////////////////////////\n HELPER FUNCTIONS\n//////////////////////////////////////////////////////////////////////////*/\n\nusing {\n Helpers.add,\n Helpers.and,\n Helpers.eq,\n Helpers.gt,\n Helpers.gte,\n Helpers.isZero,\n Helpers.lshift,\n Helpers.lt,\n Helpers.lte,\n Helpers.mod,\n Helpers.neq,\n Helpers.not,\n Helpers.or,\n Helpers.rshift,\n Helpers.sub,\n Helpers.uncheckedAdd,\n Helpers.uncheckedSub,\n Helpers.uncheckedUnary,\n Helpers.xor\n} for SD59x18 global;\n\n/*//////////////////////////////////////////////////////////////////////////\n OPERATORS\n//////////////////////////////////////////////////////////////////////////*/\n\n// The global \"using for\" directive makes it possible to use these operators on the SD59x18 type.\nusing {\n Helpers.add as +,\n Helpers.and2 as &,\n Math.div as /,\n Helpers.eq as ==,\n Helpers.gt as >,\n Helpers.gte as >=,\n Helpers.lt as <,\n Helpers.lte as <=,\n Helpers.mod as %,\n Math.mul as *,\n Helpers.neq as !=,\n Helpers.not as ~,\n Helpers.or as |,\n Helpers.sub as -,\n Helpers.unary as -,\n Helpers.xor as ^\n} for SD59x18 global;\n" + }, + "@prb/math/src/UD2x18.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\n/*\n\n██████╗ ██████╗ ██████╗ ███╗ ███╗ █████╗ ████████╗██╗ ██╗\n██╔══██╗██╔══██╗██╔══██╗████╗ ████║██╔══██╗╚══██╔══╝██║ ██║\n██████╔╝██████╔╝██████╔╝██╔████╔██║███████║ ██║ ███████║\n██╔═══╝ ██╔══██╗██╔══██╗██║╚██╔╝██║██╔══██║ ██║ ██╔══██║\n██║ ██║ ██║██████╔╝██║ ╚═╝ ██║██║ ██║ ██║ ██║ ██║\n╚═╝ ╚═╝ ╚═╝╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝\n\n██╗ ██╗██████╗ ██████╗ ██╗ ██╗ ██╗ █████╗\n██║ ██║██╔══██╗╚════██╗╚██╗██╔╝███║██╔══██╗\n██║ ██║██║ ██║ █████╔╝ ╚███╔╝ ╚██║╚█████╔╝\n██║ ██║██║ ██║██╔═══╝ ██╔██╗ ██║██╔══██╗\n╚██████╔╝██████╔╝███████╗██╔╝ ██╗ ██║╚█████╔╝\n ╚═════╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝ ╚═╝ ╚════╝\n\n*/\n\nimport \"./ud2x18/Casting.sol\";\nimport \"./ud2x18/Constants.sol\";\nimport \"./ud2x18/Errors.sol\";\nimport \"./ud2x18/ValueType.sol\";\n" + }, + "@prb/math/src/ud2x18/Casting.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport \"../Common.sol\" as Common;\nimport \"./Errors.sol\" as Errors;\nimport { uMAX_SD1x18 } from \"../sd1x18/Constants.sol\";\nimport { SD1x18 } from \"../sd1x18/ValueType.sol\";\nimport { SD59x18 } from \"../sd59x18/ValueType.sol\";\nimport { UD60x18 } from \"../ud60x18/ValueType.sol\";\nimport { UD2x18 } from \"./ValueType.sol\";\n\n/// @notice Casts a UD2x18 number into SD1x18.\n/// - x must be less than or equal to `uMAX_SD1x18`.\nfunction intoSD1x18(UD2x18 x) pure returns (SD1x18 result) {\n uint64 xUint = UD2x18.unwrap(x);\n if (xUint > uint64(uMAX_SD1x18)) {\n revert Errors.PRBMath_UD2x18_IntoSD1x18_Overflow(x);\n }\n result = SD1x18.wrap(int64(xUint));\n}\n\n/// @notice Casts a UD2x18 number into SD59x18.\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of SD59x18.\nfunction intoSD59x18(UD2x18 x) pure returns (SD59x18 result) {\n result = SD59x18.wrap(int256(uint256(UD2x18.unwrap(x))));\n}\n\n/// @notice Casts a UD2x18 number into UD60x18.\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of UD60x18.\nfunction intoUD60x18(UD2x18 x) pure returns (UD60x18 result) {\n result = UD60x18.wrap(UD2x18.unwrap(x));\n}\n\n/// @notice Casts a UD2x18 number into uint128.\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of uint128.\nfunction intoUint128(UD2x18 x) pure returns (uint128 result) {\n result = uint128(UD2x18.unwrap(x));\n}\n\n/// @notice Casts a UD2x18 number into uint256.\n/// @dev There is no overflow check because the domain of UD2x18 is a subset of uint256.\nfunction intoUint256(UD2x18 x) pure returns (uint256 result) {\n result = uint256(UD2x18.unwrap(x));\n}\n\n/// @notice Casts a UD2x18 number into uint40.\n/// @dev Requirements:\n/// - x must be less than or equal to `MAX_UINT40`.\nfunction intoUint40(UD2x18 x) pure returns (uint40 result) {\n uint64 xUint = UD2x18.unwrap(x);\n if (xUint > uint64(Common.MAX_UINT40)) {\n revert Errors.PRBMath_UD2x18_IntoUint40_Overflow(x);\n }\n result = uint40(xUint);\n}\n\n/// @notice Alias for {wrap}.\nfunction ud2x18(uint64 x) pure returns (UD2x18 result) {\n result = UD2x18.wrap(x);\n}\n\n/// @notice Unwrap a UD2x18 number into uint64.\nfunction unwrap(UD2x18 x) pure returns (uint64 result) {\n result = UD2x18.unwrap(x);\n}\n\n/// @notice Wraps a uint64 number into UD2x18.\nfunction wrap(uint64 x) pure returns (UD2x18 result) {\n result = UD2x18.wrap(x);\n}\n" + }, + "@prb/math/src/ud2x18/Constants.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport { UD2x18 } from \"./ValueType.sol\";\n\n/// @dev Euler's number as a UD2x18 number.\nUD2x18 constant E = UD2x18.wrap(2_718281828459045235);\n\n/// @dev The maximum value a UD2x18 number can have.\nuint64 constant uMAX_UD2x18 = 18_446744073709551615;\nUD2x18 constant MAX_UD2x18 = UD2x18.wrap(uMAX_UD2x18);\n\n/// @dev PI as a UD2x18 number.\nUD2x18 constant PI = UD2x18.wrap(3_141592653589793238);\n\n/// @dev The unit number, which gives the decimal precision of UD2x18.\nUD2x18 constant UNIT = UD2x18.wrap(1e18);\nuint64 constant uUNIT = 1e18;\n" + }, + "@prb/math/src/ud2x18/Errors.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport { UD2x18 } from \"./ValueType.sol\";\n\n/// @notice Thrown when trying to cast a UD2x18 number that doesn't fit in SD1x18.\nerror PRBMath_UD2x18_IntoSD1x18_Overflow(UD2x18 x);\n\n/// @notice Thrown when trying to cast a UD2x18 number that doesn't fit in uint40.\nerror PRBMath_UD2x18_IntoUint40_Overflow(UD2x18 x);\n" + }, + "@prb/math/src/ud2x18/ValueType.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport \"./Casting.sol\" as Casting;\n\n/// @notice The unsigned 2.18-decimal fixed-point number representation, which can have up to 2 digits and up to 18\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the underlying Solidity\n/// type uint64. This is useful when end users want to use uint64 to save gas, e.g. with tight variable packing in contract\n/// storage.\ntype UD2x18 is uint64;\n\n/*//////////////////////////////////////////////////////////////////////////\n CASTING\n//////////////////////////////////////////////////////////////////////////*/\n\nusing {\n Casting.intoSD1x18,\n Casting.intoSD59x18,\n Casting.intoUD60x18,\n Casting.intoUint256,\n Casting.intoUint128,\n Casting.intoUint40,\n Casting.unwrap\n} for UD2x18 global;\n" + }, + "@prb/math/src/UD60x18.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\n/*\n\n██████╗ ██████╗ ██████╗ ███╗ ███╗ █████╗ ████████╗██╗ ██╗\n██╔══██╗██╔══██╗██╔══██╗████╗ ████║██╔══██╗╚══██╔══╝██║ ██║\n██████╔╝██████╔╝██████╔╝██╔████╔██║███████║ ██║ ███████║\n██╔═══╝ ██╔══██╗██╔══██╗██║╚██╔╝██║██╔══██║ ██║ ██╔══██║\n██║ ██║ ██║██████╔╝██║ ╚═╝ ██║██║ ██║ ██║ ██║ ██║\n╚═╝ ╚═╝ ╚═╝╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝\n\n██╗ ██╗██████╗ ██████╗ ██████╗ ██╗ ██╗ ██╗ █████╗\n██║ ██║██╔══██╗██╔════╝ ██╔═████╗╚██╗██╔╝███║██╔══██╗\n██║ ██║██║ ██║███████╗ ██║██╔██║ ╚███╔╝ ╚██║╚█████╔╝\n██║ ██║██║ ██║██╔═══██╗████╔╝██║ ██╔██╗ ██║██╔══██╗\n╚██████╔╝██████╔╝╚██████╔╝╚██████╔╝██╔╝ ██╗ ██║╚█████╔╝\n ╚═════╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚════╝\n\n*/\n\nimport \"./ud60x18/Casting.sol\";\nimport \"./ud60x18/Constants.sol\";\nimport \"./ud60x18/Conversions.sol\";\nimport \"./ud60x18/Errors.sol\";\nimport \"./ud60x18/Helpers.sol\";\nimport \"./ud60x18/Math.sol\";\nimport \"./ud60x18/ValueType.sol\";\n" + }, + "@prb/math/src/ud60x18/Casting.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport \"./Errors.sol\" as CastingErrors;\nimport { MAX_UINT128, MAX_UINT40 } from \"../Common.sol\";\nimport { uMAX_SD1x18 } from \"../sd1x18/Constants.sol\";\nimport { SD1x18 } from \"../sd1x18/ValueType.sol\";\nimport { uMAX_SD59x18 } from \"../sd59x18/Constants.sol\";\nimport { SD59x18 } from \"../sd59x18/ValueType.sol\";\nimport { uMAX_UD2x18 } from \"../ud2x18/Constants.sol\";\nimport { UD2x18 } from \"../ud2x18/ValueType.sol\";\nimport { UD60x18 } from \"./ValueType.sol\";\n\n/// @notice Casts a UD60x18 number into SD1x18.\n/// @dev Requirements:\n/// - x must be less than or equal to `uMAX_SD1x18`.\nfunction intoSD1x18(UD60x18 x) pure returns (SD1x18 result) {\n uint256 xUint = UD60x18.unwrap(x);\n if (xUint > uint256(int256(uMAX_SD1x18))) {\n revert CastingErrors.PRBMath_UD60x18_IntoSD1x18_Overflow(x);\n }\n result = SD1x18.wrap(int64(uint64(xUint)));\n}\n\n/// @notice Casts a UD60x18 number into UD2x18.\n/// @dev Requirements:\n/// - x must be less than or equal to `uMAX_UD2x18`.\nfunction intoUD2x18(UD60x18 x) pure returns (UD2x18 result) {\n uint256 xUint = UD60x18.unwrap(x);\n if (xUint > uMAX_UD2x18) {\n revert CastingErrors.PRBMath_UD60x18_IntoUD2x18_Overflow(x);\n }\n result = UD2x18.wrap(uint64(xUint));\n}\n\n/// @notice Casts a UD60x18 number into SD59x18.\n/// @dev Requirements:\n/// - x must be less than or equal to `uMAX_SD59x18`.\nfunction intoSD59x18(UD60x18 x) pure returns (SD59x18 result) {\n uint256 xUint = UD60x18.unwrap(x);\n if (xUint > uint256(uMAX_SD59x18)) {\n revert CastingErrors.PRBMath_UD60x18_IntoSD59x18_Overflow(x);\n }\n result = SD59x18.wrap(int256(xUint));\n}\n\n/// @notice Casts a UD60x18 number into uint128.\n/// @dev This is basically an alias for {unwrap}.\nfunction intoUint256(UD60x18 x) pure returns (uint256 result) {\n result = UD60x18.unwrap(x);\n}\n\n/// @notice Casts a UD60x18 number into uint128.\n/// @dev Requirements:\n/// - x must be less than or equal to `MAX_UINT128`.\nfunction intoUint128(UD60x18 x) pure returns (uint128 result) {\n uint256 xUint = UD60x18.unwrap(x);\n if (xUint > MAX_UINT128) {\n revert CastingErrors.PRBMath_UD60x18_IntoUint128_Overflow(x);\n }\n result = uint128(xUint);\n}\n\n/// @notice Casts a UD60x18 number into uint40.\n/// @dev Requirements:\n/// - x must be less than or equal to `MAX_UINT40`.\nfunction intoUint40(UD60x18 x) pure returns (uint40 result) {\n uint256 xUint = UD60x18.unwrap(x);\n if (xUint > MAX_UINT40) {\n revert CastingErrors.PRBMath_UD60x18_IntoUint40_Overflow(x);\n }\n result = uint40(xUint);\n}\n\n/// @notice Alias for {wrap}.\nfunction ud(uint256 x) pure returns (UD60x18 result) {\n result = UD60x18.wrap(x);\n}\n\n/// @notice Alias for {wrap}.\nfunction ud60x18(uint256 x) pure returns (UD60x18 result) {\n result = UD60x18.wrap(x);\n}\n\n/// @notice Unwraps a UD60x18 number into uint256.\nfunction unwrap(UD60x18 x) pure returns (uint256 result) {\n result = UD60x18.unwrap(x);\n}\n\n/// @notice Wraps a uint256 number into the UD60x18 value type.\nfunction wrap(uint256 x) pure returns (UD60x18 result) {\n result = UD60x18.wrap(x);\n}\n" + }, + "@prb/math/src/ud60x18/Constants.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport { UD60x18 } from \"./ValueType.sol\";\n\n// NOTICE: the \"u\" prefix stands for \"unwrapped\".\n\n/// @dev Euler's number as a UD60x18 number.\nUD60x18 constant E = UD60x18.wrap(2_718281828459045235);\n\n/// @dev The maximum input permitted in {exp}.\nuint256 constant uEXP_MAX_INPUT = 133_084258667509499440;\nUD60x18 constant EXP_MAX_INPUT = UD60x18.wrap(uEXP_MAX_INPUT);\n\n/// @dev The maximum input permitted in {exp2}.\nuint256 constant uEXP2_MAX_INPUT = 192e18 - 1;\nUD60x18 constant EXP2_MAX_INPUT = UD60x18.wrap(uEXP2_MAX_INPUT);\n\n/// @dev Half the UNIT number.\nuint256 constant uHALF_UNIT = 0.5e18;\nUD60x18 constant HALF_UNIT = UD60x18.wrap(uHALF_UNIT);\n\n/// @dev $log_2(10)$ as a UD60x18 number.\nuint256 constant uLOG2_10 = 3_321928094887362347;\nUD60x18 constant LOG2_10 = UD60x18.wrap(uLOG2_10);\n\n/// @dev $log_2(e)$ as a UD60x18 number.\nuint256 constant uLOG2_E = 1_442695040888963407;\nUD60x18 constant LOG2_E = UD60x18.wrap(uLOG2_E);\n\n/// @dev The maximum value a UD60x18 number can have.\nuint256 constant uMAX_UD60x18 = 115792089237316195423570985008687907853269984665640564039457_584007913129639935;\nUD60x18 constant MAX_UD60x18 = UD60x18.wrap(uMAX_UD60x18);\n\n/// @dev The maximum whole value a UD60x18 number can have.\nuint256 constant uMAX_WHOLE_UD60x18 = 115792089237316195423570985008687907853269984665640564039457_000000000000000000;\nUD60x18 constant MAX_WHOLE_UD60x18 = UD60x18.wrap(uMAX_WHOLE_UD60x18);\n\n/// @dev PI as a UD60x18 number.\nUD60x18 constant PI = UD60x18.wrap(3_141592653589793238);\n\n/// @dev The unit number, which gives the decimal precision of UD60x18.\nuint256 constant uUNIT = 1e18;\nUD60x18 constant UNIT = UD60x18.wrap(uUNIT);\n\n/// @dev The unit number squared.\nuint256 constant uUNIT_SQUARED = 1e36;\nUD60x18 constant UNIT_SQUARED = UD60x18.wrap(uUNIT_SQUARED);\n\n/// @dev Zero as a UD60x18 number.\nUD60x18 constant ZERO = UD60x18.wrap(0);\n" + }, + "@prb/math/src/ud60x18/Conversions.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport { uMAX_UD60x18, uUNIT } from \"./Constants.sol\";\nimport { PRBMath_UD60x18_Convert_Overflow } from \"./Errors.sol\";\nimport { UD60x18 } from \"./ValueType.sol\";\n\n/// @notice Converts a UD60x18 number to a simple integer by dividing it by `UNIT`.\n/// @dev The result is rounded toward zero.\n/// @param x The UD60x18 number to convert.\n/// @return result The same number in basic integer form.\nfunction convert(UD60x18 x) pure returns (uint256 result) {\n result = UD60x18.unwrap(x) / uUNIT;\n}\n\n/// @notice Converts a simple integer to UD60x18 by multiplying it by `UNIT`.\n///\n/// @dev Requirements:\n/// - x must be less than or equal to `MAX_UD60x18 / UNIT`.\n///\n/// @param x The basic integer to convert.\n/// @param result The same number converted to UD60x18.\nfunction convert(uint256 x) pure returns (UD60x18 result) {\n if (x > uMAX_UD60x18 / uUNIT) {\n revert PRBMath_UD60x18_Convert_Overflow(x);\n }\n unchecked {\n result = UD60x18.wrap(x * uUNIT);\n }\n}\n" + }, + "@prb/math/src/ud60x18/Errors.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport { UD60x18 } from \"./ValueType.sol\";\n\n/// @notice Thrown when ceiling a number overflows UD60x18.\nerror PRBMath_UD60x18_Ceil_Overflow(UD60x18 x);\n\n/// @notice Thrown when converting a basic integer to the fixed-point format overflows UD60x18.\nerror PRBMath_UD60x18_Convert_Overflow(uint256 x);\n\n/// @notice Thrown when taking the natural exponent of a base greater than 133_084258667509499441.\nerror PRBMath_UD60x18_Exp_InputTooBig(UD60x18 x);\n\n/// @notice Thrown when taking the binary exponent of a base greater than 192e18.\nerror PRBMath_UD60x18_Exp2_InputTooBig(UD60x18 x);\n\n/// @notice Thrown when taking the geometric mean of two numbers and multiplying them overflows UD60x18.\nerror PRBMath_UD60x18_Gm_Overflow(UD60x18 x, UD60x18 y);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD1x18.\nerror PRBMath_UD60x18_IntoSD1x18_Overflow(UD60x18 x);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in SD59x18.\nerror PRBMath_UD60x18_IntoSD59x18_Overflow(UD60x18 x);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in UD2x18.\nerror PRBMath_UD60x18_IntoUD2x18_Overflow(UD60x18 x);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint128.\nerror PRBMath_UD60x18_IntoUint128_Overflow(UD60x18 x);\n\n/// @notice Thrown when trying to cast a UD60x18 number that doesn't fit in uint40.\nerror PRBMath_UD60x18_IntoUint40_Overflow(UD60x18 x);\n\n/// @notice Thrown when taking the logarithm of a number less than 1.\nerror PRBMath_UD60x18_Log_InputTooSmall(UD60x18 x);\n\n/// @notice Thrown when calculating the square root overflows UD60x18.\nerror PRBMath_UD60x18_Sqrt_Overflow(UD60x18 x);\n" + }, + "@prb/math/src/ud60x18/Helpers.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport { wrap } from \"./Casting.sol\";\nimport { UD60x18 } from \"./ValueType.sol\";\n\n/// @notice Implements the checked addition operation (+) in the UD60x18 type.\nfunction add(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\n result = wrap(x.unwrap() + y.unwrap());\n}\n\n/// @notice Implements the AND (&) bitwise operation in the UD60x18 type.\nfunction and(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\n result = wrap(x.unwrap() & bits);\n}\n\n/// @notice Implements the AND (&) bitwise operation in the UD60x18 type.\nfunction and2(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\n result = wrap(x.unwrap() & y.unwrap());\n}\n\n/// @notice Implements the equal operation (==) in the UD60x18 type.\nfunction eq(UD60x18 x, UD60x18 y) pure returns (bool result) {\n result = x.unwrap() == y.unwrap();\n}\n\n/// @notice Implements the greater than operation (>) in the UD60x18 type.\nfunction gt(UD60x18 x, UD60x18 y) pure returns (bool result) {\n result = x.unwrap() > y.unwrap();\n}\n\n/// @notice Implements the greater than or equal to operation (>=) in the UD60x18 type.\nfunction gte(UD60x18 x, UD60x18 y) pure returns (bool result) {\n result = x.unwrap() >= y.unwrap();\n}\n\n/// @notice Implements a zero comparison check function in the UD60x18 type.\nfunction isZero(UD60x18 x) pure returns (bool result) {\n // This wouldn't work if x could be negative.\n result = x.unwrap() == 0;\n}\n\n/// @notice Implements the left shift operation (<<) in the UD60x18 type.\nfunction lshift(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\n result = wrap(x.unwrap() << bits);\n}\n\n/// @notice Implements the lower than operation (<) in the UD60x18 type.\nfunction lt(UD60x18 x, UD60x18 y) pure returns (bool result) {\n result = x.unwrap() < y.unwrap();\n}\n\n/// @notice Implements the lower than or equal to operation (<=) in the UD60x18 type.\nfunction lte(UD60x18 x, UD60x18 y) pure returns (bool result) {\n result = x.unwrap() <= y.unwrap();\n}\n\n/// @notice Implements the checked modulo operation (%) in the UD60x18 type.\nfunction mod(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\n result = wrap(x.unwrap() % y.unwrap());\n}\n\n/// @notice Implements the not equal operation (!=) in the UD60x18 type.\nfunction neq(UD60x18 x, UD60x18 y) pure returns (bool result) {\n result = x.unwrap() != y.unwrap();\n}\n\n/// @notice Implements the NOT (~) bitwise operation in the UD60x18 type.\nfunction not(UD60x18 x) pure returns (UD60x18 result) {\n result = wrap(~x.unwrap());\n}\n\n/// @notice Implements the OR (|) bitwise operation in the UD60x18 type.\nfunction or(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\n result = wrap(x.unwrap() | y.unwrap());\n}\n\n/// @notice Implements the right shift operation (>>) in the UD60x18 type.\nfunction rshift(UD60x18 x, uint256 bits) pure returns (UD60x18 result) {\n result = wrap(x.unwrap() >> bits);\n}\n\n/// @notice Implements the checked subtraction operation (-) in the UD60x18 type.\nfunction sub(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\n result = wrap(x.unwrap() - y.unwrap());\n}\n\n/// @notice Implements the unchecked addition operation (+) in the UD60x18 type.\nfunction uncheckedAdd(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\n unchecked {\n result = wrap(x.unwrap() + y.unwrap());\n }\n}\n\n/// @notice Implements the unchecked subtraction operation (-) in the UD60x18 type.\nfunction uncheckedSub(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\n unchecked {\n result = wrap(x.unwrap() - y.unwrap());\n }\n}\n\n/// @notice Implements the XOR (^) bitwise operation in the UD60x18 type.\nfunction xor(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\n result = wrap(x.unwrap() ^ y.unwrap());\n}\n" + }, + "@prb/math/src/ud60x18/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport \"../Common.sol\" as Common;\nimport \"./Errors.sol\" as Errors;\nimport { wrap } from \"./Casting.sol\";\nimport {\n uEXP_MAX_INPUT,\n uEXP2_MAX_INPUT,\n uHALF_UNIT,\n uLOG2_10,\n uLOG2_E,\n uMAX_UD60x18,\n uMAX_WHOLE_UD60x18,\n UNIT,\n uUNIT,\n uUNIT_SQUARED,\n ZERO\n} from \"./Constants.sol\";\nimport { UD60x18 } from \"./ValueType.sol\";\n\n/*//////////////////////////////////////////////////////////////////////////\n MATHEMATICAL FUNCTIONS\n//////////////////////////////////////////////////////////////////////////*/\n\n/// @notice Calculates the arithmetic average of x and y using the following formula:\n///\n/// $$\n/// avg(x, y) = (x & y) + ((xUint ^ yUint) / 2)\n/// $$\n///\n/// In English, this is what this formula does:\n///\n/// 1. AND x and y.\n/// 2. Calculate half of XOR x and y.\n/// 3. Add the two results together.\n///\n/// This technique is known as SWAR, which stands for \"SIMD within a register\". You can read more about it here:\n/// https://devblogs.microsoft.com/oldnewthing/20220207-00/?p=106223\n///\n/// @dev Notes:\n/// - The result is rounded toward zero.\n///\n/// @param x The first operand as a UD60x18 number.\n/// @param y The second operand as a UD60x18 number.\n/// @return result The arithmetic average as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction avg(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\n uint256 xUint = x.unwrap();\n uint256 yUint = y.unwrap();\n unchecked {\n result = wrap((xUint & yUint) + ((xUint ^ yUint) >> 1));\n }\n}\n\n/// @notice Yields the smallest whole number greater than or equal to x.\n///\n/// @dev This is optimized for fractional value inputs, because for every whole value there are (1e18 - 1) fractional\n/// counterparts. See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\n///\n/// Requirements:\n/// - x must be less than or equal to `MAX_WHOLE_UD60x18`.\n///\n/// @param x The UD60x18 number to ceil.\n/// @param result The smallest whole number greater than or equal to x, as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction ceil(UD60x18 x) pure returns (UD60x18 result) {\n uint256 xUint = x.unwrap();\n if (xUint > uMAX_WHOLE_UD60x18) {\n revert Errors.PRBMath_UD60x18_Ceil_Overflow(x);\n }\n\n assembly (\"memory-safe\") {\n // Equivalent to `x % UNIT`.\n let remainder := mod(x, uUNIT)\n\n // Equivalent to `UNIT - remainder`.\n let delta := sub(uUNIT, remainder)\n\n // Equivalent to `x + remainder > 0 ? delta : 0`.\n result := add(x, mul(delta, gt(remainder, 0)))\n }\n}\n\n/// @notice Divides two UD60x18 numbers, returning a new UD60x18 number.\n///\n/// @dev Uses {Common.mulDiv} to enable overflow-safe multiplication and division.\n///\n/// Notes:\n/// - Refer to the notes in {Common.mulDiv}.\n///\n/// Requirements:\n/// - Refer to the requirements in {Common.mulDiv}.\n///\n/// @param x The numerator as a UD60x18 number.\n/// @param y The denominator as a UD60x18 number.\n/// @param result The quotient as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction div(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\n result = wrap(Common.mulDiv(x.unwrap(), uUNIT, y.unwrap()));\n}\n\n/// @notice Calculates the natural exponent of x using the following formula:\n///\n/// $$\n/// e^x = 2^{x * log_2{e}}\n/// $$\n///\n/// @dev Requirements:\n/// - x must be less than 133_084258667509499441.\n///\n/// @param x The exponent as a UD60x18 number.\n/// @return result The result as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction exp(UD60x18 x) pure returns (UD60x18 result) {\n uint256 xUint = x.unwrap();\n\n // This check prevents values greater than 192e18 from being passed to {exp2}.\n if (xUint > uEXP_MAX_INPUT) {\n revert Errors.PRBMath_UD60x18_Exp_InputTooBig(x);\n }\n\n unchecked {\n // Inline the fixed-point multiplication to save gas.\n uint256 doubleUnitProduct = xUint * uLOG2_E;\n result = exp2(wrap(doubleUnitProduct / uUNIT));\n }\n}\n\n/// @notice Calculates the binary exponent of x using the binary fraction method.\n///\n/// @dev See https://ethereum.stackexchange.com/q/79903/24693\n///\n/// Requirements:\n/// - x must be less than 192e18.\n/// - The result must fit in UD60x18.\n///\n/// @param x The exponent as a UD60x18 number.\n/// @return result The result as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction exp2(UD60x18 x) pure returns (UD60x18 result) {\n uint256 xUint = x.unwrap();\n\n // Numbers greater than or equal to 192e18 don't fit in the 192.64-bit format.\n if (xUint > uEXP2_MAX_INPUT) {\n revert Errors.PRBMath_UD60x18_Exp2_InputTooBig(x);\n }\n\n // Convert x to the 192.64-bit fixed-point format.\n uint256 x_192x64 = (xUint << 64) / uUNIT;\n\n // Pass x to the {Common.exp2} function, which uses the 192.64-bit fixed-point number representation.\n result = wrap(Common.exp2(x_192x64));\n}\n\n/// @notice Yields the greatest whole number less than or equal to x.\n/// @dev Optimized for fractional value inputs, because every whole value has (1e18 - 1) fractional counterparts.\n/// See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions.\n/// @param x The UD60x18 number to floor.\n/// @param result The greatest whole number less than or equal to x, as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction floor(UD60x18 x) pure returns (UD60x18 result) {\n assembly (\"memory-safe\") {\n // Equivalent to `x % UNIT`.\n let remainder := mod(x, uUNIT)\n\n // Equivalent to `x - remainder > 0 ? remainder : 0)`.\n result := sub(x, mul(remainder, gt(remainder, 0)))\n }\n}\n\n/// @notice Yields the excess beyond the floor of x using the odd function definition.\n/// @dev See https://en.wikipedia.org/wiki/Fractional_part.\n/// @param x The UD60x18 number to get the fractional part of.\n/// @param result The fractional part of x as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction frac(UD60x18 x) pure returns (UD60x18 result) {\n assembly (\"memory-safe\") {\n result := mod(x, uUNIT)\n }\n}\n\n/// @notice Calculates the geometric mean of x and y, i.e. $\\sqrt{x * y}$, rounding down.\n///\n/// @dev Requirements:\n/// - x * y must fit in UD60x18.\n///\n/// @param x The first operand as a UD60x18 number.\n/// @param y The second operand as a UD60x18 number.\n/// @return result The result as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction gm(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\n uint256 xUint = x.unwrap();\n uint256 yUint = y.unwrap();\n if (xUint == 0 || yUint == 0) {\n return ZERO;\n }\n\n unchecked {\n // Checking for overflow this way is faster than letting Solidity do it.\n uint256 xyUint = xUint * yUint;\n if (xyUint / xUint != yUint) {\n revert Errors.PRBMath_UD60x18_Gm_Overflow(x, y);\n }\n\n // We don't need to multiply the result by `UNIT` here because the x*y product picked up a factor of `UNIT`\n // during multiplication. See the comments in {Common.sqrt}.\n result = wrap(Common.sqrt(xyUint));\n }\n}\n\n/// @notice Calculates the inverse of x.\n///\n/// @dev Notes:\n/// - The result is rounded toward zero.\n///\n/// Requirements:\n/// - x must not be zero.\n///\n/// @param x The UD60x18 number for which to calculate the inverse.\n/// @return result The inverse as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction inv(UD60x18 x) pure returns (UD60x18 result) {\n unchecked {\n result = wrap(uUNIT_SQUARED / x.unwrap());\n }\n}\n\n/// @notice Calculates the natural logarithm of x using the following formula:\n///\n/// $$\n/// ln{x} = log_2{x} / log_2{e}\n/// $$\n///\n/// @dev Notes:\n/// - Refer to the notes in {log2}.\n/// - The precision isn't sufficiently fine-grained to return exactly `UNIT` when the input is `E`.\n///\n/// Requirements:\n/// - Refer to the requirements in {log2}.\n///\n/// @param x The UD60x18 number for which to calculate the natural logarithm.\n/// @return result The natural logarithm as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction ln(UD60x18 x) pure returns (UD60x18 result) {\n unchecked {\n // Inline the fixed-point multiplication to save gas. This is overflow-safe because the maximum value that\n // {log2} can return is ~196_205294292027477728.\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_E);\n }\n}\n\n/// @notice Calculates the common logarithm of x using the following formula:\n///\n/// $$\n/// log_{10}{x} = log_2{x} / log_2{10}\n/// $$\n///\n/// However, if x is an exact power of ten, a hard coded value is returned.\n///\n/// @dev Notes:\n/// - Refer to the notes in {log2}.\n///\n/// Requirements:\n/// - Refer to the requirements in {log2}.\n///\n/// @param x The UD60x18 number for which to calculate the common logarithm.\n/// @return result The common logarithm as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction log10(UD60x18 x) pure returns (UD60x18 result) {\n uint256 xUint = x.unwrap();\n if (xUint < uUNIT) {\n revert Errors.PRBMath_UD60x18_Log_InputTooSmall(x);\n }\n\n // Note that the `mul` in this assembly block is the standard multiplication operation, not {UD60x18.mul}.\n // prettier-ignore\n assembly (\"memory-safe\") {\n switch x\n case 1 { result := mul(uUNIT, sub(0, 18)) }\n case 10 { result := mul(uUNIT, sub(1, 18)) }\n case 100 { result := mul(uUNIT, sub(2, 18)) }\n case 1000 { result := mul(uUNIT, sub(3, 18)) }\n case 10000 { result := mul(uUNIT, sub(4, 18)) }\n case 100000 { result := mul(uUNIT, sub(5, 18)) }\n case 1000000 { result := mul(uUNIT, sub(6, 18)) }\n case 10000000 { result := mul(uUNIT, sub(7, 18)) }\n case 100000000 { result := mul(uUNIT, sub(8, 18)) }\n case 1000000000 { result := mul(uUNIT, sub(9, 18)) }\n case 10000000000 { result := mul(uUNIT, sub(10, 18)) }\n case 100000000000 { result := mul(uUNIT, sub(11, 18)) }\n case 1000000000000 { result := mul(uUNIT, sub(12, 18)) }\n case 10000000000000 { result := mul(uUNIT, sub(13, 18)) }\n case 100000000000000 { result := mul(uUNIT, sub(14, 18)) }\n case 1000000000000000 { result := mul(uUNIT, sub(15, 18)) }\n case 10000000000000000 { result := mul(uUNIT, sub(16, 18)) }\n case 100000000000000000 { result := mul(uUNIT, sub(17, 18)) }\n case 1000000000000000000 { result := 0 }\n case 10000000000000000000 { result := uUNIT }\n case 100000000000000000000 { result := mul(uUNIT, 2) }\n case 1000000000000000000000 { result := mul(uUNIT, 3) }\n case 10000000000000000000000 { result := mul(uUNIT, 4) }\n case 100000000000000000000000 { result := mul(uUNIT, 5) }\n case 1000000000000000000000000 { result := mul(uUNIT, 6) }\n case 10000000000000000000000000 { result := mul(uUNIT, 7) }\n case 100000000000000000000000000 { result := mul(uUNIT, 8) }\n case 1000000000000000000000000000 { result := mul(uUNIT, 9) }\n case 10000000000000000000000000000 { result := mul(uUNIT, 10) }\n case 100000000000000000000000000000 { result := mul(uUNIT, 11) }\n case 1000000000000000000000000000000 { result := mul(uUNIT, 12) }\n case 10000000000000000000000000000000 { result := mul(uUNIT, 13) }\n case 100000000000000000000000000000000 { result := mul(uUNIT, 14) }\n case 1000000000000000000000000000000000 { result := mul(uUNIT, 15) }\n case 10000000000000000000000000000000000 { result := mul(uUNIT, 16) }\n case 100000000000000000000000000000000000 { result := mul(uUNIT, 17) }\n case 1000000000000000000000000000000000000 { result := mul(uUNIT, 18) }\n case 10000000000000000000000000000000000000 { result := mul(uUNIT, 19) }\n case 100000000000000000000000000000000000000 { result := mul(uUNIT, 20) }\n case 1000000000000000000000000000000000000000 { result := mul(uUNIT, 21) }\n case 10000000000000000000000000000000000000000 { result := mul(uUNIT, 22) }\n case 100000000000000000000000000000000000000000 { result := mul(uUNIT, 23) }\n case 1000000000000000000000000000000000000000000 { result := mul(uUNIT, 24) }\n case 10000000000000000000000000000000000000000000 { result := mul(uUNIT, 25) }\n case 100000000000000000000000000000000000000000000 { result := mul(uUNIT, 26) }\n case 1000000000000000000000000000000000000000000000 { result := mul(uUNIT, 27) }\n case 10000000000000000000000000000000000000000000000 { result := mul(uUNIT, 28) }\n case 100000000000000000000000000000000000000000000000 { result := mul(uUNIT, 29) }\n case 1000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 30) }\n case 10000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 31) }\n case 100000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 32) }\n case 1000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 33) }\n case 10000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 34) }\n case 100000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 35) }\n case 1000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 36) }\n case 10000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 37) }\n case 100000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 38) }\n case 1000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 39) }\n case 10000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 40) }\n case 100000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 41) }\n case 1000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 42) }\n case 10000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 43) }\n case 100000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 44) }\n case 1000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 45) }\n case 10000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 46) }\n case 100000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 47) }\n case 1000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 48) }\n case 10000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 49) }\n case 100000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 50) }\n case 1000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 51) }\n case 10000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 52) }\n case 100000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 53) }\n case 1000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 54) }\n case 10000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 55) }\n case 100000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 56) }\n case 1000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 57) }\n case 10000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 58) }\n case 100000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(uUNIT, 59) }\n default { result := uMAX_UD60x18 }\n }\n\n if (result.unwrap() == uMAX_UD60x18) {\n unchecked {\n // Inline the fixed-point division to save gas.\n result = wrap(log2(x).unwrap() * uUNIT / uLOG2_10);\n }\n }\n}\n\n/// @notice Calculates the binary logarithm of x using the iterative approximation algorithm:\n///\n/// $$\n/// log_2{x} = n + log_2{y}, \\text{ where } y = x*2^{-n}, \\ y \\in [1, 2)\n/// $$\n///\n/// For $0 \\leq x \\lt 1$, the input is inverted:\n///\n/// $$\n/// log_2{x} = -log_2{\\frac{1}{x}}\n/// $$\n///\n/// @dev See https://en.wikipedia.org/wiki/Binary_logarithm#Iterative_approximation\n///\n/// Notes:\n/// - Due to the lossy precision of the iterative approximation, the results are not perfectly accurate to the last decimal.\n///\n/// Requirements:\n/// - x must be greater than zero.\n///\n/// @param x The UD60x18 number for which to calculate the binary logarithm.\n/// @return result The binary logarithm as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction log2(UD60x18 x) pure returns (UD60x18 result) {\n uint256 xUint = x.unwrap();\n\n if (xUint < uUNIT) {\n revert Errors.PRBMath_UD60x18_Log_InputTooSmall(x);\n }\n\n unchecked {\n // Calculate the integer part of the logarithm.\n uint256 n = Common.msb(xUint / uUNIT);\n\n // This is the integer part of the logarithm as a UD60x18 number. The operation can't overflow because n\n // n is at most 255 and UNIT is 1e18.\n uint256 resultUint = n * uUNIT;\n\n // Calculate $y = x * 2^{-n}$.\n uint256 y = xUint >> n;\n\n // If y is the unit number, the fractional part is zero.\n if (y == uUNIT) {\n return wrap(resultUint);\n }\n\n // Calculate the fractional part via the iterative approximation.\n // The `delta >>= 1` part is equivalent to `delta /= 2`, but shifting bits is more gas efficient.\n uint256 DOUBLE_UNIT = 2e18;\n for (uint256 delta = uHALF_UNIT; delta > 0; delta >>= 1) {\n y = (y * y) / uUNIT;\n\n // Is y^2 >= 2e18 and so in the range [2e18, 4e18)?\n if (y >= DOUBLE_UNIT) {\n // Add the 2^{-m} factor to the logarithm.\n resultUint += delta;\n\n // Halve y, which corresponds to z/2 in the Wikipedia article.\n y >>= 1;\n }\n }\n result = wrap(resultUint);\n }\n}\n\n/// @notice Multiplies two UD60x18 numbers together, returning a new UD60x18 number.\n///\n/// @dev Uses {Common.mulDiv} to enable overflow-safe multiplication and division.\n///\n/// Notes:\n/// - Refer to the notes in {Common.mulDiv}.\n///\n/// Requirements:\n/// - Refer to the requirements in {Common.mulDiv}.\n///\n/// @dev See the documentation in {Common.mulDiv18}.\n/// @param x The multiplicand as a UD60x18 number.\n/// @param y The multiplier as a UD60x18 number.\n/// @return result The product as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction mul(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\n result = wrap(Common.mulDiv18(x.unwrap(), y.unwrap()));\n}\n\n/// @notice Raises x to the power of y.\n///\n/// For $1 \\leq x \\leq \\infty$, the following standard formula is used:\n///\n/// $$\n/// x^y = 2^{log_2{x} * y}\n/// $$\n///\n/// For $0 \\leq x \\lt 1$, since the unsigned {log2} is undefined, an equivalent formula is used:\n///\n/// $$\n/// i = \\frac{1}{x}\n/// w = 2^{log_2{i} * y}\n/// x^y = \\frac{1}{w}\n/// $$\n///\n/// @dev Notes:\n/// - Refer to the notes in {log2} and {mul}.\n/// - Returns `UNIT` for 0^0.\n/// - It may not perform well with very small values of x. Consider using SD59x18 as an alternative.\n///\n/// Requirements:\n/// - Refer to the requirements in {exp2}, {log2}, and {mul}.\n///\n/// @param x The base as a UD60x18 number.\n/// @param y The exponent as a UD60x18 number.\n/// @return result The result as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction pow(UD60x18 x, UD60x18 y) pure returns (UD60x18 result) {\n uint256 xUint = x.unwrap();\n uint256 yUint = y.unwrap();\n\n // If both x and y are zero, the result is `UNIT`. If just x is zero, the result is always zero.\n if (xUint == 0) {\n return yUint == 0 ? UNIT : ZERO;\n }\n // If x is `UNIT`, the result is always `UNIT`.\n else if (xUint == uUNIT) {\n return UNIT;\n }\n\n // If y is zero, the result is always `UNIT`.\n if (yUint == 0) {\n return UNIT;\n }\n // If y is `UNIT`, the result is always x.\n else if (yUint == uUNIT) {\n return x;\n }\n\n // If x is greater than `UNIT`, use the standard formula.\n if (xUint > uUNIT) {\n result = exp2(mul(log2(x), y));\n }\n // Conversely, if x is less than `UNIT`, use the equivalent formula.\n else {\n UD60x18 i = wrap(uUNIT_SQUARED / xUint);\n UD60x18 w = exp2(mul(log2(i), y));\n result = wrap(uUNIT_SQUARED / w.unwrap());\n }\n}\n\n/// @notice Raises x (a UD60x18 number) to the power y (an unsigned basic integer) using the well-known\n/// algorithm \"exponentiation by squaring\".\n///\n/// @dev See https://en.wikipedia.org/wiki/Exponentiation_by_squaring.\n///\n/// Notes:\n/// - Refer to the notes in {Common.mulDiv18}.\n/// - Returns `UNIT` for 0^0.\n///\n/// Requirements:\n/// - The result must fit in UD60x18.\n///\n/// @param x The base as a UD60x18 number.\n/// @param y The exponent as a uint256.\n/// @return result The result as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction powu(UD60x18 x, uint256 y) pure returns (UD60x18 result) {\n // Calculate the first iteration of the loop in advance.\n uint256 xUint = x.unwrap();\n uint256 resultUint = y & 1 > 0 ? xUint : uUNIT;\n\n // Equivalent to `for(y /= 2; y > 0; y /= 2)`.\n for (y >>= 1; y > 0; y >>= 1) {\n xUint = Common.mulDiv18(xUint, xUint);\n\n // Equivalent to `y % 2 == 1`.\n if (y & 1 > 0) {\n resultUint = Common.mulDiv18(resultUint, xUint);\n }\n }\n result = wrap(resultUint);\n}\n\n/// @notice Calculates the square root of x using the Babylonian method.\n///\n/// @dev See https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.\n///\n/// Notes:\n/// - The result is rounded toward zero.\n///\n/// Requirements:\n/// - x must be less than `MAX_UD60x18 / UNIT`.\n///\n/// @param x The UD60x18 number for which to calculate the square root.\n/// @return result The result as a UD60x18 number.\n/// @custom:smtchecker abstract-function-nondet\nfunction sqrt(UD60x18 x) pure returns (UD60x18 result) {\n uint256 xUint = x.unwrap();\n\n unchecked {\n if (xUint > uMAX_UD60x18 / uUNIT) {\n revert Errors.PRBMath_UD60x18_Sqrt_Overflow(x);\n }\n // Multiply x by `UNIT` to account for the factor of `UNIT` picked up when multiplying two UD60x18 numbers.\n // In this case, the two numbers are both the square root.\n result = wrap(Common.sqrt(xUint * uUNIT));\n }\n}\n" + }, + "@prb/math/src/ud60x18/ValueType.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.19;\n\nimport \"./Casting.sol\" as Casting;\nimport \"./Helpers.sol\" as Helpers;\nimport \"./Math.sol\" as Math;\n\n/// @notice The unsigned 60.18-decimal fixed-point number representation, which can have up to 60 digits and up to 18\n/// decimals. The values of this are bound by the minimum and the maximum values permitted by the Solidity type uint256.\n/// @dev The value type is defined here so it can be imported in all other files.\ntype UD60x18 is uint256;\n\n/*//////////////////////////////////////////////////////////////////////////\n CASTING\n//////////////////////////////////////////////////////////////////////////*/\n\nusing {\n Casting.intoSD1x18,\n Casting.intoUD2x18,\n Casting.intoSD59x18,\n Casting.intoUint128,\n Casting.intoUint256,\n Casting.intoUint40,\n Casting.unwrap\n} for UD60x18 global;\n\n/*//////////////////////////////////////////////////////////////////////////\n MATHEMATICAL FUNCTIONS\n//////////////////////////////////////////////////////////////////////////*/\n\n// The global \"using for\" directive makes the functions in this library callable on the UD60x18 type.\nusing {\n Math.avg,\n Math.ceil,\n Math.div,\n Math.exp,\n Math.exp2,\n Math.floor,\n Math.frac,\n Math.gm,\n Math.inv,\n Math.ln,\n Math.log10,\n Math.log2,\n Math.mul,\n Math.pow,\n Math.powu,\n Math.sqrt\n} for UD60x18 global;\n\n/*//////////////////////////////////////////////////////////////////////////\n HELPER FUNCTIONS\n//////////////////////////////////////////////////////////////////////////*/\n\n// The global \"using for\" directive makes the functions in this library callable on the UD60x18 type.\nusing {\n Helpers.add,\n Helpers.and,\n Helpers.eq,\n Helpers.gt,\n Helpers.gte,\n Helpers.isZero,\n Helpers.lshift,\n Helpers.lt,\n Helpers.lte,\n Helpers.mod,\n Helpers.neq,\n Helpers.not,\n Helpers.or,\n Helpers.rshift,\n Helpers.sub,\n Helpers.uncheckedAdd,\n Helpers.uncheckedSub,\n Helpers.xor\n} for UD60x18 global;\n\n/*//////////////////////////////////////////////////////////////////////////\n OPERATORS\n//////////////////////////////////////////////////////////////////////////*/\n\n// The global \"using for\" directive makes it possible to use these operators on the UD60x18 type.\nusing {\n Helpers.add as +,\n Helpers.and2 as &,\n Math.div as /,\n Helpers.eq as ==,\n Helpers.gt as >,\n Helpers.gte as >=,\n Helpers.lt as <,\n Helpers.lte as <=,\n Helpers.or as |,\n Helpers.mod as %,\n Math.mul as *,\n Helpers.neq as !=,\n Helpers.not as ~,\n Helpers.sub as -,\n Helpers.xor as ^\n} for UD60x18 global;\n" + }, + "contracts/autonomous-admin/DecentAutonomousAdminV1.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.28;\n\nimport {IHats} from \"../interfaces/hats/IHats.sol\";\nimport {IHatsElectionsEligibility} from \"../interfaces/hats/modules/IHatsElectionsEligibility.sol\";\nimport {FactoryFriendly} from \"@gnosis.pm/zodiac/contracts/factory/FactoryFriendly.sol\";\nimport {ERC165} from \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport {IDecentAutonomousAdminV1} from \"../interfaces/autonomous-admin/IDecentAutonomousAdminV1.sol\";\n\ncontract DecentAutonomousAdminV1 is\n IDecentAutonomousAdminV1,\n ERC165,\n FactoryFriendly\n{\n // //////////////////////////////////////////////////////////////\n // initializer\n // //////////////////////////////////////////////////////////////\n function setUp(bytes memory initializeParams) public override initializer {}\n\n // //////////////////////////////////////////////////////////////\n // Public Functions\n // //////////////////////////////////////////////////////////////\n function triggerStartNextTerm(TriggerStartArgs calldata args) public {\n IHatsElectionsEligibility hatsElectionModule = IHatsElectionsEligibility(\n args.hatsProtocol.getHatEligibilityModule(args.hatId)\n );\n\n hatsElectionModule.startNextTerm();\n\n // This will burn the hat if wearer is no longer eligible\n args.hatsProtocol.checkHatWearerStatus(args.hatId, args.currentWearer);\n\n // This will mint the hat to the nominated wearer, if necessary\n if (args.nominatedWearer != args.currentWearer) {\n args.hatsProtocol.mintHat(args.hatId, args.nominatedWearer);\n }\n }\n\n function supportsInterface(\n bytes4 interfaceId\n ) public view override returns (bool) {\n return\n interfaceId == type(IDecentAutonomousAdminV1).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n}\n" + }, + "contracts/hardhat-dependency-compiler/@gnosis.pm/safe-contracts/contracts/GnosisSafeL2.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >0.0.0;\nimport '@gnosis.pm/safe-contracts/contracts/GnosisSafeL2.sol';\n" + }, + "contracts/hardhat-dependency-compiler/@gnosis.pm/safe-contracts/contracts/libraries/MultiSendCallOnly.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >0.0.0;\nimport '@gnosis.pm/safe-contracts/contracts/libraries/MultiSendCallOnly.sol';\n" + }, + "contracts/hardhat-dependency-compiler/@gnosis.pm/safe-contracts/contracts/proxies/GnosisSafeProxyFactory.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >0.0.0;\nimport '@gnosis.pm/safe-contracts/contracts/proxies/GnosisSafeProxyFactory.sol';\n" + }, + "contracts/interfaces/autonomous-admin/IDecentAutonomousAdminV1.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.28;\n\nimport {IHats} from \"../hats/IHats.sol\";\n\ninterface IDecentAutonomousAdminV1 {\n error NotCurrentWearer();\n\n struct TriggerStartArgs {\n address currentWearer;\n IHats hatsProtocol;\n uint256 hatId;\n address nominatedWearer;\n }\n\n function triggerStartNextTerm(TriggerStartArgs calldata args) external;\n}\n" + }, + "contracts/interfaces/hats/HatsErrors.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\n// Copyright (C) 2023 Haberdasher Labs\n//\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU Affero General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU Affero General Public License for more details.\n//\n// You should have received a copy of the GNU Affero General Public License\n// along with this program. If not, see .\n\npragma solidity >=0.8.13;\n\ninterface HatsErrors {\n /// @notice Emitted when `user` is attempting to perform an action on `hatId` but is not wearing one of `hatId`'s admin hats\n /// @dev Can be equivalent to `NotHatWearer(buildHatId(hatId))`, such as when emitted by `approveLinkTopHatToTree` or `relinkTopHatToTree`\n error NotAdmin(address user, uint256 hatId);\n\n /// @notice Emitted when attempting to perform an action as or for an account that is not a wearer of a given hat\n error NotHatWearer();\n\n /// @notice Emitted when attempting to perform an action that requires being either an admin or wearer of a given hat\n error NotAdminOrWearer();\n\n /// @notice Emitted when attempting to mint `hatId` but `hatId`'s maxSupply has been reached\n error AllHatsWorn(uint256 hatId);\n\n /// @notice Emitted when attempting to create a hat with a level 14 hat as its admin\n error MaxLevelsReached();\n\n /// @notice Emitted when an attempted hat id has empty intermediate level(s)\n error InvalidHatId();\n\n /// @notice Emitted when attempting to mint `hatId` to a `wearer` who is already wearing the hat\n error AlreadyWearingHat(address wearer, uint256 hatId);\n\n /// @notice Emitted when attempting to mint a non-existant hat\n error HatDoesNotExist(uint256 hatId);\n\n /// @notice Emmitted when attempting to mint or transfer a hat that is not active\n error HatNotActive();\n\n /// @notice Emitted when attempting to mint or transfer a hat to an ineligible wearer\n error NotEligible();\n\n /// @notice Emitted when attempting to check or set a hat's status from an account that is not that hat's toggle module\n error NotHatsToggle();\n\n /// @notice Emitted when attempting to check or set a hat wearer's status from an account that is not that hat's eligibility module\n error NotHatsEligibility();\n\n /// @notice Emitted when array arguments to a batch function have mismatching lengths\n error BatchArrayLengthMismatch();\n\n /// @notice Emitted when attempting to mutate or transfer an immutable hat\n error Immutable();\n\n /// @notice Emitted when attempting to change a hat's maxSupply to a value lower than its current supply\n error NewMaxSupplyTooLow();\n\n /// @notice Emitted when attempting to link a tophat to a new admin for which the tophat serves as an admin\n error CircularLinkage();\n\n /// @notice Emitted when attempting to link or relink a tophat to a separate tree\n error CrossTreeLinkage();\n\n /// @notice Emitted when attempting to link a tophat without a request\n error LinkageNotRequested();\n\n /// @notice Emitted when attempting to unlink a tophat that does not have a wearer\n /// @dev This ensures that unlinking never results in a bricked tophat\n error InvalidUnlink();\n\n /// @notice Emmited when attempting to change a hat's eligibility or toggle module to the zero address\n error ZeroAddress();\n\n /// @notice Emmitted when attempting to change a hat's details or imageURI to a string with over 7000 bytes (~characters)\n /// @dev This protects against a DOS attack where an admin iteratively extend's a hat's details or imageURI\n /// to be so long that reading it exceeds the block gas limit, breaking `uri()` and `viewHat()`\n error StringTooLong();\n}\n" + }, + "contracts/interfaces/hats/HatsEvents.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\n// Copyright (C) 2023 Haberdasher Labs\n//\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU Affero General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU Affero General Public License for more details.\n//\n// You should have received a copy of the GNU Affero General Public License\n// along with this program. If not, see .\n\npragma solidity >=0.8.13;\n\ninterface HatsEvents {\n /// @notice Emitted when a new hat is created\n /// @param id The id for the new hat\n /// @param details A description of the Hat\n /// @param maxSupply The total instances of the Hat that can be worn at once\n /// @param eligibility The address that can report on the Hat wearer's status\n /// @param toggle The address that can deactivate the Hat\n /// @param mutable_ Whether the hat's properties are changeable after creation\n /// @param imageURI The image uri for this hat and the fallback for its\n event HatCreated(\n uint256 id,\n string details,\n uint32 maxSupply,\n address eligibility,\n address toggle,\n bool mutable_,\n string imageURI\n );\n\n /// @notice Emitted when a hat wearer's standing is updated\n /// @dev Eligibility is excluded since the source of truth for eligibility is the eligibility module and may change without a transaction\n /// @param hatId The id of the wearer's hat\n /// @param wearer The wearer's address\n /// @param wearerStanding Whether the wearer is in good standing for the hat\n event WearerStandingChanged(\n uint256 hatId,\n address wearer,\n bool wearerStanding\n );\n\n /// @notice Emitted when a hat's status is updated\n /// @param hatId The id of the hat\n /// @param newStatus Whether the hat is active\n event HatStatusChanged(uint256 hatId, bool newStatus);\n\n /// @notice Emitted when a hat's details are updated\n /// @param hatId The id of the hat\n /// @param newDetails The updated details\n event HatDetailsChanged(uint256 hatId, string newDetails);\n\n /// @notice Emitted when a hat's eligibility module is updated\n /// @param hatId The id of the hat\n /// @param newEligibility The updated eligibiliy module\n event HatEligibilityChanged(uint256 hatId, address newEligibility);\n\n /// @notice Emitted when a hat's toggle module is updated\n /// @param hatId The id of the hat\n /// @param newToggle The updated toggle module\n event HatToggleChanged(uint256 hatId, address newToggle);\n\n /// @notice Emitted when a hat's mutability is updated\n /// @param hatId The id of the hat\n event HatMutabilityChanged(uint256 hatId);\n\n /// @notice Emitted when a hat's maximum supply is updated\n /// @param hatId The id of the hat\n /// @param newMaxSupply The updated max supply\n event HatMaxSupplyChanged(uint256 hatId, uint32 newMaxSupply);\n\n /// @notice Emitted when a hat's image URI is updated\n /// @param hatId The id of the hat\n /// @param newImageURI The updated image URI\n event HatImageURIChanged(uint256 hatId, string newImageURI);\n\n /// @notice Emitted when a tophat linkage is requested by its admin\n /// @param domain The domain of the tree tophat to link\n /// @param newAdmin The tophat's would-be admin in the parent tree\n event TopHatLinkRequested(uint32 domain, uint256 newAdmin);\n\n /// @notice Emitted when a tophat is linked to a another tree\n /// @param domain The domain of the newly-linked tophat\n /// @param newAdmin The tophat's new admin in the parent tree\n event TopHatLinked(uint32 domain, uint256 newAdmin);\n}\n" + }, + "contracts/interfaces/hats/IHats.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\n// Copyright (C) 2023 Haberdasher Labs\n//\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU Affero General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU Affero General Public License for more details.\n//\n// You should have received a copy of the GNU Affero General Public License\n// along with this program. If not, see .\n\npragma solidity >=0.8.13;\n\nimport \"./IHatsIdUtilities.sol\";\nimport \"./HatsErrors.sol\";\nimport \"./HatsEvents.sol\";\n\ninterface IHats is IHatsIdUtilities, HatsErrors, HatsEvents {\n function mintTopHat(\n address _target,\n string memory _details,\n string memory _imageURI\n ) external returns (uint256 topHatId);\n\n function createHat(\n uint256 _admin,\n string calldata _details,\n uint32 _maxSupply,\n address _eligibility,\n address _toggle,\n bool _mutable,\n string calldata _imageURI\n ) external returns (uint256 newHatId);\n\n function batchCreateHats(\n uint256[] calldata _admins,\n string[] calldata _details,\n uint32[] calldata _maxSupplies,\n address[] memory _eligibilityModules,\n address[] memory _toggleModules,\n bool[] calldata _mutables,\n string[] calldata _imageURIs\n ) external returns (bool success);\n\n function getNextId(uint256 _admin) external view returns (uint256 nextId);\n\n function mintHat(\n uint256 _hatId,\n address _wearer\n ) external returns (bool success);\n\n function batchMintHats(\n uint256[] calldata _hatIds,\n address[] calldata _wearers\n ) external returns (bool success);\n\n function setHatStatus(\n uint256 _hatId,\n bool _newStatus\n ) external returns (bool toggled);\n\n function checkHatStatus(uint256 _hatId) external returns (bool toggled);\n\n function setHatWearerStatus(\n uint256 _hatId,\n address _wearer,\n bool _eligible,\n bool _standing\n ) external returns (bool updated);\n\n function checkHatWearerStatus(\n uint256 _hatId,\n address _wearer\n ) external returns (bool updated);\n\n function renounceHat(uint256 _hatId) external;\n\n function transferHat(uint256 _hatId, address _from, address _to) external;\n\n /*//////////////////////////////////////////////////////////////\n HATS ADMIN FUNCTIONS\n //////////////////////////////////////////////////////////////*/\n\n function makeHatImmutable(uint256 _hatId) external;\n\n function changeHatDetails(\n uint256 _hatId,\n string memory _newDetails\n ) external;\n\n function changeHatEligibility(\n uint256 _hatId,\n address _newEligibility\n ) external;\n\n function changeHatToggle(uint256 _hatId, address _newToggle) external;\n\n function changeHatImageURI(\n uint256 _hatId,\n string memory _newImageURI\n ) external;\n\n function changeHatMaxSupply(uint256 _hatId, uint32 _newMaxSupply) external;\n\n function requestLinkTopHatToTree(\n uint32 _topHatId,\n uint256 _newAdminHat\n ) external;\n\n function approveLinkTopHatToTree(\n uint32 _topHatId,\n uint256 _newAdminHat,\n address _eligibility,\n address _toggle,\n string calldata _details,\n string calldata _imageURI\n ) external;\n\n function unlinkTopHatFromTree(uint32 _topHatId, address _wearer) external;\n\n function relinkTopHatWithinTree(\n uint32 _topHatDomain,\n uint256 _newAdminHat,\n address _eligibility,\n address _toggle,\n string calldata _details,\n string calldata _imageURI\n ) external;\n\n /*//////////////////////////////////////////////////////////////\n VIEW FUNCTIONS\n //////////////////////////////////////////////////////////////*/\n\n function viewHat(\n uint256 _hatId\n )\n external\n view\n returns (\n string memory details,\n uint32 maxSupply,\n uint32 supply,\n address eligibility,\n address toggle,\n string memory imageURI,\n uint16 lastHatId,\n bool mutable_,\n bool active\n );\n\n function isWearerOfHat(\n address _user,\n uint256 _hatId\n ) external view returns (bool isWearer);\n\n function isAdminOfHat(\n address _user,\n uint256 _hatId\n ) external view returns (bool isAdmin);\n\n function isInGoodStanding(\n address _wearer,\n uint256 _hatId\n ) external view returns (bool standing);\n\n function isEligible(\n address _wearer,\n uint256 _hatId\n ) external view returns (bool eligible);\n\n function getHatEligibilityModule(\n uint256 _hatId\n ) external view returns (address eligibility);\n\n function getHatToggleModule(\n uint256 _hatId\n ) external view returns (address toggle);\n\n function getHatMaxSupply(\n uint256 _hatId\n ) external view returns (uint32 maxSupply);\n\n function hatSupply(uint256 _hatId) external view returns (uint32 supply);\n\n function getImageURIForHat(\n uint256 _hatId\n ) external view returns (string memory _uri);\n\n function balanceOf(\n address wearer,\n uint256 hatId\n ) external view returns (uint256 balance);\n\n function balanceOfBatch(\n address[] calldata _wearers,\n uint256[] calldata _hatIds\n ) external view returns (uint256[] memory);\n\n function uri(uint256 id) external view returns (string memory _uri);\n}\n" + }, + "contracts/interfaces/hats/IHatsIdUtilities.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\n// Copyright (C) 2023 Haberdasher Labs\n//\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU Affero General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU Affero General Public License for more details.\n//\n// You should have received a copy of the GNU Affero General Public License\n// along with this program. If not, see .\n\npragma solidity >=0.8.13;\n\ninterface IHatsIdUtilities {\n function buildHatId(\n uint256 _admin,\n uint16 _newHat\n ) external pure returns (uint256 id);\n\n function getHatLevel(uint256 _hatId) external view returns (uint32 level);\n\n function getLocalHatLevel(\n uint256 _hatId\n ) external pure returns (uint32 level);\n\n function isTopHat(uint256 _hatId) external view returns (bool _topHat);\n\n function isLocalTopHat(\n uint256 _hatId\n ) external pure returns (bool _localTopHat);\n\n function isValidHatId(\n uint256 _hatId\n ) external view returns (bool validHatId);\n\n function getAdminAtLevel(\n uint256 _hatId,\n uint32 _level\n ) external view returns (uint256 admin);\n\n function getAdminAtLocalLevel(\n uint256 _hatId,\n uint32 _level\n ) external pure returns (uint256 admin);\n\n function getTopHatDomain(\n uint256 _hatId\n ) external view returns (uint32 domain);\n\n function getTippyTopHatDomain(\n uint32 _topHatDomain\n ) external view returns (uint32 domain);\n\n function noCircularLinkage(\n uint32 _topHatDomain,\n uint256 _linkedAdmin\n ) external view returns (bool notCircular);\n\n function sameTippyTopHatDomain(\n uint32 _topHatDomain,\n uint256 _newAdminHat\n ) external view returns (bool sameDomain);\n}\n" + }, + "contracts/interfaces/hats/IHatsModuleFactory.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\ninterface IHatsModuleFactory {\n error HatsModuleFactory_ModuleAlreadyDeployed(\n address implementation,\n uint256 hatId,\n bytes otherImmutableArgs,\n uint256 saltNonce\n );\n\n error BatchArrayLengthMismatch();\n\n event HatsModuleFactory_ModuleDeployed(\n address implementation,\n address instance,\n uint256 hatId,\n bytes otherImmutableArgs,\n bytes initData,\n uint256 saltNonce\n );\n\n function HATS() external view returns (address);\n\n function version() external view returns (string memory);\n\n function createHatsModule(\n address _implementation,\n uint256 _hatId,\n bytes calldata _otherImmutableArgs,\n bytes calldata _initData,\n uint256 _saltNonce\n ) external returns (address _instance);\n\n function batchCreateHatsModule(\n address[] calldata _implementations,\n uint256[] calldata _hatIds,\n bytes[] calldata _otherImmutableArgsArray,\n bytes[] calldata _initDataArray,\n uint256[] calldata _saltNonces\n ) external returns (bool success);\n\n function getHatsModuleAddress(\n address _implementation,\n uint256 _hatId,\n bytes calldata _otherImmutableArgs,\n uint256 _saltNonce\n ) external view returns (address);\n\n function deployed(\n address _implementation,\n uint256 _hatId,\n bytes calldata _otherImmutableArgs,\n uint256 _saltNonce\n ) external view returns (bool);\n}\n" + }, + "contracts/interfaces/hats/modules/IHatsElectionsEligibility.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.13;\n\ninterface IHatsElectionsEligibility {\n event ElectionOpened(uint128 nextTermEnd);\n event ElectionCompleted(uint128 termEnd, address[] winners);\n event NewTermStarted(uint128 termEnd);\n event Recalled(uint128 termEnd, address[] accounts);\n\n /// @notice Returns the first second after the current term ends.\n /// @dev Also serves as the id for the current term.\n function currentTermEnd() external view returns (uint128);\n\n /// @notice Returns the first second after the next term ends.\n /// @dev Also serves as the id for the next term.\n function nextTermEnd() external view returns (uint128);\n\n /// @notice Returns the election status (open or closed) for a given term end.\n /// @param termEnd The term end timestamp to query.\n function electionStatus(\n uint128 termEnd\n ) external view returns (bool isElectionOpen);\n\n /// @notice Returns whether a candidate was elected in a given term.\n /// @param termEnd The term end timestamp to query.\n /// @param candidate The address of the candidate.\n function electionResults(\n uint128 termEnd,\n address candidate\n ) external view returns (bool elected);\n\n /// @notice Returns the BALLOT_BOX_HAT constant.\n function BALLOT_BOX_HAT() external pure returns (uint256);\n\n /// @notice Returns the ADMIN_HAT constant.\n function ADMIN_HAT() external pure returns (uint256);\n\n /**\n * @notice Submit the results of an election for a specified term.\n * @dev Only callable by the wearer(s) of the BALLOT_BOX_HAT.\n * @param _termEnd The id of the term for which the election results are being submitted.\n * @param _winners The addresses of the winners of the election.\n */\n function elect(uint128 _termEnd, address[] calldata _winners) external;\n\n /**\n * @notice Submit the results of a recall election for a specified term.\n * @dev Only callable by the wearer(s) of the BALLOT_BOX_HAT.\n * @param _termEnd The id of the term for which the recall results are being submitted.\n * @param _recallees The addresses to be recalled.\n */\n function recall(uint128 _termEnd, address[] calldata _recallees) external;\n\n /**\n * @notice Set the next term and open the election for it.\n * @dev Only callable by the wearer(s) of the ADMIN_HAT.\n * @param _newTermEnd The id of the term that will be opened.\n */\n function setNextTerm(uint128 _newTermEnd) external;\n\n /**\n * @notice Start the next term, updating the current term.\n * @dev Can be called by anyone, but will revert if conditions are not met.\n */\n function startNextTerm() external;\n\n /**\n * @notice Determine the eligibility and standing of a wearer for a hat.\n * @param _wearer The address of the hat wearer.\n * @param _hatId The ID of the hat.\n * @return eligible True if the wearer is eligible for the hat.\n * @return standing True if the wearer is in good standing.\n */\n function getWearerStatus(\n address _wearer,\n uint256 _hatId\n ) external view returns (bool eligible, bool standing);\n}\n" + }, + "contracts/interfaces/IERC6551Registry.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IERC6551Registry {\n /**\n * @dev Creates a token bound account for a non-fungible token.\n *\n * If account has already been created, returns the account address without calling create2.\n *\n * Emits ERC6551AccountCreated event.\n *\n * @return account The address of the token bound account\n */\n function createAccount(\n address implementation,\n bytes32 salt,\n uint256 chainId,\n address tokenContract,\n uint256 tokenId\n ) external returns (address account);\n}\n" + }, + "contracts/interfaces/sablier/IAdminable.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\npragma solidity >=0.8.22;\n\n/// @title IAdminable\n/// @notice Contract module that provides a basic access control mechanism, with an admin that can be\n/// granted exclusive access to specific functions. The inheriting contract must set the initial admin\n/// in the constructor.\ninterface IAdminable {\n /*//////////////////////////////////////////////////////////////////////////\n EVENTS\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @notice Emitted when the admin is transferred.\n /// @param oldAdmin The address of the old admin.\n /// @param newAdmin The address of the new admin.\n event TransferAdmin(address indexed oldAdmin, address indexed newAdmin);\n\n /*//////////////////////////////////////////////////////////////////////////\n CONSTANT FUNCTIONS\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @notice The address of the admin account or contract.\n function admin() external view returns (address);\n\n /*//////////////////////////////////////////////////////////////////////////\n NON-CONSTANT FUNCTIONS\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @notice Transfers the contract admin to a new address.\n ///\n /// @dev Notes:\n /// - Does not revert if the admin is the same.\n /// - This function can potentially leave the contract without an admin, thereby removing any\n /// functionality that is only available to the admin.\n ///\n /// Requirements:\n /// - `msg.sender` must be the contract admin.\n ///\n /// @param newAdmin The address of the new admin.\n function transferAdmin(address newAdmin) external;\n}\n" + }, + "contracts/interfaces/sablier/IERC4096.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 \"@openzeppelin/contracts/interfaces/IERC165.sol\";\nimport {IERC721} from \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\n\n/// @title ERC-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" + }, + "contracts/interfaces/sablier/ISablierV2Lockup.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\npragma solidity >=0.8.22;\n\nimport {IERC4906} from \"./IERC4096.sol\";\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {IERC721Metadata} from \"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\";\nimport {UD60x18} from \"@prb/math/src/UD60x18.sol\";\n\nimport {Lockup} from \"./types/DataTypes.sol\";\nimport {IAdminable} from \"./IAdminable.sol\";\nimport {ISablierV2NFTDescriptor} from \"./ISablierV2NFTDescriptor.sol\";\n\n/// @title ISablierV2Lockup\n/// @notice Common logic between all Sablier V2 Lockup contracts.\ninterface ISablierV2Lockup is\n IAdminable, // 0 inherited components\n IERC4906, // 2 inherited components\n IERC721Metadata // 2 inherited components\n{\n /*//////////////////////////////////////////////////////////////////////////\n EVENTS\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @notice Emitted when the admin allows a new recipient contract to hook to Sablier.\n /// @param admin The address of the current contract admin.\n /// @param recipient The address of the recipient contract put on the allowlist.\n event AllowToHook(address indexed admin, address recipient);\n\n /// @notice Emitted when a stream is canceled.\n /// @param streamId The ID of the stream.\n /// @param sender The address of the stream's sender.\n /// @param recipient The address of the stream's recipient.\n /// @param asset The contract address of the ERC-20 asset to be distributed.\n /// @param senderAmount The amount of assets refunded to the stream's sender, denoted in units of the asset's\n /// decimals.\n /// @param recipientAmount The amount of assets left for the stream's recipient to withdraw, denoted in units of the\n /// asset's decimals.\n event CancelLockupStream(\n uint256 streamId,\n address indexed sender,\n address indexed recipient,\n IERC20 indexed asset,\n uint128 senderAmount,\n uint128 recipientAmount\n );\n\n /// @notice Emitted when a sender gives up the right to cancel a stream.\n /// @param streamId The ID of the stream.\n event RenounceLockupStream(uint256 indexed streamId);\n\n /// @notice Emitted when the admin sets a new NFT descriptor contract.\n /// @param admin The address of the current contract admin.\n /// @param oldNFTDescriptor The address of the old NFT descriptor contract.\n /// @param newNFTDescriptor The address of the new NFT descriptor contract.\n event SetNFTDescriptor(\n address indexed admin,\n ISablierV2NFTDescriptor oldNFTDescriptor,\n ISablierV2NFTDescriptor newNFTDescriptor\n );\n\n /// @notice Emitted when assets are withdrawn from a stream.\n /// @param streamId The ID of the stream.\n /// @param to The address that has received the withdrawn assets.\n /// @param asset The contract address of the ERC-20 asset to be distributed.\n /// @param amount The amount of assets withdrawn, denoted in units of the asset's decimals.\n event WithdrawFromLockupStream(\n uint256 indexed streamId,\n address indexed to,\n IERC20 indexed asset,\n uint128 amount\n );\n\n /*//////////////////////////////////////////////////////////////////////////\n CONSTANT FUNCTIONS\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @notice Retrieves the address of the ERC-20 asset to be distributed.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function getAsset(uint256 streamId) external view returns (IERC20 asset);\n\n /// @notice Retrieves the amount deposited in the stream, denoted in units of the asset's decimals.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function getDepositedAmount(\n uint256 streamId\n ) external view returns (uint128 depositedAmount);\n\n /// @notice Retrieves the stream's end time, which is a Unix timestamp.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function getEndTime(\n uint256 streamId\n ) external view returns (uint40 endTime);\n\n /// @notice Retrieves the stream's recipient.\n /// @dev Reverts if the NFT has been burned.\n /// @param streamId The stream ID for the query.\n function getRecipient(\n uint256 streamId\n ) external view returns (address recipient);\n\n /// @notice Retrieves the amount refunded to the sender after a cancellation, denoted in units of the asset's\n /// decimals. This amount is always zero unless the stream was canceled.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function getRefundedAmount(\n uint256 streamId\n ) external view returns (uint128 refundedAmount);\n\n /// @notice Retrieves the stream's sender.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function getSender(uint256 streamId) external view returns (address sender);\n\n /// @notice Retrieves the stream's start time, which is a Unix timestamp.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function getStartTime(\n uint256 streamId\n ) external view returns (uint40 startTime);\n\n /// @notice Retrieves the amount withdrawn from the stream, denoted in units of the asset's decimals.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function getWithdrawnAmount(\n uint256 streamId\n ) external view returns (uint128 withdrawnAmount);\n\n /// @notice Retrieves a flag indicating whether the provided address is a contract allowed to hook to Sablier\n /// when a stream is canceled or when assets are withdrawn.\n /// @dev See {ISablierLockupRecipient} for more information.\n function isAllowedToHook(\n address recipient\n ) external view returns (bool result);\n\n /// @notice Retrieves a flag indicating whether the stream can be canceled. When the stream is cold, this\n /// flag is always `false`.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function isCancelable(uint256 streamId) external view returns (bool result);\n\n /// @notice Retrieves a flag indicating whether the stream is cold, i.e. settled, canceled, or depleted.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function isCold(uint256 streamId) external view returns (bool result);\n\n /// @notice Retrieves a flag indicating whether the stream is depleted.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function isDepleted(uint256 streamId) external view returns (bool result);\n\n /// @notice Retrieves a flag indicating whether the stream exists.\n /// @dev Does not revert if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function isStream(uint256 streamId) external view returns (bool result);\n\n /// @notice Retrieves a flag indicating whether the stream NFT can be transferred.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function isTransferable(\n uint256 streamId\n ) external view returns (bool result);\n\n /// @notice Retrieves a flag indicating whether the stream is warm, i.e. either pending or streaming.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function isWarm(uint256 streamId) external view returns (bool result);\n\n /// @notice Retrieves the maximum broker fee that can be charged by the broker, denoted as a fixed-point\n /// number where 1e18 is 100%.\n /// @dev This value is hard coded as a constant.\n function MAX_BROKER_FEE() external view returns (UD60x18);\n\n /// @notice Counter for stream IDs, used in the create functions.\n function nextStreamId() external view returns (uint256);\n\n /// @notice Contract that generates the non-fungible token URI.\n function nftDescriptor() external view returns (ISablierV2NFTDescriptor);\n\n /// @notice Calculates the amount that the sender would be refunded if the stream were canceled, denoted in units\n /// of the asset's decimals.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function refundableAmountOf(\n uint256 streamId\n ) external view returns (uint128 refundableAmount);\n\n /// @notice Retrieves the stream's status.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function statusOf(\n uint256 streamId\n ) external view returns (Lockup.Status status);\n\n /// @notice Calculates the amount streamed to the recipient, denoted in units of the asset's decimals.\n /// @dev Reverts if `streamId` references a null stream.\n ///\n /// Notes:\n /// - Upon cancellation of the stream, the amount streamed is calculated as the difference between the deposited\n /// amount and the refunded amount. Ultimately, when the stream becomes depleted, the streamed amount is equivalent\n /// to the total amount withdrawn.\n ///\n /// @param streamId The stream ID for the query.\n function streamedAmountOf(\n uint256 streamId\n ) external view returns (uint128 streamedAmount);\n\n /// @notice Retrieves a flag indicating whether the stream was canceled.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function wasCanceled(uint256 streamId) external view returns (bool result);\n\n /// @notice Calculates the amount that the recipient can withdraw from the stream, denoted in units of the asset's\n /// decimals.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function withdrawableAmountOf(\n uint256 streamId\n ) external view returns (uint128 withdrawableAmount);\n\n /*//////////////////////////////////////////////////////////////////////////\n NON-CONSTANT FUNCTIONS\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @notice Allows a recipient contract to hook to Sablier when a stream is canceled or when assets are withdrawn.\n /// Useful for implementing contracts that hold streams on behalf of users, such as vaults or staking contracts.\n ///\n /// @dev Emits an {AllowToHook} event.\n ///\n /// Notes:\n /// - Does not revert if the contract is already on the allowlist.\n /// - This is an irreversible operation. The contract cannot be removed from the allowlist.\n ///\n /// Requirements:\n /// - `msg.sender` must be the contract admin.\n /// - `recipient` must have a non-zero code size.\n /// - `recipient` must implement {ISablierLockupRecipient}.\n ///\n /// @param recipient The address of the contract to allow for hooks.\n function allowToHook(address recipient) external;\n\n /// @notice Burns the NFT associated with the stream.\n ///\n /// @dev Emits a {Transfer} event.\n ///\n /// Requirements:\n /// - Must not be delegate called.\n /// - `streamId` must reference a depleted stream.\n /// - The NFT must exist.\n /// - `msg.sender` must be either the NFT owner or an approved third party.\n ///\n /// @param streamId The ID of the stream NFT to burn.\n function burn(uint256 streamId) external;\n\n /// @notice Cancels the stream and refunds any remaining assets to the sender.\n ///\n /// @dev Emits a {Transfer}, {CancelLockupStream}, and {MetadataUpdate} event.\n ///\n /// Notes:\n /// - If there any assets left for the recipient to withdraw, the stream is marked as canceled. Otherwise, the\n /// stream is marked as depleted.\n /// - This function attempts to invoke a hook on the recipient, if the resolved address is a contract.\n ///\n /// Requirements:\n /// - Must not be delegate called.\n /// - The stream must be warm and cancelable.\n /// - `msg.sender` must be the stream's sender.\n ///\n /// @param streamId The ID of the stream to cancel.\n function cancel(uint256 streamId) external;\n\n /// @notice Cancels multiple streams and refunds any remaining assets to the sender.\n ///\n /// @dev Emits multiple {Transfer}, {CancelLockupStream}, and {MetadataUpdate} events.\n ///\n /// Notes:\n /// - Refer to the notes in {cancel}.\n ///\n /// Requirements:\n /// - All requirements from {cancel} must be met for each stream.\n ///\n /// @param streamIds The IDs of the streams to cancel.\n function cancelMultiple(uint256[] calldata streamIds) external;\n\n /// @notice Removes the right of the stream's sender to cancel the stream.\n ///\n /// @dev Emits a {RenounceLockupStream} and {MetadataUpdate} event.\n ///\n /// Notes:\n /// - This is an irreversible operation.\n ///\n /// Requirements:\n /// - Must not be delegate called.\n /// - `streamId` must reference a warm stream.\n /// - `msg.sender` must be the stream's sender.\n /// - The stream must be cancelable.\n ///\n /// @param streamId The ID of the stream to renounce.\n function renounce(uint256 streamId) external;\n\n /// @notice Sets a new NFT descriptor contract, which produces the URI describing the Sablier stream NFTs.\n ///\n /// @dev Emits a {SetNFTDescriptor} and {BatchMetadataUpdate} event.\n ///\n /// Notes:\n /// - Does not revert if the NFT descriptor is the same.\n ///\n /// Requirements:\n /// - `msg.sender` must be the contract admin.\n ///\n /// @param newNFTDescriptor The address of the new NFT descriptor contract.\n function setNFTDescriptor(\n ISablierV2NFTDescriptor newNFTDescriptor\n ) external;\n\n /// @notice Withdraws the provided amount of assets from the stream to the `to` address.\n ///\n /// @dev Emits a {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} event.\n ///\n /// Notes:\n /// - This function attempts to call a hook on the recipient of the stream, unless `msg.sender` is the recipient.\n ///\n /// Requirements:\n /// - Must not be delegate called.\n /// - `streamId` must not reference a null or depleted stream.\n /// - `to` must not be the zero address.\n /// - `amount` must be greater than zero and must not exceed the withdrawable amount.\n /// - `to` must be the recipient if `msg.sender` is not the stream's recipient or an approved third party.\n ///\n /// @param streamId The ID of the stream to withdraw from.\n /// @param to The address receiving the withdrawn assets.\n /// @param amount The amount to withdraw, denoted in units of the asset's decimals.\n function withdraw(uint256 streamId, address to, uint128 amount) external;\n\n /// @notice Withdraws the maximum withdrawable amount from the stream to the provided address `to`.\n ///\n /// @dev Emits a {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} event.\n ///\n /// Notes:\n /// - Refer to the notes in {withdraw}.\n ///\n /// Requirements:\n /// - Refer to the requirements in {withdraw}.\n ///\n /// @param streamId The ID of the stream to withdraw from.\n /// @param to The address receiving the withdrawn assets.\n /// @return withdrawnAmount The amount withdrawn, denoted in units of the asset's decimals.\n function withdrawMax(\n uint256 streamId,\n address to\n ) external returns (uint128 withdrawnAmount);\n\n /// @notice Withdraws the maximum withdrawable amount from the stream to the current recipient, and transfers the\n /// NFT to `newRecipient`.\n ///\n /// @dev Emits a {WithdrawFromLockupStream} and a {Transfer} event.\n ///\n /// Notes:\n /// - If the withdrawable amount is zero, the withdrawal is skipped.\n /// - Refer to the notes in {withdraw}.\n ///\n /// Requirements:\n /// - `msg.sender` must be the stream's recipient.\n /// - Refer to the requirements in {withdraw}.\n /// - Refer to the requirements in {IERC721.transferFrom}.\n ///\n /// @param streamId The ID of the stream NFT to transfer.\n /// @param newRecipient The address of the new owner of the stream NFT.\n /// @return withdrawnAmount The amount withdrawn, denoted in units of the asset's decimals.\n function withdrawMaxAndTransfer(\n uint256 streamId,\n address newRecipient\n ) external returns (uint128 withdrawnAmount);\n\n /// @notice Withdraws assets from streams to the recipient of each stream.\n ///\n /// @dev Emits multiple {Transfer}, {WithdrawFromLockupStream}, and {MetadataUpdate} events.\n ///\n /// Notes:\n /// - This function attempts to call a hook on the recipient of each stream, unless `msg.sender` is the recipient.\n ///\n /// Requirements:\n /// - Must not be delegate called.\n /// - There must be an equal number of `streamIds` and `amounts`.\n /// - Each stream ID in the array must not reference a null or depleted stream.\n /// - Each amount in the array must be greater than zero and must not exceed the withdrawable amount.\n ///\n /// @param streamIds The IDs of the streams to withdraw from.\n /// @param amounts The amounts to withdraw, denoted in units of the asset's decimals.\n function withdrawMultiple(\n uint256[] calldata streamIds,\n uint128[] calldata amounts\n ) external;\n}\n" + }, + "contracts/interfaces/sablier/ISablierV2LockupLinear.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\npragma solidity >=0.8.22;\n\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\nimport {Lockup, LockupLinear} from \"./types/DataTypes.sol\";\nimport {ISablierV2Lockup} from \"./ISablierV2Lockup.sol\";\n\n/// @title ISablierV2LockupLinear\n/// @notice Creates and manages Lockup streams with a linear distribution function.\ninterface ISablierV2LockupLinear is ISablierV2Lockup {\n /*//////////////////////////////////////////////////////////////////////////\n EVENTS\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @notice Emitted when a stream is created.\n /// @param streamId The ID of the newly created stream.\n /// @param funder The address which funded the stream.\n /// @param sender The address distributing the assets, which will have the ability to cancel the stream.\n /// @param recipient The address receiving the assets.\n /// @param amounts Struct encapsulating (i) the deposit amount, and (ii) the broker fee amount, both denoted\n /// in units of the asset's decimals.\n /// @param asset The contract address of the ERC-20 asset to be distributed.\n /// @param cancelable Boolean indicating whether the stream will be cancelable or not.\n /// @param transferable Boolean indicating whether the stream NFT is transferable or not.\n /// @param timestamps Struct encapsulating (i) the stream's start time, (ii) cliff time, and (iii) end time, all as\n /// Unix timestamps.\n /// @param broker The address of the broker who has helped create the stream, e.g. a front-end website.\n event CreateLockupLinearStream(\n uint256 streamId,\n address funder,\n address indexed sender,\n address indexed recipient,\n Lockup.CreateAmounts amounts,\n IERC20 indexed asset,\n bool cancelable,\n bool transferable,\n LockupLinear.Timestamps timestamps,\n address broker\n );\n\n /*//////////////////////////////////////////////////////////////////////////\n CONSTANT FUNCTIONS\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @notice Retrieves the stream's cliff time, which is a Unix timestamp. A value of zero means there\n /// is no cliff.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n function getCliffTime(\n uint256 streamId\n ) external view returns (uint40 cliffTime);\n\n /// @notice Retrieves the full stream details.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n /// @return stream See the documentation in {DataTypes}.\n function getStream(\n uint256 streamId\n ) external view returns (LockupLinear.StreamLL memory stream);\n\n /// @notice Retrieves the stream's start, cliff and end timestamps.\n /// @dev Reverts if `streamId` references a null stream.\n /// @param streamId The stream ID for the query.\n /// @return timestamps See the documentation in {DataTypes}.\n function getTimestamps(\n uint256 streamId\n ) external view returns (LockupLinear.Timestamps memory timestamps);\n\n /*//////////////////////////////////////////////////////////////////////////\n NON-CONSTANT FUNCTIONS\n //////////////////////////////////////////////////////////////////////////*/\n\n /// @notice Creates a stream by setting the start time to `block.timestamp`, and the end time to\n /// the sum of `block.timestamp` and `params.durations.total`. The stream is funded by `msg.sender` and is wrapped\n /// in an ERC-721 NFT.\n ///\n /// @dev Emits a {Transfer} and {CreateLockupLinearStream} event.\n ///\n /// Requirements:\n /// - All requirements in {createWithTimestamps} must be met for the calculated parameters.\n ///\n /// @param params Struct encapsulating the function parameters, which are documented in {DataTypes}.\n /// @return streamId The ID of the newly created stream.\n function createWithDurations(\n LockupLinear.CreateWithDurations calldata params\n ) external returns (uint256 streamId);\n\n /// @notice Creates a stream with the provided start time and end time. The stream is funded by `msg.sender` and is\n /// wrapped in an ERC-721 NFT.\n ///\n /// @dev Emits a {Transfer} and {CreateLockupLinearStream} event.\n ///\n /// Notes:\n /// - A cliff time of zero means there is no cliff.\n /// - As long as the times are ordered, it is not an error for the start or the cliff time to be in the past.\n ///\n /// Requirements:\n /// - Must not be delegate called.\n /// - `params.totalAmount` must be greater than zero.\n /// - If set, `params.broker.fee` must not be greater than `MAX_BROKER_FEE`.\n /// - `params.timestamps.start` must be greater than zero and less than `params.timestamps.end`.\n /// - If set, `params.timestamps.cliff` must be greater than `params.timestamps.start` and less than\n /// `params.timestamps.end`.\n /// - `params.timestamps.end` must be in the future.\n /// - `params.recipient` must not be the zero address.\n /// - `msg.sender` must have allowed this contract to spend at least `params.totalAmount` assets.\n ///\n /// @param params Struct encapsulating the function parameters, which are documented in {DataTypes}.\n /// @return streamId The ID of the newly created stream.\n function createWithTimestamps(\n LockupLinear.CreateWithTimestamps calldata params\n ) external returns (uint256 streamId);\n}\n" + }, + "contracts/interfaces/sablier/ISablierV2NFTDescriptor.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\npragma solidity >=0.8.22;\n\nimport {IERC721Metadata} from \"@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol\";\n\n/// @title ISablierV2NFTDescriptor\n/// @notice This contract generates the URI describing the Sablier V2 stream NFTs.\n/// @dev Inspired by Uniswap V3 Positions NFTs.\ninterface ISablierV2NFTDescriptor {\n /// @notice Produces the URI describing a particular stream NFT.\n /// @dev This is a data URI with the JSON contents directly inlined.\n /// @param sablier The address of the Sablier contract the stream was created in.\n /// @param streamId The ID of the stream for which to produce a description.\n /// @return uri The URI of the ERC721-compliant metadata.\n function tokenURI(\n IERC721Metadata sablier,\n uint256 streamId\n ) external view returns (string memory uri);\n}\n" + }, + "contracts/interfaces/sablier/types/DataTypes.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0-or-later\npragma solidity >=0.8.22;\n\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {UD2x18} from \"@prb/math/src/UD2x18.sol\";\nimport {UD60x18} from \"@prb/math/src/UD60x18.sol\";\n\n// DataTypes.sol\n//\n// This file defines all structs used in V2 Core, most of which are organized under three namespaces:\n//\n// - Lockup\n// - LockupDynamic\n// - LockupLinear\n// - LockupTranched\n//\n// You will notice that some structs contain \"slot\" annotations - they are used to indicate the\n// storage layout of the struct. It is more gas efficient to group small data types together so\n// that they fit in a single 32-byte slot.\n\n/// @notice Struct encapsulating the broker parameters passed to the create functions. Both can be set to zero.\n/// @param account The address receiving the broker's fee.\n/// @param fee The broker's percentage fee from the total amount, denoted as a fixed-point number where 1e18 is 100%.\nstruct Broker {\n address account;\n UD60x18 fee;\n}\n\n/// @notice Namespace for the structs used in both {SablierV2LockupLinear} and {SablierV2LockupDynamic}.\nlibrary Lockup {\n /// @notice Struct encapsulating the deposit, withdrawn, and refunded amounts, all denoted in units of the asset's\n /// decimals.\n /// @dev Because the deposited and the withdrawn amount are often read together, declaring them in the same slot\n /// saves gas.\n /// @param deposited The initial amount deposited in the stream, net of broker fee.\n /// @param withdrawn The cumulative amount withdrawn from the stream.\n /// @param refunded The amount refunded to the sender. Unless the stream was canceled, this is always zero.\n struct Amounts {\n // slot 0\n uint128 deposited;\n uint128 withdrawn;\n // slot 1\n uint128 refunded;\n }\n\n /// @notice Struct encapsulating (i) the deposit amount and (ii) the broker fee amount, both denoted in units of the\n /// asset's decimals.\n /// @param deposit The amount to deposit in the stream.\n /// @param brokerFee The broker fee amount.\n struct CreateAmounts {\n uint128 deposit;\n uint128 brokerFee;\n }\n\n /// @notice Enum representing the different statuses of a stream.\n /// @custom:value0 PENDING Stream created but not started; assets are in a pending state.\n /// @custom:value1 STREAMING Active stream where assets are currently being streamed.\n /// @custom:value2 SETTLED All assets have been streamed; recipient is due to withdraw them.\n /// @custom:value3 CANCELED Canceled stream; remaining assets await recipient's withdrawal.\n /// @custom:value4 DEPLETED Depleted stream; all assets have been withdrawn and/or refunded.\n enum Status {\n PENDING,\n STREAMING,\n SETTLED,\n CANCELED,\n DEPLETED\n }\n\n /// @notice A common data structure to be stored in all {SablierV2Lockup} models.\n /// @dev The fields are arranged like this to save gas via tight variable packing.\n /// @param sender The address distributing the assets, with the ability to cancel the stream.\n /// @param startTime The Unix timestamp indicating the stream's start.\n /// @param endTime The Unix timestamp indicating the stream's end.\n /// @param isCancelable Boolean indicating if the stream is cancelable.\n /// @param wasCanceled Boolean indicating if the stream was canceled.\n /// @param asset The contract address of the ERC-20 asset to be distributed.\n /// @param isDepleted Boolean indicating if the stream is depleted.\n /// @param isStream Boolean indicating if the struct entity exists.\n /// @param isTransferable Boolean indicating if the stream NFT is transferable.\n /// @param amounts Struct encapsulating the deposit, withdrawn, and refunded amounts, all denoted in units of the\n /// asset's decimals.\n struct Stream {\n // slot 0\n address sender;\n uint40 startTime;\n uint40 endTime;\n bool isCancelable;\n bool wasCanceled;\n // slot 1\n IERC20 asset;\n bool isDepleted;\n bool isStream;\n bool isTransferable;\n // slot 2 and 3\n Lockup.Amounts amounts;\n }\n}\n\n/// @notice Namespace for the structs used in {SablierV2LockupDynamic}.\nlibrary LockupDynamic {\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupDynamic.createWithDurations} function.\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\n /// the same as `msg.sender`.\n /// @param recipient The address receiving the assets.\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\n /// broker fee, denoted in units of the asset's decimals.\n /// @param asset The contract address of the ERC-20 asset to be distributed.\n /// @param cancelable Indicates if the stream is cancelable.\n /// @param transferable Indicates if the stream NFT is transferable.\n /// @param segments Segments with durations used to compose the dynamic distribution function. Timestamps are\n /// calculated by starting from `block.timestamp` and adding each duration to the previous timestamp.\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\n struct CreateWithDurations {\n address sender;\n address recipient;\n uint128 totalAmount;\n IERC20 asset;\n bool cancelable;\n bool transferable;\n SegmentWithDuration[] segments;\n Broker broker;\n }\n\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupDynamic.createWithTimestamps} function.\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\n /// the same as `msg.sender`.\n /// @param recipient The address receiving the assets.\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\n /// broker fee, denoted in units of the asset's decimals.\n /// @param asset The contract address of the ERC-20 asset to be distributed.\n /// @param cancelable Indicates if the stream is cancelable.\n /// @param transferable Indicates if the stream NFT is transferable.\n /// @param startTime The Unix timestamp indicating the stream's start.\n /// @param segments Segments used to compose the dynamic distribution function.\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\n struct CreateWithTimestamps {\n address sender;\n address recipient;\n uint128 totalAmount;\n IERC20 asset;\n bool cancelable;\n bool transferable;\n uint40 startTime;\n Segment[] segments;\n Broker broker;\n }\n\n /// @notice Segment struct used in the Lockup Dynamic stream.\n /// @param amount The amount of assets to be streamed in the segment, denoted in units of the asset's decimals.\n /// @param exponent The exponent of the segment, denoted as a fixed-point number.\n /// @param timestamp The Unix timestamp indicating the segment's end.\n struct Segment {\n // slot 0\n uint128 amount;\n UD2x18 exponent;\n uint40 timestamp;\n }\n\n /// @notice Segment struct used at runtime in {SablierV2LockupDynamic.createWithDurations}.\n /// @param amount The amount of assets to be streamed in the segment, denoted in units of the asset's decimals.\n /// @param exponent The exponent of the segment, denoted as a fixed-point number.\n /// @param duration The time difference in seconds between the segment and the previous one.\n struct SegmentWithDuration {\n uint128 amount;\n UD2x18 exponent;\n uint40 duration;\n }\n\n /// @notice Struct encapsulating the full details of a stream.\n /// @dev Extends `Lockup.Stream` by including the recipient and the segments.\n struct StreamLD {\n address sender;\n address recipient;\n uint40 startTime;\n uint40 endTime;\n bool isCancelable;\n bool wasCanceled;\n IERC20 asset;\n bool isDepleted;\n bool isStream;\n bool isTransferable;\n Lockup.Amounts amounts;\n Segment[] segments;\n }\n\n /// @notice Struct encapsulating the LockupDynamic timestamps.\n /// @param start The Unix timestamp indicating the stream's start.\n /// @param end The Unix timestamp indicating the stream's end.\n struct Timestamps {\n uint40 start;\n uint40 end;\n }\n}\n\n/// @notice Namespace for the structs used in {SablierV2LockupLinear}.\nlibrary LockupLinear {\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupLinear.createWithDurations} function.\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\n /// the same as `msg.sender`.\n /// @param recipient The address receiving the assets.\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\n /// broker fee, denoted in units of the asset's decimals.\n /// @param asset The contract address of the ERC-20 asset to be distributed.\n /// @param cancelable Indicates if the stream is cancelable.\n /// @param transferable Indicates if the stream NFT is transferable.\n /// @param durations Struct encapsulating (i) cliff period duration and (ii) total stream duration, both in seconds.\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\n struct CreateWithDurations {\n address sender;\n address recipient;\n uint128 totalAmount;\n IERC20 asset;\n bool cancelable;\n bool transferable;\n Durations durations;\n Broker broker;\n }\n\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupLinear.createWithTimestamps} function.\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\n /// the same as `msg.sender`.\n /// @param recipient The address receiving the assets.\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\n /// broker fee, denoted in units of the asset's decimals.\n /// @param asset The contract address of the ERC-20 asset to be distributed.\n /// @param cancelable Indicates if the stream is cancelable.\n /// @param transferable Indicates if the stream NFT is transferable.\n /// @param timestamps Struct encapsulating (i) the stream's start time, (ii) cliff time, and (iii) end time, all as\n /// Unix timestamps.\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\n struct CreateWithTimestamps {\n address sender;\n address recipient;\n uint128 totalAmount;\n IERC20 asset;\n bool cancelable;\n bool transferable;\n Timestamps timestamps;\n Broker broker;\n }\n\n /// @notice Struct encapsulating the cliff duration and the total duration.\n /// @param cliff The cliff duration in seconds.\n /// @param total The total duration in seconds.\n struct Durations {\n uint40 cliff;\n uint40 total;\n }\n\n /// @notice Struct encapsulating the full details of a stream.\n /// @dev Extends `Lockup.Stream` by including the recipient and the cliff time.\n struct StreamLL {\n address sender;\n address recipient;\n uint40 startTime;\n bool isCancelable;\n bool wasCanceled;\n IERC20 asset;\n uint40 endTime;\n bool isDepleted;\n bool isStream;\n bool isTransferable;\n Lockup.Amounts amounts;\n uint40 cliffTime;\n }\n\n /// @notice Struct encapsulating the LockupLinear timestamps.\n /// @param start The Unix timestamp for the stream's start.\n /// @param cliff The Unix timestamp for the cliff period's end. A value of zero means there is no cliff.\n /// @param end The Unix timestamp for the stream's end.\n struct Timestamps {\n uint40 start;\n uint40 cliff;\n uint40 end;\n }\n}\n\n/// @notice Namespace for the structs used in {SablierV2LockupTranched}.\nlibrary LockupTranched {\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupTranched.createWithDurations} function.\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\n /// the same as `msg.sender`.\n /// @param recipient The address receiving the assets.\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\n /// broker fee, denoted in units of the asset's decimals.\n /// @param asset The contract address of the ERC-20 asset to be distributed.\n /// @param cancelable Indicates if the stream is cancelable.\n /// @param transferable Indicates if the stream NFT is transferable.\n /// @param tranches Tranches with durations used to compose the tranched distribution function. Timestamps are\n /// calculated by starting from `block.timestamp` and adding each duration to the previous timestamp.\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\n struct CreateWithDurations {\n address sender;\n address recipient;\n uint128 totalAmount;\n IERC20 asset;\n bool cancelable;\n bool transferable;\n TrancheWithDuration[] tranches;\n Broker broker;\n }\n\n /// @notice Struct encapsulating the parameters of the {SablierV2LockupTranched.createWithTimestamps} function.\n /// @param sender The address distributing the assets, with the ability to cancel the stream. It doesn't have to be\n /// the same as `msg.sender`.\n /// @param recipient The address receiving the assets.\n /// @param totalAmount The total amount of ERC-20 assets to be distributed, including the stream deposit and any\n /// broker fee, denoted in units of the asset's decimals.\n /// @param asset The contract address of the ERC-20 asset to be distributed.\n /// @param cancelable Indicates if the stream is cancelable.\n /// @param transferable Indicates if the stream NFT is transferable.\n /// @param startTime The Unix timestamp indicating the stream's start.\n /// @param tranches Tranches used to compose the tranched distribution function.\n /// @param broker Struct encapsulating (i) the address of the broker assisting in creating the stream, and (ii) the\n /// percentage fee paid to the broker from `totalAmount`, denoted as a fixed-point number. Both can be set to zero.\n struct CreateWithTimestamps {\n address sender;\n address recipient;\n uint128 totalAmount;\n IERC20 asset;\n bool cancelable;\n bool transferable;\n uint40 startTime;\n Tranche[] tranches;\n Broker broker;\n }\n\n /// @notice Struct encapsulating the full details of a stream.\n /// @dev Extends `Lockup.Stream` by including the recipient and the tranches.\n struct StreamLT {\n address sender;\n address recipient;\n uint40 startTime;\n uint40 endTime;\n bool isCancelable;\n bool wasCanceled;\n IERC20 asset;\n bool isDepleted;\n bool isStream;\n bool isTransferable;\n Lockup.Amounts amounts;\n Tranche[] tranches;\n }\n\n /// @notice Struct encapsulating the LockupTranched timestamps.\n /// @param start The Unix timestamp indicating the stream's start.\n /// @param end The Unix timestamp indicating the stream's end.\n struct Timestamps {\n uint40 start;\n uint40 end;\n }\n\n /// @notice Tranche struct used in the Lockup Tranched stream.\n /// @param amount The amount of assets to be unlocked in the tranche, denoted in units of the asset's decimals.\n /// @param timestamp The Unix timestamp indicating the tranche's end.\n struct Tranche {\n // slot 0\n uint128 amount;\n uint40 timestamp;\n }\n\n /// @notice Tranche struct used at runtime in {SablierV2LockupTranched.createWithDurations}.\n /// @param amount The amount of assets to be unlocked in the tranche, denoted in units of the asset's decimals.\n /// @param duration The time difference in seconds between the tranche and the previous one.\n struct TrancheWithDuration {\n uint128 amount;\n uint40 duration;\n }\n}\n" + }, + "contracts/mocks/ERC6551Registry.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IERC6551Registry {\n /**\n * @dev The registry MUST emit the ERC6551AccountCreated event upon successful account creation.\n */\n event ERC6551AccountCreated(\n address account,\n address indexed implementation,\n bytes32 salt,\n uint256 chainId,\n address indexed tokenContract,\n uint256 indexed tokenId\n );\n\n /**\n * @dev The registry MUST revert with AccountCreationFailed error if the create2 operation fails.\n */\n error AccountCreationFailed();\n\n /**\n * @dev Creates a token bound account for a non-fungible token.\n *\n * If account has already been created, returns the account address without calling create2.\n *\n * Emits ERC6551AccountCreated event.\n *\n * @return account The address of the token bound account\n */\n function createAccount(\n address implementation,\n bytes32 salt,\n uint256 chainId,\n address tokenContract,\n uint256 tokenId\n ) external returns (address account);\n\n /**\n * @dev Returns the computed token bound account address for a non-fungible token.\n *\n * @return account The address of the token bound account\n */\n function account(\n address implementation,\n bytes32 salt,\n uint256 chainId,\n address tokenContract,\n uint256 tokenId\n ) external view returns (address account);\n}\n\ncontract ERC6551Registry is IERC6551Registry {\n function createAccount(\n address implementation,\n bytes32 salt,\n uint256 chainId,\n address tokenContract,\n uint256 tokenId\n ) external returns (address) {\n assembly {\n // Memory Layout:\n // ----\n // 0x00 0xff (1 byte)\n // 0x01 registry (address) (20 bytes)\n // 0x15 salt (bytes32) (32 bytes)\n // 0x35 Bytecode Hash (bytes32) (32 bytes)\n // ----\n // 0x55 ERC-1167 Constructor + Header (20 bytes)\n // 0x69 implementation (address) (20 bytes)\n // 0x5D ERC-1167 Footer (15 bytes)\n // 0x8C salt (uint256) (32 bytes)\n // 0xAC chainId (uint256) (32 bytes)\n // 0xCC tokenContract (address) (32 bytes)\n // 0xEC tokenId (uint256) (32 bytes)\n\n // Silence unused variable warnings\n pop(chainId)\n\n // Copy bytecode + constant data to memory\n calldatacopy(0x8c, 0x24, 0x80) // salt, chainId, tokenContract, tokenId\n mstore(0x6c, 0x5af43d82803e903d91602b57fd5bf3) // ERC-1167 footer\n mstore(0x5d, implementation) // implementation\n mstore(0x49, 0x3d60ad80600a3d3981f3363d3d373d3d3d363d73) // ERC-1167 constructor + header\n\n // Copy create2 computation data to memory\n mstore8(0x00, 0xff) // 0xFF\n mstore(0x35, keccak256(0x55, 0xb7)) // keccak256(bytecode)\n mstore(0x01, shl(96, address())) // registry address\n mstore(0x15, salt) // salt\n\n // Compute account address\n let computed := keccak256(0x00, 0x55)\n\n // If the account has not yet been deployed\n if iszero(extcodesize(computed)) {\n // Deploy account contract\n let deployed := create2(0, 0x55, 0xb7, salt)\n\n // Revert if the deployment fails\n if iszero(deployed) {\n mstore(0x00, 0x20188a59) // `AccountCreationFailed()`\n revert(0x1c, 0x04)\n }\n\n // Store account address in memory before salt and chainId\n mstore(0x6c, deployed)\n\n // Emit the ERC6551AccountCreated event\n log4(\n 0x6c,\n 0x60,\n // `ERC6551AccountCreated(address,address,bytes32,uint256,address,uint256)`\n 0x79f19b3655ee38b1ce526556b7731a20c8f218fbda4a3990b6cc4172fdf88722,\n implementation,\n tokenContract,\n tokenId\n )\n\n // Return the account address\n return(0x6c, 0x20)\n }\n\n // Otherwise, return the computed account address\n mstore(0x00, shr(96, shl(96, computed)))\n return(0x00, 0x20)\n }\n }\n\n function account(\n address implementation,\n bytes32 salt,\n uint256 chainId,\n address tokenContract,\n uint256 tokenId\n ) external view returns (address) {\n assembly {\n // Silence unused variable warnings\n pop(chainId)\n pop(tokenContract)\n pop(tokenId)\n\n // Copy bytecode + constant data to memory\n calldatacopy(0x8c, 0x24, 0x80) // salt, chainId, tokenContract, tokenId\n mstore(0x6c, 0x5af43d82803e903d91602b57fd5bf3) // ERC-1167 footer\n mstore(0x5d, implementation) // implementation\n mstore(0x49, 0x3d60ad80600a3d3981f3363d3d373d3d3d363d73) // ERC-1167 constructor + header\n\n // Copy create2 computation data to memory\n mstore8(0x00, 0xff) // 0xFF\n mstore(0x35, keccak256(0x55, 0xb7)) // keccak256(bytecode)\n mstore(0x01, shl(96, address())) // registry address\n mstore(0x15, salt) // salt\n\n // Store computed account address in memory\n mstore(0x00, shr(96, shl(96, keccak256(0x00, 0x55))))\n\n // Return computed account address\n return(0x00, 0x20)\n }\n }\n}\n" + }, + "contracts/mocks/MockContract.sol": { + "content": "//SPDX-License-Identifier: Unlicense\n\npragma solidity ^0.8.19;\n\n/**\n * Mock contract for testing\n */\ncontract MockContract {\n event DidSomething(string message);\n\n error Reverting();\n\n function doSomething() public {\n doSomethingWithParam(\"doSomething()\");\n }\n\n function doSomethingWithParam(string memory _message) public {\n emit DidSomething(_message);\n }\n\n function returnSomething(string memory _s)\n external\n pure\n returns (string memory)\n {\n return _s;\n }\n\n function revertSomething() external pure {\n revert Reverting();\n }\n}\n" + }, + "contracts/mocks/MockDecentHatsUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.28;\n\nimport {DecentHatsModuleUtils} from \"../modules/DecentHatsModuleUtils.sol\";\n\ncontract MockDecentHatsModuleUtils is DecentHatsModuleUtils {\n // Expose the internal _processHat function for testing\n function processRoleHats(CreateRoleHatsParams calldata params) external {\n _processRoleHats(params);\n }\n}\n" + }, + "contracts/mocks/MockHatsElectionsEligibility.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\nimport {IHatsElectionsEligibility} from \"../interfaces/hats/modules/IHatsElectionsEligibility.sol\";\n\ncontract MockHatsElectionsEligibility is IHatsElectionsEligibility {\n // Storage\n mapping(uint128 termEnd => mapping(address candidates => bool elected))\n public electionResults;\n mapping(uint128 termEnd => bool isElectionOpen) public electionStatus;\n uint128 public currentTermEnd;\n uint128 public nextTermEnd;\n\n // Errors\n error AlreadySetup();\n error ElectionNotOpen();\n error InvalidTermEnd();\n error NoActiveElection();\n error ElectionClosed(uint128 termEnd);\n error TermNotEnded();\n error NextTermNotReady();\n error TooManyWinners();\n\n modifier onlyOnce() {\n if (currentTermEnd != 0) revert AlreadySetup();\n _;\n }\n\n function _setUp(bytes calldata _initData) external onlyOnce {\n // decode init data\n uint128 _firstTermEnd = abi.decode(_initData, (uint128));\n require(\n _firstTermEnd > block.timestamp,\n \"First term must end in the future\"\n );\n\n currentTermEnd = _firstTermEnd;\n\n // open the first election\n electionStatus[_firstTermEnd] = true;\n\n // log the first term\n emit ElectionOpened(_firstTermEnd);\n }\n\n function elect(uint128 _termEnd, address[] calldata _winners) external {\n // results can only be submitted for open elections\n if (!electionStatus[_termEnd]) revert ElectionClosed(_termEnd);\n\n // close the election\n electionStatus[_termEnd] = false;\n\n // set the election results\n for (uint256 i; i < _winners.length; ) {\n electionResults[_termEnd][_winners[i]] = true;\n\n unchecked {\n ++i;\n }\n }\n\n // log the election results\n emit ElectionCompleted(_termEnd, _winners);\n }\n\n function recall(uint128 _termEnd, address[] calldata _recallees) external {\n // loop through the accounts and set their election status to false\n for (uint256 i; i < _recallees.length; ) {\n electionResults[_termEnd][_recallees[i]] = false;\n\n unchecked {\n ++i;\n }\n }\n\n emit Recalled(_termEnd, _recallees);\n }\n\n function setNextTerm(uint128 _newTermEnd) external {\n // new term must end after current term\n if (_newTermEnd <= currentTermEnd) revert InvalidTermEnd();\n\n // if next term is already set, its election must still be open\n uint128 next = nextTermEnd;\n if (next > 0 && !electionStatus[next]) revert ElectionClosed(next);\n\n // set the next term\n nextTermEnd = _newTermEnd;\n\n // open the next election\n electionStatus[_newTermEnd] = true;\n\n // log the new term\n emit ElectionOpened(_newTermEnd);\n }\n\n function startNextTerm() external {\n // current term must be over\n if (block.timestamp < currentTermEnd) revert TermNotEnded();\n\n uint128 next = nextTermEnd; // save SLOADs\n\n // next term must be set and its election must be closed\n if (next == 0 || electionStatus[next]) revert NextTermNotReady();\n\n // set the current term to the next term\n currentTermEnd = next;\n\n // clear the next term\n nextTermEnd = 0;\n\n // log the change\n emit NewTermStarted(next);\n }\n\n function getWearerStatus(\n address _wearer,\n uint256 /* _hatId */\n ) public view override returns (bool eligible, bool standing) {\n /// @dev This eligibility module is not concerned with standing, so we default it to good standing\n standing = true;\n\n uint128 current = currentTermEnd; // save SLOAD\n\n if (block.timestamp < current) {\n // if the current term is still open, the wearer is eligible if they have been elected for the current term\n eligible = electionResults[current][_wearer];\n }\n // if the current term is closed, the wearer is not eligible\n }\n\n // // Test helper functions\n // function setWearerStatus(address wearer, bool eligible) external {\n // electionResults[currentTermEnd][wearer] = eligible;\n // }\n\n function BALLOT_BOX_HAT() external pure override returns (uint256) {}\n\n function ADMIN_HAT() external pure override returns (uint256) {}\n}\n" + }, + "contracts/mocks/MockHatsModuleFactory.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport {IHatsModuleFactory} from \"../interfaces/hats/IHatsModuleFactory.sol\";\nimport {MockHatsElectionsEligibility} from \"./MockHatsElectionsEligibility.sol\";\n\ncontract MockHatsModuleFactory is IHatsModuleFactory {\n function createHatsModule(\n address,\n uint256,\n bytes calldata,\n bytes calldata _initData,\n uint256\n ) external override returns (address _instance) {\n // Deploy a new instance of MockHatsElectionsEligibility\n MockHatsElectionsEligibility newModule = new MockHatsElectionsEligibility();\n newModule._setUp(_initData);\n _instance = address(newModule);\n }\n\n function getHatsModuleAddress(\n address _implementation,\n uint256 _hatId,\n bytes calldata _otherImmutableArgs,\n uint256 _saltNonce\n ) external view returns (address) {}\n\n function HATS() external view override returns (address) {}\n\n function version() external view override returns (string memory) {}\n\n function batchCreateHatsModule(\n address[] calldata _implementations,\n uint256[] calldata _hatIds,\n bytes[] calldata _otherImmutableArgsArray,\n bytes[] calldata _initDataArray,\n uint256[] calldata _saltNonces\n ) external override returns (bool success) {}\n\n function deployed(\n address _implementation,\n uint256 _hatId,\n bytes calldata _otherImmutableArgs,\n uint256 _saltNonce\n ) external view override returns (bool) {}\n}\n" + }, + "contracts/mocks/MockLockupLinear.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\nlibrary MockLockupLinear {\n struct CreateWithTimestamps {\n address sender;\n address recipient;\n uint128 totalAmount;\n IERC20 asset;\n bool cancelable;\n bool transferable;\n Timestamps timestamps;\n Broker broker;\n }\n\n struct Timestamps {\n uint40 start;\n uint40 cliff;\n uint40 end;\n }\n\n struct Broker {\n address account;\n uint256 fee;\n }\n\n struct Stream {\n address sender;\n uint40 startTime;\n uint40 endTime;\n uint40 cliffTime;\n bool cancelable;\n bool wasCanceled;\n address asset;\n bool transferable;\n uint128 totalAmount;\n address recipient;\n }\n\n /// @notice Enum representing the different statuses of a stream.\n /// @custom:value0 PENDING Stream created but not started; assets are in a pending state.\n /// @custom:value1 STREAMING Active stream where assets are currently being streamed.\n /// @custom:value2 SETTLED All assets have been streamed; recipient is due to withdraw them.\n /// @custom:value3 CANCELED Canceled stream; remaining assets await recipient's withdrawal.\n /// @custom:value4 DEPLETED Depleted stream; all assets have been withdrawn and/or refunded.\n enum Status {\n PENDING,\n STREAMING,\n SETTLED,\n CANCELED,\n DEPLETED\n }\n}\n" + }, + "contracts/mocks/MockSablierV2LockupLinear.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.22;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {ISablierV2LockupLinear} from \"../interfaces/sablier/ISablierV2LockupLinear.sol\";\nimport {MockLockupLinear} from \"./MockLockupLinear.sol\";\n\ncontract MockSablierV2LockupLinear {\n mapping(uint256 => MockLockupLinear.Stream) public streams;\n uint256 public nextStreamId = 1;\n\n // Add this event declaration at the contract level\n event StreamCreated(\n uint256 streamId,\n address indexed sender,\n address indexed recipient,\n uint128 totalAmount,\n address indexed asset,\n bool cancelable,\n bool transferable,\n uint40 startTime,\n uint40 cliffTime,\n uint40 endTime\n );\n\n function createWithTimestamps(\n MockLockupLinear.CreateWithTimestamps calldata params\n ) external returns (uint256 streamId) {\n require(\n params.asset.transferFrom(\n msg.sender,\n address(this),\n params.totalAmount\n ),\n \"Token transfer failed\"\n );\n\n streamId = nextStreamId++;\n streams[streamId] = MockLockupLinear.Stream({\n sender: params.sender,\n recipient: params.recipient,\n totalAmount: params.totalAmount,\n asset: address(params.asset),\n cancelable: params.cancelable,\n wasCanceled: false,\n transferable: params.transferable,\n startTime: params.timestamps.start,\n cliffTime: params.timestamps.cliff,\n endTime: params.timestamps.end\n });\n\n // Emit the StreamCreated event\n emit StreamCreated(\n streamId,\n params.sender,\n params.recipient,\n params.totalAmount,\n address(params.asset),\n params.cancelable,\n params.transferable,\n params.timestamps.start,\n params.timestamps.cliff,\n params.timestamps.end\n );\n\n return streamId;\n }\n\n function getStream(\n uint256 streamId\n ) external view returns (MockLockupLinear.Stream memory) {\n return streams[streamId];\n }\n\n function withdrawableAmountOf(\n uint256 streamId\n ) public view returns (uint128) {\n MockLockupLinear.Stream memory stream = streams[streamId];\n if (block.timestamp <= stream.startTime) {\n return 0;\n }\n if (block.timestamp >= stream.endTime) {\n return stream.totalAmount;\n }\n return\n uint128(\n (stream.totalAmount * (block.timestamp - stream.startTime)) /\n (stream.endTime - stream.startTime)\n );\n }\n\n function withdrawMax(\n uint256 streamId,\n address to\n ) external returns (uint128 withdrawnAmount) {\n withdrawnAmount = withdrawableAmountOf(streamId);\n MockLockupLinear.Stream storage stream = streams[streamId];\n\n require(\n msg.sender == stream.recipient,\n \"Only recipient can call withdraw\"\n );\n require(\n withdrawnAmount <= withdrawableAmountOf(streamId),\n \"Insufficient withdrawable amount\"\n );\n\n stream.totalAmount -= withdrawnAmount;\n IERC20(stream.asset).transfer(to, withdrawnAmount);\n }\n\n function cancel(uint256 streamId) external {\n MockLockupLinear.Stream memory stream = streams[streamId];\n require(stream.cancelable, \"Stream is not cancelable\");\n require(msg.sender == stream.sender, \"Only sender can cancel\");\n\n uint128 withdrawableAmount = withdrawableAmountOf(streamId);\n uint128 refundAmount = stream.totalAmount - withdrawableAmount;\n\n streams[streamId].wasCanceled = true;\n\n if (withdrawableAmount > 0) {\n IERC20(stream.asset).transfer(stream.recipient, withdrawableAmount);\n }\n if (refundAmount > 0) {\n IERC20(stream.asset).transfer(stream.sender, refundAmount);\n }\n }\n\n function isCancelable(uint256 streamId) external view returns (bool) {\n return streams[streamId].cancelable;\n }\n\n /// @dev Retrieves the stream's status without performing a null check.\n function statusOf(\n uint256 streamId\n ) public view returns (MockLockupLinear.Status) {\n uint256 withdrawableAmount = withdrawableAmountOf(streamId);\n if (withdrawableAmount == 0) {\n return MockLockupLinear.Status.DEPLETED;\n } else if (streams[streamId].wasCanceled) {\n return MockLockupLinear.Status.CANCELED;\n }\n\n if (block.timestamp < streams[streamId].startTime) {\n return MockLockupLinear.Status.PENDING;\n }\n\n if (block.timestamp < streams[streamId].endTime) {\n return MockLockupLinear.Status.STREAMING;\n } else {\n return MockLockupLinear.Status.SETTLED;\n }\n }\n}\n" + }, + "contracts/modules/DecentHatsCreationModule.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.28;\n\nimport {Enum} from \"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\";\nimport {IAvatar} from \"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol\";\nimport {Strings} from \"@openzeppelin/contracts/utils/Strings.sol\";\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {IERC6551Registry} from \"../interfaces/IERC6551Registry.sol\";\nimport {IHats} from \"../interfaces/hats/IHats.sol\";\nimport {LockupLinear, Broker} from \"../interfaces/sablier/types/DataTypes.sol\";\nimport {IHatsModuleFactory} from \"../interfaces/hats/IHatsModuleFactory.sol\";\nimport {IHatsElectionsEligibility} from \"../interfaces/hats/modules/IHatsElectionsEligibility.sol\";\nimport {ModuleProxyFactory} from \"@gnosis.pm/zodiac/contracts/factory/ModuleProxyFactory.sol\";\nimport {ISablierV2LockupLinear} from \"../interfaces/sablier/ISablierV2LockupLinear.sol\";\nimport {DecentHatsModuleUtils} from \"./DecentHatsModuleUtils.sol\";\n\ncontract DecentHatsCreationModule is DecentHatsModuleUtils {\n struct TopHatParams {\n string details;\n string imageURI;\n }\n\n struct AdminHatParams {\n string details;\n string imageURI;\n bool isMutable;\n }\n\n struct CreateTreeParams {\n IHats hatsProtocol;\n IERC6551Registry erc6551Registry;\n IHatsModuleFactory hatsModuleFactory;\n ModuleProxyFactory moduleProxyFactory;\n address keyValuePairs;\n address decentAutonomousAdminImplementation;\n address hatsAccountImplementation;\n address hatsElectionsEligibilityImplementation;\n TopHatParams topHat;\n AdminHatParams adminHat;\n HatParams[] hats;\n }\n\n /* /////////////////////////////////////////////////////////////////////////////\n EXTERNAL FUNCTIONS\n ///////////////////////////////////////////////////////////////////////////// */\n /**\n * @notice For a safe without any roles previously created on it, this function should be called. It sets up the\n * top hat and admin hat, as well as any other hats and their streams that are provided, then transfers the top hat\n * to the calling safe.\n *\n * @notice This contract should be enabled a module on the Safe for which the role(s) are to be created, and disabled after.\n *\n * @dev For each hat that is included, if the hat is:\n * - termed, its stream funds on are targeted directly at the nominated wearer. The wearer should directly call `withdraw-`\n * on the Sablier contract.\n * - untermed, its stream funds are targeted at the hat's smart account. In order to withdraw funds from the stream, the\n * hat's smart account must be the one call to `withdraw-` on the Sablier contract, setting the recipient arg to its wearer.\n *\n * @dev In order for a Safe to seamlessly create roles even if it has never previously created a role and thus has\n * no hat tree, we defer the creation of the hat tree and its setup to this contract. This way, in a single tx block,\n * the resulting topHatId of the newly created hat can be used to create an admin hat and any other hats needed.\n * We also make use of `KeyValuePairs` to associate the topHatId with the Safe.\n *\n * @param treeParams The parameters for creating the Hat Tree with Roles\n */\n function createAndDeclareTree(\n CreateTreeParams calldata treeParams\n ) external {\n // Create Top Hat\n (uint256 topHatId, address topHatAccount) = _processTopHat(\n treeParams.hatsProtocol,\n treeParams.erc6551Registry,\n treeParams.hatsAccountImplementation,\n treeParams.keyValuePairs,\n treeParams.topHat\n );\n\n // Create Admin Hat\n uint256 adminHatId = _processAdminHat(\n treeParams.hatsProtocol,\n treeParams.erc6551Registry,\n treeParams.hatsAccountImplementation,\n topHatId,\n topHatAccount,\n treeParams.moduleProxyFactory,\n treeParams.decentAutonomousAdminImplementation,\n treeParams.adminHat\n );\n\n // Create Role Hats\n _processRoleHats(\n CreateRoleHatsParams({\n hatsProtocol: treeParams.hatsProtocol,\n erc6551Registry: treeParams.erc6551Registry,\n hatsAccountImplementation: treeParams.hatsAccountImplementation,\n topHatId: topHatId,\n topHatAccount: topHatAccount,\n hatsModuleFactory: treeParams.hatsModuleFactory,\n hatsElectionsEligibilityImplementation: treeParams\n .hatsElectionsEligibilityImplementation,\n adminHatId: adminHatId,\n hats: treeParams.hats,\n keyValuePairs: treeParams.keyValuePairs\n })\n );\n }\n\n /* /////////////////////////////////////////////////////////////////////////////\n INTERNAL FUNCTIONS\n ///////////////////////////////////////////////////////////////////////////// */\n\n function _processTopHat(\n IHats hatsProtocol,\n IERC6551Registry erc6551Registry,\n address hatsAccountImplementation,\n address keyValuePairs,\n TopHatParams calldata topHat\n ) internal returns (uint256 topHatId, address topHatAccount) {\n // Call lastTopHatId() and properly decode the response\n (bool success, bytes memory data) = address(hatsProtocol).call(\n abi.encodeWithSignature(\"lastTopHatId()\")\n );\n require(success, \"Failed to get lastTopHatId\");\n topHatId = (abi.decode(data, (uint256)) + 1) << 224;\n\n // Mint Top Hat to the Safe\n IAvatar(msg.sender).execTransactionFromModule(\n address(hatsProtocol),\n 0,\n abi.encodeWithSignature(\n \"mintTopHat(address,string,string)\",\n msg.sender,\n topHat.details,\n topHat.imageURI\n ),\n Enum.Operation.Call\n );\n\n // Create Top Hat's ERC6551 Account\n topHatAccount = erc6551Registry.createAccount(\n hatsAccountImplementation,\n SALT,\n block.chainid,\n address(hatsProtocol),\n topHatId\n );\n\n // Declare Top Hat ID to Safe via KeyValuePairs\n string[] memory keys = new string[](1);\n string[] memory values = new string[](1);\n keys[0] = \"topHatId\";\n values[0] = Strings.toString(topHatId);\n IAvatar(msg.sender).execTransactionFromModule(\n keyValuePairs,\n 0,\n abi.encodeWithSignature(\n \"updateValues(string[],string[])\",\n keys,\n values\n ),\n Enum.Operation.Call\n );\n }\n\n function _processAdminHat(\n IHats hatsProtocol,\n IERC6551Registry erc6551Registry,\n address hatsAccountImplementation,\n uint256 topHatId,\n address topHatAccount,\n ModuleProxyFactory moduleProxyFactory,\n address decentAutonomousAdminImplementation,\n AdminHatParams calldata adminHat\n ) internal returns (uint256 adminHatId) {\n // Create Admin Hat\n adminHatId = hatsProtocol.getNextId(topHatId);\n IAvatar(msg.sender).execTransactionFromModule(\n address(hatsProtocol),\n 0,\n abi.encodeWithSignature(\n \"createHat(uint256,string,uint32,address,address,bool,string)\",\n topHatId,\n adminHat.details,\n 1, // only one Admin Hat\n topHatAccount,\n topHatAccount,\n adminHat.isMutable,\n adminHat.imageURI\n ),\n Enum.Operation.Call\n );\n\n // Create Admin Hat's ERC6551 Account\n erc6551Registry.createAccount(\n hatsAccountImplementation,\n SALT,\n block.chainid,\n address(hatsProtocol),\n adminHatId\n );\n\n // Deploy Decent Autonomous Admin Module, which will wear the Admin Hat\n address autonomousAdmin = moduleProxyFactory.deployModule(\n decentAutonomousAdminImplementation,\n abi.encodeWithSignature(\"setUp(bytes)\", bytes(\"\")),\n uint256(\n keccak256(\n abi.encodePacked(\n // for the salt, we'll concatenate our static salt\n // with the Admin Hat ID\n SALT,\n adminHatId\n )\n )\n )\n );\n\n // Mint Hat to the Decent Autonomous Admin Module\n IAvatar(msg.sender).execTransactionFromModule(\n address(hatsProtocol),\n 0,\n abi.encodeWithSignature(\n \"mintHat(uint256,address)\",\n adminHatId,\n autonomousAdmin\n ),\n Enum.Operation.Call\n );\n }\n}\n" + }, + "contracts/modules/DecentHatsModificationModule.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.28;\n\nimport {DecentHatsModuleUtils} from \"./DecentHatsModuleUtils.sol\";\n\ncontract DecentHatsModificationModule is DecentHatsModuleUtils {\n /**\n * @notice Creates a new termed or untermed role hat and any streams on it.\n *\n * @notice This contract should be enabled a module on the Safe for which the role is to be created, and disabled after.\n *\n * @dev Stream funds on untermed Roles are targeted at the hat's smart account. In order to withdraw funds from the stream, the\n * hat's smart account must be the one call to `withdraw-` on the Sablier contract, setting the recipient arg to its wearer.\n *\n * @dev Stream funds on termed Roles are targeted directly at the nominated wearer.\n * The wearer should directly call `withdraw-` on the Sablier contract.\n *\n * @dev Role hat creation, minting, smart account creation and stream creation are handled here in order\n * to avoid a race condition where not more than one active proposal to create a new role can exist at a time.\n * See: https://github.com/decentdao/decent-interface/issues/2402\n *\n * @param roleHatsParams An array of params for each role hat to be created.\n */\n function createRoleHats(\n CreateRoleHatsParams calldata roleHatsParams\n ) external {\n _processRoleHats(roleHatsParams);\n }\n}\n" + }, + "contracts/modules/DecentHatsModuleUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.28;\n\nimport {Enum} from \"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\";\nimport {IAvatar} from \"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol\";\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {IERC6551Registry} from \"../interfaces/IERC6551Registry.sol\";\nimport {IHats} from \"../interfaces/hats/IHats.sol\";\nimport {LockupLinear, Broker} from \"../interfaces/sablier/types/DataTypes.sol\";\nimport {IHatsModuleFactory} from \"../interfaces/hats/IHatsModuleFactory.sol\";\nimport {ISablierV2LockupLinear} from \"../interfaces/sablier/ISablierV2LockupLinear.sol\";\nimport {Strings} from \"@openzeppelin/contracts/utils/Strings.sol\";\n\nabstract contract DecentHatsModuleUtils {\n bytes32 public constant SALT =\n 0x5d0e6ce4fd951366cc55da93f6e79d8b81483109d79676a04bcc2bed6a4b5072;\n\n struct SablierStreamParams {\n ISablierV2LockupLinear sablier;\n address sender;\n address asset;\n LockupLinear.Timestamps timestamps;\n Broker broker;\n uint128 totalAmount;\n bool cancelable;\n bool transferable;\n }\n\n struct HatParams {\n address wearer;\n string details;\n string imageURI;\n SablierStreamParams[] sablierStreamsParams;\n uint128 termEndDateTs; // If 0, this is an untermed Hat\n uint32 maxSupply;\n bool isMutable;\n }\n\n struct CreateRoleHatsParams {\n IHats hatsProtocol;\n IERC6551Registry erc6551Registry;\n address hatsAccountImplementation;\n uint256 topHatId;\n address topHatAccount;\n address keyValuePairs;\n IHatsModuleFactory hatsModuleFactory;\n address hatsElectionsEligibilityImplementation;\n uint256 adminHatId;\n HatParams[] hats;\n }\n\n function _processRoleHats(\n CreateRoleHatsParams memory roleHatsParams\n ) internal {\n for (uint256 i = 0; i < roleHatsParams.hats.length; ) {\n HatParams memory hatParams = roleHatsParams.hats[i];\n\n // Create eligibility module if needed\n address eligibilityAddress = _createEligibilityModule(\n roleHatsParams.hatsProtocol,\n roleHatsParams.hatsModuleFactory,\n roleHatsParams.hatsElectionsEligibilityImplementation,\n roleHatsParams.topHatId,\n roleHatsParams.topHatAccount,\n roleHatsParams.adminHatId,\n hatParams.termEndDateTs\n );\n\n // Create and Mint the Role Hat\n uint256 hatId = _createAndMintHat(\n roleHatsParams.hatsProtocol,\n roleHatsParams.adminHatId,\n hatParams,\n eligibilityAddress,\n roleHatsParams.topHatAccount\n );\n\n // Get the stream recipient (based on termed or not)\n address streamRecipient = _setupStreamRecipient(\n roleHatsParams.erc6551Registry,\n roleHatsParams.hatsAccountImplementation,\n address(roleHatsParams.hatsProtocol),\n hatParams.termEndDateTs,\n hatParams.wearer,\n hatId\n );\n\n // Create streams\n _processSablierStreams(\n hatParams.sablierStreamsParams,\n streamRecipient,\n roleHatsParams.keyValuePairs,\n hatId\n );\n\n unchecked {\n ++i;\n }\n }\n }\n\n function _createEligibilityModule(\n IHats hatsProtocol,\n IHatsModuleFactory hatsModuleFactory,\n address hatsElectionsEligibilityImplementation,\n uint256 topHatId,\n address topHatAccount,\n uint256 adminHatId,\n uint128 termEndDateTs\n ) private returns (address) {\n // If the Hat is termed, create the eligibility module\n if (termEndDateTs != 0) {\n return\n hatsModuleFactory.createHatsModule(\n hatsElectionsEligibilityImplementation,\n hatsProtocol.getNextId(adminHatId),\n abi.encode(topHatId, uint256(0)), // [BALLOT_BOX_ID, ADMIN_HAT_ID]\n abi.encode(termEndDateTs),\n uint256(SALT)\n );\n }\n\n // Otherwise, return the Top Hat account\n return topHatAccount;\n }\n\n function _createAndMintHat(\n IHats hatsProtocol,\n uint256 adminHatId,\n HatParams memory hat,\n address eligibilityAddress,\n address topHatAccount\n ) private returns (uint256) {\n // Grab the next Hat ID (before creating it)\n uint256 hatId = hatsProtocol.getNextId(adminHatId);\n\n // Create the new Hat\n IAvatar(msg.sender).execTransactionFromModule(\n address(hatsProtocol),\n 0,\n abi.encodeWithSignature(\n \"createHat(uint256,string,uint32,address,address,bool,string)\",\n adminHatId,\n hat.details,\n hat.maxSupply,\n eligibilityAddress,\n topHatAccount,\n hat.isMutable,\n hat.imageURI\n ),\n Enum.Operation.Call\n );\n\n // If the Hat is termed, nominate the wearer as the eligible member\n if (hat.termEndDateTs != 0) {\n address[] memory nominatedWearers = new address[](1);\n nominatedWearers[0] = hat.wearer;\n\n IAvatar(msg.sender).execTransactionFromModule(\n eligibilityAddress,\n 0,\n abi.encodeWithSignature(\n \"elect(uint128,address[])\",\n hat.termEndDateTs,\n nominatedWearers\n ),\n Enum.Operation.Call\n );\n }\n\n // Mint the Hat\n IAvatar(msg.sender).execTransactionFromModule(\n address(hatsProtocol),\n 0,\n abi.encodeWithSignature(\n \"mintHat(uint256,address)\",\n hatId,\n hat.wearer\n ),\n Enum.Operation.Call\n );\n return hatId;\n }\n\n // Exists to avoid stack too deep errors\n function _setupStreamRecipient(\n IERC6551Registry erc6551Registry,\n address hatsAccountImplementation,\n address hatsProtocol,\n uint128 termEndDateTs,\n address wearer,\n uint256 hatId\n ) private returns (address) {\n // If the hat is termed, the wearer is the stream recipient\n if (termEndDateTs != 0) {\n return wearer;\n }\n\n // Otherwise, the Hat's smart account is the stream recipient\n return\n erc6551Registry.createAccount(\n hatsAccountImplementation,\n SALT,\n block.chainid,\n hatsProtocol,\n hatId\n );\n }\n\n function _processSablierStreams(\n SablierStreamParams[] memory streamParams,\n address streamRecipient,\n address keyValuePairs,\n uint256 hatId\n ) private {\n for (uint256 i = 0; i < streamParams.length; ) {\n SablierStreamParams memory sablierStreamParams = streamParams[i];\n\n // Approve tokens for Sablier\n IAvatar(msg.sender).execTransactionFromModule(\n sablierStreamParams.asset,\n 0,\n abi.encodeWithSignature(\n \"approve(address,uint256)\",\n sablierStreamParams.sablier,\n sablierStreamParams.totalAmount\n ),\n Enum.Operation.Call\n );\n uint256 streamId = ISablierV2LockupLinear(\n sablierStreamParams.sablier\n ).nextStreamId();\n\n // Proxy the Sablier call through IAvatar\n IAvatar(msg.sender).execTransactionFromModule(\n address(sablierStreamParams.sablier),\n 0,\n abi.encodeWithSignature(\n \"createWithTimestamps((address,address,uint128,address,bool,bool,(uint40,uint40,uint40),(address,uint256)))\",\n LockupLinear.CreateWithTimestamps({\n sender: sablierStreamParams.sender,\n recipient: streamRecipient,\n totalAmount: sablierStreamParams.totalAmount,\n asset: IERC20(sablierStreamParams.asset),\n cancelable: sablierStreamParams.cancelable,\n transferable: sablierStreamParams.transferable,\n timestamps: sablierStreamParams.timestamps,\n broker: sablierStreamParams.broker\n })\n ),\n Enum.Operation.Call\n );\n\n // Update KeyValuePairs with the stream ID and Hat ID\n string[] memory keys = new string[](1);\n string[] memory values = new string[](1);\n keys[0] = \"hatIdToStreamId\";\n values[0] = string(\n abi.encodePacked(\n Strings.toString(hatId),\n \":\",\n Strings.toString(streamId)\n )\n );\n\n IAvatar(msg.sender).execTransactionFromModule(\n keyValuePairs,\n 0,\n abi.encodeWithSignature(\n \"updateValues(string[],string[])\",\n keys,\n values\n ),\n Enum.Operation.Call\n );\n\n unchecked {\n ++i;\n }\n }\n }\n}\n" + }, + "contracts/modules/DecentSablierStreamManagementModule.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.28;\n\nimport {Enum} from \"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\";\nimport {IAvatar} from \"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol\";\nimport {ISablierV2Lockup} from \"../interfaces/sablier/ISablierV2Lockup.sol\";\nimport {Lockup} from \"../interfaces/sablier/types/DataTypes.sol\";\n\ncontract DecentSablierStreamManagementModule {\n function withdrawMaxFromStream(\n ISablierV2Lockup sablier,\n address recipientHatAccount,\n uint256 streamId,\n address to\n ) public {\n // Check if there are funds to withdraw\n if (sablier.withdrawableAmountOf(streamId) == 0) {\n return;\n }\n\n // Proxy the Sablier withdrawMax call through IAvatar (Safe)\n IAvatar(msg.sender).execTransactionFromModule(\n recipientHatAccount,\n 0,\n abi.encodeWithSignature(\n \"execute(address,uint256,bytes,uint8)\",\n address(sablier),\n 0,\n abi.encodeWithSignature(\n \"withdrawMax(uint256,address)\",\n streamId,\n to\n ),\n 0\n ),\n Enum.Operation.Call\n );\n }\n\n function cancelStream(ISablierV2Lockup sablier, uint256 streamId) public {\n // Check if the stream can be cancelled\n Lockup.Status streamStatus = sablier.statusOf(streamId);\n if (\n streamStatus != Lockup.Status.PENDING &&\n streamStatus != Lockup.Status.STREAMING\n ) {\n return;\n }\n\n IAvatar(msg.sender).execTransactionFromModule(\n address(sablier),\n 0,\n abi.encodeWithSignature(\"cancel(uint256)\", streamId),\n Enum.Operation.Call\n );\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 200 + }, + "evmVersion": "paris", + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 3dd3ff8..7df4607 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@fractal-framework/fractal-contracts", - "version": "1.4.1", + "version": "1.4.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@fractal-framework/fractal-contracts", - "version": "1.4.1", + "version": "1.4.2", "license": "MIT", "dependencies": { "@gnosis.pm/zodiac": "^1.1.4", diff --git a/package.json b/package.json index ab617b1..7fb9f47 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@fractal-framework/fractal-contracts", - "version": "1.4.1", + "version": "1.4.2", "files": [ "publish", "contracts",